@ai-dossier/cli 0.13.0 → 0.18.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 (63) hide show
  1. package/README.md +236 -6
  2. package/dist/cache-resolver.d.ts.map +1 -1
  3. package/dist/cache-resolver.js +2 -11
  4. package/dist/cache-resolver.js.map +1 -1
  5. package/dist/cap-log.d.ts +31 -0
  6. package/dist/cap-log.d.ts.map +1 -0
  7. package/dist/cap-log.js +30 -0
  8. package/dist/cap-log.js.map +1 -0
  9. package/dist/capability.d.ts +108 -0
  10. package/dist/capability.d.ts.map +1 -0
  11. package/dist/capability.js +407 -0
  12. package/dist/capability.js.map +1 -0
  13. package/dist/cli.js +6 -0
  14. package/dist/cli.js.map +1 -1
  15. package/dist/commands/cap.d.ts +13 -0
  16. package/dist/commands/cap.d.ts.map +1 -0
  17. package/dist/commands/cap.js +105 -0
  18. package/dist/commands/cap.js.map +1 -0
  19. package/dist/commands/plan.d.ts +20 -0
  20. package/dist/commands/plan.d.ts.map +1 -0
  21. package/dist/commands/plan.js +323 -0
  22. package/dist/commands/plan.js.map +1 -0
  23. package/dist/commands/runstate.d.ts.map +1 -1
  24. package/dist/commands/runstate.js +56 -292
  25. package/dist/commands/runstate.js.map +1 -1
  26. package/dist/commands/sched.d.ts +11 -0
  27. package/dist/commands/sched.d.ts.map +1 -0
  28. package/dist/commands/sched.js +402 -0
  29. package/dist/commands/sched.js.map +1 -0
  30. package/dist/gh.d.ts +155 -0
  31. package/dist/gh.d.ts.map +1 -0
  32. package/dist/gh.js +357 -0
  33. package/dist/gh.js.map +1 -0
  34. package/dist/helpers.d.ts +7 -0
  35. package/dist/helpers.d.ts.map +1 -1
  36. package/dist/helpers.js +19 -0
  37. package/dist/helpers.js.map +1 -1
  38. package/dist/issue-selection.js +2 -2
  39. package/dist/issue-selection.js.map +1 -1
  40. package/dist/jsonl-log.d.ts +14 -0
  41. package/dist/jsonl-log.d.ts.map +1 -0
  42. package/dist/jsonl-log.js +32 -0
  43. package/dist/jsonl-log.js.map +1 -0
  44. package/dist/plan-artifact.d.ts +123 -0
  45. package/dist/plan-artifact.d.ts.map +1 -0
  46. package/dist/plan-artifact.js +213 -0
  47. package/dist/plan-artifact.js.map +1 -0
  48. package/dist/run-log.d.ts.map +1 -1
  49. package/dist/run-log.js +2 -9
  50. package/dist/run-log.js.map +1 -1
  51. package/dist/runstate-stats.d.ts +12 -3
  52. package/dist/runstate-stats.d.ts.map +1 -1
  53. package/dist/runstate-stats.js +33 -14
  54. package/dist/runstate-stats.js.map +1 -1
  55. package/dist/runstate.d.ts +87 -13
  56. package/dist/runstate.d.ts.map +1 -1
  57. package/dist/runstate.js +195 -25
  58. package/dist/runstate.js.map +1 -1
  59. package/dist/version.d.ts +10 -0
  60. package/dist/version.d.ts.map +1 -0
  61. package/dist/version.js +23 -0
  62. package/dist/version.js.map +1 -0
  63. package/package.json +3 -2
