You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the user's intent is unambiguous, **do what they meant** instead of rejecting with an error. Show a `log.warn()` notice explaining what was corrected and how to do it properly next time. Only reject when intent is ambiguous or the input is genuinely dangerous (e.g., path traversal).
556
+
557
+
This applies across the CLI:
558
+
-**Input cleanup** — strip copy-paste artifacts (line breaks, indentation) and warn, rather than throwing `ValidationError`
559
+
-**Entity type recovery** — resolve wrong-type identifiers to the correct type (see "Auto-Recovery" below)
560
+
-**Argument order swapping** — fix swapped positional args with a stderr warning
561
+
-**Slug/org matching** — redirect bare slugs to the most likely intent
562
+
563
+
When recovery is **ambiguous or impossible**, keep the error but add entity-aware suggestions and fuzzy matches.
564
+
553
565
### Error Handling
554
566
555
567
All CLI errors extend the `CliError` base class from `src/lib/errors.ts`:
* **Testing Stricli command func() bodies via spyOn mocking**: To unit-test a Stricli command's \`func()\` body: (1) \`const func = await cmd.loader()\`, (2) \`func.call(mockContext, flags, ...args)\` with mock \`stdout\`, \`stderr\`, \`cwd\`, \`setContext\`. (3) \`spyOn\` namespace imports to mock dependencies (e.g., \`spyOn(apiClient, 'getLogs')\`). The \`loader()\` return type union causes \`.call()\` LSP errors — these are false positives that pass \`tsc --noEmit\`. When API functions are renamed (e.g., \`getLog\` → \`getLogs\`), update both spy target name AND mock return shape (single → array). Slug normalization (\`normalizeSlug\`) replaces underscores with dashes but does NOT lowercase — test assertions must match original casing (e.g., \`'CAM-82X'\` not \`'cam-82x'\`).
0 commit comments