@vaiftech/cli 1.9.1 → 1.9.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/README.md +1 -1
- package/dist/cli.cjs +2 -2
- package/dist/cli.js +21 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@vaiftech/cli)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
Command-line tools for [VAIF Studio](https://vaif.studio) (v1.9.
|
|
6
|
+
Command-line tools for [VAIF Studio](https://vaif.studio) (v1.9.3) — scaffold full projects from templates with feature selection, browser-based authentication, manage schemas, deploy functions, generate TypeScript types, and more.
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
package/dist/cli.cjs
CHANGED
|
@@ -4231,5 +4231,5 @@ All authenticated requests require:
|
|
|
4231
4231
|
- \`x-project-id: ${e}\` \u2014 identifies the project
|
|
4232
4232
|
`}async function dt(t){let e=Q__default.default(),n=I();(!n||!n.token)&&(console.log(f__default.default.red("Not logged in")),console.log(f__default.default.gray("Run `vaif login` first to authenticate")),process.exit(1));let o=t.config||"vaif.config.json",r=null;try{r=await A(o);}catch{}let i=fo(t,r,n);i||(console.log(f__default.default.yellow(`No project ID specified \u2014 fetching your projects...
|
|
4233
4233
|
`)),i=await go(n.token),i||(console.log(f__default.default.gray(`
|
|
4234
|
-
Tip: pass --project-id <id> or set projectId in vaif.config.json`)),process.exit(1)));let s=___default.default.resolve(t.outputDir||".");console.log(""),console.log(f__default.default.bold("VAIF Claude Code Setup")),console.log(f__default.default.gray(` Project: ${i}`)),console.log(""),e.start("Fetching database schema...");let a={tables:[]};try{let p=await fetch(`${J}/schema-engine/introspect/${i}`,{headers:{Authorization:`Bearer ${n.token}`}});p.ok?(a=await p.json(),e.succeed(`Fetched schema (${a.tables?.length||0} tables)`)):e.warn("Could not fetch schema \u2014 continuing without it");}catch{e.warn("Could not fetch schema \u2014 continuing without it");}e.start("Fetching project info...");let l=i,d=J;try{let p=await fetch(`${J}/projects/${i}`,{headers:{Authorization:`Bearer ${n.token}`}});if(p.ok){let c=await p.json();l=
|
|
4235
|
-
`,"utf-8"),e.succeed(`Written ${f__default.default.cyan(".mcp.json")}`);}if(!t.skipClaudeMd){e.start("Writing CLAUDE.md...");let p=vo({projectId:i,apiKey:u,apiUrl:d,projectName:l,schema:a}),c=___default.default.join(s,"CLAUDE.md");U__default.default.writeFileSync(c,p,"utf-8"),e.succeed(`Written ${f__default.default.cyan("CLAUDE.md")}`);}console.log(""),console.log(f__default.default.green.bold(" Claude Code integration configured!")),console.log(""),t.skipMcp||console.log(f__default.default.gray(" MCP Server: ")+f__default.default.white(".mcp.json")),t.skipClaudeMd||console.log(f__default.default.gray(" Context: ")+f__default.default.white("CLAUDE.md")),console.log(""),console.log(f__default.default.bold(" Next steps:")),console.log(f__default.default.gray(" 1. Open this project in Claude Code")),console.log(f__default.default.gray(" 2. The MCP server auto-connects to your VAIF project")),console.log(f__default.default.gray(" 3. Ask Claude to query, modify, or build against your schema")),console.log("");}var pt="1.9.1",he=f__default.default.hex("#00f0ff"),ye=f__default.default.hex("#7b61ff"),ve=f__default.default.hex("#ff3dff"),be=f__default.default.hex("#00ff9d"),S=f__default.default.hex("#555570"),B=f__default.default.hex("#00f0ff");function bo(){console.log(""),console.log(he(" \u2566 \u2566")+ye("\u2554\u2550\u2557\u2566")+ve("\u2554\u2550\u2557 ")+be("\u2554\u2550\u2557\u2566 \u2566")),console.log(he(" \u255A\u2557\u2554\u255D")+ye("\u2560\u2550\u2563\u2551")+ve("\u2560\u2563 ")+be("\u2551 \u2551 \u2551")),console.log(he(" \u255A\u255D ")+ye("\u2569 \u2569\u2569")+ve("\u255A ")+be("\u255A\u2550\u255D\u2569\u2550\u255D\u2569")),console.log(""),console.log(S(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log(B(" VAIF Studio CLI")+S(` v${pt}`)),console.log(S(" Build full-stack apps at lightning speed")),console.log(S(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log(""),console.log(f__default.default.bold(" Quick Start")),console.log(S(" $ ")+B("vaif login")+S(" Authenticate")),console.log(S(" $ ")+B("vaif init -t react-spa")+S(" Scaffold project")),console.log(S(" $ ")+B("vaif db push")+S(" Push migrations")),console.log(S(" $ ")+B("vaif generate")+S(" Generate types")),console.log(S(" $ ")+B("vaif functions deploy")+S(" Deploy functions")),console.log(""),console.log(f__default.default.bold(" Categories")),console.log(S(" auth ")+f__default.default.white("login, logout, whoami")),console.log(S(" project ")+f__default.default.white("init, templates, info, status")),console.log(S(" schema ")+f__default.default.white("pull, push, generate")),console.log(S(" database ")+f__default.default.white("db push, db pull, db seed, db reset")),console.log(S(" deploy ")+f__default.default.white("functions deploy, functions list")),console.log(S(" security ")+f__default.default.white("keys, secrets")),console.log(S(" ai ")+f__default.default.white("claude-setup")),console.log(""),console.log(S(" Run ")+B("vaif <command> --help")+S(" for details")),console.log(S(" Docs: ")+f__default.default.underline("https://docs.vaif.studio")),console.log("");}commander.program.name("vaif").description("VAIF CLI - Type generation and development tools").version(pt);commander.program.command("login").description("Authenticate with VAIF (opens browser)").option("-e, --email","Login with email/password instead of browser").option("-p, --project-id <id>","Default project ID").action(Te);commander.program.command("logout").description("Log out and remove stored credentials").action(Pe);commander.program.command("whoami").description("Show current authenticated user").action(Fe);commander.program.command("init").description("Initialize VAIF configuration in your project").option("--typescript","Setup for TypeScript project").option("-f, --force","Overwrite existing config").option("-t, --template <name>","Scaffold from a template (run vaif templates for list)").option("--features <features>","Comma-separated features to include: auth,database,realtime,storage,functions").option("--add-features <features>","Add features to an existing project (requires --template)").action(Ne);commander.program.command("templates").alias("tpl").description("List available project templates").action(Le);commander.program.command("info").description("Show project information (name, region, URLs)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").action(st);commander.program.command("status").description("Show project status (tables, functions, storage, connections)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").action(rt);commander.program.command("pull").description("Pull database schema from your VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-o, --output <path>","Output file path","vaif.schema.json").option("-s, --schema <name>","Schema name","public").option("-p, --project-id <id>","Project ID (overrides config)").action(Ve);commander.program.command("push").description("Push local schema changes to your VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-s, --schema <path>","Schema file path","vaif.schema.json").option("-p, --project-id <id>","Project ID (overrides config)").option("--dry-run","Preview changes without applying").option("-f, --force","Apply changes without confirmation").action($e);commander.program.command("generate").alias("gen").description("Generate TypeScript types from your database schema").option("-c, --connection <url>","Database connection string").option("-o, --output <path>","Output file path","./src/types/database.ts").option("--schema <name>","Schema name","public").option("--config <path>","Config file path","vaif.config.json").option("--dry-run","Preview generated types without writing").action(je);var ut=commander.program.command("functions").alias("fn").description("Manage serverless functions");ut.command("deploy").description("Deploy functions to your VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID").option("-n, --name <name>","Function name filter").option("-r, --runtime <runtime>","Runtime (nodejs, typescript, python)").option("--entrypoint <file>","Specific entrypoint file").option("--dry-run","Preview deployment without deploying").action(ze);ut.command("list").alias("ls").description("List deployed functions").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID").action(Be);var ae=commander.program.command("db").description("Database management commands");ae.command("push").description("Push local Drizzle migrations to VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-d, --dir <path>","Migrations directory","./drizzle").option("--dry-run","Preview without applying").action(Je);ae.command("pull").description("Pull schema from VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-o, --output <path>","Output file","vaif.schema.json").action(Ge);ae.command("seed").description("Seed your database with test data").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-f, --file <path>","Specific seed file").option("-t, --table <name>","Seed specific table only").option("--truncate","Truncate tables before seeding").option("--dry-run","Preview seeding without inserting data").action(Ye);ae.command("reset").description("Reset database (drop all tables and data)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-f, --force","Confirm reset (required)").action(We);var ft=commander.program.command("keys").description("Manage API keys");ft.command("generate").description("Generate a new API key").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-n, --name <name>","Key name").action(Ze);ft.command("list").alias("ls").description("List API keys").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").action(et);var ie=commander.program.command("secrets").alias("sec").description("Manage function secrets");ie.command("set <name> [value]").description("Create or update a secret").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID or name").option("--from-file <path>","Read secret value from a file").action(tt);ie.command("list").alias("ls").description("List all secrets (names only)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID or name").action(ot);ie.command("get <name>").description("Reveal a secret value").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID or name").action(nt);ie.command("delete <name>").description("Delete a secret").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID or name").action(at);commander.program.command("claude-setup").description("Configure Claude Code integration (MCP server + CLAUDE.md)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID").option("-k, --api-key <key>","API key for MCP server").option("--skip-mcp","Skip generating .mcp.json").option("--skip-claude-md","Skip generating CLAUDE.md").option("-o, --output-dir <dir>","Output directory",".").action(dt);process.argv.slice(2).length||(bo(),process.exit(0));commander.program.parse(process.argv);
|
|
4234
|
+
Tip: pass --project-id <id> or set projectId in vaif.config.json`)),process.exit(1)));let s=___default.default.resolve(t.outputDir||".");console.log(""),console.log(f__default.default.bold("VAIF Claude Code Setup")),console.log(f__default.default.gray(` Project: ${i}`)),console.log(""),e.start("Fetching database schema...");let a={tables:[]};try{let p=await fetch(`${J}/schema-engine/introspect/${i}`,{headers:{Authorization:`Bearer ${n.token}`}});p.ok?(a=await p.json(),e.succeed(`Fetched schema (${a.tables?.length||0} tables)`)):e.warn("Could not fetch schema \u2014 continuing without it");}catch{e.warn("Could not fetch schema \u2014 continuing without it");}e.start("Fetching project info...");let l=i,d=J;try{let p=await fetch(`${J}/projects/${i}`,{headers:{Authorization:`Bearer ${n.token}`}});if(p.ok){let c=await p.json(),g=c.project||c;l=g.name||i,d=g.apiUrl||J,e.succeed(`Project: ${l}`);}else e.warn("Could not fetch project info \u2014 using defaults");}catch{e.warn("Could not fetch project info \u2014 using defaults");}let u=t.apiKey||r?.api?.apiKey||"";if(!u){e.start("Generating API key for Claude Code...");try{let p=`claude-code-${Date.now()}`,c=await fetch(`${J}/projects/${i}/api-keys`,{method:"POST",headers:{Authorization:`Bearer ${n.token}`,"Content-Type":"application/json"},body:JSON.stringify({name:p,scopes:["crud","realtime","functions","storage"]})});if(c.ok){let g=await c.json();u=g.apiKey||g.key,e.succeed(`Generated API key: ${p}`);}else e.fail("Could not auto-generate API key"),console.log(f__default.default.yellow(" Pass one with --api-key or generate via `vaif keys generate`")),process.exit(1);}catch{e.fail("Could not auto-generate API key"),console.log(f__default.default.yellow(" Pass one with --api-key or generate via `vaif keys generate`")),process.exit(1);}}if(!t.skipMcp){e.start("Writing .mcp.json...");let p={mcpServers:{"vaif-studio":{command:"npx",args:["@vaiftech/mcp"],env:{VAIF_API_KEY:u,VAIF_PROJECT_ID:i,VAIF_API_URL:d,VAIF_AUTH_TOKEN:n.token}}}},c=___default.default.join(s,".mcp.json");U__default.default.writeFileSync(c,JSON.stringify(p,null,2)+`
|
|
4235
|
+
`,"utf-8"),e.succeed(`Written ${f__default.default.cyan(".mcp.json")}`);}if(!t.skipClaudeMd){e.start("Writing CLAUDE.md...");let p=vo({projectId:i,apiKey:u,apiUrl:d,projectName:l,schema:a}),c=___default.default.join(s,"CLAUDE.md");U__default.default.writeFileSync(c,p,"utf-8"),e.succeed(`Written ${f__default.default.cyan("CLAUDE.md")}`);}console.log(""),console.log(f__default.default.green.bold(" Claude Code integration configured!")),console.log(""),t.skipMcp||console.log(f__default.default.gray(" MCP Server: ")+f__default.default.white(".mcp.json")),t.skipClaudeMd||console.log(f__default.default.gray(" Context: ")+f__default.default.white("CLAUDE.md")),console.log(""),console.log(f__default.default.bold(" Next steps:")),console.log(f__default.default.gray(" 1. Open this project in Claude Code")),console.log(f__default.default.gray(" 2. The MCP server auto-connects to your VAIF project")),console.log(f__default.default.gray(" 3. Ask Claude to query, modify, or build against your schema")),console.log("");}var pt="1.9.3",he=f__default.default.hex("#00f0ff"),ye=f__default.default.hex("#7b61ff"),ve=f__default.default.hex("#ff3dff"),be=f__default.default.hex("#00ff9d"),S=f__default.default.hex("#555570"),B=f__default.default.hex("#00f0ff");function bo(){console.log(""),console.log(he(" \u2566 \u2566")+ye("\u2554\u2550\u2557\u2566")+ve("\u2554\u2550\u2557 ")+be("\u2554\u2550\u2557\u2566 \u2566")),console.log(he(" \u255A\u2557\u2554\u255D")+ye("\u2560\u2550\u2563\u2551")+ve("\u2560\u2563 ")+be("\u2551 \u2551 \u2551")),console.log(he(" \u255A\u255D ")+ye("\u2569 \u2569\u2569")+ve("\u255A ")+be("\u255A\u2550\u255D\u2569\u2550\u255D\u2569")),console.log(""),console.log(S(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log(B(" VAIF Studio CLI")+S(` v${pt}`)),console.log(S(" Build full-stack apps at lightning speed")),console.log(S(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log(""),console.log(f__default.default.bold(" Quick Start")),console.log(S(" $ ")+B("vaif login")+S(" Authenticate")),console.log(S(" $ ")+B("vaif init -t react-spa")+S(" Scaffold project")),console.log(S(" $ ")+B("vaif db push")+S(" Push migrations")),console.log(S(" $ ")+B("vaif generate")+S(" Generate types")),console.log(S(" $ ")+B("vaif functions deploy")+S(" Deploy functions")),console.log(""),console.log(f__default.default.bold(" Categories")),console.log(S(" auth ")+f__default.default.white("login, logout, whoami")),console.log(S(" project ")+f__default.default.white("init, templates, info, status")),console.log(S(" schema ")+f__default.default.white("pull, push, generate")),console.log(S(" database ")+f__default.default.white("db push, db pull, db seed, db reset")),console.log(S(" deploy ")+f__default.default.white("functions deploy, functions list")),console.log(S(" security ")+f__default.default.white("keys, secrets")),console.log(S(" ai ")+f__default.default.white("claude-setup")),console.log(""),console.log(S(" Run ")+B("vaif <command> --help")+S(" for details")),console.log(S(" Docs: ")+f__default.default.underline("https://docs.vaif.studio")),console.log("");}commander.program.name("vaif").description("VAIF CLI - Type generation and development tools").version(pt);commander.program.command("login").description("Authenticate with VAIF (opens browser)").option("-e, --email","Login with email/password instead of browser").option("-p, --project-id <id>","Default project ID").action(Te);commander.program.command("logout").description("Log out and remove stored credentials").action(Pe);commander.program.command("whoami").description("Show current authenticated user").action(Fe);commander.program.command("init").description("Initialize VAIF configuration in your project").option("--typescript","Setup for TypeScript project").option("-f, --force","Overwrite existing config").option("-t, --template <name>","Scaffold from a template (run vaif templates for list)").option("--features <features>","Comma-separated features to include: auth,database,realtime,storage,functions").option("--add-features <features>","Add features to an existing project (requires --template)").action(Ne);commander.program.command("templates").alias("tpl").description("List available project templates").action(Le);commander.program.command("info").description("Show project information (name, region, URLs)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").action(st);commander.program.command("status").description("Show project status (tables, functions, storage, connections)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").action(rt);commander.program.command("pull").description("Pull database schema from your VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-o, --output <path>","Output file path","vaif.schema.json").option("-s, --schema <name>","Schema name","public").option("-p, --project-id <id>","Project ID (overrides config)").action(Ve);commander.program.command("push").description("Push local schema changes to your VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-s, --schema <path>","Schema file path","vaif.schema.json").option("-p, --project-id <id>","Project ID (overrides config)").option("--dry-run","Preview changes without applying").option("-f, --force","Apply changes without confirmation").action($e);commander.program.command("generate").alias("gen").description("Generate TypeScript types from your database schema").option("-c, --connection <url>","Database connection string").option("-o, --output <path>","Output file path","./src/types/database.ts").option("--schema <name>","Schema name","public").option("--config <path>","Config file path","vaif.config.json").option("--dry-run","Preview generated types without writing").action(je);var ut=commander.program.command("functions").alias("fn").description("Manage serverless functions");ut.command("deploy").description("Deploy functions to your VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID").option("-n, --name <name>","Function name filter").option("-r, --runtime <runtime>","Runtime (nodejs, typescript, python)").option("--entrypoint <file>","Specific entrypoint file").option("--dry-run","Preview deployment without deploying").action(ze);ut.command("list").alias("ls").description("List deployed functions").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID").action(Be);var ae=commander.program.command("db").description("Database management commands");ae.command("push").description("Push local Drizzle migrations to VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-d, --dir <path>","Migrations directory","./drizzle").option("--dry-run","Preview without applying").action(Je);ae.command("pull").description("Pull schema from VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-o, --output <path>","Output file","vaif.schema.json").action(Ge);ae.command("seed").description("Seed your database with test data").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-f, --file <path>","Specific seed file").option("-t, --table <name>","Seed specific table only").option("--truncate","Truncate tables before seeding").option("--dry-run","Preview seeding without inserting data").action(Ye);ae.command("reset").description("Reset database (drop all tables and data)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-f, --force","Confirm reset (required)").action(We);var ft=commander.program.command("keys").description("Manage API keys");ft.command("generate").description("Generate a new API key").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-n, --name <name>","Key name").action(Ze);ft.command("list").alias("ls").description("List API keys").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").action(et);var ie=commander.program.command("secrets").alias("sec").description("Manage function secrets");ie.command("set <name> [value]").description("Create or update a secret").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID or name").option("--from-file <path>","Read secret value from a file").action(tt);ie.command("list").alias("ls").description("List all secrets (names only)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID or name").action(ot);ie.command("get <name>").description("Reveal a secret value").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID or name").action(nt);ie.command("delete <name>").description("Delete a secret").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID or name").action(at);commander.program.command("claude-setup").description("Configure Claude Code integration (MCP server + CLAUDE.md)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID").option("-k, --api-key <key>","API key for MCP server").option("--skip-mcp","Skip generating .mcp.json").option("--skip-claude-md","Skip generating CLAUDE.md").option("-o, --output-dir <dir>","Output directory",".").action(dt);process.argv.slice(2).length||(bo(),process.exit(0));commander.program.parse(process.argv);
|
package/dist/cli.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {c,d as d$1,e,h,g,f,b,a}from'./chunk-T7GOLIY4.js';import'dotenv/config';import {program}from'commander';import d from'chalk';import F from'fs';import $ from'path';import
|
|
2
|
+
import {c,d as d$1,e,h,g,f,b,a}from'./chunk-T7GOLIY4.js';import'dotenv/config';import {program}from'commander';import d from'chalk';import F from'fs';import $ from'path';import K from'ora';import We from'readline';var Be=process.env.VAIF_API_URL||"https://api.vaif.studio";async function Je(o,e,t="public"){let n=await fetch(`${Be}/projects/${e}/schema?schema=${t}`,{headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}});if(!n.ok){let a=await n.text();throw new Error(`Failed to fetch schema: ${a}`)}return n.json()}async function ce(o){let e=K(),t=b();(!t||!t.token)&&(console.log(d.red("Not logged in")),console.log(d.gray("Run `vaif login` first to authenticate")),process.exit(1));let n=o.config||"vaif.config.json",a$1=null;e.start("Loading configuration...");try{a$1=await a(n);}catch(i){e.fail("Failed to load config"),console.log(d.red(`
|
|
3
3
|
Error: ${i}`)),process.exit(1);}a$1||(e.fail("No configuration found"),console.log(d.yellow("\nRun `vaif init` to create a configuration file.")),process.exit(1));let r=o.projectId||a$1.projectId||process.env.VAIF_PROJECT_ID||t.projectId;r||(e.fail("No project ID specified"),console.log(d.yellow(`
|
|
4
4
|
Set projectId in vaif.config.json or use --project-id flag.`)),process.exit(1)),e.text="Fetching remote schema...";try{let i=o.schema||a$1.database?.schema||"public",s=await Je(t.token,r,i);e.succeed("Schema fetched successfully");let c=o.output||$.resolve("vaif.schema.json"),f={$schema:"https://vaif.studio/schemas/schema.json",projectId:r,schema:i,pulledAt:new Date().toISOString(),...s};F.writeFileSync(c,JSON.stringify(f,null,2),"utf-8"),console.log(""),console.log(d.green(`Schema saved to: ${c}`)),console.log(""),console.log(d.gray("Schema summary:")),console.log(d.gray(` Tables: ${(s.tables||[]).length}`)),console.log(d.gray(` Enums: ${(s.enums||[]).length}`)),console.log(d.gray(` Functions: ${(s.functions||[]).length}`)),console.log(""),console.log(d.gray("Next steps:")),console.log(d.gray(" - Run `vaif generate` to generate TypeScript types")),console.log(d.gray(" - Edit the schema and run `vaif push` to deploy changes")),console.log("");}catch(i){e.fail("Failed to fetch schema"),i instanceof Error&&console.log(d.red(`
|
|
5
|
-
Error: ${i.message}`)),process.exit(1);}}var ge=process.env.VAIF_API_URL||"https://api.vaif.studio";function Ge(o){let e=We.createInterface({input:process.stdin,output:process.stdout});return new Promise(t=>{e.question(o,n=>{e.close(),t(n);});})}async function Ye(o,e,t){let n=await fetch(`${ge}/projects/${e}/schema/preview`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify({schema:t})});if(!n.ok){let a=await n.text();throw new Error(`Failed to preview changes: ${a}`)}return n.json()}async function He(o,e,t){let n=await fetch(`${ge}/projects/${e}/schema/apply`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify({schema:t})});if(!n.ok){let a=await n.text();throw new Error(`Failed to apply changes: ${a}`)}return n.json()}function Qe(o){if(console.log(""),console.log(d.bold("Schema Changes:")),console.log(""),o.added.length===0&&o.modified.length===0&&o.removed.length===0){console.log(d.gray(" No changes detected. Schema is up to date."));return}if(o.added.length>0){console.log(d.green.bold(" + Added:"));for(let e of o.added)console.log(d.green(` + ${e.type}: ${e.name}`));console.log("");}if(o.modified.length>0){console.log(d.yellow.bold(" ~ Modified:"));for(let e of o.modified){console.log(d.yellow(` ~ ${e.type}: ${e.name}`));for(let t of e.changes)console.log(d.gray(` ${t}`));}console.log("");}if(o.removed.length>0){console.log(d.red.bold(" - Removed:"));for(let e of o.removed)console.log(d.red(` - ${e.type}: ${e.name}`));console.log("");}}async function de(o){let e=
|
|
5
|
+
Error: ${i.message}`)),process.exit(1);}}var ge=process.env.VAIF_API_URL||"https://api.vaif.studio";function Ge(o){let e=We.createInterface({input:process.stdin,output:process.stdout});return new Promise(t=>{e.question(o,n=>{e.close(),t(n);});})}async function Ye(o,e,t){let n=await fetch(`${ge}/projects/${e}/schema/preview`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify({schema:t})});if(!n.ok){let a=await n.text();throw new Error(`Failed to preview changes: ${a}`)}return n.json()}async function He(o,e,t){let n=await fetch(`${ge}/projects/${e}/schema/apply`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify({schema:t})});if(!n.ok){let a=await n.text();throw new Error(`Failed to apply changes: ${a}`)}return n.json()}function Qe(o){if(console.log(""),console.log(d.bold("Schema Changes:")),console.log(""),o.added.length===0&&o.modified.length===0&&o.removed.length===0){console.log(d.gray(" No changes detected. Schema is up to date."));return}if(o.added.length>0){console.log(d.green.bold(" + Added:"));for(let e of o.added)console.log(d.green(` + ${e.type}: ${e.name}`));console.log("");}if(o.modified.length>0){console.log(d.yellow.bold(" ~ Modified:"));for(let e of o.modified){console.log(d.yellow(` ~ ${e.type}: ${e.name}`));for(let t of e.changes)console.log(d.gray(` ${t}`));}console.log("");}if(o.removed.length>0){console.log(d.red.bold(" - Removed:"));for(let e of o.removed)console.log(d.red(` - ${e.type}: ${e.name}`));console.log("");}}async function de(o){let e=K(),t=b();(!t||!t.token)&&(console.log(d.red("Not logged in")),console.log(d.gray("Run `vaif login` first to authenticate")),process.exit(1));let n=o.config||"vaif.config.json",a$1=null;e.start("Loading configuration...");try{a$1=await a(n);}catch(c){e.fail("Failed to load config"),console.log(d.red(`
|
|
6
6
|
Error: ${c}`)),process.exit(1);}a$1||(e.fail("No configuration found"),console.log(d.yellow("\nRun `vaif init` to create a configuration file.")),process.exit(1));let r=o.projectId||a$1.projectId||process.env.VAIF_PROJECT_ID||t.projectId;r||(e.fail("No project ID specified"),console.log(d.yellow(`
|
|
7
7
|
Set projectId in vaif.config.json or use --project-id flag.`)),process.exit(1));let i=o.schema||$.resolve("vaif.schema.json");F.existsSync(i)||(e.fail("No local schema found"),console.log(d.yellow(`
|
|
8
8
|
Expected schema file at: ${i}`)),console.log(d.gray("Run `vaif pull` first to fetch the current schema.")),process.exit(1));let s;try{let c=F.readFileSync(i,"utf-8");s=JSON.parse(c);}catch(c){e.fail("Failed to parse schema file"),c instanceof Error&&console.log(d.red(`
|
|
9
9
|
Error: ${c.message}`)),process.exit(1);}e.text="Calculating schema changes...";try{let{diff:c,sql:f}=await Ye(t.token,r,s);if(e.stop(),Qe(c),c.added.length===0&&c.modified.length===0&&c.removed.length===0){console.log("");return}if(f.length>0){console.log(d.bold("SQL Migrations:")),console.log("");for(let g of f)console.log(d.gray(` ${g}`));console.log("");}if(o.dryRun){console.log(d.yellow("Dry run mode - no changes applied.")),console.log(d.gray("Remove --dry-run to apply these changes."));return}if(!o.force){c.removed.length>0&&(console.log(d.red.bold("\u26A0\uFE0F Warning: This will remove tables/columns from your database.")),console.log(d.red(" This action cannot be undone!")),console.log(""));let l=await Ge(d.cyan("Apply these changes? [y/N] "));if(l.toLowerCase()!=="y"&&l.toLowerCase()!=="yes"){console.log(d.yellow(`
|
|
10
10
|
Cancelled. No changes applied.`));return}}e.start("Applying schema changes...");let p=await He(t.token,r,s);if(p.success){if(e.succeed("Schema changes applied successfully"),console.log(""),p.migrations.length>0){console.log(d.gray("Migrations applied:"));for(let g of p.migrations)console.log(d.gray(` - ${g}`));console.log("");}console.log(d.green("Your database schema is now up to date.")),console.log(d.gray("Run `vaif generate` to update your TypeScript types.")),console.log("");}else e.fail("Failed to apply some changes");}catch(c){e.fail("Failed to push schema changes"),c instanceof Error&&console.log(d.red(`
|
|
11
|
-
Error: ${c.message}`)),process.exit(1);}}var z=process.env.VAIF_API_URL||"https://api.vaif.studio";async function Xe(o,e,t,n){let a=new URL(`${z}/functions/project/${e}`);n&&a.searchParams.set("envId",n);let r=await fetch(a.toString(),{headers:{Authorization:`Bearer ${o}`}});if(!r.ok)return null;let i=await r.json(),s=i.functions||i;return Array.isArray(s)&&s.find(c=>c.name===t)||null}async function Ze(o,e,t){let n=await fetch(`${z}/functions/`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify({projectId:e,name:t.name,runtime:t.runtime,entrypoint:t.entrypoint,envId:t.envId})});if(!n.ok){let a=await n.text();throw new Error(`Failed to create function: ${a}`)}return n.json()}async function eo(o,e,t){let n=await fetch(`${z}/functions/${e}/source`,{method:"PUT",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify({sourceCode:t})});if(!n.ok){let a=await n.text();throw new Error(`Failed to deploy source: ${a}`)}}async function oo(o,e,t){let n=new URL(`${z}/functions/project/${e}`);t&&n.searchParams.set("envId",t);let a=await fetch(n.toString(),{headers:{Authorization:`Bearer ${o}`}});if(!a.ok){let i=await a.text();throw new Error(`Failed to list functions: ${i}`)}let r=await a.json();return r.functions||r}function fe(o){switch($.extname(o).toLowerCase()){case ".ts":return "typescript";case ".js":case ".mjs":return "nodejs";case ".py":return "python";case ".go":return "go";case ".rs":return "rust";default:return "nodejs"}}function pe(o){let e=[],t=[".ts",".js",".mjs",".py",".go",".rs"],n=["drizzle.config.ts","tsconfig.json","package.json"];if(!F.existsSync(o))return e;let a=F.readdirSync(o,{withFileTypes:true});for(let r of a){let i=$.join(o,r.name);if(r.isDirectory()){if(r.name!=="node_modules"&&!r.name.startsWith(".")){let s=F.readdirSync(i,{withFileTypes:true});for(let c of s)if(c.isFile()){let f=$.extname(c.name).toLowerCase();if(t.includes(f)){e.push($.join(i,c.name));break}}}}else if(r.isFile()){let s=$.extname(r.name).toLowerCase();t.includes(s)&&!n.includes(r.name)&&e.push(i);}}return e}async function he(o){let e=
|
|
11
|
+
Error: ${c.message}`)),process.exit(1);}}var z=process.env.VAIF_API_URL||"https://api.vaif.studio";async function Xe(o,e,t,n){let a=new URL(`${z}/functions/project/${e}`);n&&a.searchParams.set("envId",n);let r=await fetch(a.toString(),{headers:{Authorization:`Bearer ${o}`}});if(!r.ok)return null;let i=await r.json(),s=i.functions||i;return Array.isArray(s)&&s.find(c=>c.name===t)||null}async function Ze(o,e,t){let n=await fetch(`${z}/functions/`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify({projectId:e,name:t.name,runtime:t.runtime,entrypoint:t.entrypoint,envId:t.envId})});if(!n.ok){let a=await n.text();throw new Error(`Failed to create function: ${a}`)}return n.json()}async function eo(o,e,t){let n=await fetch(`${z}/functions/${e}/source`,{method:"PUT",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify({sourceCode:t})});if(!n.ok){let a=await n.text();throw new Error(`Failed to deploy source: ${a}`)}}async function oo(o,e,t){let n=new URL(`${z}/functions/project/${e}`);t&&n.searchParams.set("envId",t);let a=await fetch(n.toString(),{headers:{Authorization:`Bearer ${o}`}});if(!a.ok){let i=await a.text();throw new Error(`Failed to list functions: ${i}`)}let r=await a.json();return r.functions||r}function fe(o){switch($.extname(o).toLowerCase()){case ".ts":return "typescript";case ".js":case ".mjs":return "nodejs";case ".py":return "python";case ".go":return "go";case ".rs":return "rust";default:return "nodejs"}}function pe(o){let e=[],t=[".ts",".js",".mjs",".py",".go",".rs"],n=["drizzle.config.ts","tsconfig.json","package.json"];if(!F.existsSync(o))return e;let a=F.readdirSync(o,{withFileTypes:true});for(let r of a){let i=$.join(o,r.name);if(r.isDirectory()){if(r.name!=="node_modules"&&!r.name.startsWith(".")){let s=F.readdirSync(i,{withFileTypes:true});for(let c of s)if(c.isFile()){let f=$.extname(c.name).toLowerCase();if(t.includes(f)){e.push($.join(i,c.name));break}}}}else if(r.isFile()){let s=$.extname(r.name).toLowerCase();t.includes(s)&&!n.includes(r.name)&&e.push(i);}}return e}async function he(o){let e=K(),t=b();(!t||!t.token)&&(console.log(d.red("Not logged in")),console.log(d.gray("Run `vaif login` first to authenticate")),process.exit(1));let n=o.config||"vaif.config.json",a$1=null;try{a$1=await a(n);}catch{}let r=o.projectId||a$1?.projectId||process.env.VAIF_PROJECT_ID||t.projectId;r||(console.log(d.red("No project ID specified")),console.log(d.yellow("Set projectId in vaif.config.json or use --project-id flag.")),process.exit(1)),console.log(""),console.log(d.bold("VAIF Functions Deploy")),console.log(""),e.start("Scanning for function files...");let i=$.resolve("functions"),s=$.resolve("src/functions"),c=[];if(o.entrypoint){let l=$.resolve(o.entrypoint);F.existsSync(l)||(e.fail(`File not found: ${o.entrypoint}`),process.exit(1)),c=[l];}else c=[...pe(i),...pe(s)];c.length===0&&(e.fail("No function files found"),console.log(d.yellow(`
|
|
12
12
|
Place your functions in:`)),console.log(d.gray(" - ./functions/")),console.log(d.gray(" - ./src/functions/")),console.log(d.gray(`
|
|
13
13
|
Or specify an entrypoint with --entrypoint`)),process.exit(1)),e.succeed(`Found ${c.length} function(s)`),o.name&&(c=c.filter(l=>$.basename(l,$.extname(l)).includes(o.name)),c.length===0&&(console.log(d.yellow(`
|
|
14
|
-
No functions matching "${o.name}" found`)),process.exit(1))),console.log(""),console.log(d.gray("Functions to deploy:"));for(let l of c){let
|
|
14
|
+
No functions matching "${o.name}" found`)),process.exit(1))),console.log(""),console.log(d.gray("Functions to deploy:"));for(let l of c){let u=$.basename($.dirname(l)),y=u==="functions"||u==="src"?$.basename(l,$.extname(l)):u,D=o.runtime||fe(l);console.log(d.gray(` - ${y} (${D})`));}if(console.log(""),o.dryRun){console.log(d.yellow("Dry run mode - no functions deployed."));return}let f=[];for(let l of c){let u=$.basename($.dirname(l)),y=u==="functions"||u==="src"?$.basename(l,$.extname(l)):u,D=o.runtime||fe(l);e.start(`Deploying ${y}...`);try{let U=F.readFileSync(l,"utf-8"),L=await Xe(t.token,r,y,o.envId);L||(e.text=`Creating ${y}...`,L=await Ze(t.token,r,{name:y,runtime:D,entrypoint:$.basename(l),envId:o.envId})),e.text=`Deploying ${y}...`,await eo(t.token,L.id,U),e.succeed(`Deployed ${y}`),f.push({name:y,success:!0});}catch(U){let L=U instanceof Error?U.message:"Unknown error";e.fail(`Failed to deploy ${y}`),f.push({name:y,success:false,error:L});}}console.log("");let p=f.filter(l=>l.success).length;if(f.filter(l=>!l.success).length===0)console.log(d.green(`\u2713 Successfully deployed ${p} function(s)`));else {console.log(d.yellow(`Deployed ${p}/${f.length} function(s)`)),console.log(""),console.log(d.red("Failed deployments:"));for(let l of f.filter(u=>!u.success))console.log(d.red(` - ${l.name}: ${l.error}`));}console.log("");}async function me(o){let e=K(),t=b();(!t||!t.token)&&(console.log(d.red("Not logged in")),console.log(d.gray("Run `vaif login` first to authenticate")),process.exit(1));let n=o.config||"vaif.config.json",a$1=null;try{a$1=await a(n);}catch{}let r=o.projectId||a$1?.projectId||process.env.VAIF_PROJECT_ID||t.projectId;r||(console.log(d.red("No project ID specified")),process.exit(1)),e.start("Fetching functions...");try{let i=await oo(t.token,r,o.envId);if(e.stop(),i.length===0){console.log(d.yellow(`
|
|
15
15
|
No functions found`)),console.log(d.gray("Deploy your first function with: vaif functions deploy"));return}console.log(""),console.log(d.bold(`Functions (${i.length}):`)),console.log(""),console.log(d.gray(" "+"NAME".padEnd(25)+"RUNTIME".padEnd(15)+"STATUS".padEnd(12)+"INVOCATIONS".padEnd(14)+"LAST DEPLOYED")),console.log(d.gray(" "+"-".repeat(80)));for(let s of i){let c=s.deployStatus==="deployed"?d.green:s.deployStatus==="deploying"?d.yellow:s.deployStatus==="failed"?d.red:d.gray;console.log(" "+s.name.padEnd(25)+s.runtime.padEnd(15)+c(s.deployStatus.padEnd(12))+String(s.invocationCount??0).padEnd(14)+(s.deployedAt?new Date(s.deployedAt).toLocaleDateString():"-"));}console.log("");}catch(i){e.fail("Failed to fetch functions"),i instanceof Error&&console.log(d.red(`
|
|
16
|
-
Error: ${i.message}`)),process.exit(1);}}var
|
|
16
|
+
Error: ${i.message}`)),process.exit(1);}}var B=process.env.VAIF_API_URL||"https://api.vaif.studio";async function to(o,e,t,n,a){let r=await fetch(`${B}/projects/${e}/db/seed`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify({table:t,records:n,truncate:a?.truncate??false})});if(!r.ok){let i=await r.text();throw new Error(`Failed to seed ${t}: ${i}`)}return r.json()}async function no(o,e){let t=await fetch(`${B}/projects/${e}/db/reset`,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"}});if(!t.ok){let n=await t.text();throw new Error(`Failed to reset database: ${n}`)}return t.json()}function H(o){let e=[];if(!F.existsSync(o))return e;let t=F.readdirSync(o,{withFileTypes:true});for(let n of t)if(n.isFile()){let a=$.extname(n.name).toLowerCase();(a===".json"||a===".ts"||a===".js")&&e.push($.join(o,n.name));}return e.sort()}async function ye(o){let e=$.extname(o).toLowerCase();if(e===".json"){let t=F.readFileSync(o,"utf-8"),n=JSON.parse(t);return Array.isArray(n)?[{table:$.basename(o,e),data:n}]:n.table&&n.data?[n]:Object.entries(n).map(([a,r])=>({table:a,data:r}))}else if(e===".ts"||e===".js"){let t=await import(o),n=t.default||t;return typeof n=="function"?n():n}throw new Error(`Unsupported file format: ${e}`)}async function we(o){let e=K(),t=b();(!t||!t.token)&&(console.log(d.red("Not logged in")),console.log(d.gray("Run `vaif login` first to authenticate")),process.exit(1));let n=o.config||"vaif.config.json",a$1=null;try{a$1=await a(n);}catch{}let r=o.projectId||a$1?.projectId||process.env.VAIF_PROJECT_ID||t.projectId;r||(console.log(d.red("No project ID specified")),console.log(d.yellow("Set projectId in vaif.config.json or use --project-id flag.")),process.exit(1)),console.log(""),console.log(d.bold("VAIF Database Seed")),console.log("");let i=[];if(o.file){let p=$.resolve(o.file);F.existsSync(p)||(console.log(d.red(`File not found: ${o.file}`)),process.exit(1)),i=[p];}else {let p=$.resolve("seeds"),g=$.resolve("prisma/seed"),l=$.resolve("db/seeds");i=[...H(p),...H(g),...H(l)];}i.length===0&&(console.log(d.yellow("No seed files found")),console.log(d.gray(`
|
|
17
17
|
Place your seed files in one of these directories:`)),console.log(d.gray(" - ./seeds/")),console.log(d.gray(" - ./prisma/seed/")),console.log(d.gray(" - ./db/seeds/")),console.log(d.gray(`
|
|
18
18
|
Or specify a file with --file`)),console.log(d.gray(`
|
|
19
|
-
Example seed file (seeds/users.json):`)),console.log(d.gray(" [")),console.log(d.gray(' { "name": "John Doe", "email": "john@example.com" },')),console.log(d.gray(' { "name": "Jane Doe", "email": "jane@example.com" }')),console.log(d.gray(" ]")),process.exit(1)),console.log(d.gray("Seed files found:"));for(let p of i)console.log(d.gray(` - ${$.relative(process.cwd(),p)}`));if(console.log(""),o.truncate&&(console.log(d.yellow("\u26A0\uFE0F Tables will be truncated before seeding")),console.log("")),o.dryRun){console.log(d.yellow("Dry run mode - no data will be inserted.")),console.log("");for(let p of i){e.start(`Loading ${$.basename(p)}...`);try{let g=await ye(p);e.stop();for(let l of g)o.table&&l.table!==o.table||(console.log(d.cyan(`Table: ${l.table}`)),console.log(d.gray(` Records: ${l.data.length}`)),l.data.length>0&&console.log(d.gray(` Sample: ${JSON.stringify(l.data[0],null,2).slice(0,100)}...`)),console.log(""));}catch(g){e.fail(`Failed to load ${$.basename(p)}`),g instanceof Error&&console.log(d.red(` Error: ${g.message}`));}}return}let s=[];for(let p of i){e.start(`Processing ${$.basename(p)}...`);try{let g=await ye(p);e.stop();for(let l of g)if(!(o.table&&l.table!==o.table)){if(l.data.length===0){console.log(d.gray(` Skipping ${l.table} (no records)`));continue}e.start(`Seeding ${l.table} (${l.data.length} records)...`);try{let
|
|
19
|
+
Example seed file (seeds/users.json):`)),console.log(d.gray(" [")),console.log(d.gray(' { "name": "John Doe", "email": "john@example.com" },')),console.log(d.gray(' { "name": "Jane Doe", "email": "jane@example.com" }')),console.log(d.gray(" ]")),process.exit(1)),console.log(d.gray("Seed files found:"));for(let p of i)console.log(d.gray(` - ${$.relative(process.cwd(),p)}`));if(console.log(""),o.truncate&&(console.log(d.yellow("\u26A0\uFE0F Tables will be truncated before seeding")),console.log("")),o.dryRun){console.log(d.yellow("Dry run mode - no data will be inserted.")),console.log("");for(let p of i){e.start(`Loading ${$.basename(p)}...`);try{let g=await ye(p);e.stop();for(let l of g)o.table&&l.table!==o.table||(console.log(d.cyan(`Table: ${l.table}`)),console.log(d.gray(` Records: ${l.data.length}`)),l.data.length>0&&console.log(d.gray(` Sample: ${JSON.stringify(l.data[0],null,2).slice(0,100)}...`)),console.log(""));}catch(g){e.fail(`Failed to load ${$.basename(p)}`),g instanceof Error&&console.log(d.red(` Error: ${g.message}`));}}return}let s=[];for(let p of i){e.start(`Processing ${$.basename(p)}...`);try{let g=await ye(p);e.stop();for(let l of g)if(!(o.table&&l.table!==o.table)){if(l.data.length===0){console.log(d.gray(` Skipping ${l.table} (no records)`));continue}e.start(`Seeding ${l.table} (${l.data.length} records)...`);try{let u=await to(t.token,r,l.table,l.data,{truncate:o.truncate});e.succeed(`Seeded ${l.table}: ${u.inserted} records`),s.push({table:l.table,inserted:u.inserted});}catch(u){let y=u instanceof Error?u.message:"Unknown error";e.fail(`Failed to seed ${l.table}`),s.push({table:l.table,inserted:0,error:y});}}}catch(g){e.fail(`Failed to load ${$.basename(p)}`),g instanceof Error&&console.log(d.red(` Error: ${g.message}`));}}console.log("");let c=s.reduce((p,g)=>p+g.inserted,0),f=s.filter(p=>p.error).length;if(f===0)console.log(d.green(`\u2713 Successfully seeded ${c} records across ${s.length} table(s)`));else {console.log(d.yellow(`Seeded ${c} records with ${f} error(s)`)),console.log(""),console.log(d.red("Errors:"));for(let p of s.filter(g=>g.error))console.log(d.red(` - ${p.table}: ${p.error}`));}console.log("");}async function je(o){let e=K(),t=b();(!t||!t.token)&&(console.log(d.red("Not logged in")),console.log(d.gray("Run `vaif login` first to authenticate")),process.exit(1));let n=o.config||"vaif.config.json",a$1=null;try{a$1=await a(n);}catch{}let r=o.projectId||a$1?.projectId||process.env.VAIF_PROJECT_ID||t.projectId;r||(console.log(d.red("No project ID specified")),console.log(d.yellow("Set projectId in vaif.config.json or use --project-id flag.")),process.exit(1));let i=$.resolve(o.dir||"./drizzle");if(console.log(""),console.log(d.bold("VAIF Database Push")),console.log(""),!F.existsSync(i)){let g=$.resolve("./migrations");F.existsSync(g)?console.log(d.gray(`Using migrations from: ${g}`)):(console.log(d.red(`Migrations directory not found: ${i}`)),console.log(d.gray(`
|
|
20
20
|
Expected one of:`)),console.log(d.gray(" - ./drizzle/")),console.log(d.gray(" - ./migrations/")),console.log(d.gray(`
|
|
21
|
-
Or specify with: vaif db push --dir <path>`)),process.exit(1));}let s=[],c=F.readdirSync(i,{withFileTypes:true});for(let g of c)if(g.isFile()&&g.name.endsWith(".sql"))s.push($.join(i,g.name));else if(g.isDirectory()){let l=F.readdirSync($.join(i,g.name),{withFileTypes:true});for(let
|
|
22
|
-
Error: ${s.message}`)),process.exit(1);}}async function Ie(o){let e=
|
|
23
|
-
Error: ${i.message}`)),process.exit(1);}}var Se=process.env.VAIF_API_URL||"https://api.vaif.studio";function be(o,e,t){return o.projectId||e?.projectId||process.env.VAIF_PROJECT_ID||t.projectId||null}async function Ae(o){let e=
|
|
24
|
-
Error: ${s.message}`)),process.exit(1);}}async function ke(o){let e=
|
|
25
|
-
Generate one with: vaif keys generate`));return}let f=Math.max(8,...c.map(g=>(g.name||"").length)),p=` ${"Name".padEnd(f)} ${"Key".padEnd(24)} Created`;console.log(d.gray(p)),console.log(d.gray(" "+"-".repeat(p.length-2)));for(let g of c){let l=(g.name||"unnamed").padEnd(f),
|
|
26
|
-
Error: ${i.message}`)),process.exit(1);}}var O=process.env.VAIF_API_URL||"https://api.vaif.studio";function io(o,e,t){return o.projectId||e?.projectId||process.env.VAIF_PROJECT_ID||t.projectId||null}function q(){let o=b();return (!o||!o.token)&&(console.log(d.red("Not logged in")),console.log(d.gray("Run `vaif login` first to authenticate")),process.exit(1)),o}async function M(o){try{return await a(o||"vaif.config.json")}catch{return null}}function W(o,e,t){let n=io(o,e,t);return n||(console.log(d.red("No project ID specified")),console.log(d.yellow("Set projectId in vaif.config.json or use --project-id flag.")),process.exit(1)),n}async function Pe(o,e,t){let n=
|
|
27
|
-
Error: ${c.message}`)),process.exit(1);}}async function Ce(o){let e=
|
|
21
|
+
Or specify with: vaif db push --dir <path>`)),process.exit(1));}let s=[],c=F.readdirSync(i,{withFileTypes:true});for(let g of c)if(g.isFile()&&g.name.endsWith(".sql"))s.push($.join(i,g.name));else if(g.isDirectory()){let l=F.readdirSync($.join(i,g.name),{withFileTypes:true});for(let u of l)u.isFile()&&u.name.endsWith(".sql")&&s.push($.join(i,g.name,u.name));}s.sort(),s.length===0&&(console.log(d.yellow("No SQL migration files found")),process.exit(1)),console.log(d.gray(`Found ${s.length} migration(s):`));for(let g of s)console.log(d.gray(` - ${$.relative(process.cwd(),g)}`));if(console.log(""),o.dryRun){console.log(d.yellow("Dry run mode - no migrations will be applied.")),console.log("");for(let g of s){let l=F.readFileSync(g,"utf-8");console.log(d.cyan(`--- ${$.basename(g)} ---`)),console.log(d.gray(l.slice(0,500))),l.length>500&&console.log(d.gray("...")),console.log("");}return}let f=0,p=0;for(let g of s){let l=F.readFileSync(g,"utf-8"),u=$.relative(process.cwd(),g);e.start(`Applying ${u}...`);try{let y=await fetch(`${B}/schema-engine/query/${r}`,{method:"POST",headers:{Authorization:`Bearer ${t.token}`,"Content-Type":"application/json"},body:JSON.stringify({sql:l})});if(!y.ok){let D=await y.text();throw new Error(D)}e.succeed(`Applied ${u}`),f++;}catch(y){let D=y instanceof Error?y.message:"Unknown error";e.fail(`Failed ${u}: ${D}`),p++;}}console.log(""),console.log(p===0?d.green(`Successfully applied ${f} migration(s)`):d.yellow(`Applied ${f}, failed ${p} migration(s)`)),console.log("");}async function ve(o){let e=K(),t=b();(!t||!t.token)&&(console.log(d.red("Not logged in")),console.log(d.gray("Run `vaif login` first to authenticate")),process.exit(1));let n=o.config||"vaif.config.json",a$1=null;try{a$1=await a(n);}catch{}let r=o.projectId||a$1?.projectId||process.env.VAIF_PROJECT_ID||t.projectId;r||(console.log(d.red("No project ID specified")),console.log(d.yellow("Set projectId in vaif.config.json or use --project-id flag.")),process.exit(1));let i=$.resolve(o.output||"vaif.schema.json");console.log(""),console.log(d.bold("VAIF Database Pull")),console.log(""),e.start("Pulling schema from remote...");try{let s=await fetch(`${B}/schema-engine/introspect/${r}`,{headers:{Authorization:`Bearer ${t.token}`}});if(!s.ok){let p=await s.text();throw new Error(`Failed to pull schema: ${p}`)}let c=await s.json();F.writeFileSync(i,JSON.stringify(c,null,2),"utf-8"),e.succeed(`Schema written to ${$.relative(process.cwd(),i)}`);let f=c.tables?.length??Object.keys(c).length;console.log(d.gray(` ${f} table(s) pulled`)),console.log("");}catch(s){e.fail("Failed to pull schema"),s instanceof Error&&console.log(d.red(`
|
|
22
|
+
Error: ${s.message}`)),process.exit(1);}}async function Ie(o){let e=K(),t=b();(!t||!t.token)&&(console.log(d.red("Not logged in")),console.log(d.gray("Run `vaif login` first to authenticate")),process.exit(1));let n=o.config||"vaif.config.json",a$1=null;try{a$1=await a(n);}catch{}let r=o.projectId||a$1?.projectId||process.env.VAIF_PROJECT_ID||t.projectId;r||(console.log(d.red("No project ID specified")),process.exit(1)),console.log(""),console.log(d.red.bold("\u26A0\uFE0F DATABASE RESET")),console.log(""),console.log(d.red("This will:")),console.log(d.red(" - Drop all tables")),console.log(d.red(" - Delete all data")),console.log(d.red(" - Reset migrations")),console.log(""),console.log(d.red.bold("This action cannot be undone!")),console.log(""),o.force||(console.log(d.yellow("Use --force to confirm this action.")),process.exit(1)),e.start("Resetting database...");try{await no(t.token,r),e.succeed("Database reset complete"),console.log(""),console.log(d.gray("Your database is now empty.")),console.log(d.gray("Run `vaif push` to apply your schema, then `vaif db seed` to seed data.")),console.log("");}catch(i){e.fail("Failed to reset database"),i instanceof Error&&console.log(d.red(`
|
|
23
|
+
Error: ${i.message}`)),process.exit(1);}}var Se=process.env.VAIF_API_URL||"https://api.vaif.studio";function be(o,e,t){return o.projectId||e?.projectId||process.env.VAIF_PROJECT_ID||t.projectId||null}async function Ae(o){let e=K(),t=b();(!t||!t.token)&&(console.log(d.red("Not logged in")),console.log(d.gray("Run `vaif login` first to authenticate")),process.exit(1));let n=o.config||"vaif.config.json",a$1=null;try{a$1=await a(n);}catch{}let r=be(o,a$1,t);r||(console.log(d.red("No project ID specified")),console.log(d.yellow("Set projectId in vaif.config.json or use --project-id flag.")),process.exit(1));let i=o.name||`cli-key-${Date.now()}`;console.log(""),console.log(d.bold("VAIF Generate API Key")),console.log(""),e.start("Generating API key...");try{let s=await fetch(`${Se}/projects/${r}/api-keys`,{method:"POST",headers:{Authorization:`Bearer ${t.token}`,"Content-Type":"application/json"},body:JSON.stringify({name:i})});if(!s.ok){let f=await s.text();throw new Error(`Failed to generate key: ${f}`)}let c=await s.json();e.succeed("API key generated"),console.log(""),console.log(d.green(` Name: ${c.name}`)),console.log(d.green(` Key: ${c.key}`)),console.log(""),console.log(d.yellow.bold(" Save this key now - it will not be shown again!")),console.log("");}catch(s){e.fail("Failed to generate API key"),s instanceof Error&&console.log(d.red(`
|
|
24
|
+
Error: ${s.message}`)),process.exit(1);}}async function ke(o){let e=K(),t=b();(!t||!t.token)&&(console.log(d.red("Not logged in")),console.log(d.gray("Run `vaif login` first to authenticate")),process.exit(1));let n=o.config||"vaif.config.json",a$1=null;try{a$1=await a(n);}catch{}let r=be(o,a$1,t);r||(console.log(d.red("No project ID specified")),console.log(d.yellow("Set projectId in vaif.config.json or use --project-id flag.")),process.exit(1)),console.log(""),console.log(d.bold("VAIF API Keys")),console.log(""),e.start("Fetching API keys...");try{let i=await fetch(`${Se}/projects/${r}/api-keys`,{headers:{Authorization:`Bearer ${t.token}`}});if(!i.ok){let g=await i.text();throw new Error(`Failed to list keys: ${g}`)}let s=await i.json(),c=s.keys||s;if(e.stop(),!Array.isArray(c)||c.length===0){console.log(d.yellow("No API keys found")),console.log(d.gray(`
|
|
25
|
+
Generate one with: vaif keys generate`));return}let f=Math.max(8,...c.map(g=>(g.name||"").length)),p=` ${"Name".padEnd(f)} ${"Key".padEnd(24)} Created`;console.log(d.gray(p)),console.log(d.gray(" "+"-".repeat(p.length-2)));for(let g of c){let l=(g.name||"unnamed").padEnd(f),u=g.maskedKey||g.prefix||`${(g.key||"").slice(0,12)}...`,y=g.createdAt?new Date(g.createdAt).toLocaleDateString():"N/A";console.log(` ${l} ${u.padEnd(24)} ${y}`);}console.log(""),console.log(d.gray(` ${c.length} key(s) total`)),console.log("");}catch(i){e.fail("Failed to list API keys"),i instanceof Error&&console.log(d.red(`
|
|
26
|
+
Error: ${i.message}`)),process.exit(1);}}var O=process.env.VAIF_API_URL||"https://api.vaif.studio";function io(o,e,t){return o.projectId||e?.projectId||process.env.VAIF_PROJECT_ID||t.projectId||null}function q(){let o=b();return (!o||!o.token)&&(console.log(d.red("Not logged in")),console.log(d.gray("Run `vaif login` first to authenticate")),process.exit(1)),o}async function M(o){try{return await a(o||"vaif.config.json")}catch{return null}}function W(o,e,t){let n=io(o,e,t);return n||(console.log(d.red("No project ID specified")),console.log(d.yellow("Set projectId in vaif.config.json or use --project-id flag.")),process.exit(1)),n}async function Pe(o,e,t){let n=K(),a=q(),r=await M(t.config),i=W(t,r,a),s=e;if(t.fromFile)try{s=F.readFileSync(t.fromFile,"utf-8");}catch(c){console.log(d.red(`Failed to read file: ${t.fromFile}`)),c instanceof Error&&console.log(d.gray(c.message)),process.exit(1);}s||(console.log(d.red("No value provided")),console.log(d.gray("Provide a value as argument or use --from-file <path>")),process.exit(1)),console.log(""),console.log(d.bold("VAIF Set Secret")),console.log(""),n.start("Checking for existing secret...");try{let c=new URL(`${O}/functions/secrets/project/${i}`);t.envId&&c.searchParams.set("envId",t.envId);let f=await fetch(c.toString(),{headers:{Authorization:`Bearer ${a.token}`}});if(!f.ok)throw new Error(`Failed to check existing secrets: ${await f.text()}`);let g=(await f.json()).find(l=>l.key===o);if(g){n.text=`Updating secret "${o}"...`;let l=await fetch(`${O}/functions/secrets/${g.id}`,{method:"PUT",headers:{Authorization:`Bearer ${a.token}`,"Content-Type":"application/json"},body:JSON.stringify({value:s})});if(!l.ok)throw new Error(`Failed to update secret: ${await l.text()}`);n.succeed(`Updated secret "${o}"`);}else {n.text=`Creating secret "${o}"...`;let l=await fetch(`${O}/functions/secrets`,{method:"POST",headers:{Authorization:`Bearer ${a.token}`,"Content-Type":"application/json"},body:JSON.stringify({projectId:i,envId:t.envId,key:o,value:s})});if(!l.ok)throw new Error(`Failed to create secret: ${await l.text()}`);n.succeed(`Created secret "${o}"`);}console.log("");}catch(c){n.fail("Failed to set secret"),c instanceof Error&&console.log(d.red(`
|
|
27
|
+
Error: ${c.message}`)),process.exit(1);}}async function Ce(o){let e=K(),t=q(),n=await M(o.config),a=W(o,n,t);console.log(""),console.log(d.bold("VAIF Secrets")),console.log(""),e.start("Fetching secrets...");try{let r=new URL(`${O}/functions/secrets/project/${a}`);o.envId&&r.searchParams.set("envId",o.envId);let i=await fetch(r.toString(),{headers:{Authorization:`Bearer ${t.token}`}});if(!i.ok)throw new Error(`Failed to list secrets: ${await i.text()}`);let s=await i.json();if(e.stop(),s.length===0){console.log(d.yellow("No secrets found")),console.log(d.gray(`
|
|
28
28
|
Create one with: vaif secrets set <name> <value>`));return}let c=Math.max(8,...s.map(p=>p.key.length)),f=` ${"Name".padEnd(c)} Created`;console.log(d.gray(f)),console.log(d.gray(" "+"-".repeat(f.length-2)));for(let p of s){let g=p.key.padEnd(c),l=p.createdAt?new Date(p.createdAt).toLocaleDateString():"N/A";console.log(` ${g} ${l}`);}console.log(""),console.log(d.gray(` ${s.length} secret(s) total`)),console.log(d.gray(" Values are hidden. Use `vaif secrets get <name>` to reveal.")),console.log("");}catch(r){e.fail("Failed to list secrets"),r instanceof Error&&console.log(d.red(`
|
|
29
|
-
Error: ${r.message}`)),process.exit(1);}}async function Ee(o,e){let t=
|
|
30
|
-
Error: ${i.message}`)),process.exit(1);}}async function xe(o,e){let t=
|
|
31
|
-
Error: ${i.message}`)),process.exit(1);}}var Fe=process.env.VAIF_API_URL||"https://api.vaif.studio";function ao(o){try{let e=new URL(o);return e.password&&(e.password="****"),e.toString()}catch{return o.replace(/:[^@/]+@/,":****@")}}async function De(o){let e=
|
|
32
|
-
Error: ${i.message}`)),process.exit(1);}}var lo=process.env.VAIF_API_URL||"https://api.vaif.studio";async function Re(o){let e=
|
|
33
|
-
Error: ${i.message}`)),process.exit(1);}}var _=process.env.VAIF_API_URL||"https://api.vaif.studio";function fo(o){let e=We.createInterface({input:process.stdin,output:process.stdout});return new Promise(t=>{e.question(o,n=>{e.close(),t(n.trim());});})}function po(o,e,t){return o.projectId||e?.projectId||process.env.VAIF_PROJECT_ID||t.projectId||null}async function uo(o){let e=
|
|
29
|
+
Error: ${r.message}`)),process.exit(1);}}async function Ee(o,e){let t=K(),n=q(),a=await M(e.config),r=W(e,a,n);console.log(""),t.start("Fetching secret...");try{let i=new URL(`${O}/functions/secrets/project/${r}`);e.envId&&i.searchParams.set("envId",e.envId);let s=await fetch(i.toString(),{headers:{Authorization:`Bearer ${n.token}`}});if(!s.ok)throw new Error(`Failed to fetch secrets: ${await s.text()}`);let f=(await s.json()).find(l=>l.key===o);f||(t.fail(`Secret "${o}" not found`),process.exit(1));let p=await fetch(`${O}/functions/secrets/${f.id}/value`,{headers:{Authorization:`Bearer ${n.token}`}});if(!p.ok)throw new Error(`Failed to get secret value: ${await p.text()}`);let g=await p.json();t.stop(),console.log(g.value);}catch(i){t.fail("Failed to get secret"),i instanceof Error&&console.log(d.red(`
|
|
30
|
+
Error: ${i.message}`)),process.exit(1);}}async function xe(o,e){let t=K(),n=q(),a=await M(e.config),r=W(e,a,n);console.log(""),console.log(d.bold("VAIF Delete Secret")),console.log(""),t.start("Finding secret...");try{let i=new URL(`${O}/functions/secrets/project/${r}`);e.envId&&i.searchParams.set("envId",e.envId);let s=await fetch(i.toString(),{headers:{Authorization:`Bearer ${n.token}`}});if(!s.ok)throw new Error(`Failed to fetch secrets: ${await s.text()}`);let f=(await s.json()).find(g=>g.key===o);f||(t.fail(`Secret "${o}" not found`),process.exit(1)),t.text=`Deleting secret "${o}"...`;let p=await fetch(`${O}/functions/secrets/${f.id}`,{method:"DELETE",headers:{Authorization:`Bearer ${n.token}`}});if(!p.ok)throw new Error(`Failed to delete secret: ${await p.text()}`);t.succeed(`Deleted secret "${o}"`),console.log("");}catch(i){t.fail("Failed to delete secret"),i instanceof Error&&console.log(d.red(`
|
|
31
|
+
Error: ${i.message}`)),process.exit(1);}}var Fe=process.env.VAIF_API_URL||"https://api.vaif.studio";function ao(o){try{let e=new URL(o);return e.password&&(e.password="****"),e.toString()}catch{return o.replace(/:[^@/]+@/,":****@")}}async function De(o){let e=K(),t=b();(!t||!t.token)&&(console.log(d.red("Not logged in")),console.log(d.gray("Run `vaif login` first to authenticate")),process.exit(1));let n=o.config||"vaif.config.json",a$1=null;try{a$1=await a(n);}catch{}let r=o.projectId||a$1?.projectId||process.env.VAIF_PROJECT_ID||t.projectId;r||(console.log(d.red("No project ID specified")),console.log(d.yellow("Set projectId in vaif.config.json or use --project-id flag.")),process.exit(1)),e.start("Fetching project info...");try{let i=await fetch(`${Fe}/projects/${r}`,{headers:{Authorization:`Bearer ${t.token}`}});if(!i.ok){let p=await i.text();throw new Error(`Failed to fetch project: ${p}`)}let s=await i.json();e.stop(),console.log(""),console.log(d.bold("VAIF Project Info")),console.log("");let c=16,f=(p,g)=>{console.log(` ${d.gray(p.padEnd(c))} ${g}`);};f("Name:",d.white(s.name||"N/A")),f("Project ID:",d.white(r)),f("Region:",d.white(s.region||"us-east-1")),f("Plan:",d.white(s.plan||s.tier||"free")),f("Created:",d.white(s.createdAt?new Date(s.createdAt).toLocaleDateString():"N/A")),console.log(""),f("API URL:",d.cyan(s.apiUrl||`${Fe}/v1`)),f("WS URL:",d.cyan(s.wsUrl||s.realtimeUrl||"N/A")),f("DB URL:",d.cyan(s.databaseUrl?ao(s.databaseUrl):"N/A")),f("Storage URL:",d.cyan(s.storageUrl||"N/A")),console.log("");}catch(i){e.fail("Failed to fetch project info"),i instanceof Error&&console.log(d.red(`
|
|
32
|
+
Error: ${i.message}`)),process.exit(1);}}var lo=process.env.VAIF_API_URL||"https://api.vaif.studio";async function Re(o){let e=K(),t=b();(!t||!t.token)&&(console.log(d.red("Not logged in")),console.log(d.gray("Run `vaif login` first to authenticate")),process.exit(1));let n=o.config||"vaif.config.json",a$1=null;try{a$1=await a(n);}catch{}let r=o.projectId||a$1?.projectId||process.env.VAIF_PROJECT_ID||t.projectId;r||(console.log(d.red("No project ID specified")),console.log(d.yellow("Set projectId in vaif.config.json or use --project-id flag.")),process.exit(1)),e.start("Fetching project status...");try{let i=await fetch(`${lo}/projects/${r}?include=tables,functions,storage,connections`,{headers:{Authorization:`Bearer ${t.token}`}});if(!i.ok){let y=await i.text();throw new Error(`Failed to fetch project status: ${y}`)}let s=await i.json();e.stop(),console.log(""),console.log(d.bold("VAIF Project Status")),console.log("");let c=22,f=(y,D)=>{console.log(` ${d.gray(y.padEnd(c))} ${D}`);};f("Project:",d.white(s.name||r)),f("Plan:",d.white(s.plan||s.tier||"free")),console.log(""),console.log(d.gray(" --- Resources ---")),console.log("");let p=s.tableCount??s.tables?.length??"N/A",g=s.functionCount??s.functions?.length??"N/A",l=s.bucketCount??s.storage?.buckets?.length??"N/A",u=s.activeConnections??s.connections??"N/A";f("Tables:",d.white(String(p))),f("Functions:",d.white(String(g))),f("Storage Buckets:",d.white(String(l))),f("Active Connections:",d.white(String(u))),s.usage&&(console.log(""),console.log(d.gray(" --- Usage ---")),console.log(""),s.usage.dbSize&&f("Database Size:",d.white(s.usage.dbSize)),s.usage.storageSize&&f("Storage Size:",d.white(s.usage.storageSize)),s.usage.bandwidth&&f("Bandwidth:",d.white(s.usage.bandwidth)),s.usage.functionInvocations!=null&&f("Function Invocations:",d.white(String(s.usage.functionInvocations)))),console.log("");}catch(i){e.fail("Failed to fetch project status"),i instanceof Error&&console.log(d.red(`
|
|
33
|
+
Error: ${i.message}`)),process.exit(1);}}var _=process.env.VAIF_API_URL||"https://api.vaif.studio";function fo(o){let e=We.createInterface({input:process.stdin,output:process.stdout});return new Promise(t=>{e.question(o,n=>{e.close(),t(n.trim());});})}function po(o,e,t){return o.projectId||e?.projectId||process.env.VAIF_PROJECT_ID||t.projectId||null}async function uo(o){let e=K("Fetching your projects...").start();try{let t=await fetch(`${_}/projects`,{headers:{Authorization:`Bearer ${o}`}});if(!t.ok)return e.fail("Could not fetch projects"),null;let n=await t.json();if(!n||n.length===0)return e.fail("No projects found. Create a project at https://vaif.studio first."),null;if(n.length===1)return e.succeed(`Found project: ${d.cyan(n[0].name)} (${n[0].id})`),n[0].id;e.succeed(`Found ${n.length} projects
|
|
34
34
|
`);for(let i=0;i<n.length;i++)console.log(d.gray(` ${i+1}.`)+` ${d.white(n[i].name)} ${d.gray(`(${n[i].id})`)}`);console.log("");let a=await fo(d.cyan(` Select a project [1-${n.length}]: `)),r=parseInt(a,10)-1;return isNaN(r)||r<0||r>=n.length?(console.log(d.red(`
|
|
35
35
|
Invalid selection.`)),null):n[r].id}catch{return e.fail("Could not fetch projects"),null}}function ho(o){if(!o||o.length===0)return "*No tables found. Create tables in the VAIF Studio dashboard.*";let e="";for(let t of o){e+=`### \`${t.name}\`
|
|
36
36
|
|
|
@@ -441,7 +441,7 @@ All authenticated requests require:
|
|
|
441
441
|
- \`Authorization: Bearer <jwt_token>\` \u2014 for user-scoped requests
|
|
442
442
|
- \`x-api-key: <api_key>\` \u2014 for server-side / service-role requests
|
|
443
443
|
- \`x-project-id: ${e}\` \u2014 identifies the project
|
|
444
|
-
`}async function Ne(o){let e=
|
|
444
|
+
`}async function Ne(o){let e=K(),t=b();(!t||!t.token)&&(console.log(d.red("Not logged in")),console.log(d.gray("Run `vaif login` first to authenticate")),process.exit(1));let n=o.config||"vaif.config.json",a$1=null;try{a$1=await a(n);}catch{}let r=po(o,a$1,t);r||(console.log(d.yellow(`No project ID specified \u2014 fetching your projects...
|
|
445
445
|
`)),r=await uo(t.token),r||(console.log(d.gray(`
|
|
446
|
-
Tip: pass --project-id <id> or set projectId in vaif.config.json`)),process.exit(1)));let i=$.resolve(o.outputDir||".");console.log(""),console.log(d.bold("VAIF Claude Code Setup")),console.log(d.gray(` Project: ${r}`)),console.log(""),e.start("Fetching database schema...");let s={tables:[]};try{let g=await fetch(`${_}/schema-engine/introspect/${r}`,{headers:{Authorization:`Bearer ${t.token}`}});g.ok?(s=await g.json(),e.succeed(`Fetched schema (${s.tables?.length||0} tables)`)):e.warn("Could not fetch schema \u2014 continuing without it");}catch{e.warn("Could not fetch schema \u2014 continuing without it");}e.start("Fetching project info...");let c=r,f=_;try{let g=await fetch(`${_}/projects/${r}`,{headers:{Authorization:`Bearer ${t.token}`}});if(g.ok){let l=await g.json();c=
|
|
447
|
-
`,"utf-8"),e.succeed(`Written ${d.cyan(".mcp.json")}`);}if(!o.skipClaudeMd){e.start("Writing CLAUDE.md...");let g=wo({projectId:r,apiKey:p,apiUrl:f,projectName:c,schema:s}),l=$.join(i,"CLAUDE.md");F.writeFileSync(l,g,"utf-8"),e.succeed(`Written ${d.cyan("CLAUDE.md")}`);}console.log(""),console.log(d.green.bold(" Claude Code integration configured!")),console.log(""),o.skipMcp||console.log(d.gray(" MCP Server: ")+d.white(".mcp.json")),o.skipClaudeMd||console.log(d.gray(" Context: ")+d.white("CLAUDE.md")),console.log(""),console.log(d.bold(" Next steps:")),console.log(d.gray(" 1. Open this project in Claude Code")),console.log(d.gray(" 2. The MCP server auto-connects to your VAIF project")),console.log(d.gray(" 3. Ask Claude to query, modify, or build against your schema")),console.log("");}var _e="1.9.1",X=d.hex("#00f0ff"),Z=d.hex("#7b61ff"),ee=d.hex("#ff3dff"),oe=d.hex("#00ff9d"),j=d.hex("#555570"),N=d.hex("#00f0ff");function jo(){console.log(""),console.log(X(" \u2566 \u2566")+Z("\u2554\u2550\u2557\u2566")+ee("\u2554\u2550\u2557 ")+oe("\u2554\u2550\u2557\u2566 \u2566")),console.log(X(" \u255A\u2557\u2554\u255D")+Z("\u2560\u2550\u2563\u2551")+ee("\u2560\u2563 ")+oe("\u2551 \u2551 \u2551")),console.log(X(" \u255A\u255D ")+Z("\u2569 \u2569\u2569")+ee("\u255A ")+oe("\u255A\u2550\u255D\u2569\u2550\u255D\u2569")),console.log(""),console.log(j(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log(N(" VAIF Studio CLI")+j(` v${_e}`)),console.log(j(" Build full-stack apps at lightning speed")),console.log(j(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log(""),console.log(d.bold(" Quick Start")),console.log(j(" $ ")+N("vaif login")+j(" Authenticate")),console.log(j(" $ ")+N("vaif init -t react-spa")+j(" Scaffold project")),console.log(j(" $ ")+N("vaif db push")+j(" Push migrations")),console.log(j(" $ ")+N("vaif generate")+j(" Generate types")),console.log(j(" $ ")+N("vaif functions deploy")+j(" Deploy functions")),console.log(""),console.log(d.bold(" Categories")),console.log(j(" auth ")+d.white("login, logout, whoami")),console.log(j(" project ")+d.white("init, templates, info, status")),console.log(j(" schema ")+d.white("pull, push, generate")),console.log(j(" database ")+d.white("db push, db pull, db seed, db reset")),console.log(j(" deploy ")+d.white("functions deploy, functions list")),console.log(j(" security ")+d.white("keys, secrets")),console.log(j(" ai ")+d.white("claude-setup")),console.log(""),console.log(j(" Run ")+N("vaif <command> --help")+j(" for details")),console.log(j(" Docs: ")+d.underline("https://docs.vaif.studio")),console.log("");}program.name("vaif").description("VAIF CLI - Type generation and development tools").version(_e);program.command("login").description("Authenticate with VAIF (opens browser)").option("-e, --email","Login with email/password instead of browser").option("-p, --project-id <id>","Default project ID").action(c);program.command("logout").description("Log out and remove stored credentials").action(d$1);program.command("whoami").description("Show current authenticated user").action(e);program.command("init").description("Initialize VAIF configuration in your project").option("--typescript","Setup for TypeScript project").option("-f, --force","Overwrite existing config").option("-t, --template <name>","Scaffold from a template (run vaif templates for list)").option("--features <features>","Comma-separated features to include: auth,database,realtime,storage,functions").option("--add-features <features>","Add features to an existing project (requires --template)").action(h);program.command("templates").alias("tpl").description("List available project templates").action(g);program.command("info").description("Show project information (name, region, URLs)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").action(De);program.command("status").description("Show project status (tables, functions, storage, connections)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").action(Re);program.command("pull").description("Pull database schema from your VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-o, --output <path>","Output file path","vaif.schema.json").option("-s, --schema <name>","Schema name","public").option("-p, --project-id <id>","Project ID (overrides config)").action(ce);program.command("push").description("Push local schema changes to your VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-s, --schema <path>","Schema file path","vaif.schema.json").option("-p, --project-id <id>","Project ID (overrides config)").option("--dry-run","Preview changes without applying").option("-f, --force","Apply changes without confirmation").action(de);program.command("generate").alias("gen").description("Generate TypeScript types from your database schema").option("-c, --connection <url>","Database connection string").option("-o, --output <path>","Output file path","./src/types/database.ts").option("--schema <name>","Schema name","public").option("--config <path>","Config file path","vaif.config.json").option("--dry-run","Preview generated types without writing").action(f);var Le=program.command("functions").alias("fn").description("Manage serverless functions");Le.command("deploy").description("Deploy functions to your VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID").option("-n, --name <name>","Function name filter").option("-r, --runtime <runtime>","Runtime (nodejs, typescript, python)").option("--entrypoint <file>","Specific entrypoint file").option("--dry-run","Preview deployment without deploying").action(he);Le.command("list").alias("ls").description("List deployed functions").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID").action(me);var G=program.command("db").description("Database management commands");G.command("push").description("Push local Drizzle migrations to VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-d, --dir <path>","Migrations directory","./drizzle").option("--dry-run","Preview without applying").action(je);G.command("pull").description("Pull schema from VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-o, --output <path>","Output file","vaif.schema.json").action(ve);G.command("seed").description("Seed your database with test data").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-f, --file <path>","Specific seed file").option("-t, --table <name>","Seed specific table only").option("--truncate","Truncate tables before seeding").option("--dry-run","Preview seeding without inserting data").action(we);G.command("reset").description("Reset database (drop all tables and data)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-f, --force","Confirm reset (required)").action(Ie);var Ve=program.command("keys").description("Manage API keys");Ve.command("generate").description("Generate a new API key").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-n, --name <name>","Key name").action(Ae);Ve.command("list").alias("ls").description("List API keys").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").action(ke);var Y=program.command("secrets").alias("sec").description("Manage function secrets");Y.command("set <name> [value]").description("Create or update a secret").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID or name").option("--from-file <path>","Read secret value from a file").action(Pe);Y.command("list").alias("ls").description("List all secrets (names only)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID or name").action(Ce);Y.command("get <name>").description("Reveal a secret value").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID or name").action(Ee);Y.command("delete <name>").description("Delete a secret").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID or name").action(xe);program.command("claude-setup").description("Configure Claude Code integration (MCP server + CLAUDE.md)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID").option("-k, --api-key <key>","API key for MCP server").option("--skip-mcp","Skip generating .mcp.json").option("--skip-claude-md","Skip generating CLAUDE.md").option("-o, --output-dir <dir>","Output directory",".").action(Ne);process.argv.slice(2).length||(jo(),process.exit(0));program.parse(process.argv);
|
|
446
|
+
Tip: pass --project-id <id> or set projectId in vaif.config.json`)),process.exit(1)));let i=$.resolve(o.outputDir||".");console.log(""),console.log(d.bold("VAIF Claude Code Setup")),console.log(d.gray(` Project: ${r}`)),console.log(""),e.start("Fetching database schema...");let s={tables:[]};try{let g=await fetch(`${_}/schema-engine/introspect/${r}`,{headers:{Authorization:`Bearer ${t.token}`}});g.ok?(s=await g.json(),e.succeed(`Fetched schema (${s.tables?.length||0} tables)`)):e.warn("Could not fetch schema \u2014 continuing without it");}catch{e.warn("Could not fetch schema \u2014 continuing without it");}e.start("Fetching project info...");let c=r,f=_;try{let g=await fetch(`${_}/projects/${r}`,{headers:{Authorization:`Bearer ${t.token}`}});if(g.ok){let l=await g.json(),u=l.project||l;c=u.name||r,f=u.apiUrl||_,e.succeed(`Project: ${c}`);}else e.warn("Could not fetch project info \u2014 using defaults");}catch{e.warn("Could not fetch project info \u2014 using defaults");}let p=o.apiKey||a$1?.api?.apiKey||"";if(!p){e.start("Generating API key for Claude Code...");try{let g=`claude-code-${Date.now()}`,l=await fetch(`${_}/projects/${r}/api-keys`,{method:"POST",headers:{Authorization:`Bearer ${t.token}`,"Content-Type":"application/json"},body:JSON.stringify({name:g,scopes:["crud","realtime","functions","storage"]})});if(l.ok){let u=await l.json();p=u.apiKey||u.key,e.succeed(`Generated API key: ${g}`);}else e.fail("Could not auto-generate API key"),console.log(d.yellow(" Pass one with --api-key or generate via `vaif keys generate`")),process.exit(1);}catch{e.fail("Could not auto-generate API key"),console.log(d.yellow(" Pass one with --api-key or generate via `vaif keys generate`")),process.exit(1);}}if(!o.skipMcp){e.start("Writing .mcp.json...");let g={mcpServers:{"vaif-studio":{command:"npx",args:["@vaiftech/mcp"],env:{VAIF_API_KEY:p,VAIF_PROJECT_ID:r,VAIF_API_URL:f,VAIF_AUTH_TOKEN:t.token}}}},l=$.join(i,".mcp.json");F.writeFileSync(l,JSON.stringify(g,null,2)+`
|
|
447
|
+
`,"utf-8"),e.succeed(`Written ${d.cyan(".mcp.json")}`);}if(!o.skipClaudeMd){e.start("Writing CLAUDE.md...");let g=wo({projectId:r,apiKey:p,apiUrl:f,projectName:c,schema:s}),l=$.join(i,"CLAUDE.md");F.writeFileSync(l,g,"utf-8"),e.succeed(`Written ${d.cyan("CLAUDE.md")}`);}console.log(""),console.log(d.green.bold(" Claude Code integration configured!")),console.log(""),o.skipMcp||console.log(d.gray(" MCP Server: ")+d.white(".mcp.json")),o.skipClaudeMd||console.log(d.gray(" Context: ")+d.white("CLAUDE.md")),console.log(""),console.log(d.bold(" Next steps:")),console.log(d.gray(" 1. Open this project in Claude Code")),console.log(d.gray(" 2. The MCP server auto-connects to your VAIF project")),console.log(d.gray(" 3. Ask Claude to query, modify, or build against your schema")),console.log("");}var _e="1.9.3",X=d.hex("#00f0ff"),Z=d.hex("#7b61ff"),ee=d.hex("#ff3dff"),oe=d.hex("#00ff9d"),j=d.hex("#555570"),N=d.hex("#00f0ff");function jo(){console.log(""),console.log(X(" \u2566 \u2566")+Z("\u2554\u2550\u2557\u2566")+ee("\u2554\u2550\u2557 ")+oe("\u2554\u2550\u2557\u2566 \u2566")),console.log(X(" \u255A\u2557\u2554\u255D")+Z("\u2560\u2550\u2563\u2551")+ee("\u2560\u2563 ")+oe("\u2551 \u2551 \u2551")),console.log(X(" \u255A\u255D ")+Z("\u2569 \u2569\u2569")+ee("\u255A ")+oe("\u255A\u2550\u255D\u2569\u2550\u255D\u2569")),console.log(""),console.log(j(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log(N(" VAIF Studio CLI")+j(` v${_e}`)),console.log(j(" Build full-stack apps at lightning speed")),console.log(j(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log(""),console.log(d.bold(" Quick Start")),console.log(j(" $ ")+N("vaif login")+j(" Authenticate")),console.log(j(" $ ")+N("vaif init -t react-spa")+j(" Scaffold project")),console.log(j(" $ ")+N("vaif db push")+j(" Push migrations")),console.log(j(" $ ")+N("vaif generate")+j(" Generate types")),console.log(j(" $ ")+N("vaif functions deploy")+j(" Deploy functions")),console.log(""),console.log(d.bold(" Categories")),console.log(j(" auth ")+d.white("login, logout, whoami")),console.log(j(" project ")+d.white("init, templates, info, status")),console.log(j(" schema ")+d.white("pull, push, generate")),console.log(j(" database ")+d.white("db push, db pull, db seed, db reset")),console.log(j(" deploy ")+d.white("functions deploy, functions list")),console.log(j(" security ")+d.white("keys, secrets")),console.log(j(" ai ")+d.white("claude-setup")),console.log(""),console.log(j(" Run ")+N("vaif <command> --help")+j(" for details")),console.log(j(" Docs: ")+d.underline("https://docs.vaif.studio")),console.log("");}program.name("vaif").description("VAIF CLI - Type generation and development tools").version(_e);program.command("login").description("Authenticate with VAIF (opens browser)").option("-e, --email","Login with email/password instead of browser").option("-p, --project-id <id>","Default project ID").action(c);program.command("logout").description("Log out and remove stored credentials").action(d$1);program.command("whoami").description("Show current authenticated user").action(e);program.command("init").description("Initialize VAIF configuration in your project").option("--typescript","Setup for TypeScript project").option("-f, --force","Overwrite existing config").option("-t, --template <name>","Scaffold from a template (run vaif templates for list)").option("--features <features>","Comma-separated features to include: auth,database,realtime,storage,functions").option("--add-features <features>","Add features to an existing project (requires --template)").action(h);program.command("templates").alias("tpl").description("List available project templates").action(g);program.command("info").description("Show project information (name, region, URLs)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").action(De);program.command("status").description("Show project status (tables, functions, storage, connections)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").action(Re);program.command("pull").description("Pull database schema from your VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-o, --output <path>","Output file path","vaif.schema.json").option("-s, --schema <name>","Schema name","public").option("-p, --project-id <id>","Project ID (overrides config)").action(ce);program.command("push").description("Push local schema changes to your VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-s, --schema <path>","Schema file path","vaif.schema.json").option("-p, --project-id <id>","Project ID (overrides config)").option("--dry-run","Preview changes without applying").option("-f, --force","Apply changes without confirmation").action(de);program.command("generate").alias("gen").description("Generate TypeScript types from your database schema").option("-c, --connection <url>","Database connection string").option("-o, --output <path>","Output file path","./src/types/database.ts").option("--schema <name>","Schema name","public").option("--config <path>","Config file path","vaif.config.json").option("--dry-run","Preview generated types without writing").action(f);var Le=program.command("functions").alias("fn").description("Manage serverless functions");Le.command("deploy").description("Deploy functions to your VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID").option("-n, --name <name>","Function name filter").option("-r, --runtime <runtime>","Runtime (nodejs, typescript, python)").option("--entrypoint <file>","Specific entrypoint file").option("--dry-run","Preview deployment without deploying").action(he);Le.command("list").alias("ls").description("List deployed functions").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID").action(me);var G=program.command("db").description("Database management commands");G.command("push").description("Push local Drizzle migrations to VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-d, --dir <path>","Migrations directory","./drizzle").option("--dry-run","Preview without applying").action(je);G.command("pull").description("Pull schema from VAIF project").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-o, --output <path>","Output file","vaif.schema.json").action(ve);G.command("seed").description("Seed your database with test data").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-f, --file <path>","Specific seed file").option("-t, --table <name>","Seed specific table only").option("--truncate","Truncate tables before seeding").option("--dry-run","Preview seeding without inserting data").action(we);G.command("reset").description("Reset database (drop all tables and data)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-f, --force","Confirm reset (required)").action(Ie);var Ve=program.command("keys").description("Manage API keys");Ve.command("generate").description("Generate a new API key").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-n, --name <name>","Key name").action(Ae);Ve.command("list").alias("ls").description("List API keys").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").action(ke);var Y=program.command("secrets").alias("sec").description("Manage function secrets");Y.command("set <name> [value]").description("Create or update a secret").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID or name").option("--from-file <path>","Read secret value from a file").action(Pe);Y.command("list").alias("ls").description("List all secrets (names only)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID or name").action(Ce);Y.command("get <name>").description("Reveal a secret value").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID or name").action(Ee);Y.command("delete <name>").description("Delete a secret").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID (overrides config)").option("-e, --env-id <id>","Environment ID or name").action(xe);program.command("claude-setup").description("Configure Claude Code integration (MCP server + CLAUDE.md)").option("-c, --config <path>","Config file path","vaif.config.json").option("-p, --project-id <id>","Project ID").option("-k, --api-key <key>","API key for MCP server").option("--skip-mcp","Skip generating .mcp.json").option("--skip-claude-md","Skip generating CLAUDE.md").option("-o, --output-dir <dir>","Output directory",".").action(Ne);process.argv.slice(2).length||(jo(),process.exit(0));program.parse(process.argv);
|