@spendgraph/cli 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,51 @@
1
+ import type { Spendgraph } from "@spendgraph/sdk";
2
+ import type { Parsed } from "./args.js";
3
+ import type { Loaded } from "./env.js";
4
+ /** What a command is handed: the client, the line it was called with, and the scope it runs in. */
5
+ export interface Ctx {
6
+ sg: Spendgraph;
7
+ parsed: Parsed;
8
+ /** The resolved environment, and which `.env` fed it. */
9
+ loaded: Loaded;
10
+ /** A positional argument. Throws `UsageError` naming it when absent. */
11
+ need(index: number, name: string): string;
12
+ /** A positional argument, or undefined. */
13
+ arg(index: number): string | undefined;
14
+ /** A flag as text, or undefined where it was not passed. */
15
+ flag(name: string): string | undefined;
16
+ /** A flag as a boolean. A flag passed without a value is true. */
17
+ bool(name: string): boolean;
18
+ /** A flag as a number. Throws `UsageError` where it was passed but is not one. */
19
+ num(name: string): number | undefined;
20
+ /** A flag as a comma-separated list. */
21
+ list(name: string): string[] | undefined;
22
+ /** The project id, from `--project` or `SPENDGRAPH_PROJECT`. Throws where neither is set. */
23
+ project(): string;
24
+ /** `--project` where it was given, for a call that scopes rather than requires it. */
25
+ scope(): {
26
+ project?: string;
27
+ };
28
+ /**
29
+ * The request body: `--file`'s JSON with the flags named here laid over it.
30
+ *
31
+ * A flag always wins, so `--file base.json --name other` edits one field of a
32
+ * stored definition without restating the rest of it.
33
+ */
34
+ body(fromFlags: Record<string, unknown>): Record<string, unknown>;
35
+ }
36
+ /** One thing the CLI can do, and how to say it. */
37
+ export interface Command {
38
+ name: string;
39
+ summary: string;
40
+ /** Positional arguments, as they appear in help. */
41
+ usage?: string;
42
+ /** True where the command never reaches the API, so it runs without credentials. */
43
+ local?: boolean;
44
+ run(ctx: Ctx): Promise<unknown>;
45
+ }
46
+ /** A resource, and the commands that act on it. */
47
+ export interface Group {
48
+ name: string;
49
+ summary: string;
50
+ commands: Command[];
51
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@spendgraph/cli",
3
+ "version": "0.2.0",
4
+ "description": "Drive the spendgraph dashboard from a terminal: prompts, tools, projects, keys and spend.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/fnLog0/spendgraph.git",
9
+ "directory": "packages/cli"
10
+ },
11
+ "homepage": "https://github.com/fnLog0/spendgraph#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/fnLog0/spendgraph/issues"
14
+ },
15
+ "keywords": [
16
+ "cli",
17
+ "llm",
18
+ "prompts",
19
+ "tools",
20
+ "spend"
21
+ ],
22
+ "type": "module",
23
+ "bin": {
24
+ "sg": "./dist/index.js"
25
+ },
26
+ "main": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./dist/index.js"
32
+ },
33
+ "./package.json": "./package.json"
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "README.md"
38
+ ],
39
+ "scripts": {
40
+ "build": "tsc -p tsconfig.json",
41
+ "test": "vitest run"
42
+ },
43
+ "dependencies": {
44
+ "@spendgraph/sdk": "^0.2.0"
45
+ },
46
+ "devDependencies": {
47
+ "typescript": "^5"
48
+ },
49
+ "engines": {
50
+ "node": ">=18"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ }
55
+ }