@guilz-dev/belay 0.1.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 (266) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +268 -0
  3. package/agent-belay-logo.png +0 -0
  4. package/dist/adapters/claude/adapter.d.ts +7 -0
  5. package/dist/adapters/claude/adapter.js +114 -0
  6. package/dist/adapters/claude/hooks.d.ts +13 -0
  7. package/dist/adapters/claude/hooks.js +49 -0
  8. package/dist/adapters/claude/runtime-entry.d.ts +4 -0
  9. package/dist/adapters/claude/runtime-entry.js +260 -0
  10. package/dist/adapters/codex/adapter.d.ts +7 -0
  11. package/dist/adapters/codex/adapter.js +73 -0
  12. package/dist/adapters/codex/hooks.d.ts +21 -0
  13. package/dist/adapters/codex/hooks.js +78 -0
  14. package/dist/adapters/codex/runtime-entry.d.ts +4 -0
  15. package/dist/adapters/codex/runtime-entry.js +237 -0
  16. package/dist/adapters/cursor/adapter.d.ts +7 -0
  17. package/dist/adapters/cursor/adapter.js +29 -0
  18. package/dist/adapters/cursor/hooks.d.ts +2 -0
  19. package/dist/adapters/cursor/hooks.js +26 -0
  20. package/dist/adapters/cursor/runtime-entry.d.ts +4 -0
  21. package/dist/adapters/cursor/runtime-entry.js +143 -0
  22. package/dist/adapters/layouts/claude.d.ts +2 -0
  23. package/dist/adapters/layouts/claude.js +40 -0
  24. package/dist/adapters/layouts/codex.d.ts +2 -0
  25. package/dist/adapters/layouts/codex.js +43 -0
  26. package/dist/adapters/layouts/cursor.d.ts +2 -0
  27. package/dist/adapters/layouts/cursor.js +40 -0
  28. package/dist/adapters/layouts/index.d.ts +7 -0
  29. package/dist/adapters/layouts/index.js +23 -0
  30. package/dist/adapters/layouts/protected-paths.d.ts +3 -0
  31. package/dist/adapters/layouts/protected-paths.js +15 -0
  32. package/dist/adapters/layouts/scope.d.ts +19 -0
  33. package/dist/adapters/layouts/scope.js +86 -0
  34. package/dist/adapters/layouts/types.d.ts +14 -0
  35. package/dist/adapters/layouts/types.js +1 -0
  36. package/dist/adapters/registry.d.ts +4 -0
  37. package/dist/adapters/registry.js +14 -0
  38. package/dist/adapters/shared/gate-runtime.d.ts +51 -0
  39. package/dist/adapters/shared/gate-runtime.js +518 -0
  40. package/dist/adapters/shared/repo-root.d.ts +2 -0
  41. package/dist/adapters/shared/repo-root.js +17 -0
  42. package/dist/adapters/types.d.ts +19 -0
  43. package/dist/adapters/types.js +1 -0
  44. package/dist/branding.d.ts +3 -0
  45. package/dist/branding.js +3 -0
  46. package/dist/bundle/claude-runtime.mjs +5323 -0
  47. package/dist/bundle/codex-runtime.mjs +5310 -0
  48. package/dist/bundle/cursor-runtime.mjs +5208 -0
  49. package/dist/cleanup-orphans.d.ts +7 -0
  50. package/dist/cleanup-orphans.js +59 -0
  51. package/dist/cli.d.ts +2 -0
  52. package/dist/cli.js +631 -0
  53. package/dist/commands/approve.d.ts +14 -0
  54. package/dist/commands/approve.js +65 -0
  55. package/dist/commands/audit.d.ts +59 -0
  56. package/dist/commands/audit.js +132 -0
  57. package/dist/commands/classify-for-report.d.ts +9 -0
  58. package/dist/commands/classify-for-report.js +85 -0
  59. package/dist/commands/doctor.d.ts +3 -0
  60. package/dist/commands/doctor.js +366 -0
  61. package/dist/commands/dogfood.d.ts +5 -0
  62. package/dist/commands/dogfood.js +71 -0
  63. package/dist/commands/explain.d.ts +3 -0
  64. package/dist/commands/explain.js +133 -0
  65. package/dist/commands/health-snapshot.d.ts +2 -0
  66. package/dist/commands/health-snapshot.js +166 -0
  67. package/dist/commands/init-wizard.d.ts +16 -0
  68. package/dist/commands/init-wizard.js +50 -0
  69. package/dist/commands/metrics.d.ts +7 -0
  70. package/dist/commands/metrics.js +89 -0
  71. package/dist/commands/recover.d.ts +3 -0
  72. package/dist/commands/recover.js +105 -0
  73. package/dist/commands/report.d.ts +3 -0
  74. package/dist/commands/report.js +65 -0
  75. package/dist/commands/revoke.d.ts +5 -0
  76. package/dist/commands/revoke.js +22 -0
  77. package/dist/commands/simulate.d.ts +14 -0
  78. package/dist/commands/simulate.js +55 -0
  79. package/dist/commands/status.d.ts +5 -0
  80. package/dist/commands/status.js +107 -0
  81. package/dist/config-io.d.ts +23 -0
  82. package/dist/config-io.js +180 -0
  83. package/dist/conformance/guarantee-table.d.ts +14 -0
  84. package/dist/conformance/guarantee-table.js +95 -0
  85. package/dist/conformance/types.d.ts +6 -0
  86. package/dist/conformance/types.js +1 -0
  87. package/dist/core/approval-service.d.ts +26 -0
  88. package/dist/core/approval-service.js +41 -0
  89. package/dist/core/approval-token.d.ts +11 -0
  90. package/dist/core/approval-token.js +61 -0
  91. package/dist/core/approval.d.ts +19 -0
  92. package/dist/core/approval.js +58 -0
  93. package/dist/core/audit-analysis.d.ts +10 -0
  94. package/dist/core/audit-analysis.js +147 -0
  95. package/dist/core/audit-metrics.d.ts +51 -0
  96. package/dist/core/audit-metrics.js +155 -0
  97. package/dist/core/audit-query.d.ts +11 -0
  98. package/dist/core/audit-query.js +142 -0
  99. package/dist/core/audit-summary.d.ts +33 -0
  100. package/dist/core/audit-summary.js +111 -0
  101. package/dist/core/audit-types.d.ts +65 -0
  102. package/dist/core/audit-types.js +2 -0
  103. package/dist/core/capability/allowlist.d.ts +10 -0
  104. package/dist/core/capability/allowlist.js +53 -0
  105. package/dist/core/capability/broker.d.ts +17 -0
  106. package/dist/core/capability/broker.js +29 -0
  107. package/dist/core/capability/index.d.ts +5 -0
  108. package/dist/core/capability/index.js +4 -0
  109. package/dist/core/capability/paths.d.ts +1 -0
  110. package/dist/core/capability/paths.js +20 -0
  111. package/dist/core/capability/reasons.d.ts +2 -0
  112. package/dist/core/capability/reasons.js +4 -0
  113. package/dist/core/capability/types.d.ts +10 -0
  114. package/dist/core/capability/types.js +1 -0
  115. package/dist/core/capability-approval.d.ts +28 -0
  116. package/dist/core/capability-approval.js +43 -0
  117. package/dist/core/classify-subagent.d.ts +2 -0
  118. package/dist/core/classify-subagent.js +69 -0
  119. package/dist/core/classify-tool.d.ts +3 -0
  120. package/dist/core/classify-tool.js +311 -0
  121. package/dist/core/config-layers.d.ts +23 -0
  122. package/dist/core/config-layers.js +59 -0
  123. package/dist/core/config.d.ts +219 -0
  124. package/dist/core/config.js +720 -0
  125. package/dist/core/control-plane-isolation.d.ts +10 -0
  126. package/dist/core/control-plane-isolation.js +83 -0
  127. package/dist/core/custom-command-match.d.ts +2 -0
  128. package/dist/core/custom-command-match.js +8 -0
  129. package/dist/core/egress/allowlist.d.ts +7 -0
  130. package/dist/core/egress/allowlist.js +33 -0
  131. package/dist/core/egress/env.d.ts +3 -0
  132. package/dist/core/egress/env.js +17 -0
  133. package/dist/core/egress/fingerprint.d.ts +3 -0
  134. package/dist/core/egress/fingerprint.js +35 -0
  135. package/dist/core/egress/policy.d.ts +8 -0
  136. package/dist/core/egress/policy.js +47 -0
  137. package/dist/core/egress/proxy-server.d.ts +21 -0
  138. package/dist/core/egress/proxy-server.js +263 -0
  139. package/dist/core/egress/types.d.ts +25 -0
  140. package/dist/core/egress/types.js +1 -0
  141. package/dist/core/egress-approval.d.ts +48 -0
  142. package/dist/core/egress-approval.js +129 -0
  143. package/dist/core/fingerprint.d.ts +6 -0
  144. package/dist/core/fingerprint.js +24 -0
  145. package/dist/core/gate-contract.d.ts +48 -0
  146. package/dist/core/gate-contract.js +50 -0
  147. package/dist/core/gate-engine.d.ts +20 -0
  148. package/dist/core/gate-engine.js +172 -0
  149. package/dist/core/glob.d.ts +1 -0
  150. package/dist/core/glob.js +39 -0
  151. package/dist/core/index.d.ts +19 -0
  152. package/dist/core/index.js +15 -0
  153. package/dist/core/integrity.d.ts +15 -0
  154. package/dist/core/integrity.js +68 -0
  155. package/dist/core/judge-api-key.d.ts +4 -0
  156. package/dist/core/judge-api-key.js +11 -0
  157. package/dist/core/judge-config.d.ts +29 -0
  158. package/dist/core/judge-config.js +85 -0
  159. package/dist/core/judge-doctor.d.ts +7 -0
  160. package/dist/core/judge-doctor.js +124 -0
  161. package/dist/core/judgment.d.ts +6 -0
  162. package/dist/core/judgment.js +38 -0
  163. package/dist/core/notify.d.ts +13 -0
  164. package/dist/core/notify.js +44 -0
  165. package/dist/core/path-utils.d.ts +12 -0
  166. package/dist/core/path-utils.js +107 -0
  167. package/dist/core/reclassify.d.ts +15 -0
  168. package/dist/core/reclassify.js +82 -0
  169. package/dist/core/recover-advice.d.ts +30 -0
  170. package/dist/core/recover-advice.js +177 -0
  171. package/dist/core/recover-git-probe.d.ts +8 -0
  172. package/dist/core/recover-git-probe.js +50 -0
  173. package/dist/core/recover-select.d.ts +10 -0
  174. package/dist/core/recover-select.js +60 -0
  175. package/dist/core/scrub.d.ts +3 -0
  176. package/dist/core/scrub.js +87 -0
  177. package/dist/core/shell-substitution.d.ts +6 -0
  178. package/dist/core/shell-substitution.js +130 -0
  179. package/dist/core/shell-tokenizer.d.ts +5 -0
  180. package/dist/core/shell-tokenizer.js +129 -0
  181. package/dist/core/shell-unparseable.d.ts +4 -0
  182. package/dist/core/shell-unparseable.js +96 -0
  183. package/dist/core/transactional/diff-evaluator.d.ts +2 -0
  184. package/dist/core/transactional/diff-evaluator.js +84 -0
  185. package/dist/core/transactional/eligibility.d.ts +4 -0
  186. package/dist/core/transactional/eligibility.js +44 -0
  187. package/dist/core/transactional/git-worktree.d.ts +13 -0
  188. package/dist/core/transactional/git-worktree.js +189 -0
  189. package/dist/core/transactional/index.d.ts +5 -0
  190. package/dist/core/transactional/index.js +4 -0
  191. package/dist/core/transactional/reasons.d.ts +4 -0
  192. package/dist/core/transactional/reasons.js +8 -0
  193. package/dist/core/transactional/runner.d.ts +2 -0
  194. package/dist/core/transactional/runner.js +113 -0
  195. package/dist/core/transactional/types.d.ts +46 -0
  196. package/dist/core/transactional/types.js +1 -0
  197. package/dist/core/types.d.ts +90 -0
  198. package/dist/core/types.js +1 -0
  199. package/dist/core/v2/adapter.d.ts +14 -0
  200. package/dist/core/v2/adapter.js +118 -0
  201. package/dist/core/v2/containment.d.ts +19 -0
  202. package/dist/core/v2/containment.js +91 -0
  203. package/dist/core/v2/egress-classify.d.ts +7 -0
  204. package/dist/core/v2/egress-classify.js +216 -0
  205. package/dist/core/v2/fingerprint.d.ts +1 -0
  206. package/dist/core/v2/fingerprint.js +4 -0
  207. package/dist/core/v2/index.d.ts +12 -0
  208. package/dist/core/v2/index.js +10 -0
  209. package/dist/core/v2/judge-audit.d.ts +2 -0
  210. package/dist/core/v2/judge-audit.js +15 -0
  211. package/dist/core/v2/judge-factory.d.ts +25 -0
  212. package/dist/core/v2/judge-factory.js +75 -0
  213. package/dist/core/v2/judge-outbound.d.ts +12 -0
  214. package/dist/core/v2/judge-outbound.js +73 -0
  215. package/dist/core/v2/judge.d.ts +47 -0
  216. package/dist/core/v2/judge.js +264 -0
  217. package/dist/core/v2/launcher-resolve.d.ts +12 -0
  218. package/dist/core/v2/launcher-resolve.js +190 -0
  219. package/dist/core/v2/overrides.d.ts +7 -0
  220. package/dist/core/v2/overrides.js +37 -0
  221. package/dist/core/v2/parser.d.ts +21 -0
  222. package/dist/core/v2/parser.js +213 -0
  223. package/dist/core/v2/types.d.ts +67 -0
  224. package/dist/core/v2/types.js +1 -0
  225. package/dist/core/v2/verdict.d.ts +2 -0
  226. package/dist/core/v2/verdict.js +699 -0
  227. package/dist/corpus/evaluate.d.ts +24 -0
  228. package/dist/corpus/evaluate.js +69 -0
  229. package/dist/defaults.d.ts +18 -0
  230. package/dist/defaults.js +155 -0
  231. package/dist/egress-daemon.d.ts +1 -0
  232. package/dist/egress-daemon.js +52 -0
  233. package/dist/index.d.ts +17 -0
  234. package/dist/index.js +15 -0
  235. package/dist/installer/bootstrap.d.ts +5 -0
  236. package/dist/installer/bootstrap.js +61 -0
  237. package/dist/installer/runtime-artifacts.d.ts +3 -0
  238. package/dist/installer/runtime-artifacts.js +23 -0
  239. package/dist/installer/scope-config.d.ts +8 -0
  240. package/dist/installer/scope-config.js +25 -0
  241. package/dist/installer.d.ts +22 -0
  242. package/dist/installer.js +169 -0
  243. package/dist/node-resolution.d.ts +8 -0
  244. package/dist/node-resolution.js +237 -0
  245. package/dist/operational-insights.d.ts +19 -0
  246. package/dist/operational-insights.js +24 -0
  247. package/dist/presets.d.ts +4 -0
  248. package/dist/presets.js +95 -0
  249. package/dist/services/egress-service.d.ts +57 -0
  250. package/dist/services/egress-service.js +334 -0
  251. package/dist/services/sandbox-service.d.ts +38 -0
  252. package/dist/services/sandbox-service.js +95 -0
  253. package/dist/templates.d.ts +7 -0
  254. package/dist/templates.js +56 -0
  255. package/dist/types.d.ts +230 -0
  256. package/dist/types.js +1 -0
  257. package/dist/version.d.ts +1 -0
  258. package/dist/version.js +1 -0
  259. package/package.json +65 -0
  260. package/skills/belay/SKILL.md +52 -0
  261. package/skills/belay/belay-approve.md +7 -0
  262. package/skills/belay/belay-explain.md +11 -0
  263. package/skills/belay/belay-recover.md +13 -0
  264. package/skills/belay/belay-report.md +7 -0
  265. package/skills/belay/belay-status.md +9 -0
  266. package/skills/belay/belay-why.md +11 -0
