@theglitchking/hit-em-with-the-docs 2.3.0 → 2.5.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 (45) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +4 -0
  4. package/dist/action/core/audit/auditor.d.ts.map +1 -1
  5. package/dist/action/core/integrate/integrator.d.ts.map +1 -1
  6. package/dist/action/core/knowledge-base/fix-legacy-layout.d.ts +61 -0
  7. package/dist/action/core/knowledge-base/fix-legacy-layout.d.ts.map +1 -0
  8. package/dist/action/core/knowledge-base/migrate.d.ts +42 -8
  9. package/dist/action/core/knowledge-base/migrate.d.ts.map +1 -1
  10. package/dist/action/core/maintain/orchestrator.d.ts +2 -0
  11. package/dist/action/core/maintain/orchestrator.d.ts.map +1 -1
  12. package/dist/action/generators/regenerate.d.ts +38 -0
  13. package/dist/action/generators/regenerate.d.ts.map +1 -0
  14. package/dist/action/index.d.ts +1 -0
  15. package/dist/action/index.d.ts.map +1 -1
  16. package/dist/action/index.js +1 -1
  17. package/dist/cli/index.js +103 -4
  18. package/dist/cli/index.js.map +1 -1
  19. package/dist/core/audit/auditor.d.ts.map +1 -1
  20. package/dist/core/audit/auditor.js +62 -2
  21. package/dist/core/audit/auditor.js.map +1 -1
  22. package/dist/core/integrate/integrator.d.ts.map +1 -1
  23. package/dist/core/integrate/integrator.js +9 -31
  24. package/dist/core/integrate/integrator.js.map +1 -1
  25. package/dist/core/knowledge-base/fix-legacy-layout.d.ts +61 -0
  26. package/dist/core/knowledge-base/fix-legacy-layout.d.ts.map +1 -0
  27. package/dist/core/knowledge-base/fix-legacy-layout.js +189 -0
  28. package/dist/core/knowledge-base/fix-legacy-layout.js.map +1 -0
  29. package/dist/core/knowledge-base/migrate.d.ts +42 -8
  30. package/dist/core/knowledge-base/migrate.d.ts.map +1 -1
  31. package/dist/core/knowledge-base/migrate.js +59 -24
  32. package/dist/core/knowledge-base/migrate.js.map +1 -1
  33. package/dist/core/maintain/orchestrator.d.ts +2 -0
  34. package/dist/core/maintain/orchestrator.d.ts.map +1 -1
  35. package/dist/core/maintain/orchestrator.js +19 -0
  36. package/dist/core/maintain/orchestrator.js.map +1 -1
  37. package/dist/generators/regenerate.d.ts +38 -0
  38. package/dist/generators/regenerate.d.ts.map +1 -0
  39. package/dist/generators/regenerate.js +137 -0
  40. package/dist/generators/regenerate.js.map +1 -0
  41. package/dist/index.d.ts +1 -0
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +1 -0
  44. package/dist/index.js.map +1 -1
  45. package/package.json +1 -1
@@ -6,13 +6,13 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Official marketplace for hit-em-with-the-docs - Self-managing documentation system",
9
- "version": "2.3.0"
9
+ "version": "2.5.0"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "hit-em-with-the-docs",
14
14
  "description": "Self-managing documentation system with hierarchical structure, intelligent automation, pattern discovery, and agent orchestration",
