@superdesign/cli 0.1.7 → 0.1.9
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/README.md +11 -14
- package/dist/config/constants.d.ts +1 -1
- package/dist/index.cjs +31 -28
- package/dist/index.js +32 -29
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,9 +39,9 @@ Use these to discover style direction, references, and brand context:
|
|
|
39
39
|
- **Search prompt library** (style/components/pages)
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
superdesign search-prompts --
|
|
42
|
+
superdesign search-prompts --query "<query>" --json
|
|
43
43
|
superdesign search-prompts --tags "style" --json
|
|
44
|
-
superdesign search-prompts --tags "style" --
|
|
44
|
+
superdesign search-prompts --tags "style" --query "<style query>" --json
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
- **Get full prompt details**
|
|
@@ -59,7 +59,7 @@ Use these to discover style direction, references, and brand context:
|
|
|
59
59
|
|
|
60
60
|
Use design agent to generate high quality design drafts:
|
|
61
61
|
|
|
62
|
-
- Create project (
|
|
62
|
+
- Create project (auto-detects `.superdesign/design-system.md` as prompt)
|
|
63
63
|
- Create design draft
|
|
64
64
|
- Iterate design draft (replace / branch)
|
|
65
65
|
- Plan flow pages → execute flow pages
|
|
@@ -75,7 +75,7 @@ Use design agent to generate high quality design drafts:
|
|
|
75
75
|
4. Ask user whether ready to design in superdesign OR implement UI directly
|
|
76
76
|
5. If yes to superdesign
|
|
77
77
|
5.1 Create/update a pixel perfect html replica of current UI of page that we will design on top of in `.superdesign/replica_html_template/<name>.html` (html should only contain & reflect how UI look now, the actual design should be handled by superdesign agent)
|
|
78
|
-
5.2 Create project with this replica html
|
|
78
|
+
5.2 Create project with this replica html
|
|
79
79
|
5.3 Start desigining by iterating & branching design draft based on designDraft ID returned from project
|
|
80
80
|
|
|
81
81
|
## Always-on rules
|
|
@@ -192,11 +192,11 @@ Then in the iterate command:
|
|
|
192
192
|
```bash
|
|
193
193
|
superdesign create-project \
|
|
194
194
|
--title "<feature>" \
|
|
195
|
-
--
|
|
196
|
-
--set-project-prompt-file .superdesign/design-system.md \
|
|
195
|
+
--template .superdesign/replica_html_template/<file>.html \
|
|
197
196
|
--json
|
|
198
197
|
```
|
|
199
198
|
→ Note: `draftId` in response is the baseline draft
|
|
199
|
+
→ Auto-detects `.superdesign/design-system.md` as project prompt
|
|
200
200
|
3.4 Branch designs from baseline (use `draftId` from step 3.3)
|
|
201
201
|
```bash
|
|
202
202
|
superdesign iterate-design-draft \
|
|
@@ -218,7 +218,6 @@ Execute:
|
|
|
218
218
|
```bash
|
|
219
219
|
superdesign execute-flow-pages \
|
|
220
220
|
--draft-id <draftId> \
|
|
221
|
-
--source-node-id <nodeId> \
|
|
222
221
|
--pages '[{"title":"Signup","prompt":"..."},{"title":"Payment","prompt":"..."}]' \
|
|
223
222
|
--json
|
|
224
223
|
```
|
|
@@ -226,7 +225,7 @@ superdesign execute-flow-pages \
|
|
|
226
225
|
#### Get HTML reference from a draft
|
|
227
226
|
|
|
228
227
|
```bash
|
|
229
|
-
superdesign get-design --draft-id <draftId>
|
|
228
|
+
superdesign get-design --draft-id <draftId>
|
|
230
229
|
```
|
|
231
230
|
|
|
232
231
|
---
|
|
@@ -235,16 +234,14 @@ superdesign get-design --draft-id <draftId> --output ./design.html
|
|
|
235
234
|
|
|
236
235
|
```bash
|
|
237
236
|
# Inspirations
|
|
238
|
-
superdesign search-prompts --
|
|
237
|
+
superdesign search-prompts --query "<query>" --json
|
|
239
238
|
superdesign search-prompts --tags "style" --json
|
|
240
239
|
superdesign get-prompts --slugs "<slug1,slug2>" --json
|
|
241
240
|
superdesign extract-brand-guide --url https://example.com --json
|
|
242
241
|
|
|
243
|
-
# Canvas - Create project
|
|
244
|
-
|
|
245
|
-
superdesign create-project --title "X" --
|
|
246
|
-
superdesign create-project --title "X" --set-project-prompt-file .superdesign/design-system.md --json
|
|
247
|
-
superdesign create-project --title "X" --html-file ./index.html --set-project-prompt-file .superdesign/design-system.md --json
|
|
242
|
+
# Canvas - Create project (auto-detects .superdesign/design-system.md as prompt)
|
|
243
|
+
superdesign create-project --title "X" --json
|
|
244
|
+
superdesign create-project --title "X" --template ./index.html --json
|
|
248
245
|
|
|
249
246
|
# Iterate: replace mode (single variation, updates in place)
|
|
250
247
|
superdesign iterate-design-draft --draft-id <id> -p "..." --mode replace --json
|
|
@@ -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.9";
|
|
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.
|
|
319
|
+
cliVersion: "0.1.9",
|
|
320
320
|
os: `${external_os_namespaceObject.platform()} ${external_os_namespaceObject.release()}`,
|
|
321
321
|
hostname: external_os_namespaceObject.hostname()
|
|
322
322
|
});
|
|
@@ -724,23 +724,24 @@ superdesign --help
|
|
|
724
724
|
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
725
725
|
}
|
|
726
726
|
}
|
|
727
|
-
function
|
|
728
|
-
if (filePath)
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
}
|
|
733
|
-
|
|
727
|
+
function readFileIfExists(filePath) {
|
|
728
|
+
if ((0, external_fs_namespaceObject.existsSync)(filePath)) return (0, external_fs_namespaceObject.readFileSync)(filePath, 'utf-8');
|
|
729
|
+
}
|
|
730
|
+
function readFileOrError(filePath, fileType) {
|
|
731
|
+
if (!(0, external_fs_namespaceObject.existsSync)(filePath)) {
|
|
732
|
+
output_error(`${fileType} file not found: ${filePath}`);
|
|
733
|
+
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
734
734
|
}
|
|
735
|
-
return
|
|
735
|
+
return (0, external_fs_namespaceObject.readFileSync)(filePath, 'utf-8');
|
|
736
736
|
}
|
|
737
737
|
function createCreateProjectCommand() {
|
|
738
|
-
const command = new external_commander_namespaceObject.Command('create-project').description('Create a new SuperDesign project').requiredOption('--title <title>', 'Project title').option('--
|
|
738
|
+
const command = new external_commander_namespaceObject.Command('create-project').description('Create a new SuperDesign project').requiredOption('--title <title>', 'Project title').option('--template <path>', 'Path to HTML template file for first draft').option('--device <mode>', 'Device mode for html template (mobile, tablet, desktop)', 'desktop').option('--json', 'Output in JSON format').action(async (options)=>{
|
|
739
739
|
if (options.json) setJsonMode(true);
|
|
740
740
|
job_runner_requireAuth(manager_isAuthenticated);
|
|
741
741
|
validateDeviceMode(options.device);
|
|
742
|
-
const htmlContent =
|
|
743
|
-
const
|
|
742
|
+
const htmlContent = options.template ? readFileOrError(options.template, 'Template') : void 0;
|
|
743
|
+
const designSystemPath = '.superdesign/design-system.md';
|
|
744
|
+
const promptContent = readFileIfExists(designSystemPath);
|
|
744
745
|
startSpinner('Creating project...');
|
|
745
746
|
try {
|
|
746
747
|
const project = await createProject({
|
|
@@ -750,10 +751,8 @@ superdesign --help
|
|
|
750
751
|
deviceMode: options.device
|
|
751
752
|
});
|
|
752
753
|
succeedSpinner('Project created successfully!');
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
await openBrowser(urlWithLive);
|
|
756
|
-
}
|
|
754
|
+
const urlWithLive = `${project.projectUrl}?live=1`;
|
|
755
|
+
await openBrowser(urlWithLive);
|
|
757
756
|
if (isJsonMode()) output({
|
|
758
757
|
projectId: project.projectId,
|
|
759
758
|
title: project.title,
|
|
@@ -801,7 +800,7 @@ superdesign --help
|
|
|
801
800
|
return response.data;
|
|
802
801
|
}
|
|
803
802
|
function createCreateDesignDraftCommand() {
|
|
804
|
-
const command = new external_commander_namespaceObject.Command('create-design-draft').description('Create a design draft
|
|
803
|
+
const command = new external_commander_namespaceObject.Command('create-design-draft').description('Create a design draft from scratch without any reference, Default dont use this, use iterate-design-draft instead').requiredOption('--project-id <id>', 'Project ID').requiredOption('--title <title>', 'Draft title').requiredOption('-p, --prompt <prompt>', 'Design prompt for AI generation').option('--device <mode>', 'Device mode (mobile, tablet, desktop)', 'desktop').option('--json', 'Output in JSON format').action(async (options)=>{
|
|
805
804
|
if (options.json) setJsonMode(true);
|
|
806
805
|
job_runner_requireAuth(manager_isAuthenticated);
|
|
807
806
|
validateDeviceMode(options.device);
|
|
@@ -876,7 +875,7 @@ superdesign --help
|
|
|
876
875
|
};
|
|
877
876
|
}
|
|
878
877
|
function createIterateDesignDraftCommand() {
|
|
879
|
-
const command = new external_commander_namespaceObject.Command('iterate-design-draft').description('
|
|
878
|
+
const command = new external_commander_namespaceObject.Command('iterate-design-draft').description('Generate design based on existing draft or template, the main design exploration tool').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').addOption(new external_commander_namespaceObject.Option('--project-id <id>').hideHelp()).action(async (options)=>{
|
|
880
879
|
if (options.json) setJsonMode(true);
|
|
881
880
|
job_runner_requireAuth(manager_isAuthenticated);
|
|
882
881
|
const { prompts, count, mode } = validateOptions(options);
|
|
@@ -916,9 +915,10 @@ superdesign --help
|
|
|
916
915
|
return command;
|
|
917
916
|
}
|
|
918
917
|
function createPlanFlowPagesCommand() {
|
|
919
|
-
const command = new external_commander_namespaceObject.Command('plan-flow-pages').description('Plan flow pages using AI').requiredOption('--draft-id <id>', 'Source draft ID').
|
|
918
|
+
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)=>{
|
|
920
919
|
if (options.json) setJsonMode(true);
|
|
921
920
|
job_runner_requireAuth(manager_isAuthenticated);
|
|
921
|
+
const sourceNodeId = `draft-variant-${options.draftId}`;
|
|
922
922
|
await runJob({
|
|
923
923
|
startLabel: 'Planning flow pages...',
|
|
924
924
|
pollingLabel: 'AI is analyzing and planning pages...',
|
|
@@ -926,7 +926,7 @@ superdesign --help
|
|
|
926
926
|
timeoutLabel: 'Planning timed out',
|
|
927
927
|
failureLabel: 'Failed to plan flow pages',
|
|
928
928
|
startJob: ()=>planFlowPages(options.draftId, {
|
|
929
|
-
sourceNodeId
|
|
929
|
+
sourceNodeId,
|
|
930
930
|
flowContext: options.context
|
|
931
931
|
}),
|
|
932
932
|
transformResult: (job)=>({
|
|
@@ -958,7 +958,7 @@ superdesign --help
|
|
|
958
958
|
return parsed;
|
|
959
959
|
}
|
|
960
960
|
function createExecuteFlowPagesCommand() {
|
|
961
|
-
const command = new external_commander_namespaceObject.Command('execute-flow-pages').description('Generate flow pages using AI').requiredOption('--draft-id <id>', 'Source draft ID').requiredOption('--
|
|
961
|
+
const command = new external_commander_namespaceObject.Command('execute-flow-pages').description('Generate flow pages using AI').requiredOption('--draft-id <id>', 'Source draft ID').requiredOption('--pages <json>', 'JSON array of pages to generate [{title, prompt}]').option('--context <context>', 'Additional context for flow generation').option('--json', 'Output in JSON format').action(async (options)=>{
|
|
962
962
|
if (options.json) setJsonMode(true);
|
|
963
963
|
job_runner_requireAuth(manager_isAuthenticated);
|
|
964
964
|
let pages;
|
|
@@ -978,6 +978,7 @@ superdesign --help
|
|
|
978
978
|
output_error('Maximum 10 pages allowed');
|
|
979
979
|
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
980
980
|
}
|
|
981
|
+
const sourceNodeId = `draft-variant-${options.draftId}`;
|
|
981
982
|
const timeoutMs = Math.max(300000, 2 * pages.length * 60000);
|
|
982
983
|
await runJob({
|
|
983
984
|
startLabel: `Generating ${pages.length} flow page(s)...`,
|
|
@@ -987,7 +988,7 @@ superdesign --help
|
|
|
987
988
|
failureLabel: 'Failed to execute flow pages',
|
|
988
989
|
timeoutMs,
|
|
989
990
|
startJob: ()=>executeFlowPages(options.draftId, {
|
|
990
|
-
sourceNodeId
|
|
991
|
+
sourceNodeId,
|
|
991
992
|
flowContext: options.context,
|
|
992
993
|
pages
|
|
993
994
|
}),
|
|
@@ -1109,7 +1110,7 @@ superdesign --help
|
|
|
1109
1110
|
return response.data;
|
|
1110
1111
|
}
|
|
1111
1112
|
function createSearchPromptsCommand() {
|
|
1112
|
-
const command = new external_commander_namespaceObject.Command('search-prompts').description('Search public prompts in the library').option('--
|
|
1113
|
+
const command = new external_commander_namespaceObject.Command('search-prompts').description('Search public prompts in the library').option('--query <text>', "Search query (searches title and description)").option('--tags <tags>', 'Comma-separated tags to filter by').option('--limit <n>', 'Maximum number of results (default: 20, max: 100)').option('--offset <n>', 'Number of results to skip (for pagination)').option('--json', 'Output in JSON format').action(async (options)=>{
|
|
1113
1114
|
if (options.json) setJsonMode(true);
|
|
1114
1115
|
job_runner_requireAuth(manager_isAuthenticated);
|
|
1115
1116
|
const spinner = isJsonMode() ? null : external_ora_default()('Searching prompts...').start();
|
|
@@ -1118,7 +1119,7 @@ superdesign --help
|
|
|
1118
1119
|
const limit = options.limit ? parseInt(options.limit, 10) : 20;
|
|
1119
1120
|
const offset = options.offset ? parseInt(options.offset, 10) : 0;
|
|
1120
1121
|
const result = await searchPrompts({
|
|
1121
|
-
keyword: options.
|
|
1122
|
+
keyword: options.query,
|
|
1122
1123
|
tags,
|
|
1123
1124
|
limit,
|
|
1124
1125
|
offset
|
|
@@ -1304,7 +1305,7 @@ superdesign --help
|
|
|
1304
1305
|
durationMs: opts.durationMs,
|
|
1305
1306
|
errorCode: opts.errorCode,
|
|
1306
1307
|
options: opts.options,
|
|
1307
|
-
cliVersion: "0.1.
|
|
1308
|
+
cliVersion: "0.1.9",
|
|
1308
1309
|
os: `${external_os_default().platform()} ${external_os_default().release()}`
|
|
1309
1310
|
};
|
|
1310
1311
|
const posthog = getPostHog();
|
|
@@ -1341,7 +1342,7 @@ superdesign --help
|
|
|
1341
1342
|
(0, external_dotenv_namespaceObject.config)();
|
|
1342
1343
|
function createProgram() {
|
|
1343
1344
|
const program = new external_commander_namespaceObject.Command();
|
|
1344
|
-
program.name('superdesign').description('SuperDesign CLI - AI product designer for coding agents').version("0.1.
|
|
1345
|
+
program.name('superdesign').description('SuperDesign CLI - AI product designer for coding agents').version("0.1.9");
|
|
1345
1346
|
let startTime = 0;
|
|
1346
1347
|
program.hook('preAction', ()=>{
|
|
1347
1348
|
startTime = Date.now();
|
|
@@ -1359,15 +1360,17 @@ superdesign --help
|
|
|
1359
1360
|
program.addCommand(createLogoutCommand());
|
|
1360
1361
|
program.addCommand(createInitCommand());
|
|
1361
1362
|
program.addCommand(createCreateProjectCommand());
|
|
1362
|
-
program.addCommand(createCreateDesignDraftCommand());
|
|
1363
1363
|
program.addCommand(createIterateDesignDraftCommand());
|
|
1364
|
-
program.addCommand(createPlanFlowPagesCommand()
|
|
1364
|
+
program.addCommand(createPlanFlowPagesCommand(), {
|
|
1365
|
+
hidden: true
|
|
1366
|
+
});
|
|
1365
1367
|
program.addCommand(createExecuteFlowPagesCommand());
|
|
1366
1368
|
program.addCommand(createExtractBrandGuideCommand());
|
|
1367
1369
|
program.addCommand(createSearchPromptsCommand());
|
|
1368
1370
|
program.addCommand(createGetPromptsCommand());
|
|
1369
1371
|
program.addCommand(createFetchDesignNodesCommand());
|
|
1370
1372
|
program.addCommand(createGetDesignCommand());
|
|
1373
|
+
program.addCommand(createCreateDesignDraftCommand());
|
|
1371
1374
|
return program;
|
|
1372
1375
|
}
|
|
1373
1376
|
async function run() {
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { config as external_dotenv_config } from "dotenv";
|
|
2
2
|
import { fileURLToPath } from "url";
|
|
3
3
|
import { dirname, join, resolve as external_path_resolve } from "path";
|
|
4
|
-
import { Command } from "commander";
|
|
4
|
+
import { Command, Option } from "commander";
|
|
5
5
|
import { appendFileSync, existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "fs";
|
|
6
6
|
import os, { homedir, hostname, platform, release } from "os";
|
|
7
7
|
import axios from "axios";
|
|
@@ -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.
|
|
229
|
+
cliVersion: "0.1.9",
|
|
230
230
|
os: `${platform()} ${release()}`,
|
|
231
231
|
hostname: hostname()
|
|
232
232
|
});
|
|
@@ -634,23 +634,24 @@ function validateDeviceMode(device) {
|
|
|
634
634
|
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
635
635
|
}
|
|
636
636
|
}
|
|
637
|
-
function
|
|
638
|
-
if (filePath)
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
}
|
|
643
|
-
|
|
637
|
+
function readFileIfExists(filePath) {
|
|
638
|
+
if (existsSync(filePath)) return readFileSync(filePath, 'utf-8');
|
|
639
|
+
}
|
|
640
|
+
function readFileOrError(filePath, fileType) {
|
|
641
|
+
if (!existsSync(filePath)) {
|
|
642
|
+
output_error(`${fileType} file not found: ${filePath}`);
|
|
643
|
+
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
644
644
|
}
|
|
645
|
-
return
|
|
645
|
+
return readFileSync(filePath, 'utf-8');
|
|
646
646
|
}
|
|
647
647
|
function createCreateProjectCommand() {
|
|
648
|
-
const command = new Command('create-project').description('Create a new SuperDesign project').requiredOption('--title <title>', 'Project title').option('--
|
|
648
|
+
const command = new Command('create-project').description('Create a new SuperDesign project').requiredOption('--title <title>', 'Project title').option('--template <path>', 'Path to HTML template file for first draft').option('--device <mode>', 'Device mode for html template (mobile, tablet, desktop)', 'desktop').option('--json', 'Output in JSON format').action(async (options)=>{
|
|
649
649
|
if (options.json) setJsonMode(true);
|
|
650
650
|
job_runner_requireAuth(manager_isAuthenticated);
|
|
651
651
|
validateDeviceMode(options.device);
|
|
652
|
-
const htmlContent =
|
|
653
|
-
const
|
|
652
|
+
const htmlContent = options.template ? readFileOrError(options.template, 'Template') : void 0;
|
|
653
|
+
const designSystemPath = '.superdesign/design-system.md';
|
|
654
|
+
const promptContent = readFileIfExists(designSystemPath);
|
|
654
655
|
startSpinner('Creating project...');
|
|
655
656
|
try {
|
|
656
657
|
const project = await createProject({
|
|
@@ -660,10 +661,8 @@ function createCreateProjectCommand() {
|
|
|
660
661
|
deviceMode: options.device
|
|
661
662
|
});
|
|
662
663
|
succeedSpinner('Project created successfully!');
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
await openBrowser(urlWithLive);
|
|
666
|
-
}
|
|
664
|
+
const urlWithLive = `${project.projectUrl}?live=1`;
|
|
665
|
+
await openBrowser(urlWithLive);
|
|
667
666
|
if (isJsonMode()) output({
|
|
668
667
|
projectId: project.projectId,
|
|
669
668
|
title: project.title,
|
|
@@ -711,7 +710,7 @@ async function executeFlowPages(draftId, data) {
|
|
|
711
710
|
return response.data;
|
|
712
711
|
}
|
|
713
712
|
function createCreateDesignDraftCommand() {
|
|
714
|
-
const command = new Command('create-design-draft').description('Create a design draft
|
|
713
|
+
const command = new Command('create-design-draft').description('Create a design draft from scratch without any reference, Default dont use this, use iterate-design-draft instead').requiredOption('--project-id <id>', 'Project ID').requiredOption('--title <title>', 'Draft title').requiredOption('-p, --prompt <prompt>', 'Design prompt for AI generation').option('--device <mode>', 'Device mode (mobile, tablet, desktop)', 'desktop').option('--json', 'Output in JSON format').action(async (options)=>{
|
|
715
714
|
if (options.json) setJsonMode(true);
|
|
716
715
|
job_runner_requireAuth(manager_isAuthenticated);
|
|
717
716
|
validateDeviceMode(options.device);
|
|
@@ -786,7 +785,7 @@ function validateOptions(options) {
|
|
|
786
785
|
};
|
|
787
786
|
}
|
|
788
787
|
function createIterateDesignDraftCommand() {
|
|
789
|
-
const command = new Command('iterate-design-draft').description('
|
|
788
|
+
const command = new Command('iterate-design-draft').description('Generate design based on existing draft or template, the main design exploration tool').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').addOption(new Option('--project-id <id>').hideHelp()).action(async (options)=>{
|
|
790
789
|
if (options.json) setJsonMode(true);
|
|
791
790
|
job_runner_requireAuth(manager_isAuthenticated);
|
|
792
791
|
const { prompts, count, mode } = validateOptions(options);
|
|
@@ -826,9 +825,10 @@ function createIterateDesignDraftCommand() {
|
|
|
826
825
|
return command;
|
|
827
826
|
}
|
|
828
827
|
function createPlanFlowPagesCommand() {
|
|
829
|
-
const command = new Command('plan-flow-pages').description('Plan flow pages using AI').requiredOption('--draft-id <id>', 'Source draft ID').
|
|
828
|
+
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)=>{
|
|
830
829
|
if (options.json) setJsonMode(true);
|
|
831
830
|
job_runner_requireAuth(manager_isAuthenticated);
|
|
831
|
+
const sourceNodeId = `draft-variant-${options.draftId}`;
|
|
832
832
|
await runJob({
|
|
833
833
|
startLabel: 'Planning flow pages...',
|
|
834
834
|
pollingLabel: 'AI is analyzing and planning pages...',
|
|
@@ -836,7 +836,7 @@ function createPlanFlowPagesCommand() {
|
|
|
836
836
|
timeoutLabel: 'Planning timed out',
|
|
837
837
|
failureLabel: 'Failed to plan flow pages',
|
|
838
838
|
startJob: ()=>planFlowPages(options.draftId, {
|
|
839
|
-
sourceNodeId
|
|
839
|
+
sourceNodeId,
|
|
840
840
|
flowContext: options.context
|
|
841
841
|
}),
|
|
842
842
|
transformResult: (job)=>({
|
|
@@ -868,7 +868,7 @@ function parsePages(pagesJson) {
|
|
|
868
868
|
return parsed;
|
|
869
869
|
}
|
|
870
870
|
function createExecuteFlowPagesCommand() {
|
|
871
|
-
const command = new Command('execute-flow-pages').description('Generate flow pages using AI').requiredOption('--draft-id <id>', 'Source draft ID').requiredOption('--
|
|
871
|
+
const command = new Command('execute-flow-pages').description('Generate flow pages using AI').requiredOption('--draft-id <id>', 'Source draft ID').requiredOption('--pages <json>', 'JSON array of pages to generate [{title, prompt}]').option('--context <context>', 'Additional context for flow generation').option('--json', 'Output in JSON format').action(async (options)=>{
|
|
872
872
|
if (options.json) setJsonMode(true);
|
|
873
873
|
job_runner_requireAuth(manager_isAuthenticated);
|
|
874
874
|
let pages;
|
|
@@ -888,6 +888,7 @@ function createExecuteFlowPagesCommand() {
|
|
|
888
888
|
output_error('Maximum 10 pages allowed');
|
|
889
889
|
process.exit(EXIT_CODES.VALIDATION_ERROR);
|
|
890
890
|
}
|
|
891
|
+
const sourceNodeId = `draft-variant-${options.draftId}`;
|
|
891
892
|
const timeoutMs = Math.max(300000, 2 * pages.length * 60000);
|
|
892
893
|
await runJob({
|
|
893
894
|
startLabel: `Generating ${pages.length} flow page(s)...`,
|
|
@@ -897,7 +898,7 @@ function createExecuteFlowPagesCommand() {
|
|
|
897
898
|
failureLabel: 'Failed to execute flow pages',
|
|
898
899
|
timeoutMs,
|
|
899
900
|
startJob: ()=>executeFlowPages(options.draftId, {
|
|
900
|
-
sourceNodeId
|
|
901
|
+
sourceNodeId,
|
|
901
902
|
flowContext: options.context,
|
|
902
903
|
pages
|
|
903
904
|
}),
|
|
@@ -1019,7 +1020,7 @@ async function getPrompts(data) {
|
|
|
1019
1020
|
return response.data;
|
|
1020
1021
|
}
|
|
1021
1022
|
function createSearchPromptsCommand() {
|
|
1022
|
-
const command = new Command('search-prompts').description('Search public prompts in the library').option('--
|
|
1023
|
+
const command = new Command('search-prompts').description('Search public prompts in the library').option('--query <text>', "Search query (searches title and description)").option('--tags <tags>', 'Comma-separated tags to filter by').option('--limit <n>', 'Maximum number of results (default: 20, max: 100)').option('--offset <n>', 'Number of results to skip (for pagination)').option('--json', 'Output in JSON format').action(async (options)=>{
|
|
1023
1024
|
if (options.json) setJsonMode(true);
|
|
1024
1025
|
job_runner_requireAuth(manager_isAuthenticated);
|
|
1025
1026
|
const spinner = isJsonMode() ? null : ora('Searching prompts...').start();
|
|
@@ -1028,7 +1029,7 @@ function createSearchPromptsCommand() {
|
|
|
1028
1029
|
const limit = options.limit ? parseInt(options.limit, 10) : 20;
|
|
1029
1030
|
const offset = options.offset ? parseInt(options.offset, 10) : 0;
|
|
1030
1031
|
const result = await searchPrompts({
|
|
1031
|
-
keyword: options.
|
|
1032
|
+
keyword: options.query,
|
|
1032
1033
|
tags,
|
|
1033
1034
|
limit,
|
|
1034
1035
|
offset
|
|
@@ -1212,7 +1213,7 @@ async function trackCommand(opts) {
|
|
|
1212
1213
|
durationMs: opts.durationMs,
|
|
1213
1214
|
errorCode: opts.errorCode,
|
|
1214
1215
|
options: opts.options,
|
|
1215
|
-
cliVersion: "0.1.
|
|
1216
|
+
cliVersion: "0.1.9",
|
|
1216
1217
|
os: `${os.platform()} ${os.release()}`
|
|
1217
1218
|
};
|
|
1218
1219
|
const posthog = getPostHog();
|
|
@@ -1249,7 +1250,7 @@ external_dotenv_config({
|
|
|
1249
1250
|
external_dotenv_config();
|
|
1250
1251
|
function createProgram() {
|
|
1251
1252
|
const program = new Command();
|
|
1252
|
-
program.name('superdesign').description('SuperDesign CLI - AI product designer for coding agents').version("0.1.
|
|
1253
|
+
program.name('superdesign').description('SuperDesign CLI - AI product designer for coding agents').version("0.1.9");
|
|
1253
1254
|
let startTime = 0;
|
|
1254
1255
|
program.hook('preAction', ()=>{
|
|
1255
1256
|
startTime = Date.now();
|
|
@@ -1267,15 +1268,17 @@ function createProgram() {
|
|
|
1267
1268
|
program.addCommand(createLogoutCommand());
|
|
1268
1269
|
program.addCommand(createInitCommand());
|
|
1269
1270
|
program.addCommand(createCreateProjectCommand());
|
|
1270
|
-
program.addCommand(createCreateDesignDraftCommand());
|
|
1271
1271
|
program.addCommand(createIterateDesignDraftCommand());
|
|
1272
|
-
program.addCommand(createPlanFlowPagesCommand()
|
|
1272
|
+
program.addCommand(createPlanFlowPagesCommand(), {
|
|
1273
|
+
hidden: true
|
|
1274
|
+
});
|
|
1273
1275
|
program.addCommand(createExecuteFlowPagesCommand());
|
|
1274
1276
|
program.addCommand(createExtractBrandGuideCommand());
|
|
1275
1277
|
program.addCommand(createSearchPromptsCommand());
|
|
1276
1278
|
program.addCommand(createGetPromptsCommand());
|
|
1277
1279
|
program.addCommand(createFetchDesignNodesCommand());
|
|
1278
1280
|
program.addCommand(createGetDesignCommand());
|
|
1281
|
+
program.addCommand(createCreateDesignDraftCommand());
|
|
1279
1282
|
return program;
|
|
1280
1283
|
}
|
|
1281
1284
|
async function run() {
|