mdkg 0.0.7 → 0.0.9

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 (45) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/CONTRIBUTING.md +124 -0
  3. package/README.md +33 -10
  4. package/dist/cli.js +80 -32
  5. package/dist/commands/checkpoint.js +19 -2
  6. package/dist/commands/event.js +12 -0
  7. package/dist/commands/new.js +50 -4
  8. package/dist/commands/pack.js +14 -0
  9. package/dist/commands/query_output.js +2 -0
  10. package/dist/commands/search.js +8 -0
  11. package/dist/commands/show.js +7 -0
  12. package/dist/commands/skill.js +80 -12
  13. package/dist/commands/task.js +41 -4
  14. package/dist/commands/validate.js +31 -3
  15. package/dist/commands/workspace.js +105 -13
  16. package/dist/core/config.js +217 -22
  17. package/dist/core/migrate.js +39 -5
  18. package/dist/core/workspace_path.js +41 -0
  19. package/dist/graph/agent_file_types.js +392 -0
  20. package/dist/graph/edges.js +13 -10
  21. package/dist/graph/frontmatter.js +33 -0
  22. package/dist/graph/indexer.js +1 -0
  23. package/dist/graph/node.js +21 -5
  24. package/dist/graph/skills_indexer.js +14 -1
  25. package/dist/graph/validate_graph.js +302 -2
  26. package/dist/init/AGENT_START.md +13 -0
  27. package/dist/init/CLI_COMMAND_MATRIX.md +43 -1
  28. package/dist/init/README.md +7 -0
  29. package/dist/init/skills/default/verify-close-and-checkpoint/SKILL.md +1 -1
  30. package/dist/init/templates/default/dispute.md +31 -0
  31. package/dist/init/templates/default/feedback.md +27 -0
  32. package/dist/init/templates/default/proposal.md +35 -0
  33. package/dist/init/templates/default/receipt.md +31 -0
  34. package/dist/init/templates/default/spec.md +43 -0
  35. package/dist/init/templates/default/work.md +44 -0
  36. package/dist/init/templates/default/work_order.md +32 -0
  37. package/dist/pack/export_json.js +3 -0
  38. package/dist/pack/export_md.js +9 -0
  39. package/dist/pack/export_xml.js +9 -0
  40. package/dist/pack/order.js +7 -0
  41. package/dist/pack/pack.js +1 -0
  42. package/dist/util/argparse.js +1 -0
  43. package/dist/util/id.js +19 -0
  44. package/package.json +9 -2
  45. package/scripts/postinstall.js +89 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,56 @@
