doctrina-cli 0.4.0 → 0.8.0

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.
@@ -11,20 +11,47 @@ This repository uses the Doctrina framework for spec-driven, AGENTS.md
11
11
  native multi-agent development. The full framework artifacts live under
12
12
  `.doctrina/`.
13
13
 
14
- ## Working from intent
15
-
16
- - **Bootstrap.** If `.doctrina/intake.md` exists with `Status: pending`,
17
- the specs have not been written yet. Before anything else, run
18
- `doctrina intake` and execute the printed bootstrap playbook in one
19
- linear pass: fill `product.md`, derive capabilities, author one EARS
20
- spec each, run the quality gates (`doctrina clarify --all`,
21
- `doctrina validate`), then flip the intake to `Status: converted`. Ask
22
- the user only when the intake is genuinely ambiguous. After conversion
23
- the specs are the only source of truth — never edit `intake.md` to
24
- change requirements.
25
- - **Day-to-day.** Turn a brief request into a scaffolded change with
26
- `doctrina work "<prompt>"`, then follow the printed work playbook
27
- (spec delta → tasks → implement → analyze → apply → archive → validate).
14
+ ## Working from intent (you drive; the human stays passive)
15
+
16
+ You — the AI agent — run the Doctrina commands. The human gives a brief
17
+ prompt and approves; do not make them run the CLI or hand-author artifacts.
18
+
19
+ - **Bootstrap.** If `.doctrina/intake.md` is `Status: pending`, the specs
20
+ are not written yet: run `doctrina intake` and execute the printed
21
+ playbook in one pass (fill `product.md`, derive capabilities, one EARS
22
+ spec each, `doctrina clarify --all` + `doctrina validate`, then flip the
23
+ intake to `Status: converted`). After conversion the specs are the only
24
+ source of truth — never edit `intake.md` to change requirements.
25
+ - **Day-to-day.** Turn any request into a change with `doctrina work
26
+ "<prompt>"` and follow the printed playbook (spec delta → tasks →
27
+ implement → analyze → apply → archive → validate). Unsure what to do
28
+ next? Run `doctrina next`. Need to read? Run `doctrina context`. Ask the
29
+ human only on genuine ambiguity.
30
+
31
+ ## Doctrina command surface (reach for these — don't hand-author)
32
+
33
+ The CLI scaffolds from canonical templates and keeps `index.json` in sync,
34
+ so prefer it over writing artifacts by hand. Full list: `doctrina --help`.
35
+
36
+ - **Read / orient (any task, first & last):** `doctrina status` (health) ·
37
+ `doctrina context [<cap>] --concat` (read pack) · `doctrina next` (what's
38
+ next) · `doctrina why <cap>` (provenance) · `doctrina spec list` ·
39
+ `doctrina decision list` · `doctrina search <query>`
40
+ - **Start:** `doctrina work "<prompt>"` · `--from-diff` (backfill from
41
+ existing code) · `--chore` (no-spec infra/docs/build)
42
+ - **Scaffold (manual creation stays available):** `doctrina spec new <cap>`
43
+ (`--bug`) · `doctrina decision new "<title>"` · `doctrina change new <id>`
44
+ · `doctrina contract new <id>` · `doctrina skill new <slug>`
45
+ - **Advance / close:** `doctrina change apply|archive|diff <id>` · `doctrina
46
+ decision accept|land|supersede <n>` · `doctrina spec set <cap> [...]` ·
47
+ `doctrina close <id>` (whole close in one pass)
48
+ - **Gates (ground truth, not guesses):** `doctrina validate` (`--fix`) ·
49
+ `doctrina verify` · `doctrina review` (conformance vs specs/ADRs) ·
50
+ `doctrina coverage --strict` · `doctrina trace --strict` · `doctrina
51
+ contract check` · `doctrina clarify --all` · `doctrina analyze <id>`
52
+
53
+ Continuous: `doctrina watch` re-syncs and re-orients on every save.
54
+ Capture lessons: `doctrina skill suggest` surfaces skills worth writing.
28
55
 
29
56
  ## Stack and tooling
30
57
 
@@ -86,14 +113,14 @@ before considering work done.
86
113
 
87
114
  ## How to read context efficiently
88
115
 
