doctrina-cli 0.12.0 → 0.14.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.
- package/README.md +1 -1
- package/package.json +3 -2
- package/src/commands/adapter.js +205 -0
- package/src/commands/analyze.js +76 -19
- package/src/commands/change.js +341 -44
- package/src/commands/clarify.js +40 -19
- package/src/commands/close.js +119 -11
- package/src/commands/completion.js +6 -0
- package/src/commands/constitution.js +8 -1
- package/src/commands/context.js +359 -53
- package/src/commands/contract.js +17 -24
- package/src/commands/coverage.js +16 -4
- package/src/commands/decision.js +172 -40
- package/src/commands/doctor.js +38 -7
- package/src/commands/handoff.js +8 -1
- package/src/commands/hooks.js +6 -0
- package/src/commands/index-rebuild.js +8 -1
- package/src/commands/init.js +152 -6
- package/src/commands/intake.js +11 -2
- package/src/commands/intent.js +8 -1
- package/src/commands/metrics.js +80 -7
- package/src/commands/next.js +14 -2
- package/src/commands/prime.js +8 -1
- package/src/commands/report.js +8 -1
- package/src/commands/review.js +8 -1
- package/src/commands/search.js +8 -1
- package/src/commands/show.js +8 -1
- package/src/commands/skill.js +16 -6
- package/src/commands/spec.js +13 -6
- package/src/commands/status.js +14 -2
- package/src/commands/templates.js +277 -40
- package/src/commands/trace.js +15 -3
- package/src/commands/upgrade.js +23 -12
- package/src/commands/validate.js +93 -3
- package/src/commands/verify.js +12 -2
- package/src/commands/watch.js +8 -1
- package/src/commands/why.js +10 -24
- package/src/commands/work.js +69 -7
- package/src/index.js +60 -6
- package/src/lib/adapters.js +140 -0
- package/src/lib/adr-guard.js +47 -0
- package/src/lib/args.js +10 -0
- package/src/lib/clarity.js +1 -0
- package/src/lib/colors.js +1 -0
- package/src/lib/commands.js +314 -3
- package/src/lib/criteria.js +1 -0
- package/src/lib/dates.js +1 -0
- package/src/lib/diff.js +1 -0
- package/src/lib/doc-model.js +287 -0
- package/src/lib/docs-impact.js +167 -0
- package/src/lib/ears.js +1 -0
- package/src/lib/exit-codes.js +103 -0
- package/src/lib/flag-catalog.js +106 -0
- package/src/lib/fs-ops.js +1 -0
- package/src/lib/gates.js +123 -0
- package/src/lib/git.js +97 -0
- package/src/lib/index-json.js +14 -6
- package/src/lib/json-out.js +83 -0
- package/src/lib/prompt.js +18 -1
- package/src/lib/scan.js +81 -33
- package/src/lib/spec-ops.js +228 -3
- package/src/lib/suggest.js +1 -0
- package/src/lib/templates.js +89 -0
- package/src/lib/usage.js +89 -0
- package/src/lib/version.js +1 -0
- package/templates/.gitkeep +0 -0
- package/templates/AGENTS.md.template +71 -75
- package/templates/change/spec-delta.md.template +13 -7
|
@@ -22,41 +22,54 @@ prompt and approves; do not make them run the CLI or hand-author artifacts.
|
|
|
22
22
|
spec each, `doctrina clarify --all` + `doctrina validate`, then flip the
|
|
23
23
|
intake to `Status: converted`). After conversion the specs are the only
|
|
24
24
|
source of truth — never edit `intake.md` to change requirements.
|
|
25
|
-
- **Day-to-day.**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
25
|
+
- **Day-to-day.** Start every session with `doctrina prime` (gates, rules,
|
|
26
|
+
open work in one read). Turn any request into a change with `doctrina
|
|
27
|
+
work "<prompt>"` and follow the printed playbook (spec delta → tasks →
|
|
28
|
+
implement → close). Preview a close with `doctrina change check <id>`;
|
|
29
|
+
close with `doctrina close <id>`. Unsure what's next? `doctrina next`.
|
|
30
|
+
Before compaction or handover: `doctrina handoff`. Ask the human only on
|
|
31
|
+
genuine ambiguity.
|
|
32
|
+
|
|
33
|
+
<!-- doctrina:surface:begin — CLI-owned block, generated from the installed command catalog. Refreshed by `doctrina upgrade --write`; edits inside are overwritten. -->
|
|
34
|
+
## Doctrina command surface (generated — reach for these, don't hand-author)
|
|
35
|
+
|
|
36
|
+
Every command, with the moment you reach for it. The CLI scaffolds from
|
|
37
|
+
canonical templates and keeps `index.json` in sync — prefer it over
|
|
38
|
+
hand-authoring. Flags and detail: `doctrina <command> --help`.
|
|
39
|
+
**Bootstrap**
|
|
40
|
+
- `doctrina init` — scaffold AGENTS.md and .doctrina/. *When:* starting a project that has no AGENTS.md yet.
|
|
41
|
+
- `doctrina intake` — store the intent and print the bootstrap playbook. *When:* you have a full project description and no specs yet.
|
|
42
|
+
- `doctrina adapter list|add|remove` — install/remove agent adapters (additive). *When:* adding or removing an agent's pointer files.
|
|
43
|
+
**Orient**
|
|
44
|
+
- `doctrina prime (session start)` — gates, standing rules, and open work in one read. *When:* at the START of every session.
|
|
45
|
+
- `doctrina context [<cap>] --for "<task>" --concat` — the read pack, assembled to fit a token budget. *When:* before working on any task, to load the right files.
|
|
46
|
+
- `doctrina show` — point-read a single artifact by reference. *When:* you need one requirement, criterion, or ADR, not a file.
|
|
47
|
+
- `doctrina search` — search the artifact tree, grouped by category. *When:* you do not know which artifact mentions a term.
|
|
48
|
+
- `doctrina status` — index, coverage, trace, and artifact counts. *When:* you need the health of the tree at a glance.
|
|
49
|
+
- `doctrina next` — the recommended next workflow action. *When:* you finished something and do not know what follows.
|
|
50
|
+
- `doctrina why` — provenance: intent, proof, ADRs, and history. *When:* you need to justify or trace a capability's existence.
|
|
51
|
+
- `doctrina handoff (before compaction/handover)` — a resume note: open work, task state, next command. *When:* BEFORE compaction or handing over to another session.
|
|
52
|
+
- `doctrina constitution` — accepted ADRs and product non-goals. *When:* you need the standing rules before deciding something.
|
|
53
|
+
**Change**
|
|
54
|
+
- `doctrina work "<prompt>" (--capability · --chore · --from-diff · --quiet)` — scaffold a change and print the playbook to execute. *When:* any request arrives that changes behaviour.
|
|
55
|
+
- `doctrina spec new|list|set` — create, list, and edit capability specs. *When:* a capability needs creating or its headers advancing.
|
|
56
|
+
- `doctrina change new|apply|archive|check|tick|diff|abandon` — new / apply / archive / check / tick / diff / abandon. *When:* driving a change through its lifecycle by hand.
|
|
57
|
+
- `doctrina contract new|list|check` — own and verify the integration surface. *When:* the change touches ports, env vars, or public endpoints.
|
|
58
|
+
- `doctrina decision new|accept|land|supersede|list|scope` — record, accept, land, scope, and supersede ADRs. *When:* the change decides something a later session must not relitigate.
|
|
59
|
+
- `doctrina skill new|list|sync|suggest` — capture on-demand procedural memory. *When:* a lesson is worth not relearning.
|
|
60
|
+
- `doctrina intent add|list` — append and list product intent anchors. *When:* new product intent appears after the intake.
|
|
61
|
+
**Gate**
|
|
62
|
+
- `doctrina analyze` — structural pre-flight on a change folder. *When:* before applying a change.
|
|
63
|
+
- `doctrina clarify --all (--lang pt|en)` — smell-test Markdown for ambiguity. *When:* before applying, or before opening a PR.
|
|
64
|
+
- `doctrina validate (--fix)` — schema, structure, EARS, and index drift. *When:* after any artifact edit, and before considering work done.
|
|
65
|
+
- `doctrina coverage --strict` — acceptance criteria against cited evidence. *When:* before claiming a capability is proven.
|
|
66
|
+
- `doctrina trace --strict` — intent provenance across the tree. *When:* checking that product intent still maps to capabilities.
|
|
67
|
+
- `doctrina review` — conformance of your changes vs specs/ADRs/contracts. *When:* before handing work back, to self-review it.
|
|
68
|
+
- `doctrina verify` — the project's declared typecheck/test/build checks. *When:* the real build gate must run.
|
|
69
|
+
- `doctrina close <id...>` — the whole closing sequence in one attested pass. *When:* a change is implemented and ready to finish.
|
|
70
|
+
- `doctrina doctor` — aggregate diagnostic with per-finding remedies. *When:* something looks wrong and you do not know which gate to ask.
|
|
71
|
+
**Maintain** (triggers: `doctrina <command> --help`) — `doctrina templates list|check|update` · `doctrina hooks install` · `doctrina index rebuild` · `doctrina watch` · `doctrina metrics` · `doctrina report` · `doctrina completion` · `doctrina upgrade --write`
|
|
72
|
+
<!-- doctrina:surface:end -->
|
|
60
73
|
|
|
61
74
|
## Stack and tooling
|
|
62
75
|
|
|
@@ -88,55 +101,38 @@ After a CLI update: `doctrina upgrade --write` brings this project up.
|
|
|
88
101
|
- Archived changes in `.doctrina/changes/archive/` are out of the default
|
|
89
102
|
read path; consult only when explicitly debugging history.
|
|
90
103
|
|
|
91
|
-
## Artifact invariants (
|
|
92
|
-
|
|
93
|
-
Scaffold
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
- **
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
- **Change folder** at `.doctrina/changes/<id>/` must contain a file named
|
|
107
|
-
exactly `proposal.md` (not `change.md`, not `README.md`). `tasks.md` and
|
|
108
|
-
`design.md` are optional siblings.
|
|
109
|
-
- **Spec** lives at `.doctrina/specs/<capability>/spec.md` and its
|
|
110
|
-
`**Version:**` header must equal the `version` recorded for it in
|
|
111
|
-
`.doctrina/index.json`.
|
|
112
|
-
- **Every artifact on disk** must be registered in `.doctrina/index.json`,
|
|
113
|
-
and every path in `index.json` must exist on disk. Update the index in
|
|
114
|
-
the same change that adds or moves a file.
|
|
115
|
-
|
|
116
|
-
Always finish by running `doctrina validate` and resolving every `error:`
|
|
117
|
-
before considering work done.
|
|
104
|
+
## Artifact invariants (`doctrina validate` enforces these)
|
|
105
|
+
|
|
106
|
+
Scaffold with the CLI; do not hand-author from memory. If you must:
|
|
107
|
+
|
|
108
|
+
- **Headers:** ADRs / proposals / intake use list items
|
|
109
|
+
(`- **Status:** accepted`); specs use bare bold (`**Status:** active`).
|
|
110
|
+
- **ADR filename:** `NNNN-slug.md`, four digits. Other shapes are invisible
|
|
111
|
+
to `decision accept`, the index, and the orphan check.
|
|
112
|
+
- **Change folder:** `.doctrina/changes/<id>/proposal.md`, that exact name.
|
|
113
|
+
- **Spec:** `.doctrina/specs/<cap>/spec.md`; its `**Version:**` must equal
|
|
114
|
+
the version recorded in `index.json`.
|
|
115
|
+
- **Every artifact** is registered in `index.json`, and every indexed path
|
|
116
|
+
exists. Update the index in the same change.
|
|
117
|
+
|
|
118
|
+
Finish by running `doctrina validate` and resolving every `error:`.
|
|
118
119
|
|
|
119
120
|
## How to read context efficiently
|
|
120
121
|
|
|
121
122
|
`doctrina context [<capability>] --concat` assembles the read pack in one
|
|
122
|
-
call
|
|
123
|
-
|
|
124
|
-
`Status: accepted`. Run it for ANY task, not only `doctrina work`; it skips
|
|
125
|
-
`changes/archive/` (history — read only when debugging it).
|
|
123
|
+
call: this `AGENTS.md` → `product.md` → the capability spec → open changes →
|
|
124
|
+
accepted ADRs. Run it for ANY task. It skips `changes/archive/` (history).
|
|
126
125
|
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
Skills are on demand: read the `description:` / `when:` frontmatter in
|
|
127
|
+
`.doctrina/skills/`; load a body only when its trigger fires.
|
|
129
128
|
|
|
130
|
-
Keep this file under 150 lines. Density beats prose.
|
|
129
|
+
Keep this file under 150 lines. Density beats prose.
|
|
131
130
|
|
|
132
131
|
## Definition of done
|
|
133
132
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
- The change folder has been moved to `.doctrina/changes/archive/`.
|
|
138
|
-
- Any architectural decisions are recorded as ADRs with `Status: accepted`.
|
|
139
|
-
- `.doctrina/index.json` has been updated.
|
|
133
|
+
`doctrina close <id>` is the definition: tasks checked, deltas merged into
|
|
134
|
+
specs, gates green, ADRs recorded and accepted, change archived, index
|
|
135
|
+
updated. If close refuses, the change is not done.
|
|
140
136
|
|
|
141
137
|
## What never goes in this file
|
|
142
138
|
|
|
@@ -7,21 +7,27 @@
|
|
|
7
7
|
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
|
-
For MODIFIED:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
manual-merge pointer.
|
|
10
|
+
For MODIFIED: prefer a fenced `ops` block — on apply the CLI executes it
|
|
11
|
+
against the target spec, all ops or none (ADR 0007). The verbs cover
|
|
12
|
+
headers, acceptance criteria, AND the EARS requirement bullets, so a
|
|
13
|
+
typical delta applies mechanically end to end; only free-prose rewrites
|
|
14
|
+
(Purpose, Maturity, ...) stay a by-hand merge. A MODIFIED delta with no
|
|
15
|
+
`ops` block prints a manual-merge pointer.
|
|
17
16
|
|
|
18
17
|
```ops
|
|
19
18
|
set-header Implementation: verified — durable adapter (`src/db.ts`)
|
|
20
19
|
bump-version minor
|
|
21
20
|
set-criterion 1: verified
|
|
22
21
|
append-criterion [unverified] new signal — verified by `test/x.test.ts`
|
|
22
|
+
append-requirement event: When <trigger>, the system shall <action>.
|
|
23
|
+
replace-requirement ubiquitous 2: The system shall <action>.
|
|
23
24
|
```
|
|
24
25
|
|
|
26
|
+
Requirement sections: ubiquitous | event | state | unwanted | optional.
|
|
27
|
+
append-* ops resolve numbering/position at APPLY time, so several open
|
|
28
|
+
changes appending to the same spec never collide on numbers — order of
|
|
29
|
+
application decides.
|
|
30
|
+
|
|
25
31
|
For REMOVED: the body may be empty; on apply, the target spec file is
|
|
26
32
|
deleted and the capability is recorded in the change archive only.
|
|
27
33
|
-->
|