Commit 12288ed
authored
fix(cli): error messages in utils/ misc (flags, fs, git, npm, promise, terminal) (#1260)
* fix(cli): align utils/ miscellaneous error messages with 4-ingredient strategy
Final PR in the error-message series. Covers everything not already
touched by #1255-#1259: utils/basics, utils/config, utils/fs,
utils/git, utils/npm, utils/promise, utils/terminal, and the flags
module at the root of the CLI tree.
Sources:
- flags.mts: 2 throws (--max-old-space-size, --max-semi-space-size)
— name the flag, show the offending value, suggest a concrete
megabyte value.
- utils/config.mts: 1 throw (SOCKET_CLI_CONFIG base64 decode) —
explains the replacement-character symptom and how to re-encode.
- utils/basics/vfs-extract.mts: 4 throws (SEA VFS extraction for
Python + security tools) — name the missing paths, the exit
codes, and point at the "rebuild the SEA binary" fix.
- utils/promise/queue.mts: 1 throw (PromiseQueue concurrency guard)
— show the offending value and suggest 4/8.
- utils/npm/spec.mts: 1 throw (PURL conversion) — show the input,
state what a valid npm spec looks like.
- utils/git/operations.mts: 1 throw (git-not-on-PATH) — point at
install and the local-path env-var override.
- utils/git/gitlab-provider.mts: 2 throws (no token, PR creation
after retries) — name the token scope, the retry count, the
repo/head refs.
- utils/fs/path-resolve.mts: 1 throw (npm path-walk iteration cap)
— name the start path, current directory, and what usually
causes the cycle (symlinks).
- utils/terminal/iocraft.mts: 1 throw (native-module load failure)
— show the underlying error and the offending platform/arch
triple.
Skipped (already informative):
- github-provider.mts pass-through errors (forward inner CResult
cause/message)
- gitlab-provider.mts try/catch wrappers that call
formatErrorWithDetail (inner error has context)
- 'process.exit called' sentinel throws in npm/pnpm/yarn/with-
subcommands paths (test harness re-raise markers, not user-facing)
Tests updated:
- test/unit/utils/promise/queue.test.mts (2 assertions)
- test/unit/utils/npm/spec.test.mts (2 assertions)
- test/unit/utils/git/gitlab-provider.test.mts (3 assertions)
Full suite (343 files / 5225 tests) passes.
Completes the series: #1255 (commands/) → #1256 (utils/dlx/) →
#1257 (utils/update + utils/command/) → #1258 (env/ + constants/) →
#1259 (test/) → this.
* fix(cli): address Cursor bugbot findings on error messages
Four issues flagged by Cursor bugbot on #1260:
1. (Medium) gitlab-provider.mts: error said 'check GL_TOKEN permissions'
but the actual env var is GITLAB_TOKEN (as the same file's getGitLabToken
confirms). Fixed to GITLAB_TOKEN.
2. (Medium) git/operations.mts: error suggested 'set SOCKET_CLI_GIT_PATH
to point at a specific binary' — that env var is not read anywhere.
Removed the false suggestion; kept the real fix (install git and put
it on PATH) with package-manager examples.
3. (Low) terminal/iocraft.mts: '(e as Error).message' evaluates to
undefined when a non-Error is thrown. Switched to
'e instanceof Error ? e.message : String(e)' for safe stringification.
4. (Low) gitlab-provider.mts: error said 'after ${retries} retries' but
the loop runs attempt 1..retries inclusive — retries is the total
attempt count, not retries beyond the first. Reworded to 'attempts'.
Matching test assertions updated.
Caught by #1260 bugbot review.
* chore(cli): use joinAnd + getErrorCause helpers in utils/ misc
- basics/vfs-extract.mts: missingTools list now renders as prose
via joinAnd('a, b, and c').
- terminal/iocraft.mts: inline `e instanceof Error ? e.message :
String(e)` swapped for getErrorCause(e). require() of a native
binding can throw non-Error values, so the safe-stringify with
UNKNOWN_ERROR fallback is correct here.
No behavior change for Error throws.1 parent e272f33 commit 12288ed
12 files changed
Lines changed: 38 additions & 22 deletions
File tree
- packages/cli
- src
- utils
- basics
- fs
- git
- npm
- promise
- terminal
- test/unit/utils
- git
- npm
- promise
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
179 | | - | |
| 180 | + | |
180 | 181 | | |
181 | 182 | | |
182 | 183 | | |
| |||
186 | 187 | | |
187 | 188 | | |
188 | 189 | | |
189 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
190 | 193 | | |
191 | 194 | | |
192 | 195 | | |
| |||
197 | 200 | | |
198 | 201 | | |
199 | 202 | | |
200 | | - | |
| 203 | + | |
201 | 204 | | |
202 | 205 | | |
203 | 206 | | |
| |||
218 | 221 | | |
219 | 222 | | |
220 | 223 | | |
221 | | - | |
| 224 | + | |
222 | 225 | | |
223 | 226 | | |
224 | 227 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
144 | 146 | | |
145 | 147 | | |
146 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
330 | | - | |
| 330 | + | |
331 | 331 | | |
332 | 332 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
188 | 190 | | |
189 | 191 | | |
190 | 192 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | | - | |
31 | | - | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
197 | 199 | | |
198 | 200 | | |
199 | 201 | | |
| |||
212 | 214 | | |
213 | 215 | | |
214 | 216 | | |
215 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
216 | 220 | | |
217 | 221 | | |
218 | 222 | | |
| |||
0 commit comments