@manfred-kunze-dev/backbone-cli 2.6.0-dev.4

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 (50) hide show
  1. package/LICENSE +19 -0
  2. package/dist/commands/ai.d.ts +3 -0
  3. package/dist/commands/ai.js +72 -0
  4. package/dist/commands/analytics.d.ts +3 -0
  5. package/dist/commands/analytics.js +120 -0
  6. package/dist/commands/auth.d.ts +3 -0
  7. package/dist/commands/auth.js +115 -0
  8. package/dist/commands/billing.d.ts +3 -0
  9. package/dist/commands/billing.js +100 -0
  10. package/dist/commands/config.d.ts +3 -0
  11. package/dist/commands/config.js +70 -0
  12. package/dist/commands/convert.d.ts +3 -0
  13. package/dist/commands/convert.js +123 -0
  14. package/dist/commands/extractions.d.ts +3 -0
  15. package/dist/commands/extractions.js +143 -0
  16. package/dist/commands/projects.d.ts +3 -0
  17. package/dist/commands/projects.js +83 -0
  18. package/dist/commands/prompt-labels.d.ts +3 -0
  19. package/dist/commands/prompt-labels.js +72 -0
  20. package/dist/commands/prompt-versions.d.ts +3 -0
  21. package/dist/commands/prompt-versions.js +70 -0
  22. package/dist/commands/prompts.d.ts +3 -0
  23. package/dist/commands/prompts.js +170 -0
  24. package/dist/commands/providers.d.ts +3 -0
  25. package/dist/commands/providers.js +115 -0
  26. package/dist/commands/schema-labels.d.ts +3 -0
  27. package/dist/commands/schema-labels.js +72 -0
  28. package/dist/commands/schema-versions.d.ts +3 -0
  29. package/dist/commands/schema-versions.js +71 -0
  30. package/dist/commands/schemas.d.ts +3 -0
  31. package/dist/commands/schemas.js +168 -0
  32. package/dist/commands/transcribe.d.ts +3 -0
  33. package/dist/commands/transcribe.js +65 -0
  34. package/dist/index.d.ts +3 -0
  35. package/dist/index.js +38 -0
  36. package/dist/lib/client.d.ts +12 -0
  37. package/dist/lib/client.js +52 -0
  38. package/dist/lib/config.d.ts +20 -0
  39. package/dist/lib/config.js +68 -0
  40. package/dist/lib/context.d.ts +7 -0
  41. package/dist/lib/context.js +14 -0
  42. package/dist/lib/errors.d.ts +14 -0
  43. package/dist/lib/errors.js +53 -0
  44. package/dist/lib/multipart.d.ts +10 -0
  45. package/dist/lib/multipart.js +57 -0
  46. package/dist/lib/output.d.ts +29 -0
  47. package/dist/lib/output.js +107 -0
  48. package/dist/lib/pagination.d.ts +21 -0
  49. package/dist/lib/pagination.js +21 -0
  50. package/package.json +52 -0
