doctrina-cli 0.1.0 → 0.2.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 (57) hide show
  1. package/README.md +27 -5
  2. package/package.json +4 -2
  3. package/src/commands/analyze.js +5 -5
  4. package/src/commands/change.js +113 -16
  5. package/src/commands/clarify.js +81 -18
  6. package/src/commands/context.js +129 -0
  7. package/src/commands/decision.js +91 -8
  8. package/src/commands/hooks.js +3 -3
  9. package/src/commands/index-rebuild.js +109 -0
  10. package/src/commands/init.js +58 -7
  11. package/src/commands/intake.js +166 -0
  12. package/src/commands/metrics.js +190 -0
  13. package/src/commands/next.js +108 -0
  14. package/src/commands/search.js +93 -0
  15. package/src/commands/skill.js +58 -5
  16. package/src/commands/spec.js +49 -7
  17. package/src/commands/templates.js +103 -4
  18. package/src/commands/validate.js +76 -9
  19. package/src/commands/work.js +215 -0
  20. package/src/index.js +26 -3
  21. package/src/lib/diff.js +103 -0
  22. package/src/lib/ears.js +108 -0
  23. package/src/lib/fs-ops.js +12 -0
  24. package/src/lib/scan.js +185 -0
  25. package/src/lib/templates.js +2 -2
  26. package/templates/AGENTS.md.template +83 -0
  27. package/templates/README.md +85 -0
  28. package/templates/adapters/aider/CONVENTIONS.md.template +11 -0
  29. package/templates/adapters/amp/README.md +13 -0
  30. package/templates/adapters/claude/CLAUDE.md.template +11 -0
  31. package/templates/adapters/codex/README.md +12 -0
  32. package/templates/adapters/continue/.continue/rules/00-doctrina.md.template +11 -0
  33. package/templates/adapters/copilot/.github/copilot-instructions.md.template +11 -0
  34. package/templates/adapters/cursor/.cursor/rules/00-doctrina.mdc.template +16 -0
  35. package/templates/adapters/devin/README.md +14 -0
  36. package/templates/adapters/factory/README.md +13 -0
  37. package/templates/adapters/gemini/GEMINI.md.template +11 -0
  38. package/templates/adapters/jules/README.md +13 -0
  39. package/templates/adapters/windsurf/.windsurfrules.template +11 -0
  40. package/templates/change/design.md.template +24 -0
  41. package/templates/change/proposal.md.template +26 -0
  42. package/templates/change/spec-delta.md.template +20 -0
  43. package/templates/change/tasks.md.template +17 -0
  44. package/templates/decision.md.template +56 -0
  45. package/templates/doctrina/changes/.gitkeep +0 -0
  46. package/templates/doctrina/changes/archive/.gitkeep +0 -0
  47. package/templates/doctrina/decisions/.gitkeep +0 -0
  48. package/templates/doctrina/index.json.template +19 -0
  49. package/templates/doctrina/product.md.template +31 -0
  50. package/templates/doctrina/skills/.gitkeep +0 -0
  51. package/templates/doctrina/specs/.gitkeep +0 -0
  52. package/templates/doctrina/templates/.gitkeep +0 -0
  53. package/templates/hooks/pre-commit.sample +7 -0
  54. package/templates/hooks/watch.sample +21 -0
  55. package/templates/skill.md.template +49 -0
  56. package/templates/spec-bug.md.template +40 -0
  57. package/templates/spec.md.template +52 -0
