doctrina-cli 0.13.0 → 0.15.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.
Files changed (71) hide show
  1. package/README.md +1 -1
  2. package/package.json +3 -2
  3. package/src/commands/adapter.js +205 -0
  4. package/src/commands/analyze.js +120 -17
  5. package/src/commands/change.js +100 -42
  6. package/src/commands/clarify.js +8 -1
  7. package/src/commands/close.js +57 -2
  8. package/src/commands/completion.js +6 -0
  9. package/src/commands/constitution.js +8 -1
  10. package/src/commands/context.js +391 -58
  11. package/src/commands/contract.js +76 -43
  12. package/src/commands/coverage.js +126 -12
  13. package/src/commands/decision.js +172 -40
  14. package/src/commands/doctor.js +92 -11
  15. package/src/commands/handoff.js +8 -1
  16. package/src/commands/hooks.js +6 -0
  17. package/src/commands/index-rebuild.js +8 -1
  18. package/src/commands/init.js +139 -6
  19. package/src/commands/intake.js +11 -2
  20. package/src/commands/intent.js +8 -1
  21. package/src/commands/metrics.js +80 -7
  22. package/src/commands/next.js +38 -3
  23. package/src/commands/prime.js +8 -1
  24. package/src/commands/report.js +8 -1
  25. package/src/commands/review.js +8 -1
  26. package/src/commands/search.js +8 -1
  27. package/src/commands/show.js +8 -1
  28. package/src/commands/skill.js +201 -8
  29. package/src/commands/spec.js +13 -6
  30. package/src/commands/status.js +14 -2
  31. package/src/commands/templates.js +193 -59
  32. package/src/commands/trace.js +15 -3
  33. package/src/commands/triage.js +248 -0
  34. package/src/commands/upgrade.js +8 -1
  35. package/src/commands/validate.js +148 -5
  36. package/src/commands/verify.js +126 -5
  37. package/src/commands/watch.js +8 -1
  38. package/src/commands/why.js +10 -24
  39. package/src/commands/work.js +44 -3
  40. package/src/index.js +61 -6
  41. package/src/lib/adapters.js +140 -0
  42. package/src/lib/adr-guard.js +1 -0
  43. package/src/lib/args.js +10 -0
  44. package/src/lib/clarity.js +1 -0
  45. package/src/lib/colors.js +1 -0
  46. package/src/lib/commands.js +252 -27
  47. package/src/lib/criteria.js +1 -0
  48. package/src/lib/dates.js +1 -0
  49. package/src/lib/diff.js +1 -0
  50. package/src/lib/doc-model.js +287 -0
  51. package/src/lib/docs-impact.js +167 -0
  52. package/src/lib/ears.js +1 -0
  53. package/src/lib/exit-codes.js +103 -0
  54. package/src/lib/flag-catalog.js +106 -0
  55. package/src/lib/fs-ops.js +1 -0
  56. package/src/lib/gates.js +123 -0
  57. package/src/lib/git.js +97 -0
  58. package/src/lib/index-json.js +14 -6
  59. package/src/lib/json-out.js +83 -0
  60. package/src/lib/pipeline.js +161 -0
  61. package/src/lib/prompt.js +18 -1
  62. package/src/lib/runtime.js +683 -0
  63. package/src/lib/scan.js +81 -33
  64. package/src/lib/spec-ops.js +94 -9
  65. package/src/lib/suggest.js +1 -0
  66. package/src/lib/templates.js +89 -0
  67. package/src/lib/usage.js +89 -0
  68. package/src/lib/version.js +1 -0
  69. package/templates/AGENTS.md.template +59 -53
  70. package/templates/contract.md.template +74 -3
  71. package/templates/spec.md.template +22 -0
@@ -32,11 +32,82 @@ Variables the running system requires, named IDENTICALLY across code,
32
32
  `.env.example`, and infra (compose/helm). `doctrina contract check` warns
33
33
  when a variable here is missing from `.env.example` — the DATABASE_URL /
34
34
  KAFKA_BROKER drift class.