@@ -0,0 +1,143 @@
1
+ import { Command } from "commander";
2
+ import { readFileSync } from "node:fs";
3
+ import { extname } from "node:path";
4
+ import { getClient, runAction } from "../lib/client.js";
5
+ import { requireProjectId } from "../lib/context.js";
6
+ import { formatPage, formatDetail, withSpinner } from "../lib/output.js";
7
+ import { addPaginationOptions, paginationParams } from "../lib/pagination.js";
8
+ const IMAGE_MIME_TYPES = {
9
+ ".png": "image/png",
10
+ ".jpg": "image/jpeg",
11
+ ".jpeg": "image/jpeg",
12
+ ".gif": "image/gif",
13
+ ".webp": "image/webp",
14
+ ".bmp": "image/bmp",
15
+ ".tiff": "image/tiff",
16
+ };
17
+ function readImages(paths) {
18
+ return paths.map((p) => {
19
+ const buffer = readFileSync(p);
20
+ const ext = extname(p).toLowerCase();
21
+ const mimeType = IMAGE_MIME_TYPES[ext] ?? "image/png";
22
+ return { data: buffer.toString("base64"), mimeType };
23
+ });
24
+ }
25
+ export function makeExtractionsCommand() {
26
+ const cmd = new Command("extractions").description("Manage extractions");
27
+ cmd
28
+ .command("create")
29
+ .description("Create a new extraction")
30
+ .requiredOption("--schema <id>", "Schema ID")
31
+ .requiredOption("-m, --model <model>", "Model to use (provider/model)")
32
+ .option("-t, --text <text>", "Input text")
33
+ .option("-f, --file <path>", "Read input text from file")
34
+ .option("--images <paths...>", "Image file paths")
35
+ .option("--version-id <id>", "Schema version ID")
36
+ .option("-l, --label <name>", "Schema label")
37
+ .option("--async", "Run asynchronously")
38
+ .action(async (opts, command) => {
39
+ await runAction(command, async () => {
40
+ const projectId = requireProjectId(command);
41
+ const client = getClient(command);
42
+ let text = opts.text;
43
+ if (opts.file) {
44
+ text = readFileSync(opts.file, "utf-8");
45
+ }
46
+ const images = opts.images ? readImages(opts.images) : undefined;
47
+ const body = {
48
+ schemaId: opts.schema,
49
+ schemaVersionId: opts.versionId,
50
+ model: opts.model,
51
+ inputText: text,
52
+ inputImages: images,
53
+ };
54
+ if (opts.async) {
55
+ const { data } = await withSpinner("Extracting...", () => client.POST("/v1/projects/{projectId}/extractions/async", {
56
+ params: { path: { projectId } },
57
+ body,
58
+ }));
59
+ formatDetail(data, command);
60
+ }
61
+ else {
62
+ const { data } = await withSpinner("Extracting...", () => client.POST("/v1/projects/{projectId}/extractions", {
63
+ params: { path: { projectId } },
64
+ body,
65
+ }));
66
+ formatDetail(data, command);
67
+ }
68
+ });
69
+ });
70
+ cmd
71
+ .command("get")
72
+ .description("Get an extraction by ID")
73
+ .argument("<id>", "Extraction ID")
74
+ .action(async (id, _opts, command) => {
75
+ await runAction(command, async () => {
76
+ const projectId = requireProjectId(command);
77
+ const client = getClient(command);
78
+ const { data } = await client.GET("/v1/projects/{projectId}/extractions/{id}", { params: { path: { projectId, id } } });
79
+ formatDetail(data, command);
80
+ });
81
+ });
82
+ const list = new Command("list").description("List extractions");
83
+ addPaginationOptions(list);
84
+ list.option("-s, --search <term>", "Search text");
85
+ list.option("--schema-version <id>", "Filter by schema version ID");
86
+ list.option("--status <status>", "Filter by status (PENDING|PROCESSING|COMPLETED|FAILED)");
87
+ list.action(async (opts, command) => {
88
+ await runAction(command, async () => {
89
+ const projectId = requireProjectId(command);
90
+ const client = getClient(command);
91
+ const { data } = await client.GET("/v1/projects/{projectId}/extractions", {
92
+ params: {
93
+ path: { projectId },
94
+ query: {
95
+ search: opts.search,
96
+ schemaVersionId: opts.schemaVersion,
97
+ status: opts.status,
98
+ ...paginationParams(opts),
99
+ },
100
+ },
101
+ });
102
+ formatPage(data, command, ["id", "schemaId", "model", "status", "totalTokens", "createdAt"]);
103
+ });
104
+ });
105
+ cmd.addCommand(list);
106
+ cmd
107
+ .command("estimate")
108
+ .description("Estimate token usage for an extraction")
109
+ .requiredOption("--schema <id>", "Schema ID")
110
+ .requiredOption("-m, --model <model>", "Model to use")
111
+ .option("-t, --text <text>", "Input text")
112
+ .option("--version-id <id>", "Schema version ID")
113
+ .action(async (opts, command) => {
114
+ await runAction(command, async () => {
115
+ const projectId = requireProjectId(command);
116
+ const client = getClient(command);
117
+ const { data } = await client.POST("/v1/projects/{projectId}/extractions/estimate", {
118
+ body: {
119
+ schemaId: opts.schema,
120
+ schemaVersionId: opts.versionId,
121
+ inputText: opts.text,
122
+ },
123
+ });
124
+ formatDetail(data, command);
125
+ });
126
+ });
127
+ cmd
128
+ .command("rerun")
129
+ .description("Re-run an extraction")
130
+ .argument("<id>", "Extraction ID to rerun")
131
+ .action(async (id, _opts, command) => {
132
+ await runAction(command, async () => {
133
+ const projectId = requireProjectId(command);
134
+ const client = getClient(command);
135
+ const { data } = await withSpinner("Re-running extraction...", () => client.POST("/v1/projects/{projectId}/extractions/{id}/rerun", {
136
+ params: { path: { projectId, id } },
137
+ }));
138
+ formatDetail(data, command);
139
+ });
140
+ });
141
+ return cmd;
142
+ }
143
+ //# sourceMappingURL=extractions.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function makeProjectsCommand(): Command;
3
+ //# sourceMappingURL=projects.d.ts.map
@@ -0,0 +1,83 @@
1
+ import { Command } from "commander";
2
+ import { getClient, runAction } from "../lib/client.js";
3
+ import { formatPage, formatDetail, formatSuccess } from "../lib/output.js";
4
+ import { addPaginationOptions, paginationParams } from "../lib/pagination.js";
5
+ export function makeProjectsCommand() {
6
+ const cmd = new Command("projects").description("Manage projects");
7
+ const list = new Command("list").description("List projects");
8
+ addPaginationOptions(list);
9
+ list.option("-s, --search <term>", "Filter by name");
10
+ list.action(async (opts, command) => {
11
+ await runAction(command, async () => {
12
+ const client = getClient(command);
13
+ const { data } = await client.GET("/v1/projects", {
14
+ params: { query: { search: opts.search, ...paginationParams(opts) } },
15
+ });
16
+ formatPage(data, command, ["id", "name", "description", "createdAt"]);
17
+ });
18
+ });
19
+ cmd.addCommand(list);
20
+ cmd
21
+ .command("get")
22
+ .description("Get a project by ID")
23
+ .argument("<id>", "Project ID")
24
+ .action(async (id, _opts, command) => {
25
+ await runAction(command, async () => {
26
+ const client = getClient(command);
27
+ const { data } = await client.GET("/v1/projects/{id}", {
28
+ params: { path: { id } },
29
+ });
30
+ formatDetail(data, command);
31
+ });
32
+ });
33
+ cmd
34
+ .command("create")
35
+ .description("Create a new project")
36
+ .requiredOption("-n, --name <name>", "Project name")
37
+ .option("-d, --description <text>", "Project description")
38
+ .action(async (opts, command) => {
39
+ await runAction(command, async () => {
40
+ const client = getClient(command);
41
+ const { data } = await client.POST("/v1/projects", {
42
+ body: { name: opts.name, description: opts.description },
43
+ });
44
+ formatDetail(data, command);
45
+ });
46
+ });
47
+ cmd
48
+ .command("update")
49
+ .description("Update a project")
50
+ .argument("<id>", "Project ID")
51
+ .option("-n, --name <name>", "New name")
52
+ .option("-d, --description <text>", "New description")
53
+ .action(async (id, opts, command) => {
54
+ await runAction(command, async () => {
55
+ const client = getClient(command);
56
+ const body = {};
57
+ if (opts.name)
58
+ body.name = opts.name;
59
+ if (opts.description !== undefined)
60
+ body.description = opts.description;
61
+ const { data } = await client.PUT("/v1/projects/{id}", {
62
+ params: { path: { id } },
63
+ body: body,
64
+ });
65
+ formatDetail(data, command);
66
+ });
67
+ });
68
+ cmd
69
+ .command("delete")
70
+ .description("Delete a project")
71
+ .argument("<id>", "Project ID")
72
+ .action(async (id, _opts, command) => {
73
+ await runAction(command, async () => {
74
+ const client = getClient(command);
75
+ await client.DELETE("/v1/projects/{id}", {
76
+ params: { path: { id } },
77
+ });
78
+ formatSuccess(`Project ${id} deleted.`, command);
79
+ });
80
+ });
81
+ return cmd;
82
+ }
83
+ //# sourceMappingURL=projects.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function makePromptLabelsCommand(): Command;
3
+ //# sourceMappingURL=prompt-labels.d.ts.map
@@ -0,0 +1,72 @@
1
+ import { Command } from "commander";
2
+ import { getClient, runAction } from "../lib/client.js";
3
+ import { requireProjectId } from "../lib/context.js";
4
+ import { formatList, formatDetail, formatSuccess } from "../lib/output.js";
5
+ export function makePromptLabelsCommand() {
6
+ const cmd = new Command("labels").description("Manage prompt labels");
7
+ cmd
8
+ .command("list")
9
+ .description("List labels for a prompt")
10
+ .requiredOption("--prompt <id>", "Prompt ID")
11
+ .action(async (opts, command) => {
12
+ await runAction(command, async () => {
13
+ const projectId = requireProjectId(command);
14
+ const client = getClient(command);
15
+ const { data } = await client.GET("/v1/projects/{projectId}/prompts/{promptId}/labels", { params: { path: { projectId, promptId: opts.prompt } } });
16
+ formatList(data, command, [
17
+ "name",
18
+ "promptVersionId",
19
+ "createdAt",
20
+ ]);
21
+ });
22
+ });
23
+ cmd
24
+ .command("create")
25
+ .description("Create a label for a prompt version")
26
+ .requiredOption("--prompt <id>", "Prompt ID")
27
+ .requiredOption("-n, --name <name>", "Label name")
28
+ .requiredOption("--version-id <id>", "Prompt version ID to label")
29
+ .action(async (opts, command) => {
30
+ await runAction(command, async () => {
31
+ const projectId = requireProjectId(command);
32
+ const client = getClient(command);
33
+ const { data } = await client.POST("/v1/projects/{projectId}/prompts/{promptId}/labels", {
34
+ params: { path: { projectId, promptId: opts.prompt } },
35
+ body: { name: opts.name, promptVersionId: opts.versionId },
36
+ });
37
+ formatDetail(data, command);
38
+ });
39
+ });
40
+ cmd
41
+ .command("update")
42
+ .description("Update a label to point to a different version")
43
+ .argument("<labelName>", "Label name")
44
+ .requiredOption("--prompt <id>", "Prompt ID")
45
+ .requiredOption("--version-id <id>", "New prompt version ID")
46
+ .action(async (labelName, opts, command) => {
47
+ await runAction(command, async () => {
48
+ const projectId = requireProjectId(command);
49
+ const client = getClient(command);
50
+ const { data } = await client.PUT("/v1/projects/{projectId}/prompts/{promptId}/labels/{labelName}", {
51
+ params: { path: { projectId, promptId: opts.prompt, labelName } },
52
+ body: { promptVersionId: opts.versionId },
53
+ });
54
+ formatDetail(data, command);
55
+ });
56
+ });
57
+ cmd
58
+ .command("delete")
59
+ .description("Delete a prompt label")
60
+ .argument("<labelName>", "Label name")
61
+ .requiredOption("--prompt <id>", "Prompt ID")
62
+ .action(async (labelName, opts, command) => {
63
+ await runAction(command, async () => {
64
+ const projectId = requireProjectId(command);
65
+ const client = getClient(command);
66
+ await client.DELETE("/v1/projects/{projectId}/prompts/{promptId}/labels/{labelName}", { params: { path: { projectId, promptId: opts.prompt, labelName } } });
67
+ formatSuccess(`Label "${labelName}" deleted.`, command);
68
+ });
69
+ });
70
+ return cmd;
71
+ }
72
+ //# sourceMappingURL=prompt-labels.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function makePromptVersionsCommand(): Command;
3
+ //# sourceMappingURL=prompt-versions.d.ts.map
@@ -0,0 +1,70 @@
1
+ import { Command } from "commander";
2
+ import { getClient, runAction } from "../lib/client.js";
3
+ import { requireProjectId } from "../lib/context.js";
4
+ import { formatPage, formatDetail } from "../lib/output.js";
5
+ import { addPaginationOptions, paginationParams } from "../lib/pagination.js";
6
+ export function makePromptVersionsCommand() {
7
+ const cmd = new Command("versions").description("Manage prompt versions");
8
+ const list = new Command("list").description("List versions of a prompt");
9
+ addPaginationOptions(list);
10
+ list.requiredOption("--prompt <id>", "Prompt ID");
11
+ list.action(async (opts, command) => {
12
+ await runAction(command, async () => {
13
+ const projectId = requireProjectId(command);
14
+ const client = getClient(command);
15
+ const { data } = await client.GET("/v1/projects/{projectId}/prompts/{promptId}/versions", {
16
+ params: {
17
+ path: { projectId, promptId: opts.prompt },
18
+ query: paginationParams(opts),
19
+ },
20
+ });
21
+ formatPage(data, command, ["id", "version", "active", "changeDescription", "createdAt"]);
22
+ });
23
+ });
24
+ cmd.addCommand(list);
25
+ cmd
26
+ .command("get")
27
+ .description("Get a specific prompt version")
28
+ .argument("<versionId>", "Version ID")
29
+ .requiredOption("--prompt <id>", "Prompt ID")
30
+ .action(async (versionId, opts, command) => {
31
+ await runAction(command, async () => {
32
+ const projectId = requireProjectId(command);
33
+ const client = getClient(command);
34
+ const { data } = await client.GET("/v1/projects/{projectId}/prompts/{promptId}/versions/{versionId}", { params: { path: { projectId, promptId: opts.prompt, versionId } } });
35
+ formatDetail(data, command);
36
+ });
37
+ });
38
+ cmd
39
+ .command("create")
40
+ .description("Create a new prompt version")
41
+ .requiredOption("--prompt <id>", "Prompt ID")
42
+ .requiredOption("-c, --content <text>", "Prompt content (template text)")
43
+ .option("-m, --message <text>", "Change description")
44
+ .action(async (opts, command) => {
45
+ await runAction(command, async () => {
46
+ const projectId = requireProjectId(command);
47
+ const client = getClient(command);
48
+ const { data } = await client.POST("/v1/projects/{projectId}/prompts/{promptId}/versions", {
49
+ params: { path: { projectId, promptId: opts.prompt } },
50
+ body: { content: opts.content, changeDescription: opts.message },
51
+ });
52
+ formatDetail(data, command);
53
+ });
54
+ });
55
+ cmd
56
+ .command("activate")
57
+ .description("Activate a prompt version")
58
+ .argument("<versionId>", "Version ID")
59
+ .requiredOption("--prompt <id>", "Prompt ID")
60
+ .action(async (versionId, opts, command) => {
61
+ await runAction(command, async () => {
62
+ const projectId = requireProjectId(command);
63
+ const client = getClient(command);
64
+ const { data } = await client.PUT("/v1/projects/{projectId}/prompts/{promptId}/versions/{versionId}/activate", { params: { path: { projectId, promptId: opts.prompt, versionId } } });
65
+ formatDetail(data, command);
66
+ });
67
+ });
68
+ return cmd;
69
+ }
70
+ //# sourceMappingURL=prompt-versions.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function makePromptsCommand(): Command;
3
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1,170 @@
1
+ import { Command } from "commander";
2
+ import { getClient, runAction } from "../lib/client.js";
3
+ import { requireProjectId } from "../lib/context.js";
4
+ import { formatPage, formatDetail, formatSuccess } from "../lib/output.js";
5
+ import { addPaginationOptions, paginationParams } from "../lib/pagination.js";
6
+ import { makePromptVersionsCommand } from "./prompt-versions.js";
7
+ import { makePromptLabelsCommand } from "./prompt-labels.js";
8
+ export function makePromptsCommand() {
9
+ const cmd = new Command("prompts").description("Manage prompts");
10
+ const list = new Command("list").description("List prompts");
11
+ addPaginationOptions(list);
12
+ list.option("-s, --search <term>", "Filter by name");
13
+ list.option("--type <type>", "Filter by type");
14
+ list.action(async (opts, command) => {
15
+ await runAction(command, async () => {
16
+ const projectId = requireProjectId(command);
17
+ const client = getClient(command);
18
+ const { data } = await client.GET("/v1/projects/{projectId}/prompts", {
19
+ params: {
20
+ path: { projectId },
21
+ query: { search: opts.search, type: opts.type, ...paginationParams(opts) },
22
+ },
23
+ });
24
+ formatPage(data, command, ["id", "name", "type", "description", "activeVersionId", "createdAt"]);
25
+ });
26
+ });
27
+ cmd.addCommand(list);
28
+ cmd
29
+ .command("get")
30
+ .description("Get a prompt by ID")
31
+ .argument("<id>", "Prompt ID")
32
+ .action(async (id, _opts, command) => {
33
+ await runAction(command, async () => {
34
+ const projectId = requireProjectId(command);
35
+ const client = getClient(command);
36
+ const { data } = await client.GET("/v1/projects/{projectId}/prompts/{id}", {
37
+ params: { path: { projectId, id } },
38
+ });
39
+ formatDetail(data, command);
40
+ });
41
+ });
42
+ cmd
43
+ .command("create")
44
+ .description("Create a new prompt")
45
+ .requiredOption("-n, --name <name>", "Prompt name")
46
+ .option("-d, --description <text>", "Prompt description")
47
+ .option("--type <type>", "Prompt type")
48
+ .action(async (opts, command) => {
49
+ await runAction(command, async () => {
50
+ const projectId = requireProjectId(command);
51
+ const client = getClient(command);
52
+ const { data } = await client.POST("/v1/projects/{projectId}/prompts", {
53
+ params: { path: { projectId } },
54
+ body: { name: opts.name, description: opts.description, type: opts.type },
55
+ });
56
+ formatDetail(data, command);
57
+ });
58
+ });
59
+ cmd
60
+ .command("update")
61
+ .description("Update a prompt")
62
+ .argument("<id>", "Prompt ID")
63
+ .option("-n, --name <name>", "New name")
64
+ .option("-d, --description <text>", "New description")
65
+ .option("--type <type>", "New type")
66
+ .action(async (id, opts, command) => {
67
+ await runAction(command, async () => {
68
+ const projectId = requireProjectId(command);
69
+ const client = getClient(command);
70
+ const body = {};
71
+ if (opts.name)
72
+ body.name = opts.name;
73
+ if (opts.description !== undefined)
74
+ body.description = opts.description;
75
+ if (opts.type !== undefined)
76
+ body.type = opts.type;
77
+ const { data } = await client.PUT("/v1/projects/{projectId}/prompts/{id}", {
78
+ params: { path: { projectId, id } },
79
+ body: body,
80
+ });
81
+ formatDetail(data, command);
82
+ });
83
+ });
84
+ cmd
85
+ .command("delete")
86
+ .description("Delete a prompt")
87
+ .argument("<id>", "Prompt ID")
88
+ .action(async (id, _opts, command) => {
89
+ await runAction(command, async () => {
90
+ const projectId = requireProjectId(command);
91
+ const client = getClient(command);
92
+ await client.DELETE("/v1/projects/{projectId}/prompts/{id}", {
93
+ params: { path: { projectId, id } },
94
+ });
95
+ formatSuccess(`Prompt ${id} deleted.`, command);
96
+ });
97
+ });
98
+ cmd
99
+ .command("resolve")
100
+ .description("Resolve prompt content (latest or by label)")
101
+ .argument("<promptId>", "Prompt ID")
102
+ .option("-l, --label <name>", "Label to resolve")
103
+ .action(async (promptId, opts, command) => {
104
+ await runAction(command, async () => {
105
+ const projectId = requireProjectId(command);
106
+ const client = getClient(command);
107
+ const { data } = await client.GET("/v1/projects/{projectId}/prompts/{promptId}/resolve", {
108
+ params: {
109
+ path: { projectId, promptId },
110
+ query: { label: opts.label },
111
+ },
112
+ });
113
+ formatDetail(data, command);
114
+ });
115
+ });
116
+ cmd
117
+ .command("compile")
118
+ .description("Compile a prompt with variable substitution")
119
+ .argument("<promptId>", "Prompt ID")
120
+ .option("--vars <json>", "Variables as JSON object")
121
+ .option("--version-id <id>", "Specific version ID")
122
+ .option("-l, --label <name>", "Label to use")
123
+ .action(async (promptId, opts, command) => {
124
+ await runAction(command, async () => {
125
+ const projectId = requireProjectId(command);
126
+ const client = getClient(command);
127
+ const variables = opts.vars ? JSON.parse(opts.vars) : undefined;
128
+ const { data } = await client.POST("/v1/projects/{projectId}/prompts/{promptId}/compile", {
129
+ params: { path: { projectId, promptId } },
130
+ body: {
131
+ variables,
132
+ versionId: opts.versionId,
133
+ label: opts.label,
134
+ },
135
+ });
136
+ formatDetail(data, command);
137
+ });
138
+ });
139
+ cmd
140
+ .command("test")
141
+ .description("Test a prompt with an LLM")
142
+ .argument("<promptId>", "Prompt ID")
143
+ .requiredOption("-m, --model <model>", "Model to use (provider/model)")
144
+ .option("-t, --text <text>", "Input text")
145
+ .option("--vars <json>", "Variables as JSON object")
146
+ .option("--version-id <id>", "Specific version ID")
147
+ .option("-l, --label <name>", "Label to use")
148
+ .action(async (promptId, opts, command) => {
149
+ await runAction(command, async () => {
150
+ const projectId = requireProjectId(command);
151
+ const client = getClient(command);
152
+ const variables = opts.vars ? JSON.parse(opts.vars) : undefined;
153
+ const { data } = await client.POST("/v1/projects/{projectId}/prompts/{promptId}/test", {
154
+ params: { path: { projectId, promptId } },
155
+ body: {
156
+ model: opts.model,
157
+ content: opts.text,
158
+ variables,
159
+ versionId: opts.versionId,
160
+ label: opts.label,
161
+ },
162
+ });
163
+ formatDetail(data, command);
164
+ });
165
+ });
166
+ cmd.addCommand(makePromptVersionsCommand());
167
+ cmd.addCommand(makePromptLabelsCommand());
168
+ return cmd;
169
+ }
170
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function makeProvidersCommand(): Command;
3
+ //# sourceMappingURL=providers.d.ts.map