@superdesign/cli 0.1.0
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/bin/superdesign.js +11 -0
- package/dist/api/auth.d.ts +36 -0
- package/dist/api/client.d.ts +28 -0
- package/dist/api/drafts.d.ts +46 -0
- package/dist/api/jobs.d.ts +73 -0
- package/dist/api/projects.d.ts +33 -0
- package/dist/commands/create-design-draft.d.ts +5 -0
- package/dist/commands/create-project.d.ts +5 -0
- package/dist/commands/execute-flow-pages.d.ts +5 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/iterate-design-draft.d.ts +5 -0
- package/dist/commands/login.d.ts +5 -0
- package/dist/commands/logout.d.ts +5 -0
- package/dist/commands/plan-flow-pages.d.ts +5 -0
- package/dist/config/constants.d.ts +33 -0
- package/dist/config/manager.d.ts +45 -0
- package/dist/index.cjs +1254 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +1107 -0
- package/dist/skills/superdesign.d.ts +4 -0
- package/dist/utils/ascii-animation.d.ts +17 -0
- package/dist/utils/auth-flow.d.ts +22 -0
- package/dist/utils/job-runner.d.ts +41 -0
- package/dist/utils/open-browser.d.ts +7 -0
- package/dist/utils/output.d.ts +39 -0
- package/dist/utils/poll.d.ts +29 -0
- package/dist/utils/spinner.d.ts +29 -0
- package/package.json +55 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ASCII Art Animation for SuperDesign CLI
|
|
3
|
+
* Matrix-style decrypt animation that reveals the logo
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Check if animation should be skipped
|
|
7
|
+
*/
|
|
8
|
+
export declare function shouldSkipAnimation(): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Run the decrypt animation
|
|
11
|
+
* Characters gradually reveal from scrambled to actual logo
|
|
12
|
+
*/
|
|
13
|
+
export declare function animateLogo(): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Quick reveal animation - simpler version for non-TTY contexts
|
|
16
|
+
*/
|
|
17
|
+
export declare function quickReveal(): Promise<void>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared authentication flow utility
|
|
3
|
+
* Used by both login and init commands
|
|
4
|
+
*/
|
|
5
|
+
export interface AuthFlowOptions {
|
|
6
|
+
/** Whether to open browser automatically */
|
|
7
|
+
openBrowser?: boolean;
|
|
8
|
+
/** Whether to show success message */
|
|
9
|
+
showSuccessMessage?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface AuthFlowResult {
|
|
12
|
+
success: boolean;
|
|
13
|
+
teamId?: string;
|
|
14
|
+
teamName?: string;
|
|
15
|
+
apiKey?: string;
|
|
16
|
+
error?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Run the device authentication flow
|
|
20
|
+
* Creates a session, opens browser for authorization, polls for approval, and saves credentials
|
|
21
|
+
*/
|
|
22
|
+
export declare function runAuthFlow(options?: AuthFlowOptions): Promise<AuthFlowResult>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Job runner utility for polling async jobs
|
|
3
|
+
* Encapsulates the common pattern of: start job -> poll -> handle result
|
|
4
|
+
*/
|
|
5
|
+
import { type JobCompletedResponse } from '../api/jobs';
|
|
6
|
+
export interface JobRunnerConfig<TResult> {
|
|
7
|
+
/** Label shown while starting (e.g., "Creating design draft...") */
|
|
8
|
+
startLabel: string;
|
|
9
|
+
/** Label shown while polling (e.g., "Generating design with AI...") */
|
|
10
|
+
pollingLabel: string;
|
|
11
|
+
/** Label shown on success (e.g., "Design draft created!") */
|
|
12
|
+
successLabel: string;
|
|
13
|
+
/** Label shown on timeout (e.g., "Generation timed out") */
|
|
14
|
+
timeoutLabel: string;
|
|
15
|
+
/** Label shown on failure (e.g., "Failed to create draft") */
|
|
16
|
+
failureLabel: string;
|
|
17
|
+
/** Custom timeout in ms (defaults to POLL_TIMEOUT_MS) */
|
|
18
|
+
timeoutMs?: number;
|
|
19
|
+
/** Function that starts the job and returns jobId */
|
|
20
|
+
startJob: () => Promise<{
|
|
21
|
+
jobId: string;
|
|
22
|
+
}>;
|
|
23
|
+
/** Transform completed job result for output */
|
|
24
|
+
transformResult: (job: JobCompletedResponse<TResult>) => Record<string, unknown>;
|
|
25
|
+
/** Display human-readable result (non-JSON mode) */
|
|
26
|
+
displayResult: (job: JobCompletedResponse<TResult>) => void;
|
|
27
|
+
}
|
|
28
|
+
export interface JobRunnerResult<TResult> {
|
|
29
|
+
success: boolean;
|
|
30
|
+
data?: JobCompletedResponse<TResult>;
|
|
31
|
+
error?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Run a job with polling and standard error handling
|
|
35
|
+
* Handles spinner updates, timeout, failure states, and output formatting
|
|
36
|
+
*/
|
|
37
|
+
export declare function runJob<TResult>(config: JobRunnerConfig<TResult>): Promise<never>;
|
|
38
|
+
/**
|
|
39
|
+
* Check authentication and exit with appropriate error if not authenticated
|
|
40
|
+
*/
|
|
41
|
+
export declare function requireAuth(isAuthenticated: () => boolean): void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output utilities for human-readable and JSON output
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Enable JSON output mode
|
|
6
|
+
*/
|
|
7
|
+
export declare function setJsonMode(enabled: boolean): void;
|
|
8
|
+
/**
|
|
9
|
+
* Check if JSON mode is enabled
|
|
10
|
+
*/
|
|
11
|
+
export declare function isJsonMode(): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Output data - either as JSON or human-readable
|
|
14
|
+
*/
|
|
15
|
+
export declare function output(data: unknown): void;
|
|
16
|
+
/**
|
|
17
|
+
* Output success message
|
|
18
|
+
*/
|
|
19
|
+
export declare function success(message: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* Output error message
|
|
22
|
+
*/
|
|
23
|
+
export declare function error(message: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Output info message (only in human mode)
|
|
26
|
+
*/
|
|
27
|
+
export declare function info(message: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Output warning message (only in human mode)
|
|
30
|
+
*/
|
|
31
|
+
export declare function warn(message: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Format a key-value pair for display
|
|
34
|
+
*/
|
|
35
|
+
export declare function formatKeyValue(key: string, value: string | number | boolean): string;
|
|
36
|
+
/**
|
|
37
|
+
* Output result with optional success message in human mode
|
|
38
|
+
*/
|
|
39
|
+
export declare function result<T>(data: T, humanMessage?: string): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Polling utility for async operations
|
|
3
|
+
*/
|
|
4
|
+
export interface PollOptions {
|
|
5
|
+
/** Interval between poll attempts in ms */
|
|
6
|
+
intervalMs?: number;
|
|
7
|
+
/** Maximum time to poll in ms */
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
/** Callback on each poll attempt */
|
|
10
|
+
onPoll?: (attempt: number) => void;
|
|
11
|
+
}
|
|
12
|
+
export interface PollResult<T> {
|
|
13
|
+
success: boolean;
|
|
14
|
+
data?: T;
|
|
15
|
+
error?: string;
|
|
16
|
+
timedOut?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Poll a function until a condition is met or timeout
|
|
20
|
+
*
|
|
21
|
+
* @param fn Function to poll (should return the current state)
|
|
22
|
+
* @param isDone Predicate to check if polling should stop
|
|
23
|
+
* @param options Polling options
|
|
24
|
+
*/
|
|
25
|
+
export declare function poll<T>(fn: () => Promise<T>, isDone: (result: T) => boolean, options?: PollOptions): Promise<PollResult<T>>;
|
|
26
|
+
/**
|
|
27
|
+
* Sleep for a specified duration
|
|
28
|
+
*/
|
|
29
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spinner utility wrapping ora
|
|
3
|
+
*/
|
|
4
|
+
import { type Ora } from 'ora';
|
|
5
|
+
/**
|
|
6
|
+
* Start a spinner with the given text
|
|
7
|
+
* Returns null in JSON mode (no spinner shown)
|
|
8
|
+
*/
|
|
9
|
+
export declare function startSpinner(text: string): Ora | null;
|
|
10
|
+
/**
|
|
11
|
+
* Update spinner text
|
|
12
|
+
*/
|
|
13
|
+
export declare function updateSpinner(text: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Stop spinner with success
|
|
16
|
+
*/
|
|
17
|
+
export declare function succeedSpinner(text?: string): void;
|
|
18
|
+
/**
|
|
19
|
+
* Stop spinner with failure
|
|
20
|
+
*/
|
|
21
|
+
export declare function failSpinner(text?: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* Stop spinner (neutral)
|
|
24
|
+
*/
|
|
25
|
+
export declare function stopSpinner(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Get the current spinner instance
|
|
28
|
+
*/
|
|
29
|
+
export declare function getSpinner(): Ora | null;
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@superdesign/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CLI for SuperDesign Platform - agent skills for Claude Code",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"bin": {
|
|
10
|
+
"superdesign": "./bin/superdesign.js"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"require": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"bin"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "rslib build && chmod +x bin/superdesign.js",
|
|
25
|
+
"dev": "rslib build --watch"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"axios": "^1.6.0",
|
|
29
|
+
"commander": "^11.1.0",
|
|
30
|
+
"dotenv": "^16.3.0",
|
|
31
|
+
"open": "^10.0.0",
|
|
32
|
+
"ora": "^8.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@rslib/core": "0.15.1",
|
|
36
|
+
"@types/node": "^20.10.0",
|
|
37
|
+
"typescript": "^5.3.3"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=18.0.0"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"superdesign",
|
|
44
|
+
"cli",
|
|
45
|
+
"claude-code",
|
|
46
|
+
"ai",
|
|
47
|
+
"design"
|
|
48
|
+
],
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "https://github.com/superdesigndev/superdesign-platform.git",
|
|
52
|
+
"directory": "packages/cli"
|
|
53
|
+
},
|
|
54
|
+
"license": "MIT"
|
|
55
|
+
}
|