Skip to content

Commit fbd32f6

Browse files
authored
✨ Split init and auth wiring (#258)
Why: make setup and auth commands dependable before the API, server, and client integration slices land on top. These commands are first-run and account-boundary surfaces, so they need clear behavior, isolated state, and tests that exercise user-visible outcomes.\n\nWhat changed:\n- Tightened init config generation and plugin loading behavior.\n- Hardened login/logout/whoami auth flows with injectable boundaries and clearer failure handling.\n- Added focused command tests for init, login, logout, whoami, config, and context behavior.\n- Kept CLI test runs isolated from real local auth/config state.\n\nVerification:\n- npm run lint\n- npm run build\n- node --test tests/commands/init.test.js tests/commands/login.test.js tests/commands/logout.test.js tests/commands/whoami.test.js\n- GitHub CI: CI Status, Node 22, Node 24, SDK E2E, SDK Unit Status, and GitHub visual workflows all passed.\n\nNote: external Vizzly CLI Reporter requested review for a recurring mobile fullscreen-viewer visual diff outside this PR's code scope.
1 parent 0c1d1fd commit fbd32f6

13 files changed

Lines changed: 1550 additions & 355 deletions

File tree

src/commands/config-cmd.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Config command - query and display configuration
33
*/
44

5+
import { CONFIG_DEFAULTS } from '../config/core.js';
56
import { loadConfig as defaultLoadConfig } from '../utils/config-loader.js';
67
import * as defaultOutput from '../utils/output.js';
78

@@ -40,10 +41,10 @@ export async function configCommand(
4041

4142
// Build the config object to display
4243
let displayConfig = {
43-
server: config.server || { port: 47392, timeout: 30000 },
44+
server: config.server || CONFIG_DEFAULTS.server,
4445
build: config.build || {},
4546
upload: config.upload || {},
46-
comparison: config.comparison || { threshold: 2.0 },
47+
comparison: config.comparison || CONFIG_DEFAULTS.comparison,
4748
tdd: config.tdd || {},
4849
};
4950

src/commands/context.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function validateLimitRange(value, flagName, { min = 1, max }) {
2929
}
3030

3131
if (!Number.isInteger(value) || value < min || value > max) {
32-
return [`${flagName} must be a number between ${min} and ${max}`];
32+
return [`${flagName} must be an integer between ${min} and ${max}`];
3333
}
3434

3535
return [];
@@ -41,7 +41,7 @@ function validateOffset(value) {
4141
}
4242

4343
if (!Number.isInteger(value) || value < 0) {
44-
return ['--offset must be a non-negative number'];
44+
return ['--offset must be a non-negative integer'];
4545
}
4646

4747
return [];

0 commit comments

Comments
 (0)