@superdesign/cli 0.1.1 → 0.1.3
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.
- package/dist/api/drafts.d.ts +3 -2
- package/dist/config/constants.d.ts +1 -1
- package/dist/index.cjs +52 -20
- package/dist/index.js +52 -20
- package/package.json +1 -1
package/dist/api/drafts.d.ts
CHANGED
|
@@ -7,9 +7,10 @@ export interface CreateDraftRequest {
|
|
|
7
7
|
deviceMode?: 'mobile' | 'tablet' | 'desktop';
|
|
8
8
|
}
|
|
9
9
|
export interface IterateDraftRequest {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
prompts?: string[];
|
|
11
|
+
prompt?: string;
|
|
12
12
|
count?: 1 | 2 | 3 | 4;
|
|
13
|
+
mode: 'replace' | 'branch';
|
|
13
14
|
}
|
|
14
15
|
export interface PlanFlowRequest {
|
|
15
16
|
sourceNodeId: string;
|
|
@@ -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.
|
|
15
|
+
export declare const CLI_VERSION = "0.1.2";
|
|
16
16
|
/** Config directory name */
|
|
17
17
|
export declare const CONFIG_DIR_NAME = ".superdesign";
|
|
18
18
|
/** Config file name */
|
package/dist/index.cjs
CHANGED
|
@@ -313,7 +313,7 @@ var __webpack_exports__ = {};
|
|
|
313
313
|
try {
|
|
314
314
|
startSpinner('Creating auth session...');
|
|
315
315
|
const session = await createSession({
|
|
316
|
-
cliVersion: "0.1.
|
|
316
|
+
cliVersion: "0.1.2",
|
|
317
317
|
os: `${external_os_namespaceObject.platform()} ${external_os_namespaceObject.release()}`,
|
|
318
318
|
hostname: external_os_namespaceObject.hostname()
|
|
319
319
|
});
|
|
@@ -1094,33 +1094,65 @@ superdesign get-design --draft-id <id> --json
|
|
|
1094
1094
|
});
|
|
1095
1095
|
return command;
|
|
1096
1096
|
}
|
|
1097
|
+
const VALID_MODES = [
|
|
1098
|
+
'replace',
|
|
1099
|
+
'branch'
|
|
1100
|
+
];
|
|
1101
|
+
const MAX_VARIATIONS = 4;
|
|
1102
|
+
function parseCount(countStr) {
|
|
1103
|
+
if (void 0 === countStr) return;
|
|
1104
|
+
const count = parseInt(countStr, 10);
|
|
1105
|
+
return isNaN(count) ? NaN : count;
|
|
1106
|
+
}
|
|
1107
|
+
function validateOptions(options) {
|
|
1108
|
+
if (!VALID_MODES.includes(options.mode)) {
|
|
1109
|
+
output_error('Invalid mode. Must be: replace or branch');
|
|
1110
|
+
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
1111
|
+
}
|
|
1112
|
+
const prompts = options.prompt;
|
|
1113
|
+
const count = parseCount(options.count);
|
|
1114
|
+
if (void 0 !== count && (isNaN(count) || count < 1 || count > MAX_VARIATIONS)) {
|
|
1115
|
+
output_error(`Invalid count. Must be between 1 and ${MAX_VARIATIONS}`);
|
|
1116
|
+
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
1117
|
+
}
|
|
1118
|
+
if (prompts.length > 1 && void 0 !== count) {
|
|
1119
|
+
output_error('Cannot use --count with multiple prompts. Either provide multiple -p prompts OR single -p with --count.');
|
|
1120
|
+
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
1121
|
+
}
|
|
1122
|
+
if (prompts.length > MAX_VARIATIONS) {
|
|
1123
|
+
output_error(`Must provide 1-${MAX_VARIATIONS} prompts`);
|
|
1124
|
+
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
1125
|
+
}
|
|
1126
|
+
if ('replace' === options.mode && (prompts.length > 1 || count && count > 1)) {
|
|
1127
|
+
output_error('Replace mode only supports 1 prompt/variation');
|
|
1128
|
+
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
1129
|
+
}
|
|
1130
|
+
return {
|
|
1131
|
+
prompts,
|
|
1132
|
+
count,
|
|
1133
|
+
mode: options.mode
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1097
1136
|
function createIterateDesignDraftCommand() {
|
|
1098
|
-
const command = new external_commander_namespaceObject.Command('iterate-design-draft').description('Iterate on an existing draft using AI').requiredOption('--draft-id <id>', 'Draft ID to iterate on').requiredOption('--prompt <prompt
|
|
1137
|
+
const command = new external_commander_namespaceObject.Command('iterate-design-draft').description('Iterate on an existing draft using AI').requiredOption('--draft-id <id>', 'Draft ID to iterate on').requiredOption('-p, --prompt <prompt...>', 'Iteration prompt(s). Use multiple -p for specific prompts per variation.').requiredOption('--mode <mode>', 'Iteration mode (replace or branch)').option('--count <count>', 'Number of variations (1-4). Only used when single prompt provided.').option('--json', 'Output in JSON format').action(async (options)=>{
|
|
1099
1138
|
if (options.json) setJsonMode(true);
|
|
1100
1139
|
job_runner_requireAuth(manager_isAuthenticated);
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
output_error('Invalid count. Must be between 1 and 4');
|
|
1111
|
-
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
1112
|
-
}
|
|
1140
|
+
const { prompts, count, mode } = validateOptions(options);
|
|
1141
|
+
const requestData = prompts.length > 1 ? {
|
|
1142
|
+
prompts,
|
|
1143
|
+
mode
|
|
1144
|
+
} : {
|
|
1145
|
+
prompt: prompts[0],
|
|
1146
|
+
count: count,
|
|
1147
|
+
mode
|
|
1148
|
+
};
|
|
1113
1149
|
await runJob({
|
|
1114
1150
|
startLabel: 'Starting iteration...',
|
|
1115
1151
|
pollingLabel: 'Iterating design with AI...',
|
|
1116
1152
|
successLabel: 'Iteration complete!',
|
|
1117
1153
|
timeoutLabel: 'Iteration timed out',
|
|
1118
1154
|
failureLabel: 'Failed to iterate draft',
|
|
1119
|
-
startJob: ()=>iterateDraft(options.draftId,
|
|
1120
|
-
prompt: options.prompt,
|
|
1121
|
-
mode: options.mode,
|
|
1122
|
-
count: count
|
|
1123
|
-
}),
|
|
1155
|
+
startJob: ()=>iterateDraft(options.draftId, requestData),
|
|
1124
1156
|
transformResult: (job)=>({
|
|
1125
1157
|
drafts: job.result.drafts,
|
|
1126
1158
|
projectUrl: job.result.projectUrl,
|
|
@@ -1501,7 +1533,7 @@ superdesign get-design --draft-id <id> --json
|
|
|
1501
1533
|
(0, external_dotenv_namespaceObject.config)();
|
|
1502
1534
|
function createProgram() {
|
|
1503
1535
|
const program = new external_commander_namespaceObject.Command();
|
|
1504
|
-
program.name('superdesign').description('SuperDesign CLI - AI product designer for coding agents').version("0.1.
|
|
1536
|
+
program.name('superdesign').description('SuperDesign CLI - AI product designer for coding agents').version("0.1.2");
|
|
1505
1537
|
program.addCommand(createLoginCommand());
|
|
1506
1538
|
program.addCommand(createLogoutCommand());
|
|
1507
1539
|
program.addCommand(createInitCommand());
|
package/dist/index.js
CHANGED
|
@@ -223,7 +223,7 @@ async function runAuthFlow(options = {}) {
|
|
|
223
223
|
try {
|
|
224
224
|
startSpinner('Creating auth session...');
|
|
225
225
|
const session = await createSession({
|
|
226
|
-
cliVersion: "0.1.
|
|
226
|
+
cliVersion: "0.1.2",
|
|
227
227
|
os: `${platform()} ${release()}`,
|
|
228
228
|
hostname: hostname()
|
|
229
229
|
});
|
|
@@ -1004,33 +1004,65 @@ function createCreateDesignDraftCommand() {
|
|
|
1004
1004
|
});
|
|
1005
1005
|
return command;
|
|
1006
1006
|
}
|
|
1007
|
+
const VALID_MODES = [
|
|
1008
|
+
'replace',
|
|
1009
|
+
'branch'
|
|
1010
|
+
];
|
|
1011
|
+
const MAX_VARIATIONS = 4;
|
|
1012
|
+
function parseCount(countStr) {
|
|
1013
|
+
if (void 0 === countStr) return;
|
|
1014
|
+
const count = parseInt(countStr, 10);
|
|
1015
|
+
return isNaN(count) ? NaN : count;
|
|
1016
|
+
}
|
|
1017
|
+
function validateOptions(options) {
|
|
1018
|
+
if (!VALID_MODES.includes(options.mode)) {
|
|
1019
|
+
output_error('Invalid mode. Must be: replace or branch');
|
|
1020
|
+
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
1021
|
+
}
|
|
1022
|
+
const prompts = options.prompt;
|
|
1023
|
+
const count = parseCount(options.count);
|
|
1024
|
+
if (void 0 !== count && (isNaN(count) || count < 1 || count > MAX_VARIATIONS)) {
|
|
1025
|
+
output_error(`Invalid count. Must be between 1 and ${MAX_VARIATIONS}`);
|
|
1026
|
+
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
1027
|
+
}
|
|
1028
|
+
if (prompts.length > 1 && void 0 !== count) {
|
|
1029
|
+
output_error('Cannot use --count with multiple prompts. Either provide multiple -p prompts OR single -p with --count.');
|
|
1030
|
+
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
1031
|
+
}
|
|
1032
|
+
if (prompts.length > MAX_VARIATIONS) {
|
|
1033
|
+
output_error(`Must provide 1-${MAX_VARIATIONS} prompts`);
|
|
1034
|
+
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
1035
|
+
}
|
|
1036
|
+
if ('replace' === options.mode && (prompts.length > 1 || count && count > 1)) {
|
|
1037
|
+
output_error('Replace mode only supports 1 prompt/variation');
|
|
1038
|
+
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
1039
|
+
}
|
|
1040
|
+
return {
|
|
1041
|
+
prompts,
|
|
1042
|
+
count,
|
|
1043
|
+
mode: options.mode
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1007
1046
|
function createIterateDesignDraftCommand() {
|
|
1008
|
-
const command = new Command('iterate-design-draft').description('Iterate on an existing draft using AI').requiredOption('--draft-id <id>', 'Draft ID to iterate on').requiredOption('--prompt <prompt
|
|
1047
|
+
const command = new Command('iterate-design-draft').description('Iterate on an existing draft using AI').requiredOption('--draft-id <id>', 'Draft ID to iterate on').requiredOption('-p, --prompt <prompt...>', 'Iteration prompt(s). Use multiple -p for specific prompts per variation.').requiredOption('--mode <mode>', 'Iteration mode (replace or branch)').option('--count <count>', 'Number of variations (1-4). Only used when single prompt provided.').option('--json', 'Output in JSON format').action(async (options)=>{
|
|
1009
1048
|
if (options.json) setJsonMode(true);
|
|
1010
1049
|
job_runner_requireAuth(manager_isAuthenticated);
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
output_error('Invalid count. Must be between 1 and 4');
|
|
1021
|
-
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
1022
|
-
}
|
|
1050
|
+
const { prompts, count, mode } = validateOptions(options);
|
|
1051
|
+
const requestData = prompts.length > 1 ? {
|
|
1052
|
+
prompts,
|
|
1053
|
+
mode
|
|
1054
|
+
} : {
|
|
1055
|
+
prompt: prompts[0],
|
|
1056
|
+
count: count,
|
|
1057
|
+
mode
|
|
1058
|
+
};
|
|
1023
1059
|
await runJob({
|
|
1024
1060
|
startLabel: 'Starting iteration...',
|
|
1025
1061
|
pollingLabel: 'Iterating design with AI...',
|
|
1026
1062
|
successLabel: 'Iteration complete!',
|
|
1027
1063
|
timeoutLabel: 'Iteration timed out',
|
|
1028
1064
|
failureLabel: 'Failed to iterate draft',
|
|
1029
|
-
startJob: ()=>iterateDraft(options.draftId,
|
|
1030
|
-
prompt: options.prompt,
|
|
1031
|
-
mode: options.mode,
|
|
1032
|
-
count: count
|
|
1033
|
-
}),
|
|
1065
|
+
startJob: ()=>iterateDraft(options.draftId, requestData),
|
|
1034
1066
|
transformResult: (job)=>({
|
|
1035
1067
|
drafts: job.result.drafts,
|
|
1036
1068
|
projectUrl: job.result.projectUrl,
|
|
@@ -1410,7 +1442,7 @@ external_dotenv_config({
|
|
|
1410
1442
|
external_dotenv_config();
|
|
1411
1443
|
function createProgram() {
|
|
1412
1444
|
const program = new Command();
|
|
1413
|
-
program.name('superdesign').description('SuperDesign CLI - AI product designer for coding agents').version("0.1.
|
|
1445
|
+
program.name('superdesign').description('SuperDesign CLI - AI product designer for coding agents').version("0.1.2");
|
|
1414
1446
|
program.addCommand(createLoginCommand());
|
|
1415
1447
|
program.addCommand(createLogoutCommand());
|
|
1416
1448
|
program.addCommand(createInitCommand());
|