coolhand-cli 0.8.0 → 0.10.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 (96) hide show
  1. package/README.md +6 -2
  2. package/dist/api/last-sync.d.ts.map +1 -1
  3. package/dist/api/last-sync.js +2 -1
  4. package/dist/api/last-sync.js.map +1 -1
  5. package/dist/api/log-client.d.ts +17 -0
  6. package/dist/api/log-client.d.ts.map +1 -0
  7. package/dist/api/log-client.js +40 -0
  8. package/dist/api/log-client.js.map +1 -0
  9. package/dist/base-url.d.ts +7 -0
  10. package/dist/base-url.d.ts.map +1 -0
  11. package/dist/base-url.js +14 -0
  12. package/dist/base-url.js.map +1 -0
  13. package/dist/cli.d.ts.map +1 -1
  14. package/dist/cli.js +242 -9
  15. package/dist/cli.js.map +1 -1
  16. package/dist/commands/analyze-claude-sessions.d.ts.map +1 -1
  17. package/dist/commands/analyze-claude-sessions.js +10 -21
  18. package/dist/commands/analyze-claude-sessions.js.map +1 -1
  19. package/dist/commands/fetch-log.d.ts +3 -0
  20. package/dist/commands/fetch-log.d.ts.map +1 -0
  21. package/dist/commands/fetch-log.js +42 -0
  22. package/dist/commands/fetch-log.js.map +1 -0
  23. package/dist/commands/login.d.ts.map +1 -1
  24. package/dist/commands/login.js +3 -2
  25. package/dist/commands/login.js.map +1 -1
  26. package/dist/commands/map-claude-projects.d.ts +22 -0
  27. package/dist/commands/map-claude-projects.d.ts.map +1 -0
  28. package/dist/commands/map-claude-projects.js +282 -0
  29. package/dist/commands/map-claude-projects.js.map +1 -0
  30. package/dist/commands/search-logs.d.ts +3 -0
  31. package/dist/commands/search-logs.d.ts.map +1 -0
  32. package/dist/commands/search-logs.js +77 -0
  33. package/dist/commands/search-logs.js.map +1 -0
  34. package/dist/commands/upload-client-file.d.ts +3 -0
  35. package/dist/commands/upload-client-file.d.ts.map +1 -0
  36. package/dist/commands/upload-client-file.js +43 -0
  37. package/dist/commands/upload-client-file.js.map +1 -0
  38. package/dist/commands/wildcard.d.ts +6 -6
  39. package/dist/commands/wildcard.d.ts.map +1 -1
  40. package/dist/commands/wildcard.js +14 -11
  41. package/dist/commands/wildcard.js.map +1 -1
  42. package/dist/config.d.ts +11 -0
  43. package/dist/config.d.ts.map +1 -1
  44. package/dist/config.js +31 -8
  45. package/dist/config.js.map +1 -1
  46. package/dist/errors.d.ts +1 -1
  47. package/dist/errors.d.ts.map +1 -1
  48. package/dist/errors.js.map +1 -1
  49. package/dist/log-request.d.ts +4 -0
  50. package/dist/log-request.d.ts.map +1 -1
  51. package/dist/log-request.js +8 -1
  52. package/dist/log-request.js.map +1 -1
  53. package/dist/logger.d.ts +1 -0
  54. package/dist/logger.d.ts.map +1 -1
  55. package/dist/logger.js +30 -1
  56. package/dist/logger.js.map +1 -1
  57. package/dist/proxy/certs.d.ts.map +1 -1
  58. package/dist/proxy/certs.js +145 -5
  59. package/dist/proxy/certs.js.map +1 -1
  60. package/dist/proxy/interceptor.d.ts +8 -1
  61. package/dist/proxy/interceptor.d.ts.map +1 -1
  62. package/dist/proxy/interceptor.js +36 -3
  63. package/dist/proxy/interceptor.js.map +1 -1
  64. package/dist/proxy/proxy.d.ts.map +1 -1
  65. package/dist/proxy/proxy.js +4 -3
  66. package/dist/proxy/proxy.js.map +1 -1
  67. package/dist/proxy/wrap-runner.d.ts +0 -12
  68. package/dist/proxy/wrap-runner.d.ts.map +1 -1
  69. package/dist/proxy/wrap-runner.js +24 -11
  70. package/dist/proxy/wrap-runner.js.map +1 -1
  71. package/dist/sessions/claude-scanner.d.ts +3 -0
  72. package/dist/sessions/claude-scanner.d.ts.map +1 -1
  73. package/dist/sessions/claude-scanner.js +8 -0
  74. package/dist/sessions/claude-scanner.js.map +1 -1
  75. package/dist/sessions/cowork-scanner.d.ts.map +1 -1
  76. package/dist/sessions/cowork-scanner.js +6 -1
  77. package/dist/sessions/cowork-scanner.js.map +1 -1
  78. package/dist/sessions/redact-secrets.d.ts.map +1 -1
  79. package/dist/sessions/redact-secrets.js +10 -2
  80. package/dist/sessions/redact-secrets.js.map +1 -1
  81. package/dist/sessions/session-filter.d.ts +3 -1
  82. package/dist/sessions/session-filter.d.ts.map +1 -1
  83. package/dist/sessions/session-filter.js +9 -3
  84. package/dist/sessions/session-filter.js.map +1 -1
  85. package/dist/types.d.ts +48 -0
  86. package/dist/types.d.ts.map +1 -1
  87. package/dist/types.js.map +1 -1
  88. package/dist/upload-client-file.d.ts +31 -0
  89. package/dist/upload-client-file.d.ts.map +1 -0
  90. package/dist/upload-client-file.js +81 -0
  91. package/dist/upload-client-file.js.map +1 -0
  92. package/dist/version.d.ts +2 -2
  93. package/dist/version.d.ts.map +1 -1
  94. package/dist/version.js +1 -1
  95. package/dist/version.js.map +1 -1
  96. package/package.json +10 -8