@@ -0,0 +1,230 @@
1
+ export type { BelayConfig, BelayConfigV1, BelayConfigV2, BelayConfigV3, BelayControlPlaneConfig, BelayEgressConfig, BelayMode, BelayOverridesConfig, BelayPolicyConfig, BelayRedactionConfig, BelaySandboxConfig, BelayTransactionalConfig, UnknownLocalEffectPolicy, } from './core/config.js';
2
+ export type { ApprovalRecord, ApprovalStateFile, Assessment, ClassifyResult, HookVerdict, } from './core/types.js';
3
+ import type { InstallScope } from './adapters/layouts/scope.js';
4
+ import type { RecentAskEntry } from './core/audit-summary.js';
5
+ import type { BelayEgressConfig, BelayOverridesConfig, BelayPolicyConfig, BelaySandboxConfig } from './core/config.js';
6
+ import type { ApprovalRecord, ClassifyResult } from './core/types.js';
7
+ export interface HookEntry {
8
+ command: string;
9
+ matcher?: string;
10
+ }
11
+ export interface HooksFile {
12
+ version: number;
13
+ hooks: Record<string, HookEntry[]>;
14
+ }
15
+ export type AdapterName = 'cursor' | 'claude' | 'codex';
16
+ export interface InitOptions {
17
+ targetDir?: string;
18
+ withSkill?: boolean;
19
+ dogfood?: boolean;
20
+ adapter?: AdapterName;
21
+ scope?: InstallScope;
22
+ preset?: import('./presets.js').ConfigPresetName;
23
+ judgeProfile?: 'local-ollama';
24
+ judgeProvider?: 'ollama' | 'openai-compatible' | 'cursor';
25
+ judgeModel?: string;
26
+ judgeEndpoint?: string;
27
+ /** Acknowledge cloud judge egress + redaction limits (R19). Required for openai-compatible provider. */
28
+ acceptCloudJudge?: boolean;
29
+ /** When true, skip writing judge config (used when user declines cloud consent). */
30
+ skipJudgeWrite?: boolean;
31
+ }
32
+ export interface UpgradeOptions {
33
+ targetDir?: string;
34
+ withSkill?: boolean;
35
+ adapter?: AdapterName;
36
+ scope?: InstallScope;
37
+ }
38
+ export interface DoctorOptions {
39
+ targetDir?: string;
40
+ fix?: boolean;
41
+ dryRun?: boolean;
42
+ adapter?: AdapterName;
43
+ }
44
+ export interface DogfoodStatus {
45
+ active: boolean;
46
+ mode: string;
47
+ unknownLocalEffect: string;
48
+ readyForEnforce: boolean;
49
+ gateEvents: number;
50
+ wouldBlockCount: number;
51
+ wouldBlockRate: number;
52
+ notes: string[];
53
+ }
54
+ export interface ConfigProvenanceNote {
55
+ path: string;
56
+ source: 'builtin' | 'team' | 'repo' | 'protected';
57
+ }
58
+ export interface DoctorReport {
59
+ ok: boolean;
60
+ repoRoot: string;
61
+ configPath: string;
62
+ hooksPath: string;
63
+ nodeResolution: {
64
+ ok: boolean;
65
+ detail: string;
66
+ path?: string;
67
+ };
68
+ issues: string[];
69
+ notes: string[];
70
+ warnings: string[];
71
+ configProvenance: ConfigProvenanceNote[];
72
+ dogfood: DogfoodStatus | null;
73
+ }
74
+ export interface StatusOptions {
75
+ targetDir?: string;
76
+ json?: boolean;
77
+ }
78
+ export interface HealthSnapshotOptions {
79
+ targetDir?: string;
80
+ adapter?: AdapterName;
81
+ }
82
+ export interface HealthSnapshot {
83
+ repoRoot: string;
84
+ adapter: AdapterName;
85
+ installScope: 'project' | 'global';
86
+ configPath: string;
87
+ hooksPath: string;
88
+ skillPath: string;
89
+ commandsPath?: string;
90
+ configPresent: boolean;
91
+ hooksInstalled: boolean;
92
+ managedHooksOk: boolean;
93
+ runtimePresent: boolean;
94
+ skillInstalled: boolean;
95
+ skillOnly: boolean;
96
+ commandsInstalled: boolean;
97
+ floorInstalled: boolean;
98
+ missingArtifacts: string[];
99
+ judgeIssues: string[];
100
+ judgeWarnings: string[];
101
+ judgeNotes: string[];
102
+ containmentPosture: 'best-effort' | 'l1-full';
103
+ containmentWarnings: string[];
104
+ additionalRiskSignals: string[];
105
+ l1FullActive: boolean;
106
+ }
107
+ export interface ClassifyForReportResult {
108
+ repoRoot: string;
109
+ kind: ExplainKind;
110
+ input: string;
111
+ cwd: string;
112
+ config: import('./core/config.js').BelayConfigV3;
113
+ policy: BelayPolicyConfig;
114
+ overrides: BelayOverridesConfig;
115
+ egress: BelayEgressConfig;
116
+ egressProxyRunning: boolean;
117
+ sandbox: BelaySandboxConfig;
118
+ sandboxBrokerActive: boolean;
119
+ l1FullActive: boolean;
120
+ transactionalEligible: boolean;
121
+ permission: string;
122
+ tier: string;
123
+ result: ClassifyResult;
124
+ }
125
+ export interface StatusReport {
126
+ repoRoot: string;
127
+ approvalStateDir: string;
128
+ pending: ApprovalRecord[];
129
+ approved: ApprovalRecord[];
130
+ expiredPendingCount: number;
131
+ dogfood: DogfoodStatus;
132
+ health: HealthSnapshot;
133
+ visibility: AuditVisibilityReport;
134
+ }
135
+ export interface ReportOptions {
136
+ targetDir?: string;
137
+ since?: string;
138
+ until?: string;
139
+ limit?: number;
140
+ json?: boolean;
141
+ }
142
+ export interface AuditVisibilityReport {
143
+ repoRoot: string;
144
+ auditLogPath: string;
145
+ gateEvents: number;
146
+ askCount: number;
147
+ enforceAskCount: number;
148
+ auditAskCount: number;
149
+ unknownModeAskCount: number;
150
+ flagCount: number;
151
+ allowCount: number;
152
+ silentPassRate: number;
153
+ recentAsks: RecentAskEntry[];
154
+ warnings: string[];
155
+ notes: string[];
156
+ }
157
+ export interface RecoverOptions {
158
+ targetDir?: string;
159
+ since?: string;
160
+ fingerprint?: string;
161
+ command?: string;
162
+ limit?: number;
163
+ json?: boolean;
164
+ }
165
+ export interface RecoverReport {
166
+ repoRoot: string;
167
+ target?: {
168
+ timestamp?: string;
169
+ fingerprint?: string;
170
+ summary: string;
171
+ reason: string;
172
+ effect?: string;
173
+ location?: string;
174
+ permission?: string;
175
+ };
176
+ recoverable: boolean;
177
+ confidence: 'high' | 'medium';
178
+ disclaimer: string[];
179
+ advice: string[];
180
+ warnings: string[];
181
+ }
182
+ export interface DogfoodOptions {
183
+ targetDir?: string;
184
+ enforce?: boolean;
185
+ force?: boolean;
186
+ adapter?: AdapterName;
187
+ }
188
+ export interface DogfoodResult {
189
+ ok: boolean;
190
+ repoRoot: string;
191
+ message: string;
192
+ configPath: string;
193
+ mode: string;
194
+ unknownLocalEffect: string;
195
+ }
196
+ export type ExplainKind = 'shell' | 'tool' | 'subagent';
197
+ export interface ExplainReport {
198
+ repoRoot: string;
199
+ kind: string;
200
+ command: string;
201
+ cwd: string;
202
+ policy: BelayPolicyConfig;
203
+ overrides: BelayOverridesConfig;
204
+ egress: BelayEgressConfig;
205
+ egressProxyRunning: boolean;
206
+ egressL3DemotionActive: boolean;
207
+ sandbox: BelaySandboxConfig;
208
+ sandboxBrokerActive: boolean;
209
+ l1FullActive: boolean;
210
+ transactionalEligible: boolean;
211
+ permission: string;
212
+ tier: string;
213
+ approvalId?: string;
214
+ result: ClassifyResult;
215
+ }
216
+ export interface ExplainOptions {
217
+ targetDir?: string;
218
+ command?: string;
219
+ cwd?: string;
220
+ json?: boolean;
221
+ kind?: ExplainKind;
222
+ toolName?: string;
223
+ payload?: Record<string, unknown>;
224
+ /** Re-classify the latest pending approval when no command is given. */
225
+ explainLastPending?: boolean;
226
+ }
227
+ export interface RevokeOptions {
228
+ targetDir?: string;
229
+ approvalId: string;
230
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare const PACKAGE_VERSION = "0.0.1";
@@ -0,0 +1 @@
1
+ export const PACKAGE_VERSION = '0.0.1';
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@guilz-dev/belay",
3
+ "version": "0.1.0",
4
+ "description": "Belay-style approval and audit gating for agent runtimes.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/guilz-dev/belay.git"
10
+ },
11
+ "homepage": "https://github.com/guilz-dev/belay#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/guilz-dev/belay/issues"
14
+ },
15
+ "keywords": [
16
+ "agent",
17
+ "belay",
18
+ "hooks",
19
+ "approval",
20
+ "audit",
21
+ "runtime-safety"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "engines": {
27
+ "node": ">=22"
28
+ },
29
+ "packageManager": "pnpm@10.29.3",
30
+ "bin": {
31
+ "belay": "./dist/cli.js"
32
+ },
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/index.d.ts",
36
+ "default": "./dist/index.js"
37
+ },
38
+ "./core": {
39
+ "types": "./dist/core/index.d.ts",
40
+ "default": "./dist/core/index.js"
41
+ }
42
+ },
43
+ "files": [
44
+ "dist",
45
+ "skills",
46
+ "README.md",
47
+ "LICENSE",
48
+ "agent-belay-logo.png"
49
+ ],
50
+ "scripts": {
51
+ "build": "rm -rf dist && tsc -p tsconfig.build.json && node scripts/build-runtime.mjs",
52
+ "lint": "biome check src package.json README.md CHANGELOG.md CONTRIBUTING.md SECURITY.md tsconfig.json tsconfig.build.json vitest.config.ts scripts docs",
53
+ "typecheck": "tsc --noEmit",
54
+ "test": "pnpm build && vitest run",
55
+ "test:stable": "pnpm build && vitest run && vitest run && vitest run",
56
+ "corpus": "pnpm build && node scripts/corpus.mjs"
57
+ },
58
+ "devDependencies": {
59
+ "@biomejs/biome": "2.4.15",
60
+ "@types/node": "22.15.29",
61
+ "esbuild": "0.25.5",
62
+ "typescript": "5.9.3",
63
+ "vitest": "3.2.4"
64
+ }
65
+ }
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: belay
3
+ description: >-
4
+ Guides approval when belay blocks a high-risk shell command, subagent launch,
5
+ or tool action. Use when an action is denied, blocked, or needs belay-approve, or when
6
+ installing or checking belay hook health in a repository.
7
+ disable-model-invocation: true
8
+ ---
9
+
10
+ # Belay
11
+
12
+ Belay installs repo-local hooks that gate high-risk shell commands, tool actions, and
13
+ subagent launches. Enforcement lives in hooks; this skill only explains the flow and
14
+ routes you to the CLI. It does not classify commands itself.
15
+
16
+ ## Prerequisites
17
+
18
+ Run `npx @guilz-dev/belay init` in the project root before relying on enforcement.
19
+ If you only installed this skill via `npx skills add`, approval instructions are
20
+ available, but the runtime gate is not installed yet. Run `belay doctor` to
21
+ check whether hooks are present.
22
+
23
+ ## When belay blocks an action
24
+
25
+ 1. Read the approval ID in the deny message.
26
+ 2. Approve once with `/belay-approve <approval-id>` or `belay approve <approval-id>`.
27
+ 3. Retry the original action unchanged.
28
+
29
+ For why it was blocked, use `/belay why <command>` or `belay explain --command "<command>"`.
30
+ For the latest pending ask, use `/belay explain` or `belay explain`.
31
+ For install health and audit visibility, use `/belay status` or `belay status`.
32
+ For audit-only summary, use `/belay report` or `belay report`.
33
+ For recovery advice after a block, use `/belay recover` or `belay recover`.
34
+
35
+ ## Install or repair
36
+
37
+ - Full install: `npx @guilz-dev/belay init --with-skill`
38
+ - Interactive wizard: `npx @guilz-dev/belay init-wizard`
39
+ - Health check: `belay doctor`
40
+
41
+ Do not run init or doctor implicitly from this skill — only when the user asks.
42
+
43
+ ## CLI mapping
44
+
45
+ | User intent | Command |
46
+ | --- | --- |
47
+ | Why was this blocked? | `belay explain --command "..."` |
48
+ | Explain latest pending ask | `belay explain` |
49
+ | Status / dogfood / audit visibility | `belay status` |
50
+ | Audit summary (read-only) | `belay report` |
51
+ | Recovery advice (advisory only) | `belay recover` |
52
+ | Approve once | `belay approve <id>` |
@@ -0,0 +1,7 @@
1
+ Run after belay denies a high-risk action and returns an approval ID.
2
+
3
+ ```bash
4
+ belay approve <approval-id>
5
+ ```
6
+
7
+ Then retry the original action unchanged.
@@ -0,0 +1,11 @@
1
+ Explain the latest pending belay approval, or a specific blocked action.
2
+
3
+ ```bash
4
+ belay explain
5
+ ```
6
+
7
+ If the user names a command, use:
8
+
9
+ ```bash
10
+ belay explain --command "<command>"
11
+ ```
@@ -0,0 +1,13 @@
1
+ Advisory recovery guidance for a recent blocked or destructive action (does not run commands).
2
+
3
+ ```bash
4
+ belay recover
5
+ ```
6
+
7
+ To target a specific command:
8
+
9
+ ```bash
10
+ belay recover --command "rm important.ts"
11
+ ```
12
+
13
+ Review each suggested step before running — recovery commands pass through belay hooks.
@@ -0,0 +1,7 @@
1
+ Show audit visibility: ask/flag/allow counts, silent-pass rate, and recent asks.
2
+
3
+ ```bash
4
+ belay report
5
+ ```
6
+
7
+ For full install health plus audit summary, use `belay status`.
@@ -0,0 +1,9 @@
1
+ Show belay install health, pending approvals, dogfood metrics, and audit visibility.
2
+
3
+ ```bash
4
+ belay status
5
+ ```
6
+
7
+ For audit-only summary: `belay report`. For recovery advice: `belay recover`.
8
+
9
+ If hooks are missing, suggest `npx @guilz-dev/belay init` and `belay doctor`.
@@ -0,0 +1,11 @@
1
+ Explain why belay would classify a command. Pass the exact shell command in quotes.
2
+
3
+ ```bash
4
+ belay explain --command "<command>"
5
+ ```
6
+
7
+ Example:
8
+
9
+ ```bash
10
+ belay explain --command "git push origin main"
11
+ ```