{"id":18263870,"url":"https://github.com/atomist/sdm-local","last_synced_at":"2025-07-18T11:11:44.221Z","repository":{"id":33043229,"uuid":"136576987","full_name":"atomist/sdm-local","owner":"atomist","description":"Local software delivery machine support","archived":false,"fork":false,"pushed_at":"2022-05-28T17:45:23.000Z","size":4761,"stargazers_count":13,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-20T19:07:39.505Z","etag":null,"topics":["node"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atomist.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null}},"created_at":"2018-06-08T06:35:28.000Z","updated_at":"2024-09-03T08:15:58.000Z","dependencies_parsed_at":"2022-08-20T17:31:39.148Z","dependency_job_id":null,"html_url":"https://github.com/atomist/sdm-local","commit_stats":null,"previous_names":[],"tags_count":1351,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomist%2Fsdm-local","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomist%2Fsdm-local/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomist%2Fsdm-local/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomist%2Fsdm-local/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atomist","download_url":"https://codeload.github.com/atomist/sdm-local/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247246404,"owners_count":20907789,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["node"],"created_at":"2024-11-05T11:12:58.509Z","updated_at":"2025-04-04T20:31:25.089Z","avatar_url":"https://github.com/atomist.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://images.atomist.com/sdm/SDM-Logo-Dark.png\"\u003e\n\u003c/p\u003e\n\n# Software Delivery Machine - Local - `@atomist/sdm-local`\n\n[![atomist sdm goals](http://badge.atomist.com/T29E48P34/atomist/sdm-local/c9f93c3b-3cfb-4824-a590-15e7a5743a2d)](https://app.atomist.com/workspace/T29E48P34)\n[![npm version](https://img.shields.io/npm/v/@atomist/sdm-local.svg)](https://www.npmjs.com/package/@atomist/sdm-local)\n\nA **Software Delivery Machine** (SDM) helps you write and deliver code that is up to your own standards, at scale.\nThis project runs a software delivery sdm.machine locally on your sdm.machine, responding to your commands and your commits.\n\nFor instance:\n\n- Every time you make a commit, perform a build in the background, and tell you if it fails.\n- every time you make a commit, fix trivial linting errors.\n- at your command, perform common code changes that you program (such as upgrade a library). It can do this across all the repositories you have checked out, and tell you if this causes any build failures.\n- at your command, create a new project by copying and modifying a working project you already have.\n\nFor more information on software delivery machines, see Rod Johnson's blog [Why you need a Software Delivery Machine](https://the-composition.com/why-you-need-a-software-delivery-machine-85e8399cdfc0). This [video](https://vimeo.com/260496136) shows an SDM in action. \nThe blogs and videos show an SDM that connects to Atomist's cloud service. This repository contains a *local* software delivery sdm.machine that works on your development sdm.machine and responds to your commits, performing whatever actions you decide\nshould happen in response to new code. \n \nThe SDM framework understands code and delivery flows. Further description is in the Atomist [sdm library project](https://github.com/atomist/sdm).\n\n\u003e This project is purely\nopen source and can be used without the\nAtomist service. However, the code you write it can\nrun unchanged to benefit your entire team if you do\nconnect to the Atomist service, as the `SoftwareDeliveryMachine` API is identical between local and cloud SDMs.\n\n## Quick Start\n\n### Prerequisites\n\n- Node (version??)\n\n### Steps\n\nInstall the atomist CLI with the following command.\n\n```\nnpm i -g @atomist/cli\n```\n\nUse the following command to create a new SDM:\n\n```\natomist create sdm\n```\n\nThis will create a new SDM instance in a git repository on your local drive, by default under `\u003cuser home\u003e/atomist/\u003corg\u003e`.\n\nIn order to see what's happening across all your automation clients, start a local listener to the Atomist lifecycle feed. This plays the same role as Atomist lifecycle in Slack, showing activity on your repositories. The console will display messages:\n\n```\natomist feed\n``` \n\n*Optional*: You likely want CD for your own SDMs. (Otherwise, you can start and stop them yourselves, for example in your IDE.) SDM CD requires special support as an SDM would need to shut itself down to deliver itself. Thus there is a command to run a dedicated SDM to deliver other SDMs. Start it as follows:\n\n```\natomist deliver\n```\n\n## Usage\n\n### Overview\n\nYou customize an SDM to work with the code \nyou care about: fix formatting errors (with commits), perform code reviews, run tests, publish artifacts, etc.\n\nIt also responds to your commands: to create new projects, edit code in existing projects, or other actions\nyou program into it.\n\nThe instructions here will take you through \n\n   * Initializing your local SDM\n   * Seeing it react to a push, then changing how it reacts to your push\n   * Creating a new project with a generator\n   * Changing to project creation to work from a project of your choice\n   * Invoking a *code transform* to change code in one or more projects, then writing your own code transfor\n   * Running a command, then making your own commands\n\nLater, when they've proven useful, you can elevate your push reactions, generators, editors, \nand commands into the cloud for your whole team to use with [Atomist](https://www.atomist.com).\n\nHere is an architecture diagram:\n\n![architecture diagram](docs/local-sdm.png)\n\n### Setup\n\nTo create your local SDM, execute:\n\n```\natomist create sdm\n```\n\nThe SDM works only on `git` repositories.\n\nTo find projects on your filesystem, the SDM looks in directories group by owner (on GitHub, the owner is an organization\nor user; on BitBucket, the owner is a user or a BitBucket Project), and it looks for each owner directory\n under one parent directory.\n\nThe directory structure looks like this:\n\n```\n$ATOMIST_ROOT\n├── owner1\n│   ├── repo1\n│   └── repo2\n└── owner2\n    ├── repo3\n    └── repo4\n\n```\n`ATOMIST_ROOT` defaults to `\u003cuser home\u003e/atomist`. \n\n3) Send commit events from your repositories to your SDM. See \"Configure existing projects\" below. TODO: test this. how does it know\n \n### Startup\n\nInstall the cli: `npm install -g @atomist/cli`\n\nStart your SDM in local mode by setting an environment variable and then invoking the atomist CLI. `ATOMIST_MODE=local atomist start`. The SDM will run in the background, listening for commands and events. This terminal will display logs.\n\nTrigger commands with `atomist \u003ccommand\u003e` in another terminal. Try `atomist say hello`! Your SDM will send messages right back to where you ran the command.\n\nEvents are triggered by git postCommit hooks. Messages from events don't come back to wherever you made the commit. Instead: \n\n#### See messages from events \n\nIn order to see messages from events (not interspersed with logs), activate a message listener in another terminal:\n\n```\natomist feed\n\n```\nYou can narrow down messages with the `channel` option. For example, this will display only messages to the given two services:\n\n```\natomist feed --channel=AccountService --channel=BillingService\n```\nYou can use the `--verbose` flag to show more information about command invocation. This is particularly useful when developing your SDM.\n\n#### Configure Existing Projects\n\nIf you already have repositories cloned under your $SDM_PROJECTS_ROOT, configure them to activate the local SDM\non commit.\n\nAdd the Atomist git hook to the existing git projects within this directory structure by \nrunning the following command:\n\n```\natomist add git hooks\n```\n\nSuccess will result in output like the following:\n\n```==\u003e @atomist add-git-hooks\n2018-06-06T11:23:58.003Z [m:85087] [info ] Adding extension pack 'WellKnownGoals' version 0.1.0 from Atomist\n2018-06-06T11:23:58.051Z [m:85087] [info ] Searching under child directory [spring-team] of /Users/rodjohnson/temp/local-sdm\n2018-06-06T11:23:58.052Z [m:85087] [info ] Searching under child directory [undefined] of /Users/rodjohnson/temp/local-sdm\n2018-06-06T11:23:58.053Z [m:85087] [info ] Searching under child directory [x] of /Users/rodjohnson/temp/local-sdm\n2018-06-06T11:23:58.074Z [m:85087] [info ] addGitHooks: Adding git post-commit script to project at /Users/rodjohnson/temp/local-sdm/spring-team/danger-mouse\n2018-06-06T11:23:58.076Z [m:85087] [info ] addGitHooks: Adding git post-commit script to project at /Users/rodjohnson/temp/local-sdm/spring-team/fiddlesticks\n2018-06-06T11:23:58.077Z [m:85087] [info ] addGitHooks: Adding git post-commit script to project at /Users/rodjohnson/temp/local-sdm/spring-team/foo\n2018-06-06T11:23:58.078Z [m:85087] [info ] addGitHooks: Adding git post-commit script to project at /Users/rodjohnson/temp/local-sdm/spring-team/losgatos1\n2018-06-06T11:23:58.079Z [m:85087] [info ] addGitHooks: Adding git post-commit script to project at /Users/rodjohnson/temp/local-sdm/spring-team/spring-rest-seed\n2018-06-06T11:23:58.080Z [m:85087] [info ] addGitHooks: Adding git post-commit script to project at /Users/rodjohnson/temp/local-sdm/x/y\n```\n\n\u003e Running `atomist add git hooks` is only necessary for pre-existing cloned directories and directories that are cloned using `git` rather than the local SDM.\n\n## Reacting to commits\n\nA software delivery sdm.machine reacts to code changes. For instance, when you commit to a Spring Boot application, it can \nstart the app up locally, while running tests.\nWhen you commit to a Node library, it can publish a snapshot to npm, while running tests, and while fixing any formatting\nerrors and performing automated code review and identifying sensitive changes.\n\nMake a commit in any repository within $SDM_PROJECTS_ROOT, and the SDM will run immediately. \n\nCommits to managed repos generate Atomist *push* events.\n\n# Adding to your SDM\n\n\u003e The API is identical to the API of a cloud-connected Atomist SDM.\n\n## Adding projects\nFurther projects can be added under the expanded directory tree in three ways:\n\n### Normal git Clone\n\nCloning any git project from anywhere under `$ATOMIST_ROOT` and running `atomist add git hooks` to add git hooks to it.\n\n### Symbolic Link\nGo to the correct organization directory, creating it if necessary. Then create a symlink to the required directory elsewhere on your sdm.machine. For example:\n\n```\nln -s /Users/rodjohnson/sforzando-dev/idea-projects/flight1\n```\nThen run `atomist add git hooks` and the linked project will be treated as a normal project.\n\n### 'atomist clone' Command\n\nThe easiest way to add an existing project to your SDM projects is: run the `atomist clone` command to clone a \nGitHub.com repository in the right place in the expanded tree and automatically install the git hooks:\n\n```\natomist clone https://github.com/\u003cowner\u003e/\u003crepo\u003e\n\n```\nThe arguments are the same as those to `git clone`.\n\nThis is the recommended way, as it will run Atomist onboarding events for a new repo.\n\nOutput will look as follows:\n\n```\n018-06-06T11:27:27.068Z [m:85220] [info ] Adding extension pack 'WellKnownGoals' version 0.1.0 from Atomist\n2018-06-06T11:27:27.116Z [m:85220] [info ] Adding GitHub project johnsonr/initializr\nCloning into 'initializr'...\nwarning: redirecting to https://github.com/johnsonr/initializr/\n2018-06-06T11:27:33.349Z [m:85220] [info ] addGitHooks: Adding git post-commit script to project at /Users/rodjohnson/temp/local-sdm/johnsonr/initializr\n```\n\n## Running Commands\n\nAll commands (\"skills\") on connected SDMs will be shown by the following command:\n\n```\natomist show skills\n```\n\nThe CLI exposes the \"intents\" of all commands based on their command registrations. Type in intents as follows to activate the command:\n\n```\natomist create spring\n```\n\nNo parameters beyond the command name are required to invoke an intent. However, command-specific parameters may be provided in options syntax.\n\n\u003e Clashing intents cause ambiguity, which will be flagged in a warning message. Try to avoid clashing intents between your commands, within or across SDMs.\n\n## Architecture\n\nThis project consists of four parts:\n\n- One or more Atomist SDMs running in their own processes, in a special local mode\n- A command line, exposed as a Node binary.\n- `git` hooks inserted in those projects you wish to use the local SDM with.\n- A feed listener process which, if running, will display all messages from the SDMs and some diagnostic information.\n\n## Troubleshooting\n\n- *My command isn't accepted by the CLI, nor shown in the usage message of `atomist --help`*: Check that the relevant SDM is running in local mode. The list of commands (beyond the built-in commands) is built dynamically on every invocation, so if the relevant SDM isn't running the SDM will not respond to those commands.\n\n\n## Advanced Setup\n\n### Mapped Parameters and Secrets\nEnvironment variables\n\n- `ATOMIST_ROOT`: Default system-wide location for Atomist expanded directory tree. Defaults to `\u003cuser home\u003e/atomist`\n- `ATOMIST_GITHOOK_VERBOSE`: Make Atomist git hooks synchronous (although they will never block a git action, and display output to the console\n\n- `ATOMIST_TEAMS`: Shared with Atomist cloud service. Comma-separated list of teams we will use.\n\n- `SLACK_TEAM`\n- `SLACK_USER_NAME`\n\n### Required Ports\n\nThe following ports are required:\n\n- `2866`: The default port for your Automation client. By default ports 2866-2876 are regularly checked for running automation clients, so if you restrict your clients to these ports you do not need to configure anything.\n- `6660`: The default port for listening to all Atomist messages\n- [Port range above `10000`]: Atomist will find free ports for routing messages back to command line. These ports will be used only during command execution.\n\n\u003e To start additional automation clients, increment the port by 1 for each after 2866.\n\n## Roadmap\n\n- Decide how to get build results from external tools in (if we wish to)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomist%2Fsdm-local","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatomist%2Fsdm-local","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomist%2Fsdm-local/lists"}