@@ -0,0 +1,282 @@
1
+ import { promises as fs } from 'fs';
2
+ import * as os from 'os';
3
+ import * as path from 'path';
4
+ import { randomBytes } from 'crypto';
5
+ import { CliError, ExitCode } from '../errors.js';
6
+ import { logger, redact } from '../logger.js';
7
+ import { uploadClientFile } from '../upload-client-file.js';
8
+ /** Matches "claude"/"Claude" and also the dotfile convention "`.claude`"/"`.Claude`" (Claude
9
+ * Code's own home directory) — a leading dot is stripped before comparison, everything else
10
+ * must match exactly (not a substring match, so "claude-code" or "my-claude-notes" don't count). */
11
+ function isClaudeDirName(name) {
12
+ return name.replace(/^\./, '').toLowerCase() === 'claude';
13
+ }
14
+ /**
15
+ * Find every directory named "claude" (see `isClaudeDirName`), searching recursively from
16
+ * `root`. A match is not itself searched further — its full contents are captured by
17
+ * `appendTree` instead, so a nested "claude" folder inside a match isn't double-reported as its
18
+ * own match. A *symlinked* "claude"/".claude" directory still counts as a match (dotfile
19
+ * managers like chezmoi/Stow/yadm commonly manage `~/.claude` this way) — only non-matching
20
+ * symlinked directories are skipped during further recursion, to avoid link loops and escaping
21
+ * `root`. Unreadable directories (permissions, etc.) are skipped rather than aborting the whole
22
+ * scan.
23
+ *
24
+ * Being recorded as a match here does not by itself mean its contents get walked — a matched
25
+ * symlink whose target resolves outside `root` is caller-checked (see `resolvesWithinRoot`,
26
+ * used in `run()`) and its contents are never enumerated, since nothing here constrains where a
27
+ * "claude"-named symlink's target actually lives.
28
+ */
29
+ export async function findClaudeDirs(root) {
30
+ if (isClaudeDirName(path.basename(root))) {
31
+ // Unlike every match found via walk() below, root is handed to us directly rather than
32
+ // discovered via fs.readdir — nothing has confirmed it actually exists or is a directory
33
+ // yet. Without this check, a nonexistent or wrong-type --root (e.g. `--root ~/.claude` on a
34
+ // machine where that path doesn't exist — exactly the usage docs/commands.md recommends)
35
+ // would be reported as a real match, and the empty/failing walk downstream would silently
36
+ // produce and upload a near-empty "successful" report instead of a clear "not found" result.
37
+ const rootStat = await fs.stat(root).catch(() => null);
38
+ return rootStat?.isDirectory() ? [root] : [];
39
+ }
40
+ const matches = [];
41
+ async function walk(dir) {
42
+ let entries;
43
+ try {
44
+ entries = await fs.readdir(dir, { withFileTypes: true });
45
+ }
46
+ catch {
47
+ return;
48
+ }
49
+ for (const entry of entries) {
50
+ const fullPath = path.join(dir, entry.name);
51
+ if (isClaudeDirName(entry.name)) {
52
+ if (entry.isDirectory()) {
53
+ matches.push(fullPath);
54
+ }
55
+ else if (entry.isSymbolicLink()) {
56
+ // Resolve the target to confirm it's actually a directory before recording it as a
57
+ // match (a symlink to a plain file literally named "claude" wouldn't be one). A
58
+ // broken/looping symlink fails fs.stat and is simply not reported as a match.
59
+ const targetStat = await fs.stat(fullPath).catch(() => null);
60
+ if (targetStat?.isDirectory()) {
61
+ matches.push(fullPath);
62
+ }
63
+ }
64
+ continue; // matched (or matched-by-name-but-not-a-dir) — never searched further either way
65
+ }
66
+ if (entry.isSymbolicLink() || !entry.isDirectory()) {
67
+ continue; // non-matching symlink or non-directory — never followed
68
+ }
69
+ await walk(fullPath);
70
+ }
71
+ }
72
+ await walk(root);
73
+ return matches;
74
+ }
75
+ /**
76
+ * Wrap `text` in a markdown inline-code span that's safe even if `text` itself contains
77
+ * backticks (a literal backtick in a filename would otherwise prematurely close the span and
78
+ * mangle the rest of the report) — CommonMark's own rule: a code span delimited by N backticks
79
+ * can safely contain any run of fewer than N backticks, as long as it's not at the very edge.
80
+ *
81
+ * A literal newline (legal in a POSIX filename) is replaced with a visible placeholder rather
82
+ * than left as-is: CommonMark only collapses line endings *inside* a code span when the span
83
+ * stays within one block, which doesn't hold across an ATX heading's own line boundary (this
84
+ * function is also used to build `## <match>` headings) — an embedded `\n` would otherwise split
85
+ * the heading into two lines, one with an unclosed code span.
86
+ */
87
+ function mdInlineCode(text) {
88
+ const singleLine = text.replace(/\r\n|\r|\n/g, '␤');
89
+ const runs = singleLine.match(/`+/g);
90
+ const longestRun = runs ? Math.max(...runs.map((r) => r.length)) : 0;
91
+ if (longestRun === 0) {
92
+ return `\`${singleLine}\``;
93
+ }
94
+ const fence = '`'.repeat(longestRun + 1);
95
+ return `${fence} ${singleLine} ${fence}`;
96
+ }
97
+ /**
98
+ * Resolve both `root` and `target` to their canonical (symlink-free) paths and report whether
99
+ * `target` actually lives under `root` — used to decide whether a *matched* symlinked directory
100
+ * (see `findClaudeDirs`) is safe to walk. A `claude`/`.claude` symlink is recorded as a match
101
+ * without regard for where it points, so without this check a planted symlink anywhere under the
102
+ * search root (a malicious repo clone, an extracted archive) could point at an arbitrary
103
+ * unrelated directory — `/`, `~/.ssh`, a mounted volume — and have its entire contents (every
104
+ * filename, size, and timestamp) enumerated into the uploaded report. If either path fails to
105
+ * resolve (e.g. a dangling symlink), this conservatively reports "does not resolve within root".
106
+ */
107
+ async function resolvesWithinRoot(root, target) {
108
+ const [realRoot, realTarget] = await Promise.all([
109
+ fs.realpath(root).catch(() => null),
110
+ fs.realpath(target).catch(() => null),
111
+ ]);
112
+ if (realRoot === null || realTarget === null) {
113
+ return { within: false, realTarget };
114
+ }
115
+ const relative = path.relative(realRoot, realTarget);
116
+ const within = relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
117
+ return { within, realTarget };
118
+ }
119
+ /**
120
+ * Depth-first append of `dir`'s full contents (recursive, no exclusions) to `lines` as an
121
+ * indented markdown list, one entry per file/directory, each annotated with basic metadata
122
+ * (size, extension, created/modified times for files). Never reads file *contents* — only
123
+ * filesystem metadata — so nothing from inside these folders leaves the machine except names
124
+ * and stats.
125
+ */
126
+ async function appendTree(lines, dir, depth) {
127
+ const indent = ' '.repeat(depth);
128
+ let entries;
129
+ try {
130
+ entries = await fs.readdir(dir, { withFileTypes: true });
131
+ }
132
+ catch (err) {
133
+ lines.push(`${indent}- ⚠️ (unreadable: ${err.message})`);
134
+ return;
135
+ }
136
+ entries.sort((a, b) => a.name.localeCompare(b.name));
137
+ for (const entry of entries) {
138
+ const fullPath = path.join(dir, entry.name);
139
+ if (entry.isSymbolicLink()) {
140
+ // Resolve the target only to tell a file from a directory — a symlinked directory is
141
+ // never followed (avoids link loops and escaping dir), but a symlinked file is safe to
142
+ // list (using the target's metadata) since nothing recurses into it.
143
+ let targetStat;
144
+ try {
145
+ targetStat = await fs.stat(fullPath);
146
+ }
147
+ catch (err) {
148
+ lines.push(`${indent}- ${mdInlineCode(entry.name)} (broken symlink: ${err.message})`);
149
+ continue;
150
+ }
151
+ if (targetStat.isDirectory()) {
152
+ lines.push(`${indent}- 📁 ${mdInlineCode(`${entry.name}/`)} (symlink to a directory, not followed)`);
153
+ continue;
154
+ }
155
+ const ext = path.extname(entry.name) || '(none)';
156
+ const kb = (targetStat.size / 1024).toFixed(1);
157
+ lines.push(`${indent}- 📄 ${mdInlineCode(entry.name)} (symlink) — ${kb} KB, ${ext}, ` +
158
+ `created ${targetStat.birthtime.toISOString()}, modified ${targetStat.mtime.toISOString()}`);
159
+ continue;
160
+ }
161
+ let stat;
162
+ try {
163
+ stat = await fs.stat(fullPath);
164
+ }
165
+ catch (err) {
166
+ lines.push(`${indent}- ${mdInlineCode(entry.name)} (unreadable: ${err.message})`);
167
+ continue;
168
+ }
169
+ if (entry.isDirectory()) {
170
+ lines.push(`${indent}- 📁 ${mdInlineCode(`${entry.name}/`)} — modified ${stat.mtime.toISOString()}`);
171
+ await appendTree(lines, fullPath, depth + 1);
172
+ continue;
173
+ }
174
+ if (!entry.isFile()) {
175
+ // A special file — socket, FIFO, block/char device. Rare under a Claude config directory,
176
+ // but "no exclusions" means it still gets a line rather than vanishing without a trace.
177
+ lines.push(`${indent}- ${mdInlineCode(entry.name)} (special file, not a regular file or directory)`);
178
+ continue;
179
+ }
180
+ const ext = path.extname(entry.name) || '(none)';
181
+ const kb = (stat.size / 1024).toFixed(1);
182
+ lines.push(`${indent}- 📄 ${mdInlineCode(entry.name)} — ${kb} KB, ${ext}, ` +
183
+ `created ${stat.birthtime.toISOString()}, modified ${stat.mtime.toISOString()}`);
184
+ }
185
+ }
186
+ export async function run(opts, deps = {}) {
187
+ try {
188
+ const root = opts.root ?? (deps.homedir ?? os.homedir)();
189
+ const matches = await findClaudeDirs(root);
190
+ if (matches.length === 0) {
191
+ if (opts.json) {
192
+ logger.json({ ok: true, matches: 0, matchedPaths: [] });
193
+ }
194
+ else {
195
+ logger.info(`No folders named "claude" found under ${root}.`);
196
+ }
197
+ return ExitCode.OK;
198
+ }
199
+ const lines = [
200
+ '# Claude Folders Map',
201
+ '',
202
+ `Generated ${new Date().toISOString()} — ${matches.length} folder(s) matching "claude" found under ${mdInlineCode(root)}.`,
203
+ '',
204
+ ];
205
+ for (const match of matches) {
206
+ // mdInlineCode also replaces any stray newline byte in a directory name, not just
207
+ // backticks — a heading built from a raw, unescaped path could otherwise be split across
208
+ // lines (see mdInlineCode's own doc comment for why the newline handling lives there).
209
+ lines.push(`## ${mdInlineCode(match)}`, '');
210
+ const matchLstat = await fs.lstat(match).catch(() => null);
211
+ const escape = matchLstat?.isSymbolicLink() ? await resolvesWithinRoot(root, match) : null;
212
+ if (escape && !escape.within) {
213
+ lines.push(`- ⚠️ This is a symlink that resolves outside the search root` +
214
+ (escape.realTarget ? ` (to ${mdInlineCode(escape.realTarget)})` : ' (target could not be resolved)') +
215
+ ` — not followed, to avoid leaking an unrelated location's contents via a planted symlink.`);
216
+ }
217
+ else {
218
+ await appendTree(lines, match, 0);
219
+ }
220
+ lines.push('');
221
+ }
222
+ const markdown = `${lines.join('\n')}\n`;
223
+ if (opts.output) {
224
+ // Same sensitivity as the upload temp file below (real filenames from every matched
225
+ // folder) — 0o600, and written before the upload attempt so it's available for inspection
226
+ // even if the upload itself fails.
227
+ await fs.writeFile(opts.output, markdown, { encoding: 'utf8', mode: 0o600 });
228
+ }
229
+ const tmpPath = path.join(os.tmpdir(), `coolhand-claude-map-${randomBytes(6).toString('hex')}.md`);
230
+ // The report lists real filenames (and thus can be sensitive) from every matched folder —
231
+ // 0o600 keeps it unreadable by other local users for as long as it exists on disk, matching
232
+ // the mode used for other sensitive files elsewhere (src/config.ts, capture-state.ts).
233
+ await fs.writeFile(tmpPath, markdown, { encoding: 'utf8', mode: 0o600 });
234
+ try {
235
+ const result = await uploadClientFile({
236
+ filePath: tmpPath,
237
+ name: 'Claude Folders Map',
238
+ fileType: 'report',
239
+ description: `File tree map of ${matches.length} folder(s) named "claude" under ${root} (names and metadata only — no file contents).`,
240
+ metadata: { source: 'map-claude-projects', matchCount: matches.length, root },
241
+ }, { clientId: opts.clientId, dryRun: opts.dryRun });
242
+ const mb = (result.sizeBytes / (1024 * 1024)).toFixed(2);
243
+ if (opts.json) {
244
+ logger.json({
245
+ ok: true,
246
+ dryRun: result.status === 'dry-run',
247
+ matches: matches.length,
248
+ matchedPaths: matches,
249
+ sizeBytes: result.sizeBytes,
250
+ ...(opts.output && { outputPath: opts.output }),
251
+ result: result.response,
252
+ });
253
+ }
254
+ else if (result.status === 'dry-run') {
255
+ logger.info(`Dry run: found ${matches.length} folder(s), map is ${mb}MB. Nothing sent.` +
256
+ (opts.output ? ` Report written to ${opts.output}.` : ''));
257
+ }
258
+ else {
259
+ logger.info(`Uploaded a map of ${matches.length} folder(s) (${mb}MB) as client file ` +
260
+ `"${result.response?.name}" (id: ${result.response?.id}).` +
261
+ (opts.output ? ` Report also written to ${opts.output}.` : ''));
262
+ }
263
+ return ExitCode.OK;
264
+ }
265
+ finally {
266
+ await fs.rm(tmpPath, { force: true }).catch(() => undefined);
267
+ }
268
+ }
269
+ catch (err) {
270
+ if (err instanceof CliError) {
271
+ if (opts.json) {
272
+ logger.json({ ok: false, error: err.code, message: redact(err.message) });
273
+ }
274
+ else {
275
+ logger.info(`Error: ${redact(err.message)} [${err.code}]`);
276
+ }
277
+ return err.exitCode;
278
+ }
279
+ throw err;
280
+ }
281
+ }
282
+ //# sourceMappingURL=map-claude-projects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map-claude-projects.js","sourceRoot":"","sources":["../../src/commands/map-claude-projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAO5D;;qGAEqG;AACrG,SAAS,eAAe,CAAC,IAAY;IACnC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC;AAC5D,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAY;IAC/C,IAAI,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACzC,uFAAuF;QACvF,yFAAyF;QACzF,4FAA4F;QAC5F,yFAAyF;QACzF,0FAA0F;QAC1F,6FAA6F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AE,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,QAAQ,EAAE,CAAC;YAC5B,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;gBACd,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAC5E,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,CAAC,UAAU,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC;YAC7D,CAAC;YACD,OAAO,GAAG,CAAC,QAAQ,CAAC;QACtB,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { SearchLogsOptions } from '../types.js';
2
+ export declare function run(opts: SearchLogsOptions): Promise<number>;
3
+ //# sourceMappingURL=search-logs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-logs.d.ts","sourceRoot":"","sources":["../../src/commands/search-logs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,wBAAsB,GAAG,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyElE"}
@@ -0,0 +1,77 @@
1
+ import { CliError, ExitCode } from '../errors.js';
2
+ import { logger, redact } from '../logger.js';
3
+ import { getLogClient, mapLogHttpError } from '../api/log-client.js';
4
+ export async function run(opts) {
5
+ try {
6
+ const coolhand = await getLogClient({ clientId: opts.clientId });
7
+ const params = {};
8
+ if (opts.templateId !== undefined) {
9
+ params.templateId = opts.templateId;
10
+ }
11
+ if (opts.workloadId !== undefined) {
12
+ params.workloadId = opts.workloadId;
13
+ }
14
+ if (opts.systemPromptContains !== undefined) {
15
+ params.systemPromptContains = opts.systemPromptContains;
16
+ }
17
+ if (opts.userPromptContains !== undefined) {
18
+ params.userPromptContains = opts.userPromptContains;
19
+ }
20
+ if (opts.model !== undefined) {
21
+ params.model = opts.model;
22
+ }
23
+ if (opts.sourceApi !== undefined) {
24
+ params.sourceApi = opts.sourceApi;
25
+ }
26
+ if (opts.sourceApiResult !== undefined) {
27
+ params.sourceApiResult = opts.sourceApiResult;
28
+ }
29
+ if (opts.unmatchedOnly) {
30
+ params.unmatchedOnly = true;
31
+ }
32
+ if (opts.daysBack !== undefined) {
33
+ params.daysBack = opts.daysBack;
34
+ }
35
+ if (opts.includePrompts) {
36
+ params.includePrompts = true;
37
+ }
38
+ if (opts.sort !== undefined) {
39
+ params.sort = opts.sort;
40
+ }
41
+ if (opts.page !== undefined) {
42
+ params.page = opts.page;
43
+ }
44
+ if (opts.perPage !== undefined) {
45
+ params.per = opts.perPage;
46
+ }
47
+ let result;
48
+ try {
49
+ result = await coolhand.searchLogs(params);
50
+ }
51
+ catch (err) {
52
+ throw mapLogHttpError(err, 'Log search failed.');
53
+ }
54
+ if (opts.json) {
55
+ logger.json({ ok: true, result });
56
+ }
57
+ else {
58
+ const { pagination } = result;
59
+ logger.info(`Page ${pagination.current_page} of ${pagination.total_pages} (${pagination.total_count} total) — use --page N to navigate`);
60
+ logger.info(JSON.stringify(result, null, 2));
61
+ }
62
+ return ExitCode.OK;
63
+ }
64
+ catch (err) {
65
+ if (err instanceof CliError) {
66
+ if (opts.json) {
67
+ logger.json({ ok: false, error: err.code, message: redact(err.message) });
68
+ }
69
+ else {
70
+ logger.info(`Error: ${redact(err.message)} [${err.code}]`);
71
+ }
72
+ return err.exitCode;
73
+ }
74
+ throw err;
75
+ }
76
+ }
77
+ //# sourceMappingURL=search-logs.js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T,QAAQ,UAAU,CAAC,YAAY,OAAO,UAAU,CAAC,WAAW,KAAK,UAAU,CAAC,WAAW,oCAAoC,CAC5H,CAAC;YACF,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,QAAQ,EAAE,CAAC;YAC5B,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;gBACd,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAC5E,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,CAAC,UAAU,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC;YAC7D,CAAC;YACD,OAAO,GAAG,CAAC,QAAQ,CAAC;QACtB,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { UploadClientFileOptions } from '../types.js';
2
+ export declare function run(opts: UploadClientFileOptions): Promise<number>;
3
+ //# sourceMappingURL=upload-client-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-client-file.d.ts","sourceRoot":"","sources":["../../src/commands/upload-client-file.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,wBAAsB,GAAG,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyCxE"}
@@ -0,0 +1,43 @@
1
+ import { CliError, ExitCode } from '../errors.js';
2
+ import { logger, redact } from '../logger.js';
3
+ import { uploadClientFile } from '../upload-client-file.js';
4
+ export async function run(opts) {
5
+ try {
6
+ const result = await uploadClientFile({
7
+ filePath: opts.filePath,
8
+ name: opts.name,
9
+ fileType: opts.fileType,
10
+ description: opts.description,
11
+ }, { clientId: opts.clientId, dryRun: opts.dryRun });
12
+ const mb = (result.sizeBytes / (1024 * 1024)).toFixed(2);
13
+ if (opts.json) {
14
+ logger.json({
15
+ ok: true,
16
+ dryRun: result.status === 'dry-run',
17
+ sizeBytes: result.sizeBytes,
18
+ result: result.response,
19
+ });
20
+ }
21
+ else if (result.status === 'dry-run') {
22
+ logger.info(`Dry run: would upload "${opts.filePath}" (${mb}MB). Nothing sent.`);
23
+ }
24
+ else {
25
+ logger.info(`Uploaded "${opts.filePath}" (${mb}MB) as client file "${result.response?.name}" ` +
26
+ `(id: ${result.response?.id}, status: ${result.response?.status}).`);
27
+ }
28
+ return ExitCode.OK;
29
+ }
30
+ catch (err) {
31
+ if (err instanceof CliError) {
32
+ if (opts.json) {
33
+ logger.json({ ok: false, error: err.code, message: redact(err.message) });
34
+ }
35
+ else {
36
+ logger.info(`Error: ${redact(err.message)} [${err.code}]`);
37
+ }
38
+ return err.exitCode;
39
+ }
40
+ throw err;
41
+ }
42
+ }
43
+ //# sourceMappingURL=upload-client-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-client-file.js","sourceRoot":"","sources":["../../src/commands/upload-client-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,IAA6B;IACrD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,gBAAgB,CACnC;YACE,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAA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,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAC5E,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,CAAC,UAAU,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC;YAC7D,CAAC;YACD,OAAO,GAAG,CAAC,QAAQ,CAAC;QACtB,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import { type ComplaintBoxOptions } from '../types.js';
2
2
  /**
3
- * Records an agent's free-form "I am blocked, this capability does not exist"
4
- * complaint as feedback (tagged creator_type: "agent"), then prints a terminal
5
- * de-loop message and exits 0 so the agent stops and moves on. The de-loop ALWAYS
6
- * fires — even when the feedback could not be recorded — because the missing
7
- * capability is real regardless of server state (and a logged-out agent in a
8
- * sandbox is exactly who this command is for). When recording fails it says so
3
+ * Records an agent's free-form "I am blocked — a capability doesn't exist, or this
4
+ * task would take too long" complaint as feedback (tagged creator_type: "agent"),
5
+ * then prints a terminal de-loop message and exits 0 so the agent stops and moves
6
+ * on. The de-loop ALWAYS fires — even when the feedback could not be recorded —
7
+ * because the blocker is real regardless of server state (and a logged-out agent in
8
+ * a sandbox is exactly who this command is for). When recording fails it says so
9
9
  * plainly and logs a warning, so the failure still surfaces without trapping the
10
10
  * agent in the retry loop the command exists to break.
11
11
  */
