@hexagen-monaco/sync 0.12.0 → 0.13.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 (99) hide show
  1. package/README.md +429 -0
  2. package/dist/cli.js +6253 -439
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/arch/edit.d.ts.map +1 -1
  5. package/dist/commands/contract/evaluate.d.ts +45 -0
  6. package/dist/commands/contract/evaluate.d.ts.map +1 -0
  7. package/dist/commands/contract/index.d.ts +24 -0
  8. package/dist/commands/contract/index.d.ts.map +1 -0
  9. package/dist/commands/evidence/check.d.ts +31 -0
  10. package/dist/commands/evidence/check.d.ts.map +1 -0
  11. package/dist/commands/evidence/index.d.ts +3 -0
  12. package/dist/commands/evidence/index.d.ts.map +1 -0
  13. package/dist/commands/evidence/pack.d.ts +41 -0
  14. package/dist/commands/evidence/pack.d.ts.map +1 -0
  15. package/dist/commands/grant/build.d.ts +53 -0
  16. package/dist/commands/grant/build.d.ts.map +1 -0
  17. package/dist/commands/grant/canonical.d.ts +27 -0
  18. package/dist/commands/grant/canonical.d.ts.map +1 -0
  19. package/dist/commands/grant/check.d.ts +26 -0
  20. package/dist/commands/grant/check.d.ts.map +1 -0
  21. package/dist/commands/grant/duration.d.ts +8 -0
  22. package/dist/commands/grant/duration.d.ts.map +1 -0
  23. package/dist/commands/grant/index.d.ts +2 -0
  24. package/dist/commands/grant/index.d.ts.map +1 -0
  25. package/dist/commands/grant/issue.d.ts +23 -0
  26. package/dist/commands/grant/issue.d.ts.map +1 -0
  27. package/dist/commands/grant/key-init.d.ts +16 -0
  28. package/dist/commands/grant/key-init.d.ts.map +1 -0
  29. package/dist/commands/grant/revoke.d.ts +35 -0
  30. package/dist/commands/grant/revoke.d.ts.map +1 -0
  31. package/dist/commands/grant/show.d.ts +18 -0
  32. package/dist/commands/grant/show.d.ts.map +1 -0
  33. package/dist/commands/grant/sign.d.ts +3 -0
  34. package/dist/commands/grant/sign.d.ts.map +1 -0
  35. package/dist/commands/grant/signing-key.d.ts +22 -0
  36. package/dist/commands/grant/signing-key.d.ts.map +1 -0
  37. package/dist/commands/grant/verify.d.ts +45 -0
  38. package/dist/commands/grant/verify.d.ts.map +1 -0
  39. package/dist/commands/grant/workspace.d.ts +11 -0
  40. package/dist/commands/grant/workspace.d.ts.map +1 -0
  41. package/dist/commands/observe/imports/jsonc.d.ts +6 -0
  42. package/dist/commands/observe/imports/jsonc.d.ts.map +1 -0
  43. package/dist/commands/observe/imports/pass.d.ts +45 -0
  44. package/dist/commands/observe/imports/pass.d.ts.map +1 -0
  45. package/dist/commands/observe/imports/resolve.d.ts +44 -0
  46. package/dist/commands/observe/imports/resolve.d.ts.map +1 -0
  47. package/dist/commands/observe/imports/safe-read.d.ts +30 -0
  48. package/dist/commands/observe/imports/safe-read.d.ts.map +1 -0
  49. package/dist/commands/observe/imports/scan.d.ts +59 -0
  50. package/dist/commands/observe/imports/scan.d.ts.map +1 -0
  51. package/dist/commands/observe/index.d.ts +59 -0
  52. package/dist/commands/observe/index.d.ts.map +1 -0
  53. package/dist/commands/observe/same-path.d.ts +9 -0
  54. package/dist/commands/observe/same-path.d.ts.map +1 -0
  55. package/dist/commands/observe/walk.d.ts +29 -0
  56. package/dist/commands/observe/walk.d.ts.map +1 -0
  57. package/dist/commands/shared/brownfield-sidecar.d.ts +68 -0
  58. package/dist/commands/shared/brownfield-sidecar.d.ts.map +1 -0
  59. package/dist/commands/shared/git-exclude.d.ts +36 -0
  60. package/dist/commands/shared/git-exclude.d.ts.map +1 -0
  61. package/dist/commands/shared/glob.d.ts +29 -0
  62. package/dist/commands/shared/glob.d.ts.map +1 -0
  63. package/dist/commands/shared/ignore.d.ts +32 -0
  64. package/dist/commands/shared/ignore.d.ts.map +1 -0
  65. package/dist/commands/shared/sidecar-out.d.ts +6 -0
  66. package/dist/commands/shared/sidecar-out.d.ts.map +1 -0
  67. package/dist/commands/shared/sidecar-write.d.ts +2 -0
  68. package/dist/commands/shared/sidecar-write.d.ts.map +1 -0
  69. package/dist/commands/slice/index.d.ts +23 -0
  70. package/dist/commands/slice/index.d.ts.map +1 -0
  71. package/dist/commands/workbook/allow-list.d.ts +27 -0
  72. package/dist/commands/workbook/allow-list.d.ts.map +1 -0
  73. package/dist/commands/workbook/export.d.ts +41 -0
  74. package/dist/commands/workbook/export.d.ts.map +1 -0
  75. package/dist/commands/workbook/index.d.ts +3 -0
  76. package/dist/commands/workbook/index.d.ts.map +1 -0
  77. package/dist/commands/workbook/zip-read.d.ts +7 -0
  78. package/dist/commands/workbook/zip-read.d.ts.map +1 -0
  79. package/dist/fs-utils.d.ts.map +1 -1
  80. package/dist/generators/barrels/recursive.d.ts.map +1 -1
  81. package/dist/generators/root-file-templates.d.ts +5 -4
  82. package/dist/generators/root-file-templates.d.ts.map +1 -1
  83. package/dist/generators/root-files.d.ts.map +1 -1
  84. package/dist/index.js +355 -75
  85. package/dist/index.js.map +1 -1
  86. package/dist/templates/agents-md/findings/0001-session-log-grows-unbounded.md +35 -0
  87. package/dist/templates/ci-github-actions/findings/0001-ci-runners-have-no-zsh.md +34 -0
  88. package/dist/templates/orchestration/README.md +88 -0
  89. package/dist/templates/orchestration/files/.agents/skills/orchestrate-wave/SKILL.md +511 -0
  90. package/dist/templates/orchestration/files/.agents/skills/orchestrate-wave/references/briefs.md +178 -0
  91. package/dist/templates/orchestration/files/.agents/skills/orchestrate-wave/references/rationale.md +520 -0
  92. package/dist/templates/orchestration/files/.agents/skills/orchestrate-wave/scripts/wave-event.sh +17 -0
  93. package/dist/templates/orchestration/files/.github/workflows/gate.yml +66 -0
  94. package/dist/templates/orchestration/findings/0001-relative-runbook-links-escape-the-skill.md +48 -0
  95. package/dist/templates/orchestration/findings/0002-interpolation-hazard-in-graphql-line.md +46 -0
  96. package/dist/templates/orchestration/manifest.json +41 -0
  97. package/dist/types/manifest/monorepo.d.ts +4 -0
  98. package/dist/types/manifest/monorepo.d.ts.map +1 -1
  99. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../src/commands/arch/edit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAwED,wBAAsB,WAAW,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsK1E;AAED,eAAO,MAAM,aAAa,SAOtB,CAAC"}
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../src/commands/arch/edit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAuED,wBAAsB,WAAW,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsK1E;AAED,eAAO,MAAM,aAAa,SAOtB,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { type Contract, type ObservedReport, type Slice } from "@hexagen/shared";
2
+ export interface Violation {
3
+ rule: string;
4
+ file: string;
5
+ specifier: string;
6
+ severity: "error" | "warn";
7
+ }
8
+ export interface Evaluation {
9
+ violations: Violation[];
10
+ /**
11
+ * Set when the edge or unresolved sections were not collected: nothing can be
12
+ * said about the slice's imports, so the check is never clean and no baseline
13
+ * can cover it.
14
+ */
15
+ incomplete: string | null;
16
+ }
17
+ /** Specifier recorded for a file the import pass cannot read. */
18
+ export declare function unreadLanguageSpecifier(ext: string): string;
19
+ /**
20
+ * Rules against the observed edges whose `from` is in the slice, plus the
21
+ * built-in `unresolved-import` rule (plan BW-D3):
22
+ * - every `unresolved` row whose `from` is in the slice, whatever its reason;
23
+ * - every in-slice file whose extension is in `edges.unreadLanguages`.
24
+ *
25
+ * `forbid`: an edge from the rule's `from` prefix to its `to` prefix.
26
+ * `allow-only`: an edge from the `from` prefix to anywhere that is neither
27
+ * the `to` prefix nor the `from` prefix itself (same-prefix imports are
28
+ * allowed).
29
+ */
30
+ export declare function evaluateContract(input: {
31
+ slice: Slice;
32
+ contract: Contract | undefined;
33
+ observed: ObservedReport;
34
+ /** Work-tree files (tracked and untracked, not ignored). */
35
+ files: readonly string[];
36
+ }): Evaluation;
37
+ export { isSuppressionExpired, isKnown } from "@hexagen/shared";
38
+ /** Cross-prefix edges inside the slice, deduplicated by prefix pair. */
39
+ export declare function proposeCrossPrefixEdges(slice: Slice, observed: ObservedReport): {
40
+ from: string;
41
+ to: string;
42
+ count: number;
43
+ example: string;
44
+ }[];
45
+ //# sourceMappingURL=evaluate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../../src/commands/contract/evaluate.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,KAAK,EACX,MAAM,iBAAiB,CAAC;AAIzB,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB;;;;OAIG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,iEAAiE;AACjE,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,cAAc,CAAC;IACzB,4DAA4D;IAC5D,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B,GAAG,UAAU,CAyDb;AAGD,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEhE,wEAAwE;AACxE,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,cAAc,GACvB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,CAuBhE"}
@@ -0,0 +1,24 @@
1
+ import { Command } from "commander";
2
+ import { type CommandResult } from "../shared/brownfield-sidecar.js";
3
+ import { type SliceRootOptions } from "../slice/index.js";
4
+ export declare function runContractPropose(options: SliceRootOptions & {
5
+ strict?: boolean;
6
+ }): Promise<CommandResult>;
7
+ export interface AddRuleOptions extends SliceRootOptions {
8
+ kind: "forbid" | "allow-only";
9
+ from: string;
10
+ to: string;
11
+ severity?: "error" | "warn";
12
+ id?: string;
13
+ yes?: boolean;
14
+ }
15
+ export declare function runContractAddRule(options: AddRuleOptions): Promise<CommandResult>;
16
+ export declare function runContractShow(options: SliceRootOptions): Promise<CommandResult>;
17
+ export interface ContractCheckOptions extends SliceRootOptions {
18
+ baseline?: boolean;
19
+ yes?: boolean;
20
+ strict?: boolean;
21
+ }
22
+ export declare function runContractCheck(options: ContractCheckOptions): Promise<CommandResult>;
23
+ export declare const contractCommander: Command;
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/contract/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,OAAO,EAUL,KAAK,aAAa,EACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAW1D,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,gBAAgB,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC/C,OAAO,CAAC,aAAa,CAAC,CAiCxB;AAED,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD,IAAI,EAAE,QAAQ,GAAG,YAAY,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAkCD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,aAAa,CAAC,CAExB;AAyED,wBAAsB,eAAe,CACnC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,aAAa,CAAC,CAYxB;AAED,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,aAAa,CAAC,CAMxB;AAwHD,eAAO,MAAM,iBAAiB,SAE7B,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { type SplitLine } from "@hexagen/shared/node/trace-chain";
2
+ import { type Grant } from "@hexagen/shared";
3
+ /**
4
+ * Reader-side checks for `hexagen evidence pack`: chain, line shape and the
5
+ * Rules of docs/kernel/TRACE.md. Pure; no fs.
6
+ *
7
+ * The Rule 1-3 logic itself is `traceRuleReasons` in `@hexagen/shared`, the same
8
+ * function the MCP server's `checkTrace` calls: a denial skips the allowlist and
9
+ * window checks, but still has to cite a known grant.
10
+ */
11
+ export type LineKind = "evidence" | "denial" | "invalid";
12
+ export interface LineVerdict {
13
+ /** 0-based position in the file (equals `seq` on a sound chain). */
14
+ readonly index: number;
15
+ readonly seq?: number;
16
+ readonly kind: LineKind;
17
+ readonly valid: boolean;
18
+ readonly reasons: readonly string[];
19
+ /** The grant a line cites, when it cites one. */
20
+ readonly grantId?: string;
21
+ readonly haltReason?: string;
22
+ readonly tool?: string;
23
+ readonly time?: string;
24
+ readonly reason?: string;
25
+ }
26
+ /**
27
+ * One verdict per line, in file order. `grants` holds only grants whose
28
+ * signature verified, so a line citing a forged grant fails Rule 3.
29
+ */
30
+ export declare function checkLines(lines: readonly SplitLine[], grants: ReadonlyMap<string, Grant>): LineVerdict[];
31
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/commands/evidence/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAEL,KAAK,KAAK,EAEX,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;GAOG;AAEH,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEzD,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,iDAAiD;IACjD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAoGD;;;GAGG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,GACjC,WAAW,EAAE,CAoEf"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare const evidenceCommander: Command;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/evidence/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,iBAAiB,SAE7B,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { type LineVerdict } from "./check.js";
2
+ export interface EvidencePackOptions {
3
+ /** Repo root; `.hexagen/` lives here. Never searched upward. */
4
+ readonly root: string;
5
+ readonly trace: string;
6
+ readonly grantFiles: readonly string[];
7
+ readonly out: string;
8
+ readonly keyFile?: string;
9
+ readonly engagement?: string;
10
+ readonly env?: Readonly<Record<string, string | undefined>>;
11
+ /** Test seam; defaults to `os.homedir()`. */
12
+ readonly homeDir?: string;
13
+ readonly now?: () => Date;
14
+ /** Milliseconds to wait for the trace lock (default 15 s). */
15
+ readonly lockTimeoutMs?: number;
16
+ /** Test seam: replaces the atomic write of `tip.json`. */
17
+ /** Test seam: runs after the trace and tip were validated, before anything is written, with the trace lock held. */
18
+ readonly beforeTipWrite?: () => Promise<void>;
19
+ /** Test seam: runs after the output directory is validated, before the temp file is created. */
20
+ readonly beforeWrite?: () => Promise<void>;
21
+ /** Test seam: runs after the temp bundle is written, before it is linked. */
22
+ readonly beforeLink?: () => Promise<void>;
23
+ readonly writeTip?: (target: string, data: string) => Promise<void>;
24
+ }
25
+ export interface EvidencePackResult {
26
+ /** 0 packed; 1 the evidence is invalid (nothing written); 2 usage or precondition. */
27
+ readonly exitCode: 0 | 1 | 2;
28
+ readonly messages: readonly string[];
29
+ readonly verdicts?: readonly LineVerdict[];
30
+ /** Absolute path of the bundle, when one was written. */
31
+ readonly bundle?: string;
32
+ }
33
+ /**
34
+ * `hexagen evidence pack`: verifies a brownfield trace (chain, line shape,
35
+ * docs/kernel/TRACE.md Rules, the anchored tip) and, only if every line is
36
+ * sound, writes an HMAC'd bundle zip under `.hexagen/` and advances
37
+ * `.hexagen/evidence/tip.json`. On any invalid line it writes nothing at all,
38
+ * so a bundle that exists is a bundle that passed.
39
+ */
40
+ export declare function runEvidencePack(options: EvidencePackOptions): Promise<EvidencePackResult>;
41
+ //# sourceMappingURL=pack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../../../src/commands/evidence/pack.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1D,MAAM,WAAW,mBAAmB;IAClC,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAC5D,6CAA6C;IAC7C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,0DAA0D;IAC1D,oHAAoH;IACpH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,gGAAgG;IAChG,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrE;AAED,MAAM,WAAW,kBAAkB;IACjC,sFAAsF;IACtF,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAC3C,yDAAyD;IACzD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAwCD;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,kBAAkB,CAAC,CAsW7B"}
@@ -0,0 +1,53 @@
1
+ import { type GrantFields } from "./canonical.js";
2
+ export interface IssueGrantInput {
3
+ readonly principal: string;
4
+ readonly agent: string;
5
+ readonly paths: readonly string[];
6
+ readonly tools: readonly string[];
7
+ readonly mode: "write" | "propose";
8
+ readonly expiresIn: string;
9
+ readonly contexts?: readonly string[];
10
+ readonly maxFiles?: number;
11
+ /**
12
+ * Brownfield (no manifest): leave `contexts` off the grant entirely. Absent
13
+ * and `[]` sign differently, and a client-repo grant never writes `[]`.
14
+ */
15
+ readonly omitContexts?: boolean;
16
+ readonly now?: Date;
17
+ }
18
+ export interface IssuedGrant extends GrantFields {
19
+ readonly signature: string;
20
+ }
21
+ /**
22
+ * Looks up each `--contexts` name in `manifest.yaml`'s `bounded_contexts`
23
+ * and expands it to `packages/<context>/`, per docs/kernel/GRANT.md
24
+ * "Compiling a grant". A name that isn't a real context is a hard error
25
+ * (fail closed) — never a silently-dropped entry.
26
+ */
27
+ export declare function expandContexts(workspaceRoot: string, contexts: readonly string[]): Promise<string[]>;
28
+ /**
29
+ * `checkMutationAgainstGrant` requires `grant.contexts` to independently
30
+ * name every context a mutation targets — `grant.paths` covering
31
+ * `packages/<context>/` is not enough on its own (see
32
+ * packages/mcp-server/src/application/kernel/grant.ts
33
+ * `checkMutationAgainstGrant`, "An empty `grant.contexts` ... denies
34
+ * everything by construction"). So a grant issued on `--paths` alone,
35
+ * naming `packages/<context>/` prefixes but no `--contexts`, would
36
+ * otherwise sign with `contexts: []` and be denied for every mutation —
37
+ * contradicting the documented paths-only flow. This reverse-matches each
38
+ * `packages/<name>/` path prefix against the manifest's known contexts so
39
+ * those names land in `grant.contexts` too, without requiring the caller
40
+ * to repeat them via `--contexts`. Returns `[]` (never throws) when no
41
+ * manifest exists or no path matches a known context — that's the one
42
+ * case a true paths-only grant (no manifest at all) is deliberately
43
+ * useless against this manifest-only enforcement adapter, not a bug to
44
+ * paper over here.
45
+ */
46
+ export declare function deriveContextsFromPaths(workspaceRoot: string, paths: readonly string[]): Promise<string[]>;
47
+ /**
48
+ * Assembles and signs a Grant. Pure apart from the signature HMAC itself —
49
+ * `id` and `expires_at` are the only non-deterministic-by-design fields
50
+ * (fresh id, now + expiresIn), both overridable via `now` for tests.
51
+ */
52
+ export declare function buildGrant(input: IssueGrantInput, keyHex: string, signFn: (payload: string, keyHex: string) => string, contextPaths?: readonly string[]): Promise<IssuedGrant>;
53
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/grant/build.ts"],"names":[],"mappings":"AAIA,OAAO,EAAyB,KAAK,WAAW,EAAE,M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
+ * The exact bytes a Grant's signature is computed over.
3
+ *
4
+ * This MUST byte-for-byte match `canonicalGrantPayload` in
5
+ * `packages/mcp-server/src/application/kernel/grant.ts` — that is the
6
+ * function `GrantSignatureAdapter.verify` runs at the accept choke point.
7
+ * The two packages cannot share one implementation without `@hexagen/sync`
8
+ * depending on `@hexagen/mcp-server` (the wrong direction: `mcp-server`
9
+ * already depends on `sync`), so this is a deliberate, pinned duplicate —
10
+ * see `__tests__/commands/grant/canonical.test.ts`, which locks the output
11
+ * for a fixed sample grant so the two can't silently drift.
12
+ */
13
+ export interface GrantFields {
14
+ readonly id: string;
15
+ readonly principal: string;
16
+ readonly agent: string;
17
+ /** Absent on a client-repo grant (it never writes `[]`); absent and `[]` sign differently. */
18
+ readonly contexts?: readonly string[];
19
+ readonly paths: readonly string[];
20
+ readonly tools: readonly string[];
21
+ readonly mode: "write" | "propose";
22
+ readonly max_files?: number;
23
+ readonly expires_at: string;
24
+ readonly revoked_at?: string;
25
+ }
26
+ export declare function canonicalGrantPayload(grant: GrantFields): string;
27
+ //# sourceMappingURL=canonical.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonical.d.ts","sourceRoot":"","sources":["../../../src/commands/grant/canonical.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,8FAA8F;IAC9F,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAchE"}
@@ -0,0 +1,26 @@
1
+ export interface CheckOptions {
2
+ grantFile: string;
3
+ /** Field Kit form. */
4
+ tool?: string | string[];
5
+ path?: string[];
6
+ /** Monaco form (`grant check <grant-file> <transaction-id>`); not built. */
7
+ transactionId?: string;
8
+ workspaceRoot?: string;
9
+ keyFile?: string;
10
+ engagement?: string;
11
+ /** Test seams. */
12
+ homeDir?: string;
13
+ env?: Readonly<Record<string, string | undefined>>;
14
+ now?: Date;
15
+ }
16
+ /**
17
+ * `hexagen grant check <grant-file> --tool <t> --path <p>...`: would this write
18
+ * be allowed? Signature, then window, then `checkWriteAgainstGrant`; never
19
+ * `checkGrantMode` (a client grant is propose-only, so the mode check would
20
+ * deny every patch). In a client repo (no manifest at the workspace root) a
21
+ * path outside `slice.paths`, or inside its excludes, is denied even when the
22
+ * grant allows it. Exit 0 allow, 1 deny, 2 bad input. Prints the reason, the
23
+ * workspace root and the key's path and fingerprint, never the key.
24
+ */
25
+ export declare function grantCheckCommand(options: CheckOptions): Promise<void>;
26
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/commands/grant/check.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IACnD,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AAOD;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA0G5E"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Parses a `--expires-in` value like `4h`, `30m`, `900s`, `1d` into
3
+ * milliseconds. Whole positive integers only — no fractional or compound
4
+ * durations (`1h30m`), since a grant's expiry only needs to be "roughly
5
+ * this long," not scheduled to the second.
6
+ */
7
+ export declare function parseDurationMs(input: string): number;
8
+ //# sourceMappingURL=duration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../../src/commands/grant/duration.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAerD"}
@@ -0,0 +1,2 @@
1
+ export { grantCommander, issueGrantCommand } from "./issue.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/grant/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { Command } from "commander";
2
+ interface IssueOptions {
3
+ principal: string;
4
+ agent: string;
5
+ paths?: string;
6
+ tools: string;
7
+ mode: "write" | "propose";
8
+ expiresIn: string;
9
+ contexts?: string;
10
+ maxFiles?: string;
11
+ workspaceRoot?: string;
12
+ out?: string;
13
+ keyFile?: string;
14
+ engagement?: string;
15
+ /** Test seam; defaults to `os.homedir()`. */
16
+ homeDir?: string;
17
+ /** Brownfield: consent to the writes listed in the preflight. */
18
+ yes?: boolean;
19
+ }
20
+ export declare function issueGrantCommand(options: IssueOptions): Promise<void>;
21
+ export declare const grantCommander: Command;
22
+ export {};
23
+ //# sourceMappingURL=issue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"issue.d.ts","sourceRoot":"","sources":["../../../src/commands/grant/issue.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiDpC,UAAU,YAAY;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAQD,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAsV5E;AAED,eAAO,MAAM,cAAc,SAE1B,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { Command } from "commander";
2
+ export interface KeyInitOptions {
3
+ engagement: string;
4
+ keyFile?: string;
5
+ /** Test seam; defaults to `os.homedir()`. */
6
+ homeDir?: string;
7
+ }
8
+ /**
9
+ * The only place outside repo mode that mints a grant-signing key. Writes 32
10
+ * random bytes as hex at mode 0600 (directory 0700) and refuses to overwrite:
11
+ * replacing a key silently invalidates every grant already issued under it.
12
+ * Prints the path and fingerprint, never the key.
13
+ */
14
+ export declare function grantKeyInitCommand(options: KeyInitOptions): Promise<void>;
15
+ export declare const grantKeyCommander: Command;
16
+ //# sourceMappingURL=key-init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key-init.d.ts","sourceRoot":"","sources":["../../../src/commands/grant/key-init.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAsBD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAED,eAAO,MAAM,iBAAiB,SAE7B,CAAC"}
@@ -0,0 +1,35 @@
1
+ export interface RevokeOptions {
2
+ grantFile: string;
3
+ /** ISO date-time with an offset; default now. */
4
+ at?: string;
5
+ workspaceRoot?: string;
6
+ keyFile?: string;
7
+ engagement?: string;
8
+ yes?: boolean;
9
+ /** Test seams. */
10
+ homeDir?: string;
11
+ env?: Readonly<Record<string, string | undefined>>;
12
+ now?: Date;
13
+ /** Runs after the temp file is written, before the final containment re-check and the rename. */
14
+ beforeRename?: () => Promise<void>;
15
+ }
16
+ /**
17
+ * `hexagen grant revoke <grant-file> [--at <iso>] [--yes]`: set `revoked_at`
18
+ * and re-sign with the key that verifies the grant. Refuses a grant whose
19
+ * signature does not verify under the resolved key (exit 1): it never signs
20
+ * what it cannot vouch for. Idempotent: an already-revoked grant is left
21
+ * untouched unless `--at` is earlier than the recorded time. Exit 0 done or
22
+ * already revoked, 1 not verified, 2 bad input, a held lock or no `--yes`.
23
+ * Never prints the key; prints its path and fingerprint.
24
+ *
25
+ * The grant path is resolved once. In a client repo it must be under the real
26
+ * `<root>/.hexagen/`, and that containment is re-checked on the directory
27
+ * right before the rename. Residual window: between that last check and the
28
+ * rename itself nothing is held, so an attacker who can already write inside
29
+ * `.hexagen/` and swap its ancestors in that instant can still redirect the
30
+ * rename; the guard narrows the window, it does not close it (the same
31
+ * trade-off the sidecar writers make). A `<grant>.lock` file (O_EXCL, holding
32
+ * the pid, never auto-broken) serialises concurrent revokes.
33
+ */
34
+ export declare function grantRevokeCommand(options: RevokeOptions): Promise<void>;
35
+ //# sourceMappingURL=revoke.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revoke.d.ts","sourceRoot":"","sources":["../../../src/commands/grant/revoke.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,kBAAkB;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IACnD,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,iGAAiG;IACjG,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AA4CD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,IAAI,CAAC,CAgFf"}
@@ -0,0 +1,18 @@
1
+ export interface ShowOptions {
2
+ grantFile: string;
3
+ workspaceRoot?: string;
4
+ keyFile?: string;
5
+ engagement?: string;
6
+ /** Test seams. */
7
+ homeDir?: string;
8
+ env?: Readonly<Record<string, string | undefined>>;
9
+ now?: Date;
10
+ }
11
+ /**
12
+ * `hexagen grant show <grant-file>`: the grant as the runtime reads it, plus
13
+ * whether its signature verifies. Exit 0 verified, 1 not verified, 2 bad
14
+ * input. The window (expired/revoked) is informational here; `grant check`
15
+ * enforces it. Prints the key's path and fingerprint, never the key.
16
+ */
17
+ export declare function grantShowCommand(options: ShowOptions): Promise<void>;
18
+ //# sourceMappingURL=show.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../../src/commands/grant/show.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IACnD,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAiE1E"}
@@ -0,0 +1,3 @@
1
+ /** HMAC-SHA256 (hex) over `payload`, keyed by `keyHex` (also hex). */
2
+ export declare function signGrantPayload(payload: string, keyHex: string): string;
3
+ //# sourceMappingURL=sign.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../../src/commands/grant/sign.ts"],"names":[],"mappings":"AAEA,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAIxE"}
@@ -0,0 +1,22 @@
1
+ export interface LoadedSigningKey {
2
+ readonly keyHex: string;
3
+ readonly created: boolean;
4
+ readonly path: string;
5
+ }
6
+ /**
7
+ * Reads the trust root `GrantSignatureAdapter.verify` checks against
8
+ * (`<workspaceRoot>/.hexagen/grant-signing.key`). If it doesn't exist yet,
9
+ * mints a fresh 32-byte random key and writes it — per
10
+ * `docs/kernel/GRANT.md` "No issuer exists yet": "create it ... if it
11
+ * doesn't exist; treat it like any other credential, never commit it." The
12
+ * caller is told whether a key was just created, so it can warn loudly
13
+ * (this is a secret landing on disk in a git working tree).
14
+ *
15
+ * Key creation uses exclusive (`wx`) file creation: if two `grant issue`
16
+ * invocations race on a fresh workspace, the loser's write fails with
17
+ * EEXIST and it re-reads the winner's key instead of overwriting it —
18
+ * otherwise both would sign with different keys while only one survives on
19
+ * disk, and the loser's grant would never verify.
20
+ */
21
+ export declare function loadOrCreateSigningKey(workspaceRoot: string): Promise<LoadedSigningKey>;
22
+ //# sourceMappingURL=signing-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signing-key.d.ts","sourceRoot":"","sources":["../../../src/commands/grant/signing-key.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAmDD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,gBAAgB,CAAC,CAyB3B"}
@@ -0,0 +1,45 @@
1
+ import { z } from "zod";
2
+ import type { Grant } from "@hexagen/shared";
3
+ import { type ResolvedGrantKey } from "@hexagen/shared/node/grant-key";
4
+ /** RFC 3339 date-time with a mandatory offset, and a real calendar instant (the Field Kit schema's `date-time`). */
5
+ export declare const isoDateTime: z.ZodEffects<z.ZodString, string, string>;
6
+ export type LoadedGrant = {
7
+ readonly ok: true;
8
+ readonly grant: Grant;
9
+ } | {
10
+ readonly ok: false;
11
+ readonly problem: string;
12
+ };
13
+ /** Reads and shape-checks a grant file. A failure here is bad input (exit 2), not a denial. */
14
+ export declare function loadGrantFile(file: string): Promise<LoadedGrant>;
15
+ /**
16
+ * Shape-checks already-parsed JSON against the one strict grant schema (also
17
+ * used by `hexagen evidence pack`, so there is exactly one).
18
+ */
19
+ export declare function parseGrant(json: unknown, label: string): LoadedGrant;
20
+ export interface VerifyContext {
21
+ readonly workspaceRoot: string;
22
+ readonly keyFile?: string;
23
+ readonly engagement?: string;
24
+ readonly env: Readonly<Record<string, string | undefined>>;
25
+ /** Test seam; defaults to `os.homedir()`. */
26
+ readonly homeDir?: string;
27
+ }
28
+ export interface GrantVerification {
29
+ readonly verified: boolean;
30
+ /** Why not, when not. Never contains key material. */
31
+ readonly reason?: string;
32
+ readonly key: ResolvedGrantKey;
33
+ }
34
+ /** The same resolution `hexagen grant issue` and the MCP server use. */
35
+ export declare function resolveVerifyKey(ctx: VerifyContext): ResolvedGrantKey;
36
+ /**
37
+ * Verifies `grant.signature` (HMAC-SHA256 hex over the canonical payload)
38
+ * against the key the shared resolver finds. Fails closed on every way trust
39
+ * can fail to be established: no signature, a malformed one, no key location,
40
+ * a missing or weak key, or a mismatch. When the operator overrode the key
41
+ * (`--key-file` / `--engagement`) and it fails, the message also names the key
42
+ * the MCP server would use without the override, with both fingerprints.
43
+ */
44
+ export declare function verifyGrantSignature(grant: Grant, ctx: VerifyContext): GrantVerification;
45
+ //# sourceMappingURL=verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/commands/grant/verify.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,gCAAgC,CAAC;AAGxC,oHAAoH;AACpH,eAAO,MAAM,WAAW,2CASrB,CAAC;AAmBJ,MAAM,MAAM,WAAW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/**
4
+ * Which workspace root the grant commands (issue, show, check) work from. `findWorkspaceRoot` walks up to ANY parent manifest,
5
+ * so a client repo checked out beneath a monorepo would inherit its repo mode
6
+ * (and its key). The git toplevel is the repo boundary: when discovery lands
7
+ * outside it, the toplevel wins. A manifest at or below the toplevel (a HexaGen
8
+ * project inside a larger repo) stays the root. `--workspace-root` overrides.
9
+ */
10
+ export declare function discoverWorkspaceRoot(workspaceRootOption?: string): string;
11
+ //# sourceMappingURL=workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/commands/grant/workspace.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAIxC,wBAAsB,SAAS,CAC7B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAY5B;AAgBD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,mBAAmB,CAAC,EAAE,MAAM,GAAG,MAAM,CAmB1E"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Parse JSON with comments and trailing commas (what a `tsconfig.json` is),
3
+ * without a dependency. Returns undefined when the text is not parseable.
4
+ */
5
+ export declare function parseJsonc(text: string): unknown;
6
+ //# sourceMappingURL=jsonc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonc.d.ts","sourceRoot":"","sources":["../../../../src/commands/observe/imports/jsonc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAwDhD"}
@@ -0,0 +1,45 @@
1
+ import { type UnresolvedReason, type WorkspacePackage } from "./resolve.js";
2
+ /** Extensions the pass reads. Every other counted language is unread. */
3
+ export declare const READ_EXTENSIONS: ReadonlySet<string>;
4
+ export declare const DEFAULT_MAX_IMPORT_FILES = 20000;
5
+ export declare const DEFAULT_MAX_IMPORT_BYTES: number;
6
+ export declare const DEFAULT_MAX_IMPORT_MS = 30000;
7
+ /** Only files up to this size are read; a larger one is noted and skipped. */
8
+ export declare const MAX_FILE_BYTES: number;
9
+ /** A tsconfig `extends` chain is followed this many levels past the nearest file. */
10
+ export declare const MAX_EXTENDS_DEPTH = 5;
11
+ export interface ImportPassOptions {
12
+ root: string;
13
+ /** Repo-relative walked files. */
14
+ files: readonly string[];
15
+ packages: readonly WorkspacePackage[];
16
+ maxFiles: number;
17
+ maxBytes: number;
18
+ maxMs: number;
19
+ now: () => number;
20
+ start: number;
21
+ notes: string[];
22
+ /** Per-file read limit; defaults to MAX_FILE_BYTES. A test seam, not a flag. */
23
+ maxFileBytes?: number;
24
+ }
25
+ export interface EdgeRow {
26
+ from: string;
27
+ to: string;
28
+ specifier: string;
29
+ }
30
+ export interface UnresolvedRow {
31
+ from: string;
32
+ specifier: string;
33
+ reason: UnresolvedReason;
34
+ }
35
+ export type ImportPassResult = {
36
+ collected: true;
37
+ edges: EdgeRow[];
38
+ unresolved: UnresolvedRow[];
39
+ } | {
40
+ collected: false;
41
+ reason: string;
42
+ };
43
+ export declare function isReadable(file: string): boolean;
44
+ export declare function runImportPass(options: ImportPassOptions): Promise<ImportPassResult>;
45
+ //# sourceMappingURL=pass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pass.d.ts","sourceRoot":"","sources":["../../../../src/commands/observe/imports/pass.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AAOtB,yEAAyE;AACzE,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,MAAM,CAS9C,CAAC;AAEH,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAC/C,eAAO,MAAM,wBAAwB,QAAoB,CAAC;AAC1D,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAC5C,8EAA8E;AAC9E,eAAO,MAAM,cAAc,QAAc,CAAC;AAC1C,qFAAqF;AACrF,eAAO,MAAM,iB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