@superdesign/cli 0.1.11 → 0.1.13

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.
@@ -13,7 +13,6 @@ export interface IterateDraftRequest {
13
13
  mode: 'replace' | 'branch';
14
14
  }
15
15
  export interface PlanFlowRequest {
16
- sourceNodeId: string;
17
16
  flowContext?: string;
18
17
  }
19
18
  export interface FlowPage {
@@ -21,7 +20,6 @@ export interface FlowPage {
21
20
  prompt: string;
22
21
  }
23
22
  export interface ExecuteFlowRequest {
24
- sourceNodeId: string;
25
23
  flowContext?: string;
26
24
  pages: FlowPage[];
27
25
  }
@@ -12,7 +12,7 @@ export declare const POLL_TIMEOUT_MS: number;
12
12
  export declare const AUTH_POLL_INTERVAL_MS = 2000;
13
13
  export declare const AUTH_POLL_TIMEOUT_MS: number;
14
14
  /** CLI version - should match package.json */
15
- export declare const CLI_VERSION = "0.1.11";
15
+ export declare const CLI_VERSION = "0.1.13";
16
16
  /** PostHog analytics configuration */
17
17
  export declare const POSTHOG_KEY: string;
18
18
  export declare const POSTHOG_HOST: string;
package/dist/index.cjs CHANGED
@@ -316,7 +316,7 @@ var __webpack_exports__ = {};
316
316
  try {
317
317
  startSpinner('Creating auth session...');
318
318
  const session = await createSession({
319
- cliVersion: "0.1.11",
319
+ cliVersion: "0.1.13",
320
320
  os: `${external_os_namespaceObject.platform()} ${external_os_namespaceObject.release()}`,
321
321
  hostname: external_os_namespaceObject.hostname()
322
322
  });
@@ -928,7 +928,6 @@ Usage Examples:
928
928
  const command = new external_commander_namespaceObject.Command('plan-flow-pages').description('Plan flow pages using AI').requiredOption('--draft-id <id>', 'Source draft ID').option('--context <context>', 'Additional context for flow planning').option('--json', 'Output in JSON format').action(async (options)=>{
929
929
  if (options.json) setJsonMode(true);
930
930
  job_runner_requireAuth(manager_isAuthenticated);
931
- const sourceNodeId = `draft-variant-${options.draftId}`;
932
931
  await runJob({
933
932
  startLabel: 'Planning flow pages...',
934
933
  pollingLabel: 'AI is analyzing and planning pages...',
@@ -936,7 +935,6 @@ Usage Examples:
936
935
  timeoutLabel: 'Planning timed out',
937
936
  failureLabel: 'Failed to plan flow pages',
938
937
  startJob: ()=>planFlowPages(options.draftId, {
939
- sourceNodeId,
940
938
  flowContext: options.context
941
939
  }),
942
940
  transformResult: (job)=>({
@@ -988,7 +986,6 @@ Usage Examples:
988
986
  output_error('Maximum 10 pages allowed');
989
987
  process.exit(EXIT_CODES.VALIDATION_ERROR);
990
988
  }
991
- const sourceNodeId = `draft-variant-${options.draftId}`;
992
989
  const timeoutMs = Math.max(300000, 2 * pages.length * 60000);
993
990
  await runJob({
994
991
  startLabel: `Generating ${pages.length} flow page(s)...`,
@@ -998,7 +995,6 @@ Usage Examples:
998
995
  failureLabel: 'Failed to execute flow pages',
999
996
  timeoutMs,
1000
997
  startJob: ()=>executeFlowPages(options.draftId, {
1001
- sourceNodeId,
1002
998
  flowContext: options.context,
1003
999
  pages
1004
1000
  }),
@@ -1315,7 +1311,7 @@ Usage Examples:
1315
1311
  durationMs: opts.durationMs,
1316
1312
  errorCode: opts.errorCode,
1317
1313
  options: opts.options,
1318
- cliVersion: "0.1.11",
1314
+ cliVersion: "0.1.13",
1319
1315
  os: `${external_os_default().platform()} ${external_os_default().release()}`
1320
1316
  };
1321
1317
  const posthog = getPostHog();
@@ -1350,9 +1346,46 @@ Usage Examples:
1350
1346
  path: (0, external_path_namespaceObject.resolve)(src_dirname, '../.env')
1351
1347
  });
1352
1348
  (0, external_dotenv_namespaceObject.config)();
1349
+ function getFailedCommandUsage(program) {
1350
+ const failedCommand = findFailedCommand(program);
1351
+ if (!failedCommand) return {
1352
+ message: 'Run with --help for usage information'
1353
+ };
1354
+ return {
1355
+ command: failedCommand.name(),
1356
+ description: failedCommand.description(),
1357
+ requiredOptions: failedCommand.options.filter((opt)=>opt.mandatory).map((opt)=>({
1358
+ flags: opt.flags,
1359
+ description: opt.description
1360
+ })),
1361
+ allOptions: failedCommand.options.map((opt)=>({
1362
+ flags: opt.flags,
1363
+ description: opt.description,
1364
+ required: opt.mandatory
1365
+ }))
1366
+ };
1367
+ }
1368
+ function getFailedCommandHelp(program) {
1369
+ const failedCommand = findFailedCommand(program);
1370
+ if (!failedCommand) return '\nRun with --help for usage information\n';
1371
+ return '\n' + failedCommand.helpInformation();
1372
+ }
1373
+ function findFailedCommand(program) {
1374
+ const args = process.argv;
1375
+ const commandName = args[2];
1376
+ if (!commandName || commandName.startsWith('-')) return program;
1377
+ const subcommand = program.commands.find((cmd)=>cmd.name() === commandName);
1378
+ return subcommand || program;
1379
+ }
1353
1380
  function createProgram() {
1354
1381
  const program = new external_commander_namespaceObject.Command();
1355
- program.name('superdesign').description('SuperDesign CLI - AI product designer for coding agents').version("0.1.11");
1382
+ program.name('superdesign').description('SuperDesign CLI - AI product designer for coding agents').version("0.1.13");
1383
+ program.configureOutput({
1384
+ writeErr: (str)=>{
1385
+ if (!process.argv.includes('--json')) process.stderr.write(str);
1386
+ }
1387
+ });
1388
+ program.exitOverride();
1356
1389
  let startTime = 0;
1357
1390
  program.hook('preAction', ()=>{
1358
1391
  startTime = Date.now();
@@ -1366,26 +1399,58 @@ Usage Examples:
1366
1399
  });
1367
1400
  await shutdownAnalytics();
1368
1401
  });
1369
- program.addCommand(createLoginCommand());
1370
- program.addCommand(createLogoutCommand());
1371
- program.addCommand(createInitCommand());
1372
- program.addCommand(createCreateProjectCommand());
1373
- program.addCommand(createIterateDesignDraftCommand());
1374
- program.addCommand(createPlanFlowPagesCommand(), {
1402
+ const addCommandWithOverride = (cmd, opts)=>{
1403
+ cmd.exitOverride();
1404
+ cmd.configureOutput({
1405
+ writeErr: (str)=>{
1406
+ if (!process.argv.includes('--json')) process.stderr.write(str);
1407
+ }
1408
+ });
1409
+ program.addCommand(cmd, opts);
1410
+ };
1411
+ addCommandWithOverride(createLoginCommand());
1412
+ addCommandWithOverride(createLogoutCommand());
1413
+ addCommandWithOverride(createInitCommand());
1414
+ addCommandWithOverride(createCreateProjectCommand());
1415
+ addCommandWithOverride(createIterateDesignDraftCommand());
1416
+ addCommandWithOverride(createPlanFlowPagesCommand(), {
1375
1417
  hidden: true
1376
1418
  });
1377
- program.addCommand(createExecuteFlowPagesCommand());
1378
- program.addCommand(createExtractBrandGuideCommand());
1379
- program.addCommand(createSearchPromptsCommand());
1380
- program.addCommand(createGetPromptsCommand());
1381
- program.addCommand(createFetchDesignNodesCommand());
1382
- program.addCommand(createGetDesignCommand());
1383
- program.addCommand(createCreateDesignDraftCommand());
1419
+ addCommandWithOverride(createExecuteFlowPagesCommand());
1420
+ addCommandWithOverride(createExtractBrandGuideCommand());
1421
+ addCommandWithOverride(createSearchPromptsCommand());
1422
+ addCommandWithOverride(createGetPromptsCommand());
1423
+ addCommandWithOverride(createFetchDesignNodesCommand());
1424
+ addCommandWithOverride(createGetDesignCommand());
1425
+ addCommandWithOverride(createCreateDesignDraftCommand());
1384
1426
  return program;
1385
1427
  }
1386
1428
  async function run() {
1387
1429
  const program = createProgram();
1388
- await program.parseAsync(process.argv);
1430
+ try {
1431
+ await program.parseAsync(process.argv);
1432
+ } catch (err) {
1433
+ if (err && 'object' == typeof err && 'code' in err) {
1434
+ const commanderError = err;
1435
+ if ('commander.helpDisplayed' === commanderError.code || 'commander.version' === commanderError.code) process.exit(0);
1436
+ if ('commander.missingMandatoryOptionValue' === commanderError.code) {
1437
+ const hasJsonFlag = process.argv.includes('--json');
1438
+ if (hasJsonFlag) {
1439
+ const errorOutput = {
1440
+ error: commanderError.message,
1441
+ usage: getFailedCommandUsage(program)
1442
+ };
1443
+ process.stderr.write(JSON.stringify(errorOutput, null, 2) + '\n');
1444
+ } else {
1445
+ process.stderr.write('\n');
1446
+ const helpInfo = getFailedCommandHelp(program);
1447
+ if (helpInfo) process.stderr.write(helpInfo);
1448
+ }
1449
+ process.exit(1);
1450
+ }
1451
+ }
1452
+ throw err;
1453
+ }
1389
1454
  }
1390
1455
  })();
1391
1456
  exports.ApiClientError = __webpack_exports__.ApiClientError;
package/dist/index.js CHANGED
@@ -226,7 +226,7 @@ async function runAuthFlow(options = {}) {
226
226
  try {
227
227
  startSpinner('Creating auth session...');
228
228
  const session = await createSession({
229
- cliVersion: "0.1.11",
229
+ cliVersion: "0.1.13",
230
230
  os: `${platform()} ${release()}`,
231
231
  hostname: hostname()
232
232
  });
@@ -838,7 +838,6 @@ function createPlanFlowPagesCommand() {
838
838
  const command = new Command('plan-flow-pages').description('Plan flow pages using AI').requiredOption('--draft-id <id>', 'Source draft ID').option('--context <context>', 'Additional context for flow planning').option('--json', 'Output in JSON format').action(async (options)=>{
839
839
  if (options.json) setJsonMode(true);
840
840
  job_runner_requireAuth(manager_isAuthenticated);
841
- const sourceNodeId = `draft-variant-${options.draftId}`;
842
841
  await runJob({
843
842
  startLabel: 'Planning flow pages...',
844
843
  pollingLabel: 'AI is analyzing and planning pages...',
@@ -846,7 +845,6 @@ function createPlanFlowPagesCommand() {
846
845
  timeoutLabel: 'Planning timed out',
847
846
  failureLabel: 'Failed to plan flow pages',
848
847
  startJob: ()=>planFlowPages(options.draftId, {
849
- sourceNodeId,
850
848
  flowContext: options.context
851
849
  }),
852
850
  transformResult: (job)=>({
@@ -898,7 +896,6 @@ function createExecuteFlowPagesCommand() {
898
896
  output_error('Maximum 10 pages allowed');
899
897
  process.exit(EXIT_CODES.VALIDATION_ERROR);
900
898
  }
901
- const sourceNodeId = `draft-variant-${options.draftId}`;
902
899
  const timeoutMs = Math.max(300000, 2 * pages.length * 60000);
903
900
  await runJob({
904
901
  startLabel: `Generating ${pages.length} flow page(s)...`,
@@ -908,7 +905,6 @@ function createExecuteFlowPagesCommand() {
908
905
  failureLabel: 'Failed to execute flow pages',
909
906
  timeoutMs,
910
907
  startJob: ()=>executeFlowPages(options.draftId, {
911
- sourceNodeId,
912
908
  flowContext: options.context,
913
909
  pages
914
910
  }),
@@ -1223,7 +1219,7 @@ async function trackCommand(opts) {
1223
1219
  durationMs: opts.durationMs,
1224
1220
  errorCode: opts.errorCode,
1225
1221
  options: opts.options,
1226
- cliVersion: "0.1.11",
1222
+ cliVersion: "0.1.13",
1227
1223
  os: `${os.platform()} ${os.release()}`
1228
1224
  };
1229
1225
  const posthog = getPostHog();
@@ -1258,9 +1254,46 @@ external_dotenv_config({
1258
1254
  path: external_path_resolve(src_dirname, '../.env')
1259
1255
  });
1260
1256
  external_dotenv_config();
1257
+ function getFailedCommandUsage(program) {
1258
+ const failedCommand = findFailedCommand(program);
1259
+ if (!failedCommand) return {
1260
+ message: 'Run with --help for usage information'
1261
+ };
1262
+ return {
1263
+ command: failedCommand.name(),
1264
+ description: failedCommand.description(),
1265
+ requiredOptions: failedCommand.options.filter((opt)=>opt.mandatory).map((opt)=>({
1266
+ flags: opt.flags,
1267
+ description: opt.description
1268
+ })),
1269
+ allOptions: failedCommand.options.map((opt)=>({
1270
+ flags: opt.flags,
1271
+ description: opt.description,
1272
+ required: opt.mandatory
1273
+ }))
1274
+ };
1275
+ }
1276
+ function getFailedCommandHelp(program) {
1277
+ const failedCommand = findFailedCommand(program);
1278
+ if (!failedCommand) return '\nRun with --help for usage information\n';
1279
+ return '\n' + failedCommand.helpInformation();
1280
+ }
1281
+ function findFailedCommand(program) {
1282
+ const args = process.argv;
1283
+ const commandName = args[2];
1284
+ if (!commandName || commandName.startsWith('-')) return program;
1285
+ const subcommand = program.commands.find((cmd)=>cmd.name() === commandName);
1286
+ return subcommand || program;
1287
+ }
1261
1288
  function createProgram() {
1262
1289
  const program = new Command();
1263
- program.name('superdesign').description('SuperDesign CLI - AI product designer for coding agents').version("0.1.11");
1290
+ program.name('superdesign').description('SuperDesign CLI - AI product designer for coding agents').version("0.1.13");
1291
+ program.configureOutput({
1292
+ writeErr: (str)=>{
1293
+ if (!process.argv.includes('--json')) process.stderr.write(str);
1294
+ }
1295
+ });
1296
+ program.exitOverride();
1264
1297
  let startTime = 0;
1265
1298
  program.hook('preAction', ()=>{
1266
1299
  startTime = Date.now();
@@ -1274,25 +1307,57 @@ function createProgram() {
1274
1307
  });
1275
1308
  await shutdownAnalytics();
1276
1309
  });
1277
- program.addCommand(createLoginCommand());
1278
- program.addCommand(createLogoutCommand());
1279
- program.addCommand(createInitCommand());
1280
- program.addCommand(createCreateProjectCommand());
1281
- program.addCommand(createIterateDesignDraftCommand());
1282
- program.addCommand(createPlanFlowPagesCommand(), {
1310
+ const addCommandWithOverride = (cmd, opts)=>{
1311
+ cmd.exitOverride();
1312
+ cmd.configureOutput({
1313
+ writeErr: (str)=>{
1314
+ if (!process.argv.includes('--json')) process.stderr.write(str);
1315
+ }
1316
+ });
1317
+ program.addCommand(cmd, opts);
1318
+ };
1319
+ addCommandWithOverride(createLoginCommand());
1320
+ addCommandWithOverride(createLogoutCommand());
1321
+ addCommandWithOverride(createInitCommand());
1322
+ addCommandWithOverride(createCreateProjectCommand());
1323
+ addCommandWithOverride(createIterateDesignDraftCommand());
1324
+ addCommandWithOverride(createPlanFlowPagesCommand(), {
1283
1325
  hidden: true
1284
1326
  });
1285
- program.addCommand(createExecuteFlowPagesCommand());
1286
- program.addCommand(createExtractBrandGuideCommand());
1287
- program.addCommand(createSearchPromptsCommand());
1288
- program.addCommand(createGetPromptsCommand());
1289
- program.addCommand(createFetchDesignNodesCommand());
1290
- program.addCommand(createGetDesignCommand());
1291
- program.addCommand(createCreateDesignDraftCommand());
1327
+ addCommandWithOverride(createExecuteFlowPagesCommand());
1328
+ addCommandWithOverride(createExtractBrandGuideCommand());
1329
+ addCommandWithOverride(createSearchPromptsCommand());
1330
+ addCommandWithOverride(createGetPromptsCommand());
1331
+ addCommandWithOverride(createFetchDesignNodesCommand());
1332
+ addCommandWithOverride(createGetDesignCommand());
1333
+ addCommandWithOverride(createCreateDesignDraftCommand());
1292
1334
  return program;
1293
1335
  }
1294
1336
  async function run() {
1295
1337
  const program = createProgram();
1296
- await program.parseAsync(process.argv);
1338
+ try {
1339
+ await program.parseAsync(process.argv);
1340
+ } catch (err) {
1341
+ if (err && 'object' == typeof err && 'code' in err) {
1342
+ const commanderError = err;
1343
+ if ('commander.helpDisplayed' === commanderError.code || 'commander.version' === commanderError.code) process.exit(0);
1344
+ if ('commander.missingMandatoryOptionValue' === commanderError.code) {
1345
+ const hasJsonFlag = process.argv.includes('--json');
1346
+ if (hasJsonFlag) {
1347
+ const errorOutput = {
1348
+ error: commanderError.message,
1349
+ usage: getFailedCommandUsage(program)
1350
+ };
1351
+ process.stderr.write(JSON.stringify(errorOutput, null, 2) + '\n');
1352
+ } else {
1353
+ process.stderr.write('\n');
1354
+ const helpInfo = getFailedCommandHelp(program);
1355
+ if (helpInfo) process.stderr.write(helpInfo);
1356
+ }
1357
+ process.exit(1);
1358
+ }
1359
+ }
1360
+ throw err;
1361
+ }
1297
1362
  }
1298
1363
  export { ApiClientError, addDraft, claimSession, clearConfig, createApiClient, createDraft, createProgram, createProject, createPublicApiClient, createSession, executeFlowPages, extractBrandGuide, fetchDesignNodes, getApiClient, getApiKey, getApiUrl, getConfigDir, getConfigPath, getDesignHtml, getJobStatus, getPrompts, manager_isAuthenticated as isAuthenticated, isJobCompleted, isJobDone, isJobFailed, iterateDraft, loadConfig, planFlowPages, pollSession, run, saveConfig, searchPrompts, updateConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdesign/cli",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "CLI for SuperDesign Platform - agent skills for Claude Code",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",