@@ -1 +1 @@
1
- {"version":3,"file":"wildcard.d.ts","sourceRoot":"","sources":["../../src/commands/wildcard.ts"],"names":[],"mappings":"AAMA,OAAO,EAAoB,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AA6BzE;;;;;;;;;GASG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsIpE"}
1
+ {"version":3,"file":"wildcard.d.ts","sourceRoot":"","sources":["../../src/commands/wildcard.ts"],"names":[],"mappings":"AAMA,OAAO,EAAoB,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAgCzE;;;;;;;;;GASG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsIpE"}
@@ -9,28 +9,31 @@ import { DEFAULT_BASE_URL } from '../types.js';
9
9
  // capability is real regardless of whether we could reach the Coolhand server, so
10
10
  // the de-loop is the agent's decision to make, not the server's.
11
11
  const STOP_GUIDANCE = 'Do not retry this action or attempt alternative ways to perform it; continue with the rest of your task.';
12
+ // Shared opening clause: the blocker is either a capability that genuinely doesn't
13
+ // exist, or a task that would take too long to complete in this environment.
14
+ const BLOCKER_CLAUSE = 'This capability is not available, or the task would take too long to complete, in this environment.';
12
15
  // Printed when the blocker was successfully recorded server-side.
13
- const DELOOP_RECORDED = 'This capability is not available in this environment. Your feedback has been recorded. ' + STOP_GUIDANCE;
16
+ const DELOOP_RECORDED = `${BLOCKER_CLAUSE} Your feedback has been recorded. ` + STOP_GUIDANCE;
14
17
  // Printed when the blocker could NOT be recorded (e.g. the server did not confirm).