89
- 1. Read this `AGENTS.md`.
90
- 2. Read `.doctrina/product.md`.
91
- 3. Read the relevant `.doctrina/specs/<capability>/spec.md`.
92
- 4. Read any open `.doctrina/changes/<id>/`.
93
- 5. Read `.doctrina/decisions/` filtered by `Status: accepted`.
94
- 6. If the task matches a skill in `.doctrina/skills/`, load the
95
- relevant skill on demand (read its `description:` / `when:`
96
- frontmatter; load the full body only when the trigger fires).
116
+ `doctrina context [<capability>] --concat` assembles the read pack in one
117
+ call, in order: this `AGENTS.md` → `.doctrina/product.md` → the capability
118
+ spec → open `.doctrina/changes/<id>/` → `.doctrina/decisions/` filtered to
119
+ `Status: accepted`. Run it for ANY task, not only `doctrina work`; it skips
120
+ `changes/archive/` (history — read only when debugging it).
121
+
122
+ On demand only: if the task matches a skill in `.doctrina/skills/`, read its
123
+ `description:` / `when:` frontmatter; load the full body when the trigger fires.
97
124
 
98
125
  Keep this file under 150 lines. Density beats prose. Use exact commands.
99
126
 
@@ -8,8 +8,19 @@ For ADDED: include the full new spec body below. On apply, the body is
8
8
  written verbatim to the target path.
9
9
 
10
10
  For MODIFIED: include only the sections that change, with clear
11
- before/after markers. On apply, the maintainer merges the delta into the
12
- existing spec by hand or with the CLI.
11
+ before/after markers. Bookkeeping edits (flip a criterion, bump the
12
+ version, set a header) can be made mechanical by adding a fenced `ops`
13
+ block — on apply the CLI executes it against the target spec, all ops or
14
+ none (ADR 0007). Anything the ops verbs cannot express (rewriting prose)
15
+ stays a by-hand merge; a MODIFIED delta with no `ops` block prints a
16
+ manual-merge pointer.
17
+
18
+ ```ops
19
+ set-header Implementation: verified — durable adapter (`src/db.ts`)
20
+ bump-version minor
21
+ set-criterion 1: verified
22
+ append-criterion [unverified] new signal — verified by `test/x.test.ts`
23
+ ```
13
24
 
14
25
  For REMOVED: the body may be empty; on apply, the target spec file is
15
26
  deleted and the capability is recorded in the change archive only.
@@ -1,7 +1,24 @@
1
1
  #!/usr/bin/env sh
2
2
  # Doctrina pre-commit hook.
3
- # Installed by `doctrina hooks install`. Runs validate and blocks the
4
- # commit if it exits non-zero. Edit freely after install; the CLI will
5
- # not overwrite without --force.
3
+ # Installed by `doctrina hooks install`. Edit freely after install; the CLI
4
+ # will not overwrite without --force.
5
+ #
6
+ # Runs `doctrina validate --fix`:
7
+ # 1. --fix regenerates index.json from the tree (repairs metadata drift and
8
+ # migrates the framework_version stamp) BEFORE checking, so the single
9
+ # most common gate failure — a hand-edited header that drifted the index —
10
+ # is healed at commit time instead of blocking the commit.
11
+ # 2. validate still exits non-zero (and blocks the commit) on real errors a
12
+ # rebuild cannot heal: missing artifacts, duplicate ADR numbers, broken
13
+ # EARS, ledger/index disagreement, and so on.
14
+ #
15
+ # To gate without auto-repairing (CI-style, fail on any drift), replace the
16
+ # line below with a bare `doctrina validate`.
6
17
 
7
- doctrina validate
18
+ doctrina validate --fix || exit 1
19
+
20
+ # Re-stage the index if --fix rewrote it, so the repaired index lands in this
21
+ # commit rather than as a leftover unstaged change. Harmless when unchanged.
22
+ if [ -f .doctrina/index.json ]; then
23
+ git add .doctrina/index.json
24
+ fi
@@ -3,6 +3,7 @@
3
3
  **Capability:** {{CAPABILITY}}
4
4
  **Status:** draft
5
5
  **Implementation:** planned
6
+ **Realizes:** <product.md success-criteria anchors this delivers, or "n/a — <why>">
6
7
  **Last updated:** {{DATE}}
7
8
  **Version:** 0.1.0
8
9
 
@@ -18,9 +19,12 @@ behind it, and `doctrina validate` warns. To record a deliberate gap and
18
19
  silence the warning, add a note after the value, e.g.
19
20
  "**Implementation:** planned — backend deferred to Q3, see ADR 0007".
20
21
 
21
- Optional: trace this capability to product intent by adding a header
22
- "**Realizes:** SC1, SC3" that names the product.md anchors it delivers
23
- (`doctrina trace`; ADR 0006).
22
+ Realizes ties this capability to product intent (`doctrina trace`;
23
+ ADR 0006). Tag product.md success-criteria bullets with an anchor —
24
+ "- [SC1] ..." — and list the ones this spec delivers above. An "active"
25
+ spec with no Realizes: header warns under `doctrina validate`; if the
26
+ capability genuinely maps to no product anchor (internal tooling), keep
27
+ the header and write "n/a — <why>" to record that on purpose.
24
28
  -->
25
29
 
26
30
  ## Purpose