@hexagen-monaco/sync 0.12.1 → 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 (98) hide show
  1. package/README.md +429 -0
  2. package/dist/cli.js +6250 -401
  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/root-file-templates.d.ts +5 -4
  81. package/dist/generators/root-file-templates.d.ts.map +1 -1
  82. package/dist/generators/root-files.d.ts.map +1 -1
  83. package/dist/index.js +351 -36
  84. package/dist/index.js.map +1 -1
  85. package/dist/templates/agents-md/findings/0001-session-log-grows-unbounded.md +35 -0
  86. package/dist/templates/ci-github-actions/findings/0001-ci-runners-have-no-zsh.md +34 -0
  87. package/dist/templates/orchestration/README.md +88 -0
  88. package/dist/templates/orchestration/files/.agents/skills/orchestrate-wave/SKILL.md +511 -0
  89. package/dist/templates/orchestration/files/.agents/skills/orchestrate-wave/references/briefs.md +178 -0
  90. package/dist/templates/orchestration/files/.agents/skills/orchestrate-wave/references/rationale.md +520 -0
  91. package/dist/templates/orchestration/files/.agents/skills/orchestrate-wave/scripts/wave-event.sh +17 -0
  92. package/dist/templates/orchestration/files/.github/workflows/gate.yml +66 -0
  93. package/dist/templates/orchestration/findings/0001-relative-runbook-links-escape-the-skill.md +48 -0
  94. package/dist/templates/orchestration/findings/0002-interpolation-hazard-in-graphql-line.md +46 -0
  95. package/dist/templates/orchestration/manifest.json +41 -0
  96. package/dist/types/manifest/monorepo.d.ts +4 -0
  97. package/dist/types/manifest/monorepo.d.ts.map +1 -1
  98. package/package.json +1 -1
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Specifier resolution for the import pass. Pure: it sees only the walked
3
+ * file set, the workspace packages and a tsconfig lookup.
4
+ *
5
+ * Order, per specifier: (1) relative, (2) workspace package name,
6
+ * (3) the nearest tsconfig `paths` / `baseUrl`, (4) `#` package imports.
7
+ * Anything no step claims is external (a node builtin or a dependency).
8
+ */
9
+ export type UnresolvedReason = "not-found" | "exports-subpath" | "non-literal" | "outside-repo" | "package-imports" | "not-scanned";
10
+ export type Resolution = {
11
+ kind: "edge";
12
+ to: string;
13
+ } | {
14
+ kind: "unresolved";
15
+ reason: UnresolvedReason;
16
+ } | {
17
+ kind: "external";
18
+ };
19
+ export interface WorkspacePackage {
20
+ readonly name: string;
21
+ /** "." for the repo root, else a repo-relative directory. */
22
+ readonly root: string;
23
+ }
24
+ /** A tsconfig reduced to what resolution needs. Paths are repo-relative, "" is the root. */
25
+ export interface EffectiveTsconfig {
26
+ /** Absolute-in-repo directory the `baseUrl` points at, or undefined. */
27
+ readonly baseUrl?: string;
28
+ /** Directory the `paths` targets are relative to. */
29
+ readonly pathsBase?: string;
30
+ readonly paths?: Readonly<Record<string, readonly string[]>>;
31
+ }
32
+ export interface ResolveContext {
33
+ readonly files: ReadonlySet<string>;
34
+ readonly packages: readonly WorkspacePackage[];
35
+ /** The effective tsconfig for the directory of the importing file. */
36
+ readonly tsconfigFor: (fileDir: string) => EffectiveTsconfig | null;
37
+ }
38
+ export declare const RESOLVE_EXTENSIONS: readonly [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs", ".json"];
39
+ /** Join and normalize; null when the result leaves the repo root. "" is the root. */
40
+ export declare function joinInRepo(dir: string, rel: string): string | null;
41
+ /** Find the file a repo-relative path names, with extension and index rules. */
42
+ export declare function tryFile(files: ReadonlySet<string>, p: string, dirOnly?: boolean): string | null;
43
+ export declare function makeResolver(ctx: ResolveContext): (spec: string, fromFile: string) => Resolution;
44
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","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lE;AAED,gFAAgF;AAChF,wBAAgB,OAAO,CACrB,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAC1B,CAAC,EAAE,MAAM,EACT,OAAO,UAAQ,GACd,MAAM,GAAG,IAAI,CAmBf;AA2HD,wBAAgB,YAAY,CAC1B,GAAG,EAAE,cAAc,GAClB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,UAAU,CAiBhD"}
@@ -0,0 +1,30 @@
1
+ export type SafeRead = {
2
+ ok: true;
3
+ text: string;
4
+ size: number;
5
+ } | {
6
+ ok: false;
7
+ why: "unreadable" | "too-large";
8
+ };
9
+ /**
10
+ * Read a regular file without following a symlink in its last component, so a
11
+ * file swapped for a link after the walk is refused rather than read.
12
+ *
13
+ * Where `O_NOFOLLOW` exists the file is opened with it; elsewhere (Windows) the
14
+ * path is `lstat`ed first and a symlink refused. The size limit is decided on
15
+ * the opened handle (`fstat`), and the bytes are read through that handle, so
16
+ * the size checked is the size read. Parent directories are not re-checked: the
17
+ * walk never follows a symlinked directory, and a swap of one is outside this
18
+ * tool's threat model.
19
+ */
20
+ export declare function safeReadText(abs: string, maxBytes: number): Promise<SafeRead>;
21
+ export type SafeReadBytes = {
22
+ ok: true;
23
+ bytes: Buffer;
24
+ } | {
25
+ ok: false;
26
+ why: "unreadable" | "too-large";
27
+ };
28
+ /** `safeReadText`'s twin that returns the exact bytes (for files that are hashed or signed). */
29
+ export declare function safeReadBytes(abs: string, maxBytes: number): Promise<SafeReadBytes>;
30
+ //# sourceMappingURL=safe-read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safe-read.d.ts","sourceRoot":"","sources":["../../../../src/commands/observe/imports/safe-read.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAChB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,YAAY,GAAG,WAAW,CAAA;CAAE,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,QAAQ,CAAC,CAqCnB;AAED,MAAM,MAAM,aAAa,GACrB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC3B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,YAAY,GAAG,WAAW,CAAA;CAAE,CAAC;AAEnD,gGAAgG;AAChG,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,aAAa,CAAC,CAiCxB"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * A small lexical scanner for JS/TS module specifiers. It is a tokenizer, not
3
+ * a parser: it knows comments, strings, template literals (with nested
4
+ * `${...}`), regex literals and a few keywords, and nothing else. It never
5
+ * builds a syntax tree and never touches the TypeScript compiler API.
6
+ *
7
+ * Cost is linear in the input: a regex attempt that fails to close remembers
8
+ * where its line ends, so no later attempt on that line rescans it.
9
+ *
10
+ * Known limits, accepted for a bounded pass:
11
+ * - JSX text containing an apostrophe opens a string that is closed at the end
12
+ * of the line.
13
+ * - A regex literal right after `)` (for example `if (x) /re/.test(y)`) is read
14
+ * as division, so its contents are tokenized as code and can yield a phantom
15
+ * specifier.
16
+ * - A wrong regex or string guess can swallow a backtick and flip template
17
+ * state until the next backtick, so a mistake can reach past its own line.
18
+ * - After `>` a `/` starts a regex, because `=>` tokenizes as `=` then `>` and
19
+ * `x => /re/.test(x)` must work. After `<` it never does, since `</tag>` is
20
+ * the usual case.
21
+ * - A postfix `++`/`--` is read as two operators, so the `/` after it starts a
22
+ * regex attempt. If that attempt reads an unbalanced `[` from a divisor
23
+ * string, the line guard can then hide a later quote-bearing regex on the
24
+ * same line: `x = i++ / "["; y = /it's/.test(s); import a from './a.js';`.
25
+ * - A block statement after a semicolon-less non-literal `require(x)` (ASI
26
+ * only, `const m = require(name)\n{ … }`) is read as a method definition
27
+ * and the call is dropped.
28
+ */
29
+ export interface ScannedSpecifier {
30
+ /** The literal specifier, or null when the specifier is not a plain string. */
31
+ readonly specifier: string | null;
32
+ readonly kind: "import" | "export-from" | "dynamic-import" | "require";
33
+ }
34
+ type Tok = {
35
+ k: "id";
36
+ v: string;
37
+ inTpl: boolean;
38
+ } | {
39
+ k: "str";
40
+ v: string;
41
+ escaped: boolean;
42
+ inTpl: boolean;
43
+ } | {
44
+ k: "opaque";
45
+ inTpl: boolean;
46
+ } | {
47
+ k: "p";
48
+ v: string;
49
+ inTpl: boolean;
50
+ };
51
+ /** Pass 1: text to tokens. Comments are dropped; template contents are opaque. */
52
+ export declare function tokenize(text: string): Tok[];
53
+ /**
54
+ * Scan `text` and return every module specifier found outside comments and
55
+ * template literals, in source order.
56
+ */
57
+ export declare function scanSpecifiers(text: string): ScannedSpecifier[];
58
+ export {};
59
+ //# sourceMappingURL=scan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../../src/commands/observe/imports/scan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,+EAA+E;IAC/E,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,aAAa,GAAG,gBAAgB,GAAG,SAAS,CAAC;CACxE;AAED,KAAK,GAAG,GACJ;IAAE,CAAC,EAAE,IAAI,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GACtC;IAAE,CAAC,EAAE,KAAK,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GACzD;IAAE,CAAC,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAC/B;IAAE,CAAC,EAAE,GAAG,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AA+B1C,kFAAkF;AAClF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,EAAE,CAwH5C;AAsBD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAyE/D"}
@@ -0,0 +1,59 @@
1
+ import { Command } from "commander";
2
+ import { ObservedReport } from "@hexagen/shared";
3
+ import { DEFAULT_MAX_IMPORT_BYTES, DEFAULT_MAX_IMPORT_FILES, DEFAULT_MAX_IMPORT_MS } from "./imports/pass.js";
4
+ /**
5
+ * `hexagen observe`: a read-only scan that reports what a repo already
6
+ * contains, in the repo's own names. It never calls adopt, bootstrap, sync or
7
+ * hexagen-lint, and the only thing it can write is `--out`, which must
8
+ * resolve under `<root>/.hexagen/`.
9
+ *
10
+ * The import pass (`edges`, `unresolved`) is a bounded lexical scan of
11
+ * JS/TS files; see `./imports/`.
12
+ */
13
+ export declare const DEFAULT_MAX_FILES = 50000;
14
+ export declare const DEFAULT_MAX_MS = 30000;
15
+ export { DEFAULT_MAX_IMPORT_BYTES, DEFAULT_MAX_IMPORT_FILES, DEFAULT_MAX_IMPORT_MS, };
16
+ export declare function extOf(file: string): string;
17
+ export interface ObserveOptions {
18
+ root: string;
19
+ /** `--dont-touch` prefixes, reported as given. */
20
+ dontTouch?: string[];
21
+ maxFiles?: number;
22
+ maxMs?: number;
23
+ /** Import pass caps; the pass has its own clock, started when it begins. */
24
+ maxImportFiles?: number;
25
+ maxImportBytes?: number;
26
+ maxImportMs?: number;
27
+ /** Per-file read limit for the import pass (default 1 MiB); a test seam. */
28
+ maxImportFileBytes?: number;
29
+ /** Clock seam for the time cap. */
30
+ now?: () => number;
31
+ }
32
+ /**
33
+ * Remove credentials, query and fragment from a URL remote. scp-like remotes
34
+ * (`git@host:o/r`) are not URLs and go through the regex fallback.
35
+ */
36
+ export declare function stripCredentials(remote: string): string;
37
+ export declare class ObserveError extends Error {
38
+ }
39
+ export declare function readRepo(root: string): {
40
+ remote?: string;
41
+ commit: string;
42
+ };
43
+ export declare function observe(options: ObserveOptions): Promise<ObservedReport>;
44
+ export interface RunObserveOptions extends ObserveOptions {
45
+ out?: string;
46
+ yes?: boolean;
47
+ /** Test seam: the temp file path for a given target. */
48
+ tmpPath?: (target: string) => string;
49
+ }
50
+ export interface RunObserveResult {
51
+ exitCode: number;
52
+ /** The report JSON, when it is meant for stdout. */
53
+ stdout?: string;
54
+ /** Preflight and error lines, in order, for stderr. */
55
+ messages: string[];
56
+ }
57
+ export declare function runObserve(options: RunObserveOptions): Promise<RunObserveResult>;
58
+ export declare const observeCommander: Command;
59
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/observe/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAwB,MAAM,WAAW,CAAC;AAM1D,OAAO,EAEL,cAAc,EAEf,MAAM,iBAAiB,CAAC;AASzB,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EAGtB,MAAM,mBAAmB,CAAC;AAI3B;;;;;;;;GAQG;AAEH,eAAO,MAAM,iBAAiB,QAAS,CAAC;AACxC,eAAO,MAAM,cAAc,QAAS,CAAC;AACrC,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,GACtB,CAAC;AAiEF,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1C;AAMD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,EAA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parent` itself or lies beneath it, judged on the same
4
+ * canonical text as `samePath` (separators, case on win32, trailing slashes).
5
+ * Both inputs must already be resolved with `fs.realpath.native`. Pure, so a
6
+ * Windows decision can be tested on any OS.
7
+ */
8
+ export declare function isSameOrInside(parent: string, child: string, platform?: string): boolean;
9
+ //# sourceMappingURL=same-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"same-path.d.ts","sourceRoot":"","sources":["../../../src/commands/observe/same-path.ts"],"names":[],"mappings":"AAaA,wBAAgB,QAAQ,CACtB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,QAAQ,GAAE,MAAyB,GAClC,OAAO,CAET;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,MAAyB,GAClC,OAAO,CAIT"}
@@ -0,0 +1,29 @@
1
+ /** Never descended into. `.hexagen` is observe's own output directory. */
2
+ export declare const SKIP_DIRS: ReadonlySet<string>;
3
+ export interface WalkLimits {
4
+ readonly maxFiles: number;
5
+ readonly maxMs: number;
6
+ readonly now: () => number;
7
+ /** When the deadline started; defaults to the start of the walk. */
8
+ readonly start?: number;
9
+ }
10
+ export interface WalkResult {
11
+ /** Repo-relative POSIX paths of non-ignored regular files, sorted. */
12
+ readonly files: string[];
13
+ /** Repo-relative POSIX paths of walked directories (not the root), sorted. */
14
+ readonly dirs: string[];
15
+ /** Gitignored directories named `dist` or `build`, with a trailing `/`. */
16
+ readonly ignoredBuildDirs: string[];
17
+ /** Non-fatal observations (unreadable directories, skipped entries). */
18
+ readonly notes: string[];
19
+ /** The reason the walk stopped early, or null when it finished. */
20
+ readonly truncated: string | null;
21
+ }
22
+ export declare function timeCapReason(maxMs: number): string;
23
+ /**
24
+ * Walk `root` without following symlinks. Skips VCS, vendored and dependency
25
+ * directories, and honours the root `.gitignore` and any nested `.gitignore`.
26
+ * Ignored directories are not descended into.
27
+ */
28
+ export declare function walk(root: string, limits: WalkLimits): Promise<WalkResult>;
29
+ //# sourceMappingURL=walk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../../../src/commands/observe/walk.ts"],"names":[],"mappings":"AASA,0EAA0E;AAC1E,eAAO,MAAM,SAAS,EAAE,WAAW,CAAC,MAAM,CAUxC,CAAC;AAEH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,MAAM,CAAC;IAC3B,oEAAoE;IACpE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACzB,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IACzB,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IACxB,2EAA2E;IAC3E,QAAQ,CAAC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IACpC,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IACzB,mEAAmE;IACnE,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;GAIG;AACH,wBAAsB,IAAI,CACxB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,UAAU,CAAC,CAkGrB"}
@@ -0,0 +1,68 @@
1
+ import { Contract, ObservedReport, Slice } from "@hexagen/shared";
2
+ /** Result shape shared by the slice and contract commands. */
3
+ export interface CommandResult {
4
+ /** 0 clean/ok, 1 drift or violation, 2 bad input or refused. */
5
+ exitCode: 0 | 1 | 2;
6
+ /** Status lines, printed to stderr. */
7
+ messages: string[];
8
+ /** The command's own output, printed to stdout. */
9
+ stdout?: string;
10
+ }
11
+ /** A refusal, bad input or failed precondition: exit 2. */
12
+ export declare class UsageError extends Error {
13
+ }
14
+ /** A sidecar file that does not exist (a missing slice, observed report or contract). */
15
+ export declare class NotFoundError extends UsageError {
16
+ }
17
+ /** Turn a thrown precondition failure into an exit-2 result. */
18
+ export declare function asResult(e: unknown, messages: string[]): CommandResult;
19
+ export declare const SIDECAR_ENTRY = ".hexagen/";
20
+ export { prefixHasTarget, sliceEntryOf, targetInSlice, underPrefix, } from "@hexagen/shared";
21
+ export declare function git(root: string, args: string[]): string | null;
22
+ /** Tracked and untracked-but-not-ignored files, repo-relative. */
23
+ export declare function listWorkTreeFiles(root: string): string[];
24
+ /** True when `commit` names a commit object in the repo. */
25
+ export declare function commitExists(root: string, commit: string): boolean;
26
+ /** True when `ancestor` is `descendant` or one of its ancestors. */
27
+ export declare function isAncestor(root: string, ancestor: string, descendant: string): boolean;
28
+ export declare function headCommit(root: string): string | null;
29
+ /** Files changed between `commit` and HEAD, restricted to the pathspecs. */
30
+ export declare function changedSince(root: string, commit: string, pathspecs: readonly string[]): string[] | null;
31
+ export declare const slicePath: (root: string) => string;
32
+ export declare const observedPath: (root: string) => string;
33
+ export declare const contractPath: (root: string) => string;
34
+ /** Every command works from the repo top level, never a subdirectory. */
35
+ export declare function assertTopLevel(root: string): void;
36
+ export declare function loadSlice(root: string): Promise<Slice>;
37
+ export declare function loadObserved(root: string): Promise<ObservedReport>;
38
+ export { isSuppressionExpired } from "@hexagen/shared";
39
+ /** The contract, or undefined when none exists yet. */
40
+ export declare function loadContract(root: string): Promise<Contract | undefined>;
41
+ /**
42
+ * Stale-input checks on `observed.json` against the slice (plan BW5 task 3).
43
+ * Returns hard problems (exit 2) and warnings. `observed.repo.commit` must be
44
+ * the slice's `repo.commit` or a descendant of it (the report is "newer" than
45
+ * the slice's commit); a different HEAD is a warning, and a problem with
46
+ * `strict`.
47
+ */
48
+ export declare function staleInputs(root: string, slice: Slice, observed: ObservedReport, strict: boolean): {
49
+ problems: string[];
50
+ warnings: string[];
51
+ };
52
+ /**
53
+ * Preflight for writes into the sidecar: names every file that will be
54
+ * written, adds the exclude file when it would change, and requires `--yes`.
55
+ * Throws `UsageError` (exit 2) without `--yes`. Returns whether the exclude
56
+ * must be applied.
57
+ */
58
+ export declare function preflight(root: string, writes: readonly string[], yes: boolean | undefined, messages: string[]): Promise<{
59
+ applyExclude: boolean;
60
+ }>;
61
+ /**
62
+ * Run `fn` holding `.hexagen/contract.json.lock`, created with O_EXCL and
63
+ * holding this pid. A lock that is already there exits 2; it is never broken
64
+ * automatically. The lock is removed in a `finally`. When `.hexagen` does not
65
+ * exist yet nothing can be locked and `fn` runs (it fails on the missing slice).
66
+ */
67
+ export declare function withContractLock<T>(root: string, fn: () => Promise<T>): Promise<T>;
68
+ //# sourceMappingURL=brownfield-sidecar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brownfield-sidecar.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/brownfield-sidecar.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,QAAQ,EACR,cAAc,EACd,KAAK,EAEN,MAAM,iBAAiB,CAAC;AAMzB,8DAA8D;AAC9D,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,2DAA2D;AAC3D,qBAAa,UAAW,SAAQ,KAAK;CAAG;AAExC,yFAAyF;AACzF,qBAAa,aAAc,SAAQ,UAAU;CAAG;AAEhD,gEAAgE;AAChE,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,aAAa,CAWtE;AAED,eAAO,MAAM,aAAa,cAAc,CAAC;AAGzC,OAAO,EACL,eAAe,EACf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EAAE,MAAM,GACX,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAuB/B;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,OAAO,GACd;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAqB5C;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,GAAG,EAAE,OAAO,GAAG,SAAS,EACxB,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC;IAAE,YAAY,EAAE,OAAO,CAAA;CAAE,CAAC,CAcpC;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAwBZ"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Keep a sidecar directory out of `git status` without touching the client's
3
+ * tracked `.gitignore` (plan BW-D1). The exclude file is whatever
4
+ * `git rev-parse --git-path info/exclude` prints, which is correct in linked
5
+ * worktrees (the common dir's file), submodules and `--separate-git-dir`
6
+ * clones, where `.git` is a file rather than a directory.
7
+ *
8
+ * `git add -f` can still stage an excluded path; callers say so.
9
+ */
10
+ export declare class GitExcludeError extends Error {
11
+ }
12
+ /** `p` with its nearest existing ancestor resolved through symlinks. */
13
+ export declare function realpathOfExistingAncestor(p: string): Promise<string>;
14
+ /**
15
+ * Absolute path of the repo's `info/exclude`. Refuses a path that resolves
16
+ * (through symlinks) outside the repo's git dir, common dir or work tree.
17
+ */
18
+ export declare function resolveExcludeFile(root: string): Promise<string>;
19
+ /**
20
+ * Read-only twin of `ensureExcluded`: true when it would append `entry`.
21
+ * Lets a caller list the write in a preflight before making it.
22
+ */
23
+ export declare function excludeWouldChange(root: string, entry: string): Promise<{
24
+ file: string;
25
+ changes: boolean;
26
+ }>;
27
+ /**
28
+ * Append `entry` (e.g. `.hexagen/`) to the repo's exclude file if absent.
29
+ * Idempotent. Returns the file and whether anything was written; any failure
30
+ * throws `GitExcludeError` so the caller can stop before writing its own file.
31
+ */
32
+ export declare function ensureExcluded(root: string, entry: string): Promise<{
33
+ file: string;
34
+ wrote: boolean;
35
+ }>;
36
+ //# sourceMappingURL=git-exclude.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-exclude.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/git-exclude.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AAEH,qBAAa,eAAgB,SAAQ,KAAK;CAAG;AAe7C,wEAAwE;AACxE,wBAAsB,0BAA0B,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAY3E;AAOD;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAwBtE;AAYD;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAa7C;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,CAmB3C"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * A small glob-to-RegExp translator for `hexagen observe`.
3
+ *
4
+ * Supports `*` (within a segment), `**` (across segments), `?`, `[...]`
5
+ * classes, `{a,b}` alternation and backslash escapes. Everything else is
6
+ * matched literally. Deliberately not `detectWorkspaces`, which throws on
7
+ * anything but a trailing `/*`.
8
+ *
9
+ * Patterns are matched against repo-relative POSIX paths with no leading or
10
+ * trailing slash.
11
+ *
12
+ * Known limits (they fail open on match, and never crash):
13
+ * - `packages/**` matches what is inside `packages`, not `packages` itself.
14
+ * - `a**` (a `**` that is not a whole segment) behaves like `a.*`, so it can
15
+ * cross separators.
16
+ * - A `]` as the first class member (`[]]`) is not supported.
17
+ * - Extglob (`+(a|b)`, `@(a)`, `!(a)`) is not supported; the characters are
18
+ * matched literally.
19
+ * - A pattern that does not compile (for example `[z-a]`) yields null and the
20
+ * caller skips that one pattern with a note.
21
+ */
22
+ /** Translate a glob body to a regex source (no anchors). */
23
+ export declare function globToRegexSource(glob: string, braces?: boolean): string;
24
+ /**
25
+ * Anchored regex for a whole-path glob match, or null when the pattern cannot
26
+ * be compiled (client-controlled text must never crash the scan).
27
+ */
28
+ export declare function globToRegExp(glob: string): RegExp | null;
29
+ //# sourceMappingURL=glob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/glob.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH,4DAA4D;AAC5D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,UAAO,GAAG,MAAM,CA0DrE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMxD"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Ordered rules from a gitignore-style file; the last matching rule wins.
3
+ * Also used for `.gitattributes` patterns (same pattern syntax), where a
4
+ * negated rule stands for "attribute unset".
5
+ */
6
+ export interface IgnoreRule {
7
+ readonly negated: boolean;
8
+ readonly dirOnly: boolean;
9
+ readonly regex: RegExp;
10
+ /** The pattern as written, for literal-path extraction. */
11
+ readonly pattern: string;
12
+ /** True when the pattern is anchored (leading or inner `/`). */
13
+ readonly anchored: boolean;
14
+ }
15
+ export declare function parseIgnoreLine(raw: string, negatedByCaller?: boolean, notes?: string[], label?: string): IgnoreRule | null;
16
+ export declare function parseIgnoreFile(text: string, notes?: string[], label?: string): IgnoreRule[];
17
+ /**
18
+ * The verdict of the last matching rule: true (ignored/set), false (negated),
19
+ * or undefined when no rule matched.
20
+ */
21
+ export declare function verdict(rules: readonly IgnoreRule[], relPath: string, isDir: boolean): boolean | undefined;
22
+ /** A rule set that applies below `base` (repo-relative, "" for the root). */
23
+ export interface ScopedRules {
24
+ readonly base: string;
25
+ readonly rules: readonly IgnoreRule[];
26
+ }
27
+ /**
28
+ * Evaluate nested gitignore files shallow to deep; the deepest decisive rule
29
+ * wins, as in git. `relPath` is repo-relative.
30
+ */
31
+ export declare function isIgnored(scopes: readonly ScopedRules[], relPath: string, isDir: boolean): boolean;
32
+ //# sourceMappingURL=ignore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ignore.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/ignore.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,eAAe,UAAQ,EACvB,KAAK,CAAC,EAAE,MAAM,EAAE,EAChB,KAAK,SAAgB,GACpB,UAAU,GAAG,IAAI,CA8BnB;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,EAAE,EAChB,KAAK,SAAgB,GACpB,UAAU,EAAE,CAOd;AAED;;;GAGG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,OAAO,GACb,OAAO,GAAG,SAAS,CAOrB;AAED,6EAA6E;AAC7E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;CACvC;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,SAAS,WAAW,EAAE,EAC9B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,OAAO,GACb,OAAO,CAUT"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Resolve `--out` against the root and require it to land strictly under
3
+ * `<root>/.hexagen/`, including through symlinks. Returns the absolute path.
4
+ */
5
+ export declare function resolveSidecarOut(root: string, out: string): Promise<string | null>;
6
+ //# sourceMappingURL=sidecar-out.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sidecar-out.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/sidecar-out.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAaxB"}
@@ -0,0 +1,2 @@
1
+ export { SidecarFileExistsError, writeFileExclusive, writeFileReplace, } from "@hexagen/shared/node/sidecar-write";
2
+ //# sourceMappingURL=sidecar-write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sidecar-write.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/sidecar-write.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,oCAAoC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { Command } from "commander";
2
+ import { type CommandResult } from "../shared/brownfield-sidecar.js";
3
+ export interface SliceRootOptions {
4
+ /** Repo top level; the CLI defaults it to cwd and never searches upward. */
5
+ root: string;
6
+ }
7
+ export interface SliceInitOptions extends SliceRootOptions {
8
+ paths: string[];
9
+ exclude?: string[];
10
+ id?: string;
11
+ by?: string;
12
+ yes?: boolean;
13
+ }
14
+ export declare function runSliceInit(options: SliceInitOptions): Promise<CommandResult>;
15
+ export declare function runSliceShow(options: SliceRootOptions): Promise<CommandResult>;
16
+ export interface SliceCheckOptions extends SliceRootOptions {
17
+ strict?: boolean;
18
+ /** Fail (exit 1) on edges that cross the slice boundary. */
19
+ closed?: boolean;
20
+ }
21
+ export declare function runSliceCheck(options: SliceCheckOptions): Promise<CommandResult>;
22
+ export declare const sliceCommander: Command;
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/slice/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBpC,OAAO,EAYL,KAAK,aAAa,EACnB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AASD,wBAAsB,YAAY,CAChC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,aAAa,CAAC,CA8DxB;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,aAAa,CAAC,CAYxB;AAED,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,aAAa,CAAC,CAsFxB;AAWD,eAAO,MAAM,cAAc,SAE1B,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { BUNDLE_FILE_ROLES } from "@hexagen/shared";
2
+ /**
3
+ * What `hexagen workbook export` may ever put in a bundle or stage into the
4
+ * client's history (plan BW-D1, §4.8). It is an allow-list: a file that is not
5
+ * named here is never read, so a new secret file cannot slip in by accident.
6
+ * The key and env pattern from BW0 is an independent second check.
7
+ */
8
+ export type BundleRole = (typeof BUNDLE_FILE_ROLES)[number];
9
+ export interface AllowedFile {
10
+ /** Path relative to `.hexagen/` (forward slashes). */
11
+ readonly source: string;
12
+ /** Path inside the bundle. */
13
+ readonly bundlePath: string;
14
+ readonly role: BundleRole;
15
+ }
16
+ /** True for a key file, anything under a `keys/` directory, or an env file. */
17
+ export declare function isForbiddenPath(p: string): boolean;
18
+ /**
19
+ * The allow-list entry for a path relative to `.hexagen/`, or null. The
20
+ * forbidden-pattern check runs on the source path and again on the bundle path.
21
+ */
22
+ export declare function allowListEntry(sourceRel: string, options?: {
23
+ readonly bundleOnly?: boolean;
24
+ }): AllowedFile | null;
25
+ /** True when `bundlePath` may be named inside a bundle: the allow-list, the derived verdicts and the top-level tip, and never a key or env path. */
26
+ export declare function bundlePathAllowed(bundlePath: string): boolean;
27
+ //# sourceMappingURL=allow-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allow-list.d.ts","sourceRoot":"","sources":["../../../src/commands/workbook/allow-list.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EAElB,MAAM,iBAAiB,CAAC;AAEzB;;;;;GAKG;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAqB5D,MAAM,WAAW,WAAW;IAC1B,sDAAsD;IACtD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8BAA8B;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAElD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GAC9C,WAAW,GAAG,IAAI,CAcpB;AAED,oJAAoJ;AACpJ,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAM7D"}
@@ -0,0 +1,41 @@
1
+ export interface WorkbookExportOptions {
2
+ /** Repo root; `.hexagen/` lives here. Never searched upward. */
3
+ readonly root: string;
4
+ /** Bundle path, under `<root>/.hexagen/` and not under `evidence/`. */
5
+ readonly out?: string;
6
+ /** Stage mode: allow-listed files to `git add -f` into the client's history. */
7
+ readonly stage?: readonly string[];
8
+ /** Confirms the staging (stage mode only). */
9
+ readonly yes?: boolean;
10
+ readonly keyFile?: string;
11
+ readonly engagement?: string;
12
+ readonly env?: Readonly<Record<string, string | undefined>>;
13
+ /** Test seam; defaults to `os.homedir()`. */
14
+ readonly homeDir?: string;
15
+ readonly now?: () => Date;
16
+ /** Test seam: runs after the temporary pack was written, before it is read back. */
17
+ readonly afterPack?: (zipPath: string) => Promise<void>;
18
+ /** Test seam: runs after a file was validated, before it is opened. */
19
+ readonly afterValidate?: (file: string) => Promise<void>;
20
+ /** Test seam: runs after the stage files were read, before the preview is computed. */
21
+ readonly beforePreview?: () => Promise<void>;
22
+ /** Test seam: runs after the stage preview, before anything is staged. */
23
+ readonly beforeStage?: () => Promise<void>;
24
+ }
25
+ export interface WorkbookExportResult {
26
+ /** 0 done; 1 the evidence or a grant is invalid (nothing written); 2 usage, refusal or precondition. */
27
+ readonly exitCode: 0 | 1 | 2;
28
+ readonly messages: readonly string[];
29
+ /** Absolute path of the bundle, when one was written. */
30
+ readonly bundle?: string;
31
+ /** Repo-relative paths staged (stage mode with --yes). */
32
+ readonly staged?: readonly string[];
33
+ }
34
+ /**
35
+ * `hexagen workbook export`: writes the workbook bundle (plan §4.8) from an
36
+ * allow-list, or, with `--stage`, stages exactly the named allow-listed files
37
+ * into the client's history after showing the diff (BW-D1). It never touches
38
+ * the client's working tree.
39
+ */
40
+ export declare function runWorkbookExport(options: WorkbookExportOptions): Promise<WorkbookExportResult>;
41
+ //# sourceMappingURL=export.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../src/commands/workbook/export.ts"],"names":[],"mappings":"AAqCA,MAAM,WAAW,qBAAqB;IACpC,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,gFAAgF;IAChF,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,8CAA8C;IAC9C,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,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,oFAAoF;IACpF,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,uEAAuE;IACvE,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,uFAAuF;IACvF,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,oBAAoB;IACnC,wGAAwG;IACxG,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,yDAAyD;IACzD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,0DAA0D;IAC1D,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAisBD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CA4B/B"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare const workbookCommander: Command;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/workbook/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,iBAAiB,SAE7B,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Reads a store-method zip written by `writeZipStore` (the evidence pack's
3
+ * output). It reads only what that writer produces: stored entries, sizes in
4
+ * the central directory. Anything else throws.
5
+ */
6
+ export declare function readZipStore(buf: Buffer): Map<string, Buffer>;
7
+ //# sourceMappingURL=zip-read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zip-read.d.ts","sourceRoot":"","sources":["../../../src/commands/workbook/zip-read.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAwB7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"fs-utils.d.ts","sourceRoot":"","sources":["../src/fs-utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAYhD,eAAO,MAAM,cAAc,aAiBzB,CAAC;AASH;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAc7E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAIvE;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,UAAU,EAClB,MAAM,CAAC,EAAE,cAAc,EACvB,kBAAkB,GAAE,OAAe,GAClC,OAAO,CAAC,WAAW,CAAC,CAsHtB;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,UAAU,EAClB,kBAAkB,GAAE,OAAe,GAClC,OAAO,CAAC,WAAW,CAAC,CAQtB"}
1
+ {"version":3,"file":"fs-utils.d.ts","sourceRoot":"","sources":["../src/fs-utils.ts"],"names":[],"mappings":"A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