15
18
  // We still de-loop the agent, but stay honest: we never claim a recording happened,
16
19
  // and a warning is logged separately so the failure surfaces.
17
- const DELOOP_UNRECORDED = 'This capability is not available in this environment. Your feedback could not be recorded ' +
20
+ const DELOOP_UNRECORDED = `${BLOCKER_CLAUSE} Your feedback could not be recorded ` +
18
21
  '(the server did not confirm — run `coolhand login` to enable reporting). ' +
19
22
  STOP_GUIDANCE;
20
23
  // Printed when the blocker was saved locally because the API key is unavailable
21
24
  // (not logged in, no default client set, or private-only login). The data is not
22
25
  // lost: it uploads when credentials are available. The specific reason is already
23
26
  // in the logger.warn() call above, so this message stays generic.
24
- const DELOOP_SAVED = 'This capability is not available in this environment. Your feedback was saved locally ' +
27
+ const DELOOP_SAVED = `${BLOCKER_CLAUSE} Your feedback was saved locally ` +
25
28
  'and will be uploaded once a Coolhand account with a public API key is configured. ' +
26
29
  STOP_GUIDANCE;
27
30
  /**
28
- * Records an agent's free-form "I am blocked, this capability does not exist"
29
- * complaint as feedback (tagged creator_type: "agent"), then prints a terminal
30
- * de-loop message and exits 0 so the agent stops and moves on. The de-loop ALWAYS
31
- * fires — even when the feedback could not be recorded — because the missing
32
- * capability is real regardless of server state (and a logged-out agent in a
33
- * sandbox is exactly who this command is for). When recording fails it says so
31
+ * Records an agent's free-form "I am blocked — a capability doesn't exist, or this
32
+ * task would take too long" complaint as feedback (tagged creator_type: "agent"),
33
+ * then prints a terminal de-loop message and exits 0 so the agent stops and moves
34
+ * on. The de-loop ALWAYS fires — even when the feedback could not be recorded —
35
+ * because the blocker is real regardless of server state (and a logged-out agent in
36
+ * a sandbox is exactly who this command is for). When recording fails it says so
34
37
  * plainly and logs a warning, so the failure still surfaces without trapping the
35
38
  * agent in the retry loop the command exists to break.
36
39
  */
