@theglitchking/hit-em-with-the-docs 2.7.1 → 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.
@@ -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.1"
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.1",
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.1",
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,23 @@ 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
+
877
894
  ### Indexing: what counts as a document
878
895
 
879
896
  `INDEX.md` and `REGISTRY.md` are **generated** — `index`, `maintain`, and
@@ -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"}
@@ -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,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,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AAGxC,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":"","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