bearings 0.5.3 → 0.5.5

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # bearings
2
2
 
3
- `bearings` is a small TypeScript CLI that helps you give your agents their bearings: it scaffolds an agent-friendly repository setup, exposes shared skills and commands to supported harnesses, records every generated file in a manifest, and leaves project-specific tailoring to your AI agent via `/setup-repo`.
3
+ `bearings` sets up repository maps, commands, and skills for AI coding agents. It saves the scaffold, then opens one interactive agent to tailor it with you.
4
4
 
5
5
  Requires Node >= 24.
6
6
 
@@ -8,13 +8,17 @@ Requires Node >= 24.
8
8
 
9
9
  ```sh
10
10
  npx bearings init
11
- /setup-repo
12
- bearings verify
11
+ npx bearings verify
13
12
  ```
14
13
 
15
- 1. `npx bearings init` writes the generic scaffold and prints the next step.
16
- 2. `/setup-repo` runs inside your AI agent to review backups, fill placeholders, seed docs, and tailor the setup.
17
- 3. `bearings verify` checks the scaffold for drift, missing files, broken exposures, and unresolved setup warnings.
14
+ 1. Run `npx bearings init` in the target repository from a real terminal.
15
+ 2. Choose one setup runner. Answer its project questions and permission prompts. In OpenCode, press **Enter** to submit the prefilled task. Claude Code may first ask you to trust the folder.
16
+ 3. The agent fills the seed and maps, tailors starter skills, and resolves backups. It runs the printed `init --complete-setup` command to validate and record completion. Exit the harness when done.
17
+ 4. Run `npx bearings verify` to check files, exposures, and remaining warnings.
18
+
19
+ **Interrupted?** Run `npx bearings init` again. It resumes pending tasks and keeps completed work.
20
+
21
+ **First setup or resume inside an agent session?** Use `npx bearings init --no-agent`. Follow the one scoped handoff it prints. For pending setup, `--yes`, piped input/output, and an unavailable harness CLI also leave a handoff instead of opening an agent. Ordinary updates require a real terminal for your decisions.
18
22
 
19
23
  Re-run `npx bearings init` later to update an initialized repository. There is no separate `update` verb — `init` dispatches on manifest state (ADR-0001).
20
24
 
@@ -27,6 +31,8 @@ docs/
27
31
  DOMAIN.md
28
32
  ARCHITECTURE.md
29
33
  CODEBASE_MAP.md
34
+ diagrams/
35
+ c4-component.puml # created during first setup; not a scaffold/manifest file
30
36
  adr/
31
37
  INDEX.md
32
38
  0000-template.md
@@ -36,7 +42,7 @@ docs/
36
42
  bearings.json
37
43
  commands/
38
44
  refresh-repo-map.md
39
- setup-repo.md
45
+ update-bearings-setup.md
40
46
  skills/
41
47
  commit-convention/SKILL.md
42
48
  defer-work/SKILL.md
