mdkg 0.0.1 → 0.0.2

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 (67) hide show
  1. package/README.md +20 -6
  2. package/dist/cli.js +667 -11
  3. package/dist/commands/checkpoint.js +133 -0
  4. package/dist/commands/format.js +297 -0
  5. package/dist/commands/guide.js +22 -0
  6. package/dist/commands/index.js +17 -0
  7. package/dist/commands/init.js +111 -0
  8. package/dist/commands/list.js +52 -0
  9. package/dist/commands/new.js +279 -0
  10. package/dist/commands/next.js +75 -0
  11. package/dist/commands/node_card.js +17 -0
  12. package/dist/commands/pack.js +105 -0
  13. package/dist/commands/search.js +70 -0
  14. package/dist/commands/show.js +95 -0
  15. package/dist/commands/validate.js +229 -0
  16. package/dist/commands/workspace.js +101 -0
  17. package/dist/core/config.js +162 -0
  18. package/dist/core/migrate.js +30 -0
  19. package/dist/core/paths.js +14 -0
  20. package/dist/graph/edges.js +64 -0
  21. package/dist/graph/frontmatter.js +132 -0
  22. package/dist/graph/index_cache.js +50 -0
  23. package/dist/graph/indexer.js +144 -0
  24. package/dist/graph/node.js +225 -0
  25. package/dist/graph/staleness.js +31 -0
  26. package/dist/graph/template_schema.js +86 -0
  27. package/dist/graph/validate_graph.js +115 -0
  28. package/dist/graph/workspace_files.js +64 -0
  29. package/dist/init/AGENTS.md +43 -0
  30. package/dist/init/CLAUDE.md +37 -0
  31. package/dist/init/config.json +67 -0
  32. package/dist/init/core/core.md +12 -0
  33. package/dist/init/core/guide.md +99 -0
  34. package/dist/init/core/rule-1-mdkg-conventions.md +232 -0
  35. package/dist/init/core/rule-2-context-pack-rules.md +186 -0
  36. package/dist/init/core/rule-3-cli-contract.md +177 -0
  37. package/dist/init/core/rule-4-repo-safety-and-ignores.md +97 -0
  38. package/dist/init/core/rule-5-release-and-versioning.md +82 -0
  39. package/dist/init/core/rule-6-templates-and-schemas.md +186 -0
  40. package/dist/init/templates/default/bug.md +54 -0
  41. package/dist/init/templates/default/chk.md +55 -0
  42. package/dist/init/templates/default/dec.md +38 -0
  43. package/dist/init/templates/default/edd.md +50 -0
  44. package/dist/init/templates/default/epic.md +46 -0
  45. package/dist/init/templates/default/feat.md +35 -0
  46. package/dist/init/templates/default/prd.md +59 -0
  47. package/dist/init/templates/default/prop.md +45 -0
  48. package/dist/init/templates/default/rule.md +33 -0
  49. package/dist/init/templates/default/task.md +53 -0
  50. package/dist/init/templates/default/test.md +49 -0
  51. package/dist/pack/export_json.js +38 -0
  52. package/dist/pack/export_md.js +93 -0
  53. package/dist/pack/export_toon.js +7 -0
  54. package/dist/pack/export_xml.js +73 -0
  55. package/dist/pack/order.js +162 -0
  56. package/dist/pack/pack.js +181 -0
  57. package/dist/pack/types.js +2 -0
  58. package/dist/pack/verbose_core.js +23 -0
  59. package/dist/templates/loader.js +82 -0
  60. package/dist/util/argparse.js +154 -0
  61. package/dist/util/date.js +9 -0
  62. package/dist/util/errors.js +12 -0
  63. package/dist/util/filter.js +26 -0
  64. package/dist/util/output.js +50 -0
  65. package/dist/util/qid.js +54 -0
  66. package/dist/util/sort.js +40 -0
  67. package/package.json +18 -2
