@theglitchking/hit-em-with-the-docs 2.7.0 → 2.8.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 (43) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +40 -1
  4. package/dist/action/core/enforce/guard.d.ts +54 -0
  5. package/dist/action/core/enforce/guard.d.ts.map +1 -0
  6. package/dist/action/generators/regenerate.d.ts +14 -3
  7. package/dist/action/generators/regenerate.d.ts.map +1 -1
  8. package/dist/action/index.d.ts +1 -0
  9. package/dist/action/index.d.ts.map +1 -1
  10. package/dist/action/index.js +1 -1
  11. package/dist/action/utils/config.d.ts +58 -11
  12. package/dist/action/utils/config.d.ts.map +1 -1
  13. package/dist/action/utils/glob.d.ts +15 -4
  14. package/dist/action/utils/glob.d.ts.map +1 -1
  15. package/dist/cli/index.js +45 -4
  16. package/dist/cli/index.js.map +1 -1
  17. package/dist/core/enforce/guard.d.ts +54 -0
  18. package/dist/core/enforce/guard.d.ts.map +1 -0
  19. package/dist/core/enforce/guard.js +201 -0
  20. package/dist/core/enforce/guard.js.map +1 -0
  21. package/dist/generators/regenerate.d.ts +14 -3
  22. package/dist/generators/regenerate.d.ts.map +1 -1
  23. package/dist/generators/regenerate.js +99 -16
  24. package/dist/generators/regenerate.js.map +1 -1
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +2 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/utils/config.d.ts +47 -0
  30. package/dist/utils/config.d.ts.map +1 -1
  31. package/dist/utils/config.js +13 -0
  32. package/dist/utils/config.js.map +1 -1
  33. package/dist/utils/glob.d.ts +15 -4
  34. package/dist/utils/glob.d.ts.map +1 -1
  35. package/dist/utils/glob.js +16 -4
  36. package/dist/utils/glob.js.map +1 -1
  37. package/hooks/hooks.json +16 -1
  38. package/hooks/pre-tool-use.js +98 -0
  39. package/hooks/session-brief.js +51 -0
  40. package/package.json +2 -1
  41. package/scripts/link-skills.js +5 -4
  42. package/skills/documentation-lifecycle/SKILL.md +130 -0
  43. package/templates/claude/CLAUDE.md +0 -208
