use-vibes 0.19.28-dev-cli → 0.19.30-dev-cli

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.
Files changed (39) hide show
  1. package/esm/bin.js +2 -2
  2. package/esm/cli/exec/info.d.ts +3 -0
  3. package/esm/cli/exec/info.d.ts.map +1 -0
  4. package/esm/cli/exec/info.js +18 -0
  5. package/esm/cli/exec/skills.d.ts +3 -0
  6. package/esm/cli/exec/skills.d.ts.map +1 -0
  7. package/esm/cli/exec/skills.js +13 -0
  8. package/esm/cli/exec/system.d.ts +3 -0
  9. package/esm/cli/exec/system.d.ts.map +1 -0
  10. package/esm/cli/exec/system.js +22 -0
  11. package/esm/cli/exec/whoami.d.ts +3 -0
  12. package/esm/cli/exec/whoami.d.ts.map +1 -0
  13. package/esm/cli/exec/whoami.js +13 -0
  14. package/esm/cli/executable.d.ts +11 -0
  15. package/esm/cli/executable.d.ts.map +1 -0
  16. package/esm/cli/executable.js +1 -0
  17. package/esm/commands/cli-output.d.ts.map +1 -1
  18. package/esm/commands/cli-output.js +1 -0
  19. package/esm/commands/config.d.ts +16 -0
  20. package/esm/commands/config.d.ts.map +1 -0
  21. package/esm/commands/config.js +33 -0
  22. package/esm/commands/info.d.ts +8 -0
  23. package/esm/commands/info.d.ts.map +1 -0
  24. package/esm/commands/info.js +25 -0
  25. package/esm/commands/resolve-target.d.ts +13 -0
  26. package/esm/commands/resolve-target.d.ts.map +1 -0
  27. package/esm/commands/resolve-target.js +42 -0
  28. package/esm/commands/whoami.d.ts.map +1 -1
  29. package/esm/commands/whoami.js +2 -2
  30. package/esm/dispatcher.d.ts +4 -0
  31. package/esm/dispatcher.d.ts.map +1 -0
  32. package/esm/dispatcher.js +28 -0
  33. package/package.json +2 -3
  34. package/esm/commands/not-implemented.d.ts +0 -6
  35. package/esm/commands/not-implemented.d.ts.map +0 -1
  36. package/esm/commands/not-implemented.js +0 -6
  37. package/esm/run-cli.d.ts +0 -7
  38. package/esm/run-cli.d.ts.map +0 -1
  39. package/esm/run-cli.js +0 -107
package/esm/bin.js CHANGED
@@ -2,8 +2,8 @@
2
2
  // Node CLI entry point — compiled by dnt with #!/usr/bin/env node shebang.
3
3
  // For Deno, use main.deno.ts instead.
4
4
  import { defaultCliOutput } from "./commands/cli-output.js";