1
+ # Changelog
2
+
3
+ All notable changes to mdkg are documented here.
4
+
5
+ This project follows a pragmatic changelog style inspired by Keep a Changelog. Versions use npm package versions.
6
+
7
+ ## 0.0.9 - 2026-05-12
8
+
9
+ ### Added
10
+
11
+ - Added generic agent workflow file support for `SPEC.md`, `WORK.md`, `WORK_ORDER.md`, `RECEIPT.md`, `FEEDBACK.md`, `DISPUTE.md`, and `PROPOSAL.md`.
12
+ - Added `mdkg new <agent-file-type> ... --id <portable-id>` for semantic ids such as `agent.image-worker` and `work.generate-image`.
13
+ - Added validation support for `pricing_model: included`.
14
+ - Added validation support for `proposal_kind: skill_update` targeting `skill.<slug>` refs.
15
+ - Added generic skill extension output under `extensions`, with `ochatr_*` metadata mapped to `extensions.ochatr`.
16
+ - Added a non-mutating npm `postinstall` hint that points users to `mdkg --help` and prints shell PATH guidance only when needed.
17
+ - Added `docs/agent-runtime-0.0.9-handoff.md` to document the runtime migration path from implementation-specific naming to generic agent workflow naming.
18
+ - Added `npm run smoke:matrix` to pack mdkg, install it into an isolated temporary npm prefix, and exercise the command matrix plus onboarding workflows from the packaged CLI.
19
+
20
+ ### Changed
21
+
22
+ - Renamed the remaining public Omni file-type surface to generic agent workflow language.
23
+ - Kept `mdkg init --omni` only as hidden migration guidance to `mdkg init --agent`.
24
+ - Updated README and command matrix version references to `0.0.9`.
25
+ - Removed stale prepublish wording and absolute local README links.
26
+ - Removed `AGENT_PROMPT_SNIPPET.md` and distilled its startup rules into `AGENT_START.md`, making `AGENT_START.md` the single first-hop agent onboarding doc.
27
+ - Treated ochatr.ai metadata as a vendor extension pattern rather than the base mdkg schema name.
28
+ - Added npm `prepack` and `prepublishOnly` guards so release commands fail if the built CLI or init assets are missing.
29
+ - Included `CHANGELOG.md` and `CONTRIBUTING.md` in the npm package because README links to them.
30
+
31
+ ### Fixed
32
+
33
+ - Fixed strict validation gaps for room-runtime-style skill proposals and included pricing.
34
+ - Fixed docs drift between published `0.0.8`, local source version, and the 0.0.9 release target.
35
+
36
+ ### Verification Status
37
+
38
+ - Passed: `npm ci` with `NPM_CONFIG_CACHE=/private/tmp/mdkg-npm-cache`.
39
+ - Passed: `npm run build`.
40
+ - Passed: `npm run test` with 306 tests.
41
+ - Passed: `npm run cli:check`.
42
+ - Passed: `node dist/cli.js validate`.
43
+ - Passed: `npm run smoke:consumer`.
44
+ - Passed: `npm run smoke:matrix`.
45
+ - Passed: `npm pack --dry-run --json`; tarball includes `dist/cli.js`, compiled command/core/graph/pack/template/util files, `dist/init/`, `CHANGELOG.md`, `CONTRIBUTING.md`, `README.md`, `LICENSE`, package metadata, and `scripts/postinstall.js`.
46
+ - Passed: `npm publish --dry-run`; `prepublishOnly` and `prepack` both completed successfully.
47
+ - Confirmed before publish: npm registry latest remains `mdkg@0.0.8`.
48
+
49
+ ## 0.0.8
50
+
51
+ - Published npm baseline before the 0.0.9 agent workflow release work.
52
+ - Does not include agent workflow file types, mutation JSON receipt expansion, workspace enable/disable, or postinstall guidance.
53
+
54
+ ## 0.0.7 and earlier
55
+
56
+ - Historical local and published release line for mdkg's initial CLI, graph, pack, skill, and agent-bootstrap work.
@@ -0,0 +1,124 @@
1
+ # Contributing to mdkg
2
+
3
+ mdkg is a local-first CLI for deterministic project memory. Contributions should preserve that shape: file-based, inspectable in git, deterministic when possible, and useful to both humans and agents.
4
+
5
+ ## Prompt Requests Before Pull Requests
6
+
7
+ The preferred contribution path is a Prompt Request: describe intent clearly enough that a maintainer, human contributor, or coding agent can turn it into a correct patch.
8
+
9
+ This is inspired by the OpenClaw creator's framing of Prompt Requests over Pull Requests. The point is not to reject code; it is to make user intent first-class. Many useful contributors know the workflow problem better than the codebase. mdkg should capture that intent before debating implementation details.
10
+
11
+ Use a Prompt Request when you want to propose:
12
+ - a new command or flag
13
+ - a docs or onboarding improvement
14
+ - a validation rule
15
+ - a workflow standard
16
+ - a bug report with expected behavior
17
+ - an agent-facing convention or template
18
+
19
+ A good Prompt Request includes:
20
+ - the goal in plain language
21
+ - the current behavior or gap
22
+ - the desired behavior
23
+ - one or two example commands or markdown snippets
24
+ - acceptance criteria
25
+ - any constraints, such as backwards compatibility or public naming
26
+
27
+ Code Pull Requests are still welcome when the implementation is clear, scoped, tested, and linked to the intent it serves.
28
+
29
+ ## Public Naming
30
+
31
+ mdkg's public standard language is generic agent workflow language.
32
+
33
+ Use:
34
+ - `agent workflow files`
35
+ - `agent workflow docs`
36
+ - `mdkg init --agent`
37
+ - `skill.<slug>` for skill proposal targets
38
+ - `extensions.<vendor>` for vendor extension metadata
39
+
40
+ Avoid new public API or docs language that makes mdkg look tied to one product or runtime. ochatr.ai is a pioneering adopter and may use `ochatr_*` extension metadata, but the base mdkg schema should stay vendor-neutral.
41
+
42
+ ## Development Loop
43
+
44
+ Install dependencies when npm is available:
45
+
46
+ ```bash
47
+ npm install
48
+ ```
49
+
50
+ Core checks:
51
+
52
+ ```bash
53
+ npm run build
54
+ npm run test
55
+ npm run cli:check
56
+ node dist/cli.js validate
57
+ ```
58
+
59
+ Release smoke checks:
60
+
61
+ ```bash
62
+ npm run smoke:consumer
63
+ npm pack --dry-run
64
+ ```
65
+
66
+ If the local toolchain is incomplete, document exactly what was blocked and run the checks that are still possible, such as:
67
+
68
+ ```bash
69
+ git diff --check
70
+ node --check scripts/postinstall.js
71
+ ```
72
+
73
+ ## Working in the mdkg Repo
74
+
75
+ This repo dogfoods mdkg. Before a substantial change:
76
+
77
+ 1. Read `AGENT_START.md`.
78
+ 2. Inspect relevant source and tests.
79
+ 3. Use `CLI_COMMAND_MATRIX.md` for the command surface.
80
+ 4. Keep source behavior and docs aligned.
81
+ 5. Add focused tests for new user-visible behavior.
82
+ 6. Run `mdkg validate` after building when possible.
83
+
84
+ Do not commit generated index or pack outputs. Keep `.mdkg/index/` and `.mdkg/pack/` ignored.
85
+
86
+ ## Change Requirements
87
+
88
+ Good patches are:
89
+ - small enough to review
90
+ - explicit about public interface changes
91
+ - covered by focused tests
92
+ - documented in `README.md`, `CLI_COMMAND_MATRIX.md`, or `CHANGELOG.md` when behavior changes
93
+ - careful with existing dirty worktree changes
94
+
95
+ For agent workflow files, update tests and fixtures when changing:
96
+ - accepted frontmatter fields
97
+ - validation rules
98
+ - `mdkg new` scaffolding
99
+ - pack/search/show output
100
+
101
+ For release work, update:
102
+ - `package.json`
103
+ - `package-lock.json`
104
+ - `README.md`
105
+ - `CLI_COMMAND_MATRIX.md`
106
+ - `CHANGELOG.md`
107
+ - init assets under `assets/init/` when generated starter docs change
108
+
109
+ ## Pull Request Guidance
110
+
111
+ When submitting code, include:
112
+ - linked Prompt Request or short intent statement
113
+ - summary of behavior changes
114
+ - tests run and any blocked checks
115
+ - docs updated or reason docs were not needed
116
+ - compatibility notes for existing mdkg repos
117
+
118
+ Do not include unrelated formatting churn or generated artifacts unless the change requires them.
119
+
120
+ ## Security and Secrets
121
+
122
+ Do not put secrets in mdkg nodes, packs, events, fixtures, or test outputs. mdkg is project memory, not a secret store.
123
+
124
+ Report security-sensitive issues privately until a safe disclosure path is established.
package/README.md CHANGED
@@ -13,7 +13,7 @@ mdkg stays deliberately boring:
13
13
  - zero runtime dependencies
