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.
- package/README.md +32 -13
- package/package.json +1 -1
- package/src/commands/change.js +128 -38
- package/src/commands/close.js +104 -0
- package/src/commands/coverage.js +100 -20
- package/src/commands/hooks.js +9 -3
- package/src/commands/next.js +56 -3
- package/src/commands/review.js +177 -0
- package/src/commands/skill.js +112 -2
- package/src/commands/spec.js +92 -6
- package/src/commands/status.js +178 -0
- package/src/commands/trace.js +31 -0
- package/src/commands/validate.js +97 -11
- package/src/commands/verify.js +234 -13
- package/src/commands/watch.js +97 -0
- package/src/commands/why.js +182 -0
- package/src/commands/work.js +241 -20
- package/src/index.js +13 -1
- package/src/lib/spec-ops.js +236 -0
- package/templates/AGENTS.md.template +49 -22
- package/templates/change/spec-delta.md.template +13 -2
- package/templates/hooks/pre-commit.sample +21 -4
- package/templates/spec.md.template +7 -3
|
@@ -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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
change requirements.
|
|
25
|
-
- **Day-to-day.** Turn
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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.
|
|
12
|
-
|
|
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`.
|
|
4
|
-
#
|
|
5
|
-
#
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|