bearings 0.3.1 → 0.3.2

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/README.md +47 -6
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,8 @@
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 the generated files in a manifest, and leaves project-specific tailoring to your AI agent via `/setup-repo`.
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`.
4
+
5
+ Requires Node >= 24.
4
6
 
5
7
  ## Quick Start
6
8
 
@@ -11,9 +13,11 @@ bearings verify
11
13
  ```
12
14
 
13
15
  1. `npx bearings init` writes the generic scaffold and prints the next step.
14
- 2. `/setup-repo` runs inside your AI agent to merge backups, fill placeholders, seed docs, and tailor skills.
16
+ 2. `/setup-repo` runs inside your AI agent to review backups, fill placeholders, seed docs, and tailor the setup.
15
17
  3. `bearings verify` checks the scaffold for drift, missing files, broken exposures, and unresolved setup warnings.
16
18
 
19
+ 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
+
17
21
  ## What Gets Generated
18
22
 
19
23
  ```text
@@ -46,9 +50,11 @@ docs/
46
50
  skills/*
47
51
  ```
48
52
 
53
+ Every file carries an `owner` in the manifest. `bearings`-owned files (`CLAUDE.md`, the ADR template, commands, skills) are package-maintained — the incoming template is their canonical update source. `agent`-owned files (`AGENTS.md`, the three maps, the two indexes) are yours; bearings never overwrites them without an explicit per-file decision.
54
+
49
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.
50
56
 
51
- Existing scaffold targets are backed up as `<path>.bkp` before replacement. Re-running `init` skips unchanged managed files.
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.
52
58
 
53
59
  ## The Model
54
60
 
@@ -67,24 +73,59 @@ user task
67
73
 
68
74
  ### `bearings init`
69
75
 
70
- Scaffold the agent-friendly setup in the current repository.
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.
71
77
 
72
78
  | Flag | Meaning |
73
79
  |---|---|
74
80
  | `--harness <name...>` | Expose to `claude` and/or `opencode`. Defaults to detected harness dirs, or both in a fresh repo. |
75
81
  | `--copy` | Copy exposures instead of symlinking them. `verify` checks copy drift. |
76
- | `-y`, `--yes` | Accept defaults and do not prompt. |
82
+ | `-y`, `--yes` | Accept defaults and do not prompt. Fresh init only. |
83
+
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`.
85
+
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:
87
+
88
+ | Situation | What happens |
89
+ |---|---|
90
+ | Content matches baseline | Kept silently |
91
+ | 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) |
93
+ | File no longer shipped, unchanged locally | Removed |
94
+ | File no longer shipped, changed locally | You choose **Remove** or **Keep and untrack** |
95
+ | New scaffold path already occupied | Conflict, resolved the same way |
96
+
97
+ 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`.
98
+
99
+ **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.
77
100
 
78
101
  ### `bearings verify`
79
102
 
80
- Check the manifest and harness exposures for mechanical breakage. Exit code `0` means no failures; exit code `1` means one or more failures.
103
+ Check the manifest and harness exposures for mechanical breakage. Exit code `0` means no failures; exit code `1` means one or more failures. Warnings never affect the exit code.
81
104
 
82
105
  | Code | Severity | Condition |
83
106
  |---|---|---|
84
107
  | `no-manifest` | fail | `.agents/bearings.json` missing |
108
+ | `invalid-manifest` | fail | manifest fails structural validation |
85
109
  | `missing-file` | fail | manifest entry path doesn't exist |
86
110
  | `missing-exposure` | fail | a child of `.agents/skills` or `.agents/commands` absent from a configured harness dir |
87
111
  | `broken-symlink` | fail | harness entry is a symlink whose target doesn't resolve |
88
112
  | `copy-drift` | fail | copy mode: harness file content differs from `.agents` source content |
113
+ | `setup-pending` | warn | an update finished but `/setup-repo` hasn't run yet |
89
114
  | `unfilled-placeholder` | warn | a bearings-generated file still contains `<agent:` |
90
115
  | `unreviewed-backup` | warn | manifest `backup` path still exists on disk |
116
+ | `pending-reconciliation` | warn | a recorded backup from a collision or Merge is still unresolved |
117
+
118
+ ## Development
119
+
120
+ ```sh
121
+ npm test # rebuilds dist/ via pretest, then runs the full Vitest suite
122
+ npm run build
123
+ ```
124
+
125
+ - `docs/ARCHITECTURE.md` — components, dependency direction, build shape.
126
+ - `docs/CODEBASE_MAP.md` — capability-to-source routing with `path#symbol` anchors.
127
+ - `docs/DOMAIN.md` — terminology, workflows, and domain rules.
128
+ - `docs/adr/INDEX.md` — consequential decisions.
129
+ - `docs/qa/RELEASE_QA.md` — manual pre-release tiers, staged by `node scripts/qa.ts setup`.
130
+
131
+ This repo is maintained by bearings itself; see `AGENTS.md` for the dogfooding ownership rules before editing any managed file.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bearings",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Give your AI agents their bearings — scaffold an agent-friendly setup in any repository.",
5
5
  "type": "module",
6
6
  "engines": {