@zgeoff/skill-gate 0.2.7 → 0.2.8

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.
@@ -0,0 +1,6 @@
1
+ import type { SessionLoads } from './types.ts';
2
+ export declare const EMPTY_LEDGER: SessionLoads;
3
+ export declare function readLoadLedger(ledgerPath: string | null): Promise<SessionLoads>;
4
+ export declare function writeLoadLedger(ledgerPath: string | null, ledger: SessionLoads): Promise<void>;
5
+ export declare function addLoads(ledger: SessionLoads, loads: Pick<SessionLoads, 'skills' | 'readPaths'>): SessionLoads;
6
+ export declare function voidLoads(): SessionLoads;
@@ -0,0 +1,3 @@
1
+ import type { Harness } from './harness.ts';
2
+ import type { HookInput, LifecycleInput } from './types.ts';
3
+ export declare function parseHookInput(harness: Harness, value: unknown): HookInput | LifecycleInput | null;
@@ -0,0 +1 @@
1
+ export declare function parsePatchPaths(patch: string): readonly string[];
@@ -1,2 +1,4 @@
1
1
  import type { ShellCommand } from './types.ts';
2
- export declare function parseShellCommands(text: string): readonly ShellCommand[] | null;
2
+ export declare function parseShellCommands(text: string, options?: {
3
+ readonly withGuards?: boolean;
4
+ }): readonly ShellCommand[] | null;
@@ -0,0 +1,3 @@
1
+ import type { Harness } from './harness.ts';
2
+ import type { HarnessWording } from './types.ts';
3
+ export declare function pickHarnessWording(harness: Harness | undefined): HarnessWording;
@@ -0,0 +1 @@
1
+ export declare function readAvailableSkills(skillsDir: string): Promise<readonly string[]>;
@@ -0,0 +1 @@
1
+ export declare function readProjectDir(cwd: string): Promise<string>;
@@ -0,0 +1,2 @@
1
+ import type { HookInput, SessionLoads } from './types.ts';
2
+ export declare function readSessionLoads(hookInput: HookInput): Promise<SessionLoads>;
@@ -0,0 +1,2 @@
1
+ import type { HookInput } from './types.ts';
2
+ export declare function readSessionTranscript(hookInput: HookInput): Promise<string>;
@@ -0,0 +1,3 @@
1
+ import type { HookInput, LifecycleInput } from './types.ts';
2
+ export declare function recordLifecycle(input: LifecycleInput, projectDir: string): Promise<void>;
3
+ export declare function recordCommandReads(input: HookInput, command: string, projectDir: string, rulesText: string): Promise<void>;
@@ -0,0 +1,3 @@
1
+ import type { SessionState } from './types.ts';
2
+ export declare function resolveStateDir(hookInput: SessionState): string | null;
3
+ export declare function resolveLedgerPath(hookInput: SessionState): string | null;
@@ -1 +1,2 @@
1
- export declare function runSkillGate(): Promise<never>;
1
+ import type { Harness } from './harness.ts';
2
+ export declare function runSkillGate(harness?: Harness): Promise<never>;
package/dist/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { z } from 'zod';
2
2
  import type { bashSnapshotSchema } from './bash-snapshot-schema.ts';
3
+ import type { Harness } from './harness.ts';
3
4
  export interface SkillGate {
4
5
  readonly match: string;
5
6
  readonly skills: readonly string[];
@@ -69,12 +70,18 @@ export interface ShellCommand {
69
70
  readonly stdin: string | null;
70
71
  readonly enters: number;
71
72
  readonly leaves: number;
73
+ readonly guard?: ShellGuard | null;
74
+ }
75
+ export interface ShellGuard {
76
+ readonly viaOr: boolean;
77
+ readonly before: readonly (readonly ShellWord[])[];
72
78
  }
73
79
  export interface WrittenPath {
74
80
  readonly path: string;
75
81
  readonly fileName?: string;
76
82
  }
77
83
  export interface SkillGateOutputContext {
84
+ readonly harness?: Harness;
78
85
  readonly compacted?: boolean;
79
86
  readonly rulesError?: string;
80
87
  readonly unknownKeys?: readonly string[];
@@ -166,3 +173,37 @@ export type RecordStep = Exclude<BashResultStep, {
166
173
  readonly kind: 'compare';
167
174
  readonly recorded: RecordedSnapshot;
168
175
  };
176
+ export interface HarnessWording {
177
+ readonly loadSkill: string;
178
+ readonly readFile: string;
179
+ readonly editTools: string;
180
+ }
181
+ export interface HookInput {
182
+ readonly kind: 'tool';
183
+ readonly harness: Harness;
184
+ readonly event: HookEvent;
185
+ readonly toolName: string | null;
186
+ readonly cwd: string;
187
+ readonly editPaths: readonly string[];
188
+ readonly command: string | null;
189
+ readonly transcriptPath: string | null;
190
+ readonly sessionID: string | null;
191
+ readonly toolUseID: unknown;
192
+ readonly agentID: unknown;
193
+ }
194
+ export interface LifecycleInput {
195
+ readonly kind: 'lifecycle';
196
+ readonly event: 'UserPromptSubmit' | 'PostCompact';
197
+ readonly cwd: string;
198
+ readonly transcriptPath: string | null;
199
+ readonly sessionID: string | null;
200
+ readonly prompt: string | null;
201
+ }
202
+ export interface SessionState {
203
+ readonly transcriptPath: string | null;
204
+ readonly sessionID: string | null;
205
+ }
206
+ export interface EditEntry {
207
+ readonly filePath: string;
208
+ readonly plan: SkillGatePlan;
209
+ }
@@ -0,0 +1 @@
1
+ export declare function withLedgerLock<Result>(ledgerPath: string | null, job: () => Promise<Result>): Promise<Result>;
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@zgeoff/skill-gate",
3
- "version": "0.2.7",
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",
3
+ "version": "0.2.8",
4
+ "description": "A Claude Code and Codex CLI 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",
7
+ "codex",
7
8
  "hook",
8
9
  "skills"
9
10
  ],