onboard.sh detect <repo-dir> — deterministic repo-facts probe the install session builds on #59

Closed
opened 2026-08-24 17:14:47 +00:00 by ben · 2 comments
Owner

Sub-project 4 of the agent-driven install-session arc (Ben, 2026-08-21; docs/superpowers/specs/2026-08-21-vendor-command-design.md §Context). Sub-projects 2 (vendor), 1 (policy + rendering) and 3 (host enrolment) are closed — every mechanical step exists as an onboard.sh subcommand. This sub-project adds the missing probes and the instruction layer that drives them as ONE agent session on the target host.

What

onboard.sh detect <repo-dir> prints the facts every later step consumes, as KEY=value lines on stdout (parseable AND human-readable, same discipline as swarm.config):

  • DETECT_SLUG (from origin's URL; empty + a WARNING line if no forge remote),
  • DETECT_STACKS (node/go joinable exactly as onboard.sh dockerfile accepts — presence of package.json/lockfiles, go.mod; none when neither),
  • DETECT_PKG_MANAGER + pin (pnpm/npm/yarn from lockfile; the Dockerfile stack layer needs the pin),
  • DETECT_DEFAULT_BRANCH,
  • DETECT_SANDCASTLE (absent | present:<FACTORY_REF> | present:unpinned),
  • DETECT_LABELS (minted:<n> when FORGEJO_TOKEN is set and the core set exists, missing, or unchecked without a token — never a hard failure),
  • DETECT_E2E_TIER_SUGGESTION (opt-out unless the repo carries an obvious journey/e2e dir — a suggestion line, the human still answers e2e-tier's mandatory question).

Read-only: detect never writes. Unknown is a value (unchecked/none), not an error; exit 0 unless <repo-dir> is not a git checkout (exit 2).

Tests

onboarding/tests/onboard-lib-test.sh (or a new detect-test.sh): fixture trees for node-pnpm, go, node+go, bare; no-remote WARNING; labels unchecked without token vs minted with shimmed curl; non-checkout exit 2. Offline, shimmed curl only.

Acceptance

  • Run against this repo: DETECT_STACKS=node, DETECT_PKG_MANAGER=pnpm@…, DETECT_SANDCASTLE=present:<current pin>, exit 0. Full suite green.
_Sub-project 4 of the agent-driven install-session arc (Ben, 2026-08-21; `docs/superpowers/specs/2026-08-21-vendor-command-design.md` §Context). Sub-projects 2 (vendor), 1 (policy + rendering) and 3 (host enrolment) are closed — every mechanical step exists as an `onboard.sh` subcommand. This sub-project adds the missing probes and the instruction layer that drives them as ONE agent session on the target host._ ## What `onboard.sh detect <repo-dir>` prints the facts every later step consumes, as `KEY=value` lines on stdout (parseable AND human-readable, same discipline as `swarm.config`): - `DETECT_SLUG` (from `origin`'s URL; empty + a WARNING line if no forge remote), - `DETECT_STACKS` (`node`/`go` joinable exactly as `onboard.sh dockerfile` accepts — presence of `package.json`/lockfiles, `go.mod`; `none` when neither), - `DETECT_PKG_MANAGER` + pin (pnpm/npm/yarn from lockfile; the Dockerfile stack layer needs the pin), - `DETECT_DEFAULT_BRANCH`, - `DETECT_SANDCASTLE` (`absent` | `present:<FACTORY_REF>` | `present:unpinned`), - `DETECT_LABELS` (`minted:<n>` when `FORGEJO_TOKEN` is set and the core set exists, `missing`, or `unchecked` without a token — never a hard failure), - `DETECT_E2E_TIER_SUGGESTION` (`opt-out` unless the repo carries an obvious journey/e2e dir — a suggestion line, the human still answers `e2e-tier`'s mandatory question). Read-only: detect never writes. Unknown is a value (`unchecked`/`none`), not an error; exit 0 unless `<repo-dir>` is not a git checkout (exit 2). ## Tests `onboarding/tests/onboard-lib-test.sh` (or a new `detect-test.sh`): fixture trees for node-pnpm, go, node+go, bare; no-remote WARNING; labels `unchecked` without token vs `minted` with shimmed curl; non-checkout exit 2. Offline, shimmed curl only. ## Acceptance - Run against this repo: `DETECT_STACKS=node`, `DETECT_PKG_MANAGER=pnpm@…`, `DETECT_SANDCASTLE=present:<current pin>`, exit 0. Full suite green.

swarm-claim host=matou-dev-server-01 run=576
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=576 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #59 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 59,
  "status": "success",
  "commits": [
    "030e9e3"
  ],
  "changed_files": [
    "STATUS.md",
    "onboarding/onboard-lib.sh",
    "onboarding/onboard.sh",
    "onboarding/tests/onboard-lib-test.sh"
  ],
  "tests": [
    {
      "command": "bash onboarding/tests/onboard-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL: $t; done",
      "exit_code": 0
    }
  ],
  "criteria": {
    "onboard.sh detect <repo-dir> prints KEY=value facts on stdout": "onboard_detect in onboarding/onboard-lib.sh + detect subcommand in onboarding/onboard.sh; verified `onboard.sh detect .` emits the seven DETECT_* lines",
    "DETECT_SLUG from origin URL, empty + WARNING if no forge remote": "onboard_detect via _onboard_slug_from_url (strips creds/.git, https+ssh); bare-fixture test asserts empty slug + WARNING on stderr",
    "DETECT_STACKS node/go joinable as dockerfile accepts, none when neither": "node/go detection joined with +; node/go/node+go/bare fixture tests assert node, go, node+go, none",
    "DETECT_PKG_MANAGER + pin (pnpm/npm/yarn from lockfile)": "pnpm/yarn/npm from lockfile; packageManager field wins over lockfileVersion->major; tests assert pnpm@9, pnpm@9.1.0 (field), npm@unknown, none",
    "DETECT_DEFAULT_BRANCH": "origin/HEAD then checked-out branch fallback; node-pnpm fixture asserts main",
    "DETECT_SANDCASTLE absent|present:<FACTORY_REF>|present:unpinned": "reads .sandcastle/FACTORY_REF; tests assert present:abc123 and absent",
    "DETECT_LABELS minted:<n>/missing/unchecked, never a hard failure": "unchecked without token; forgejo_get /labels counts core set; tests assert unchecked, missing (partial), minted:16 (full core via shimmed curl)",
    "DETECT_E2E_TIER_SUGGESTION opt-out unless obvious e2e/journey dir": "scans e2e/journey dirs; tests assert opt-out (bare) and journey (e2e/ present)",
    "Read-only; unknown is a value; exit 0 unless not a git checkout (exit 2)": "onboard_detect never writes (test asserts clean tree after run); exit 2 on non-checkout and missing dir (tests)",
    "Tests offline, shimmed curl only": "onboarding/tests/onboard-lib-test.sh detect section uses git fixture trees + shimmed curl, no network/docker",
    "Acceptance: this repo -> DETECT_STACKS=node, DETECT_PKG_MANAGER=pnpm@…, DETECT_SANDCASTLE=present:<pin>, exit 0; full suite green": "detect-self test asserts all three against $root; full offline suite green (0 FAIL)"
  },
  "summary": "onboard.sh detect <repo-dir>: a read-only repo-facts probe printing the seven DETECT_* KEY=value facts every later onboard step consumes.",
  "blockers": []
}
**close-report** for #59 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 59, "status": "success", "commits": [ "030e9e3" ], "changed_files": [ "STATUS.md", "onboarding/onboard-lib.sh", "onboarding/onboard.sh", "onboarding/tests/onboard-lib-test.sh" ], "tests": [ { "command": "bash onboarding/tests/onboard-lib-test.sh", "exit_code": 0 }, { "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL: $t; done", "exit_code": 0 } ], "criteria": { "onboard.sh detect <repo-dir> prints KEY=value facts on stdout": "onboard_detect in onboarding/onboard-lib.sh + detect subcommand in onboarding/onboard.sh; verified `onboard.sh detect .` emits the seven DETECT_* lines", "DETECT_SLUG from origin URL, empty + WARNING if no forge remote": "onboard_detect via _onboard_slug_from_url (strips creds/.git, https+ssh); bare-fixture test asserts empty slug + WARNING on stderr", "DETECT_STACKS node/go joinable as dockerfile accepts, none when neither": "node/go detection joined with +; node/go/node+go/bare fixture tests assert node, go, node+go, none", "DETECT_PKG_MANAGER + pin (pnpm/npm/yarn from lockfile)": "pnpm/yarn/npm from lockfile; packageManager field wins over lockfileVersion->major; tests assert pnpm@9, pnpm@9.1.0 (field), npm@unknown, none", "DETECT_DEFAULT_BRANCH": "origin/HEAD then checked-out branch fallback; node-pnpm fixture asserts main", "DETECT_SANDCASTLE absent|present:<FACTORY_REF>|present:unpinned": "reads .sandcastle/FACTORY_REF; tests assert present:abc123 and absent", "DETECT_LABELS minted:<n>/missing/unchecked, never a hard failure": "unchecked without token; forgejo_get /labels counts core set; tests assert unchecked, missing (partial), minted:16 (full core via shimmed curl)", "DETECT_E2E_TIER_SUGGESTION opt-out unless obvious e2e/journey dir": "scans e2e/journey dirs; tests assert opt-out (bare) and journey (e2e/ present)", "Read-only; unknown is a value; exit 0 unless not a git checkout (exit 2)": "onboard_detect never writes (test asserts clean tree after run); exit 2 on non-checkout and missing dir (tests)", "Tests offline, shimmed curl only": "onboarding/tests/onboard-lib-test.sh detect section uses git fixture trees + shimmed curl, no network/docker", "Acceptance: this repo -> DETECT_STACKS=node, DETECT_PKG_MANAGER=pnpm@…, DETECT_SANDCASTLE=present:<pin>, exit 0; full suite green": "detect-self test asserts all three against $root; full offline suite green (0 FAIL)" }, "summary": "onboard.sh detect <repo-dir>: a read-only repo-facts probe printing the seven DETECT_* KEY=value facts every later onboard step consumes.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/dev-factory#59
No description provided.