@zgeoff/skill-gate 0.2.5 → 0.2.7

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 (3) hide show
  1. package/README.md +12 -99
  2. package/dist/index.js +83 -34
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -23,16 +23,9 @@ The hook runs a file in the repo that calls the package's `runSkillGate`, at
23
23
  file from zgeoff/tools. `runSkillGate` reads the hook payload from stdin, prints the hook output,
24
24
  and exits the process.
25
25
 
26
- The entry point fails closed. When the package cannot load, the entry point blocks each edit that a
27
- gate in the rules file matches, and its error names the load failure. It also blocks every edit
28
- inside the project when it cannot read the rules file or the file does not parse. It blocks a call
29
- to a tool that a tool gate names, and every call other than an edit or a Bash command when it cannot
30
- read the rules file or the file or its `tools` list does not parse. Any other call runs, and the
31
- hook reports the load failure as a non-blocking error.
32
-
33
26
  Register the entry point in `.claude/settings.json`, before a Bash command and after it. The
34
- `PreToolUse` matcher names each tool that a [tool gate](#tool-gates) names, since the hook never
35
- sees a call that the matcher skips. This example gates `mcp__tracker__update_ticket`:
27
+ `PreToolUse` matcher names each tool that a tool gate names, since the hook never sees a call that
28
+ the matcher skips. This example gates `mcp__tracker__update_ticket`:
36
29
 
37
30
  ```json
38
31
  {
@@ -76,102 +69,22 @@ sees a call that the matcher skips. This example gates `mcp__tracker__update_tic
76
69
 
77
70
  ## Rules
78
71
 
79
- `.claude/skill-gate.json` maps path globs to the skills each path needs. `match` is a glob over the
80
- path from the repo root, and it matches files in dot folders such as `.claude/`. A path that holds
81
- an `ignore` segment is never gated. The entry point matches with `Bun.Glob` when the package cannot
82
- load, and `Bun.Glob` misses deep paths for a `**` inside a brace group, such as `{e2e/**,test/**}`,
83
- so write one gate per pattern.
72
+ `.claude/skill-gate.json` maps path globs to the skills each path needs, and the optional `tools`
73
+ list gates a tool call by name.
84
74
 
85
75
  ```json
86
76
  {
87
77
  "ignore": ["node_modules/", "dist/"],
88
- "gates": [
89
- { "match": "**/*.test.ts", "skills": ["testing", "project-testing"] },
90
- { "match": "**/*.md", "skills": ["docs-writing"] }
91
- ]
78
+ "gates": [{ "match": "**/*.md", "skills": ["docs-writing"] }],
79
+ "tools": [{ "tool": "mcp__tracker__update_ticket", "skills": ["ticket-review"] }]
92
80
  }
93
81
  ```
94
82
 
95
- The gate skips a skill that a rule names but `.claude/skills/` lacks, and it still requires the
96
- rule's other skills. A rules file that does not parse denies no edit and no tool call. In both cases
97
- the hook warns the user and the agent on every edit, and on every call to a tool that the hook
98
- matcher names, until the rules file is fixed.
99
-
100
- The gate skips a key it does not know, at the top level or inside a gate, and keeps the rest of the
101
- rules. It warns on every edit and every gated tool call, and the key itself denies nothing. A rules
102
- file written for a later version of the package therefore never blocks every call.
103
-
104
- ### Tool gates
105
-
106
- The optional `tools` list gates a tool call by its `PreToolUse` tool name. Each gate names the
107
- `tool`, the `skills` the session loads, and the `references` it reads, and it needs at least one
108
- skill or reference. A reference is a file path under `.claude/skills/`. A tool gate never names
109
- `Edit`, `Write`, `MultiEdit` or `Bash`, since path gates cover those tools.
110
-
111
- ```json
112
- {
113
- "gates": [],
114
- "tools": [
115
- {
116
- "tool": "mcp__tracker__update_ticket",
117
- "skills": ["ticket-review"],
118
- "references": ["ticket-review/references/reasons.md"]
119
- }
120
- ]
121
- }
122
- ```
123
-
124
- The denial names each missing skill and each reference to read. The gate skips a skill or a
125
- reference that the repo lacks, and warns on each gated call until the rule is fixed.
126
-
127
- ## Which loads count
128
-
129
- The gate counts the loads of the session that makes the edit or the tool call. A skill loads through
130
- a Skill tool call or a slash command. A reference counts once a Read tool call of its file succeeds;
131
- a Bash `cat` of the file does not count. A subagent's tool call carries `agent_id` beside the main
132
- session's `transcript_path`, and the gate reads that subagent's own transcript,
133
- `<session>/subagents/agent-<agent_id>.jsonl` beside the main one. A subagent therefore loads the
134
- skills itself, and the main session's loads never count for it. A compaction writes a
135
- `compact_boundary` entry, and the loads and reads before it no longer count: after a compaction, the
136
- gate denies a gated edit or tool call until the session loads the skills and reads the references
137
- again, and its denial says so.
138
-
139
- ## Bash commands
140
-
141
- The gate checks what a Bash command changed, not what the command says. Before the command, it
142
- records `HEAD` and the content of each gated file that `git status` lists as changed, staged or
143
- untracked. After the command, it reads `git status` again, plus the files that differ between the
144
- old and the new `HEAD`. A gated file that the command created, changed, deleted, renamed or
145
- committed counts as a change. A file that keeps its content does not: one dirty before and left
146
- alone, or one whose mode alone changed, compared with its content at the old `HEAD`. A command that
147
- moves `HEAD` another way, such as a pull or a checkout, counts each gated file it brought in. When
148
- the session that ran the command lacks a skill that a changed file needs, the hook blocks: the agent
149
- gets a reason that names the skills to load and asks it to review what the command changed. The same
150
- load check as an edit applies, with its compaction and subagent rules.
151
-
152
- Claude Code runs a `PostToolUse` hook after the command, so a block cannot undo the change. It stops
153
- the agent's next step and puts the reason beside the command's output, as the
154
- [hooks reference](https://code.claude.com/docs/en/hooks#posttooluse-decision-control) describes. A
155
- command that exits with an error fires `PostToolUseFailure`, which cannot block, so the hook adds
156
- the same reason as context.
157
-
158
- Before the command runs, the gate also reads the common forms of a shell write, such as a redirect,
159
- `tee`, `sed -i`, `cp`, `mv` or an inline script. When one targets a gated path, it warns and names
160
- the skills to load. The warning is an early notice only, and the check after the command is the one
161
- that blocks.
162
-
163
- The check has limits:
83
+ [Writing skill-gate rules](../../docs/guides/skill-gate-rules.md) covers each key, the glob shapes
84
+ to avoid, and how the gate treats a mistake in the rules file.
164
85
 
165
- - It needs a git work tree. Outside one, the gate gives only the early warning. When git fails
166
- inside one, such as on an index it cannot read, the hook warns the user and the agent that the
167
- command went unchecked.
168
- - A command that runs in the background returns before it writes, so the check sees no change.
169
- - A file that a git filter rewrites on checkout, such as a Git LFS file, never matches its content
170
- at `HEAD`, so a mode change to one counts as a change.
171
- - Bash commands that run in parallel share one work tree, so each one's check also sees the other's
172
- changes.
173
- - A command whose `PreToolUse` call left no record, such as one that started before the hook was
174
- installed, goes unchecked.
86
+ ## Documentation
175
87
 
176
- Change a gated path only with Edit, Write or MultiEdit; the denial, the warning and the block all
177
- say so.
88
+ [The skill gate architecture](../../docs/architecture/skill-gate.md) describes how the entry point
89
+ fails closed, which skill loads and reference reads the gate counts, and how it checks what a Bash
90
+ command changed.
package/dist/index.js CHANGED
@@ -5764,7 +5764,7 @@ function F3(t) {
5764
5764
  throw new I3(t);
5765
5765
  }
5766
5766
 
5767
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/util.js
5767
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/core/util.js
5768
5768
  function getEnumValues(entries) {
5769
5769
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
5770
5770
  const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
@@ -6102,6 +6102,18 @@ function prefixIssues(path, issues) {
6102
6102
  function unwrapMessage(message) {
6103
6103
  return typeof message === "string" ? message : message?.message;
6104
6104
  }
6105
+ function sizeCaps(defChecks) {
6106
+ const caps = [];
6107
+ for (const ch of defChecks ?? []) {
6108
+ const d = ch._zod.def;
6109
+ if (!/_(length|size)$|_equals$/.test(d.check))
6110
+ break;
6111
+ const max = d.maximum ?? d.length ?? d.size;
6112
+ if (max >= 0)
6113
+ caps.push([max, ch]);
6114
+ }
6115
+ return caps;
6116
+ }
6105
6117
  function attachSchema(issues, start, inst) {
6106
6118
  var _a;
6107
6119
  for (let i = start;i < issues.length; i++) {
@@ -6299,7 +6311,7 @@ function constantCatch(value) {
6299
6311
  return fn;
6300
6312
  }
6301
6313
 
6302
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/core.js
6314
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/core/core.js
6303
6315
  var _a;
6304
6316
  var _zodDesc = { value: undefined, enumerable: false };
6305
6317
  var _E = "captureStackTrace" in Error ? Error : null;
@@ -6417,7 +6429,7 @@ function config(newConfig) {
6417
6429
  Object.assign(globalConfig, newConfig);
6418
6430
  return globalConfig;
6419
6431
  }
6420
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/errors.js
6432
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/core/errors.js
6421
6433
  function _getMessage() {
6422
6434
  const internals = this._zod;
6423
6435
  internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
@@ -6532,7 +6544,7 @@ function formatError(error, mapper = (issue) => issue.message) {
6532
6544
  return fieldErrors;
6533
6545
  }
6534
6546
 
6535
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/parse.js
6547
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/core/parse.js
6536
6548
  function finalizeParams(callee, params) {
6537
6549
  return { callee: params?.callee ?? callee, Err: params?.Err };
6538
6550
  }
@@ -6679,7 +6691,7 @@ var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
6679
6691
  var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
6680
6692
  return _safeParseAsync(_Err)(schema, value, _ctx);
6681
6693
  };
6682
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/regexes.js
6694
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/core/regexes.js
6683
6695
  var cuid = /^[cC][0-9a-z]{6,}$/;
6684
6696
  var cuid2 = /^[0-9a-z]+$/;
6685
6697
  var ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;
@@ -6736,7 +6748,7 @@ var number = /^-?\d+(?:\.\d+)?$/;
6736
6748
  var lowercase = /^[^A-Z]*$/;
6737
6749
  var uppercase = /^[^a-z]*$/;
6738
6750
 
6739
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/checks.js
6751
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/core/checks.js
6740
6752
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
6741
6753
  var _a;
6742
6754
  inst._zod ?? (inst._zod = {});
@@ -6922,7 +6934,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
6922
6934
  };
6923
6935
  });
6924
6936
 
6925
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/doc.js
6937
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/core/doc.js
6926
6938
  class Doc {
6927
6939
  constructor(args = [], closed = {}) {
6928
6940
  this.content = [];
@@ -6964,14 +6976,14 @@ ${content.join(`
6964
6976
  }
6965
6977
  }
6966
6978
 
6967
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/versions.js
6979
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/core/versions.js
6968
6980
  var version = {
6969
6981
  major: 4,
6970
6982
  minor: 6,
6971
- patch: 5
6983
+ patch: 6
6972
6984
  };
6973
6985
 
6974
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/schemas.js
6986
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/core/schemas.js
6975
6987
  var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
6976
6988
  var _a;
6977
6989
  inst ?? (inst = {});
@@ -7473,6 +7485,29 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
7473
7485
  return payload;
7474
7486
  };
7475
7487
  });
7488
+ function capSize(inst, size) {
7489
+ const caps = sizeCaps(inst._zod.def.checks);
7490
+ if (!caps.length)
7491
+ return;
7492
+ const cap = Math.min(...caps.map((c) => c[0]));
7493
+ const parse = inst._zod.parse;
7494
+ inst._zod.parse = (payload, ctx) => {
7495
+ const n = size(payload.value);
7496
+ if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
7497
+ for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
7498
+ if (n > max && ch._zod.def.when(payload)) {
7499
+ const start = payload.issues.length;
7500
+ ch._zod.check(payload);
7501
+ payload.issues[start].continue = false;
7502
+ attachSchema(payload.issues, start, inst);
7503
+ return payload;
7504
+ }
7505
+ }
7506
+ }
7507
+ return parse(payload, ctx);
7508
+ };
7509
+ }
7510
+ var arraySize = (input) => Array.isArray(input) ? input.length : -1;
7476
7511
  function handleArrayResult(result, final, index) {
7477
7512
  if (result.issues.length) {
7478
7513
  final.issues.push(...prefixIssues(index, result.issues));
@@ -7516,6 +7551,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
7516
7551
  }
7517
7552
  return payload;
7518
7553
  };
7554
+ capSize(inst, arraySize);
7519
7555
  });
7520
7556
  function handlePropertyResult(result, final, key, input, optin, optout) {
7521
7557
  const isPresent = key in input;
@@ -8536,7 +8572,7 @@ function handleRefineResult(result, payload, input, inst) {
8536
8572
  payload.issues.push(issue(_iss));
8537
8573
  }
8538
8574
  }
8539
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/memoizer.js
8575
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/core/memoizer.js
8540
8576
  class $ZodCyclicError extends Error {
8541
8577
  constructor() {
8542
8578
  super(`Cannot parse a reference cycle that closes through a transform`);
@@ -8805,7 +8841,7 @@ function isBackEdge(ctx, value) {
8805
8841
  const backEdges = ctx[STATE]?.backEdges;
8806
8842
  return backEdges !== undefined && isRef(value) && backEdges.has(value);
8807
8843
  }
8808
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/locales/en.js
8844
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/locales/en.js
8809
8845
  var error = () => {
8810
8846
  const Sizable = {
8811
8847
  string: { unit: "characters", verb: "to have" },
@@ -8927,7 +8963,7 @@ function en_default() {
8927
8963
  localeError: error()
8928
8964
  };
8929
8965
  }
8930
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/registries.js
8966
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/core/registries.js
8931
8967
  var _a2;
8932
8968
  class $ZodRegistry {
8933
8969
  constructor() {
@@ -8974,7 +9010,7 @@ function registry() {
8974
9010
  }
8975
9011
  (_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
8976
9012
  var globalRegistry = globalThis.__zod_globalRegistry;
8977
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/api.js
9013
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/core/api.js
8978
9014
  function snapshotChecks(def) {
8979
9015
  if (def.checks)
8980
9016
  def.checks = [...def.checks];
@@ -9365,7 +9401,7 @@ function _check(fn, params) {
9365
9401
  ch._zod.check = fn;
9366
9402
  return ch;
9367
9403
  }
9368
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/to-json-schema.js
9404
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/core/to-json-schema.js
9369
9405
  function assignProps(target, ...sources) {
9370
9406
  for (const source of sources) {
9371
9407
  for (const key of Reflect.ownKeys(source)) {
@@ -9888,7 +9924,7 @@ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) =
9888
9924
  extractDefs(ctx, schema);
9889
9925
  return finalize(ctx, schema);
9890
9926
  };
9891
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/json-schema-processors.js
9927
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/core/json-schema-processors.js
9892
9928
  var narrowMin = (agg, key, value) => {
9893
9929
  if (agg[key] === undefined || value > agg[key])
9894
9930
  agg[key] = value;
@@ -10368,7 +10404,7 @@ var optionalProcessor = (schema, ctx, _json, params) => {
10368
10404
  const seen = ctx.seen.get(schema);
10369
10405
  seen.ref = def.innerType;
10370
10406
  };
10371
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/errors.js
10407
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/classic/errors.js
10372
10408
  var _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
10373
10409
  function _lazyMethod(proto, key, make) {
10374
10410
  Object.defineProperty(proto, key, {
@@ -10413,7 +10449,7 @@ var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, undefi
10413
10449
  Parent: Error
10414
10450
  });
10415
10451
 
10416
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/parse.js
10452
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/classic/parse.js
10417
10453
  var parse2 = /* @__PURE__ */ _parse(ZodRealError);
10418
10454
  var parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
10419
10455
  var safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -10427,7 +10463,7 @@ var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
10427
10463
  var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
10428
10464
  var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
10429
10465
 
10430
- // ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/schemas.js
10466
+ // ../../node_modules/.bun/zod@4.6.6/node_modules/zod/v4/classic/schemas.js
10431
10467
  function _ensureDefaultLocale() {
10432
10468
  if (!globalConfig.localeError)
10433
10469
  config(en_default());
@@ -12350,7 +12386,7 @@ async function runSkillGate() {
12350
12386
  process.exit(0);
12351
12387
  }
12352
12388
  const availableSkills = await readAvailableSkills(path7.join(projectDir, ".claude", "skills"));
12353
- const transcript = await readTranscript(resolveSessionTranscriptPath(input));
12389
+ const transcript = await readSessionTranscript(input);
12354
12390
  const loaded = collectSessionLoads(transcript);
12355
12391
  const plan = planSkillGate({
12356
12392
  rules: parsed.rules,
@@ -12407,7 +12443,7 @@ async function checkToolCall(check) {
12407
12443
  return;
12408
12444
  }
12409
12445
  const skillsDir = path7.join(check.projectDir, ".claude", "skills");
12410
- const transcript = await readTranscript(resolveSessionTranscriptPath(check.hookInput));
12446
+ const transcript = await readSessionTranscript(check.hookInput);
12411
12447
  const loads = collectSessionLoads(transcript);
12412
12448
  const plan = planToolGate({
12413
12449
  tools: parsedRules.tools,
@@ -12428,23 +12464,36 @@ function printOutput(output) {
12428
12464
  console.log(JSON.stringify(output));
12429
12465
  }
12430
12466
  }
12431
- async function readTranscript(transcriptPath) {
12432
- if (transcriptPath === null) {
12467
+ async function readSessionTranscript(hookInput) {
12468
+ if (hookInput.agentID === undefined) {
12469
+ return readTranscript(hookInput.transcriptPath);
12470
+ }
12471
+ if (typeof hookInput.agentID !== "string" || !/^[\w-]+$/u.test(hookInput.agentID)) {
12433
12472
  return "";
12434
12473
  }
12474
+ const subagentsDir = path7.join(hookInput.transcriptPath.replace(/\.jsonl$/u, ""), "subagents");
12475
+ const transcriptName = `agent-${hookInput.agentID}.jsonl`;
12476
+ const agentTranscript = await readTranscript(path7.join(subagentsDir, transcriptName));
12477
+ if (agentTranscript !== "") {
12478
+ return agentTranscript;
12479
+ }
12480
+ return readWorkflowAgentTranscript(subagentsDir, transcriptName);
12481
+ }
12482
+ async function readTranscript(transcriptPath) {
12435
12483
  const transcriptFile = Bun.file(transcriptPath);
12436
12484
  const exists = await transcriptFile.exists();
12437
12485
  return exists ? transcriptFile.text() : "";
12438
12486
  }
12439
- function resolveSessionTranscriptPath(edit) {
12440
- if (edit.agentID === undefined) {
12441
- return edit.transcriptPath;
12442
- }
12443
- if (typeof edit.agentID !== "string" || !/^[\w-]+$/u.test(edit.agentID)) {
12444
- return null;
12445
- }
12446
- const sessionDir = edit.transcriptPath.replace(/\.jsonl$/u, "");
12447
- return path7.join(sessionDir, "subagents", `agent-${edit.agentID}.jsonl`);
12487
+ async function readWorkflowAgentTranscript(subagentsDir, transcriptName) {
12488
+ const scan = new Bun.Glob(`workflows/*/${transcriptName}`).scan({ cwd: subagentsDir });
12489
+ let transcriptPath = null;
12490
+ try {
12491
+ for await (const scannedPath of scan) {
12492
+ transcriptPath = scannedPath;
12493
+ break;
12494
+ }
12495
+ } catch {}
12496
+ return transcriptPath === null ? "" : readTranscript(path7.join(subagentsDir, transcriptPath));
12448
12497
  }
12449
12498
  async function readAvailableSkills(skillsDir) {
12450
12499
  const skills = [];
@@ -12528,7 +12577,7 @@ async function checkBashCommand(check, rules) {
12528
12577
  return;
12529
12578
  }
12530
12579
  const skills = await readAvailableSkills(path7.join(check.projectDir, ".claude", "skills"));
12531
- const sessionTranscript = await readTranscript(resolveSessionTranscriptPath(check.hookInput));
12580
+ const sessionTranscript = await readSessionTranscript(check.hookInput);
12532
12581
  const sessionLoads = collectSessionLoads(sessionTranscript);
12533
12582
  const bashPlan = planBashSkillGate({
12534
12583
  rules,
@@ -12583,7 +12632,7 @@ async function runBashResultStep(check, rules, result, step) {
12583
12632
  }
12584
12633
  async function checkChangedPaths(check, rules, result, changedPaths) {
12585
12634
  const skills = await readAvailableSkills(path7.join(check.projectDir, ".claude", "skills"));
12586
- const sessionTranscript = await readTranscript(resolveSessionTranscriptPath(check.hookInput));
12635
+ const sessionTranscript = await readSessionTranscript(check.hookInput);
12587
12636
  const sessionLoads = collectSessionLoads(sessionTranscript);
12588
12637
  const changePlan = planBashSkillGate({
12589
12638
  rules,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgeoff/skill-gate",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "A Claude Code hook that denies an edit or a gated tool call until the session loads the skills and reads the reference files it needs, and blocks after a Bash command that changed a gated file without them",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -42,7 +42,7 @@
42
42
  "ts-pattern": "5.9.0",
43
43
  "tsrs": "0.18.0-ts7.1.0-dev.20260929",
44
44
  "typescript": "7.0.2",
45
- "zod": "4.6.5"
45
+ "zod": "4.6.6"
46
46
  },
47
47
  "engines": {
48
48
  "bun": ">=1.3"