35
+
36
+ Values declares an ENUM when the variable is one. Write the alternation
37
+ with escaped pipes so the table survives: `none\|critical\|serious`.
38
+ check then fails an .env.example value outside the set (RT04), and warns
39
+ when the consumer never mentions any member — an enum nothing validates.
40
+ Leave Values empty or `—` for free-form variables.
41
+ -->
42
+
43
+ | Variable | Required | Values | Example |
44
+ |--------------|----------|--------|-------------------------------------------|
45
+ | DATABASE_URL | yes | — | postgres://user:pass@localhost:5432/app |
46
+
47
+ ## Wiring
48
+
49
+ <!--
50
+ Where each variable's value COMES FROM, and what reads it. This is the
51
+ table that closes the gap between "I configured it" and "the process saw
52
+ it": a variable can be set in the CI provider and still never reach the
53
+ program, because no `env:` line ever exports it.
54
+
55
+ Origin vars | secrets | literal | local
56
+ vars and secrets are CI-injected, and CI injects the EMPTY
57
+ STRING for one that is unset — not "absent". That is why a
58
+ `getenv(NAME, default)` default silently never applies.
59
+ Workflow repo-relative path to the workflow/pipeline file.
60
+ Job/Step the job (or step) whose env: block must export it.
61
+ Consumer the file that reads it.
62
+
63
+ `doctrina contract check` then verifies (RT01/RT02) that the workflow
64
+ really exports it, from the origin and under the name declared, and
65
+ (RT03) that the consumer does not give it a default only an ABSENT
66
+ value would trigger.
67
+
68
+ Delete the rows that do not apply. A contract with no Wiring rows is
69
+ not "verified" — it is unchecked, and check says so.
70
+ -->
71
+
72
+ | Variable | Origin | Workflow | Job/Step | Consumer |
73
+ |----------|--------|----------|----------|----------|
74
+ | <NAME> | vars | <path> | <job> | <file> |
75
+
76
+ ## Selectors
77
+
78
+ <!--
79
+ The test selectors (BDD tags, suite names, filter expressions) this
80
+ project DISPATCHES on. A selector that matches nothing runs zero cases
81
+ and still exits 0 — a green job that tested nothing.
82
+
83
+ Source glob for the files the selectors live in.
84
+ Pattern a regex whose FIRST GROUP captures the selector name.
85
+ Used by the selectors a pipeline actually dispatches on.
86
+
87
+ Doctrina knows no test runner: it extracts with the pattern you declare
88
+ and checks each selector in "Used by" against what it found (RT05),
89
+ naming a near-miss when only the separator differs.
90
+
91
+ Example (Behave): features/**/*.feature with pattern @([a-z0-9_-]+)
92
+ -->
93
+
94
+ | Selector | Source | Pattern | Used by |
95
+ |----------|--------|---------|---------|
96
+ | <NAME> | <glob> | <regex> | <tag> |
97
+
98
+ ## Budgets
99
+
100
+ <!--
101
+ Ceilings that are a CONTRACT, not a preference: token limits, payload
102
+ caps, timeouts. Direction distinguishes what goes IN from what comes
103
+ OUT, because they fail differently — and `doctrina analyze` refuses a
104
+ change that "fixes" an overflow by raising an OUTPUT ceiling, which
105
+ buys headroom by truncating what mattered rather than sending less.
35
106
  -->
36
107
 
37
- | Variable | Required | Example |
38
- |--------------|----------|-------------------------------------------|
39
- | DATABASE_URL | yes | postgres://user:pass@localhost:5432/app |
108
+ | Limit | Direction | Value |
109
+ |--------|--------------|---------|
110
+ | <NAME> | input/output | <count> |
40
111
 
41
112
  ## Interfaces
42
113
 
@@ -71,6 +71,28 @@ Easy Approach to Requirements Syntax. Use one of the five forms per item:
71
71
 
72
72
  -
73
73
 
74
+ ### Pipeline
75
+
76
+ <!--
77
+ OPTIONAL, and only for capabilities with an ORDER. The five EARS forms
78
+ state each requirement independently and truthfully, and say nothing about
79
+ sequence: "when the run finishes, append a summary" and "when the analysis
80
+ completes, publish the dashboard" both pass every gate, and neither says
81
+ the dashboard needs the analysis to have run first. The result ships green
82
+ and one run stale.
83
+
84
+ Declare the order and the artifact each step hands on. `doctrina validate`
85
+ then enforces the one invariant a numbered list cannot: a step may only
86
+ require what an EARLIER step produced.
87
+
88
+ 1. run-suite — produces `reports/results.json`
89
+ 2. analyse — requires `reports/results.json`, produces `reports/analysis.md`
90
+ 3. publish — requires `reports/analysis.md`
91
+
92
+ Mark inputs that come from outside the pipeline `(external)`. Delete this
93
+ section when the capability has no ordering.
94
+ -->
95
+
74
96
  ## Acceptance criteria
75
97
 
76
98
  <!--