mdkg 0.3.3 → 0.3.5

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.
@@ -22,19 +22,27 @@ Primary commands:
22
22
  - `mdkg spec`
23
23
  - `mdkg archive`
24
24
  - `mdkg bundle`
25
+ - `mdkg graph`
26
+ - `mdkg subgraph`
25
27
  - `mdkg work`
26
28
  - `mdkg goal`
27
29
  - `mdkg task`
28
30
  - `mdkg validate`
29
31
  - `mdkg status [--json]`
30
- - `mdkg fix plan [--family index|refs|ids|all] [--target <id-or-qid>] [--json]`
32
+ - `mdkg fix plan [--family index|refs|ids|all] [--target <id-or-qid>] [--base-ref <ref>] [--json]`
33
+ - `mdkg fix apply [--family ids] [--target <id-or-qid>] [--base-ref <ref>] [--json]`
34
+ - `mdkg fix ids [--target <id-or-qid>] [--base-ref <ref>] [--apply] [--json]`
31
35
 
32
36
  Operator health:
33
37
  - `mdkg status [--json]` is a read-only summary for scripts and agents
34
38
  - reports mdkg version/config, git state, graph/index freshness, selected-goal state, project DB verification summary, and generated cache status
35
39
  - does not rebuild indexes, run migrations, repair files, mutate graph nodes, or change selected-goal state
36
- - `mdkg fix plan ...` is dry-run repair planning only; it writes nothing and `fix apply` is not exposed
37
- - `fix plan --json` returns a receipt-shaped plan with selected families, risk counts, paths, reason codes, and `apply_supported: false`
40
+ - `mdkg fix plan ...` is dry-run repair planning only; it writes nothing
41
+ - duplicate-ID graph repairs can be applied with `mdkg fix apply --family ids` or `mdkg fix ids --apply`
42
+ - use `--base-ref main` when mainline IDs should win branch-merge repair
43
+ - unresolved Git add/add conflict stages are split by keeping stage 2 at the conflicted path and writing stage 3 to a new canonical ID/path
44
+ - graph-reference and index/cache findings remain review-only guidance
45
+ - `fix plan --json` returns a receipt-shaped plan with selected families, risk counts, paths, reason codes, and per-change `apply_supported` metadata
38
46
 
39
47
  Index backend:
40
48
  - fresh mdkg workspaces default to `index.backend: sqlite`
@@ -198,6 +206,21 @@ Graph snapshot bundles:
198
206
  - public bundles include only public workspace content and public archive sidecars
199
207
  - public bundle creation fails when public records reference private graph, archive, or subgraph records
200
208
 
209
+ Graph clone, fork, and template import:
210
+ - `mdkg graph clone <source-bundle-or-mdkg-dir> --target <path> [--json]`
211
+ - `mdkg graph fork <source-bundle-or-mdkg-dir> --target <path> [--start-goal <goal-id>] [--json]`
212
+ - `mdkg graph import-template <source-bundle-or-mdkg-dir> [--start-goal <goal-id>] [--select-goal] [--id-prefix <prefix>] [--dry-run] [--apply] [--json]`
213
+ - `graph clone` and `graph fork` preserve IDs because the target is a separate graph namespace
214
+ - clone/fork targets must be empty or absent and stay under the current mdkg root
215
+ - live directory sources are never mutated; clone/fork refuses targets nested inside a live source directory
216
+ - `graph fork --start-goal <goal-id>` writes selected-goal state in the target graph after validation
217
+ - `graph import-template` imports authored `.mdkg/work/*.md` template nodes into the current repo and skips config, generated indexes, archive payloads, bundles, and materialized subgraph views
218
+ - `graph import-template` defaults to dry-run unless `--apply` is supplied
219
+ - same-repo template import rewrites canonical numeric IDs to the next unused ID by type prefix and rewrites structured refs plus safe body-local id/qid mentions
220
+ - colliding semantic template IDs require `--id-prefix`
221
+ - `--select-goal` requires `--start-goal` and writes selected-goal state only after apply validation
222
+ - subgraphs remain read-only bundle projections for orchestration context; use `graph clone|fork|import-template` when authored graph state should be created
223
+
201
224
  Subgraph orchestration:
202
225
  - `mdkg subgraph add <alias> <bundle-path> [--visibility private|internal|public] [--profile private|public] [--source-path <path>] [--json]`
203
226
  - `mdkg subgraph list [--json]`
@@ -29,13 +29,14 @@ mdkg capability search "..."
29
29
  mdkg spec list --json
30
30
  mdkg archive list
31
31
  mdkg bundle create --profile private
32
+ mdkg graph clone .mdkg/bundles/private/all.mdkg.zip --target demos/demo-1 --json
32
33
  mdkg subgraph list --json
33
34
  mdkg status --json
34
35
  mdkg fix plan --json
35
36
  mdkg validate
