@zdql/giga-claude-cli 1.0.2
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 +148 -0
- package/dist/commands/config.d.ts +6 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +62 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/workflow/artifacts.d.ts +6 -0
- package/dist/commands/workflow/artifacts.d.ts.map +1 -0
- package/dist/commands/workflow/artifacts.js +92 -0
- package/dist/commands/workflow/artifacts.js.map +1 -0
- package/dist/commands/workflow/control.d.ts +7 -0
- package/dist/commands/workflow/control.d.ts.map +1 -0
- package/dist/commands/workflow/control.js +76 -0
- package/dist/commands/workflow/control.js.map +1 -0
- package/dist/commands/workflow/create.d.ts +6 -0
- package/dist/commands/workflow/create.d.ts.map +1 -0
- package/dist/commands/workflow/create.js +137 -0
- package/dist/commands/workflow/create.js.map +1 -0
- package/dist/commands/workflow/index.d.ts +6 -0
- package/dist/commands/workflow/index.d.ts.map +1 -0
- package/dist/commands/workflow/index.js +27 -0
- package/dist/commands/workflow/index.js.map +1 -0
- package/dist/commands/workflow/logs.d.ts +6 -0
- package/dist/commands/workflow/logs.d.ts.map +1 -0
- package/dist/commands/workflow/logs.js +117 -0
- package/dist/commands/workflow/logs.js.map +1 -0
- package/dist/commands/workflow/run.d.ts +14 -0
- package/dist/commands/workflow/run.d.ts.map +1 -0
- package/dist/commands/workflow/run.js +140 -0
- package/dist/commands/workflow/run.js.map +1 -0
- package/dist/commands/workflow/status.d.ts +6 -0
- package/dist/commands/workflow/status.d.ts.map +1 -0
- package/dist/commands/workflow/status.js +113 -0
- package/dist/commands/workflow/status.js.map +1 -0
- package/dist/commands/workflow/validate.d.ts +6 -0
- package/dist/commands/workflow/validate.d.ts.map +1 -0
- package/dist/commands/workflow/validate.js +94 -0
- package/dist/commands/workflow/validate.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/client.d.ts +14 -0
- package/dist/lib/client.d.ts.map +1 -0
- package/dist/lib/client.js +30 -0
- package/dist/lib/client.js.map +1 -0
- package/dist/lib/config.d.ts +31 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +71 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/output.d.ts +56 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +106 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/utils.d.ts +41 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +92 -0
- package/dist/lib/utils.js.map +1 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Giga-Claude CLI
|
|
2
|
+
|
|
3
|
+
Command-line interface for Giga-Claude workflow orchestration.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm install -g @zdql/giga-claude-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or use directly from the monorepo:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
cd src/packages/cli
|
|
15
|
+
pnpm run build
|
|
16
|
+
node dist/index.js
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
### 1. Configure the CLI
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
giga config set baseUrl http://localhost:3000
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 2. Validate your workflow
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
giga workflow validate \
|
|
31
|
+
--data ./states.csv \
|
|
32
|
+
--prompt ./prompt.txt \
|
|
33
|
+
--key-field "abbreviation"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 3. Create a workflow
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
giga workflow create \
|
|
40
|
+
--data ./states.csv \
|
|
41
|
+
--prompt ./prompt.txt \
|
|
42
|
+
--key-field "abbreviation" \
|
|
43
|
+
--tools "Bash,Read,Write,WebSearch" \
|
|
44
|
+
--concurrency 5 \
|
|
45
|
+
--artifact-pattern "enriched_output.json" \
|
|
46
|
+
--name "State Enrichment"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 4. Run the workflow
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Dry run first
|
|
53
|
+
giga workflow run 42 --first 5 --dry-run
|
|
54
|
+
|
|
55
|
+
# Actually run
|
|
56
|
+
giga workflow run 42 --first 5
|
|
57
|
+
|
|
58
|
+
# Run all remaining
|
|
59
|
+
giga workflow run 42 --all
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 5. Monitor progress
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Summary
|
|
66
|
+
giga workflow status 42
|
|
67
|
+
|
|
68
|
+
# Detailed with all runs
|
|
69
|
+
giga workflow status 42 --runs
|
|
70
|
+
|
|
71
|
+
# Filter by status
|
|
72
|
+
giga workflow status 42 --runs --filter completed
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 6. Download artifacts
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# List all artifacts
|
|
79
|
+
giga workflow artifacts 42
|
|
80
|
+
|
|
81
|
+
# Download all
|
|
82
|
+
giga workflow artifacts 42 --download ./output/
|
|
83
|
+
|
|
84
|
+
# View specific artifact
|
|
85
|
+
giga workflow artifacts 42 --entity CA --cat
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Commands
|
|
89
|
+
|
|
90
|
+
### Configuration
|
|
91
|
+
|
|
92
|
+
- `giga config set <key> <value>` - Set configuration value
|
|
93
|
+
- `giga config list` - List all configuration
|
|
94
|
+
|
|
95
|
+
### Workflow Management
|
|
96
|
+
|
|
97
|
+
- `giga workflow create` - Create new workflow from files
|
|
98
|
+
- `giga workflow validate` - Validate without creating
|
|
99
|
+
- `giga workflow run <id>` - Start batch of runs
|
|
100
|
+
- `giga workflow status <id>` - Check progress
|
|
101
|
+
- `giga workflow pause <id>` - Pause execution
|
|
102
|
+
- `giga workflow resume <id>` - Resume paused workflow
|
|
103
|
+
- `giga workflow cancel <id>` - Cancel running jobs
|
|
104
|
+
- `giga workflow artifacts <id>` - Manage artifacts
|
|
105
|
+
|
|
106
|
+
## Full API Parity
|
|
107
|
+
|
|
108
|
+
The CLI uses the `@zdql/giga-claude-client` package for all API calls, ensuring full parity between programmatic and CLI usage.
|
|
109
|
+
|
|
110
|
+
## Example: State Enrichment
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# 1. Configure
|
|
114
|
+
giga config set baseUrl http://localhost:3000
|
|
115
|
+
|
|
116
|
+
# 2. Create workflow
|
|
117
|
+
giga workflow create \
|
|
118
|
+
--data ./states.csv \
|
|
119
|
+
--prompt ./prompt.txt \
|
|
120
|
+
--key-field "abbreviation" \
|
|
121
|
+
--concurrency 3 \
|
|
122
|
+
--artifact-pattern "enriched_output.json" \
|
|
123
|
+
--name "State Capital Enrichment"
|
|
124
|
+
|
|
125
|
+
# 3. Test with first 2 states
|
|
126
|
+
giga workflow run 42 --first 2
|
|
127
|
+
|
|
128
|
+
# 4. Check status
|
|
129
|
+
giga workflow status 42
|
|
130
|
+
|
|
131
|
+
# 5. If good, run all
|
|
132
|
+
giga workflow run 42 --all
|
|
133
|
+
|
|
134
|
+
# 6. Download results
|
|
135
|
+
giga workflow artifacts 42 --download ./output/
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Architecture
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
CLI Commands
|
|
142
|
+
↓
|
|
143
|
+
@zdql/giga-claude-client (API SDK)
|
|
144
|
+
↓
|
|
145
|
+
Giga-Claude Server (API)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
All workflow operations go through the client SDK, ensuring consistency and type safety.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../commands/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,mBAAmB,IAAI,OAAO,CAiE7C"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration commands
|
|
3
|
+
*/
|
|
4
|
+
import { Command } from "commander";
|
|
5
|
+
import { loadConfig, updateConfig } from "../lib/config.js";
|
|
6
|
+
import { success, error, info, createTable } from "../lib/output.js";
|
|
7
|
+
export function createConfigCommand() {
|
|
8
|
+
const config = new Command("config").description("Manage CLI configuration");
|
|
9
|
+
// giga config set <key> <value>
|
|
10
|
+
config
|
|
11
|
+
.command("set <key> <value>")
|
|
12
|
+
.description("Set a configuration value")
|
|
13
|
+
.action((key, value) => {
|
|
14
|
+
try {
|
|
15
|
+
// Validate key
|
|
16
|
+
const validKeys = ["baseUrl", "apiKey", "timeout", "retries"];
|
|
17
|
+
if (!validKeys.includes(key)) {
|
|
18
|
+
error(`Invalid key '${key}'. Valid keys: ${validKeys.join(", ")}`);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
// Parse value for numeric fields
|
|
22
|
+
let parsedValue = value;
|
|
23
|
+
if (key === "timeout" || key === "retries") {
|
|
24
|
+
parsedValue = parseInt(value, 10);
|
|
25
|
+
if (isNaN(parsedValue)) {
|
|
26
|
+
error(`${key} must be a number`);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
updateConfig(key, parsedValue);
|
|
31
|
+
success(`Set ${key} = ${parsedValue}`);
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
error(err.message);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
// giga config list
|
|
39
|
+
config
|
|
40
|
+
.command("list")
|
|
41
|
+
.description("List all configuration values")
|
|
42
|
+
.action(() => {
|
|
43
|
+
try {
|
|
44
|
+
const cfg = loadConfig();
|
|
45
|
+
if (!cfg) {
|
|
46
|
+
info("No configuration found. Use 'giga config set' to configure.");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const table = createTable({
|
|
50
|
+
head: ["Key", "Value"],
|
|
51
|
+
});
|
|
52
|
+
table.push(["baseUrl", cfg.baseUrl || "(not set)"], ["apiKey", cfg.apiKey ? "***" + cfg.apiKey.slice(-4) : "(not set)"], ["timeout", cfg.timeout?.toString() || "30000 (default)"], ["retries", cfg.retries?.toString() || "3 (default)"]);
|
|
53
|
+
console.log(table.toString());
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
error(err.message);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return config;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../commands/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAc,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAErE,MAAM,UAAU,mBAAmB;IACjC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC;IAE7E,gCAAgC;IAChC,MAAM;SACH,OAAO,CAAC,mBAAmB,CAAC;SAC5B,WAAW,CAAC,2BAA2B,CAAC;SACxC,MAAM,CAAC,CAAC,GAAW,EAAE,KAAa,EAAE,EAAE;QACrC,IAAI,CAAC;YACH,eAAe;YACf,MAAM,SAAS,GAA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AAC;gBACxB,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC;aACvB,CAAC,CAAC;YAEH,KAAK,CAAC,IAAI,CACR,CAAC,SAAS,EAAE,GAAG,CAAC,OAAO,IAAI,WAAW,CAAC,EACvC,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,EACnE,CAAC,SAAS,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,iBAAiB,CAAC,EACzD,CAAC,SAAS,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,aAAa,CAAC,CACtD,CAAC;YAEF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../../commands/workflow/artifacts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,8BAA8B,IAAI,OAAO,CAgGxD"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* giga workflow artifacts command
|
|
3
|
+
*/
|
|
4
|
+
import { Command } from "commander";
|
|
5
|
+
import * as fs from "fs";
|
|
6
|
+
import * as path from "path";
|
|
7
|
+
import { getClient } from "../../lib/client.js";
|
|
8
|
+
import { success, error, info, createTable } from "../../lib/output.js";
|
|
9
|
+
import { ensureDir, sanitizeFilename } from "../../lib/utils.js";
|
|
10
|
+
export function createWorkflowArtifactsCommand() {
|
|
11
|
+
return new Command("artifacts")
|
|
12
|
+
.description("List and download workflow artifacts")
|
|
13
|
+
.argument("<workflowId>", "Workflow ID")
|
|
14
|
+
.option("--download <dir>", "Download all artifacts to directory")
|
|
15
|
+
.option("--entity <key>", "Download artifact for specific entity")
|
|
16
|
+
.option("--cat", "Print artifact content to stdout (requires --entity)")
|
|
17
|
+
.action(async (workflowId, options) => {
|
|
18
|
+
try {
|
|
19
|
+
const client = getClient();
|
|
20
|
+
const id = parseInt(workflowId, 10);
|
|
21
|
+
if (isNaN(id)) {
|
|
22
|
+
error("Workflow ID must be a number");
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
const result = await client.getWorkflowArtifacts(id);
|
|
26
|
+
const artifacts = Object.entries(result.artifacts);
|
|
27
|
+
if (artifacts.length === 0) {
|
|
28
|
+
info("No artifacts found");
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
// Filter by entity if specified
|
|
32
|
+
let filteredArtifacts = artifacts;
|
|
33
|
+
if (options.entity) {
|
|
34
|
+
filteredArtifacts = artifacts.filter(([key]) => key === options.entity);
|
|
35
|
+
if (filteredArtifacts.length === 0) {
|
|
36
|
+
error(`No artifact found for entity "${options.entity}"`);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Cat mode
|
|
41
|
+
if (options.cat) {
|
|
42
|
+
if (!options.entity) {
|
|
43
|
+
error("--cat requires --entity");
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
const [_, artifact] = filteredArtifacts[0];
|
|
47
|
+
const response = await fetch(artifact.url);
|
|
48
|
+
const content = await response.text();
|
|
49
|
+
console.log(content);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// Download mode
|
|
53
|
+
if (options.download) {
|
|
54
|
+
ensureDir(options.download);
|
|
55
|
+
info(`Downloading ${filteredArtifacts.length} artifacts to ${options.download}/`);
|
|
56
|
+
for (const [entityKey, artifact] of filteredArtifacts) {
|
|
57
|
+
const safeName = sanitizeFilename(entityKey);
|
|
58
|
+
const localPath = path.join(options.download, `${safeName}.json`);
|
|
59
|
+
const response = await fetch(artifact.url);
|
|
60
|
+
if (!response.ok) {
|
|
61
|
+
error(`Failed to download artifact for ${entityKey}: ${response.status}`);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
const content = await response.text();
|
|
65
|
+
fs.writeFileSync(localPath, content);
|
|
66
|
+
console.log(` ├─ ${entityKey} → ${localPath}`);
|
|
67
|
+
}
|
|
68
|
+
success("Done");
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
// List mode (default)
|
|
72
|
+
const table = createTable({
|
|
73
|
+
head: ["Entity", "Artifact URL", "Status"],
|
|
74
|
+
});
|
|
75
|
+
for (const [entityKey, artifact] of artifacts) {
|
|
76
|
+
table.push([
|
|
77
|
+
entityKey,
|
|
78
|
+
artifact.url.substring(0, 60) + "...",
|
|
79
|
+
"✓",
|
|
80
|
+
]);
|
|
81
|
+
}
|
|
82
|
+
console.log(table.toString());
|
|
83
|
+
console.log();
|
|
84
|
+
info(`Total: ${artifacts.length} artifacts`);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
error(err.message || String(err));
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=artifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../../commands/workflow/artifacts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,SAAS,E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|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow control commands: pause, resume, cancel
|
|
3
|
+
*/
|
|
4
|
+
import { Command } from "commander";
|
|
5
|
+
export declare function createWorkflowPauseCommand(): Command;
|
|
6
|
+
export declare function createWorkflowCancelCommand(): Command;
|
|
7
|
+
//# sourceMappingURL=control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../../commands/workflow/control.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,0BAA0B,IAAI,OAAO,CA6BpD;AAID,wBAAgB,2BAA2B,IAAI,OAAO,CA0CrD"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow control commands: pause, resume, cancel
|
|
3
|
+
*/
|
|
4
|
+
import { Command } from "commander";
|
|
5
|
+
import { getClient } from "../../lib/client.js";
|
|
6
|
+
import { success, error, info } from "../../lib/output.js";
|
|
7
|
+
import { confirm } from "../../lib/utils.js";
|
|
8
|
+
export function createWorkflowPauseCommand() {
|
|
9
|
+
return new Command("pause")
|
|
10
|
+
.description("Stop auto-continuation (running jobs continue, no new jobs start)")
|
|
11
|
+
.argument("<workflowId>", "Workflow ID")
|
|
12
|
+
.action(async (workflowId) => {
|
|
13
|
+
try {
|
|
14
|
+
const client = getClient();
|
|
15
|
+
const id = parseInt(workflowId, 10);
|
|
16
|
+
if (isNaN(id)) {
|
|
17
|
+
error("Workflow ID must be a number");
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
const result = await client.pauseWorkflow(id);
|
|
21
|
+
success(`Workflow ${result.workflowId} paused`);
|
|
22
|
+
if (result.running > 0) {
|
|
23
|
+
info(`Currently running jobs (${result.running}) will complete normally`);
|
|
24
|
+
}
|
|
25
|
+
info(`Pending jobs (${result.pending}) won't auto-start`);
|
|
26
|
+
console.log();
|
|
27
|
+
info(`To resume auto-continuation: giga workflow start ${id}`);
|
|
28
|
+
info(`To run specific number without auto-continuation: giga workflow next ${id} <count>`);
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
error(err.message || String(err));
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
// Resume functionality is now handled by the 'start' command
|
|
37
|
+
export function createWorkflowCancelCommand() {
|
|
38
|
+
return new Command("cancel")
|
|
39
|
+
.description("Cancel all running jobs in workflow")
|
|
40
|
+
.argument("<workflowId>", "Workflow ID")
|
|
41
|
+
.option("--reason <text>", "Cancellation reason")
|
|
42
|
+
.option("--yes", "Skip confirmation prompt")
|
|
43
|
+
.action(async (workflowId, options) => {
|
|
44
|
+
try {
|
|
45
|
+
const client = getClient();
|
|
46
|
+
const id = parseInt(workflowId, 10);
|
|
47
|
+
if (isNaN(id)) {
|
|
48
|
+
error("Workflow ID must be a number");
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
// Get workflow info for confirmation
|
|
52
|
+
const workflow = await client.getWorkflow(id, false);
|
|
53
|
+
// Confirm unless --yes
|
|
54
|
+
if (!options.yes) {
|
|
55
|
+
console.log(`Cancel workflow ${id} "${workflow.name || "(unnamed)"}"`);
|
|
56
|
+
console.log(`This will terminate ${workflow.summary.running} running jobs.`);
|
|
57
|
+
const confirmed = await confirm("", "cancel");
|
|
58
|
+
if (!confirmed) {
|
|
59
|
+
info("Cancelled");
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const result = await client.cancelWorkflow(id, {
|
|
64
|
+
reason: options.reason,
|
|
65
|
+
});
|
|
66
|
+
success(`Canceled ${result.canceled} running jobs`);
|
|
67
|
+
info(`Pending: ${result.pending} (can still be run later)`);
|
|
68
|
+
info(`Completed: ${result.completed} (already done)`);
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
error(err.message || String(err));
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.js","sourceRoot":"","sources":["../../../commands/workflow/control.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,UAAU,0BAA0B;IACxC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;SACxB,WAAW,CAAC,mEAAmE,CAAC;SAChF,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC;SACvC,MAAM,CAAC,KAAK,EAAE,UAAkB,EAAE,EAAE;QACnC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,EAAE,GAAG,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YAEpC,IAAI,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;gBACd,KAAK,CAAC,8BAA8B,CAAC,CAAC;gBACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YAE9C,OAAO,CAAC,YAAY,MAAM,CAAC,UAAU,SAAS,CAAC,CAAC;YAChD,IAAI,MAAM,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC;gBACvB,IAAI,CAAC,2BAA2B,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC;YAC5E,CAAC;YACD,IAAI,CAAC,iBAAiB,MAAM,CAAC,OA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;gBACvE,OAAO,CAAC,GAAG,CAAC,uBAAuB,QAAQ,CAAC,OAAO,CAAC,OAAO,gBAAgB,CAAC,CAAC;gBAC7E,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;gBAC9C,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,IAAI,CAAC,WAAW,CAAC,CAAC;oBAClB,OAAO;gBACT,CAAC;YACH,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,EAAE,EAAE;gBAC7C,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB,CAAC,CAAC;YAEH,OAAO,CAAC,YAAY,MAAM,CAAC,QAAQ,eAAe,CAAC,CAAC;YACpD,IAAI,CAAC,YAAY,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC;YAC5D,IAAI,CAAC,cAAc,MAAM,CAAC,SAAS,iBAAiB,CAAC,CAAC;QACxD,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,KAAK,CAAC,GAAG,CAAC,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../commands/workflow/create.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,2BAA2B,IAAI,OAAO,CAmIrD"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* giga workflow create command
|
|
3
|
+
*/
|
|
4
|
+
import { Command } from "commander";
|
|
5
|
+
import { getClient } from "../../lib/client.js";
|
|
6
|
+
import { success, error, section, print, warn } from "../../lib/output.js";
|
|
7
|
+
import { fileExists, createUploadFormData } from "../../lib/utils.js";
|
|
8
|
+
import chalk from "chalk";
|
|
9
|
+
export function createWorkflowCreateCommand() {
|
|
10
|
+
return new Command("create")
|
|
11
|
+
.description("Create a new workflow from local files")
|
|
12
|
+
.requiredOption("--data <path>", "Path to data file (CSV or JSON)")
|
|
13
|
+
.option("--prompt <path>", "Path to prompt template file (.txt)")
|
|
14
|
+
.option("--prompt-inline <text>", "Inline prompt template string")
|
|
15
|
+
.option("--name <name>", "Workflow name")
|
|
16
|
+
.option("--key-field <field>", "Entity key field name")
|
|
17
|
+
.option("--key-expr <expression>", "Entity key expression (e.g., ${row.field})")
|
|
18
|
+
.option("--tools <tools>", "Comma-separated list of allowed tools")
|
|
19
|
+
.option("--concurrency <number>", "Max concurrent runs", "5")
|
|
20
|
+
.option("--max-turns <number>", "Max turns per run", "30")
|
|
21
|
+
.option("--permission-mode <mode>", "Permission mode", "acceptEdits")
|
|
22
|
+
.option("--system-prompt <text>", "System prompt prepended to all runs")
|
|
23
|
+
.option("--artifact-pattern <pattern>", "Artifact filename pattern")
|
|
24
|
+
.option("--run-timeout <minutes>", "Per-run timeout in minutes", "30")
|
|
25
|
+
.action(async (options) => {
|
|
26
|
+
try {
|
|
27
|
+
// Validate required options
|
|
28
|
+
if (!options.data) {
|
|
29
|
+
error("--data is required");
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
if (!options.prompt && !options.promptInline) {
|
|
33
|
+
error("Either --prompt or --prompt-inline is required");
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
if (!options.keyField && !options.keyExpr) {
|
|
37
|
+
error("Either --key-field or --key-expr is required");
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
// Check files exist
|
|
41
|
+
if (!fileExists(options.data)) {
|
|
42
|
+
error(`Data file not found: ${options.data}`);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
if (options.prompt && !fileExists(options.prompt)) {
|
|
46
|
+
error(`Prompt template file not found: ${options.prompt}`);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
// Build config
|
|
50
|
+
const config = {};
|
|
51
|
+
if (options.name)
|
|
52
|
+
config.name = options.name;
|
|
53
|
+
if (options.keyField)
|
|
54
|
+
config.entityKeyField = options.keyField;
|
|
55
|
+
if (options.keyExpr)
|
|
56
|
+
config.entityKeyExpression = options.keyExpr;
|
|
57
|
+
if (options.tools)
|
|
58
|
+
config.allowedTools = options.tools;
|
|
59
|
+
if (options.concurrency)
|
|
60
|
+
config.concurrency = options.concurrency;
|
|
61
|
+
if (options.maxTurns)
|
|
62
|
+
config.maxTurns = options.maxTurns;
|
|
63
|
+
if (options.permissionMode)
|
|
64
|
+
config.permissionMode = options.permissionMode;
|
|
65
|
+
if (options.systemPrompt)
|
|
66
|
+
config.systemPrompt = options.systemPrompt;
|
|
67
|
+
if (options.artifactPattern)
|
|
68
|
+
config.artifactPattern = options.artifactPattern;
|
|
69
|
+
if (options.runTimeout)
|
|
70
|
+
config.runTimeoutMinutes = options.runTimeout;
|
|
71
|
+
// Ensure name is set
|
|
72
|
+
if (!config.name) {
|
|
73
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
74
|
+
config.name = `workflow-${timestamp}`;
|
|
75
|
+
warn(`No name provided, using: ${config.name}`);
|
|
76
|
+
}
|
|
77
|
+
print("Uploading workflow...");
|
|
78
|
+
// Create FormData for upload
|
|
79
|
+
const formData = createUploadFormData({
|
|
80
|
+
dataFile: options.data,
|
|
81
|
+
promptTemplateFile: options.prompt,
|
|
82
|
+
promptTemplateInline: options.promptInline,
|
|
83
|
+
config,
|
|
84
|
+
});
|
|
85
|
+
// Upload using raw fetch (client's FormData doesn't work well in Node)
|
|
86
|
+
const client = getClient();
|
|
87
|
+
const baseUrl = client.baseUrl;
|
|
88
|
+
const response = await fetch(`${baseUrl}/workflows/upload`, {
|
|
89
|
+
method: "POST",
|
|
90
|
+
body: formData,
|
|
91
|
+
});
|
|
92
|
+
if (!response.ok) {
|
|
93
|
+
const errorText = await response.text();
|
|
94
|
+
let errorData;
|
|
95
|
+
try {
|
|
96
|
+
errorData = JSON.parse(errorText);
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
errorData = { error: errorText || "Upload failed" };
|
|
100
|
+
}
|
|
101
|
+
const errorMsg = errorData.error || errorData.message || errorText;
|
|
102
|
+
error(`Upload failed (HTTP ${response.status}): ${errorMsg}`);
|
|
103
|
+
if (errorData.details) {
|
|
104
|
+
console.error("Details:", errorData.details);
|
|
105
|
+
}
|
|
106
|
+
if (errorData.stack && process.env.DEBUG) {
|
|
107
|
+
console.error("Stack:", errorData.stack);
|
|
108
|
+
}
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
const result = await response.json();
|
|
112
|
+
// Print success
|
|
113
|
+
success(`Created workflow ${result.workflowId} with ${result.totalEntities} entities`);
|
|
114
|
+
console.log(` Status: ${result.status}`);
|
|
115
|
+
console.log(` Data: ${result.dataUrl}`);
|
|
116
|
+
if (result.promptTemplateUrl) {
|
|
117
|
+
console.log(` Prompt: ${result.promptTemplateUrl}`);
|
|
118
|
+
}
|
|
119
|
+
// Print sample preview
|
|
120
|
+
if (result.samplePreview) {
|
|
121
|
+
section("Sample Preview");
|
|
122
|
+
console.log(chalk.dim("─".repeat(60)));
|
|
123
|
+
console.log(chalk.bold(`Entity "${result.samplePreview.entityKey}"`));
|
|
124
|
+
console.log();
|
|
125
|
+
console.log(result.samplePreview.renderedPrompt);
|
|
126
|
+
console.log(chalk.dim("─".repeat(60)));
|
|
127
|
+
}
|
|
128
|
+
console.log();
|
|
129
|
+
print(chalk.dim(`Run \`giga workflow run ${result.workflowId} --first 5\` to start.`));
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
error(err.message || String(err));
|
|
133
|
+
process.exit(1);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=create.js.map
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../commands/workflow/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,wBAAgB,qBAAqB,IAAI,OAAO,CAgB/C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow command - combines all workflow subcommands
|
|
3
|
+
*/
|
|
4
|
+
import { Command } from "commander";
|
|
5
|
+
import { createWorkflowCreateCommand } from "./create.js";
|
|
6
|
+
import { createWorkflowValidateCommand } from "./validate.js";
|
|
7
|
+
import { createWorkflowStartCommand, createWorkflowNextCommand } from "./run.js";
|
|
8
|
+
import { createWorkflowStatusCommand } from "./status.js";
|
|
9
|
+
import { createWorkflowPauseCommand, createWorkflowCancelCommand } from "./control.js";
|
|
10
|
+
import { createWorkflowArtifactsCommand } from "./artifacts.js";
|
|
11
|
+
import { createWorkflowLogsCommand } from "./logs.js";
|
|
12
|
+
export function createWorkflowCommand() {
|
|
13
|
+
const workflow = new Command("workflow")
|
|
14
|
+
.description("Manage workflow orchestration");
|
|
15
|
+
// Add all subcommands
|
|
16
|
+
workflow.addCommand(createWorkflowCreateCommand());
|
|
17
|
+
workflow.addCommand(createWorkflowValidateCommand());
|
|
18
|
+
workflow.addCommand(createWorkflowStartCommand());
|
|
19
|
+
workflow.addCommand(createWorkflowNextCommand());
|
|
20
|
+
workflow.addCommand(createWorkflowStatusCommand());
|
|
21
|
+
workflow.addCommand(createWorkflowPauseCommand());
|
|
22
|
+
workflow.addCommand(createWorkflowCancelCommand());
|
|
23
|
+
workflow.addCommand(createWorkflowArtifactsCommand());
|
|
24
|
+
workflow.addCommand(createWorkflowLogsCommand());
|
|
25
|
+
return workflow;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../commands/workflow/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EA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