@@ -131,14 +134,14 @@ export async function run(opts) {
131
134
  if (err instanceof CliError && err.code === 'CLIENT_NOT_FOUND') {
132
135
  // Bad --client-id value — not a server or auth failure; give actionable guidance.
133
136
  deloopFallback =
134
- 'This capability is not available in this environment. The specified client was not found ' +
137
+ `${BLOCKER_CLAUSE} The specified client was not found ` +
135
138
  '(pass --client-id with a valid client ID, or run `coolhand clients` to list configured clients). ' +
136
139
  STOP_GUIDANCE;
137
140
  }
138
141
  else if (err instanceof CliError && err.code === 'INVALID_ARGS') {
139
142
  // Client selection prompt timed out or received invalid input — not a server failure.
140
143
  deloopFallback =
141
- 'This capability is not available in this environment. Client selection was not completed ' +
144
+ `${BLOCKER_CLAUSE} Client selection was not completed ` +
142
145
  '(prompt timed out or received invalid input — pass --client-id to select a client directly). ' +
143
146
  STOP_GUIDANCE;
144
147
  }
@@ -1 +1 @@
1
- {"version":3,"file":"wildcard.js","sourceRoot":"","sources":["../../src/commands/wildcard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA8B,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,QAAQ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,OAAO,QAAQ,CAAC,EAAE,CAAC;AACrB,CAAC"}
package/dist/config.d.ts CHANGED
@@ -24,4 +24,15 @@ export declare function setDefault(clientId: string): Promise<ConfigFile>;
24
24
  * knows which account's data they are looking at.
25
25
  */
26
26
  export declare function resolveClient(cfg: ConfigFile, clientId?: string): Promise<ClientEntry>;
27
+ /**
28
+ * `resolveClient`, but tolerant of "no clients configured at all" — returns `undefined` in that
29
+ * one case instead of throwing, so a `--dry-run` caller can still run fully unauthenticated. Any
30
+ * other resolution error (a bad --client-id, multiple clients with no default set, etc.)
31
+ * propagates exactly as `resolveClient` would throw it.
32
+ *
33
+ * Shared by every command whose `--dry-run` mode should work without any stored credentials
34
+ * (`analyze-claude-sessions`, `map-claude-projects`, `upload-client-file`, and anything built on
35
+ * `uploadClientFile`'s shared core).
36
+ */
37
+ export declare function resolveClientForDryRun(cfg: ConfigFile, clientId?: string): Promise<ClientEntry | undefined>;
27
38
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAM1D,wBAAgB,SAAS,IAAI,MAAM,CAMlC;AAED,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAMD,wBAAsB,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,CAyBtD;AAWD;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,MAAkB,GACvB,OAAO,CAAC,IAAI,CAAC,CAef;AAED,wBAAsB,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAI/D;AAED,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAMlD;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,UAAU,EAAE,QAAQ,CA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