14
14
  - no sqlite, daemon, hosted index, or vector DB
15
15
 
16
- Current package version in source: `0.0.6`
16
+ Current package version in source: `0.0.9`
17
17
 
18
18
  ## The product shape
19
19
 
@@ -31,8 +31,6 @@ If a repo needs repeatable procedures, author them as first-class skills under `
31
31
 
32
32
  ## Install
33
33
 
34
- Once published:
35
-
36
34
  ```bash
37
35
  npm i -g mdkg
38
36
  # or
@@ -65,6 +63,13 @@ Create a task:
65
63
  mdkg new task "bootstrap cli" --status todo --priority 1 --tags cli,build
66
64
  ```
67
65
 
66
+ Create an agent workflow document with a semantic portable id:
67
+
68
+ ```bash
69
+ mdkg new spec "image worker" --id agent.image-worker
70
+ mdkg new work "generate image" --id work.generate-image
71
+ ```
72
+
68
73
  Inspect the current truth:
69
74
 
70
75
  ```bash
@@ -113,13 +118,13 @@ mdkg skill validate release-readiness
113
118
  ## LLM-readable onboarding artifacts
114
119
 
115
120
  The root docs below are the canonical fast-start set for humans and agents:
116
- - [`AGENT_START.md`](/Users/nicholasreames/Git/mdkg/AGENT_START.md)
117
- - [`llms.txt`](/Users/nicholasreames/Git/mdkg/llms.txt)
118
- - [`AGENT_PROMPT_SNIPPET.md`](/Users/nicholasreames/Git/mdkg/AGENT_PROMPT_SNIPPET.md)
119
- - [`PACK_EXAMPLES.md`](/Users/nicholasreames/Git/mdkg/PACK_EXAMPLES.md)
120
- - [`MANUAL_BEHAVIOR_AUDIT.md`](/Users/nicholasreames/Git/mdkg/MANUAL_BEHAVIOR_AUDIT.md)
121
- - [`CLI_COMMAND_MATRIX.md`](/Users/nicholasreames/Git/mdkg/CLI_COMMAND_MATRIX.md)
122
- - [`COVERAGE_HARDENING_MATRIX.md`](/Users/nicholasreames/Git/mdkg/COVERAGE_HARDENING_MATRIX.md)
121
+ - [`AGENT_START.md`](AGENT_START.md)
122
+ - [`llms.txt`](llms.txt)
123
+ - [`PACK_EXAMPLES.md`](PACK_EXAMPLES.md)
124
+ - [`CLI_COMMAND_MATRIX.md`](CLI_COMMAND_MATRIX.md)
125
+ - [`COVERAGE_HARDENING_MATRIX.md`](COVERAGE_HARDENING_MATRIX.md)
126
+ - [`CHANGELOG.md`](CHANGELOG.md)
127
+ - [`CONTRIBUTING.md`](CONTRIBUTING.md)
123
128
 