15
- "version": "2.3.0",
15
+ "version": "2.5.0",
16
16
  "author": {
17
17
  "name": "TheGlitchKing"
18
18
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hit-em-with-the-docs",
3
3
  "description": "Self-managing documentation system with hierarchical structure, intelligent automation, pattern discovery, and agent orchestration",
4
- "version": "2.3.0",
4
+ "version": "2.5.0",
5
5
  "author": {
6
6
  "name": "TheGlitchKing",
7
7
  "email": "theglitchking@users.noreply.github.com"
package/README.md CHANGED
@@ -10,6 +10,10 @@
10
10
  > You still need to remember to use this plugin when creating documentation! As projects grow, documentation needs to be created and maintained. You'll need to invoke this plugin or ask an LLM to create documentation for your features, workflows, or infrastructure. This plugin must be invoked to create, update, or maintain your docs.
11
11
 
12
12
  > [!NOTE]
13
+ > **2.5.0 — INDEX/REGISTRY regeneration fix.** `integrate` could only append a row to an INDEX.md that already had a table, so the *first* document into any domain was never registered — and the failure was silently swallowed. `integrate` and `maintain` now rebuild domain + root `INDEX.md`/`REGISTRY.md` from the documents on disk via the real generators. New `hewtd index` (alias `reindex`) command regenerates all indexes on demand; `maintain` self-heals them every run; `audit` gains an `index-drift` rule that `--strict` gates CI on. Closes [#7](https://github.com/TheGlitchKing/hit-em-with-the-docs/issues/7). See [CHANGELOG](./CHANGELOG.md#250--2026-05-16).
14
+ >
15
+ > **2.4.0 — `migrate-incident` path bug fix + recovery command.** `migrate-incident` now correctly writes to `<vault-root>/incidents/<slug>/` (the location `hewtd maintain`'s incidents-index generator scans). In 2.3.0 the target was derived from the source flat file's parent dir, which silently bypassed the canonical layout when the flat file lived at the vault root. New `hewtd fix-legacy-layout` command relocates 2.3.0-buggy folders and rewrites fact `provenance:` refs. Idempotent, dry-run supported. See [CHANGELOG](./CHANGELOG.md#240--2026-05-15).
16
+ >
13
17
  > **New in 2.3.0:** the knowledge-base primitives layer. Three new tiers (`fact`, `incident-narrative`, `incident-facts`) for citable atomic claims and immutable postmortems, plus an optional `symptoms:` frontmatter field on any-tier playbooks for symptom→playbook routing with `cites:` to facts. Three new deterministic indexes (`facts/INDEX.md`, `incidents/INDEX.md`, `symptoms/INDEX.md`) auto-generate on `hewtd maintain` when a vault root exists. Five new CLI commands: `find-citers`, `audit-facts [--run-verify]`, `extract-facts`, `cite`, `migrate-incident`. New `audit --strict` flag for CI gating. New `/hit-em-with-the-docs:help` slash command for LLM orientation. Four authoring templates at `templates/knowledge-base/`. Full reference: [`docs/knowledge-base-primitives.md`](./docs/knowledge-base-primitives.md). Agent guide: [`docs/LLM-GUIDE.md`](./docs/LLM-GUIDE.md).
14
18
  >
15
19
  > **New in 2.2.0:** the `tier` enum gains a `"plan"` value for [persistent-planning](https://github.com/TheGlitchKing/persistent-planning) lg-mode artifacts (phase / task / atom / notes documents), and the `version` and `status` fields are now conditionally relaxed for plan-tier docs (plans use lifecycle status, not semver). Existing tiers (guide / standard / example / reference / admin) are unchanged. See [`docs/plan-tier-frontmatter.md`](./docs/plan-tier-frontmatter.md) for the full reference.
@@ -1 +1 @@
1
- {"version":3,"file":"auditor.d.ts","sourceRoot":"","sources":["file:///home/tmarlette/workspace/the-glitch-kingdom/hit-em-with-the-docs/src/core/audit/auditor.ts"],"names":[],"mappings":"AAWA,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAM5E,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CA4IpF;AA+JD;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,gBAAgB,CAAC,CAQ3B"}
1
+ {"version":3,"file":"auditor.d.ts","sourceRoot":"","sources":["file:///home/tmarlette/workspace/the-glitch-kingdom/hit-em-with-the-docs/src/core/audit/auditor.ts"],"names":[],"mappings":"AAYA,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAM5E,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAqJpF;AA0ND;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,gBAAgB,CAAC,CAQ3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"integrator.d.ts","sourceRoot":"","sources":["file:///home/tmarlette/workspace/the-glitch-kingdom/hit-em-with-the-docs/src/core/integrate/integrator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGtD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,uBAAuB,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,CA8I1B;AA+GD;;GAEG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,GAC1C,OAAO,CAAC,eAAe,EAAE,CAAC,CAY5B"}
1
+ {"version":3,"file":"integrator.d.ts","sourceRoot":"","sources":["file:///home/tmarlette/workspace/the-glitch-kingdom/hit-em-with-the-docs/src/core/integrate/integrator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAItD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,uBAAuB,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,CAoJ1B;AAmED;;GAEG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,GAC1C,OAAO,CAAC,eAAe,EAAE,CAAC,CAY5B"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Migrate 2.3.0-buggy incident folders into the canonical layout (2.4.0).
3
+ *
4
+ * In 2.3.0, `hewtd migrate-incident <flat-file>` wrote the new folder
5
+ * AS A SIBLING of the flat file. When the flat file lived at the vault
6
+ * root (the documented example), the resulting folder ended up at
7
+ * `<vault-root>/<slug>/` instead of `<vault-root>/incidents/<slug>/`.
8
+ * The `incidents/INDEX.md` generator scans only the canonical path, so
9
+ * those folders were silently absent from the index.
10
+ *
11
+ * This module:
12
+ * 1. Detects legacy folders — anything matching `<vault-root>/<slug>/`
13
+ * that contains a valid `narrative.md` AND isn't already under the
14
+ * canonical `<vault-root>/incidents/` parent.
15
+ * 2. Moves them into `<vault-root>/incidents/<slug>/` (preserving any
16
+ * `facts.md` / `evidence/` contents).
17
+ * 3. Rewrites `provenance:` references in any `<vault-root>/facts/*.md`
18
+ * files that pointed at the old folder paths.
19
+ *
20
+ * Idempotent: re-running on a clean vault is a no-op with a status report.
21
+ */
22
+ export interface FixLegacyLayoutOptions {
23
+ /** Absolute vault root. */
24
+ vaultRoot: string;
25
+ /** Project root — used for relative-path provenance rewrites. */
26
+ projectRoot: string;
27
+ /** If true, returns the plan without writing. */
28
+ dryRun?: boolean;
29
+ }
30
+ export interface MovedFolder {
31
+ /** Slug (folder basename), e.g. `2026-04-23-keycloak-idle-session`. */
32
+ slug: string;
33
+ /** Absolute source path (legacy). */
34
+ from: string;
35
+ /** Absolute destination path (canonical). */
36
+ to: string;
37
+ }
38
+ export interface RewrittenProvenance {
39
+ /** Absolute fact file path. */
40
+ factPath: string;
41
+ /** Old provenance string that was replaced. */
42
+ oldRef: string;
43
+ /** New provenance string. */
44
+ newRef: string;
45
+ }
46
+ export interface FixLegacyLayoutResult {
47
+ vaultRoot: string;
48
+ moved: MovedFolder[];
49
+ rewrittenProvenance: RewrittenProvenance[];
50
+ /** Paths that LOOKED like incident folders but were ambiguous. Reported but not moved. */
51
+ skipped: {
52
+ path: string;
53
+ reason: string;
54
+ }[];
55
+ action: 'fixed' | 'no_op' | 'dry_run';
56
+ }
57
+ /**
58
+ * Discover and (optionally) relocate 2.3.0-layout incident folders.
59
+ */
60
+ export declare function fixLegacyLayout(options: FixLegacyLayoutOptions): Promise<FixLegacyLayoutResult>;
61
+ //# sourceMappingURL=fix-legacy-layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix-legacy-layout.d.ts","sourceRoot":"","sources":["file:///home/tmarlette/workspace/the-glitch-kingdom/hit-em-with-the-docs/src/core/knowledge-base/fix-legacy-layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAOH,MAAM,WAAW,sBAAsB;IACrC,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,WAAW,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,mBAAmB;IAClC,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,mBAAmB,EAAE,mBAAmB,EAAE,CAAC;IAC3C,0FAA0F;IAC1F,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,MAAM,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;CACvC;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CAgKhC"}
@@ -1,26 +1,60 @@
1
1
  /**
2
- * Flat-file incident → folder migration (2.3.0 PR3).
2
+ * Flat-file incident → folder migration (2.3.0 PR3, target-path fix in 2.4.0).
3
3
  *
4
- * Reads a legacy flat-file incident (e.g. `knowledge-base/2026-04-23-foo.md`)
5
- * and converts it into the folder form:
4
+ * Reads a legacy flat-file incident and converts it into the folder form
5
+ * AT THE CANONICAL VAULT LOCATION:
6
6
  *
7
- * <flat-file>.md → <slug>/narrative.md
8
- * <slug>/facts.md (skeleton)
9
- * <slug>/evidence/ (empty, ready for artifacts)
7
+ * <flat-file>.md → <vault-root>/incidents/<slug>/narrative.md
8
+ * <vault-root>/incidents/<slug>/facts.md (skeleton)
9
+ * <vault-root>/incidents/<slug>/evidence/ (empty)
10
10
  *
11
- * Idempotent: re-running on an already-migrated incident detects the folder
12
- * exists and warns + no-ops.
11
+ * In 2.3.0 the target was derived from the flat file's parent directory,
12
+ * which produced folders OUTSIDE `<vault-root>/incidents/` when the source
13
+ * was at the vault root. The `incidents/INDEX.md` generator scans only
14
+ * `<vault-root>/incidents/<slug>/narrative.md` and silently missed those
15
+ * folders. 2.4.0 fixes this by always writing under `<vault-root>/incidents/`.
16
+ *
17
+ * Idempotency:
18
+ * - If a valid `narrative.md` exists at EITHER the new path (canonical)
19
+ * OR the legacy path (`<source-parent>/<slug>/narrative.md`), the
20
+ * migration is treated as already done — no-op unless `--force`.
21
+ * - This protects against double-migration and is robust against
22
+ * consumers who already migrated under the 2.3.0 buggy layout.
23
+ *
24
+ * For consumers stuck on the 2.3.0 buggy layout, see `fixLegacyLayout()`
25
+ * which moves stale folders into `<vault-root>/incidents/` and rewrites
26
+ * any fact `provenance:` references.
13
27
  */
14
28
  export interface MigrateIncidentOptions {
15
29
  /** Absolute path to the flat-file incident markdown. */
16
30
  flatFilePath: string;
31
+ /**
32
+ * Absolute path to the vault root. The migrated folder lands at
33
+ * `<vaultRoot>/incidents/<slug>/`. Required since 2.4.0 — the 2.3.0
34
+ * "sibling of the flat file" behavior was the source of the path bug.
35
+ */
36
+ vaultRoot: string;
17
37
  /** If true, returns the migration plan without writing. */
18
38
  dryRun?: boolean;
39
+ /**
40
+ * If true, proceed with migration even if a folder already exists at
41
+ * the canonical or legacy location. Used to recover from a partial
42
+ * migration.
43
+ */
44
+ force?: boolean;
19
45
  }
20
46
  export interface MigrateIncidentResult {
21
47
  flatFilePath: string;
48
+ /** The canonical target — always under `<vaultRoot>/incidents/`. */
22
49
  targetFolder: string;
23
50
  action: 'migrated' | 'already_migrated' | 'dry_run';
51
+ /**
52
+ * Populated when `action === 'already_migrated'` to indicate WHERE the
53
+ * existing migration was found. `'new'` = canonical `<vault>/incidents/`;
54
+ * `'legacy'` = 2.3.0-style sibling-of-flat-file location. Helps consumers
55
+ * decide whether to run `fix-legacy-layout`.
56
+ */
57
+ existingLocation?: 'new' | 'legacy';
24
58
  narrativePath: string;
25
59
  factsPath: string;
26
60
  evidencePath: string;
@@ -1 +1 @@
1
- {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["file:///home/tmarlette/workspace/the-glitch-kingdom/hit-em-with-the-docs/src/core/knowledge-base/migrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,MAAM,WAAW,sBAAsB;IACrC,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,UAAU,GAAG,kBAAkB,GAAG,SAAS,CAAC;IACpD,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,gBAAgB,EAAE,MAAM,CAAC;IACzB,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CAwGhC"}
1
+ {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["file:///home/tmarlette/workspace/the-glitch-kingdom/hit-em-with-the-docs/src/core/knowledge-base/migrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAOH,MAAM,WAAW,sBAAsB;IACrC,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,UAAU,GAAG,kBAAkB,GAAG,SAAS,CAAC;IACpD;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,gBAAgB,EAAE,MAAM,CAAC;IACzB,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CA8HhC"}
@@ -1,6 +1,7 @@
1
1
  import { type SyncResult } from '../metadata/sync.js';
2
2
  import { type LinkCheckResult } from '../links/checker.js';
3
3
  import { type AuditResult } from '../audit/auditor.js';
4
+ import { type RegenerateResult } from '../../generators/regenerate.js';
4
5
  export interface MaintainOptions {
5
6
  docsPath: string;
6
7
  quick?: boolean;
@@ -11,6 +12,7 @@ export interface MaintainResult {
11
12
  success: boolean;
12
13
  domainHealth: DomainHealthResult;
13
14
  metadataSync?: SyncResult;
15
+ indexRegeneration?: RegenerateResult;
14
16
  linkCheck?: LinkCheckResult;
15
17
  audit?: AuditResult;
16
18
  healthScore: number;
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["file:///home/tmarlette/workspace/the-glitch-kingdom/hit-em-with-the-docs/src/core/maintain/orchestrator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAa3E,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,kBAAkB,CAAC;IACjC,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAoKtF;AAwRD;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAChE,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC,CAoBD"}
1
+ {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["file:///home/tmarlette/workspace/the-glitch-kingdom/hit-em-with-the-docs/src/core/maintain/orchestrator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAY3E,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,gCAAgC,CAAC;AAExC,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,kBAAkB,CAAC;IACjC,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,iBAAiB,CAAC,EAAE,gBAAgB,CAAC;IACrC,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAsLtF;AAyRD;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAChE,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC,CAoBD"}
@@ -0,0 +1,38 @@
1
+ import { type Domain } from '../core/domains/constants.js';
2
+ export interface RegenerateOptions {
3
+ /** Path to the documentation root (e.g. `.documentation`). */
4
+ docsPath: string;
5
+ /**
6
+ * Restrict domain INDEX.md/REGISTRY.md writes to these domains. The root
7
+ * INDEX.md/REGISTRY.md are always refreshed regardless. Defaults to all
8
+ * domains.
9
+ */
10
+ domains?: Domain[];
11
+ silent?: boolean;
12
+ }
13
+ export interface RegenerateResult {
14
+ /** Per-domain document counts — all domains, regardless of the filter. */
15
+ documentCounts: Record<string, number>;
16
+ /** Absolute paths of every INDEX.md / REGISTRY.md written. */
17
+ filesWritten: string[];
18
+ /** Total documents across all domains. */
19
+ totalDocuments: number;
20
+ }
21
+ /**
22
+ * List the document files in a domain directory, excluding the generated
23
+ * INDEX.md / REGISTRY.md. Returns sorted file names (not paths). Empty when
24
+ * the domain directory does not exist.
25
+ */
26
+ export declare function listDomainDocFiles(docsPath: string, domain: string): Promise<string[]>;
27
+ /**
28
+ * Regenerate domain + root INDEX.md / REGISTRY.md from the documents on disk.
29
+ *
30
+ * This is the single source of truth for index generation, shared by
31
+ * `integrate`, `maintain`, and the `index` CLI command. It replaces the
32
+ * fragile regex-append path in `integrate` that could only update an
33
+ * already-populated table — and silently no-op'd on a freshly scaffolded
34
+ * INDEX.md, so the first document into any domain was never registered
35
+ * (see https://github.com/TheGlitchKing/hit-em-with-the-docs/issues/7).
36
+ */
37
+ export declare function regenerateIndexes(options: RegenerateOptions): Promise<RegenerateResult>;
38
+ //# sourceMappingURL=regenerate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regenerate.d.ts","sourceRoot":"","sources":["file:///home/tmarlette/workspace/the-glitch-kingdom/hit-em-with-the-docs/src/generators/regenerate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAkBpE,MAAM,WAAW,iBAAiB;IAChC,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,0EAA0E;IAC1E,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,8DAA8D;IAC9D,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,EAAE,CAAC,CASnB;AAkED;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,gBAAgB,CAAC,CAiE3B"}
@@ -16,6 +16,7 @@ export * from './utils/markdown.js';
16
16
  export * from './generators/scaffold.js';
17
17
  export * from './generators/index-generator.js';
18
18
  export * from './generators/registry-generator.js';
19
+ export * from './generators/regenerate.js';
19
20
  export * from './core/metadata/sync.js';
20
21
  export * from './core/links/checker.js';
21
22
  export * from './core/links/tracker.js';
@@ -1 +1 @@
1
- {"version":3,"file":"","sourceRoot":"","sources":["file:///home/tmarlette/workspace/the-glitch-kingdom/hit-em-with-the-docs/src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAG7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAG7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AAGnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAGhD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAGhD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AAGzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"","sourceRoot":"","sources":["file:///home/tmarlette/workspace/the-glitch-kingdom/hit-em-with-the-docs/src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAG7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAG7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAG3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAGhD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAGhD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AAGzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}