vibedgames 0.6.3 → 0.7.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 +14 -9
- package/dist/THIRD_PARTY_NOTICES.txt +383 -0
- package/dist/chunk-2GL2WJZX.js +172 -0
- package/dist/chunk-2QBYTIMH.js +511 -0
- package/dist/chunk-34AHIMX7.js +466 -0
- package/dist/chunk-6FZPPUQH.js +107 -0
- package/dist/chunk-BVVYDSFJ.js +99 -0
- package/dist/chunk-CAKBGDCY.js +47 -0
- package/dist/chunk-CBKOPVU6.js +1780 -0
- package/dist/chunk-CU7UY5YJ.js +1108 -0
- package/dist/chunk-CZPKN32Z.js +257 -0
- package/dist/chunk-DHEXGWJY.js +111 -0
- package/dist/chunk-FL6IFBUF.js +22 -0
- package/dist/chunk-FLUXEHMU.js +1360 -0
- package/dist/chunk-FNYBZNW2.js +165 -0
- package/dist/chunk-G5FRIFA3.js +22 -0
- package/dist/chunk-HCMTSR7E.js +69 -0
- package/dist/chunk-HKA5LBYW.js +159 -0
- package/dist/chunk-I6O4HIDY.js +1063 -0
- package/dist/chunk-J6PKNPI2.js +26 -0
- package/dist/chunk-JT2AU24K.js +759 -0
- package/dist/chunk-MBXCVCC4.js +478 -0
- package/dist/chunk-MJQSHP3Y.js +415 -0
- package/dist/chunk-MYFLYNPO.js +68 -0
- package/dist/chunk-PEUP4MZR.js +59 -0
- package/dist/chunk-PHEDW6C7.js +32 -0
- package/dist/chunk-PQDBCZRT.js +2017 -0
- package/dist/chunk-QGEITHUP.js +395 -0
- package/dist/chunk-QIVCBUYD.js +273 -0
- package/dist/chunk-RYFO3ZPO.js +71 -0
- package/dist/chunk-RZ4DIJQW.js +68 -0
- package/dist/chunk-SAANBZ25.js +118 -0
- package/dist/chunk-VFFOT7KD.js +2980 -0
- package/dist/chunk-Y552BNFZ.js +41 -0
- package/dist/chunk-Z4Z24FWO.js +39 -0
- package/dist/chunk-ZI6PKVXG.js +64 -0
- package/dist/chunk-ZYCSYJWX.js +87 -0
- package/dist/index.js +67 -60
- package/package.json +13 -16
- package/templates/none/_gitignore +3 -0
- package/templates/none/index.html +29 -0
- package/templates/none/package.json +16 -0
- package/templates/none/src/main.ts +16 -0
- package/templates/none/tsconfig.json +18 -0
- package/templates/none/vite.config.ts +8 -0
- package/templates/phaser/_gitignore +3 -0
- package/templates/phaser/index.html +24 -0
- package/templates/phaser/package.json +19 -0
- package/templates/phaser/src/main.ts +16 -0
- package/templates/phaser/src/scenes/game-scene.ts +65 -0
- package/templates/phaser/tsconfig.json +18 -0
- package/templates/phaser/vite.config.ts +8 -0
- package/templates/react-r3f/_gitignore +3 -0
- package/templates/react-r3f/index.html +24 -0
- package/templates/react-r3f/package.json +27 -0
- package/templates/react-r3f/src/app.tsx +33 -0
- package/templates/react-r3f/src/main.tsx +15 -0
- package/templates/react-r3f/tsconfig.json +19 -0
- package/templates/react-r3f/vite.config.ts +10 -0
- package/templates/threejs/_gitignore +3 -0
- package/templates/threejs/index.html +36 -0
- package/templates/threejs/package.json +20 -0
- package/templates/threejs/src/main.ts +44 -0
- package/templates/threejs/tsconfig.json +18 -0
- package/templates/threejs/vite.config.ts +8 -0
- package/dist/commands/completions.d.ts +0 -7
- package/dist/commands/completions.js +0 -145
- package/dist/commands/credits.d.ts +0 -10
- package/dist/commands/credits.js +0 -136
- package/dist/commands/deploy.d.ts +0 -26
- package/dist/commands/deploy.js +0 -257
- package/dist/commands/factory.d.ts +0 -3
- package/dist/commands/factory.js +0 -73
- package/dist/commands/fork.d.ts +0 -29
- package/dist/commands/fork.js +0 -124
- package/dist/commands/generate.d.ts +0 -1
- package/dist/commands/generate.js +0 -565
- package/dist/commands/init.d.ts +0 -20
- package/dist/commands/init.js +0 -105
- package/dist/commands/login.d.ts +0 -1
- package/dist/commands/login.js +0 -45
- package/dist/commands/logout.d.ts +0 -1
- package/dist/commands/logout.js +0 -13
- package/dist/commands/new.d.ts +0 -26
- package/dist/commands/new.js +0 -318
- package/dist/commands/playtest-run.d.ts +0 -66
- package/dist/commands/playtest-run.js +0 -268
- package/dist/commands/playtest.d.ts +0 -76
- package/dist/commands/playtest.js +0 -372
- package/dist/commands/update.d.ts +0 -13
- package/dist/commands/update.js +0 -82
- package/dist/commands/whoami.d.ts +0 -10
- package/dist/commands/whoami.js +0 -44
- package/dist/index.d.ts +0 -2
- package/dist/lib/api.d.ts +0 -18
- package/dist/lib/api.js +0 -27
- package/dist/lib/archive.d.ts +0 -17
- package/dist/lib/archive.js +0 -228
- package/dist/lib/codex.d.ts +0 -117
- package/dist/lib/codex.js +0 -426
- package/dist/lib/config-file.d.ts +0 -16
- package/dist/lib/config-file.js +0 -54
- package/dist/lib/config.d.ts +0 -11
- package/dist/lib/config.js +0 -54
- package/dist/lib/manifest.d.ts +0 -10
- package/dist/lib/manifest.js +0 -91
- package/dist/lib/media-args.d.ts +0 -30
- package/dist/lib/media-args.js +0 -219
- package/dist/lib/media-download.d.ts +0 -37
- package/dist/lib/media-download.js +0 -268
- package/dist/lib/media-poll.d.ts +0 -18
- package/dist/lib/media-poll.js +0 -86
- package/dist/lib/media-upload.d.ts +0 -12
- package/dist/lib/media-upload.js +0 -52
- package/dist/lib/output.d.ts +0 -68
- package/dist/lib/output.js +0 -102
- package/dist/lib/package-manager.d.ts +0 -25
- package/dist/lib/package-manager.js +0 -77
- package/dist/lib/playtest/agent.d.ts +0 -192
- package/dist/lib/playtest/agent.js +0 -652
- package/dist/lib/playtest/browser.d.ts +0 -109
- package/dist/lib/playtest/browser.js +0 -219
- package/dist/lib/playtest/controls.d.ts +0 -47
- package/dist/lib/playtest/controls.js +0 -218
- package/dist/lib/playtest/errors.d.ts +0 -9
- package/dist/lib/playtest/errors.js +0 -12
- package/dist/lib/playtest/keys.d.ts +0 -41
- package/dist/lib/playtest/keys.js +0 -157
- package/dist/lib/playtest/run.d.ts +0 -195
- package/dist/lib/playtest/run.js +0 -409
- package/dist/lib/run.d.ts +0 -19
- package/dist/lib/run.js +0 -23
- package/dist/lib/strict-args.d.ts +0 -27
- package/dist/lib/strict-args.js +0 -78
- package/dist/lib/types.d.ts +0 -16
- package/dist/lib/types.js +0 -10
- package/dist/lib/update.d.ts +0 -10
- package/dist/lib/update.js +0 -110
- package/dist/lib/upload.d.ts +0 -16
- package/dist/lib/upload.js +0 -41
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2023",
|
|
4
|
+
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
|
5
|
+
"module": "Preserve",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"isolatedModules": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"noUncheckedIndexedAccess": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"types": ["vite/client"]
|
|
16
|
+
},
|
|
17
|
+
"include": ["src", "vite.config.ts"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
|
|
3
|
+
// A relative base keeps built asset URLs relative, so the bundle works wherever it is
|
|
4
|
+
// hosted — including {slug}.vibedgames.com after `vg deploy ./dist`.
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
base: "./",
|
|
7
|
+
server: { port: 5173 },
|
|
8
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>__VG_SLUG__</title>
|
|
7
|
+
<!-- no favicon request, so a fresh game logs no 404 -->
|
|
8
|
+
<link rel="icon" href="data:," />
|
|
9
|
+
<style>
|
|
10
|
+
html,
|
|
11
|
+
body,
|
|
12
|
+
#root {
|
|
13
|
+
margin: 0;
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
background: #0e1020;
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
<div id="root"></div>
|
|
22
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
23
|
+
</body>
|
|
24
|
+
</html>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__VG_SLUG__",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "vite build",
|
|
8
|
+
"dev": "vite",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"typecheck": "tsc --noEmit"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@react-three/drei": "^10.7.9",
|
|
14
|
+
"@react-three/fiber": "^9.8.1",
|
|
15
|
+
"react": "~19.3.0",
|
|
16
|
+
"react-dom": "~19.3.0",
|
|
17
|
+
"three": "^0.186.1"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/react": "~19.3.0",
|
|
21
|
+
"@types/react-dom": "~19.3.0",
|
|
22
|
+
"@types/three": "^0.186.0",
|
|
23
|
+
"@vitejs/plugin-react": "^6.1.2",
|
|
24
|
+
"typescript": "^7.0.2",
|
|
25
|
+
"vite": "^8.3.3"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { OrbitControls } from "@react-three/drei";
|
|
2
|
+
import { Canvas, useFrame } from "@react-three/fiber";
|
|
3
|
+
import { useRef } from "react";
|
|
4
|
+
import type { Mesh } from "three";
|
|
5
|
+
|
|
6
|
+
// Replace the cube with your game.
|
|
7
|
+
const SpinningCube = () => {
|
|
8
|
+
const ref = useRef<Mesh>(null);
|
|
9
|
+
useFrame((_state, delta) => {
|
|
10
|
+
const mesh = ref.current;
|
|
11
|
+
if (!mesh) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
mesh.rotation.x += delta * 0.5;
|
|
15
|
+
mesh.rotation.y += delta;
|
|
16
|
+
});
|
|
17
|
+
return (
|
|
18
|
+
<mesh ref={ref}>
|
|
19
|
+
<boxGeometry args={[1, 1, 1]} />
|
|
20
|
+
<meshStandardMaterial color="#5be3ff" />
|
|
21
|
+
</mesh>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const App = () => (
|
|
26
|
+
<Canvas camera={{ fov: 60, position: [0, 1.5, 4] }} dpr={[1, 2]}>
|
|
27
|
+
<color args={["#0e1020"]} attach="background" />
|
|
28
|
+
<ambientLight intensity={0.4} />
|
|
29
|
+
<directionalLight intensity={2} position={[3, 5, 2]} />
|
|
30
|
+
<SpinningCube />
|
|
31
|
+
<OrbitControls />
|
|
32
|
+
</Canvas>
|
|
33
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StrictMode } from "react";
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
|
|
4
|
+
import { App } from "./app";
|
|
5
|
+
|
|
6
|
+
const root = document.querySelector("#root");
|
|
7
|
+
if (!root) {
|
|
8
|
+
throw new Error("index.html is missing its #root element");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
createRoot(root).render(
|
|
12
|
+
<StrictMode>
|
|
13
|
+
<App />
|
|
14
|
+
</StrictMode>,
|
|
15
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2023",
|
|
4
|
+
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
|
5
|
+
"module": "Preserve",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"isolatedModules": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"noUncheckedIndexedAccess": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"jsx": "react-jsx",
|
|
16
|
+
"types": ["vite/client"]
|
|
17
|
+
},
|
|
18
|
+
"include": ["src", "vite.config.ts"]
|
|
19
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import react from "@vitejs/plugin-react";
|
|
2
|
+
import { defineConfig } from "vite";
|
|
3
|
+
|
|
4
|
+
// A relative base keeps built asset URLs relative, so the bundle works wherever it is
|
|
5
|
+
// hosted — including {slug}.vibedgames.com after `vg deploy ./dist`.
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
base: "./",
|
|
8
|
+
plugins: [react()],
|
|
9
|
+
server: { port: 5173 },
|
|
10
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>__VG_SLUG__</title>
|
|
7
|
+
<!-- no favicon request, so a fresh game logs no 404 -->
|
|
8
|
+
<link rel="icon" href="data:," />
|
|
9
|
+
<style>
|
|
10
|
+
html,
|
|
11
|
+
body {
|
|
12
|
+
margin: 0;
|
|
13
|
+
height: 100%;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
background: #0e1020;
|
|
16
|
+
}
|
|
17
|
+
canvas {
|
|
18
|
+
display: block;
|
|
19
|
+
}
|
|
20
|
+
#hint {
|
|
21
|
+
position: fixed;
|
|
22
|
+
inset: auto 0 16px;
|
|
23
|
+
color: #9aa0c0;
|
|
24
|
+
font:
|
|
25
|
+
14px system-ui,
|
|
26
|
+
sans-serif;
|
|
27
|
+
text-align: center;
|
|
28
|
+
pointer-events: none;
|
|
29
|
+
}
|
|
30
|
+
</style>
|
|
31
|
+
</head>
|
|
32
|
+
<body>
|
|
33
|
+
<div id="hint">__VG_SLUG__ · edit src/main.ts</div>
|
|
34
|
+
<script type="module" src="/src/main.ts"></script>
|
|
35
|
+
</body>
|
|
36
|
+
</html>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__VG_SLUG__",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "vite build",
|
|
8
|
+
"dev": "vite",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"typecheck": "tsc --noEmit"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"three": "^0.186.1"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/three": "^0.186.0",
|
|
17
|
+
"typescript": "^7.0.2",
|
|
18
|
+
"vite": "^8.3.3"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AmbientLight,
|
|
3
|
+
BoxGeometry,
|
|
4
|
+
Color,
|
|
5
|
+
DirectionalLight,
|
|
6
|
+
Mesh,
|
|
7
|
+
MeshStandardMaterial,
|
|
8
|
+
PerspectiveCamera,
|
|
9
|
+
Scene,
|
|
10
|
+
WebGLRenderer,
|
|
11
|
+
} from "three";
|
|
12
|
+
|
|
13
|
+
const scene = new Scene();
|
|
14
|
+
scene.background = new Color("#0e1020");
|
|
15
|
+
|
|
16
|
+
const camera = new PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100);
|
|
17
|
+
camera.position.set(0, 1.5, 4);
|
|
18
|
+
camera.lookAt(0, 0, 0);
|
|
19
|
+
|
|
20
|
+
const renderer = new WebGLRenderer({ antialias: true });
|
|
21
|
+
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
|
|
22
|
+
renderer.setSize(window.innerWidth, window.innerHeight);
|
|
23
|
+
document.body.append(renderer.domElement);
|
|
24
|
+
|
|
25
|
+
scene.add(new AmbientLight(0xff_ff_ff, 0.4));
|
|
26
|
+
const sun = new DirectionalLight(0xff_ff_ff, 2);
|
|
27
|
+
sun.position.set(3, 5, 2);
|
|
28
|
+
scene.add(sun);
|
|
29
|
+
|
|
30
|
+
// Replace the cube with your game.
|
|
31
|
+
const cube = new Mesh(new BoxGeometry(1, 1, 1), new MeshStandardMaterial({ color: "#5be3ff" }));
|
|
32
|
+
scene.add(cube);
|
|
33
|
+
|
|
34
|
+
window.addEventListener("resize", () => {
|
|
35
|
+
camera.aspect = window.innerWidth / window.innerHeight;
|
|
36
|
+
camera.updateProjectionMatrix();
|
|
37
|
+
renderer.setSize(window.innerWidth, window.innerHeight);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
renderer.setAnimationLoop((time) => {
|
|
41
|
+
cube.rotation.x = time / 2000;
|
|
42
|
+
cube.rotation.y = time / 1000;
|
|
43
|
+
renderer.render(scene, camera);
|
|
44
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2023",
|
|
4
|
+
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
|
5
|
+
"module": "Preserve",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"isolatedModules": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"noUncheckedIndexedAccess": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"types": ["vite/client"]
|
|
16
|
+
},
|
|
17
|
+
"include": ["src", "vite.config.ts"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
|
|
3
|
+
// A relative base keeps built asset URLs relative, so the bundle works wherever it is
|
|
4
|
+
// hosted — including {slug}.vibedgames.com after `vg deploy ./dist`.
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
base: "./",
|
|
7
|
+
server: { port: 5173 },
|
|
8
|
+
});
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { defineCommand } from "citty";
|
|
2
|
-
const SUPPORTED = new Set(["bash", "zsh", "fish"]);
|
|
3
|
-
const isShell = (value) => SUPPORTED.has(value);
|
|
4
|
-
const SUBCOMMANDS = [
|
|
5
|
-
"new",
|
|
6
|
-
"init",
|
|
7
|
-
"login",
|
|
8
|
-
"logout",
|
|
9
|
-
"deploy",
|
|
10
|
-
"playtest",
|
|
11
|
-
"factory",
|
|
12
|
-
"fork",
|
|
13
|
-
"generate",
|
|
14
|
-
"credits",
|
|
15
|
-
"update",
|
|
16
|
-
"completions",
|
|
17
|
-
"whoami",
|
|
18
|
-
];
|
|
19
|
-
const GENERATE_SUBCOMMANDS = ["run", "status", "models", "schema", "pricing", "docs", "upload"];
|
|
20
|
-
const COMMON_FLAGS = ["--help", "--version"];
|
|
21
|
-
// CLI-level flags across the generate subcommands. Model parameters are
|
|
22
|
-
// arbitrary per model endpoint and passed as `--<param>`, so they can't be
|
|
23
|
-
// enumerated here — these are just the stable, command-defined flags.
|
|
24
|
-
const GENERATE_FLAGS = [
|
|
25
|
-
"--async",
|
|
26
|
-
"--download",
|
|
27
|
-
"--result",
|
|
28
|
-
"--cancel",
|
|
29
|
-
"--logs",
|
|
30
|
-
"--category",
|
|
31
|
-
"--status",
|
|
32
|
-
"--limit",
|
|
33
|
-
"--cursor",
|
|
34
|
-
"--endpoint_id",
|
|
35
|
-
"--expand",
|
|
36
|
-
"--format",
|
|
37
|
-
"--json",
|
|
38
|
-
"--quiet",
|
|
39
|
-
];
|
|
40
|
-
const bashScript = () => `# vg completions for bash. Source this file or write it to a file in your
|
|
41
|
-
# bash completion directory (e.g. /etc/bash_completion.d/vg).
|
|
42
|
-
_vg_completions() {
|
|
43
|
-
local cur prev cmd subcmd
|
|
44
|
-
COMPREPLY=()
|
|
45
|
-
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
46
|
-
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
47
|
-
cmd="\${COMP_WORDS[1]}"
|
|
48
|
-
subcmd="\${COMP_WORDS[2]}"
|
|
49
|
-
|
|
50
|
-
if [[ $COMP_CWORD -eq 1 ]]; then
|
|
51
|
-
COMPREPLY=( $(compgen -W "${SUBCOMMANDS.join(" ")} ${COMMON_FLAGS.join(" ")}" -- "$cur") )
|
|
52
|
-
return
|
|
53
|
-
fi
|
|
54
|
-
|
|
55
|
-
case "$cmd" in
|
|
56
|
-
generate)
|
|
57
|
-
if [[ $COMP_CWORD -eq 2 ]]; then
|
|
58
|
-
COMPREPLY=( $(compgen -W "${GENERATE_SUBCOMMANDS.join(" ")} ${GENERATE_FLAGS.join(" ")} ${COMMON_FLAGS.join(" ")}" -- "$cur") )
|
|
59
|
-
return
|
|
60
|
-
fi
|
|
61
|
-
COMPREPLY=( $(compgen -W "${GENERATE_FLAGS.join(" ")} ${COMMON_FLAGS.join(" ")}" -- "$cur") )
|
|
62
|
-
return
|
|
63
|
-
;;
|
|
64
|
-
*)
|
|
65
|
-
COMPREPLY=( $(compgen -W "${COMMON_FLAGS.join(" ")}" -- "$cur") )
|
|
66
|
-
return
|
|
67
|
-
;;
|
|
68
|
-
esac
|
|
69
|
-
}
|
|
70
|
-
complete -F _vg_completions vg
|
|
71
|
-
`;
|
|
72
|
-
const zshScript = () => `# vg completions for zsh. Source this file or place it on your fpath.
|
|
73
|
-
_vg() {
|
|
74
|
-
local -a subcmds generate_subs generate_flags common_flags
|
|
75
|
-
subcmds=(${SUBCOMMANDS.map((s) => `"${s}"`).join(" ")})
|
|
76
|
-
generate_subs=(${GENERATE_SUBCOMMANDS.map((s) => `"${s}"`).join(" ")})
|
|
77
|
-
generate_flags=(${GENERATE_FLAGS.map((s) => `"${s}"`).join(" ")})
|
|
78
|
-
common_flags=(${COMMON_FLAGS.map((s) => `"${s}"`).join(" ")})
|
|
79
|
-
|
|
80
|
-
if (( CURRENT == 2 )); then
|
|
81
|
-
_values "vg subcommand" "\${subcmds[@]}" "\${common_flags[@]}"
|
|
82
|
-
return
|
|
83
|
-
fi
|
|
84
|
-
case "\${words[2]}" in
|
|
85
|
-
generate)
|
|
86
|
-
if (( CURRENT == 3 )); then
|
|
87
|
-
_values "vg generate subcommand" "\${generate_subs[@]}" "\${generate_flags[@]}" "\${common_flags[@]}"
|
|
88
|
-
return
|
|
89
|
-
fi
|
|
90
|
-
_values "vg generate flag" "\${generate_flags[@]}" "\${common_flags[@]}"
|
|
91
|
-
;;
|
|
92
|
-
*)
|
|
93
|
-
_values "vg flag" "\${common_flags[@]}"
|
|
94
|
-
;;
|
|
95
|
-
esac
|
|
96
|
-
}
|
|
97
|
-
compdef _vg vg
|
|
98
|
-
`;
|
|
99
|
-
const fishFlag = (flag, condition) => {
|
|
100
|
-
const isShort = flag.startsWith("-") && !flag.startsWith("--");
|
|
101
|
-
const name = flag.replace(/^--?/u, "");
|
|
102
|
-
const opt = isShort ? "-s" : "-l";
|
|
103
|
-
return `complete -c vg -n '${condition}' ${opt} '${name}'`;
|
|
104
|
-
};
|
|
105
|
-
const fishScript = () => {
|
|
106
|
-
const generateFlagLines = [...GENERATE_FLAGS, ...COMMON_FLAGS].map((flag) => fishFlag(flag, "__fish_seen_subcommand_from generate"));
|
|
107
|
-
// For all other subcommands, only the common flags are meaningful.
|
|
108
|
-
const otherSubcommands = SUBCOMMANDS.filter((s) => s !== "generate");
|
|
109
|
-
const otherFlagLines = COMMON_FLAGS.flatMap((flag) => otherSubcommands.map((sub) => fishFlag(flag, `__fish_seen_subcommand_from ${sub}`)));
|
|
110
|
-
const topLevelFlagLines = COMMON_FLAGS.map((flag) => fishFlag(flag, "__fish_use_subcommand"));
|
|
111
|
-
return `# vg completions for fish.
|
|
112
|
-
complete -c vg -f
|
|
113
|
-
complete -c vg -n '__fish_use_subcommand' -a '${SUBCOMMANDS.join(" ")}'
|
|
114
|
-
${topLevelFlagLines.join("\n")}
|
|
115
|
-
${GENERATE_SUBCOMMANDS.map((sub) => `complete -c vg -n '__fish_seen_subcommand_from generate' -a '${sub}'`).join("\n")}
|
|
116
|
-
${generateFlagLines.join("\n")}
|
|
117
|
-
${otherFlagLines.join("\n")}
|
|
118
|
-
`;
|
|
119
|
-
};
|
|
120
|
-
export const completionsCommand = defineCommand({
|
|
121
|
-
args: {
|
|
122
|
-
shell: {
|
|
123
|
-
description: "Shell to generate completions for: bash | zsh | fish",
|
|
124
|
-
required: true,
|
|
125
|
-
type: "positional",
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
meta: {
|
|
129
|
-
description: "Print shell completions for vg. Pipe into your shell's completion dir.",
|
|
130
|
-
name: "completions",
|
|
131
|
-
},
|
|
132
|
-
run: ({ args }) => {
|
|
133
|
-
const shell = String(args.shell ?? "");
|
|
134
|
-
if (!isShell(shell)) {
|
|
135
|
-
process.stderr.write(`Unsupported shell "${shell}". Expected: ${[...SUPPORTED].join(", ")}\n`);
|
|
136
|
-
process.exit(1);
|
|
137
|
-
}
|
|
138
|
-
const scripts = {
|
|
139
|
-
bash: bashScript,
|
|
140
|
-
fish: fishScript,
|
|
141
|
-
zsh: zshScript,
|
|
142
|
-
};
|
|
143
|
-
process.stdout.write(scripts[shell]());
|
|
144
|
-
},
|
|
145
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const creditsCommand: import("citty").CommandDef<{
|
|
2
|
-
readonly field: {
|
|
3
|
-
readonly description: "Print a single value from the JSON result, e.g. --field request_id or --field images[0].url. Prints scalars bare for shell capture.";
|
|
4
|
-
readonly type: "string";
|
|
5
|
-
};
|
|
6
|
-
readonly json: {
|
|
7
|
-
readonly description: "Print structured JSON to stdout.";
|
|
8
|
-
readonly type: "boolean";
|
|
9
|
-
};
|
|
10
|
-
}>;
|
package/dist/commands/credits.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { defineCommand } from "citty";
|
|
2
|
-
import { consola } from "consola";
|
|
3
|
-
import { authErrorCode, createClient } from "../lib/api.js";
|
|
4
|
-
import { getToken } from "../lib/config.js";
|
|
5
|
-
import { outputArgs, writeStructured } from "../lib/output.js";
|
|
6
|
-
import { assertKnownFlags } from "../lib/strict-args.js";
|
|
7
|
-
const creditsArgs = { ...outputArgs };
|
|
8
|
-
const MICRO_PER_USD = 1_000_000;
|
|
9
|
-
const SUB_CENT_MICRO = MICRO_PER_USD / 100;
|
|
10
|
-
const MAX_ENTRIES_SHOWN = 15;
|
|
11
|
-
// Dollars from integer micro-USD. Two decimals normally; four when the
|
|
12
|
-
// magnitude is sub-cent so small generation charges don't render as $0.00.
|
|
13
|
-
const formatUsd = (micro) => {
|
|
14
|
-
const abs = Math.abs(micro);
|
|
15
|
-
const decimals = abs > 0 && abs < SUB_CENT_MICRO ? 4 : 2;
|
|
16
|
-
const base = `$${(abs / MICRO_PER_USD).toFixed(decimals)}`;
|
|
17
|
-
return micro < 0 ? `-${base}` : base;
|
|
18
|
-
};
|
|
19
|
-
const formatSignedUsd = (micro) => micro < 0 ? formatUsd(micro) : `+${formatUsd(micro)}`;
|
|
20
|
-
const kindLabel = (kind, deltaMicro) => {
|
|
21
|
-
switch (kind) {
|
|
22
|
-
case "signup_grant": {
|
|
23
|
-
return "Welcome credits";
|
|
24
|
-
}
|
|
25
|
-
case "admin_grant": {
|
|
26
|
-
return deltaMicro < 0 ? "Adjustment" : "Credit grant";
|
|
27
|
-
}
|
|
28
|
-
case "generation_hold": {
|
|
29
|
-
return "Generation";
|
|
30
|
-
}
|
|
31
|
-
case "generation_settle": {
|
|
32
|
-
return "Usage adjustment";
|
|
33
|
-
}
|
|
34
|
-
case "generation_release": {
|
|
35
|
-
return "Refund — failed generation";
|
|
36
|
-
}
|
|
37
|
-
default: {
|
|
38
|
-
return kind;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
// Relative for the last week, short date beyond that.
|
|
43
|
-
const formatWhen = (date, now) => {
|
|
44
|
-
const minutes = Math.floor((now.getTime() - date.getTime()) / 60_000);
|
|
45
|
-
if (minutes < 1) {
|
|
46
|
-
return "just now";
|
|
47
|
-
}
|
|
48
|
-
if (minutes < 60) {
|
|
49
|
-
return `${minutes}m ago`;
|
|
50
|
-
}
|
|
51
|
-
const hours = Math.floor(minutes / 60);
|
|
52
|
-
if (hours < 24) {
|
|
53
|
-
return `${hours}h ago`;
|
|
54
|
-
}
|
|
55
|
-
const days = Math.floor(hours / 24);
|
|
56
|
-
if (days < 7) {
|
|
57
|
-
return `${days}d ago`;
|
|
58
|
-
}
|
|
59
|
-
const opts = { day: "numeric", month: "short" };
|
|
60
|
-
if (date.getFullYear() !== now.getFullYear()) {
|
|
61
|
-
opts.year = "numeric";
|
|
62
|
-
}
|
|
63
|
-
return date.toLocaleDateString("en-US", opts);
|
|
64
|
-
};
|
|
65
|
-
export const creditsCommand = defineCommand({
|
|
66
|
-
args: creditsArgs,
|
|
67
|
-
meta: {
|
|
68
|
-
description: "Show your credit balance and recent usage.",
|
|
69
|
-
name: "credits",
|
|
70
|
-
},
|
|
71
|
-
run: async ({ args, rawArgs }) => {
|
|
72
|
-
assertKnownFlags(rawArgs, creditsArgs);
|
|
73
|
-
const token = getToken();
|
|
74
|
-
if (!token) {
|
|
75
|
-
consola.warn("Not logged in. Run `vg login` to authenticate.");
|
|
76
|
-
process.exit(1);
|
|
77
|
-
}
|
|
78
|
-
const client = createClient();
|
|
79
|
-
try {
|
|
80
|
-
const { balanceMicro, entries } = await client.credits.me();
|
|
81
|
-
const payload = {
|
|
82
|
-
balance_micro: balanceMicro,
|
|
83
|
-
balance_usd: balanceMicro / MICRO_PER_USD,
|
|
84
|
-
entries: entries.map((e) => ({
|
|
85
|
-
created_at: e.createdAt.toISOString(),
|
|
86
|
-
delta_micro: e.deltaMicro,
|
|
87
|
-
endpoint_id: e.endpointId,
|
|
88
|
-
id: e.id,
|
|
89
|
-
kind: e.kind,
|
|
90
|
-
note: e.note,
|
|
91
|
-
request_id: e.requestId,
|
|
92
|
-
})),
|
|
93
|
-
};
|
|
94
|
-
if (writeStructured(payload, args)) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
consola.log(`Balance: ${formatUsd(balanceMicro)}`);
|
|
98
|
-
if (entries.length === 0) {
|
|
99
|
-
consola.log("No activity yet.");
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const now = new Date();
|
|
103
|
-
const rows = entries.slice(0, MAX_ENTRIES_SHOWN).map((e) => ({
|
|
104
|
-
amount: formatSignedUsd(e.deltaMicro),
|
|
105
|
-
endpoint: e.endpointId ?? "",
|
|
106
|
-
label: kindLabel(e.kind, e.deltaMicro),
|
|
107
|
-
when: formatWhen(e.createdAt, now),
|
|
108
|
-
}));
|
|
109
|
-
const amountWidth = Math.max(...rows.map((r) => r.amount.length));
|
|
110
|
-
const labelWidth = Math.max(...rows.map((r) => r.label.length));
|
|
111
|
-
const endpointWidth = Math.max(...rows.map((r) => r.endpoint.length));
|
|
112
|
-
consola.log("");
|
|
113
|
-
for (const r of rows) {
|
|
114
|
-
const line = [
|
|
115
|
-
` ${r.amount.padStart(amountWidth)}`,
|
|
116
|
-
r.label.padEnd(labelWidth),
|
|
117
|
-
r.endpoint.padEnd(endpointWidth),
|
|
118
|
-
r.when,
|
|
119
|
-
].join(" ");
|
|
120
|
-
consola.log(line.trimEnd());
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
catch (error) {
|
|
124
|
-
// Only an auth error means "log in"; surface network/server failures as
|
|
125
|
-
// themselves so they aren't mistaken for a bad credential.
|
|
126
|
-
const code = authErrorCode(error);
|
|
127
|
-
if (code === "UNAUTHORIZED" || code === "FORBIDDEN") {
|
|
128
|
-
consola.warn("Not authenticated. Run `vg login`, or check your VG_TOKEN / API key.");
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
consola.error(`Failed to fetch credits: ${error instanceof Error ? error.message : String(error)}`);
|
|
132
|
-
}
|
|
133
|
-
process.exit(1);
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export declare const deployCommand: import("citty").CommandDef<{
|
|
2
|
-
readonly field: {
|
|
3
|
-
readonly description: "Print a single value from the JSON result, e.g. --field request_id or --field images[0].url. Prints scalars bare for shell capture.";
|
|
4
|
-
readonly type: "string";
|
|
5
|
-
};
|
|
6
|
-
readonly json: {
|
|
7
|
-
readonly description: "Print structured JSON to stdout.";
|
|
8
|
-
readonly type: "boolean";
|
|
9
|
-
};
|
|
10
|
-
readonly dir: {
|
|
11
|
-
readonly default: ".";
|
|
12
|
-
readonly description: "Directory to deploy";
|
|
13
|
-
readonly required: false;
|
|
14
|
-
readonly type: "positional";
|
|
15
|
-
};
|
|
16
|
-
readonly slug: {
|
|
17
|
-
readonly description: "Override the slug (bypasses vibedgames.json)";
|
|
18
|
-
readonly required: false;
|
|
19
|
-
readonly type: "string";
|
|
20
|
-
};
|
|
21
|
-
readonly source: {
|
|
22
|
-
readonly default: false;
|
|
23
|
-
readonly description: "Also upload a forkable source archive, letting anyone logged in fork the project.";
|
|
24
|
-
readonly type: "boolean";
|
|
25
|
-
};
|
|
26
|
-
}>;
|