124
129
  ## Repository shape
125
130
 
@@ -199,6 +204,21 @@ This repo now dogfoods three internal skills:
199
204
  - `build-pack-and-execute-task`
200
205
  - `verify-close-and-checkpoint`
201
206
 
207
+ Optional skill metadata with prefixes such as `ochatr_*` is treated as vendor extension data. Structured skill output exposes it under `extensions.ochatr` while keeping the top-level `ochatr` field as a 0.0.9 compatibility alias. ochatr.ai is a pioneering adopter of this extension pattern, not the name of the base mdkg standard.
208
+
209
+ ## Agent workflow files
210
+
211
+ mdkg recognizes a small set of canonical agent workflow documents:
212
+ - `SPEC.md` for agent, package, or runtime specifications
213
+ - `WORK.md` for reusable work contracts
214
+ - `WORK_ORDER.md` for concrete requests against work contracts
215
+ - `RECEIPT.md` for completed work output and artifacts
216
+ - `FEEDBACK.md`, `DISPUTE.md`, and `PROPOSAL.md` for review loops
217
+
218
+ Use `mdkg new spec|work|work_order|receipt|feedback|dispute|proposal "<title>"` to scaffold them. `--id <portable-id>` is available for these types when semantic ids such as `agent.image-worker` or `work.generate-image` are preferred.
219
+
220
+ Relational templates contain editable placeholder refs. `spec` and `work` scaffold as validation-clean standalone docs; `work_order`, `receipt`, `feedback`, `dispute`, and `proposal` need real refs before strict `mdkg validate` passes.
221
+
202
222
  ## Current direction
203
223
 
204
224
  This release includes:
@@ -211,6 +231,7 @@ This release includes:
211
231
  - latest-checkpoint resolver + index hint
212
232
  - events JSONL validation
213
233
  - XML / TOON / Markdown output for node and skill list/search/show
234
+ - agent workflow file types and semantic `mdkg new --id` support
214
235
  - product-specific skill mirrors for Codex/OpenAI and Claude
215
236
  - shared `AGENT_START.md` startup guidance
216
237
 
@@ -241,6 +262,8 @@ Use these defaults:
241
262
 
242
263
  ## Contributing
243
264
 
265
+ Start with [`CONTRIBUTING.md`](CONTRIBUTING.md). mdkg prefers Prompt Requests before Pull Requests: contributors can submit intent, workflows, prompts, and acceptance criteria without needing to write code first.
266
+
244
267
  This repo dogfoods mdkg itself. The behavior source of truth is the combination of:
245
268
  - source under `src/`
246
269
  - tests under `tests/`
