@remotedraw/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/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # @remotedraw/cli
2
+
3
+ Command-line tools for starting and inspecting RemoteDraw developer integrations.
4
+
5
+ ## Local Development
6
+
7
+ ```sh
8
+ bun run cli -- guide
9
+ bun run cli -- options --format json
10
+ bun run cli -- login
11
+ bun run cli -- whoami
12
+ bun run cli
13
+ bun run cli -- new
14
+ bun run cli -- new --app-name MijnApp --target web --sender remotedraw-ios --sdk react
15
+ bun run cli -- init --target web --sender embedded-web --sdk react
16
+ bun run cli -- doctor
17
+ bun run cli -- agent --print-skill
18
+ ```
19
+
20
+ The published package will expose the same commands through the `remotedraw`
21
+ binary, for example `npx @remotedraw/cli@latest guide`.
22
+
23
+ Run `remotedraw` with no arguments in an interactive terminal for the guided
24
+ project-creation wizard. It supports keyboard navigation, review, and explicit
25
+ confirmation before writing. Piped or redirected no-argument use prints the
26
+ same deterministic help as `remotedraw --help` and never waits for input.
27
+
28
+ `remotedraw new` remains available with either explicit flags or its existing
29
+ interactive prompts. Both routes use the same project validation, templates,
30
+ and file writer.
31
+
32
+ Coding agents and CI should use the machine-readable path instead of driving
33
+ the wizard:
34
+
35
+ ```sh
36
+ remotedraw options --format json
37
+ remotedraw new --non-interactive --offline --dry-run --format json \
38
+ --app-name AgentDesk --target web --sender remotedraw-ios \
39
+ --sdk react --preset sketch --package-manager npm
40
+ remotedraw doctor --format json
41
+ ```
42
+
43
+ `--non-interactive` guarantees that setup never opens prompts or browser
44
+ authorization. JSON dry runs return the resolved plan, applied defaults, file
45
+ list, warnings, cloud mode, and next commands. Remove `--dry-run` only after
46
+ inspecting that result; `--force` remains an explicit overwrite decision.
47
+
48
+ By default, `new` and `init` also create a project on the RemoteDraw backend,
49
+ mint a project-scoped development API key, and write these server-side values
50
+ to a gitignored `.env.local`:
51
+
52
+ ```dotenv
53
+ REMOTEDRAW_API_BASE_URL=https://api.remotedraw.com
54
+ REMOTEDRAW_PROJECT_ID=...
55
+ REMOTEDRAW_API_KEY=rd_sk_...
56
+ ```
57
+
58
+ The account-level `rd_cli_...` credential is separate: it is stored with mode
59
+ `0600` in the user's config directory (`$XDG_CONFIG_HOME/remotedraw/config.json`
60
+ or `~/.config/remotedraw/config.json`) and never copied into a project. Use
61
+ `remotedraw logout` to revoke it. For CI, provide `REMOTEDRAW_CLI_TOKEN` as a
62
+ secret. Use `--offline` when only local scaffolding is wanted.
63
+
64
+ Like the Convex CLI, RemoteDraw reads generated runtime values back from
65
+ `.env.local`, so `remotedraw doctor` and `remotedraw create-input --execute`
66
+ work without manually exporting them in the shell.
67
+
68
+ ## Agent Skill
69
+
70
+ Print or install the RemoteDraw agent skill:
71
+
72
+ ```sh
73
+ remotedraw agent --print-skill
74
+ remotedraw agent --path ~/.codex/skills/remotedraw --force
75
+ ```
76
+
77
+ The skill teaches coding agents the CLI-first integration flow, SDK choices,
78
+ API key boundary, token lifecycle, structured dry-run workflow, and
79
+ verification commands.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,141 @@
1
+ import { type WizardDefinition, type WizardTerminal } from "./setup-wizard.js";
2
+ import { type CloudRuntime } from "./cloud.js";
3
+ export declare const CLI_VERSION: string;
4
+ export type CliResult = {
5
+ exitCode: number;
6
+ stdout: string;
7
+ stderr?: string;
8
+ };
9
+ export type PromptChoice<T extends string = string> = {
10
+ value: T;
11
+ label: string;
12
+ hint?: string;
13
+ };
14
+ export type SelectPromptOptions<T extends string> = {
15
+ message: string;
16
+ helperText?: string;
17
+ defaultValue?: T;
18
+ choices: readonly PromptChoice<T>[];
19
+ };
20
+ export type TextPromptOptions = {
21
+ message: string;
22
+ defaultValue?: string;
23
+ validate?: (value: string) => string | undefined;
24
+ };
25
+ export type CliPrompter = {
26
+ intro?: (title: string) => void | Promise<void>;
27
+ text: (options: TextPromptOptions) => Promise<string>;
28
+ select: <T extends string>(options: SelectPromptOptions<T>) => Promise<T>;
29
+ };
30
+ export type CliRuntime = CloudRuntime & {
31
+ cwd: string;
32
+ prompts?: CliPrompter;
33
+ wizardTerminal?: WizardTerminal | undefined;
34
+ };
35
+ declare const targetChoices: readonly ["web", "desktop", "ios", "headless"];
36
+ declare const senderChoices: readonly ["remotedraw-ios", "embedded-web", "own-ios", "headless"];
37
+ declare const sdkChoices: readonly ["react", "svelte", "js", "swift", "headless"];
38
+ declare const presetChoices: readonly ["signature", "initials", "approval", "sketch", "photoMarkup", "pdfMarkup", "mapMarkup", "screenMarkup", "designReview", "pointer"];
39
+ declare const packageManagerChoices: readonly ["npm", "pnpm", "yarn", "bun"];
40
+ type TargetChoice = (typeof targetChoices)[number];
41
+ type SenderChoice = (typeof senderChoices)[number];
42
+ type SdkChoice = (typeof sdkChoices)[number];
43
+ type PresetChoice = (typeof presetChoices)[number];
44
+ type PackageManagerChoice = (typeof packageManagerChoices)[number];
45
+ export type IntegrationPlan = {
46
+ appName: string;
47
+ slug: string;
48
+ target: TargetChoice;
49
+ sender: SenderChoice;
50
+ sdk: SdkChoice;
51
+ preset: PresetChoice;
52
+ apiBaseUrl: string;
53
+ packageManager: PackageManagerChoice;
54
+ };
55
+ export declare function createNodeRuntime(): CliRuntime;
56
+ export declare function cliEnvironmentForWorkspace(cwd: string, env: Record<string, string | undefined>, exists?: (filePath: string) => boolean): Record<string, string | undefined>;
57
+ export declare function runCli(args: string[], runtime?: CliRuntime): Promise<CliResult>;
58
+ export declare function createRemoteDrawProject(plan: IntegrationPlan, outputDir: string, runtime: CliRuntime, options?: {
59
+ dryRun?: boolean;
60
+ force?: boolean;
61
+ }): Promise<string[]>;
62
+ export declare function projectSetupDefinition(): WizardDefinition;
63
+ type PayloadOptions = {
64
+ preset: PresetChoice;
65
+ label: string;
66
+ externalId: string;
67
+ expiresInMs?: number | undefined;
68
+ };
69
+ export declare function createSessionPayload(options: PayloadOptions): {
70
+ expiresInMs?: number;
71
+ externalId: string;
72
+ markupPreset: "signature" | "initials" | "approval" | "sketch" | "photoMarkup" | "pdfMarkup" | "mapMarkup" | "screenMarkup" | "designReview" | "pointer";
73
+ target: {
74
+ metadata: {
75
+ descriptor: {
76
+ version: number;
77
+ privacy: string;
78
+ surfaceRole: string;
79
+ inputIntent: "signature" | "initials";
80
+ label: string;
81
+ components: {
82
+ id: "signature" | "initials";
83
+ role: string;
84
+ inputIntent: "signature" | "initials";
85
+ required: boolean;
86
+ bounds: {
87
+ minX: number;
88
+ minY: number;
89
+ maxX: number;
90
+ maxY: number;
91
+ };
92
+ }[];
93
+ phoneHints: {
94
+ preferredLayout: string;
95
+ preferredTool: string;
96
+ primaryActionLabel: string;
97
+ showUndo: boolean;
98
+ showClear: boolean;
99
+ };
100
+ } | {
101
+ version: number;
102
+ privacy: string;
103
+ surfaceRole: string;
104
+ inputIntent: string;
105
+ label: string;
106
+ phoneHints: {
107
+ preferredLayout: string;
108
+ preferredTool: string;
109
+ primaryActionLabel: string;
110
+ showUndo?: never;
111
+ showClear?: never;
112
+ };
113
+ components?: never;
114
+ } | {
115
+ version: number;
116
+ privacy: string;
117
+ surfaceRole: string;
118
+ inputIntent: string;
119
+ label: string;
120
+ phoneHints: {
121
+ preferredLayout: string;
122
+ preferredTool: string;
123
+ primaryActionLabel: string;
124
+ showUndo: boolean;
125
+ showClear: boolean;
126
+ };
127
+ components?: never;
128
+ };
129
+ };
130
+ inputMapping?: "surface";
131
+ coordinateSpace?: {
132
+ width: number;
133
+ height: number;
134
+ };
135
+ kind: string;
136
+ label: string;
137
+ };
138
+ };
139
+ export declare function agentSkillMarkdown(): string;
140
+ export {};
141
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAOA,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAEpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EASL,KAAK,YAAY,EAElB,MAAM,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