5
- import { runCli } from "./run-cli.js";
6
- await runCli(process.argv.slice(2), {
5
+ import { dispatch } from "./dispatcher.js";
6
+ await dispatch(process.argv.slice(2), {
7
7
  output: defaultCliOutput,
8
8
  setExitCode(code) {
9
9
  process.exitCode = code;
@@ -0,0 +1,3 @@
1
+ import type { CommandExecutable } from "../executable.js";
2
+ export declare const infoExec: CommandExecutable;
3
+ //# sourceMappingURL=info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../../src/cli/exec/info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,eAAO,MAAM,QAAQ,EAAE,iBAgBtB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { runInfo } from "../../commands/info.js";
2
+ export const infoExec = {
3
+ name: "info",
4
+ description: "Show project info from vibes.json",
5
+ async run(argv, runtime) {
6
+ if (argv.length > 1) {
7
+ runtime.output.stderr("info accepts at most one argument (target)\n");
8
+ return 1;
9
+ }
10
+ const target = argv[0];
11
+ const result = await runInfo({ target }, runtime.output);
12
+ if (result.isErr()) {
13
+ runtime.output.stderr(String(result.Err()) + "\n");
14
+ return 1;
15
+ }
16
+ return 0;
17
+ },
18
+ };
@@ -0,0 +1,3 @@
1
+ import type { CommandExecutable } from "../executable.js";
2
+ export declare const skillsExec: CommandExecutable;
3
+ //# sourceMappingURL=skills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../../src/cli/exec/skills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,eAAO,MAAM,UAAU,EAAE,iBAWxB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { runSkills } from "../../commands/skills.js";
2
+ export const skillsExec = {
3
+ name: "skills",
4
+ description: "List available skill libraries",
5
+ async run(_argv, runtime) {
6
+ const result = await runSkills(runtime.output);
7
+ if (result.isErr()) {
8
+ runtime.output.stderr(String(result.Err()) + "\n");
9
+ return 1;
10
+ }
11
+ return 0;
12
+ },
13
+ };
@@ -0,0 +1,3 @@
1
+ import type { CommandExecutable } from "../executable.js";
2
+ export declare const systemExec: CommandExecutable;
3
+ //# sourceMappingURL=system.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../src/cli/exec/system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAY1D,eAAO,MAAM,UAAU,EAAE,iBAYxB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { runSystem } from "../../commands/system.js";
2
+ function parseArgs(argv) {
3
+ for (let i = 0; i < argv.length; i++) {
4
+ if (argv[i] === "--skills" && i + 1 < argv.length) {
5
+ return { skillsCsv: argv[i + 1] };
6
+ }
7
+ }
8
+ return {};
9
+ }
10
+ export const systemExec = {
11
+ name: "system",
12
+ description: "Output assembled system prompt",
13
+ async run(argv, runtime) {
14
+ const args = parseArgs(argv);
15
+ const result = await runSystem(args, runtime.output);
16
+ if (result.isErr()) {
17
+ runtime.output.stderr(String(result.Err()) + "\n");
18
+ return 1;
19
+ }
20
+ return 0;
21
+ },
22
+ };
@@ -0,0 +1,3 @@
1
+ import type { CommandExecutable } from "../executable.js";
2
+ export declare const whoamiExec: CommandExecutable;
3
+ //# sourceMappingURL=whoami.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../../src/cli/exec/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,eAAO,MAAM,UAAU,EAAE,iBAWxB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { runWhoami } from "../../commands/whoami.js";
2
+ export const whoamiExec = {
3
+ name: "whoami",
4
+ description: "Print logged-in user",
5
+ async run(_argv, runtime) {
6
+ const result = await runWhoami();
7
+ if (result.isErr()) {
8
+ runtime.output.stderr(String(result.Err()) + "\n");
9
+ return 1;
10
+ }
11
+ return 0;
12
+ },
13
+ };
@@ -0,0 +1,11 @@
1
+ import type { CliOutput } from "../commands/cli-output.js";
2
+ export interface CliRuntime {
3
+ readonly output: CliOutput;
4
+ readonly setExitCode: (code: number) => void;
5
+ }
6
+ export interface CommandExecutable {
7
+ readonly name: string;
8
+ readonly description: string;
9
+ run(argv: string[], runtime: CliRuntime): Promise<number>;
10
+ }
11
+ //# sourceMappingURL=executable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executable.d.ts","sourceRoot":"","sources":["../../src/cli/executable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3D"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"cli-output.d.ts","sourceRoot":"","sources":["../../src/commands/cli-output.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,gBAAgB,EAAE,SAG9B,CAAC"}
1
+ {"version":3,"file":"cli-output.d.ts","sourceRoot":"","sources":["../../src/commands/cli-output.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAID,eAAO,MAAM,gBAAgB,EAAE,SAG9B,CAAC"}
@@ -1,3 +1,4 @@
1
+ import process from "node:process";
1
2
  export const defaultCliOutput = {
2
3
  stdout: (text) => process.stdout.write(text),
3
4
  stderr: (text) => process.stderr.write(text),
@@ -0,0 +1,16 @@
1
+ import { Result } from "@adviser/cement";
2
+ export interface VibesConfig {
3
+ readonly app: string;
4
+ readonly targets?: Record<string, {
5
+ fs?: {
6
+ id: string;
7
+ ts: string;
8
+ }[];
9
+ }>;
10
+ }
11
+ export interface FoundConfig {
12
+ readonly path: string;
13
+ readonly config: VibesConfig;
14
+ }
15
+ export declare function findVibesJson(startDir: string): Promise<Result<FoundConfig>>;
16
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,EAAE,CAAC,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,CAAC,CAAC;CAC1E;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B;AAED,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CA4BlF"}
@@ -0,0 +1,33 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { join, dirname } from "node:path";
3
+ import { Result } from "@adviser/cement";
4
+ export async function findVibesJson(startDir) {
5
+ let dir = startDir;
6
+ for (;;) {
7
+ const candidate = join(dir, "vibes.json");
8
+ try {
9
+ const raw = await readFile(candidate, "utf-8");
10
+ const parsed = JSON.parse(raw);
11
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
12
+ return Result.Err(`Invalid vibes.json at ${candidate}: expected an object`);
13
+ }
14
+ const obj = parsed;
15
+ if (typeof obj.app !== "string" || obj.app === "") {
16
+ return Result.Err(`Invalid vibes.json at ${candidate}: "app" must be a non-empty string`);
17
+ }
18
+ return Result.Ok({ path: candidate, config: obj });
19
+ }
20
+ catch (err) {
21
+ const code = err.code;
22
+ if (code === "ENOENT") {
23
+ const parent = dirname(dir);
24
+ if (parent === dir) {
25
+ return Result.Err("No vibes.json found (searched up to filesystem root)");
26
+ }
27
+ dir = parent;
28
+ continue;
29
+ }
30
+ return Result.Err(`Error reading ${candidate}: ${err}`);
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,8 @@
1
+ import { Result } from "@adviser/cement";
2
+ import type { CliOutput } from "./cli-output.js";
3
+ export interface RunInfoOptions {
4
+ readonly target?: string;
5
+ readonly startDir?: string;
6
+ }
7
+ export declare function runInfo(opts: RunInfoOptions, output: CliOutput): Promise<Result<void>>;
8
+ //# sourceMappingURL=info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../src/commands/info.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAoB5F"}
@@ -0,0 +1,25 @@
1
+ import { cwd } from "node:process";
2
+ import { Result } from "@adviser/cement";
3
+ import { findVibesJson } from "./config.js";
4
+ import { resolveTarget } from "./resolve-target.js";
5
+ export async function runInfo(opts, output) {
6
+ const startDir = opts.startDir ?? cwd();
7
+ const found = await findVibesJson(startDir);
8
+ if (found.isErr())
9
+ return Result.Err(found.Err());
10
+ const { path, config } = found.Ok();
11
+ output.stdout(`vibes.json: ${path}\n`);
12
+ output.stdout(`app: ${config.app}\n`);
13
+ // Only resolve fully-qualified targets (owner/app/group) without auth.
14
+ // Bare targets need an owner from login, which isn't implemented yet.
15
+ if (opts.target && opts.target.includes("/")) {
16
+ const resolved = resolveTarget({ app: config.app, handle: "" }, opts.target);
17
+ if (resolved.isErr())
18
+ return Result.Err(resolved.Err());
19
+ output.stdout(`target: ${resolved.Ok().full}\n`);
20
+ }
21
+ else if (opts.target) {
22
+ output.stdout(`target: (requires login to resolve "${opts.target}")\n`);
23
+ }
24
+ return Result.Ok(undefined);
25
+ }
@@ -0,0 +1,13 @@
1
+ import { Result } from "@adviser/cement";
2
+ export interface ResolvedTarget {
3
+ readonly handle: string;
4
+ readonly app: string;
5
+ readonly group: string;
6
+ readonly full: string;
7
+ }
8
+ export interface ResolveTargetContext {
9
+ readonly app: string;
10
+ readonly handle: string;
11
+ }
12
+ export declare function resolveTarget(ctx: ResolveTargetContext, input?: string): Result<ResolvedTarget>;
13
+ //# sourceMappingURL=resolve-target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-target.d.ts","sourceRoot":"","sources":["../../src/commands/resolve-target.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,CAgD/F"}
@@ -0,0 +1,42 @@
1
+ import { Result } from "@adviser/cement";
2
+ export function resolveTarget(ctx, input) {
3
+ const { app, handle } = ctx;
4
+ if (input === undefined) {
5
+ return Result.Ok({ handle, app, group: "default", full: `${handle}/${app}/default` });
6
+ }
7
+ if (input === "") {
8
+ return Result.Err("Target must not be empty");
9
+ }
10
+ if (input.startsWith("/") || input.endsWith("/")) {
11
+ return Result.Err(`Invalid target "${input}": must not start or end with /`);
12
+ }
13
+ const slashes = input.split("/").length - 1;
14
+ if (slashes === 0) {
15
+ return Result.Ok({ handle, app, group: input, full: `${handle}/${app}/${input}` });
16
+ }
17
+ if (slashes === 1) {
18
+ const [targetApp, targetGroup] = input.split("/");
19
+ if (!targetApp || !targetGroup) {
20
+ return Result.Err(`Invalid target "${input}": app and group must both be non-empty`);
21
+ }
22
+ return Result.Ok({
23
+ handle,
24
+ app: targetApp,
25
+ group: targetGroup,
26
+ full: `${handle}/${targetApp}/${targetGroup}`,
27
+ });
28
+ }
29
+ if (slashes === 2) {
30
+ const [targetHandle, targetApp, targetGroup] = input.split("/");
31
+ if (!targetHandle || !targetApp || !targetGroup) {
32
+ return Result.Err(`Invalid target "${input}": handle, app, and group must all be non-empty`);
33
+ }
34
+ return Result.Ok({
35
+ handle: targetHandle,
36
+ app: targetApp,
37
+ group: targetGroup,
38
+ full: input,
39
+ });
40
+ }
41
+ return Result.Err(`Invalid target "${input}": expected "group", "app/group", or "handle/app/group"`);
42
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../src/commands/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAEvD"}
1
+ {"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../src/commands/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,wBAAgB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAEjD"}
@@ -1,4 +1,4 @@
1
1
  import { Result } from "@adviser/cement";
2
- export async function runWhoami() {
3
- return Result.Err("Not logged in. Run: use-vibes login");
2
+ export function runWhoami() {
3
+ return Promise.resolve(Result.Err("Not logged in. Run: use-vibes login"));
4
4
  }
@@ -0,0 +1,4 @@
1
+ import type { CliRuntime } from "./cli/executable.js";
2
+ export type { CliRuntime } from "./cli/executable.js";
3
+ export declare function dispatch(cliArgs: readonly string[], runtime: CliRuntime): Promise<void>;
4
+ //# sourceMappingURL=dispatcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../src/dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMzE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAatD,wBAAsB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB7F"}
@@ -0,0 +1,28 @@
1
+ import { whoamiExec } from "./cli/exec/whoami.js";
2
+ import { skillsExec } from "./cli/exec/skills.js";
3
+ import { systemExec } from "./cli/exec/system.js";
4
+ import { infoExec } from "./cli/exec/info.js";
5
+ const commands = [whoamiExec, skillsExec, systemExec, infoExec];
6
+ function printHelp(output) {
7
+ output.stdout("use-vibes — Build and deploy React + Fireproof apps\n\n");
8
+ output.stdout("Commands:\n");
9
+ for (const cmd of commands) {
10
+ output.stdout(` ${cmd.name.padEnd(18)}${cmd.description}\n`);
11
+ }
12
+ output.stdout("\nRun: use-vibes <command> --help\n");
13
+ }
14
+ export async function dispatch(cliArgs, runtime) {
15
+ if (cliArgs.length === 0 || cliArgs[0] === "help" || cliArgs[0] === "-h" || cliArgs[0] === "--help") {
16
+ printHelp(runtime.output);
17
+ return;
18
+ }
19
+ const token = cliArgs[0];
20
+ const exec = commands.find((c) => c.name === token);
21
+ if (!exec) {
22
+ runtime.output.stderr(`Unknown command: ${token}\n`);
23
+ runtime.setExitCode(1);
24
+ return;
25
+ }
26
+ const code = await exec.run([...cliArgs.slice(1)], runtime);
27
+ runtime.setExitCode(code);
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "use-vibes",
3
- "version": "0.19.28-dev-cli",
3
+ "version": "0.19.30-dev-cli",
4
4
  "description": "Transform any DOM element into an AI-powered micro-app",
5
5
  "keywords": [
6
6
  "ai",
@@ -30,8 +30,7 @@
30
30
  "dependencies": {
31
31
  "@adviser/cement": "^0.5.32",
32
32
  "@vibes.diy/prompts": "*",
33
- "@vibes.diy/use-vibes-base": "*",
34
- "cmd-ts": "^0.15.0"
33
+ "@vibes.diy/use-vibes-base": "*"
35
34
  },
36
35
  "peerDependencies": {
37
36
  "react": ">=19.1.0"
@@ -1,6 +0,0 @@
1
- import { Result } from "@adviser/cement";
2
- export interface NotImplementedOptions {
3
- readonly name: string;
4
- }
5
- export declare function notImplemented(options: NotImplementedOptions): () => Promise<Result<void>>;
6
- //# sourceMappingURL=not-implemented.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"not-implemented.d.ts","sourceRoot":"","sources":["../../src/commands/not-implemented.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAI1F"}
@@ -1,6 +0,0 @@
1
- import { Result } from "@adviser/cement";
2
- export function notImplemented(options) {
3
- return async function runNotImplemented() {
4
- return Result.Err(`use-vibes ${options.name}: not yet implemented`);
5
- };
6
- }
package/esm/run-cli.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import type { CliOutput } from "./commands/cli-output.js";
2
- export interface CliRuntime {
3
- readonly output: CliOutput;
4
- readonly setExitCode: (code: number) => void;
5
- }
6
- export declare function runCli(cliArgs: readonly string[], runtime: CliRuntime): Promise<void>;
7
- //# sourceMappingURL=run-cli.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-cli.d.ts","sourceRoot":"","sources":["../src/run-cli.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AA+FD,wBAAsB,MAAM,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB3F"}
package/esm/run-cli.js DELETED
@@ -1,107 +0,0 @@
1
- import { command, option, run, runSafely, string, subcommands, restPositionals } from "cmd-ts";
2
- import { runWhoami } from "./commands/whoami.js";
3
- import { runSkills } from "./commands/skills.js";
4
- import { runSystem } from "./commands/system.js";
5
- import { notImplemented } from "./commands/not-implemented.js";
6
- async function emitResult(runtime, runner) {
7
- const result = await runner();
8
- if (result.isErr()) {
9
- const err = result.Err();
10
- runtime.output.stderr(typeof err === "string" ? err : String(err));
11
- runtime.output.stderr("\n");
12
- runtime.setExitCode(1);
13
- }
14
- }
15
- async function emitGeneratedHelp(runtime, app) {
16
- const result = await runSafely(app, ["--help"]);
17
- if (result._tag === "ok") {
18
- return;
19
- }
20
- const target = result.error.config.into === "stdout" ? runtime.output.stdout : runtime.output.stderr;
21
- target(result.error.config.message);
22
- if (result.error.config.message.endsWith("\n") === false) {
23
- target("\n");
24
- }
25
- if (result.error.config.exitCode !== 0) {
26
- runtime.setExitCode(result.error.config.exitCode);
27
- }
28
- }
29
- function createStubCommand(runtime, name) {
30
- return command({
31
- name,
32
- description: `${name} is not implemented yet`,
33
- args: {
34
- _rest: restPositionals({ description: "arguments" }),
35
- },
36
- handler: async function handleStub() {
37
- await emitResult(runtime, notImplemented({ name }));
38
- },
39
- });
40
- }
41
- function createApp(runtime) {
42
- const whoamiCmd = command({
43
- name: "whoami",
44
- description: "Print logged in user",
45
- args: {},
46
- handler: async function handleWhoami() {
47
- await emitResult(runtime, runWhoami);
48
- },
49
- });
50
- const skillsCmd = command({
51
- name: "skills",
52
- description: "List available skills",
53
- args: {},
54
- handler: async function handleSkills() {
55
- await emitResult(runtime, () => runSkills(runtime.output));
56
- },
57
- });
58
- const systemCmd = command({
59
- name: "system",
60
- description: "Emit system prompt",
61
- args: {
62
- skills: option({
63
- type: string,
64
- long: "skills",
65
- description: "Comma-separated skills, e.g. fireproof,d3",
66
- defaultValue: () => "",
67
- }),
68
- },
69
- handler: async function handleSystem(args) {
70
- const skillsCsv = args.skills.length > 0 ? args.skills : undefined;
71
- await emitResult(runtime, () => runSystem({ skillsCsv }, runtime.output));
72
- },
73
- });
74
- return subcommands({
75
- name: "use-vibes",
76
- description: "Build and deploy React + Fireproof apps",
77
- cmds: {
78
- whoami: whoamiCmd,
79
- login: createStubCommand(runtime, "login"),
80
- dev: createStubCommand(runtime, "dev"),
81
- live: createStubCommand(runtime, "live"),
82
- generate: createStubCommand(runtime, "generate"),
83
- edit: createStubCommand(runtime, "edit"),
84
- skills: skillsCmd,
85
- system: systemCmd,
86
- publish: createStubCommand(runtime, "publish"),
87
- invite: createStubCommand(runtime, "invite"),
88
- },
89
- });
90
- }
91
- export async function runCli(cliArgs, runtime) {
92
- const app = createApp(runtime);
93
- switch (true) {
94
- case cliArgs.length === 0:
95
- await emitGeneratedHelp(runtime, app);
96
- break;
97
- case cliArgs.length === 1 && (cliArgs[0] === "-h" || cliArgs[0] === "--help"):
98
- await emitGeneratedHelp(runtime, app);
99
- break;
100
- case cliArgs.length === 1 && cliArgs[0] === "help":
101
- await emitGeneratedHelp(runtime, app);
102
- break;
103
- default:
104
- await run(app, [...cliArgs]);
105
- break;
106
- }
107
- }