36
37
  ```
37
38
 
38
- This repo is already initialized. Use `mdkg upgrade` to preview safe scaffold updates, `mdkg index` to create or refresh generated graph/skill/capability/subgraph and SQLite caches after init, `mdkg new` to create work, `mdkg new goal "..."` plus `mdkg goal activate/current/next/claim/evaluate` for recursive long-running objectives, `mdkg search`/`mdkg show` to inspect graph state, `mdkg capability ...` to inspect cached skill/spec/work/core/design capabilities, `mdkg spec ...` for focused optional SPEC records, `mdkg capability resolve ...` to rank local and subgraph capabilities, `mdkg archive ...` to register source/artifact sidecars, `mdkg work ...` to create work contract/order/receipt semantic mirrors and deterministic trigger/verification records, `mdkg bundle ...` to create full graph snapshot bundles, `mdkg subgraph ...` to register read-only child graph planning views, `mdkg pack <id>` to build deterministic context, and `mdkg validate` before closeout.
39
+ This repo is already initialized. Use `mdkg upgrade` to preview safe scaffold updates, `mdkg index` to create or refresh generated graph/skill/capability/subgraph and SQLite caches after init, `mdkg new` to create work, `mdkg new goal "..."` plus `mdkg goal activate/current/next/claim/evaluate` for recursive long-running objectives, `mdkg search`/`mdkg show` to inspect graph state, `mdkg capability ...` to inspect cached skill/spec/work/core/design capabilities, `mdkg spec ...` for focused optional SPEC records, `mdkg capability resolve ...` to rank local and subgraph capabilities, `mdkg archive ...` to register source/artifact sidecars, `mdkg work ...` to create work contract/order/receipt semantic mirrors and deterministic trigger/verification records, `mdkg bundle ...` to create full graph snapshot bundles, `mdkg graph ...` to clone/fork/import authored graph templates, `mdkg subgraph ...` to register read-only child graph planning views, `mdkg pack <id>` to build deterministic context, and `mdkg validate` before closeout.
39
40
 
40
41
  Use `mdkg status --json` for a read-only operator summary of Git, graph,
41
42
  selected-goal, project DB, and generated-cache health before mutating work. Use
@@ -45,8 +46,13 @@ fresh init, run `mdkg index` first so strict doctor can load generated caches.
45
46
 
46
47
  Use `mdkg fix plan --json` for dry-run repair guidance. It reports generated
47
48
  index/cache repair hints, missing graph references, and duplicate local ids as
48
- receipt-shaped planned changes with risk levels and `apply_supported: false`.
49
- `fix apply` is not exposed; repair application is intentionally deferred.
49
+ receipt-shaped planned changes with risk levels and per-change
50
+ `apply_supported` metadata. Duplicate-ID graph repairs can be applied with
51
+ `mdkg fix apply --family ids --json` or `mdkg fix ids --apply --json`; use
52
+ `--base-ref main` when mainline IDs should win. Index/cache and graph-reference
53
+ findings remain review-only. For unresolved Git add/add conflicts, `fix ids`
54
+ keeps stage 2 at the conflicted path, rewrites stage 3 to the next unused
55
+ canonical ID/path, and records a receipt.
50
56
 
51
57
  Use research spikes for investigation and planning work that should produce a
52
58
  reviewable recommendation before implementation:
@@ -153,6 +159,22 @@ mdkg bundle verify .mdkg/bundles/private/all.mdkg.zip
153
159
 
154
160
  Use this as a pre-commit recommendation only when the repo tracks archive caches or `.mdkg/bundles/`. Private bundles are local graph transport artifacts and may be tracked in private repos when configured. Public bundles require selected workspaces with `visibility: public` and fail closed when public records reference private graph, archive, or subgraph records.
155
161
 
162
+ Clone or fork an authored graph into a separate repo/workspace while preserving IDs:
163
+
164
+ ```bash
165
+ mdkg graph clone .mdkg/bundles/private/all.mdkg.zip --target demos/demo-1 --json
166
+ mdkg graph fork templates/website-template-mdkg --target demos/live-build --start-goal goal-1 --json
167
+ ```
168
+
169
+ Import a template graph into the current repo with deterministic ID and link rewrites:
170
+
171
+ ```bash
172
+ mdkg graph import-template templates/website-template-mdkg --start-goal goal-1 --select-goal --dry-run --json
173
+ mdkg graph import-template templates/website-template-mdkg --start-goal goal-1 --select-goal --apply --json
174
+ ```
175
+
176
+ `graph clone` and `graph fork` preserve IDs because the target is a separate graph namespace. `graph import-template` rewrites canonical numeric IDs for same-repo imports and requires `--id-prefix` for colliding semantic IDs. Subgraphs remain read-only planning views; use `mdkg graph ...` when authored graph state should be created.
177
+
156
178
  Register child bundle snapshots as read-only subgraphs with:
157
179
 
158
180
  ```bash
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema_version": 1,
3
3
  "tool": "mdkg",