@@ -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.7.0"
9
+ "version": "2.8.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.7.0",
15
+ "version": "2.8.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.7.0",
4
+ "version": "2.8.0",
5
5
  "author": {
6
6
  "name": "TheGlitchKing",
7
7
  "email": "theglitchking@users.noreply.github.com"
package/README.md CHANGED
@@ -874,6 +874,43 @@ src/
874
874
  └── logger.ts # Logging and output formatting
875
875
  ```
876
876
 
877
+ ### Lifecycle enforcement (2.8.0+)
878
+
879
+ hewtd's policy is now **binding on an agent**, not merely documented. A
880
+ `PreToolUse` hook — run by the harness, not the model — **denies** the two
881
+ destructive violations: hand-editing a generated `INDEX.md`/`REGISTRY.md` (it is
882
+ rebuilt from disk; edits are discarded) and `rm`-ing a doc under
883
+ `.documentation/` (use `hewtd archive` — reversible and link-safe). It **warns**,
884
+ without blocking, on `status: deprecated` without archiving and on starting a
885
+ rival `docs/` folder.
886
+
887
+ It **fails open**: no `.documentation/` tree, or any internal error, and it allows
888
+ everything silently. Both rules are opt-out via an `enforcement` block in
889
+ `.claude/hit-em-with-the-docs.json`. A `SessionStart` brief and a model-invocable
890
+ skill round it out — no `CLAUDE.md` is written or modified.
891
+
892
+ **Full reference: [docs/enforcement.md](docs/enforcement.md).**
893
+
894
+ ### Indexing: what counts as a document
895
+
896
+ `INDEX.md` and `REGISTRY.md` are **generated** — `index`, `maintain`, and
897
+ `integrate` rebuild them from disk, so a row you add by hand is overwritten on
898
+ the next run.
899
+
900
+ Domain folders are walked **recursively**, so a document at any depth inside a
901
+ domain is indexed (`standards/backend/foo.md` appears in `standards/INDEX.md` as
902
+ `backend/foo.md`). Never indexed: the generated `INDEX.md`/`REGISTRY.md`
903
+ themselves; anything under `archive/`, `drafts/`, `reports/`, `_templates/`,
904
+ `node_modules/`, or a nested `.documentation/`; and the vault's `facts/`,
905
+ `incidents/`, and `symptoms/` subtrees, which have their own generators.
906
+
907
+ Recursive indexing landed in **2.7.1**. Before that the walk was flat and every
908
+ document in a subfolder was invisible to the whole system — so the first
909
+ `index`/`maintain` run after upgrading will add a row for each one.
910
+
911
+ **Full contract, and the troubleshooting ladder for "my doc isn't in the index":
912
+ [docs/indexing.md](docs/indexing.md).**
913
+
877
914
  ### File Structure
878
915
 
879
916
  When you run `hewtd init`, it creates this structure:
@@ -887,7 +924,9 @@ When you run `hewtd init`, it creates this structure:
887
924
  ├── security/ # Security documentation (priority: 9)
888
925
  │ ├── INDEX.md # Security domain table of contents
889
926
  │ ├── REGISTRY.md # Quick reference for security docs
890
- └── *.md # Individual security documents
927
+ ├── *.md # Individual security documents
928
+ │ └── auth/ # Subfolders are indexed too (2.7.1+)
929
+ │ └── *.md # → listed as auth/<name>.md
891
930
 
892
931
  ├── api/ # API documentation (priority: 8)
893
932
  │ ├── INDEX.md
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Lifecycle enforcement — the decision function behind the PreToolUse hook.
3
+ *
4
+ * hewtd's lifecycle policy has always been enforced at the CLI boundary (the
5
+ * archive link guard, `auto: false`, the frontmatter schema). None of that
6
+ * binds an *agent*, which will happily `rm` a doc, hand-edit a generated
7
+ * INDEX.md, or invent its own `docs/` folder. This is the part the model
8
+ * cannot reason its way past: the harness runs it, and a `deny` is final.
9
+ *
10
+ * Two rules deny, because they destroy work or corrupt a generated artifact.
11
+ * Everything else at most warns. Anything unrecognized is allowed — this runs
12
+ * in every session the plugin is installed in, including repos that have
13
+ * nothing to do with hewtd, so the cost of a false positive is far higher
14
+ * than the cost of a miss.
15
+ */
16
+ export type GuardDecision = {
17
+ action: 'allow';
18
+ } | {
19
+ action: 'warn';
20
+ context: string;
21
+ } | {
22
+ action: 'deny';
23
+ reason: string;
24
+ };
25
+ export interface GuardInput {
26
+ toolName: string;
27
+ /** `file_path` for Write/Edit. */
28
+ filePath?: string;
29
+ /** `command` for Bash. */
30
+ command?: string;
31
+ /** `content` (Write) or `new_string` (Edit) — used to spot lifecycle changes. */
32
+ text?: string;
33
+ /** Docs root relative to the project, e.g. `.documentation`. */
34
+ docsDir: string;
35
+ }
36
+ /** Which enforcement rules are active. Both default on; users can opt out. */
37
+ export interface EnforcementPolicy {
38
+ blockIndexEdits: boolean;
39
+ blockDocDeletion: boolean;
40
+ }
41
+ export declare const DEFAULT_ENFORCEMENT: EnforcementPolicy;
42
+ /**
43
+ * Is this path inside an `archive/` folder, at any depth?
44
+ *
45
+ * Archived docs are **referenceable but never concrete** — history you may cite,
46
+ * never evidence of what is true now. Nothing under an `archive/` folder is
47
+ * indexed, audited, link-checked, or validated.
48
+ */
49
+ export declare function isArchived(path: string): boolean;
50
+ /**
51
+ * Decide what to do about one tool call. Pure — all I/O lives in the hook.
52
+ */
53
+ export declare function evaluate(input: GuardInput, policy?: EnforcementPolicy): GuardDecision;
54
+ //# sourceMappingURL=guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["file:///home/tmarlette/workspace/the-glitch-kingdom/hit-em-with-the-docs/src/core/enforce/guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,MAAM,MAAM,aAAa,GACrB;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GACnB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvC,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,8EAA8E;AAC9E,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,mBAAmB,EAAE,iBAGjC,CAAC;AAOF;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIhD;AA4BD;;GAEG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,UAAU,EACjB,MAAM,GAAE,iBAAuC,GAC9C,aAAa,CA4Gf"}
@@ -9,6 +9,12 @@ export interface RegenerateOptions {
9
9
  */
10
10
  domains?: Domain[];
11
11
  silent?: boolean;
12
+ /**
13
+ * Compute everything, write nothing. `filesWritten` then lists the files
14
+ * that WOULD be written. Exists so users can preview the (large, one-time)
15
+ * diff the 2.7.1 recursive walk produces before committing to it.
16
+ */
17
+ dryRun?: boolean;
12
18
  }
13
19
  export interface RegenerateResult {
14
20
  /** Per-domain document counts — all domains, regardless of the filter. */
@@ -19,9 +25,14 @@ export interface RegenerateResult {
19
25
  totalDocuments: number;
20
26
  }
21
27
  /**
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.
28
+ * List the document files in a domain directory, walking subfolders. Returns
29
+ * sorted, domain-relative POSIX paths (`backend/entity-schema-contract.md`).
30
+ * Empty when the domain directory does not exist.
31
+ *
32
+ * This is the shared spine for three consumers — the index generator, the
33
+ * `index-drift` audit rule, and the `domain remove` orphan count — so what it
34
+ * excludes, the whole system excludes: the generated INDEX/REGISTRY at any
35
+ * depth, `EXCLUDED_DIRS`, and the vault's generator-owned subtrees (issue #12).
25
36
  */
26
37
  export declare function listDomainDocFiles(docsPath: string, domain: string): Promise<string[]>;
27
38
  /**
@@ -1 +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,EAAE,KAAK,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAmB3D,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,CAkE3B"}
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,EAAE,KAAK,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAiE3D,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;IACjB;;;;OAIG;IACH,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;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,EAAE,CAAC,CAmBnB;AAwFD;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,gBAAgB,CAAC,CAuE3B"}
@@ -34,6 +34,7 @@ export * from './reports/link-report.js';
34
34
  export * from './core/archive/manage.js';
35
35
  export * from './core/archive/candidates.js';
36
36
  export * from './core/archive/links.js';
37
+ export * from './core/enforce/guard.js';
37
38
  export * from './core/metadata/errors.js';
38
39
  export * from './core/knowledge-base/citers.js';
39
40
  export * from './generators/facts-index.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,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAG7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAG7C,cAAc,mBAAmB,CAA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