package/dist/cli.js CHANGED
@@ -63,7 +63,7 @@ function printUsage(log) {
63
63
  log(" guide Show the mdkg guide");
64
64
  log(" format Normalize frontmatter");
65
65
  log(" doctor Run install and workspace diagnostics");
66
- log(" workspace Manage workspaces (ls/add/rm)");
66
+ log(" workspace Manage workspaces (ls/add/rm/enable/disable)");
67
67
  log("\nQuickstart:");
68
68
  log(" mdkg init --llm");
69
69
  log(' mdkg new task "..." --status todo --priority 1');
@@ -97,10 +97,14 @@ function printInitHelp(log) {
97
97
  }
98
98
  function printNewHelp(log) {
99
99
  log("Usage:");
100
- log(' mdkg new <type> "<title>" [options]');
100
+ log(' mdkg new <type> "<title>" [options] [--json]');
101
101
  log("\nTypes:");
102
102
  log(" rule prd edd dec prop epic feat task bug checkpoint test");
103
+ log("\nAgent workflow file types:");
104
+ log(" spec work work_order receipt feedback dispute proposal");
105
+ log(" Use --id <portable-id> with these types for semantic ids like agent.image-worker.");
103
106
  log("\nOptions:");
107
+ log(" --id <portable-id> Explicit id for agent workflow file types");
104
108
  log(" --ws <alias> Workspace alias (default root)");
105
109
  log(" --status <status> Work item or decision status");
106
110
  log(" --priority <0..9> Work item priority");
@@ -113,6 +117,8 @@ function printNewHelp(log) {
113
117
  log(" --parent --prev --next --relates --blocked-by --blocks");
114
118
  log(" --links --artifacts --refs --aliases --owners --cases --supersedes");
115
119
  log(" --owners <owner,owner,...> Owners");
120
+ log("\nNotes:");
121
+ log(" spec/work scaffold as validation-clean docs; relational workflow docs need real refs.");
116
122
  printGlobalOptions(log);
117
123
  }
118
124
  function printGuideHelp(log) {
@@ -122,9 +128,11 @@ function printGuideHelp(log) {
122
128
  }
123
129
  function printWorkspaceHelp(log) {
124
130
  log("Usage:");
125
- log(" mdkg workspace ls");
126
- log(" mdkg workspace add <alias> <path> [--mdkg-dir <dir>]");
127
- log(" mdkg workspace rm <alias>");
131
+ log(" mdkg workspace ls [--json]");
132
+ log(" mdkg workspace add <alias> <path> [--mdkg-dir <dir>] [--json]");
133
+ log(" mdkg workspace rm <alias> [--json]");
134
+ log(" mdkg workspace enable <alias> [--json]");
135
+ log(" mdkg workspace disable <alias> [--json]");
128
136
  printGlobalOptions(log);
129
137
  }
130
138
  function printIndexHelp(log) {
@@ -199,7 +207,7 @@ function printSkillHelp(log, subcommand) {
199
207
  switch ((subcommand ?? "").toLowerCase()) {
200
208
  case "new":
201
209
  log("Usage:");
202
- log(' mdkg skill new <slug> "<name>" --description "<description>" [options]');
210
+ log(' mdkg skill new <slug> "<name>" --description "<description>" [options] [--json]');
203
211
  log("\nOptions:");
204
212
  log(" --tags <tag,tag,...> Optional skill tags");
205
213
  log(" --authors <name,name,...> Optional authors list");
@@ -232,24 +240,24 @@ function printSkillHelp(log, subcommand) {
232
240
  return;
233
241
  case "validate":
234
242
  log("Usage:");
235
- log(" mdkg skill validate [<slug>]");
243
+ log(" mdkg skill validate [<slug>] [--json]");
236
244
  printGlobalOptions(log);
237
245
  return;
238
246
  case "sync":
239
247
  log("Usage:");
240
- log(" mdkg skill sync [--force]");
248
+ log(" mdkg skill sync [--force] [--json]");
241
249
  log("\nWhen to use:");
242
250
  log(" Rebuild .agents/skills and .claude/skills from canonical .mdkg/skills.");
243
251
  printGlobalOptions(log);
244
252
  return;
245
253
  default:
246
254
  log("Usage:");
247
- log(' mdkg skill new <slug> "<name>" --description "<description>" [options]');
255
+ log(' mdkg skill new <slug> "<name>" --description "<description>" [options] [--json]');
248
256
  log(" mdkg skill list [--tags <tag,tag,...>] [--tags-mode any|all] [--json|--xml|--toon|--md]");
249
257
  log(" mdkg skill show <slug> [--meta] [--json|--xml|--toon|--md]");
250
258
  log(' mdkg skill search "<query>" [--tags <tag,tag,...>] [--tags-mode any|all] [--json|--xml|--toon|--md]');
251
- log(" mdkg skill validate [<slug>]");
252
- log(" mdkg skill sync [--force]");
259
+ log(" mdkg skill validate [<slug>] [--json]");
260
+ log(" mdkg skill sync [--force] [--json]");
253
261
  log("\nNotes:");
254
262
  log(" Skills are first-class under `mdkg skill ...`.");
255
263
  log(" Use stage tags like `stage:plan`, `stage:execute`, and `stage:review` with --tags.");
@@ -260,7 +268,7 @@ function printTaskHelp(log, subcommand) {
260
268
  switch ((subcommand ?? "").toLowerCase()) {
261
269
  case "start":
262
270
  log("Usage:");
263
- log(' mdkg task start <id-or-qid> [--ws <alias>] [--run-id <id>] [--note "<text>"]');
271
+ log(' mdkg task start <id-or-qid> [--ws <alias>] [--run-id <id>] [--note "<text>"] [--json]');
264
272
  log("\nWhen to use:");
265
273
  log(" Move a task, bug, or test into progress as a structured state change.");
266
274
  log(" If `events.jsonl` is missing, mdkg prints a short reminder about `mdkg event enable`.");
@@ -271,7 +279,7 @@ function printTaskHelp(log, subcommand) {
271
279
  log(" mdkg task update <id-or-qid> [--ws <alias>] [--status <status>] [--priority <n>]");
272
280
  log(" [--add-artifacts <a,...>] [--add-links <l,...>] [--add-refs <id,...>]");
273
281
  log(" [--add-skills <slug,...>] [--add-tags <tag,...>] [--add-blocked-by <id,...>]");
274
- log(' [--clear-blocked-by] [--run-id <id>] [--note "<text>"]');
282
+ log(' [--clear-blocked-by] [--run-id <id>] [--note "<text>"] [--json]');
275
283
  log("\nWhen to use:");
276
284
  log(" Update structured task metadata and evidence while keeping body and narrative edits in markdown.");
277
285
  printGlobalOptions(log);
@@ -279,7 +287,7 @@ function printTaskHelp(log, subcommand) {
279
287
  case "done":
280
288
  log("Usage:");
281
289
  log(' mdkg task done <id-or-qid> [--ws <alias>] [--add-artifacts <a,...>] [--add-links <l,...>]');
282
- log(' [--add-refs <id,...>] [--checkpoint "<title>"] [--run-id <id>] [--note "<text>"]');
290
+ log(' [--add-refs <id,...>] [--checkpoint "<title>"] [--run-id <id>] [--note "<text>"] [--json]');
283
291
  log("\nWhen to use:");
284
292
  log(" Mark a task-like node done, optionally create a checkpoint, and emit a completion event when enabled.");
285
293
  log(" Use `--checkpoint` for milestone compression, not every routine task completion.");
@@ -287,9 +295,9 @@ function printTaskHelp(log, subcommand) {
287
295
  return;
288
296
  default:
289
297
  log("Usage:");
290
- log(' mdkg task start <id-or-qid> [--ws <alias>] [--run-id <id>] [--note "<text>"]');
291
- log(" mdkg task update <id-or-qid> [options]");
292
- log(' mdkg task done <id-or-qid> [--checkpoint "<title>"] [options]');
298
+ log(' mdkg task start <id-or-qid> [--ws <alias>] [--run-id <id>] [--note "<text>"] [--json]');
299
+ log(" mdkg task update <id-or-qid> [options] [--json]");
300
+ log(' mdkg task done <id-or-qid> [--checkpoint "<title>"] [options] [--json]');
293
301
  log("\nNotes:");
294
302
  log(" `mdkg task ...` only supports task, bug, and test nodes in this wave.");
295
303
  log(" Feat and epic closeout remain checkpoint-first guidance plus manual parent updates.");
@@ -300,7 +308,7 @@ function printEventHelp(log, subcommand) {
300
308
  switch ((subcommand ?? "").toLowerCase()) {
301
309
  case "enable":
302
310
  log("Usage:");
303
- log(" mdkg event enable [--ws <alias>]");
311
+ log(" mdkg event enable [--ws <alias>] [--json]");
304
312
  log("\nWhen to use:");
305
313
  log(" Create or ensure the append-only JSONL event log for a workspace.");
306
314
  printGlobalOptions(log);
@@ -308,7 +316,7 @@ function printEventHelp(log, subcommand) {
308
316
  case "append":
309
317
  log("Usage:");
310
318
  log(" mdkg event append --kind <kind> --status <ok|error|retry|skipped> --refs <id,...>");
311
- log(' [--ws <alias>] [--artifacts <a,...>] [--notes "<text>"] [--run-id <id>]');
319
+ log(' [--ws <alias>] [--artifacts <a,...>] [--notes "<text>"] [--run-id <id>] [--json]');
312
320
  log(" [--agent <name>] [--skill <slug>] [--tool <id>]");
313
321
  log("\nWhen to use:");
314
322
  log(" Append explicit provenance events from an orchestrator or manual workflow.");
@@ -316,8 +324,8 @@ function printEventHelp(log, subcommand) {
316
324
  return;
317
325
  default:
318
326
  log("Usage:");
319
- log(" mdkg event enable [--ws <alias>]");
320
- log(" mdkg event append --kind <kind> --status <ok|error|retry|skipped> --refs <id,...> [options]");
327
+ log(" mdkg event enable [--ws <alias>] [--json]");
328
+ log(" mdkg event append --kind <kind> --status <ok|error|retry|skipped> --refs <id,...> [options] [--json]");
321
329
  printGlobalOptions(log);
322
330
  }
323
331
  }
@@ -328,13 +336,13 @@ function printNextHelp(log) {
328
336
  }
329
337
  function printCheckpointHelp(log) {
330
338
  log("Usage:");
331
- log(" mdkg checkpoint new <title> [--ws <alias>]");
339
+ log(" mdkg checkpoint new <title> [--ws <alias>] [--json]");
332
340
  log(' [--relates <id,id,...>] [--scope <id,id,...>] [--run-id <id>] [--note "<text>"]');
333
341
  printGlobalOptions(log);
334
342
  }
335
343
  function printValidateHelp(log) {
336
344
  log("Usage:");
337
- log(" mdkg validate [--out <path>] [--quiet]");
345
+ log(" mdkg validate [--out <path>] [--quiet] [--json]");
338
346
  printGlobalOptions(log);
339
347
  }
340
348
  function printFormatHelp(log) {
@@ -573,7 +581,8 @@ function runWorkspaceSubcommand(parsed, root) {
573
581
  if (parsed.positionals.length > 2) {
574
582
  throw new errors_1.UsageError("workspace ls takes no arguments");
575
583
  }
576
- (0, workspace_1.runWorkspaceListCommand)({ root });
584
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
585
+ (0, workspace_1.runWorkspaceListCommand)({ root, json });
577
586
  return 0;
578
587
  }
579
588
  case "add": {
@@ -583,7 +592,8 @@ function runWorkspaceSubcommand(parsed, root) {
583
592
  throw new errors_1.UsageError("workspace add requires <alias> <path>");
584
593
  }
585
594
  const mdkgDir = requireFlagValue("--mdkg-dir", parsed.flags["--mdkg-dir"]);
586
- (0, workspace_1.runWorkspaceAddCommand)({ root, alias, workspacePath, mdkgDir });
595
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
596
+ (0, workspace_1.runWorkspaceAddCommand)({ root, alias, workspacePath, mdkgDir, json });
587
597
  return 0;
588
598
  }
589
599
  case "rm": {
@@ -591,11 +601,30 @@ function runWorkspaceSubcommand(parsed, root) {
591
601
  if (!alias || parsed.positionals.length > 3) {
592
602
  throw new errors_1.UsageError("workspace rm requires <alias>");
593
603
  }
594
- (0, workspace_1.runWorkspaceRemoveCommand)({ root, alias });
604
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
605
+ (0, workspace_1.runWorkspaceRemoveCommand)({ root, alias, json });
606
+ return 0;
607
+ }
608
+ case "enable": {
609
+ const alias = parsed.positionals[2];
610
+ if (!alias || parsed.positionals.length > 3) {
611
+ throw new errors_1.UsageError("workspace enable requires <alias>");
612
+ }
613
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
614
+ (0, workspace_1.runWorkspaceEnableCommand)({ root, alias, json });
615
+ return 0;
616
+ }
617
+ case "disable": {
618
+ const alias = parsed.positionals[2];
619
+ if (!alias || parsed.positionals.length > 3) {
620
+ throw new errors_1.UsageError("workspace disable requires <alias>");
621
+ }
622
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
623
+ (0, workspace_1.runWorkspaceDisableCommand)({ root, alias, json });
595
624
  return 0;
596
625
  }
597
626
  default:
598
- throw new errors_1.UsageError("workspace requires ls/add/rm");
627
+ throw new errors_1.UsageError("workspace requires ls/add/rm/enable/disable");
599
628
  }
600
629
  }
601
630
  function runSkillSubcommand(parsed, root) {
@@ -620,6 +649,7 @@ function runSkillSubcommand(parsed, root) {
620
649
  const withScripts = parseBooleanFlag("--with-scripts", parsed.flags["--with-scripts"]);
621
650
  const force = parseBooleanFlag("--force", parsed.flags["--force"]);
622
651
  const runId = requireFlagValue("--run-id", parsed.flags["--run-id"]);
652
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
623
653
  (0, skill_1.runSkillNewCommand)({
624
654
  root,
625
655
  slug,
@@ -631,6 +661,7 @@ function runSkillSubcommand(parsed, root) {
631
661
  withScripts,
632
662
  force,
633
663
  runId,
664
+ json,
634
665
  });
635
666
  return 0;
636
667
  }
@@ -698,7 +729,8 @@ function runSkillSubcommand(parsed, root) {
698
729
  throw new errors_1.UsageError("skill validate accepts at most one slug");
699
730
  }
700
731
  const slug = parsed.positionals[2];
701
- (0, skill_1.runSkillValidateCommand)({ root, slug });
732
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
733
+ (0, skill_1.runSkillValidateCommand)({ root, slug, json });
702
734
  return 0;
703
735
  }
704
736
  case "sync": {
@@ -706,7 +738,8 @@ function runSkillSubcommand(parsed, root) {
706
738
  throw new errors_1.UsageError("skill sync does not accept positional arguments");
707
739
  }
708
740
  const force = parseBooleanFlag("--force", parsed.flags["--force"]);
709
- (0, skill_1.runSkillSyncCommand)({ root, force });
741
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
742
+ (0, skill_1.runSkillSyncCommand)({ root, force, json });
710
743
  return 0;
711
744
  }
712
745
  default:
@@ -724,7 +757,8 @@ function runTaskSubcommand(parsed, root) {
724
757
  const ws = requireFlagValue("--ws", parsed.flags["--ws"]);
725
758
  const runId = requireFlagValue("--run-id", parsed.flags["--run-id"]);
726
759
  const note = requireFlagValue("--note", parsed.flags["--note"]);
727
- (0, task_1.runTaskStartCommand)({ root, id, ws, runId, note });
760
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
761
+ (0, task_1.runTaskStartCommand)({ root, id, ws, runId, note, json });
728
762
  return 0;
729
763
  }
730
764
  case "update": {
@@ -744,6 +778,7 @@ function runTaskSubcommand(parsed, root) {
744
778
  const clearBlockedBy = parseBooleanFlag("--clear-blocked-by", parsed.flags["--clear-blocked-by"]);
745
779
  const runId = requireFlagValue("--run-id", parsed.flags["--run-id"]);
746
780
  const note = requireFlagValue("--note", parsed.flags["--note"]);
781
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
747
782
  (0, task_1.runTaskUpdateCommand)({
748
783
  root,
749
784
  id,
@@ -759,6 +794,7 @@ function runTaskSubcommand(parsed, root) {
759
794
  clearBlockedBy,
760
795
  runId,
761
796
  note,
797
+ json,
762
798
  });
763
799
  return 0;
764
800
  }
@@ -774,6 +810,7 @@ function runTaskSubcommand(parsed, root) {
774
810
  const checkpoint = requireFlagValue("--checkpoint", parsed.flags["--checkpoint"]);
775
811
  const runId = requireFlagValue("--run-id", parsed.flags["--run-id"]);
776
812
  const note = requireFlagValue("--note", parsed.flags["--note"]);
813
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
777
814
  (0, task_1.runTaskDoneCommand)({
778
815
  root,
779
816
  id,
@@ -784,6 +821,7 @@ function runTaskSubcommand(parsed, root) {
784
821
  checkpoint,
785
822
  runId,
786
823
  note,
824
+ json,
787
825
  });
788
826
  return 0;
789
827
  }
@@ -799,7 +837,8 @@ function runEventSubcommand(parsed, root) {
799
837
  throw new errors_1.UsageError("event enable does not accept positional arguments");
800
838
  }
801
839
  const ws = requireFlagValue("--ws", parsed.flags["--ws"]);
802
- (0, event_1.runEventEnableCommand)({ root, ws });
840
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
841
+ (0, event_1.runEventEnableCommand)({ root, ws, json });
803
842
  return 0;
804
843
  }
805
844
  case "append": {
@@ -819,6 +858,7 @@ function runEventSubcommand(parsed, root) {
819
858
  const agent = requireFlagValue("--agent", parsed.flags["--agent"]);
820
859
  const skill = requireFlagValue("--skill", parsed.flags["--skill"]);
821
860
  const tool = requireFlagValue("--tool", parsed.flags["--tool"]);
861
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
822
862
  (0, event_1.runEventAppendCommand)({
823
863
  root,
824
864
  ws,
@@ -831,6 +871,7 @@ function runEventSubcommand(parsed, root) {
831
871
  agent,
832
872
  skill,
833
873
  tool,
874
+ json,
834
875
  });
835
876
  return 0;
836
877
  }
@@ -882,6 +923,7 @@ function runCommand(parsed, root, runtime) {
882
923
  if (!type || !title) {
883
924
  throw new errors_1.UsageError("new requires a type and title");
884
925
  }
926
+ const id = requireFlagValue("--id", parsed.flags["--id"]);
885
927
  const ws = requireFlagValue("--ws", parsed.flags["--ws"]);
886
928
  const status = requireFlagValue("--status", parsed.flags["--status"]);
887
929
  const priority = parseNumberFlag("--priority", parsed.flags["--priority"]);
@@ -905,10 +947,12 @@ function runCommand(parsed, root, runtime) {
905
947
  const noCache = parseBooleanFlag("--no-cache", parsed.flags["--no-cache"]);
906
948
  const noReindex = parseBooleanFlag("--no-reindex", parsed.flags["--no-reindex"]);
907
949
  const runId = requireFlagValue("--run-id", parsed.flags["--run-id"]);
950
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
908
951
  (0, new_1.runNewCommand)({
909
952
  root,
910
953
  type,
911
954
  title,
955
+ id,
912
956
  ws,
913
957
  status,
914
958
  priority,
@@ -932,6 +976,7 @@ function runCommand(parsed, root, runtime) {
932
976
  noCache,
933
977
  noReindex,
934
978
  runId,
979
+ json,
935
980
  });
936
981
  return 0;
937
982
  }
@@ -1117,6 +1162,7 @@ function runCommand(parsed, root, runtime) {
1117
1162
  const template = requireFlagValue("--template", parsed.flags["--template"]);
1118
1163
  const runId = requireFlagValue("--run-id", parsed.flags["--run-id"]);
1119
1164
  const note = requireFlagValue("--note", parsed.flags["--note"]);
1165
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
1120
1166
  (0, checkpoint_1.runCheckpointNewCommand)({
1121
1167
  root,
1122
1168
  title,
@@ -1128,6 +1174,7 @@ function runCommand(parsed, root, runtime) {
1128
1174
  template,
1129
1175
  runId,
1130
1176
  note,
1177
+ json,
1131
1178
  });
1132
1179
  return 0;
1133
1180
  }
@@ -1137,7 +1184,8 @@ function runCommand(parsed, root, runtime) {
1137
1184
  }
1138
1185
  const out = requireFlagValue("--out", parsed.flags["--out"]);
1139
1186
  const quiet = parseBooleanFlag("--quiet", parsed.flags["--quiet"]);
1140
- (0, validate_1.runValidateCommand)({ root, out, quiet });
1187
+ const json = parseBooleanFlag("--json", parsed.flags["--json"]);
1188
+ (0, validate_1.runValidateCommand)({ root, out, quiet, json });
1141
1189
  return 0;
1142
1190
  }
1143
1191
  case "format":