vibedgames 0.3.1 → 0.4.1
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 -1
- package/dist/commands/completions.js +3 -0
- package/dist/commands/credits.d.ts +4 -0
- package/dist/commands/credits.js +20 -25
- package/dist/commands/deploy.d.ts +8 -0
- package/dist/commands/deploy.js +51 -29
- package/dist/commands/fork.d.ts +8 -5
- package/dist/commands/fork.js +30 -32
- package/dist/commands/generate.js +67 -53
- package/dist/commands/init.js +47 -30
- package/dist/commands/new.d.ts +1 -1
- package/dist/commands/new.js +35 -30
- package/dist/commands/playtest.d.ts +41 -0
- package/dist/commands/playtest.js +359 -0
- package/dist/commands/update.d.ts +1 -1
- package/dist/commands/update.js +30 -21
- package/dist/commands/whoami.d.ts +10 -1
- package/dist/commands/whoami.js +8 -1
- package/dist/index.js +9 -3
- package/dist/lib/config-file.d.ts +6 -0
- package/dist/lib/config-file.js +6 -0
- package/dist/lib/manifest.js +2 -0
- package/dist/lib/media-download.d.ts +4 -0
- package/dist/lib/media-download.js +49 -5
- package/dist/lib/output.d.ts +45 -0
- package/dist/lib/output.js +94 -0
- package/dist/lib/package-manager.d.ts +25 -0
- package/dist/lib/package-manager.js +72 -0
- package/dist/lib/run.d.ts +15 -1
- package/dist/lib/run.js +14 -3
- package/dist/lib/strict-args.d.ts +27 -0
- package/dist/lib/strict-args.js +68 -0
- package/package.json +4 -4
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reject flags a command does not declare.
|
|
3
|
+
*
|
|
4
|
+
* citty hard-codes `strict: false` on node's `parseArgs`, so an unknown flag is
|
|
5
|
+
* parsed and then dropped: `vg deploy ./dist --slugg wrong` deploys to the
|
|
6
|
+
* *default* slug and exits 0. A human notices the wrong URL in the output; an
|
|
7
|
+
* agent reads exit 0 and carries on. The skill scripts already fail this way
|
|
8
|
+
* (`unrecognized arguments: …`, exit 2), so this matches them.
|
|
9
|
+
*
|
|
10
|
+
* Only for commands whose flags are a closed set. `vg generate run` forwards
|
|
11
|
+
* arbitrary `--param value` pairs to a model's schema and must stay permissive,
|
|
12
|
+
* and `vg playtest`/`vg factory` are passthroughs to another binary's grammar.
|
|
13
|
+
*/
|
|
14
|
+
const UNRECOGNIZED_EXIT = 2;
|
|
15
|
+
function declaredNames(argsDef) {
|
|
16
|
+
const names = new Set();
|
|
17
|
+
for (const [name, spec] of Object.entries(argsDef)) {
|
|
18
|
+
if (spec.type === "positional")
|
|
19
|
+
continue;
|
|
20
|
+
names.add(name);
|
|
21
|
+
// citty accepts a camelCase arg under its kebab spelling too.
|
|
22
|
+
names.add(name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`));
|
|
23
|
+
const alias = spec.alias;
|
|
24
|
+
if (typeof alias === "string")
|
|
25
|
+
names.add(alias);
|
|
26
|
+
else if (Array.isArray(alias))
|
|
27
|
+
for (const a of alias)
|
|
28
|
+
names.add(a);
|
|
29
|
+
}
|
|
30
|
+
// citty answers these itself; they never reach a command's `args`.
|
|
31
|
+
names.add("help");
|
|
32
|
+
names.add("version");
|
|
33
|
+
return names;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The long flags in `rawArgs` that `argsDef` does not declare, in the order
|
|
37
|
+
* they were typed. Everything after a bare `--` is a passthrough payload and is
|
|
38
|
+
* left alone.
|
|
39
|
+
*/
|
|
40
|
+
export function unknownFlags(rawArgs, argsDef) {
|
|
41
|
+
const known = declaredNames(argsDef);
|
|
42
|
+
const unknown = [];
|
|
43
|
+
for (const raw of rawArgs) {
|
|
44
|
+
if (raw === "--")
|
|
45
|
+
break;
|
|
46
|
+
if (!raw.startsWith("--") || raw.length === 2)
|
|
47
|
+
continue;
|
|
48
|
+
const flag = (raw.slice(2).split("=")[0] ?? "").trim();
|
|
49
|
+
if (flag.length === 0)
|
|
50
|
+
continue;
|
|
51
|
+
// `--no-foo` is citty's negation of the boolean `foo`.
|
|
52
|
+
const negated = flag.startsWith("no-") ? flag.slice(3) : null;
|
|
53
|
+
if (known.has(flag))
|
|
54
|
+
continue;
|
|
55
|
+
if (negated !== null && known.has(negated))
|
|
56
|
+
continue;
|
|
57
|
+
unknown.push(`--${flag}`);
|
|
58
|
+
}
|
|
59
|
+
return unknown;
|
|
60
|
+
}
|
|
61
|
+
/** Exit 2 naming every undeclared flag, or return so the command can run. */
|
|
62
|
+
export function assertKnownFlags(rawArgs, argsDef) {
|
|
63
|
+
const unknown = unknownFlags(rawArgs, argsDef);
|
|
64
|
+
if (unknown.length === 0)
|
|
65
|
+
return;
|
|
66
|
+
process.stderr.write(`unrecognized arguments: ${unknown.join(" ")}\n`);
|
|
67
|
+
process.exit(UNRECOGNIZED_EXIT);
|
|
68
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibedgames",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"bin": {
|
|
6
6
|
"vg": "./dist/index.js"
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"tiged": "^2.12.8"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@cloudflare/workers-types": "^5.
|
|
23
|
+
"@cloudflare/workers-types": "^5.20260814.1",
|
|
24
24
|
"@kyh/tsconfig": "^1.2.0",
|
|
25
25
|
"@trpc/server": "^11.18.0",
|
|
26
26
|
"@types/cross-spawn": "^6.0.6",
|
|
27
|
-
"@types/node": "^26.
|
|
27
|
+
"@types/node": "^26.2.0",
|
|
28
28
|
"typescript": "^7.0.2",
|
|
29
29
|
"@repo/api": "^0.1.0"
|
|
30
30
|
},
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"build": "tsc && chmod +x dist/index.js",
|
|
33
33
|
"dev": "tsc --watch",
|
|
34
34
|
"clean": "rm -rf .turbo dist node_modules",
|
|
35
|
-
"test": "node --import tsx --test test
|
|
35
|
+
"test": "node --import tsx --test test/*.test.ts",
|
|
36
36
|
"typecheck": "tsc --noEmit"
|
|
37
37
|
}
|
|
38
38
|
}
|