vibedgames 0.0.3 → 0.0.5
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 +7 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/commands/completions.d.ts +7 -0
- package/dist/commands/completions.js +138 -0
- package/dist/commands/deploy.d.ts +14 -9
- package/dist/commands/deploy.js +63 -3
- package/dist/commands/fork.d.ts +26 -0
- package/dist/commands/fork.js +118 -0
- package/dist/commands/init.d.ts +15 -15
- package/dist/commands/login.js +2 -2
- package/dist/commands/media.d.ts +1 -0
- package/dist/commands/media.js +401 -0
- package/dist/commands/new.d.ts +26 -0
- package/dist/commands/new.js +229 -0
- package/dist/index.js +8 -0
- package/dist/lib/api.js +14 -7
- package/dist/lib/archive.d.ts +17 -0
- package/dist/lib/archive.js +110 -0
- package/dist/lib/config-file.d.ts +3 -0
- package/dist/lib/config-file.js +24 -3
- package/dist/lib/config.js +5 -4
- package/dist/lib/media-args.d.ts +28 -0
- package/dist/lib/media-args.js +199 -0
- package/dist/lib/media-download.d.ts +31 -0
- package/dist/lib/media-download.js +190 -0
- package/dist/lib/media-poll.d.ts +17 -0
- package/dist/lib/media-poll.js +80 -0
- package/dist/lib/media-upload.d.ts +12 -0
- package/dist/lib/media-upload.js +51 -0
- package/dist/lib/types.d.ts +2 -0
- package/dist/lib/types.js +4 -0
- package/package.json +13 -9
- package/dist/commands/list.d.ts +0 -1
- package/dist/commands/list.js +0 -23
- package/dist/commands/rm.d.ts +0 -12
- package/dist/commands/rm.js +0 -35
- package/dist/commands/skills.d.ts +0 -8
- package/dist/commands/skills.js +0 -53
- package/dist/prompt-E6QYABXJ.js +0 -754
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
const SUPPORTED = new Set(["bash", "zsh", "fish"]);
|
|
3
|
+
const SUBCOMMANDS = [
|
|
4
|
+
"init",
|
|
5
|
+
"login",
|
|
6
|
+
"logout",
|
|
7
|
+
"deploy",
|
|
8
|
+
"media",
|
|
9
|
+
"completions",
|
|
10
|
+
"whoami",
|
|
11
|
+
];
|
|
12
|
+
const MEDIA_SUBCOMMANDS = ["run", "status", "models", "schema", "pricing", "docs", "upload"];
|
|
13
|
+
const COMMON_FLAGS = ["--help", "--version"];
|
|
14
|
+
// CLI-level flags across the media subcommands. Model parameters are
|
|
15
|
+
// arbitrary per fal endpoint and passed as `--<param>`, so they can't be
|
|
16
|
+
// enumerated here — these are just the stable, command-defined flags.
|
|
17
|
+
const MEDIA_FLAGS = [
|
|
18
|
+
"--async",
|
|
19
|
+
"--download",
|
|
20
|
+
"--result",
|
|
21
|
+
"--cancel",
|
|
22
|
+
"--logs",
|
|
23
|
+
"--category",
|
|
24
|
+
"--status",
|
|
25
|
+
"--limit",
|
|
26
|
+
"--cursor",
|
|
27
|
+
"--endpoint_id",
|
|
28
|
+
"--expand",
|
|
29
|
+
"--format",
|
|
30
|
+
"--json",
|
|
31
|
+
"--quiet",
|
|
32
|
+
];
|
|
33
|
+
function bashScript() {
|
|
34
|
+
return `# vg completions for bash. Source this file or write it to a file in your
|
|
35
|
+
# bash completion directory (e.g. /etc/bash_completion.d/vg).
|
|
36
|
+
_vg_completions() {
|
|
37
|
+
local cur prev cmd subcmd
|
|
38
|
+
COMPREPLY=()
|
|
39
|
+
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
40
|
+
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
41
|
+
cmd="\${COMP_WORDS[1]}"
|
|
42
|
+
subcmd="\${COMP_WORDS[2]}"
|
|
43
|
+
|
|
44
|
+
if [[ $COMP_CWORD -eq 1 ]]; then
|
|
45
|
+
COMPREPLY=( $(compgen -W "${SUBCOMMANDS.join(" ")} ${COMMON_FLAGS.join(" ")}" -- "$cur") )
|
|
46
|
+
return
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
case "$cmd" in
|
|
50
|
+
media)
|
|
51
|
+
if [[ $COMP_CWORD -eq 2 ]]; then
|
|
52
|
+
COMPREPLY=( $(compgen -W "${MEDIA_SUBCOMMANDS.join(" ")} ${MEDIA_FLAGS.join(" ")} ${COMMON_FLAGS.join(" ")}" -- "$cur") )
|
|
53
|
+
return
|
|
54
|
+
fi
|
|
55
|
+
COMPREPLY=( $(compgen -W "${MEDIA_FLAGS.join(" ")} ${COMMON_FLAGS.join(" ")}" -- "$cur") )
|
|
56
|
+
return
|
|
57
|
+
;;
|
|
58
|
+
*)
|
|
59
|
+
COMPREPLY=( $(compgen -W "${COMMON_FLAGS.join(" ")}" -- "$cur") )
|
|
60
|
+
return
|
|
61
|
+
;;
|
|
62
|
+
esac
|
|
63
|
+
}
|
|
64
|
+
complete -F _vg_completions vg
|
|
65
|
+
`;
|
|
66
|
+
}
|
|
67
|
+
function zshScript() {
|
|
68
|
+
return `# vg completions for zsh. Source this file or place it on your fpath.
|
|
69
|
+
_vg() {
|
|
70
|
+
local -a subcmds media_subs media_flags common_flags
|
|
71
|
+
subcmds=(${SUBCOMMANDS.map((s) => `"${s}"`).join(" ")})
|
|
72
|
+
media_subs=(${MEDIA_SUBCOMMANDS.map((s) => `"${s}"`).join(" ")})
|
|
73
|
+
media_flags=(${MEDIA_FLAGS.map((s) => `"${s}"`).join(" ")})
|
|
74
|
+
common_flags=(${COMMON_FLAGS.map((s) => `"${s}"`).join(" ")})
|
|
75
|
+
|
|
76
|
+
if (( CURRENT == 2 )); then
|
|
77
|
+
_values "vg subcommand" "\${subcmds[@]}" "\${common_flags[@]}"
|
|
78
|
+
return
|
|
79
|
+
fi
|
|
80
|
+
case "\${words[2]}" in
|
|
81
|
+
media)
|
|
82
|
+
if (( CURRENT == 3 )); then
|
|
83
|
+
_values "vg media subcommand" "\${media_subs[@]}" "\${media_flags[@]}" "\${common_flags[@]}"
|
|
84
|
+
return
|
|
85
|
+
fi
|
|
86
|
+
_values "vg media flag" "\${media_flags[@]}" "\${common_flags[@]}"
|
|
87
|
+
;;
|
|
88
|
+
*)
|
|
89
|
+
_values "vg flag" "\${common_flags[@]}"
|
|
90
|
+
;;
|
|
91
|
+
esac
|
|
92
|
+
}
|
|
93
|
+
compdef _vg vg
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
function fishFlag(flag, condition) {
|
|
97
|
+
const isShort = flag.startsWith("-") && !flag.startsWith("--");
|
|
98
|
+
const name = flag.replace(/^--?/, "");
|
|
99
|
+
const opt = isShort ? "-s" : "-l";
|
|
100
|
+
return `complete -c vg -n '${condition}' ${opt} '${name}'`;
|
|
101
|
+
}
|
|
102
|
+
function fishScript() {
|
|
103
|
+
const mediaFlagLines = [...MEDIA_FLAGS, ...COMMON_FLAGS].map((flag) => fishFlag(flag, "__fish_seen_subcommand_from media"));
|
|
104
|
+
// For all other subcommands, only the common flags are meaningful.
|
|
105
|
+
const otherSubcommands = SUBCOMMANDS.filter((s) => s !== "media");
|
|
106
|
+
const otherFlagLines = COMMON_FLAGS.flatMap((flag) => otherSubcommands.map((sub) => fishFlag(flag, `__fish_seen_subcommand_from ${sub}`)));
|
|
107
|
+
const topLevelFlagLines = COMMON_FLAGS.map((flag) => fishFlag(flag, "__fish_use_subcommand"));
|
|
108
|
+
return `# vg completions for fish.
|
|
109
|
+
complete -c vg -f
|
|
110
|
+
complete -c vg -n '__fish_use_subcommand' -a '${SUBCOMMANDS.join(" ")}'
|
|
111
|
+
${topLevelFlagLines.join("\n")}
|
|
112
|
+
${MEDIA_SUBCOMMANDS.map((sub) => `complete -c vg -n '__fish_seen_subcommand_from media' -a '${sub}'`).join("\n")}
|
|
113
|
+
${mediaFlagLines.join("\n")}
|
|
114
|
+
${otherFlagLines.join("\n")}
|
|
115
|
+
`;
|
|
116
|
+
}
|
|
117
|
+
export const completionsCommand = defineCommand({
|
|
118
|
+
meta: {
|
|
119
|
+
name: "completions",
|
|
120
|
+
description: "Print shell completions for vg. Pipe into your shell's completion dir.",
|
|
121
|
+
},
|
|
122
|
+
args: {
|
|
123
|
+
shell: {
|
|
124
|
+
type: "positional",
|
|
125
|
+
description: "Shell to generate completions for: bash | zsh | fish",
|
|
126
|
+
required: true,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
run: ({ args }) => {
|
|
130
|
+
const shell = String(args.shell ?? "");
|
|
131
|
+
if (!SUPPORTED.has(shell)) {
|
|
132
|
+
process.stderr.write(`Unsupported shell "${shell}". Expected: ${Array.from(SUPPORTED).join(", ")}\n`);
|
|
133
|
+
process.exit(1);
|
|
134
|
+
}
|
|
135
|
+
const script = shell === "bash" ? bashScript() : shell === "zsh" ? zshScript() : fishScript();
|
|
136
|
+
process.stdout.write(script);
|
|
137
|
+
},
|
|
138
|
+
});
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
export declare const deployCommand: import("citty").CommandDef<{
|
|
2
|
-
dir: {
|
|
3
|
-
type: "positional";
|
|
4
|
-
description:
|
|
5
|
-
required: false;
|
|
6
|
-
default:
|
|
2
|
+
readonly dir: {
|
|
3
|
+
readonly type: "positional";
|
|
4
|
+
readonly description: "Directory to deploy";
|
|
5
|
+
readonly required: false;
|
|
6
|
+
readonly default: ".";
|
|
7
7
|
};
|
|
8
|
-
slug: {
|
|
9
|
-
type: "string";
|
|
10
|
-
description:
|
|
11
|
-
required: false;
|
|
8
|
+
readonly slug: {
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
readonly description: "Override the slug (bypasses vibedgames.json)";
|
|
11
|
+
readonly required: false;
|
|
12
|
+
};
|
|
13
|
+
readonly source: {
|
|
14
|
+
readonly type: "boolean";
|
|
15
|
+
readonly description: "Upload a forkable source archive alongside the build (use --no-source to skip).";
|
|
16
|
+
readonly default: true;
|
|
12
17
|
};
|
|
13
18
|
}>;
|
package/dist/commands/deploy.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import {
|
|
1
|
+
import { existsSync, readFileSync, rmSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
3
4
|
import { defineCommand } from "citty";
|
|
4
5
|
import consola from "consola";
|
|
5
6
|
import { createClient } from "../lib/api.js";
|
|
6
|
-
import {
|
|
7
|
+
import { packSource } from "../lib/archive.js";
|
|
8
|
+
import { findProjectRoot, projectConfigPath, readProjectConfig, writeProjectConfig, } from "../lib/config-file.js";
|
|
7
9
|
import { buildManifest } from "../lib/manifest.js";
|
|
8
10
|
import { uploadAll } from "../lib/upload.js";
|
|
9
11
|
const SLUG_RE = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
|
|
@@ -24,6 +26,11 @@ export const deployCommand = defineCommand({
|
|
|
24
26
|
description: "Override the slug (bypasses vibedgames.json)",
|
|
25
27
|
required: false,
|
|
26
28
|
},
|
|
29
|
+
source: {
|
|
30
|
+
type: "boolean",
|
|
31
|
+
description: "Upload a forkable source archive alongside the build (use --no-source to skip).",
|
|
32
|
+
default: true,
|
|
33
|
+
},
|
|
27
34
|
},
|
|
28
35
|
run: async ({ args }) => {
|
|
29
36
|
const dir = resolve(args.dir);
|
|
@@ -44,6 +51,12 @@ export const deployCommand = defineCommand({
|
|
|
44
51
|
config = { slug: args.slug, name: config?.name };
|
|
45
52
|
}
|
|
46
53
|
if (!config) {
|
|
54
|
+
if (!process.stdin.isTTY) {
|
|
55
|
+
consola.error("No slug specified and no vibedgames.json found.\n" +
|
|
56
|
+
" Pass --slug <name> when running without a TTY (e.g. in CI or from a coding agent).\n" +
|
|
57
|
+
" Example: vg deploy ./dist --slug my-game");
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
47
60
|
const slug = await consola.prompt("Slug (e.g. pong):", { type: "text" });
|
|
48
61
|
if (typeof slug !== "string" || !SLUG_RE.test(slug)) {
|
|
49
62
|
consola.error("Invalid slug. Use lowercase letters, digits, hyphens.");
|
|
@@ -74,6 +87,24 @@ export const deployCommand = defineCommand({
|
|
|
74
87
|
}
|
|
75
88
|
const totalBytes = manifest.reduce((acc, f) => acc + f.size, 0);
|
|
76
89
|
consola.info(`Deploying ${config.slug}: ${manifest.length} files, ${formatBytes(totalBytes)}`);
|
|
90
|
+
// ---- Pack forkable source (default on; --no-source to skip) -------------
|
|
91
|
+
let sourceArchive = null;
|
|
92
|
+
if (args.source) {
|
|
93
|
+
const root = findProjectRoot(dir);
|
|
94
|
+
if (!root) {
|
|
95
|
+
consola.warn("No vibedgames.json found above the deploy dir — skipping source upload.");
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
try {
|
|
99
|
+
sourceArchive = await packSource(root, join(tmpdir(), "vibedgames"));
|
|
100
|
+
consola.info(`Source: ${sourceArchive.files.length} files, ${formatBytes(sourceArchive.bytes)} — forkable via \`vg fork ${config.slug}\``);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
consola.error(`Source archive failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
77
108
|
// ---- Create deployment --------------------------------------------------
|
|
78
109
|
const client = createClient();
|
|
79
110
|
const started = Date.now();
|
|
@@ -88,9 +119,14 @@ export const deployCommand = defineCommand({
|
|
|
88
119
|
sha256: f.sha256,
|
|
89
120
|
contentType: f.contentType,
|
|
90
121
|
})),
|
|
122
|
+
source: sourceArchive
|
|
123
|
+
? { sha256: sourceArchive.sha256, bytes: sourceArchive.bytes }
|
|
124
|
+
: undefined,
|
|
91
125
|
});
|
|
92
126
|
}
|
|
93
127
|
catch (err) {
|
|
128
|
+
if (sourceArchive)
|
|
129
|
+
rmSync(sourceArchive.path, { force: true });
|
|
94
130
|
consola.error(err instanceof Error ? err.message : String(err));
|
|
95
131
|
process.exit(1);
|
|
96
132
|
}
|
|
@@ -108,9 +144,33 @@ export const deployCommand = defineCommand({
|
|
|
108
144
|
});
|
|
109
145
|
}
|
|
110
146
|
catch (err) {
|
|
147
|
+
if (sourceArchive)
|
|
148
|
+
rmSync(sourceArchive.path, { force: true });
|
|
111
149
|
consola.error(err instanceof Error ? err.message : String(err));
|
|
112
150
|
process.exit(1);
|
|
113
151
|
}
|
|
152
|
+
// ---- Upload source archive (best-effort companion to the bundle) -------
|
|
153
|
+
if (sourceArchive && created.sourceUpload) {
|
|
154
|
+
try {
|
|
155
|
+
const res = await fetch(created.sourceUpload.url, {
|
|
156
|
+
method: "PUT",
|
|
157
|
+
headers: created.sourceUpload.headers,
|
|
158
|
+
body: readFileSync(sourceArchive.path),
|
|
159
|
+
});
|
|
160
|
+
if (!res.ok) {
|
|
161
|
+
throw new Error(`source upload failed: ${res.status} ${res.statusText}`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch (err) {
|
|
165
|
+
rmSync(sourceArchive.path, { force: true });
|
|
166
|
+
consola.error(err instanceof Error ? err.message : String(err));
|
|
167
|
+
process.exit(1);
|
|
168
|
+
}
|
|
169
|
+
rmSync(sourceArchive.path, { force: true });
|
|
170
|
+
}
|
|
171
|
+
else if (sourceArchive) {
|
|
172
|
+
rmSync(sourceArchive.path, { force: true });
|
|
173
|
+
}
|
|
114
174
|
// ---- Finalize -----------------------------------------------------------
|
|
115
175
|
let finalized;
|
|
116
176
|
try {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const forkCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly slug: {
|
|
3
|
+
readonly type: "positional";
|
|
4
|
+
readonly description: "Slug of the project to fork (e.g. bomberman).";
|
|
5
|
+
readonly required: true;
|
|
6
|
+
};
|
|
7
|
+
readonly target: {
|
|
8
|
+
readonly type: "positional";
|
|
9
|
+
readonly description: "New slug + directory for the fork. Defaults to <slug>-fork.";
|
|
10
|
+
readonly required: false;
|
|
11
|
+
};
|
|
12
|
+
readonly name: {
|
|
13
|
+
readonly type: "string";
|
|
14
|
+
readonly description: "Display name for the fork (defaults to the target slug).";
|
|
15
|
+
};
|
|
16
|
+
readonly force: {
|
|
17
|
+
readonly type: "boolean";
|
|
18
|
+
readonly description: "Overwrite the target directory if it exists.";
|
|
19
|
+
readonly default: false;
|
|
20
|
+
};
|
|
21
|
+
readonly json: {
|
|
22
|
+
readonly type: "boolean";
|
|
23
|
+
readonly description: "Emit machine-readable JSON (for agents).";
|
|
24
|
+
readonly default: false;
|
|
25
|
+
};
|
|
26
|
+
}>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
|
+
import { defineCommand } from "citty";
|
|
5
|
+
import consola from "consola";
|
|
6
|
+
import { createClient } from "../lib/api.js";
|
|
7
|
+
import { extractSource } from "../lib/archive.js";
|
|
8
|
+
const SLUG_RE = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
|
|
9
|
+
export const forkCommand = defineCommand({
|
|
10
|
+
meta: {
|
|
11
|
+
name: "fork",
|
|
12
|
+
description: "Fork another project's source so you can build on it. Downloads the source a project shipped with `vg deploy`, extracts it locally, and rewrites it to a new slug.",
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
slug: {
|
|
16
|
+
type: "positional",
|
|
17
|
+
description: "Slug of the project to fork (e.g. bomberman).",
|
|
18
|
+
required: true,
|
|
19
|
+
},
|
|
20
|
+
target: {
|
|
21
|
+
type: "positional",
|
|
22
|
+
description: "New slug + directory for the fork. Defaults to <slug>-fork.",
|
|
23
|
+
required: false,
|
|
24
|
+
},
|
|
25
|
+
name: {
|
|
26
|
+
type: "string",
|
|
27
|
+
description: "Display name for the fork (defaults to the target slug).",
|
|
28
|
+
},
|
|
29
|
+
force: {
|
|
30
|
+
type: "boolean",
|
|
31
|
+
description: "Overwrite the target directory if it exists.",
|
|
32
|
+
default: false,
|
|
33
|
+
},
|
|
34
|
+
json: {
|
|
35
|
+
type: "boolean",
|
|
36
|
+
description: "Emit machine-readable JSON (for agents).",
|
|
37
|
+
default: false,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
run: async ({ args }) => {
|
|
41
|
+
const source = args.slug.trim().toLowerCase();
|
|
42
|
+
const target = (args.target ?? `${source}-fork`).trim().toLowerCase();
|
|
43
|
+
if (!SLUG_RE.test(target)) {
|
|
44
|
+
consola.error(`Invalid target slug "${target}". Use lowercase letters, digits, and hyphens.`);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
const dir = resolve(process.cwd(), target);
|
|
48
|
+
if (existsSync(dir)) {
|
|
49
|
+
if (!args.force) {
|
|
50
|
+
consola.error(`Directory ${dir} already exists. Pass --force to overwrite, or pick another target.`);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
// --force means replace, not merge — clear stale files first so the fork
|
|
54
|
+
// isn't a dirty mix of the archive and whatever was already there.
|
|
55
|
+
rmSync(dir, { recursive: true, force: true });
|
|
56
|
+
}
|
|
57
|
+
const client = createClient();
|
|
58
|
+
// ---- Resolve + download source -----------------------------------------
|
|
59
|
+
if (!args.json)
|
|
60
|
+
consola.start(`Forking ${source}`);
|
|
61
|
+
let src;
|
|
62
|
+
try {
|
|
63
|
+
src = await client.deploy.getSource.query({ slug: source });
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
consola.error(err instanceof Error ? err.message : String(err));
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
const tmp = join(tmpdir(), "vibedgames", `fork-${process.pid}.tgz`);
|
|
70
|
+
mkdirSync(join(tmpdir(), "vibedgames"), { recursive: true });
|
|
71
|
+
try {
|
|
72
|
+
const res = await fetch(src.url);
|
|
73
|
+
if (!res.ok)
|
|
74
|
+
throw new Error(`download failed: ${res.status} ${res.statusText}`);
|
|
75
|
+
writeFileSync(tmp, Buffer.from(await res.arrayBuffer()));
|
|
76
|
+
await extractSource(tmp, dir);
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
consola.error(err instanceof Error ? err.message : String(err));
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
finally {
|
|
83
|
+
rmSync(tmp, { force: true });
|
|
84
|
+
}
|
|
85
|
+
// ---- Re-slug the fork (clean slate — no provenance recorded) ------------
|
|
86
|
+
const name = args.name ?? target.replace(/-/g, " ");
|
|
87
|
+
writeFileSync(resolve(dir, "vibedgames.json"), `${JSON.stringify({ slug: target, name }, null, 2)}\n`);
|
|
88
|
+
rewritePackageName(dir, target);
|
|
89
|
+
if (args.json) {
|
|
90
|
+
consola.log(JSON.stringify({ slug: target, dir, forkedFrom: source }));
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
consola.success(`Forked ${source} → ${target}`);
|
|
94
|
+
consola.log(` ${dir}`);
|
|
95
|
+
consola.log("");
|
|
96
|
+
consola.info("Next steps:");
|
|
97
|
+
consola.log(` cd ${target}`);
|
|
98
|
+
consola.log(" npm install");
|
|
99
|
+
consola.log(" npm run dev");
|
|
100
|
+
consola.log(` # then: npm run build && vg deploy ./dist → ${target}.vibedgames.com`);
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
function rewritePackageName(dir, slug) {
|
|
104
|
+
const pkgPath = resolve(dir, "package.json");
|
|
105
|
+
if (!existsSync(pkgPath))
|
|
106
|
+
return;
|
|
107
|
+
try {
|
|
108
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
109
|
+
pkg.name = slug;
|
|
110
|
+
delete pkg.repository;
|
|
111
|
+
delete pkg.bugs;
|
|
112
|
+
delete pkg.homepage;
|
|
113
|
+
writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
consola.warn(`Could not rewrite package.json name: ${err instanceof Error ? err.message : String(err)}`);
|
|
117
|
+
}
|
|
118
|
+
}
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
export declare const initCommand: import("citty").CommandDef<{
|
|
2
|
-
agent: {
|
|
3
|
-
type: "string";
|
|
4
|
-
description:
|
|
5
|
-
alias:
|
|
6
|
-
default:
|
|
2
|
+
readonly agent: {
|
|
3
|
+
readonly type: "string";
|
|
4
|
+
readonly description: "Comma-separated target agents. Default installs for Claude Code, Cursor, and Codex (symlinked from a shared .agents/skills/ dir). Pass '*' for every supported agent.";
|
|
5
|
+
readonly alias: "a";
|
|
6
|
+
readonly default: "claude-code,cursor,codex";
|
|
7
7
|
};
|
|
8
|
-
global: {
|
|
9
|
-
type: "boolean";
|
|
10
|
-
description:
|
|
11
|
-
default: false;
|
|
12
|
-
alias:
|
|
8
|
+
readonly global: {
|
|
9
|
+
readonly type: "boolean";
|
|
10
|
+
readonly description: "Install to user directory instead of project";
|
|
11
|
+
readonly default: false;
|
|
12
|
+
readonly alias: "g";
|
|
13
13
|
};
|
|
14
|
-
yes: {
|
|
15
|
-
type: "boolean";
|
|
16
|
-
description:
|
|
17
|
-
default: true;
|
|
18
|
-
alias:
|
|
14
|
+
readonly yes: {
|
|
15
|
+
readonly type: "boolean";
|
|
16
|
+
readonly description: "Skip confirmation prompts";
|
|
17
|
+
readonly default: true;
|
|
18
|
+
readonly alias: "y";
|
|
19
19
|
};
|
|
20
20
|
}>;
|
package/dist/commands/login.js
CHANGED
|
@@ -24,7 +24,7 @@ export const loginCommand = defineCommand({
|
|
|
24
24
|
run: async () => {
|
|
25
25
|
const baseUrl = getBaseUrl();
|
|
26
26
|
const client = createPublicClient(baseUrl);
|
|
27
|
-
const { code } = await client.
|
|
27
|
+
const { code } = await client.auth.cliInit.mutate();
|
|
28
28
|
consola.box(`Code: ${code}`);
|
|
29
29
|
consola.info("Opening browser to complete authentication...");
|
|
30
30
|
const authUrl = `${baseUrl}/auth/cli?code=${code}`;
|
|
@@ -32,7 +32,7 @@ export const loginCommand = defineCommand({
|
|
|
32
32
|
consola.start("Waiting for confirmation...");
|
|
33
33
|
for (let i = 0; i < MAX_POLLS; i++) {
|
|
34
34
|
await sleep(POLL_INTERVAL_MS);
|
|
35
|
-
const result = await client.
|
|
35
|
+
const result = await client.auth.cliPoll.query({ code });
|
|
36
36
|
if (result.status === "confirmed") {
|
|
37
37
|
saveConfig({ token: result.token, baseUrl });
|
|
38
38
|
consola.success("Logged in successfully");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const mediaCommand: import("citty").CommandDef<import("citty").ArgsDef>;
|