depa-codument 0.4.1

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 (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +262 -0
  3. package/package.json +63 -0
  4. package/src/cli/commands/archive.ts +519 -0
  5. package/src/cli/commands/decisions.ts +123 -0
  6. package/src/cli/commands/engineering.ts +105 -0
  7. package/src/cli/commands/init.ts +54 -0
  8. package/src/cli/commands/list.ts +73 -0
  9. package/src/cli/commands/modeling.ts +105 -0
  10. package/src/cli/commands/show.ts +238 -0
  11. package/src/cli/commands/status.ts +140 -0
  12. package/src/cli/commands/upgrade-track.ts +385 -0
  13. package/src/cli/commands/upgrade-workspace.ts +138 -0
  14. package/src/cli/commands/validate.ts +330 -0
  15. package/src/cli/engineering/config.ts +68 -0
  16. package/src/cli/engineering/lint.ts +58 -0
  17. package/src/cli/engineering/merge.ts +172 -0
  18. package/src/cli/engineering/registry.ts +230 -0
  19. package/src/cli/engineering/schema.ts +126 -0
  20. package/src/cli/engineering/validate.ts +286 -0
  21. package/src/cli/index.ts +136 -0
  22. package/src/cli/modeling/config.ts +68 -0
  23. package/src/cli/modeling/lint.ts +58 -0
  24. package/src/cli/modeling/merge.ts +172 -0
  25. package/src/cli/modeling/registry.ts +229 -0
  26. package/src/cli/modeling/schema.ts +160 -0
  27. package/src/cli/modeling/validate.ts +282 -0
  28. package/src/cli/utils/index.ts +941 -0
  29. package/src/cli/utils/install.ts +291 -0
  30. package/src/cli/utils/spec-xml.ts +673 -0
  31. package/src/cli/utils/track-time.ts +75 -0
  32. package/src/cli/utils/vfs.ts +102 -0
  33. package/src/templates/codument/README.md +59 -0
  34. package/src/templates/codument/attractors/product.md +17 -0
  35. package/src/templates/codument/attractors/project.md +10 -0
  36. package/src/templates/codument/backlog/README.md +33 -0
  37. package/src/templates/codument/config/attractor-profiles.xml +31 -0
  38. package/src/templates/codument/config/engineering.xml +22 -0
  39. package/src/templates/codument/config/modeling.xml +22 -0
  40. package/src/templates/codument/config/operation-hooks.xml +55 -0
  41. package/src/templates/codument/memory/README.md +13 -0
  42. package/src/templates/codument/missions/README.md +125 -0
  43. package/src/templates/codument/sop/README.md +14 -0
  44. package/src/templates/codument/std/AGENTS.md +82 -0
  45. package/src/templates/codument/std/attractors/depa-attractor.md +572 -0
  46. package/src/templates/codument/std/attractors/knowledge-tiers.md +128 -0
  47. package/src/templates/codument/std/attractors/model-driven-docs.md +293 -0
  48. package/src/templates/codument/std/attractors/project-memory.md +48 -0
  49. package/src/templates/codument/std/docs-impl-fractal/index.md +110 -0
  50. package/src/templates/codument/std/docs-modeling-fractal/index.md +156 -0
  51. package/src/templates/codument/std/kernel-pointer.md +19 -0
  52. package/src/templates/codument/std/operations/README.md +30 -0
  53. package/src/templates/codument/std/operations/_operation-spec.md +41 -0
  54. package/src/templates/codument/std/operations/archive-mission.md +66 -0
  55. package/src/templates/codument/std/operations/archive-track.md +238 -0
  56. package/src/templates/codument/std/operations/artifact-sync.md +172 -0
  57. package/src/templates/codument/std/operations/discuss-phase.md +214 -0
  58. package/src/templates/codument/std/operations/discuss.md +87 -0
  59. package/src/templates/codument/std/operations/docs-bootstrap.md +148 -0
  60. package/src/templates/codument/std/operations/gap-loop.md +301 -0
  61. package/src/templates/codument/std/operations/impl-mission.md +167 -0
  62. package/src/templates/codument/std/operations/impl-quick.md +79 -0
  63. package/src/templates/codument/std/operations/impl-track.md +537 -0
  64. package/src/templates/codument/std/operations/migrate.md +337 -0
  65. package/src/templates/codument/std/operations/plan-mission.md +230 -0
  66. package/src/templates/codument/std/operations/plan-track-wave.md +231 -0
  67. package/src/templates/codument/std/operations/plan-track.md +579 -0
  68. package/src/templates/codument/std/operations/revise-track.md +136 -0
  69. package/src/templates/codument/std/operations/validate.md +339 -0
  70. package/src/templates/codument/std/operations/verify.md +184 -0
  71. package/src/templates/codument/std/root-agents.md +39 -0
  72. package/src/templates/codument/std/sop/questioning.md +98 -0
  73. package/src/templates/codument/std/sop/tdd.md +26 -0
  74. package/src/templates/codument/std/sop/validation.md +25 -0
  75. package/src/templates/codument/std/sop/wave-exec.md +42 -0
  76. package/src/templates/codument/std/sop/workflow.md +35 -0
  77. package/src/templates/codument/std/spec/behavior-delta.md +36 -0
  78. package/src/templates/codument/std/spec/behavior-registry.md +42 -0
  79. package/src/templates/codument/std/spec/engineering-delta.md +68 -0
  80. package/src/templates/codument/std/spec/engineering-node-schema.md +86 -0
  81. package/src/templates/codument/std/spec/engineering-registry.md +82 -0
  82. package/src/templates/codument/std/spec/flow-notation.md +93 -0
  83. package/src/templates/codument/std/spec/folder-manifest.md +99 -0
  84. package/src/templates/codument/std/spec/mission-xml-spec.md +249 -0
  85. package/src/templates/codument/std/spec/modeling-delta.md +85 -0
  86. package/src/templates/codument/std/spec/modeling-node-schema.md +183 -0
  87. package/src/templates/codument/std/spec/modeling-registry.md +49 -0
  88. package/src/templates/codument/std/spec/track-xml-spec.md +272 -0
  89. package/src/templates/codument/std/spec/xnl-format.md +301 -0
  90. package/src/templates/codument/workflows/README.md +15 -0
  91. package/src/templates/manifest.ts +177 -0
  92. package/src/templates/skills/README.md +38 -0
  93. package/src/templates/skills/codument-archive/SKILL.md +17 -0
  94. package/src/templates/skills/codument-archive-mission/SKILL.md +17 -0
  95. package/src/templates/skills/codument-archive-track/SKILL.md +17 -0
  96. package/src/templates/skills/codument-artifact-sync/SKILL.md +17 -0
  97. package/src/templates/skills/codument-code-quality-score/SKILL.md +67 -0
  98. package/src/templates/skills/codument-decision-tree/SKILL.md +40 -0
  99. package/src/templates/skills/codument-discuss/SKILL.md +17 -0
  100. package/src/templates/skills/codument-discuss-phase/SKILL.md +17 -0
  101. package/src/templates/skills/codument-docs-bootstrap/SKILL.md +17 -0
  102. package/src/templates/skills/codument-gap-loop/SKILL.md +17 -0
  103. package/src/templates/skills/codument-impl-mission/SKILL.md +17 -0
  104. package/src/templates/skills/codument-impl-quick/SKILL.md +17 -0
  105. package/src/templates/skills/codument-impl-track/SKILL.md +17 -0
  106. package/src/templates/skills/codument-implement/SKILL.md +14 -0
  107. package/src/templates/skills/codument-migrate/SKILL.md +17 -0
  108. package/src/templates/skills/codument-modeling-engineering-e2e/SKILL.md +74 -0
  109. package/src/templates/skills/codument-plan-mission/SKILL.md +17 -0
  110. package/src/templates/skills/codument-plan-track/SKILL.md +17 -0
  111. package/src/templates/skills/codument-plan-track-wave/SKILL.md +17 -0
  112. package/src/templates/skills/codument-revise-track/SKILL.md +17 -0
  113. package/src/templates/skills/codument-track/SKILL.md +14 -0
  114. package/src/templates/skills/codument-validate/SKILL.md +17 -0
  115. package/src/templates/skills/codument-verify/SKILL.md +17 -0
  116. package/src/types/text-assets.d.ts +9 -0
  117. package/src/version.ts +1 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 kongweixian
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,262 @@
1
+ # DEPA Codument
2
+
3
+ DEPA Codument is a spec-driven workflow tool for AI coding assistants. It installs a self-contained `codument/` workspace into a project and gives agents durable prompts, specs, attractors, behavior registries, track/mission workflows, and validation commands.
4
+
5
+ The npm package is named `depa-codument`. The CLI command remains `codument`.
6
+
7
+ ## Install And Run
8
+
9
+ Use it directly with npx:
10
+
11
+ ```bash
12
+ npx depa-codument --help
13
+ npx depa-codument init --agent=codex,claude
14
+ ```
15
+
16
+ Or install globally:
17
+
18
+ ```bash
19
+ npm install -g depa-codument
20
+ codument --help
21
+ ```
22
+
23
+ The package also exposes a `depa-codument` bin alias, so this works too:
24
+
25
+ ```bash
26
+ depa-codument --help
27
+ ```
28
+
29
+ ## Requirements
30
+
31
+ - Bun runtime available on the machine that runs the CLI.
32
+ - An AI coding assistant that can read installed skills, such as Codex, Claude Code, CodeFlicker, Eidolon, Sparrow, or OpenCode.
33
+
34
+ ## What It Provides
35
+
36
+ Codument organizes AI-assisted development by task scale:
37
+
38
+ | Scale | Skill / Operation | Use |
39
+ |---|---|---|
40
+ | Small change | `codument-impl-quick` | Read Codument context and implement a small bug fix, test, local refactor, or config change without creating a track. |
41
+ | Pre-plan discussion | `codument-discuss` | Gather context before deciding whether work should be quick, track, mission, or blocked. Temporary notes go to `codument/analysis/` and are cleaned by the workflow. |
42
+ | Medium task | `codument-plan-track` / `codument-impl-track` / `codument-archive-track` | Plan, implement, verify, and archive a bounded change. |
43
+ | Long task | `codument-plan-mission` / `codument-impl-mission` / `codument-archive-mission` | Coordinate longer work across multiple tracks with a mission DAG and controlled replanning. |
44
+
45
+ Codument also includes:
46
+
47
+ - `codument/modeling/` registry support for domain, backend, surface, and other structural models in XNL.
48
+ - `codument/engineering/` registry support for long-lived implementation knowledge.
49
+ - `codument/behaviors/` as the behavior contract registry.
50
+ - `behavior_deltas/`, `modeling_deltas/`, and `engineering_deltas/` for track-local proposed changes.
51
+ - `operation-hooks.xml` for command lifecycle hooks such as coding attractor checks before planning.
52
+ - `codument/**/analysis` and `codument/**/reports` gitignore rules for scratch evidence and run reports.
53
+
54
+ ## Quick Start
55
+
56
+ Initialize a project:
57
+
58
+ ```bash
59
+ cd your-project
60
+ npx depa-codument init --agent=codex,claude
61
+ ```
62
+
63
+ This writes:
64
+
65
+ - `codument/std/` with operation prompts, specs, SOPs, and standard attractors.
66
+ - `codument/config/` with attractor profiles, operation hooks, modeling, and engineering config.
67
+ - `codument/attractors/project.md` and `codument/attractors/product.md`.
68
+ - Skill shells for the selected agents.
69
+ - A managed `AGENTS.md` block pointing assistants to `codument/std/AGENTS.md`.
70
+
71
+ If `.gitignore` already exists, init also ensures:
72
+
73
+ ```gitignore
74
+ codument/**/analysis
75
+ codument/**/reports
76
+ ```
77
+
78
+ ## Common Workflows
79
+
80
+ ### Small Change
81
+
82
+ Ask the agent:
83
+
84
+ ```text
85
+ 请使用 codument-impl-quick skill, 快速实现这个小改动: <description>
86
+ ```
87
+
88
+ `impl-quick` reads Codument context and project files first. If the request is actually a new feature, behavior change, architecture change, or multi-stage task, it should stop and recommend a track or mission.
89
+
90
+ ### Pre-plan Discussion
91
+
92
+ Ask the agent:
93
+
94
+ ```text
95
+ 请使用 codument-discuss skill, 分析这个需求应该 quick / track / mission: <description>
96
+ ```
97
+
98
+ The result should include:
99
+
100
+ - `route: quick | track | mission | blocked`
101
+ - reason
102
+ - suggested next command
103
+ - evidence read
104
+ - open questions
105
+
106
+ ### Track Workflow
107
+
108
+ Create a track:
109
+
110
+ ```text
111
+ 请使用 codument-plan-track skill, 创建 track: <track-id or description>
112
+ ```
113
+
114
+ A track is stored in `codument/tracks/<track-id>/` and uses `track.xml` as the state source. A typical track contains:
115
+
116
+ ```text
117
+ codument/tracks/<track-id>/
118
+ track.xml
119
+ proposal.md
120
+ design.md
121
+ decisions.md
122
+ behavior_deltas/
123
+ modeling_deltas/
124
+ engineering_deltas/
125
+ analysis/ # gitignored scratch
126
+ reports/ # gitignored run reports
127
+ ```
128
+
129
+ Implement it:
130
+
131
+ ```text
132
+ 请使用 codument-impl-track skill, 实现 track: <track-id>
133
+ ```
134
+
135
+ Discuss or refine a phase:
136
+
137
+ ```text
138
+ 请使用 codument-discuss-phase skill, 讨论 track phase: <track-id> P1
139
+ ```
140
+
141
+ Verify or correct:
142
+
143
+ ```text
144
+ 请使用 codument-verify skill, 验证 track: <track-id>
145
+ 请使用 codument-gap-loop skill, 校验并修复 track: <track-id>
146
+ ```
147
+
148
+ Archive when done:
149
+
150
+ ```text
151
+ 请使用 codument-archive-track skill, 归档 track: <track-id>
152
+ ```
153
+
154
+ Archive promotes behavior deltas into `codument/behaviors/` and, when enabled, merges modeling/engineering deltas into their registries.
155
+
156
+ ### Mission Workflow
157
+
158
+ Create a mission:
159
+
160
+ ```text
161
+ 请使用 codument-plan-mission skill, 创建 mission: <long-running goal>
162
+ ```
163
+
164
+ Missions live under:
165
+
166
+ ```text
167
+ codument/missions/
168
+ pending/
169
+ active/
170
+ archived/
171
+ ```
172
+
173
+ Each mission has `mission.xml`, `proposal.md`, and `design.md`. The mission DAG coordinates groups of tasks and can bind leaf tasks to real tracks via `cdt:TrackLink`.
174
+
175
+ ## CLI Commands
176
+
177
+ ```bash
178
+ codument init [--agent <tool[,tool...]>] [--skills-dir <path>] [--force]
179
+ codument upgrade-workspace [--agent <tool[,tool...]>] [--skills-dir <path>]
180
+ codument upgrade-track <track-id-or-archive-id>
181
+ codument list [--behaviors] [--json]
182
+ codument show [item] [--json]
183
+ codument validate [item] [--strict]
184
+ codument archive <track-id> [--yes]
185
+ codument modeling lint
186
+ codument modeling validate [--deltas <track-id>]
187
+ codument engineering lint
188
+ codument engineering validate [--deltas <track-id>]
189
+ codument decisions validate [track-id]
190
+ codument status
191
+ ```
192
+
193
+ Global option:
194
+
195
+ ```bash
196
+ codument --workspace-dir <path> <command>
197
+ ```
198
+
199
+ ## Agent Skill Targets
200
+
201
+ Supported `--agent` values:
202
+
203
+ | Agent | Skill destination |
204
+ |---|---|
205
+ | `codex` | `~/.codex/skills` |
206
+ | `claude` | `.claude/skills` |
207
+ | `codeflicker` | `.codeflicker/skills` |
208
+ | `eidolon` | `.eidolon/skills` |
209
+ | `sparrow` | `.sparrow/skills` |
210
+ | `opencode` | `.opencode/skills` |
211
+
212
+ You can also provide an explicit destination:
213
+
214
+ ```bash
215
+ codument init --skills-dir .agents/skills
216
+ ```
217
+
218
+ ## Workspace Layout
219
+
220
+ After init:
221
+
222
+ ```text
223
+ codument/
224
+ attractors/ project-owned attractors
225
+ config/ attractor profiles, operation hooks, modeling/engineering gates
226
+ std/ upgrade-managed standards, specs, SOPs, operation prompts
227
+ behaviors/ behavior registry
228
+ modeling/ optional XNL modeling registry
229
+ engineering/ optional XNL engineering registry
230
+ tracks/ active tracks
231
+ archive/ archived tracks
232
+ missions/ pending / active / archived missions
233
+ decisions/ durable decisions
234
+ memory/ durable lessons/incidents/patterns/summaries
235
+ ```
236
+
237
+ ## Development
238
+
239
+ ```bash
240
+ bun install
241
+ bun run check
242
+ bun run build:all
243
+ ```
244
+
245
+ Build outputs:
246
+
247
+ ```text
248
+ dist/codument
249
+ dist/codument-dev
250
+ ```
251
+
252
+ Local install:
253
+
254
+ ```bash
255
+ bun run install:local
256
+ ```
257
+
258
+ ## Repository
259
+
260
+ ```text
261
+ git@github.com:seerkong/depa-codument.git
262
+ ```
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "depa-codument",
3
+ "version": "0.4.1",
4
+ "description": "DEPA-oriented Codument workflow tool for AI coding assistants",
5
+ "type": "module",
6
+ "main": "src/cli/index.ts",
7
+ "bin": {
8
+ "codument": "src/cli/index.ts",
9
+ "depa-codument": "src/cli/index.ts"
10
+ },
11
+ "files": [
12
+ "src",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+ssh://git@github.com/seerkong/depa-codument.git"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/seerkong/depa-codument/issues"
22
+ },
23
+ "homepage": "https://github.com/seerkong/depa-codument#readme",
24
+ "publishConfig": {
25
+ "registry": "https://registry.npmjs.com"
26
+ },
27
+ "engines": {
28
+ "bun": ">=1.0.0"
29
+ },
30
+ "scripts": {
31
+ "gen:templates": "bun run scripts/gen-template-manifest.ts",
32
+ "dev": "bun run src/cli/index.ts",
33
+ "build": "bun run gen:templates && bun build src/cli/index.ts --compile --outfile=dist/codument",
34
+ "build:dev": "bun run gen:templates && bun build src/cli/index.ts --compile --outfile=dist/codument-dev",
35
+ "build:all": "bun run build && bun run build:dev",
36
+ "test": "bun test",
37
+ "test:coverage": "bun test --coverage",
38
+ "lint": "bunx eslint src",
39
+ "typecheck": "bunx tsc --noEmit",
40
+ "check": "bun run typecheck && bun run lint && bun run test",
41
+ "install:local": "bun run scripts/install.ts",
42
+ "install:local:dev": "bun run scripts/install.ts codument-dev"
43
+ },
44
+ "keywords": [
45
+ "spec-driven",
46
+ "ai-coding",
47
+ "development-tools",
48
+ "cli"
49
+ ],
50
+ "author": "",
51
+ "license": "MIT",
52
+ "devDependencies": {
53
+ "@types/bun": "latest",
54
+ "@typescript-eslint/parser": "^8.62.0",
55
+ "eslint": "^10.6.0",
56
+ "typescript": "^5.3.0"
57
+ },
58
+ "dependencies": {
59
+ "chalk": "^5.3.0",
60
+ "xnl-core": "0.1.7",
61
+ "xnl-vfs": "^0.1.1"
62
+ }
63
+ }