@@ -0,0 +1,16 @@
1
+ ---
2
+ description: Doctrina canonical rules — always read AGENTS.md first
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Doctrina pointer rule
7
+
8
+ This project uses the open AGENTS.md standard as the single source of
9
+ truth for agent-readable rules. Before answering or editing, read the
10
+ canonical file at `{{AGENTS_MD_PATH}}`.
11
+
12
+ The Doctrina framework artifacts (specs, decisions, changes) live under
13
+ `.doctrina/`. Read order is documented in `AGENTS.md`.
14
+
15
+ Do not duplicate rules here. If a rule belongs in AGENTS.md, put it
16
+ there and re-read this project.
@@ -0,0 +1,14 @@
1
+ # Cognition Devin adapter
2
+
3
+ Cognition Devin reads `AGENTS.md` natively as part of its
4
+ support for the open AGENTS.md standard (per the Linux
5
+ Foundation's December 2025 announcement). No adapter file is
6
+ installed for Devin.
7
+
8
+ This directory exists so the templates inventory is symmetric
9
+ across supported agents, and so future Devin-specific
10
+ affordances (custom session configs, for example) have an
11
+ obvious home.
12
+
13
+ If you are reading this because `doctrina init --agent devin`
14
+ did not create any files: that is the intended behaviour.
@@ -0,0 +1,13 @@
1
+ # Factory AI adapter
2
+
3
+ Factory AI reads `AGENTS.md` natively as part of its support
4
+ for the open AGENTS.md standard (per the Linux Foundation's
5
+ December 2025 announcement). No adapter file is installed for
6
+ Factory.
7
+
8
+ This directory exists so the templates inventory is symmetric
9
+ across supported agents, and so future Factory-specific
10
+ affordances have an obvious home.
11
+
12
+ If you are reading this because `doctrina init --agent factory`
13
+ did not create any files: that is the intended behaviour.
@@ -0,0 +1,11 @@
1
+ # GEMINI.md — {{PROJECT_NAME}}
2
+
3
+ This project uses the open AGENTS.md standard as the single source of
4
+ truth for agent-readable rules. The canonical file is at the
5
+ repository root; this `GEMINI.md` is a thin pointer so Gemini CLI's
6
+ auto-loading picks it up.
7
+
8
+ See `{{AGENTS_MD_PATH}}` for the operational rules.
9
+
10
+ The Doctrina framework artifacts (specs, decisions, changes) live
11
+ under `.doctrina/`. Read order is documented in AGENTS.md.
@@ -0,0 +1,13 @@
1
+ # Google Jules adapter
2
+
3
+ Google Jules (autonomous coding agent) reads `AGENTS.md`
4
+ natively as part of its support for the open AGENTS.md standard
5
+ (per the Linux Foundation's December 2025 announcement). No
6
+ adapter file is installed for Jules.
7
+
8
+ This directory exists so the templates inventory is symmetric
9
+ across supported agents, and so future Jules-specific
10
+ affordances have an obvious home.
11
+
12
+ If you are reading this because `doctrina init --agent jules`
13
+ did not create any files: that is the intended behaviour.
@@ -0,0 +1,11 @@
1
+ # Windsurf rules — {{PROJECT_NAME}}
2
+
3
+ This project uses the open AGENTS.md standard as the single source of
4
+ truth for agent-readable rules. Before answering or editing, read the
5
+ canonical file at `{{AGENTS_MD_PATH}}`.
6
+
7
+ The Doctrina framework artifacts (specs, decisions, changes) live
8
+ under `.doctrina/`. Read order is documented in AGENTS.md.
9
+
10
+ Do not duplicate rules in this file. If a rule belongs in AGENTS.md,
11
+ put it there.
@@ -0,0 +1,24 @@
1
+ # Design — Change {{CHANGE_ID}}
2
+
3
+ <!--
4
+ Optional, but recommended for any change with non-trivial design choices.
5
+ If this change is mechanical (a renamed field, a typo fix), delete this
6
+ file rather than leaving it empty.
7
+ -->
8
+
9
+ ## Approach
10
+
11
+ <!-- The chosen approach in one or two paragraphs. -->
12
+
13
+ ## Alternatives considered
14
+
15
+ <!-- The shortlist of approaches you rejected and why. -->
16
+
17
+ ## Trade-offs and risks
18
+
19
+ <!-- What this design costs and where it can break. -->
20
+
21
+ ## Decisions to record as ADRs
22
+
23
+ <!-- List any architectural decisions surfaced by this change that should
24
+ become their own ADR. Empty if none. -->
@@ -0,0 +1,26 @@
1
+ # Change {{CHANGE_ID}} — {{CHANGE_TITLE}}
2
+
3
+ - **Status:** proposed
4
+ - **Date:** {{DATE}}
5
+ - **Owner:**
6
+ - **Affects specs:**
7
+
8
+ ## Why
9
+
10
+ <!-- The user-visible or technical reason this change exists. -->
11
+
12
+ ## What
13
+
14
+ <!-- The shape of the change: artifacts created or modified, specs affected. -->
15
+
16
+ ## Scope boundaries
17
+
18
+ <!-- Anything adjacent that this change deliberately does NOT touch. -->
19
+
20
+ ## Verification
21
+
22
+ <!-- How you will know the change is correctly applied. -->
23
+
24
+ ## Open questions
25
+
26
+ <!-- List unresolved decisions. Empty if none. -->
@@ -0,0 +1,20 @@
1
+ # Spec Delta — capability: {{CAPABILITY}}
2
+
3
+ **Operation:** ADDED | MODIFIED | REMOVED
4
+ **Target spec on apply:** `.doctrina/specs/{{CAPABILITY}}/spec.md`
5
+
6
+ <!--
7
+ For ADDED: include the full new spec body below. On apply, the body is
8
+ written verbatim to the target path.
9
+
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.
13
+
14
+ For REMOVED: the body may be empty; on apply, the target spec file is
15
+ deleted and the capability is recorded in the change archive only.
16
+ -->
17
+
18
+ ---
19
+
20
+ <!-- delta body below -->
@@ -0,0 +1,17 @@
1
+ # Tasks — Change {{CHANGE_ID}}
2
+
3
+ <!--
4
+ Each task is a single checkable item. Keep tasks small (under a few hours
5
+ of work). The change is done when every box is checked, including the
6
+ three closing steps at the bottom.
7
+ -->
8
+
9
+ - [ ]
10
+ - [ ]
11
+ - [ ]
12
+
13
+ ## Closing steps
14
+
15
+ - [ ] Apply the change: merge each delta into the corresponding spec.
16
+ - [ ] Archive the change folder to `.doctrina/changes/archive/{{DATE}}-{{CHANGE_ID}}/`.
17
+ - [ ] Update `.doctrina/index.json` with new or modified artifacts.
@@ -0,0 +1,56 @@
1
+ # ADR {{DECISION_NUMBER}} — {{DECISION_TITLE}}
2
+
3
+ - **Status:** proposed
4
+ - **Date:** {{DATE}}
5
+ - **Deciders:**
6
+ - **Supersedes:** —
7
+ - **Superseded by:** —
8
+
9
+ ## Context
10
+
11
+ <!--
12
+ The forces at play: business goals, technical constraints, prior
13
+ decisions, options ruled out before deliberation. Reader should
14
+ understand WHY this decision is being made now, not just what was
15
+ chosen.
16
+ -->
17
+
18
+ ## Decision
19
+
20
+ <!--
21
+ What was decided. Active voice. State the choice plainly. If the
22
+ decision has scope limits, state them.
23
+ -->
24
+
25
+ ## Alternatives considered
26
+
27
+ <!--
28
+ The shortlist of approaches that were on the table. For each, a sentence
29
+ on why it was not chosen. Even rejected alternatives carry value: they
30
+ prevent the next reader from re-running the same debate.
31
+ -->
32
+
33
+ 1.
34
+ 2.
35
+
36
+ ## Consequences
37
+
38
+ **Positive**
39
+
40
+ -
41
+
42
+ **Negative**
43
+
44
+ -
45
+
46
+ **Neutral**
47
+
48
+ -
49
+
50
+ <!--
51
+ Once this ADR is accepted, do not edit it. To change the decision,
52
+ create a new ADR that supersedes this one and update the "Superseded by"
53
+ header above to point at the new ADR. Status transitions:
54
+ proposed -> accepted | rejected
55
+ accepted -> deprecated | superseded by NNNN
56
+ -->
File without changes
File without changes
File without changes
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema_version": "0.1.0",
3
+ "project": "{{PROJECT_NAME}}",
4
+ "framework_version": "0.0.0",
5
+ "last_updated": "{{DATE}}",
6
+ "artifacts": {
7
+ "product": {
8
+ "path": ".doctrina/product.md",
9
+ "status": "active",
10
+ "version": "0.1.0",
11
+ "last_updated": "{{DATE}}"
12
+ },
13
+ "specs": [],
14
+ "decisions": [],
15
+ "changes": [],
16
+ "changes_archive": [],
17
+ "skills": []
18
+ }
19
+ }
@@ -0,0 +1,31 @@
1
+ # {{PROJECT_NAME}} — Product
2
+
3
+ ## Vision
4
+
5
+ <!-- One short paragraph: what this project exists to do, for whom, why now. -->
6
+
7
+ ## Problem
8
+
9
+ <!-- The specific user pain or technical gap this project addresses. -->
10
+
11
+ ## Target users
12
+
13
+ <!-- Who benefits. Be specific; avoid "everyone". -->
14
+
15
+ ## Scope
16
+
17
+ In scope:
18
+
19
+ -
20
+
21
+ Out of scope (deferred or rejected):
22
+
23
+ -
24
+
25
+ ## Non-goals
26
+
27
+ <!-- Explicit things this project will NOT try to be. -->
28
+
29
+ ## Success criteria
30
+
31
+ <!-- How you will know this project is working. Prefer measurable signals. -->
File without changes
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env sh
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.
6
+
7
+ doctrina validate
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env sh
2
+ # Doctrina on-save watcher (sample).
3
+ #
4
+ # Re-runs `doctrina validate` whenever a Markdown file under
5
+ # .doctrina/ or docs/ changes. Pair with `doctrina hooks install` for
6
+ # pre-commit validation; this script gives you the on-save loop too.
7
+ #
8
+ # Requires a path watcher to be installed. Two common choices:
9
+ #
10
+ # entr (POSIX, portable) https://github.com/eradman/entr
11
+ # fswatch (macOS / Linux / BSD) https://github.com/emcrisostomo/fswatch
12
+ #
13
+ # Edit the body below to match your watcher of choice. The CLI does
14
+ # not install or run this script — wire it into your dev setup
15
+ # (a Make target, an npm script, a tmux pane) by hand.
16
+
17
+ # entr example (default):
18
+ find .doctrina docs -name '*.md' 2>/dev/null | entr -c doctrina validate
19
+
20
+ # fswatch example (uncomment to use):
21
+ # fswatch -o .doctrina docs | xargs -n1 -I{} doctrina validate
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: {{SKILL_NAME}}
3
+ description: <one-sentence summary of what this skill helps the agent do>
4
+ when: <one-sentence trigger — when the agent should load this skill>
5
+ ---
6
+
7
+ # Skill — {{SKILL_NAME}}
8
+
9
+ ## When to use this skill
10
+
11
+ <!--
12
+ Be specific about the trigger. Examples that DO work:
13
+ - The agent is asked to add or modify a database migration.
14
+ - The agent is reviewing a PR that touches public API surface.
15
+ - The agent is investigating a production incident.
16
+
17
+ Examples that DON'T work (too vague):
18
+ - "Whenever the agent is coding."
19
+ - "Anytime there is a problem."
20
+ -->
21
+
22
+ ## Procedure
23
+
24
+ <!--
25
+ Step-by-step. Exact commands beat advice. Verifiable checks beat
26
+ adjectives. Same rules as AGENTS.md.
27
+ -->
28
+
29
+ 1.
30
+ 2.
31
+ 3.
32
+
33
+ ## Anti-patterns
34
+
35
+ <!--
36
+ Things this skill exists to prevent. Be concrete: a real failure
37
+ mode you have seen.
38
+ -->
39
+
40
+ -
41
+
42
+ ## Related material
43
+
44
+ <!--
45
+ Cross-links to the spec, ADR, or other artifacts that this skill
46
+ references or extends.
47
+ -->
48
+
49
+ - [Workflow](../../docs/en/workflow.md)
@@ -0,0 +1,40 @@
1
+ # Bug spec — {{CAPABILITY}}
2
+
3
+ **Capability:** {{CAPABILITY}}
4
+ **Type:** bug
5
+ **Status:** active
6
+ **Last updated:** {{DATE}}
7
+ **Version:** 0.1.0
8
+
9
+ ## Current behaviour
10
+
11
+ <!--
12
+ What the system does today, exactly. Reproduce the wrong path.
13
+ Include input, observed output, and any error messages.
14
+ -->
15
+
16
+ ## Expected behaviour
17
+
18
+ <!--
19
+ What it should do instead, exactly. Be specific about inputs and
20
+ outputs that change.
21
+ -->
22
+
23
+ ## Unchanged behaviour
24
+
25
+ <!--
26
+ What must keep working. The guard-rail that prevents "fix the bug,
27
+ break two adjacent features". Reference the capabilities, flows,
28
+ or files this bug fix must NOT alter.
29
+ -->
30
+
31
+ ## Acceptance criteria
32
+
33
+ <!-- Observable signals the bug is fixed and the guard-rails hold. -->
34
+
35
+ 1.
36
+ 2.
37
+
38
+ ## Out of scope
39
+
40
+ <!-- Adjacent issues this fix deliberately does not address. -->
@@ -0,0 +1,52 @@
1
+ # Spec — {{CAPABILITY}}
2
+
3
+ **Capability:** {{CAPABILITY}}
4
+ **Status:** active
5
+ **Last updated:** {{DATE}}
6
+ **Version:** 0.1.0
7
+
8
+ ## Purpose
9
+
10
+ <!-- One paragraph: what this capability does and why it exists. -->
11
+
12
+ ## Requirements (EARS)
13
+
14
+ <!--
15
+ Easy Approach to Requirements Syntax. Use one of the five forms per item:
16
+
17
+ - Ubiquitous: The system shall <action>.
18
+ - Event-driven: When <trigger>, the system shall <action>.
19
+ - State-driven: While <state>, the system shall <action>.
20
+ - Unwanted-behavior: The system shall not <action> [when <trigger>].
21
+ - Optional: Where <feature available>, the system may <action>.
22
+ -->
23
+
24
+ ### Ubiquitous
25
+
26
+ -
27
+
28
+ ### Event-driven
29
+
30
+ -
31
+
32
+ ### State-driven
33
+
34
+ -
35
+
36
+ ### Unwanted-behavior (must-not)
37
+
38
+ -
39
+
40
+ ### Optional
41
+
42
+ -
43
+
44
+ ## Acceptance criteria
45
+
46
+ <!-- Concrete, observable signals that the capability is correctly implemented. -->
47
+
48
+ 1.
49
+
50
+ ## Out of scope for this spec
51
+
52
+ -