@@ -50,11 +56,11 @@ docs/
50
56
  skills/*
51
57
  ```
52
58
 
53
- Every file carries an `owner` in the manifest. `bearings`-owned files (`CLAUDE.md`, the ADR template, and commands) are package-maintained the incoming template is their canonical update source. Starter skills begin bearings-owned, then `/setup-repo` adapts and claims them as agent-owned. `agent`-owned files (`AGENTS.md`, the three maps, the two indexes, and claimed starter skills) are yours; bearings never overwrites them without an explicit per-file decision except for the starter-skill update handling below.
59
+ Every generated file has an `owner` in `.agents/bearings.json`. Package-maintained files include `CLAUDE.md`, the ADR template, commands, and generic skill bundles. Starter skills begin bearings-owned; setup tailors them, then the completion command claims them as agent-owned and records baselines. The seed, maps, indexes, and claimed starter skills are agent-owned. Updates preserve local work as described below.
54
60
 
55
- `/setup-repo` creates `docs/diagrams/c4-component.puml` (via `/refresh-repo-map`) once the repo is tailored; it is not part of the generated scaffold or the manifest.
61
+ First setup routes all four map tasks through `/refresh-repo-map`, including creation of `docs/diagrams/c4-component.puml`. The C4 source is a known first-setup output, not a scaffold or manifest file. Later updates remain limited to exact named map tasks and never add C4 because of an unrelated change.
56
62
 
57
- Existing files that collide with a scaffold target are backed up as `<path>.bkp` before replacement, and the backup is recorded as a pending reconciliation for `/setup-repo` to resolve.
63
+ Existing files that collide with a scaffold target are backed up as `<path>.bkp` (with a numeric suffix if needed). Setup reviews the recorded backups before the completion command cleans them up.
58
64
 
59
65
  ## The Model
60
66
 
@@ -73,32 +79,44 @@ user task
73
79
 
74
80
  ### `bearings init`
75
81
 
76
- State-aware entry point. With no manifest it scaffolds; with a manifest it runs an interactive update; with a corrupt manifest it enters reconstruction.
82
+ One entry point: scaffold a new repository, resume pending setup, update a completed repository, or reconstruct an invalid manifest.
77
83
 
78
84
  | Flag | Meaning |
79
85
  |---|---|
80
86
  | `--harness <name...>` | Expose to `claude` and/or `opencode`. Defaults to detected harness dirs, or both in a fresh repo. |
81
- | `--copy` | Copy exposures instead of symlinking them. `verify` checks copy drift. |
82
- | `-y`, `--yes` | Accept defaults and do not prompt. Fresh init only. |
87
+ | `--copy` | Copy exposures instead of symlinking them. Completion refreshes copies for authorized setup edits; `verify` detects copy drift. |
88
+ | `--setup-harness <name>` | Select one setup runner: `claude` or `opencode`. Exposure to both still launches only one runner. |
89
+ | `--no-agent` | Suppress launch and print the scoped handoff. Use inside an existing agent session. |
90
+ | `-y`, `--yes` | Accept fresh-init defaults and suppress launch. Ordinary updates still require interactive decisions. |
91
+ | `--complete-setup` | Validate pending outputs and record completion, including skill claims, baselines, copy refresh, and artifact cleanup. |
92
+ | `--setup-path <path...>` | With `--complete-setup` only: checkpoint these completed tasks and leave the others pending. |
93
+ | `--keep-local <skill-path...>` | With `--complete-setup` only: decline the incoming template for these selected `skill-update` tasks. Preserve the local or agreed freeform content. |
94
+
95
+ **Fresh init** — scans the repo, resolves harness/exposure, checks adapter collisions, then writes the scaffold, exposures, and v2 manifest. `setupPending` records `kind: init`, tasks with paths and reasons (`tailor`, `map`, or `reconcile`), and protected skills. Only after that state is saved does the selected interactive harness open with a direct first-setup task.
83
96
 
84
- **Fresh init** — scans the repo, resolves harness/exposure, aborts on unmanaged adapter collisions before writing anything, generates the scaffold, exposes `.agents/{commands,skills}/*` per harness, writes the v2 manifest, and hands off to `/setup-repo`.
97
+ **Resume and completion** — pending setup resumes before the ordinary update terminal check, without regenerating files. Partial checkpoints record output hashes and validated reconciliation artifacts. Final completion keeps one replaceable `completedSetup` receipt, so a successful agent exit, deleted artifacts, or a missing pending marker cannot prove completion by itself. Use `--complete-setup` to record progress; the CLI owns the manifest.
85
98
 
86
- **Update** — interactive only (requires a TTY; `--yes` has no effect). It refuses to downgrade the recorded bearings version and refuses to start while a prior update's `/setup-repo` handoff is still pending. Each managed file is classified against its manifest baseline:
99
+ **Update** — requires a TTY and your decisions, even with `--yes`. It refuses version downgrades. Each managed file is classified against its baseline:
87
100
 
88
101
  | Situation | What happens |
89
102
  |---|---|
90
103
  | Content matches baseline | Kept silently |
91
104
  | Template changed, file unchanged locally | Replaced |
92
- | File changed locally **and** in the template | Conflict — you choose **Replace**, **Merge** (back up your content for `/setup-repo`), or **Skip** (decline this revision; it won't re-prompt) |
105
+ | File changed locally **and** in the template | Choose **Replace**, **Merge** (back up your content for `/update-bearings-setup`), or **Skip** (decline this revision; it will not re-prompt) |
93
106
  | File no longer shipped, unchanged locally | Removed |
94
107
  | File no longer shipped, changed locally | You choose **Remove** or **Keep and untrack** |
95
108
  | New scaffold path already occupied | Conflict, resolved the same way |
96
109
  | Claimed starter skill unchanged locally, template changed | Replaced silently; its agent owner is retained and its baseline is refreshed |
97
- | Claimed starter skill and template both changed | No CLI prompt: local content is preserved with backup, base, and incoming artifacts; `/setup-repo` guides the developer through a three-way resolution when the base exists |
98
- | Legacy bearings-owned starter skill and template both changed, with no baseline | No CLI prompt and no auto-claim: local content is preserved with backup and incoming artifacts; `verify` warns about the missing base and `/setup-repo` offers Take new template, Keep local, or Freeform |
110
+ | Customized skill, upstream template unchanged | Preserved byte-for-byte by both the CLI and unrelated agent follow-up; excluded from task scope |
111
+ | Claimed starter skill and template both changed | Local content, backup, base, and incoming template are preserved. `/update-bearings-setup` guides resolution; no CLI merge prompt |
112
+ | Legacy starter skill with no historical baseline and changes on both sides | Local content, backup, and incoming template are preserved. The agent offers Take new template, Keep local, or Freeform; it does not invent a base |
99
113
 
100
114
  Adapter changes (harness added/removed, symlink↔copy switch) are planned alongside. The full plan is shown and confirmed before any mutation, then applied as a single transaction — the manifest is written last, and any failure restores the exact prior state. A run that changes nothing reports `already up to date`.
101
115
 
116
+ **Only real pending work opens an agent.** Clean generic skill/checklist updates, adapter changes, version changes, and lossless migrations finish in the CLI. A clean starter replacement that introduces placeholders needs scoped tailoring. A map added or restored, an accepted map-template change, or an explicit map-format migration creates a task for that named map. Unrelated maps and customized skills stay outside the task scope.
117
+
118
+ `/update-bearings-setup` handles update and reconstruction tasks only. It replaces `/setup-repo`; first setup uses the direct task from `init`. Customized old command content uses the normal Remove / Keep-and-untrack decision.
119
+
102
120
  **Reconstruction** — when the manifest is missing fields, hash-broken, or otherwise invalid, harness and exposure config is detected from the adapters on disk, confirmed with you, and a fresh v2 manifest is rebuilt.
103
121
 
104
122
  ### `bearings verify`
@@ -112,9 +130,9 @@ Check the manifest and harness exposures for mechanical breakage. Exit code `0`
112
130
  | `missing-file` | fail | manifest entry path doesn't exist |
113
131
  | `missing-exposure` | fail | a child of `.agents/skills` or `.agents/commands` absent from a configured harness dir |
114
132
  | `broken-symlink` | fail | harness entry is a symlink whose target doesn't resolve |
115
- | `copy-drift` | fail | copy mode: harness file content differs from `.agents` source content |
116
- | `setup-pending` | warn | an update finished but `/setup-repo` hasn't run yet |
117
- | `unfilled-placeholder` | warn | an `owner: agent` file still contains a complete single-line agent placeholder marker (bearings-owned files are not checked) |
133
+ | `copy-drift` | fail | copy mode: harness content differs from `.agents` source; the disposable checklist `data.generated.js` payload is excluded |
134
+ | `setup-pending` | warn | first setup or update tasks remain unfinished |
135
+ | `unfilled-placeholder` | warn | an agent-owned file or starter skill still contains a complete single-line agent placeholder marker |
118
136
  | `missing-skill-baseline` | warn | an agent-owned starter skill or pending `skill-update` reconciliation has no skill baseline file |
119
137
  | `unreviewed-backup` | warn | manifest `backup` path still exists on disk |
120
138
  | `pending-reconciliation` | warn | a reconciliation artifact, including a skill-update backup or incoming file, is still unresolved |
@@ -132,4 +150,4 @@ npm run build
132
150
  - `docs/adr/INDEX.md` — consequential decisions.
133
151
  - `docs/qa/RELEASE_QA.md` — manual pre-release tiers, staged by `node scripts/qa.ts setup`.
134
152
 
135
- This repo is maintained by bearings itself; see `AGENTS.md` for the dogfooding ownership rules before editing any managed file.
153
+ This repo is maintained by bearings itself; see `AGENTS.md` for the dogfooding ownership rules before editing any managed file. `templates/**` is product source for future scaffolds. Do not mirror template edits into this repo's managed copies; divergence is the dogfood signal.