@afokapu/atdd-bun 0.2.0 → 0.3.1

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
@@ -5,8 +5,8 @@ that keep their plan, acceptance evidence, tests, and implementation in the
5
5
  same Git history. It gives developers and coding agents fast local feedback,
6
6
  then runs the same checks in GitHub Actions.
7
7
 
8
- It does not require Python, the `atdd` executable, an ATdd state store, a
9
- global installation, or network access while enforcing a repository.
8
+ It runs entirely on Bun from the repository's own `node_modules`: no global
9
+ installation and no network access while enforcing a repository.
10
10
 
11
11
  ## What it protects
12
12
 
@@ -42,13 +42,25 @@ not the only thing standing between an invalid branch and `main`.
42
42
 
43
43
  ## Install and first use
44
44
 
45
- When the package is published to the configured package registry, add it as a
46
- development dependency:
45
+ Add the package from npm as a development dependency, then bootstrap the
46
+ repository once:
47
47
 
48
48
  ```sh
49
49
  bun add -d @afokapu/atdd-bun
50
+ bun run atdd-bun init
50
51
  ```
51
52
 
53
+ `init` installs the local surfaces described below: Git
54
+ [hooks](#hooks-fast-feedback-not-merge-authority), the
55
+ [CI workflow](#ci-the-merge-gate), the
56
+ [agent skill](#agent-skill-the-lifecycle-in-the-agents-context), and the
57
+ [integrity test](#integrity-files-agents-must-not-change). Commit what it
58
+ generates (`.githooks/`, `.github/workflows/atdd-bun.yml`, `.agents/`, `.claude/`,
59
+ `AGENTS.md`, `atdd-bun.integrity.test.ts`) so every clone and every agent session
60
+ gets them. To keep the
61
+ package and the skill current automatically, see
62
+ [Staying up to date](#staying-up-to-date).
63
+
52
64
  Run the complete installed policy from the repository root:
53
65
 
54
66
  ```sh
@@ -163,15 +175,17 @@ bun run atdd-bun init
163
175
  It creates `.githooks/` dispatchers, sets a worktree-local `core.hooksPath`,
164
176
  generates `.github/workflows/atdd-bun.yml`, and installs the coding-agent skill
165
177
  when they are absent. It never overwrites another hook path, an existing
166
- generated workflow, or an existing skill unless you explicitly pass `--replace`. Installing the dependency alone deliberately does
167
- neither: package installation must not mutate a repository through postinstall.
178
+ generated workflow, or an existing skill unless you explicitly pass `--replace`.
179
+ The package itself has no install script: adding the dependency never changes
180
+ the repository until you run `init`.
168
181
 
169
- Use `hooks install`, `ci init`, or `agent init` when only one surface is wanted:
182
+ Use `hooks install`, `ci init`, `agent init`, or `integrity init` when only one surface is wanted:
170
183
 
171
184
  ```sh
172
185
  bun run atdd-bun hooks install
173
186
  bun run atdd-bun ci init
174
187
  bun run atdd-bun agent init
188
+ bun run atdd-bun integrity init
175
189
  ```
176
190
 
177
191
  The hooks enforce protected-branch blocking, micro-commit limits, mass-delete
@@ -227,8 +241,34 @@ The skill names the lifecycle PLAN → RED → GREEN → SMOKE → REFACTOR →
227
241
  conventions each stage follows, and the `atdd-bun` profile that gates it. It
228
242
  points at the conventions shipped in this package instead of restating them, so
229
243
  it stays correct as they change; after upgrading, refresh it with
230
- `bun run atdd-bun agent init --replace`. The skill steers the agent; the
231
- profiles, hooks, and CI remain the enforcement.
244
+ `bun run atdd-bun agent init --replace`, or let the repository's own
245
+ `postinstall` do it (see [Staying up to date](#staying-up-to-date)). The skill
246
+ steers the agent; the profiles, hooks, and CI remain the enforcement.
247
+
248
+ ## Integrity: files agents must not change
249
+
250
+ Coding agents can edit anything on the machine they run on, including
251
+ `node_modules/@afokapu/atdd-bun`, the files this package generates, and
252
+ `atdd-bun.yaml`. `init` therefore writes `atdd-bun.integrity.test.ts` (into the
253
+ `[test] root` from `bunfig.toml`, if one is set), and the generated CI workflow
254
+ runs `bun run atdd-bun integrity` before enforcement. Both run the same check:
255
+
256
+ | Checked | Canonical source | Restore |
257
+ |---|---|---|
258
+ | Every file of the installed package | `integrity.json`, the hashes published with the package | `bun install --force` |
259
+ | The dependency is an npm version range, locked to the registry with an integrity hash | npm | `bun add -d @afokapu/atdd-bun` |
260
+ | The CI workflow, both skills, the `AGENTS.md` block, and the integrity test | what the installed version generates (its version stamp is ignored) | `bun run atdd-bun init --replace` |
261
+ | `atdd-bun.yaml` is not looser than on the branch being merged into | the merge base; for a push to the base branch, the previous commit | `git checkout <base> -- atdd-bun.yaml` |
262
+
263
+ A failure is addressed to the agent: it lists every changed file with its
264
+ restore command and tells it to stop and ask a human instead of working around
265
+ the check. Locally, this is a reminder an agent can still ignore, because
266
+ anything on its machine can be edited. In CI the check runs on a clean install,
267
+ so its verdict cannot be faked. Loosening the policy remains possible, as a
268
+ separate change a human approves.
269
+
270
+ After upgrading to a version that changes generated files, run
271
+ `bun run atdd-bun init --replace` and commit the result.
232
272
 
233
273
  ## CI: the merge gate
234
274
 
@@ -248,6 +288,47 @@ After generating it, configure the GitHub branch ruleset to require the workflow
248
288
  job before merging. `merge_group` is included so the same protection works with
249
289
  GitHub Merge Queue.
250
290
 
291
+ ## Staying up to date
292
+
293
+ Every change merged into this package's `main` is published to npm
294
+ automatically as the next patch version, with provenance, and tagged `vX.Y.Z`.
295
+
296
+ The hooks and the CI workflow run the package installed in `node_modules`, so
297
+ conventions, validators, and hook policy change as soon as a repository
298
+ upgrades the dependency; nothing needs reinstalling. The generated files are
299
+ copies: when an upgrade changes them, the integrity check reports them until you
300
+ run `bun run atdd-bun init --replace` and commit the result. The agent skill is
301
+ the one refreshed automatically. To refresh it on every install, add a script to the
302
+ repository's own `package.json` (Bun runs a project's own lifecycle scripts, not
303
+ a dependency's):
304
+
305
+ ```json
306
+ "scripts": {
307
+ "postinstall": "atdd-bun agent init --replace"
308
+ }
309
+ ```
310
+
311
+ To receive each release as a pull request, add `.github/dependabot.yml` on the
312
+ default branch:
313
+
314
+ ```yaml
315
+ version: 2
316
+ updates:
317
+ - package-ecosystem: "bun"
318
+ directory: "/"
319
+ schedule:
320
+ interval: "daily"
321
+ allow:
322
+ - dependency-name: "@afokapu/atdd-bun"
323
+ ```
324
+
325
+ Merging that pull request installs the new version and, through `postinstall`,
326
+ rewrites the skill. Without Dependabot, upgrade with
327
+ `bun update @afokapu/atdd-bun`. The lockfile pins the installed version, so
328
+ nothing changes until one of these runs. While the package is `0.x`, a `^0.1.x`
329
+ range accepts only `0.1.*`; move to a new minor with
330
+ `bun add -d @afokapu/atdd-bun@latest`.
331
+
251
332
  ## Linked worktrees for agent work
252
333
 
253
334
  An optional policy reserves one primary checkout for `main` and requires feature
@@ -314,12 +395,6 @@ publish using its own credentials and registry configuration.
314
395
 
315
396
  `bun test` runs the package’s real-Git fixtures and detector clean/dirty corpora.
316
397
  The suite proves that every declared convention output has a matching convention
317
- and a deliberate failing case; it also covers hook isolation, CI generation,
318
- planner scope, release validation, and linked-worktree policy.
319
-
320
- ## Boundaries
321
-
322
- This package intentionally excludes ATdd’s Python runtime orchestration,
323
- registry/state reconciliation, GitHub API integration, cluster access, and
324
- deployment execution. Those capabilities may be configured around the package,
325
- but repository enforcement remains deterministic and locally runnable.
398
+ and a deliberate failing case; it also covers hook isolation, the declarative
399
+ registry policy, CI generation, agent-skill installation, planner scope, release
400
+ validation, and linked-worktree policy.