vibedgames 0.0.1 → 0.0.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Kaiyu Hsu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -11,6 +11,7 @@ npm i -g vibedgames
11
11
  ## Commands
12
12
 
13
13
  ```sh
14
+ vg init [dir] # install Claude Code skills into ./.claude/skills
14
15
  vg login # authenticate via browser
15
16
  vg logout # clear credentials
16
17
  vg whoami # show current user
@@ -18,6 +19,14 @@ vg deploy [dir] # deploy a game directory
18
19
  vg deploy ./dist --slug my-game
19
20
  ```
20
21
 
22
+ `vg skills install` is an alias for `vg init`.
23
+
24
+ ## Using with Claude Code
25
+
26
+ Run `vg init` in your project to drop the full set of game-building skills
27
+ (Phaser, Three.js, Aseprite, fal.ai, deploy, etc.) into `./.claude/skills/`.
28
+ Claude picks them up automatically on next session.
29
+
21
30
  ## How deploy works
22
31
 
23
32
  1. Walks the directory, hashes files, validates `index.html` exists
@@ -0,0 +1,20 @@
1
+ export declare const initCommand: import("citty").CommandDef<{
2
+ agent: {
3
+ type: "string";
4
+ description: string;
5
+ alias: string;
6
+ default: string;
7
+ };
8
+ global: {
9
+ type: "boolean";
10
+ description: string;
11
+ default: false;
12
+ alias: string;
13
+ };
14
+ yes: {
15
+ type: "boolean";
16
+ description: string;
17
+ default: true;
18
+ alias: string;
19
+ };
20
+ }>;
@@ -0,0 +1,89 @@
1
+ import { defineCommand } from "citty";
2
+ import consola from "consola";
3
+ import spawn from "cross-spawn";
4
+ const REPO = "kyh/vibedgames";
5
+ const PKG = "vibedgames";
6
+ const DEFAULT_AGENTS = "claude-code,cursor,codex";
7
+ const description = "Install/update vibedgames skills and the vg CLI";
8
+ const run = (cmd, args) => new Promise((resolve) => {
9
+ const chunks = [];
10
+ const child = spawn(cmd, args, { stdio: ["ignore", "pipe", "pipe"] });
11
+ child.stdout?.on("data", (c) => chunks.push(c));
12
+ child.stderr?.on("data", (c) => chunks.push(c));
13
+ child.on("error", (err) => resolve({ code: 1, output: `${err.message}\n` }));
14
+ child.on("close", (code) => resolve({ code: code ?? 1, output: Buffer.concat(chunks).toString("utf8") }));
15
+ });
16
+ const skillsAddArgs = (agents, global, yes) => {
17
+ const args = ["-y", "skills", "add", REPO];
18
+ for (const agent of agents)
19
+ args.push("-a", agent);
20
+ if (global)
21
+ args.push("-g");
22
+ if (yes)
23
+ args.push("-y");
24
+ return args;
25
+ };
26
+ const skillsUpdateArgs = (global, yes) => {
27
+ const args = ["-y", "skills", "update"];
28
+ if (global)
29
+ args.push("-g");
30
+ if (yes)
31
+ args.push("-y");
32
+ return args;
33
+ };
34
+ export const initCommand = defineCommand({
35
+ meta: { name: "init", description },
36
+ args: {
37
+ agent: {
38
+ type: "string",
39
+ 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.",
40
+ alias: "a",
41
+ default: DEFAULT_AGENTS,
42
+ },
43
+ global: {
44
+ type: "boolean",
45
+ description: "Install to user directory instead of project",
46
+ default: false,
47
+ alias: "g",
48
+ },
49
+ yes: {
50
+ type: "boolean",
51
+ description: "Skip confirmation prompts",
52
+ default: true,
53
+ alias: "y",
54
+ },
55
+ },
56
+ run: async ({ args }) => {
57
+ const agents = args.agent
58
+ .split(",")
59
+ .map((s) => s.trim())
60
+ .filter(Boolean);
61
+ consola.start("Installing/updating vibedgames skills and the vg CLI...");
62
+ const [add, cli] = await Promise.all([
63
+ run("npx", skillsAddArgs(agents, args.global, args.yes)),
64
+ run("npm", ["install", "-g", PKG]),
65
+ ]);
66
+ if (add.code !== 0) {
67
+ if (add.output.trim())
68
+ consola.error(add.output.trim());
69
+ throw new Error(`skills add exited with code ${add.code}`);
70
+ }
71
+ consola.success(`Installed vibedgames skills for ${agents.join(", ")}`);
72
+ const update = await run("npx", skillsUpdateArgs(args.global, args.yes));
73
+ if (update.code !== 0) {
74
+ if (update.output.trim())
75
+ consola.warn(update.output.trim());
76
+ consola.warn(`'skills update' exited with code ${update.code}. Skills were just installed via 'add', so they should already be current.`);
77
+ }
78
+ else {
79
+ consola.success("Refreshed installed skills to latest");
80
+ }
81
+ if (cli.code !== 0) {
82
+ if (cli.output.trim())
83
+ consola.warn(cli.output.trim());
84
+ consola.warn(`Couldn't install the vg CLI globally (npm exit ${cli.code}). Install manually: npm install -g ${PKG}`);
85
+ return;
86
+ }
87
+ consola.success("Installed/updated vg CLI globally");
88
+ },
89
+ });
@@ -0,0 +1,8 @@
1
+ export declare const skillsCommand: import("citty").CommandDef<{
2
+ dir: {
3
+ type: "positional";
4
+ description: string;
5
+ required: false;
6
+ default: string;
7
+ };
8
+ }>;
@@ -0,0 +1,53 @@
1
+ import { execSync } from "node:child_process";
2
+ import { existsSync, mkdirSync, rmSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { defineCommand } from "citty";
5
+ import consola from "consola";
6
+ const REPO = "kyh/vibedgames";
7
+ const SKILLS_PATH = ".claude/skills";
8
+ const BRANCH = "main";
9
+ export const skillsCommand = defineCommand({
10
+ meta: {
11
+ name: "skills",
12
+ description: "Install vibedgames Claude Code skills into your project",
13
+ },
14
+ args: {
15
+ dir: {
16
+ type: "positional",
17
+ description: "Project directory",
18
+ required: false,
19
+ default: ".",
20
+ },
21
+ },
22
+ run: async ({ args }) => {
23
+ const projectDir = args.dir;
24
+ const targetDir = join(projectDir, SKILLS_PATH);
25
+ const tarballUrl = `https://github.com/${REPO}/archive/refs/heads/${BRANCH}.tar.gz`;
26
+ const tmpDir = join(projectDir, ".vg-skills-tmp");
27
+ consola.start("Fetching skills from vibedgames...");
28
+ try {
29
+ // Download and extract just the skills directory
30
+ mkdirSync(tmpDir, { recursive: true });
31
+ execSync(`curl -sL "${tarballUrl}" | tar xz --strip-components=3 -C "${tmpDir}" "vibedgames-${BRANCH}/${SKILLS_PATH}"`, { stdio: "pipe" });
32
+ // Copy to target
33
+ mkdirSync(targetDir, { recursive: true });
34
+ execSync(`cp -r "${tmpDir}"/* "${targetDir}"/`, { stdio: "pipe" });
35
+ // Count skills
36
+ const skills = execSync(`ls "${targetDir}"`, { encoding: "utf-8" })
37
+ .trim()
38
+ .split("\n")
39
+ .filter(Boolean);
40
+ consola.success(`Installed ${skills.length} skills to ${targetDir}`);
41
+ consola.log(` ${skills.join(", ")}`);
42
+ }
43
+ catch (err) {
44
+ consola.error(err instanceof Error ? err.message : String(err));
45
+ process.exit(1);
46
+ }
47
+ finally {
48
+ if (existsSync(tmpDir)) {
49
+ rmSync(tmpDir, { recursive: true });
50
+ }
51
+ }
52
+ },
53
+ });
package/dist/index.js CHANGED
@@ -1,16 +1,20 @@
1
1
  #!/usr/bin/env node
2
+ import { readFileSync } from "node:fs";
2
3
  import { defineCommand, runMain } from "citty";
3
4
  import { deployCommand } from "./commands/deploy.js";
5
+ import { initCommand } from "./commands/init.js";
4
6
  import { loginCommand } from "./commands/login.js";
5
7
  import { logoutCommand } from "./commands/logout.js";
6
8
  import { whoamiCommand } from "./commands/whoami.js";
9
+ const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
7
10
  const main = defineCommand({
8
11
  meta: {
9
12
  name: "vg",
10
- version: "0.0.1",
13
+ version: pkg.version,
11
14
  description: "vibedgames CLI",
12
15
  },
13
16
  subCommands: {
17
+ init: initCommand,
14
18
  login: loginCommand,
15
19
  logout: logoutCommand,
16
20
  deploy: deployCommand,
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibedgames",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,24 +9,26 @@
9
9
  "files": [
10
10
  "dist"
11
11
  ],
12
- "scripts": {
13
- "build": "tsc",
14
- "dev": "tsc --watch",
15
- "clean": "rm -rf .turbo dist node_modules",
16
- "typecheck": "tsc --noEmit"
17
- },
18
12
  "dependencies": {
19
- "@trpc/client": "catalog:",
13
+ "@trpc/client": "^11.16.0",
20
14
  "citty": "^0.1.6",
21
15
  "consola": "^3.4.2",
22
- "superjson": "catalog:"
16
+ "cross-spawn": "^7.0.6",
17
+ "superjson": "^2.2.6"
23
18
  },
24
19
  "devDependencies": {
25
- "@cloudflare/workers-types": "catalog:",
26
- "@kyh/tsconfig": "catalog:",
27
- "@repo/api": "workspace:^",
28
- "@trpc/server": "catalog:",
29
- "@types/node": "catalog:",
30
- "typescript": "catalog:"
20
+ "@cloudflare/workers-types": "^4.20260408.1",
21
+ "@kyh/tsconfig": "^1.1.14",
22
+ "@trpc/server": "^11.16.0",
23
+ "@types/cross-spawn": "^6.0.6",
24
+ "@types/node": "^25.5.2",
25
+ "typescript": "^6.0.2",
26
+ "@repo/api": "^0.1.0"
27
+ },
28
+ "scripts": {
29
+ "build": "tsc",
30
+ "dev": "tsc --watch",
31
+ "clean": "rm -rf .turbo dist node_modules",
32
+ "typecheck": "tsc --noEmit"
31
33
  }
32
- }
34
+ }