@autohq/cli 0.1.84 → 0.1.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +108 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -21127,7 +21127,7 @@ var init_package = __esm({
21127
21127
  "package.json"() {
21128
21128
  package_default = {
21129
21129
  name: "@autohq/cli",
21130
- version: "0.1.84",
21130
+ version: "0.1.85",
21131
21131
  license: "SEE LICENSE IN README.md",
21132
21132
  publishConfig: {
21133
21133
  access: "public"
@@ -29147,7 +29147,7 @@ var onboardingSkillMarkdown = `# Onboard your user to auto
29147
29147
 
29148
29148
  You are a coding agent running inside the user's repository. Your job is to
29149
29149
  take them from zero to a working auto deployment in one conversation, with
29150
- the least possible friction. Follow the five beats in order, and run every
29150
+ the least possible friction. Follow the six beats in order, and run every
29151
29151
  waiting step in parallel with your own work.
29152
29152
 
29153
29153
  ## Ground rules
@@ -29199,7 +29199,8 @@ get me into your Slack." Then, without waiting:
29199
29199
  Build a repo dossier while the clicks happen. Explore the codebase and git
29200
29200
  history for:
29201
29201
 
29202
- - Stack and layout: languages, frameworks, build and test setup, CI config.
29202
+ - Stack and layout: languages, frameworks, build and test setup, CI and
29203
+ deploy workflows (Beat 6 wires into these).
29203
29204
  - How the team works: PR conventions, review patterns, branch and release
29204
29205
  habits, merge frequency.
29205
29206
  - Tools referenced: issue tracker keys in commits and branches, chat or
@@ -29280,6 +29281,102 @@ one workflow. Then:
29280
29281
  5. Apply with \`auto apply\` and confirm the trigger is active. Route the
29281
29282
  workflow's reports to the Slack channel from Beat 2.
29282
29283
 
29284
+ ## Beat 6: Wire CI to apply on merge
29285
+
29286
+ Every apply so far ran from this terminal under the user's own login. Its
29287
+ durable home is CI: a dry-run plan as a check on every PR, and the real
29288
+ apply when changes merge \u2014 \`.auto/\` ships the same way the code does. Do
29289
+ this once the GitHub App is connected and the first apply has succeeded.
29290
+
29291
+ 1. CI authenticates as a service account, never as the user. Create two \u2014
29292
+ the \`applier\` token lives only on the merge path, while the \`read-only\`
29293
+ token is exposed to PR-triggered runs: it can produce the dry-run plan
29294
+ but cannot perform a real apply, and it stays revocable on its own. Pipe
29295
+ each token straight into a GitHub secret so it never touches your
29296
+ transcript or disk \u2014 with \`pipefail\` and \`jq -re\` so a failed create
29297
+ cannot silently store an empty secret:
29298
+
29299
+ \`\`\`sh
29300
+ set -o pipefail
29301
+ auto service-account create github-actions-auto-apply \\
29302
+ --preset applier --json \\
29303
+ | jq -re .token | gh secret set AUTO_APPLY_SERVICE_ACCOUNT_TOKEN
29304
+ auto service-account create github-actions-auto-apply-dry-run \\
29305
+ --preset read-only --json \\
29306
+ | jq -re .token | gh secret set AUTO_APPLY_DRY_RUN_SERVICE_ACCOUNT_TOKEN
29307
+ \`\`\`
29308
+
29309
+ Confirm both pipelines exited 0 and \`gh secret list\` shows both names
29310
+ before moving on. If deploys go through a GitHub environment, scope the
29311
+ apply secret to it (\`gh secret set --env\`).
29312
+ 2. Fit into the deploy process you mapped in Beat 3. If a workflow already
29313
+ ships merges, splice two steps in after its deploy succeeds \u2014 plan
29314
+ (\`auto apply --dry-run\`), then \`auto apply\` \u2014 reusing its checkout and
29315
+ Node setup. If nothing deploys from CI yet, add the standalone workflow
29316
+ below. Either way, keep the PR dry-run check: it shows reviewers the
29317
+ exact create/update/archive plan their merge will execute.
29318
+ 3. Workflow files live outside \`.auto/\`, so show the user the file and get
29319
+ a yes; commit it on the same branch as the \`.auto/\` resources.
29320
+
29321
+ \`\`\`yaml
29322
+ name: Auto Apply
29323
+
29324
+ # Both triggers assume the default branch is main; swap in the repo's
29325
+ # actual default branch before committing.
29326
+ on:
29327
+ pull_request:
29328
+ branches: [main]
29329
+ push:
29330
+ branches: [main]
29331
+
29332
+ permissions:
29333
+ contents: read
29334
+
29335
+ concurrency:
29336
+ group: auto-apply-\${{ github.event.pull_request.number || github.ref }}
29337
+ cancel-in-progress: \${{ github.event_name == 'pull_request' }}
29338
+
29339
+ jobs:
29340
+ plan:
29341
+ runs-on: ubuntu-latest
29342
+ timeout-minutes: 10
29343
+ steps:
29344
+ - uses: actions/checkout@v4
29345
+ - uses: actions/setup-node@v4
29346
+ with:
29347
+ node-version: lts/*
29348
+ - run: npx -y --package=@autohq/cli auto apply --dry-run
29349
+ env:
29350
+ AUTO_API_TOKEN: \${{ secrets.AUTO_APPLY_DRY_RUN_SERVICE_ACCOUNT_TOKEN }}
29351
+
29352
+ apply:
29353
+ if: \${{ github.event_name == 'push' }}
29354
+ needs: plan
29355
+ runs-on: ubuntu-latest
29356
+ timeout-minutes: 10
29357
+ steps:
29358
+ - uses: actions/checkout@v4
29359
+ - uses: actions/setup-node@v4
29360
+ with:
29361
+ node-version: lts/*
29362
+ - run: npx -y --package=@autohq/cli auto apply
29363
+ env:
29364
+ AUTO_API_TOKEN: \${{ secrets.AUTO_APPLY_SERVICE_ACCOUNT_TOKEN }}
29365
+ \`\`\`
29366
+
29367
+ Adapt it to the repo: the default branch name, the team's Node setup or
29368
+ pinned tool versions, and set \`AUTO_API_BASE_URL\` only if the project runs
29369
+ against a non-default Auto host. \`pull_request\` runs from forks do not
29370
+ receive secrets; if fork PRs are routine here, run the dry-run from a
29371
+ \`pull_request_target\` workflow that checks out workflow code from the base
29372
+ branch and only \`.auto/\` from the PR head.
29373
+
29374
+ After the PR merges, watch the first run and confirm its plan reports the
29375
+ resources you already applied as unchanged. From then on, \`.auto/\` on the
29376
+ default branch is the source of truth \u2014 directory apply prunes resources
29377
+ that are no longer declared, so the team changes agents by PR, not by
29378
+ terminal.
29379
+
29283
29380
  ## Workflow playbook
29284
29381
 
29285
29382
  Candidates, strongest signals, and what confirms fit:
@@ -29305,15 +29402,20 @@ out loud when proposing.
29305
29402
  the install is approved, and have the concierge retry.
29306
29403
  - Sign-in stalls: the user may not have an invite yet; point them at the
29307
29404
  auto site and pause gracefully rather than failing.
29405
+ - \`gh secret set\` fails (no repo admin rights, gh not authenticated):
29406
+ leave the CI workflow in the PR anyway and hand the user the two
29407
+ create-and-pipe commands from Beat 6 to run themselves. Tokens are shown
29408
+ once and must never be pasted into the conversation.
29308
29409
  - A command disagrees with this document: the command is right. Re-read
29309
29410
  \`auto --help\` and adapt.
29310
29411
 
29311
29412
  ## What you leave behind
29312
29413
 
29313
29414
  - \`.auto/\` committed on a branch with a PR the user can merge: the
29314
- concierge and workflow session YAML plus \`context.md\` (the distilled
29315
- dossier). Write the PR description for teammates \u2014 it doubles as the
29316
- announcement that this repo now has an auto agent.
29415
+ concierge and workflow session YAML, the CI apply workflow from Beat 6,
29416
+ plus \`context.md\` (the distilled dossier). Write the PR description for
29417
+ teammates \u2014 it doubles as the announcement that this repo now has an
29418
+ auto agent.
29317
29419
  - With the user's opt-in, an AGENTS.md section that tells every future
29318
29420
  coding agent in this repo that auto exists, what is deployed, and how to
29319
29421
  add workflows.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.84",
3
+ "version": "0.1.85",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"