@@ -0,0 +1,186 @@
1
+ ---
2
+ id: rule-6
3
+ type: rule
4
+ title: mdkg templates and schemas (global templates, required frontmatter, body guidance)
5
+ tags: [mdkg, schema, templates]
6
+ owners: []
7
+ links: []
8
+ artifacts: []
9
+ relates: []
10
+ refs: []
11
+ aliases: []
12
+ created: 2026-01-06
13
+ updated: 2026-01-22
14
+ ---
15
+
16
+ # Templates and schemas
17
+
18
+ This rule defines:
19
+ - global template sets
20
+ - required frontmatter fields per node type
21
+ - recommended body headings for agent-friendly editing
22
+ - the token substitution contract used by `mdkg new`
23
+
24
+ ## Global templates (v1)
25
+
26
+ Templates are global and live at:
27
+
28
+ - `.mdkg/templates/<set>/<type>.md`
29
+
30
+ Workspace overrides are disabled in v1.
31
+
32
+ ### Template sets
33
+
34
+ Recommended sets:
35
+ - `default` (balanced)
36
+ - `minimal` (lean body headings)
37
+ - `verbose` (more guidance, more sections)
38
+
39
+ All sets should provide the same set of types.
40
+
41
+ ## Token substitution
42
+
43
+ Templates are filled using simple token replacement.
44
+
45
+ Required tokens supported by v1:
46
+ - `{{id}}`
47
+ - `{{type}}`
48
+ - `{{title}}`
49
+ - `{{created}}`
50
+ - `{{updated}}`
51
+ - `{{status}}` (work items only)
52
+ - `{{priority}}` (work items only)
53
+
54
+ Optional tokens (nice-to-have, may be empty):
55
+ - `{{epic}}`
56
+ - `{{parent}}`
57
+ - `{{prev}}`
58
+ - `{{next}}`
59
+ - `{{relates}}` (list)
60
+ - `{{blocked_by}}` (list)
61
+ - `{{blocks}}` (list)
62
+ - `{{tags}}` (list)
63
+ - `{{owners}}` (list)
64
+ - `{{links}}` (list)
65
+ - `{{artifacts}}` (list)
66
+ - `{{refs}}` (list)
67
+ - `{{aliases}}` (list)
68
+ - `{{cases}}` (list)
69
+
70
+ ## Frontmatter requirements by type
71
+
72
+ All nodes:
73
+ - `id`
74
+ - `type`
75
+ - `title`
76
+ - `created` (YYYY-MM-DD)
77
+ - `updated` (YYYY-MM-DD)
78
+
79
+ Searchable metadata (optional)
80
+
81
+ All nodes MAY include the following searchable frontmatter lists:
82
+ - `tags: [a, b, c]`
83
+ - `owners: [a, b, c]`
84
+ - `links: [ref, ref]` (any searchable reference string; may include URLs)
85
+ - `artifacts: [ref, ref]` (build outputs, releases, commits, PRs, tarballs, etc.)
86
+ - `refs: [id, id]` (non-edge references to other nodes)
87
+ - `aliases: [text, text]` (extra searchable terms)
88
+ - `cases: [id, id]` (test case identifiers; for test nodes)
89
+
90
+ List fields SHOULD be written as `[]` when empty.
91
+ Optional scalar graph fields (like `epic`, `parent`, `prev`, `next`) should be omitted when empty.
92
+
93
+ Work items (`epic/feat/task/bug/chk/test`):
94
+ - `status` (enum)
95
+ - optional `priority` (0..9)
96
+ - optional graph edges: `epic`, `parent`, `relates`, `blocked_by`, `blocks`, `prev`, `next`
97
+
98
+ Decision records (`dec-*`):
99
+ - `status` (enum: `proposed`, `accepted`, `rejected`, `superseded`)
100
+ - optional `supersedes: dec-#`
101
+
102
+ Design docs (`prd/edd/prop`):
103
+ - no required status field
104
+ - recommended `tags`
105
+
106
+ Rules (`rule-*`):
107
+ - no required status field
108
+
109
+ ## Body headings (guidance only)
110
+
111
+ Body headings are strongly recommended for agent usability but should not be hard requirements.
112
+
113
+ ### Task / bug template headings (recommended)
114
+
115
+ - Overview
116
+ - Acceptance Criteria
117
+ - Files Affected
118
+ - Implementation Notes
119
+ - Test Plan
120
+ - Links / Artifacts
121
+
122
+ ### Test template headings (recommended)
123
+
124
+ - Overview
125
+ - Target / Scope
126
+ - Preconditions / Environment
127
+ - Test Cases
128
+ - Results / Evidence
129
+ - Notes / Follow-ups
130
+
131
+ ### Epic template headings (recommended)
132
+
133
+ - Goal
134
+ - Scope
135
+ - Milestones
136
+ - Out of Scope
137
+ - Risks
138
+ - Links / Artifacts
139
+
140
+ ### Checkpoint template headings (recommended)
141
+
142
+ - Summary
143
+ - Scope Covered
144
+ - Decisions Captured
145
+ - Implementation Summary
146
+ - Verification / Testing
147
+ - Known Issues / Follow-ups
148
+ - Links / Artifacts
149
+
150
+ ### PRD headings (recommended)
151
+
152
+ - Problem
153
+ - Goals
154
+ - Non-goals
155
+ - Requirements
156
+ - Acceptance Criteria
157
+ - Metrics / Success
158
+ - Risks
159
+ - Open Questions
160
+
161
+ ### EDD headings (recommended)
162
+
163
+ - Overview
164
+ - Architecture
165
+ - Data model
166
+ - APIs / interfaces
167
+ - Failure modes
168
+ - Observability
169
+ - Security / privacy
170
+ - Testing strategy
171
+ - Rollout plan
172
+
173
+ ### Decision record headings (recommended)
174
+
175
+ - Context
176
+ - Decision
177
+ - Alternatives considered
178
+ - Consequences
179
+ - Links / references
180
+
181
+ ## Validation behavior
182
+
183
+ - Frontmatter: strict, hard fail if invalid.
184
+ - Body headings: warn only (do not break indexing).
185
+ - If a template is missing:
186
+ - `mdkg new` must fail with a helpful error (exit code 3).
@@ -0,0 +1,54 @@
1
+ ---
2
+ id: {{id}}
3
+ type: bug
4
+ title: {{title}}
5
+ status: {{status}}
6
+ priority: {{priority}}
7
+ epic: {{epic}}
8
+ parent: {{parent}}
9
+ prev: {{prev}}
10
+ next: {{next}}
11
+ tags: []
12
+ owners: []
13
+ links: []
14
+ artifacts: []
15
+ relates: []
16
+ blocked_by: []
17
+ blocks: []
18
+ refs: []
19
+ aliases: []
20
+ created: {{created}}
21
+ updated: {{updated}}
22
+ ---
23
+
24
+ # Overview
25
+
26
+ What is broken? What’s the impact?
27
+
28
+ # Reproduction Steps
29
+
30
+ 1. step 1
31
+ 2. step 2
32
+
33
+ # Expected vs Actual
34
+
35
+ - expected:
36
+ - actual:
37
+
38
+ # Suspected Cause
39
+
40
+ Hypotheses or known causes.
41
+
42
+ # Fix Plan
43
+
44
+ What needs to change?
45
+
46
+ # Test Plan
47
+
48
+ How will we verify the fix?
49
+
50
+ # Links / Artifacts
51
+
52
+ - logs
53
+ - screenshots
54
+ - related tasks
@@ -0,0 +1,55 @@
1
+ ---
2
+ id: {{id}}
3
+ type: checkpoint
4
+ title: {{title}}
5
+ status: {{status}}
6
+ priority: {{priority}}
7
+ epic: {{epic}}
8
+ parent: {{parent}}
9
+ prev: {{prev}}
10
+ next: {{next}}
11
+ tags: []
12
+ owners: []
13
+ links: []
14
+ artifacts: []
15
+ relates: []
16
+ blocked_by: []
17
+ blocks: []
18
+ refs: []
19
+ aliases: []
20
+ scope: []
21
+ created: {{created}}
22
+ updated: {{updated}}
23
+ ---
24
+
25
+ # Summary
26
+
27
+ What was completed in this phase? What is now true?
28
+
29
+ # Scope Covered
30
+
31
+ Keep `scope` frontmatter updated when possible.
32
+
33
+ # Decisions Captured
34
+
35
+ Link the most important decision records.
36
+
37
+ # Implementation Summary
38
+
39
+ What changed? What patterns or architecture emerged?
40
+
41
+ # Verification / Testing
42
+
43
+ How do we know it works? What tests were run? What was reviewed?
44
+
45
+ # Known Issues / Follow-ups
46
+
47
+ - issue 1
48
+ - issue 2
49
+
50
+ # Links / Artifacts
51
+
52
+ - packs
53
+ - PRs/commits
54
+ - docs
55
+ - dashboards
@@ -0,0 +1,38 @@
1
+ ---
2
+ id: {{id}}
3
+ type: dec
4
+ title: {{title}}
5
+ status: proposed
6
+ supersedes: {{supersedes}}
7
+ tags: []
8
+ owners: []
9
+ links: []
10
+ artifacts: []
11
+ relates: []
12
+ refs: []
13
+ aliases: []
14
+ created: {{created}}
15
+ updated: {{updated}}
16
+ ---
17
+
18
+ # Context
19
+
20
+ What is the situation? Why do we need a decision?
21
+
22
+ # Decision
23
+
24
+ What we decided and why.
25
+
26
+ # Alternatives considered
27
+
28
+ - alternative 1
29
+ - alternative 2
30
+
31
+ # Consequences
32
+
33
+ What changes because of this decision?
34
+
35
+ # Links / references
36
+
37
+ - related docs
38
+ - related tasks
@@ -0,0 +1,50 @@
1
+ ---
2
+ id: {{id}}
3
+ type: edd
4
+ title: {{title}}
5
+ tags: []
6
+ owners: []
7
+ links: []
8
+ artifacts: []
9
+ relates: []
10
+ refs: []
11
+ aliases: []
12
+ created: {{created}}
13
+ updated: {{updated}}
14
+ ---
15
+
16
+ # Overview
17
+
18
+ What are we building and why?
19
+
20
+ # Architecture
21
+
22
+ Describe the high-level structure and key components.
23
+
24
+ # Data model
25
+
26
+ Key entities and their relationships.
27
+
28
+ # APIs / interfaces
29
+
30
+ External and internal interfaces.
31
+
32
+ # Failure modes
33
+
34
+ What can go wrong and how we handle it.
35
+
36
+ # Observability
37
+
38
+ Metrics, logs, tracing, and health checks.
39
+
40
+ # Security / privacy
41
+
42
+ Data handling, access, and protections.
43
+
44
+ # Testing strategy
45
+
46
+ How we validate the design.
47
+
48
+ # Rollout plan
49
+
50
+ How we ship this safely.
@@ -0,0 +1,46 @@
1
+ ---
2
+ id: {{id}}
3
+ type: epic
4
+ title: {{title}}
5
+ status: {{status}}
6
+ priority: {{priority}}
7
+ tags: []
8
+ owners: []
9
+ links: []
10
+ artifacts: []
11
+ relates: []
12
+ blocked_by: []
13
+ blocks: []
14
+ refs: []
15
+ aliases: []
16
+ created: {{created}}
17
+ updated: {{updated}}
18
+ ---
19
+
20
+ # Goal
21
+
22
+ What outcome does this epic deliver?
23
+
24
+ # Scope
25
+
26
+ What is included?
27
+
28
+ # Milestones
29
+
30
+ - milestone 1
31
+ - milestone 2
32
+
33
+ # Out of Scope
34
+
35
+ What is explicitly excluded?
36
+
37
+ # Risks
38
+
39
+ - risk 1
40
+ - risk 2
41
+
42
+ # Links / Artifacts
43
+
44
+ - related docs
45
+ - related tasks
46
+ - external links
@@ -0,0 +1,35 @@
1
+ ---
2
+ id: {{id}}
3
+ type: feat
4
+ title: {{title}}
5
+ status: {{status}}
6
+ priority: {{priority}}
7
+ epic: {{epic}}
8
+ parent: {{parent}}
9
+ prev: {{prev}}
10
+ next: {{next}}
11
+ tags: []
12
+ owners: []
13
+ links: []
14
+ artifacts: []
15
+ relates: []
16
+ blocked_by: []
17
+ blocks: []
18
+ refs: []
19
+ aliases: []
20
+ created: {{created}}
21
+ updated: {{updated}}
22
+ ---
23
+
24
+ # Overview
25
+
26
+ What is this feature?
27
+
28
+ # Acceptance Criteria
29
+
30
+ - criterion 1
31
+ - criterion 2
32
+
33
+ # Notes
34
+
35
+ Implementation notes, constraints, and links.
@@ -0,0 +1,59 @@
1
+ ---
2
+ id: {{id}}
3
+ type: prd
4
+ title: {{title}}
5
+ tags: []
6
+ owners: []
7
+ links: []
8
+ artifacts: []
9
+ relates: []
10
+ refs: []
11
+ aliases: []
12
+ created: {{created}}
13
+ updated: {{updated}}
14
+ ---
15
+
16
+ # Problem
17
+
18
+ What problem are we solving and for whom?
19
+
20
+ # Goals
21
+
22
+ - goal 1
23
+ - goal 2
24
+
25
+ # Non-goals
26
+
27
+ - non-goal 1
28
+ - non-goal 2
29
+
30
+ # Requirements
31
+
32
+ ## Functional
33
+
34
+ - requirement 1
35
+ - requirement 2
36
+
37
+ ## Non-functional
38
+
39
+ - requirement 1
40
+ - requirement 2
41
+
42
+ # Acceptance Criteria
43
+
44
+ - criterion 1
45
+ - criterion 2
46
+
47
+ # Metrics / Success
48
+
49
+ How do we know this worked?
50
+
51
+ # Risks
52
+
53
+ - risk 1
54
+ - risk 2
55
+
56
+ # Open Questions
57
+
58
+ - question 1
59
+ - question 2
@@ -0,0 +1,45 @@
1
+ ---
2
+ id: {{id}}
3
+ type: prop
4
+ title: {{title}}
5
+ tags: []
6
+ owners: []
7
+ links: []
8
+ artifacts: []
9
+ relates: []
10
+ refs: []
11
+ aliases: []
12
+ created: {{created}}
13
+ updated: {{updated}}
14
+ ---
15
+
16
+ # Summary
17
+
18
+ One paragraph summary of the idea.
19
+
20
+ # Motivation
21
+
22
+ Why does this matter?
23
+
24
+ # Proposal
25
+
26
+ What is being proposed?
27
+
28
+ # Impact
29
+
30
+ What changes if we do this?
31
+
32
+ # Risks
33
+
34
+ - risk 1
35
+ - risk 2
36
+
37
+ # Alternatives
38
+
39
+ - alternative 1
40
+ - alternative 2
41
+
42
+ # Next Steps
43
+
44
+ - next step 1
45
+ - next step 2
@@ -0,0 +1,33 @@
1
+ ---
2
+ id: {{id}}
3
+ type: rule
4
+ title: {{title}}
5
+ tags: []
6
+ owners: []
7
+ links: []
8
+ artifacts: []
9
+ relates: []
10
+ refs: []
11
+ aliases: []
12
+ created: {{created}}
13
+ updated: {{updated}}
14
+ ---
15
+
16
+ # Purpose
17
+
18
+ Describe the rule’s purpose and what behavior it enforces.
19
+
20
+ # Scope
21
+
22
+ What parts of the repo/process this rule applies to.
23
+
24
+ # Requirements
25
+
26
+ List the concrete requirements as bullets.
27
+
28
+ - requirement 1
29
+ - requirement 2
30
+
31
+ # Notes
32
+
33
+ Any additional guidance, examples, or rationale.
@@ -0,0 +1,53 @@
1
+ ---
2
+ id: {{id}}
3
+ type: task
4
+ title: {{title}}
5
+ status: {{status}}
6
+ priority: {{priority}}
7
+ epic: {{epic}}
8
+ parent: {{parent}}
9
+ prev: {{prev}}
10
+ next: {{next}}
11
+ tags: []
12
+ owners: []
13
+ links: []
14
+ artifacts: []
15
+ relates: []
16
+ blocked_by: []
17
+ blocks: []
18
+ refs: []
19
+ aliases: []
20
+ created: {{created}}
21
+ updated: {{updated}}
22
+ ---
23
+
24
+ # Overview
25
+
26
+ Describe what this task is and why it matters.
27
+
28
+ # Acceptance Criteria
29
+
30
+ - criterion 1
31
+ - criterion 2
32
+
33
+ # Files Affected
34
+
35
+ List files/directories expected to change.
36
+
37
+ - path 1
38
+ - path 2
39
+
40
+ # Implementation Notes
41
+
42
+ - note 1
43
+ - note 2
44
+
45
+ # Test Plan
46
+
47
+ How will we verify it works?
48
+
49
+ # Links / Artifacts
50
+
51
+ - related docs
52
+ - related issues
53
+ - references
@@ -0,0 +1,49 @@
1
+ ---
2
+ id: {{id}}
3
+ type: test
4
+ title: {{title}}
5
+ status: {{status}}
6
+ priority: {{priority}}
7
+ epic: {{epic}}
8
+ parent: {{parent}}
9
+ prev: {{prev}}
10
+ next: {{next}}
11
+ tags: []
12
+ owners: []
13
+ links: []
14
+ artifacts: []
15
+ relates: []
16
+ blocked_by: []
17
+ blocks: []
18
+ refs: []
19
+ aliases: []
20
+ cases: []
21
+ created: {{created}}
22
+ updated: {{updated}}
23
+ ---
24
+
25
+ # Overview
26
+
27
+ Describe what this test validates and why it matters.
28
+
29
+ # Target / Scope
30
+
31
+ List the work items or areas covered (use `relates` for tickets).
32
+
33
+ # Preconditions / Environment
34
+
35
+ Document environment, data, and setup requirements.
36
+
37
+ # Test Cases
38
+
39
+ - case 1
40
+ - case 2
41
+
42
+ # Results / Evidence
43
+
44
+ Record outcomes and link evidence in `artifacts` or `links`.
45
+
46
+ # Notes / Follow-ups
47
+
48
+ - follow-up 1
49
+ - follow-up 2