From e14201d7434d18d14f1f94d23a60834e85ccbc29 Mon Sep 17 00:00:00 2001 From: Andre Sutherland Date: Sun, 22 Nov 2026 12:46:59 +0000 Subject: [PATCH 1/2] docs: correct the contributing and commit guides Raise the Go and Yarn versions to what go.mod and package.json require, drop the snapshot instructions (no tests use snapshots), say what the integration run needs and that stateio's tests need it, and fix the commit guide's wording for this repo and for dependency commits. Co-Authored-By: Claude Opus 5.5 --- COMMIT_GUIDELINES.md | 6 +++--- CONTRIBUTING.md | 18 +++++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/COMMIT_GUIDELINES.md b/COMMIT_GUIDELINES.md index e5e2504..c51ef8a 100644 --- a/COMMIT_GUIDELINES.md +++ b/COMMIT_GUIDELINES.md @@ -10,13 +10,13 @@ a base for more advanced tooling to allow for efficient searches for decisions a ### Commit types -**The following commit types are supported in the Bluelink project:** +**The following commit types are supported in this repo:** - `fix:` - Should be used for any bug fixes. - `revert:` - Should be used for any commits that revert changes. - `wip:` - Should be used for commits that contain work in progress. - `feat:` - Should be used for any new features added, regardless of the size of the feature. -- `chore:` - Should be used for tasks such as releases or patching dependencies. +- `chore:` - Should be used for tasks such as releases. - `ci:` - Should be used for any work on GitHub Action workflows or scripts used in CI. - `docs:`- Should be used for adding or modifying documentation. - `style:` - Should be used for code formatting commits and linting fixes. @@ -27,7 +27,7 @@ a base for more advanced tooling to allow for efficient searches for decisions a ### Example commit -#### With commit scope +#### Example ```bash git commit -m 'feat: add select component with preview diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fbd020e..56d5493 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,9 +11,9 @@ git config core.hooksPath .githooks ### Requirements -- [Go](https://go.dev/doc/install) >= 1.24.4 +- [Go](https://go.dev/doc/install) >= 1.26.4 (`go.mod`) - [Node.js](https://nodejs.org/en/download/) >= 22.20.0 -- [Yarn](https://yarnpkg.com/getting-started/install) >= 4.3.1 +- [Yarn](https://yarnpkg.com/getting-started/install) 4 (`packageManager` in `package.json`) ### NPM dependencies @@ -44,17 +44,21 @@ To run unit tests only (without integration tests): bash scripts/run-tests.sh ``` -To update test snapshots (if any): +To run tests for a specific package: ```bash -bash scripts/run-tests.sh --update-snapshots +go test -v ./styles/... +go test -v ./config/... ``` -To run tests for a specific package: +`stateio`'s tests, unit tests included, need the integration stack, so `go test ./...` fails +there without it; use `bash scripts/run-tests.sh --integration` for that package. + +The integration run needs docker, the `aws` CLI, `jq` and `curl`, and test credentials for +LocalStack, as CI sets them: ```bash -go test -v ./styles/... -go test -v ./config/... +AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test bash scripts/run-tests.sh --integration ``` ## Linting From 06a19dabbfe72192f7e30efacc32618f95e9ab98 Mon Sep 17 00:00:00 2001 From: Andre Sutherland Date: Sun, 22 Nov 2026 12:47:23 +0000 Subject: [PATCH 2/2] docs: add AGENTS.md for coding agents Adds AGENTS.md, and a CLAUDE.md that imports it. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ CLAUDE.md | 1 + 2 files changed, 106 insertions(+) create mode 100644 AGENTS.md create mode 100644 CLAUDE.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..b8ca9a5 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,105 @@ +# Deploy CLI SDK + +A Go library of commands, TUIs and helpers for the Bluelink CLI (`apps/cli` in bluelink) and +the Celerity CLI (`apps/cli` in celerity). The Bluelink CLI passes a `commands.CLIConfig` +(see `commands/config.go`) and registers stage, deploy, destroy, instances, state and cleanup +with `commands.Setup*Command`; its own `validate` runs `tui/validateui`. The Celerity CLI so +far uses only `config`, `styles`, `engine` and `tui/precommand`, with its own validate TUI, +and its stage, deploy and destroy aren't wired to this SDK yet. + +## Workspace + +This repo is one of NewStack's. NewStack's maintainers develop it alongside the others in a +shared workspace, using the NewStack Claude Code plugin for how work is planned, reviewed, +committed and coordinated across repos. The plugin isn't public, and nothing here depends on it: +this file and the repo's own docs cover what a contribution needs. + +## Layout + +| Path | Holds | +|---|---| +| `commands/` | Command setup, `CLIConfig`, flag and environment variable binding | +| `tui/ui/` | One Bubble Tea app per command or view (`stageui`, `deployui`, `destroyui`, `validateui`, `driftui`, `inspectui`, `listui`, `cleanupui`, `stateexportui`, `stateimportui`); `tui/shared`, `tui/preflight` and the `*util` packages hold what they share | +| `tui/precommand/` | The `PreCommandStep` interface a CLI implements to run a step before a command | +| `ui/` | Reusable components: blueprint and file selection, `splitpane` | +| `headless/`, `jsonout/` | Plain output without a terminal; `--json` output | +| `engine/`, `config/` | Deploy engine client setup; CLI and deploy config loading | +| `stateio/` | State export and import between the engine's memfile or postgres store and export files, local or on S3, GCS or Azure Blob | +| `styles/` | Styles and the Bluelink and Celerity palettes | +| `diagutils/`, `consts/`, `strings/` | Diagnostic formatting, shared constants, string helpers | +| `testutils/` | Test helpers, including a fake deploy engine and `teatest` helpers | + +## Checks + +Commands are in [CONTRIBUTING.md](CONTRIBUTING.md). + +- **Tools:** Go (`go.mod`), `staticcheck` on `PATH` (CI installs `@latest`, so a local copy + can disagree), Node with Yarn 4 for commitlint (`yarn` first; the tracked `.yarnrc.yml` + makes it create `node_modules`). Integration tests also need docker, the `aws` CLI, `jq` + and `curl`; without `jq` or `curl`, the run waits and then fails with "LocalStack readiness + timed out". +- **Lint:** `bash scripts/lint.sh` runs `staticcheck` and `go vet` per package. +- **Tests:** `bash scripts/run-tests.sh` runs every package except `stateio` and `testutils` + with `-race` and coverage. `stateio`'s unit tests run only with `--integration`, and + `go test ./...` fails there without the stack. `--update-snapshots` is accepted, but no + tests use snapshots. + - `--integration` adds `stateio`. It downloads the `libs/blueprint-state` version pinned in + `go.mod`, copies its postgres migrations into `stateio/postgres/` (gitignored), starts + `stateio/docker-compose.test-deps.yml` (LocalStack on 4580, fake-gcs-server on 8185, + Azurite on 10003, postgres on 45434), and stops it on exit. + - Set `AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test`, as CI does. Without them the + script's `aws` calls and the Go S3 client use the shell's credentials (against LocalStack + only), and with none at all the S3 seeding step fails. + - Run one stack at a time: the container names are fixed, so a second checkout's run + clashes with the first. The ports don't clash with Bluelink's stacks. +- **Trying a change in a CLI:** there's no `go.work` here, so point the CLI's module at this + checkout with a temporary `replace`, or a `go.work` outside both repos, and don't commit + either. Bluelink's root `go.work` is committed and doesn't include this repo. +- **Gates:** + - With `git config core.hooksPath .githooks`, pre-commit runs `scripts/lint.sh` over the + whole module on every commit, and commit-msg runs commitlint. + - CI (`ci.yml`) runs lint, `run-tests.sh --integration` and SonarCloud on pull requests and + pushes to `main`. `codeql.yml` runs CodeQL on the same triggers and weekly; + `infrastructure-security.yml` runs actionlint when a workflow or shell script changes, + and weekly. + +## Compatibility + +- **Go API:** pre-1.0 (`bump-minor-pre-major`, so a `feat` or a breaking change bumps the + minor version). Each CLI pins its own version in `go.mod`, and the pins can differ. A + breaking change says in its PR what each CLI must change when it bumps. +- **Command behaviour:** flags, environment variables + (`_[_]_`, bound per flag in `commands/`; not every + flag has one), headless output and `--json` output are what CLI users and their scripts see. Additive only; the CLI docs in bluelink-docs and + celerity-docs (`content/docs/cli/`) describe them. +- **Bluelink libraries:** `libs/blueprint`, `libs/blueprint-state`, `libs/common` and + `libs/deploy-engine-client` are pinned in `go.mod`, so a change in bluelink reaches this + repo only by release and bump. Renovate raises those bumps as bluelink releases and merges + them itself when CI passes. Read the pinned code from the module cache + (`go list -m -f '{{.Dir}}' `), not a checkout. +- **Persisted state:** none of its own. `stateio` reads and writes the engine's memfile and + postgres stores and export files in blueprint-state's format, so it follows bluelink's + stance on persisted state. + +## Conventions + +- Commits: [COMMIT_GUIDELINES.md](COMMIT_GUIDELINES.md), with the types in + `commitlint.config.js`. Scopes are allowed but unused; release-please releases the whole + module as one package. +- Releases: release-please opens the release pull request; merging it tags `vX.Y.Z`. Don't + edit `CHANGELOG.md` or `.release-please-manifest.json` by hand. +- Dependency updates: Renovate (`renovate.json`, run hourly by `renovate.yml`). +- Anything specific to one CLI goes through `CLIConfig` or a factory it passes in (such as + `PreflightFactory`), not a check for the CLI's name. + +## Safety + +- Don't create tags or releases, or merge release pull requests. +- Don't run commands from this SDK against a running deploy engine unless asked: the + maintainer's engine may be serving runs against real cloud accounts. +- `state import` and `state export` bypass the engine and work on the store named in the + engine config file directly; don't point them at the maintainer's engine config. + +## Known mistakes + + diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..43c994c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md