package/dist/gh.d.ts ADDED
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Shared subprocess plumbing for issue-comment-backed protocols (runstate:v1,
3
+ * plan:v1).
4
+ *
5
+ * Every command that reads or writes GitHub issue comments through `gh` needs the
6
+ * same things: run a subprocess and keep WHY it failed, turn `gh`'s stderr into a
7
+ * named cause with a fix, parse `--json` output without a throw, and reject
8
+ * values that cannot be safely passed on a command line. These lived privately in
9
+ * `commands/runstate.ts` until the second consumer (`commands/plan.ts`) arrived;
10
+ * they are extracted verbatim rather than reimplemented per command — and anything
11
+ * BOTH command suites do (fetch comments, post a comment, print a dry-run) lives
12
+ * here once, not twice.
13
+ */
14
+ /**
15
+ * Fail on stderr and exit 1, so a calling dossier can detect it.
16
+ *
17
+ * Each entry is one problem. An entry may span lines: the first gets the ❌, the rest are
18
+ * indented under it, which is how a cause line and its "Fix:" line stay visibly one item.
19
+ */
20
+ export declare function fail(lines: string[]): never;
21
+ /** Why a subprocess did not produce output — enough to name the actual cause. */
22
+ export interface ExecFailure {
23
+ /** The binary itself is missing from PATH (ENOENT), rather than having exited non-zero. */
24
+ notFound: boolean;
25
+ /** The process was killed after {@link EXEC_TIMEOUT_MS} instead of answering. */
26
+ timedOut: boolean;
27
+ /** Exit status, or null when the process never ran or was killed by a signal. */
28
+ status: number | null;
29
+ /** Whatever the command wrote to stderr, falling back to the thrown message. */
30
+ stderr: string;
31
+ }
32
+ export type ExecResult = {
33
+ ok: true;
34
+ stdout: string;
35
+ } | {
36
+ ok: false;
37
+ error: ExecFailure;
38
+ };
39
+ /**
40
+ * Run a command, keeping WHY it failed.
41
+ *
42
+ * The whole point of the comment-protocol subcommands is that agents were silently
43
+ * getting things wrong, so a discarded stderr is the one thing we cannot afford:
44
+ * "gh is not installed", "gh is not logged in", and "issue 440 does not exist" need
45
+ * three different fixes and are indistinguishable without it. A hard timeout keeps a
46
+ * network-stalled gh from hanging an agent-driven run with nothing to debug.
47
+ */
48
+ export declare function exec(file: string, args: string[]): ExecResult;
49
+ /**
50
+ * Collapse output to one bounded line so a huge or binary payload stays readable.
51
+ * Control characters (ANSI/OSC escapes included) are stripped — snippets come from
52
+ * network-reachable comment bodies, and a terminal escape re-emitted raw can
53
+ * rewrite the operator's screen or clipboard.
54
+ */
55
+ export declare function snippet(text: string, max?: number): string;
56
+ /**
57
+ * `JSON.parse` for a `gh --json` payload: `null` instead of a throw, and the caller's
58
+ * declared shape instead of `any`. Every gh call here reads a `--json` payload, so all
59
+ * call sites need the same "gh exited 0 but printed something that is not JSON" branch —
60
+ * they differ only in what they say about it. Fields stay `unknown` because gh's output is
61
+ * remote data — {@link asString} narrows each one at the point of use.
62
+ */
63
+ export declare function parseGhJson<T>(raw: string): T | null;
64
+ /** A JSON field as a string, or `fallback` when gh omitted it or sent another type. */
65
+ export declare function asString(value: unknown, fallback?: string): string;
66
+ /**
67
+ * Turn a failed `gh` invocation into a message that names the cause and the fix.
68
+ *
69
+ * `action` is what we were trying to do, e.g. "Could not read issue #440".
70
+ */
71
+ export declare function ghFailure(action: string, err: ExecFailure, repo?: string): string;
72
+ /** GitHub issue numbers are positive integers; anything else is a caller mistake. */
73
+ export declare function isIssueNumber(value: string): boolean;
74
+ /** Reject a non-numeric `--issue` here rather than letting gh (or `mint`) fail obscurely. */
75
+ export declare function requireIssueNumber(issue: string): void;
76
+ /** `--repo owner/name` appended to a gh invocation when the caller supplied one. */
77
+ export declare function repoArgs(repo?: string): string[];
78
+ /** Reject a `--repo` that is not a repository slug before handing it to gh. */
79
+ export declare function requireRepoSlug(repo?: string): void;
80
+ /**
81
+ * The `--issue`/`--repo` checks every issue-targeting subcommand runs before it starts.
82
+ * Kept together so a new subcommand cannot pick up one guard and miss the other.
83
+ */
84
+ export declare function requireIssueTarget(options: {
85
+ issue: string;
86
+ repo?: string;
87
+ }): void;
88
+ /**
89
+ * Whether a value read back OUT of a comment may be passed to `git`/`gh`.
90
+ *
91
+ * These values are attacker-reachable: anyone who can comment on the issue can post a
92
+ * protocol comment, so values like `branch=`, `head=` and `pr=` arrive from the network
93
+ * rather than from the caller. Every invocation here is `execFileSync` with an argument
94
+ * array and no shell, so there is no command injection — but a value that begins with `-`
95
+ * is still read as a FLAG rather than as data. `gh` (cobra) parses flags interspersed with
96
+ * positionals, so `pr=--repo=someone/else` or `pr=--web` would silently retarget, or add a
97
+ * side effect to, a subcommand documented as strictly read-only.
98
+ */
99
+ export declare function isSafeArg(value: string): boolean;
100
+ /**
101
+ * Paths are only ever passed in value position (`git -C <path>`) or to `fs.statSync`, so
102
+ * they cannot be mistaken for a flag — but the protocol requires them absolute, and a
103
+ * relative path from a forged comment would resolve against whatever directory the agent
104
+ * happens to be in.
105
+ */
106
+ export declare function isSafePath(value: string): boolean;
107
+ /** Formats why a local `git` probe could not answer — shared by every git-reading command. */
108
+ export declare function gitFailure(err: ExecFailure): string;
109
+ /** A comment as gh reports it; every field but `body` may be absent. */
110
+ export interface GhComment {
111
+ body?: unknown;
112
+ url?: unknown;
113
+ createdAt?: unknown;
114
+ author?: {
115
+ login?: unknown;
116
+ } | null;
117
+ authorAssociation?: unknown;
118
+ }
119
+ /** A comment-read, or the one reason it could not be read. */
120
+ export type CommentsResult = {
121
+ ok: true;
122
+ comments: GhComment[];
123
+ } | {
124
+ ok: false;
125
+ error: string;
126
+ };
127
+ /**
128
+ * Read an issue's comments through gh, reporting WHY rather than exiting.
129
+ *
130
+ * The single-issue subcommands turn a failure here into an immediate exit; `stats
131
+ * --issues` cannot, because one unreadable issue in a set must not discard the rest. So
132
+ * the decision of what a failure means belongs to the caller, and this function only
133
+ * reports it.
134
+ */
135
+ export declare function tryFetchComments(issue: string, repo?: string): CommentsResult;
136
+ /** `--dry-run` support for comment-posting subcommands: show the body, post nothing. */
137
+ export declare function printDryRun(body: string, json?: boolean, extra?: Record<string, unknown>): void;
138
+ /**
139
+ * Comment `body` onto an issue, with the shared failure taxonomy, the paste-safe retry
140
+ * hint, and the success output both protocols use.
141
+ *
142
+ * `jsonExtras` merge into the `--json` result (e.g. `head` for plans); `successLine`
143
+ * renders the human-mode success line for the caller's protocol.
144
+ */
145
+ export declare function postIssueComment(options: {
146
+ issue: string;
147
+ repo?: string;
148
+ body: string;
149
+ noun: string;
150
+ action: string;
151
+ json?: boolean;
152
+ jsonExtras?: Record<string, unknown>;
153
+ successLine: (url: string) => string;
154
+ }): void;
155
+ //# sourceMappingURL=gh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gh.d.ts","sourceRoot":"","sources":["../src/gh.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAO3C;AAKD,iFAAiF;AACjF,MAAM,WAAW,WAAW;IAC1B,2FAA2F;IAC3F,QAAQ,EAAE,OAAO,CAAC;IAClB,iFAAiF;IACjF,QAAQ,EAAE,OAAO,CAAC;IAClB,iFAAiF;IACjF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,gFAAgF;IAChF,MAAM,EAAE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,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;CACtC,GAAG,IAAI,CAqBP"}
package/dist/gh.js ADDED
@@ -0,0 +1,357 @@
1
+ "use strict";
2
+ /**
3
+ * Shared subprocess plumbing for issue-comment-backed protocols (runstate:v1,
4
+ * plan:v1).
5
+ *
6
+ * Every command that reads or writes GitHub issue comments through `gh` needs the
7
+ * same things: run a subprocess and keep WHY it failed, turn `gh`'s stderr into a
8
+ * named cause with a fix, parse `--json` output without a throw, and reject
9
+ * values that cannot be safely passed on a command line. These lived privately in
10
+ * `commands/runstate.ts` until the second consumer (`commands/plan.ts`) arrived;
11
+ * they are extracted verbatim rather than reimplemented per command — and anything
12
+ * BOTH command suites do (fetch comments, post a comment, print a dry-run) lives
13
+ * here once, not twice.
14
+ */
15
+ var __importDefault = (this && this.__importDefault) || function (mod) {
16
+ return (mod && mod.__esModule) ? mod : { "default": mod };
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.fail = fail;
20
+ exports.exec = exec;
21
+ exports.snippet = snippet;
22
+ exports.parseGhJson = parseGhJson;
23
+ exports.asString = asString;
24
+ exports.ghFailure = ghFailure;
25
+ exports.isIssueNumber = isIssueNumber;
26
+ exports.requireIssueNumber = requireIssueNumber;
27
+ exports.repoArgs = repoArgs;
28
+ exports.requireRepoSlug = requireRepoSlug;
29
+ exports.requireIssueTarget = requireIssueTarget;
30
+ exports.isSafeArg = isSafeArg;
31
+ exports.isSafePath = isSafePath;
32
+ exports.gitFailure = gitFailure;
33
+ exports.tryFetchComments = tryFetchComments;
34
+ exports.printDryRun = printDryRun;
35
+ exports.postIssueComment = postIssueComment;
36
+ const node_child_process_1 = require("node:child_process");
37
+ const node_fs_1 = __importDefault(require("node:fs"));
38
+ const node_os_1 = __importDefault(require("node:os"));
39
+ const node_path_1 = __importDefault(require("node:path"));
40
+ /**
41
+ * Fail on stderr and exit 1, so a calling dossier can detect it.
42
+ *
43
+ * Each entry is one problem. An entry may span lines: the first gets the ❌, the rest are
44
+ * indented under it, which is how a cause line and its "Fix:" line stay visibly one item.
45
+ */
46
+ function fail(lines) {
47
+ for (const line of lines) {
48
+ const [first, ...rest] = line.split('\n');
49
+ console.error(`❌ ${first}`);
50
+ for (const cont of rest)
51
+ console.error(` ${cont}`);
52
+ }
53
+ process.exit(1);
54
+ }
55
+ /** How long any single gh/git subprocess may run before it is killed. */
56
+ const EXEC_TIMEOUT_MS = 120_000;
57
+ /**
58
+ * Run a command, keeping WHY it failed.
59
+ *
60
+ * The whole point of the comment-protocol subcommands is that agents were silently
61
+ * getting things wrong, so a discarded stderr is the one thing we cannot afford:
62
+ * "gh is not installed", "gh is not logged in", and "issue 440 does not exist" need
63
+ * three different fixes and are indistinguishable without it. A hard timeout keeps a
64
+ * network-stalled gh from hanging an agent-driven run with nothing to debug.
65
+ */
66
+ function exec(file, args) {
67
+ try {
68
+ const stdout = (0, node_child_process_1.execFileSync)(file, args, {
69
+ encoding: 'utf8',
70
+ stdio: ['ignore', 'pipe', 'pipe'],
71
+ timeout: EXEC_TIMEOUT_MS,
72
+ });
73
+ return { ok: true, stdout: String(stdout).trim() };
74
+ }
75
+ catch (err) {
76
+ const e = err;
77
+ const stderr = String(e?.stderr ?? '').trim() || String(e?.message ?? '').trim();
78
+ return {
79
+ ok: false,
80
+ error: {
81
+ notFound: e?.code === 'ENOENT',
82
+ timedOut: e?.killed === true,
83
+ status: typeof e?.status === 'number' ? e.status : null,
84
+ stderr,
85
+ },
86
+ };
87
+ }
88
+ }
89
+ /** Characters of command output kept in a top-level failure message. */
90
+ const SNIPPET_LENGTH = 300;
91
+ /** Control characters that have no place in output a terminal will render. */
92
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: matching (and stripping) control characters is exactly this regex's job
93
+ const CONTROL_CHARS_RE = /[\u0000-\u0008\u000b-\u001f\u007f\u009b]/g;
94
+ /**
95
+ * Collapse output to one bounded line so a huge or binary payload stays readable.
96
+ * Control characters (ANSI/OSC escapes included) are stripped — snippets come from
97
+ * network-reachable comment bodies, and a terminal escape re-emitted raw can
98
+ * rewrite the operator's screen or clipboard.
99
+ */
100
+ function snippet(text, max = SNIPPET_LENGTH) {
101
+ const oneLine = text.replace(CONTROL_CHARS_RE, '').replace(/\s+/g, ' ').trim();
102
+ if (oneLine === '')
103
+ return '(no output)';
104
+ return oneLine.length > max
105
+ ? `${oneLine.slice(0, max)}… (${oneLine.length} characters total)`
106
+ : oneLine;
107
+ }
108
+ const GH_FAILURE_CASES = [
109
+ {
110
+ match: [
111
+ 'gh auth login',
112
+ 'not logged',
113
+ 'authentication',
114
+ 'unauthorized',
115
+ 'http 401',
116
+ 'bad credentials',
117
+ ],
118
+ cause: () => 'gh is not authenticated.',
119
+ fix: `Fix: run 'gh auth login', confirm with 'gh auth status', then re-run.`,
120
+ },
121
+ {
122
+ match: ['could not resolve to', 'not found', 'http 404'],
123
+ cause: (where) => `GitHub could not find it in ${where}.`,
124
+ fix: `Fix: check the number is right and that the repository is the one you mean — pass --repo <owner/name> when running outside it.`,
125
+ },
126
+ {
127
+ // Ahead of the 403 case on purpose: gh reports rate limiting AS an HTTP 403, so without
128
+ // this the operator is told to fix their permissions — which are fine. Sequential reads
129
+ // over an issue set can fire enough calls to make this a realistic failure.
130
+ match: ['rate limit', 'secondary rate', 'abuse detection', 'http 429'],
131
+ cause: () => 'GitHub rate-limited the request.',
132
+ fix: `Fix: wait for the window to reset ('gh api rate_limit' shows when), then re-run; narrow the issue set to read fewer issues per run.`,
133
+ },
134
+ {
135
+ match: ['http 403', 'permission', 'write access', 'forbidden'],
136
+ cause: (where) => `GitHub refused the request — the authenticated account lacks access to ${where}.`,
137
+ fix: `Fix: check the account and its scopes with 'gh auth status'; reading an issue needs read access to the repository, and posting a comment needs write.`,
138
+ },
139
+ {
140
+ match: ['dial tcp', 'no such host', 'timeout', 'connection refused', 'network is unreachable'],
141
+ cause: () => 'gh could not reach GitHub.',
142
+ fix: `Fix: check network/proxy access to github.com and re-run; this is transient, so a retry is usually enough.`,
143
+ },
144
+ ];
145
+ /**
146
+ * `JSON.parse` for a `gh --json` payload: `null` instead of a throw, and the caller's
147
+ * declared shape instead of `any`. Every gh call here reads a `--json` payload, so all
148
+ * call sites need the same "gh exited 0 but printed something that is not JSON" branch —
149
+ * they differ only in what they say about it. Fields stay `unknown` because gh's output is
150
+ * remote data — {@link asString} narrows each one at the point of use.
151
+ */
152
+ function parseGhJson(raw) {
153
+ try {
154
+ return JSON.parse(raw);
155
+ }
156
+ catch {
157
+ return null;
158
+ }
159
+ }
160
+ /** A JSON field as a string, or `fallback` when gh omitted it or sent another type. */
161
+ function asString(value, fallback = '') {
162
+ return typeof value === 'string' ? value : fallback;
163
+ }
164
+ /**
165
+ * Turn a failed `gh` invocation into a message that names the cause and the fix.
166
+ *
167
+ * `action` is what we were trying to do, e.g. "Could not read issue #440".
168
+ */
169
+ function ghFailure(action, err, repo) {
170
+ if (err.notFound) {
171
+ return [
172
+ `${action}: 'gh' is not installed, or is not on PATH.`,
173
+ `Fix: install the GitHub CLI (https://cli.github.com), then re-run. Check with: gh --version`,
174
+ ].join('\n');
175
+ }
176
+ // Named ahead of the taxonomy: a kill leaves no stderr to match on, and "check the
177
+ // network" is the one fix that fits every stall.
178
+ if (err.timedOut) {
179
+ return [
180
+ `${action}: gh did not answer within ${EXEC_TIMEOUT_MS / 1000}s.`,
181
+ `Fix: the call was killed as stalled — check network/proxy access, then re-run.`,
182
+ ].join('\n');
183
+ }
184
+ const hint = err.stderr.toLowerCase();
185
+ const where = repo ? `--repo ${repo}` : 'the current repository (no --repo was passed)';
186
+ const matched = GH_FAILURE_CASES.find((c) => c.match.some((needle) => hint.includes(needle)));
187
+ const cause = matched
188
+ ? `${action}: ${matched.cause(where)}`
189
+ : `${action}: gh exited ${err.status === null ? 'abnormally' : `with status ${err.status}`}.`;
190
+ const fix = matched?.fix ?? `Fix: run the same gh command by hand to see the full error.`;
191
+ return [cause, fix, `gh said: ${snippet(err.stderr)}`].join('\n');
192
+ }
193
+ /** GitHub issue numbers are positive integers; anything else is a caller mistake. */
194
+ function isIssueNumber(value) {
195
+ return /^[1-9]\d*$/.test(value);
196
+ }
197
+ /** Reject a non-numeric `--issue` here rather than letting gh (or `mint`) fail obscurely. */
198
+ function requireIssueNumber(issue) {
199
+ if (!isIssueNumber(issue)) {
200
+ fail([
201
+ `Invalid --issue '${issue}' — expected a positive GitHub issue number.\nFix: pass the number only, e.g. --issue 440 (not a URL, a '#', or a branch name).`,
202
+ ]);
203
+ }
204
+ }
205
+ /** `--repo owner/name` appended to a gh invocation when the caller supplied one. */
206
+ function repoArgs(repo) {
207
+ return repo ? ['--repo', repo] : [];
208
+ }
209
+ /** `owner/name`, or `host/owner/name` for a GitHub Enterprise host. */
210
+ const REPO_SLUG_RE = /^(?:[A-Za-z0-9][A-Za-z0-9.-]*\/)?[A-Za-z0-9][A-Za-z0-9._-]*\/[A-Za-z0-9][A-Za-z0-9._-]*$/;
211
+ /** Reject a `--repo` that is not a repository slug before handing it to gh. */
212
+ function requireRepoSlug(repo) {
213
+ if (repo === undefined)
214
+ return;
215
+ if (!REPO_SLUG_RE.test(repo)) {
216
+ fail([
217
+ `Invalid --repo '${repo}' — expected owner/name.\nFix: pass the slug only, e.g. --repo imboard-ai/ai-dossier (not a URL, and not a shell expansion).`,
218
+ ]);
219
+ }
220
+ }
221
+ /**
222
+ * The `--issue`/`--repo` checks every issue-targeting subcommand runs before it starts.
223
+ * Kept together so a new subcommand cannot pick up one guard and miss the other.
224
+ */
225
+ function requireIssueTarget(options) {
226
+ requireIssueNumber(options.issue);
227
+ requireRepoSlug(options.repo);
228
+ }
229
+ /** Whether `value` carries a control character, which has no place in a comment value. */
230
+ function hasControlChar(value) {
231
+ for (let i = 0; i < value.length; i += 1) {
232
+ const code = value.charCodeAt(i);
233
+ if (code < 0x20 || code === 0x7f)
234
+ return true;
235
+ }
236
+ return false;
237
+ }
238
+ /**
239
+ * Whether a value read back OUT of a comment may be passed to `git`/`gh`.
240
+ *
241
+ * These values are attacker-reachable: anyone who can comment on the issue can post a
242
+ * protocol comment, so values like `branch=`, `head=` and `pr=` arrive from the network
243
+ * rather than from the caller. Every invocation here is `execFileSync` with an argument
244
+ * array and no shell, so there is no command injection — but a value that begins with `-`
245
+ * is still read as a FLAG rather than as data. `gh` (cobra) parses flags interspersed with
246
+ * positionals, so `pr=--repo=someone/else` or `pr=--web` would silently retarget, or add a
247
+ * side effect to, a subcommand documented as strictly read-only.
248
+ */
249
+ function isSafeArg(value) {
250
+ return value !== '' && !value.startsWith('-') && !/\s/.test(value) && !hasControlChar(value);
251
+ }
252
+ /**
253
+ * Paths are only ever passed in value position (`git -C <path>`) or to `fs.statSync`, so
254
+ * they cannot be mistaken for a flag — but the protocol requires them absolute, and a
255
+ * relative path from a forged comment would resolve against whatever directory the agent
256
+ * happens to be in.
257
+ */
258
+ function isSafePath(value) {
259
+ return value.startsWith('/') && !hasControlChar(value);
260
+ }
261
+ /** Formats why a local `git` probe could not answer — shared by every git-reading command. */
262
+ function gitFailure(err) {
263
+ return err.notFound
264
+ ? 'git is not installed or not on PATH'
265
+ : err.timedOut
266
+ ? `git did not answer within ${EXEC_TIMEOUT_MS / 1000}s (killed as stalled)`
267
+ : `git exited ${err.status ?? 'abnormally'}: ${snippet(err.stderr, GIT_ERROR_SNIPPET_LENGTH)}`;
268
+ }
269
+ /** Characters kept when quoting git stderr inside a reason or warning line. */
270
+ const GIT_ERROR_SNIPPET_LENGTH = 120;
271
+ /**
272
+ * Read an issue's comments through gh, reporting WHY rather than exiting.
273
+ *
274
+ * The single-issue subcommands turn a failure here into an immediate exit; `stats
275
+ * --issues` cannot, because one unreadable issue in a set must not discard the rest. So
276
+ * the decision of what a failure means belongs to the caller, and this function only
277
+ * reports it.
278
+ */
279
+ function tryFetchComments(issue, repo) {
280
+ const res = exec('gh', ['issue', 'view', issue, '--json', 'comments', ...repoArgs(repo)]);
281
+ if (!res.ok) {
282
+ return { ok: false, error: ghFailure(`Could not read issue #${issue}`, res.error, repo) };
283
+ }
284
+ const parsed = parseGhJson(res.stdout);
285
+ if (parsed === null || !Array.isArray(parsed?.comments)) {
286
+ // A comment-less issue and a shape we cannot read must not look the same: the first
287
+ // means "nothing there", the second means the tool is broken, and silently returning
288
+ // [] for both would make a reader report "no artifacts" over an unreadable response.
289
+ return {
290
+ ok: false,
291
+ error: [
292
+ `Could not read issue #${issue}: gh exited 0 but did not print JSON — no "comments" array.`,
293
+ `Fix: run 'gh issue view ${issue} --json comments' by hand — a gh older than 2.0 (no --json), or an interactive prompt landing on stdout, both look like this.`,
294
+ `gh printed: ${snippet(res.stdout)}`,
295
+ ].join('\n'),
296
+ };
297
+ }
298
+ return { ok: true, comments: parsed.comments };
299
+ }
300
+ /** `--dry-run` support for comment-posting subcommands: show the body, post nothing. */
301
+ function printDryRun(body, json, extra) {
302
+ if (json) {
303
+ console.log(JSON.stringify({ posted: false, dryRun: true, ...extra, body }, null, 2));
304
+ }
305
+ else {
306
+ process.stdout.write(body);
307
+ }
308
+ }
309
+ /**
310
+ * Write `body` to a temp file and return a paste-safe retry hint using `--body-file`.
311
+ *
312
+ * Inlining the body in a suggested `gh … --body <string>` command is a paste-time
313
+ * injection: JSON double quotes are not shell quotes, so a body containing `$(…)` or
314
+ * backticks would execute the moment the operator pastes the suggestion. A file path
315
+ * carries no such payload.
316
+ */
317
+ function retryHint(issue, repo, body, noun) {
318
+ try {
319
+ const dir = node_fs_1.default.mkdtempSync(node_path_1.default.join(node_os_1.default.tmpdir(), 'ai-dossier-'));
320
+ const file = node_path_1.default.join(dir, `${noun}.md`);
321
+ node_fs_1.default.writeFileSync(file, body);
322
+ return `The ${noun} was NOT posted. Retry, or post it by hand:\ngh issue comment ${issue}${repo ? ` --repo ${repo}` : ''} --body-file ${file}`;
323
+ }
324
+ catch {
325
+ return `The ${noun} was NOT posted. Retry, or save the body shown above and post it with: gh issue comment ${issue}${repo ? ` --repo ${repo}` : ''} --body-file <file>`;
326
+ }
327
+ }
328
+ /**
329
+ * Comment `body` onto an issue, with the shared failure taxonomy, the paste-safe retry
330
+ * hint, and the success output both protocols use.
331
+ *
332
+ * `jsonExtras` merge into the `--json` result (e.g. `head` for plans); `successLine`
333
+ * renders the human-mode success line for the caller's protocol.
334
+ */
335
+ function postIssueComment(options) {
336
+ const res = exec('gh', [
337
+ 'issue',
338
+ 'comment',
339
+ options.issue,
340
+ '--body',
341
+ options.body,
342
+ ...repoArgs(options.repo),
343
+ ]);
344
+ if (!res.ok) {
345
+ fail([
346
+ ghFailure(options.action, res.error, options.repo),
347
+ retryHint(options.issue, options.repo, options.body, options.noun),
348
+ ]);
349
+ }
350
+ if (options.json) {
351
+ console.log(JSON.stringify({ posted: true, url: res.stdout, ...options.jsonExtras }, null, 2));
352
+ }
353
+ else {
354
+ console.log(options.successLine(res.stdout));
355
+ }
356
+ }
357
+ //# sourceMappingURL=gh.js.map
package/dist/gh.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gh.js","sourceRoot":"","sources":["../src/gh.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;AAaH,oBAOC;AA4BD,oBAyBC;AAeD,0BAMC;AAiED,kCAMC;AAGD,4BAEC;AAOD,8BA2BC;AAGD,sCAEC;AAGD,gDAMC;AAGD,4BAEC;AAOD,0CAOC;AAMD,gDAGC;AAsBD,8BAEC;AAQD,gCAEC;AAGD,gCAMC;AAyBD,4CAsBC;AAGD,kCAMC;AA4BD,4CA8BC;AAjZD,2DAAkD;AAClD,sDAAyB;AACzB,sDAAyB;AACzB,0DAA6B;AAE7B;;;;;GAKG;AACH,SAAgB,IAAI,CAAC,KAAe;IAClC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC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IAAI;QACZ,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;KAC1B,CAAC,CAAC;IACH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,IAAI,CAAC;YACH,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC;YAClD,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC;SACnE,CAAC,CAAC;IACL,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACjG,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC"}
package/dist/helpers.d.ts CHANGED
@@ -271,4 +271,11 @@ export declare function formatDossierFields(d: {
271
271
  * Used by search and list commands when results span multiple pages.
272
272
  */
273
273
  export declare function logPaginationInfo(total: number, page: number, perPage: number): void;
274
+ /**
275
+ * Fail on stderr and exit 1, so a calling dossier can detect it.
276
+ *
277
+ * Each entry is one problem. An entry may span lines: the first gets the ❌, the rest are
278
+ * indented under it, which is how a cause line and its "Fix:" line stay visibly one item.
279
+ */
280
+ export declare function fail(lines: string[]): never;
274
281
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAGL,kBAAkB,EAClB,eAAe,EACf,iB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CAAE,CAAC,EAC1D,KAAK,GAAE,QAAQ,GAAG,SAAoB,GACrC,IAAI,CAQN;AAKD;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,aAAa,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GACzD,IAAI,CAyBN;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAQ1F;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CASpF;AAMD;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAO3C"}
package/dist/helpers.js CHANGED
@@ -32,6 +32,7 @@ exports.printRegistryErrors = printRegistryErrors;
32
32
  exports.printRegistryNotFoundError = printRegistryNotFoundError;
33
33
  exports.formatDossierFields = formatDossierFields;
34
34
  exports.logPaginationInfo = logPaginationInfo;
35
+ exports.fail = fail;
35
36
  const node_child_process_1 = require("node:child_process");
36
37
  const node_fs_1 = __importDefault(require("node:fs"));
37
38
  const node_http_1 = __importDefault(require("node:http"));
@@ -859,4 +860,22 @@ function logPaginationInfo(total, page, perPage) {
859
860
  console.log('');
860
861
  }
861
862
  }
863
+ // ============================================================================
864
+ // CLI failure exit
865
+ // ============================================================================
866
+ /**
867
+ * Fail on stderr and exit 1, so a calling dossier can detect it.
868
+ *
869
+ * Each entry is one problem. An entry may span lines: the first gets the ❌, the rest are
870
+ * indented under it, which is how a cause line and its "Fix:" line stay visibly one item.
871
+ */
872
+ function fail(lines) {
873
+ for (const line of lines) {
874
+ const [first, ...rest] = line.split('\n');
875
+ console.error(`❌ ${first}`);
876
+ for (const cont of rest)
877
+ console.error(` ${cont}`);
878
+ }
879
+ process.exit(1);
880
+ }
862
881
  //# sourceMappingURL=helpers.js.map