4
- "mdkg_version": "0.3.3",
4
+ "mdkg_version": "0.3.5",
5
5
  "files": [
6
6
  {
7
7
  "path": ".mdkg/config.json",
@@ -61,7 +61,7 @@
61
61
  {
62
62
  "path": ".mdkg/README.md",
63
63
  "category": "mdkg_doc",
64
- "sha256": "68b5f4d2d04a4dc9a062e54a594d684b3816c0b614079eb6b08f0dca16fd0b47"
64
+ "sha256": "a3b059cb0ea5625f9888fbcee52ddf13491e033046d8c3f3846574d8667ad234"
65
65
  },
66
66
  {
67
67
  "path": ".mdkg/skills/build-pack-and-execute-task/SKILL.md",
@@ -261,7 +261,7 @@
261
261
  {
262
262
  "path": "CLI_COMMAND_MATRIX.md",
263
263
  "category": "startup_doc",
264
- "sha256": "7f27715427a6762ef987fb872c9e09976075c76fddac68c4df89387e5b8a6909"
264
+ "sha256": "220b461553310a8248d53f01fae132d4ca433659da679e401e3ce6abe2592cb7"
265
265
  },
266
266
  {
267
267
  "path": "llms.txt",
@@ -95,6 +95,8 @@ const VALUE_FLAGS = new Set([
95
95
  "--target",
96
96
  "--snapshot",
97
97
  "--family",
98
+ "--start-goal",
99
+ "--id-prefix",
98
100
  ]);
99
101
  const BOOLEAN_FLAGS = new Set([
100
102
  "--tolerant",
@@ -132,6 +134,7 @@ const BOOLEAN_FLAGS = new Set([
132
134
  "--allow-dirty",
133
135
  "--clean",
134
136
  "--gitignore",
137
+ "--select-goal",
135
138
  ]);
136
139
  const FLAG_ALIASES = {
137
140
  "--o": "--out",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mdkg",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "Markdown Knowledge Graph",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -28,10 +28,12 @@
28
28
  "smoke:operator-health": "npm run build && node scripts/smoke-operator-health.js",
29
29
  "smoke:fix-plan": "npm run build && node scripts/smoke-fix-plan.js",
30
30
  "smoke:branch-conflicts": "npm run build && node scripts/smoke-branch-conflicts.js",
31
+ "smoke:id-repair": "npm run build && node scripts/smoke-id-repair.js",
31
32
  "smoke:command-docs": "npm run build && node scripts/smoke-command-docs.js",
32
33
  "smoke:spike": "npm run build && node scripts/smoke-spike.js",
33
34
  "smoke:goal-lifecycle": "npm run build && node scripts/smoke-goal-lifecycle.js",
34
35
  "smoke:bundle": "npm run build && node scripts/smoke-bundle.js",
36
+ "smoke:graph-clone": "npm run build && node scripts/smoke-graph-clone.js",
35
37
  "smoke:bundle-import": "npm run smoke:subgraph",
36
38
  "smoke:visibility": "npm run build && node scripts/smoke-visibility.js",
37
39
  "smoke:sqlite": "npm run build && node scripts/smoke-sqlite.js",
@@ -41,7 +43,7 @@
41
43
  "cli:check": "npm run build && node scripts/cli_help_snapshot.js --check",
42
44
  "cli:contract": "npm run build && node scripts/generate-command-contract.js --check",
43
45
  "prepack": "npm run build && node scripts/assert-publish-ready.js",
44
- "prepublishOnly": "npm run test && npm run cli:check && npm run cli:contract && node dist/cli.js validate && npm run smoke:consumer && npm run smoke:matrix && npm run smoke:upgrade && npm run smoke:init && npm run smoke:capabilities && npm run smoke:db && npm run smoke:db-queue && npm run smoke:db-queue-cli && npm run smoke:db-events && npm run smoke:db-materializer && npm run smoke:db-snapshot && npm run smoke:archive-work && npm run smoke:work-invocation && npm run smoke:cli-ux-polish && npm run smoke:operator-health && npm run smoke:fix-plan && npm run smoke:branch-conflicts && npm run smoke:command-docs && npm run smoke:spike && npm run smoke:goal-lifecycle && npm run smoke:bundle && npm run smoke:subgraph && npm run smoke:visibility && npm run smoke:sqlite && npm run smoke:parallel && npm run smoke:goal && node scripts/assert-publish-ready.js",
46
+ "prepublishOnly": "npm run test && npm run cli:check && npm run cli:contract && node dist/cli.js validate && npm run smoke:consumer && npm run smoke:matrix && npm run smoke:upgrade && npm run smoke:init && npm run smoke:capabilities && npm run smoke:db && npm run smoke:db-queue && npm run smoke:db-queue-cli && npm run smoke:db-events && npm run smoke:db-materializer && npm run smoke:db-snapshot && npm run smoke:archive-work && npm run smoke:work-invocation && npm run smoke:cli-ux-polish && npm run smoke:operator-health && npm run smoke:fix-plan && npm run smoke:branch-conflicts && npm run smoke:id-repair && npm run smoke:command-docs && npm run smoke:spike && npm run smoke:goal-lifecycle && npm run smoke:bundle && npm run smoke:graph-clone && npm run smoke:subgraph && npm run smoke:visibility && npm run smoke:sqlite && npm run smoke:parallel && npm run smoke:goal && node scripts/assert-publish-ready.js",
45
47
  "postinstall": "node scripts/postinstall.js",
46
48
  "smoke:subgraph": "npm run build && node scripts/smoke-subgraph.js"
47
49
  },