@agiflowai/cli 0.0.1-nightly.20260506-dm4stp

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/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 0.0.1-nightly.20260506-dm4stp
4
+
5
+ - Package prepared for release
package/README.md ADDED
@@ -0,0 +1,441 @@
1
+ # Agiflow CLI
2
+
3
+ `agiflow-cli` is the command-line interface for working with Agiflow projects, tasks, work units, workflow locks, artifacts, and automation runners.
4
+
5
+ It is designed for two modes of use:
6
+
7
+ - Humans working in a terminal.
8
+ - Automation systems that need stable JSON output for job discovery, claiming, and release.
9
+
10
+ ## Installation
11
+
12
+ Run with your package manager:
13
+
14
+ ```bash
15
+ npx @agiflowai/cli --help
16
+ ```
17
+
18
+ Or install it globally:
19
+
20
+ ```bash
21
+ npm install -g @agiflowai/cli
22
+ agiflow-cli --help
23
+ ```
24
+
25
+ ## API Endpoint
26
+
27
+ The CLI must know which Agiflow API to call. Set:
28
+
29
+ ```bash
30
+ export VITE_INJECT_BACKEND_AGIFLOW_API_ENDPOINT="https://api.example.com"
31
+ ```
32
+
33
+ `BACKEND_AGIFLOW_API_ENDPOINT` is also accepted as a runtime fallback.
34
+
35
+ For local development, point the variable at your local Agiflow API.
36
+
37
+ ## Authentication
38
+
39
+ Use device-code login for interactive use:
40
+
41
+ ```bash
42
+ agiflow-cli login
43
+ ```
44
+
45
+ Use an API key for automation or non-interactive environments:
46
+
47
+ ```bash
48
+ agiflow-cli login --api-key "$AGIFLOW_API_KEY" --org "$AGIFLOW_ORGANIZATION_ID"
49
+ ```
50
+
51
+ You can also avoid stored credentials and provide an API key through the environment:
52
+
53
+ ```bash
54
+ export AGIFLOW_API_KEY="..."
55
+ ```
56
+
57
+ To remove stored credentials:
58
+
59
+ ```bash
60
+ agiflow-cli logout
61
+ ```
62
+
63
+ ## Common Environment Variables
64
+
65
+ These variables can replace repeated command flags:
66
+
67
+ ```bash
68
+ export AGIFLOW_API_KEY="..."
69
+ export AGIFLOW_ORGANIZATION_ID="org-id"
70
+ export AGIFLOW_PROJECT_ID="project-id"
71
+ export AGIFLOW_TASK_ID="task-id"
72
+ export AGIFLOW_WORK_UNIT_ID="work-unit-id"
73
+ export AGIFLOW_DEVICE_ID="device-id"
74
+ ```
75
+
76
+ Flags take precedence over stored values and environment fallbacks.
77
+
78
+ ## Output Formats
79
+
80
+ Most user-facing commands print readable terminal output or formatted JSON.
81
+
82
+ Automation and resource commands are JSON-only and require or default to:
83
+
84
+ ```bash
85
+ --format json
86
+ ```
87
+
88
+ JSON-only command groups:
89
+
90
+ - `automation`
91
+ - `project`
92
+ - `task`
93
+ - `work-unit`
94
+ - `member`
95
+ - `task-comment`
96
+
97
+ ## Projects
98
+
99
+ ```bash
100
+ agiflow-cli project list --org "$AGIFLOW_ORGANIZATION_ID" --format json
101
+
102
+ agiflow-cli project create \
103
+ --org "$AGIFLOW_ORGANIZATION_ID" \
104
+ --name "CLI rollout" \
105
+ --description "Release automation work" \
106
+ --format json
107
+
108
+ agiflow-cli project get --org "$AGIFLOW_ORGANIZATION_ID" --project "$AGIFLOW_PROJECT_ID" --format json
109
+ ```
110
+
111
+ Available project commands:
112
+
113
+ ```bash
114
+ agiflow-cli project create
115
+ agiflow-cli project list
116
+ agiflow-cli project get
117
+ agiflow-cli project update
118
+ agiflow-cli project delete
119
+ ```
120
+
121
+ ## Tasks
122
+
123
+ ```bash
124
+ agiflow-cli task create \
125
+ --org "$AGIFLOW_ORGANIZATION_ID" \
126
+ --project "$AGIFLOW_PROJECT_ID" \
127
+ --title "Implement billing settings" \
128
+ --status todo \
129
+ --priority high \
130
+ --format json
131
+
132
+ agiflow-cli task list \
133
+ --org "$AGIFLOW_ORGANIZATION_ID" \
134
+ --project "$AGIFLOW_PROJECT_ID" \
135
+ --status todo,in_progress \
136
+ --limit 20 \
137
+ --format json
138
+ ```
139
+
140
+ Batch create tasks with JSON:
141
+
142
+ ```bash
143
+ agiflow-cli task batch-create \
144
+ --org "$AGIFLOW_ORGANIZATION_ID" \
145
+ --project "$AGIFLOW_PROJECT_ID" \
146
+ --tasks-json '[{"title":"First task"},{"title":"Second task"}]' \
147
+ --format json
148
+ ```
149
+
150
+ Available task commands:
151
+
152
+ ```bash
153
+ agiflow-cli task create
154
+ agiflow-cli task batch-create
155
+ agiflow-cli task list
156
+ agiflow-cli task get
157
+ agiflow-cli task active
158
+ agiflow-cli task update
159
+ agiflow-cli task delete
160
+ agiflow-cli task reorder
161
+ ```
162
+
163
+ ## Work Units
164
+
165
+ Work units group related tasks into larger chunks of work.
166
+
167
+ ```bash
168
+ agiflow-cli work-unit batch-create \
169
+ --org "$AGIFLOW_ORGANIZATION_ID" \
170
+ --project "$AGIFLOW_PROJECT_ID" \
171
+ --work-units-json '[{"title":"Billing settings","type":"feature","priority":"high"}]' \
172
+ --format json
173
+
174
+ agiflow-cli work-unit list \
175
+ --org "$AGIFLOW_ORGANIZATION_ID" \
176
+ --project "$AGIFLOW_PROJECT_ID" \
177
+ --status planning \
178
+ --format json
179
+ ```
180
+
181
+ Available work unit commands:
182
+
183
+ ```bash
184
+ agiflow-cli work-unit batch-create
185
+ agiflow-cli work-unit list
186
+ agiflow-cli work-unit get
187
+ agiflow-cli work-unit update
188
+ agiflow-cli work-unit delete
189
+ agiflow-cli work-unit progress
190
+ ```
191
+
192
+ ## Agent Members
193
+
194
+ Agent members represent automation-capable project participants.
195
+
196
+ ```bash
197
+ agiflow-cli member list \
198
+ --org "$AGIFLOW_ORGANIZATION_ID" \
199
+ --format json
200
+
201
+ agiflow-cli member create \
202
+ --org "$AGIFLOW_ORGANIZATION_ID" \
203
+ --email "agent@example.com" \
204
+ --name "Build Agent" \
205
+ --description "Handles build and release work" \
206
+ --format json
207
+ ```
208
+
209
+ ## Task Comments
210
+
211
+ ```bash
212
+ agiflow-cli task-comment create \
213
+ --org "$AGIFLOW_ORGANIZATION_ID" \
214
+ --task "$AGIFLOW_TASK_ID" \
215
+ --content "Starting implementation." \
216
+ --format json
217
+
218
+ agiflow-cli task-comment list \
219
+ --org "$AGIFLOW_ORGANIZATION_ID" \
220
+ --task "$AGIFLOW_TASK_ID" \
221
+ --format json
222
+ ```
223
+
224
+ ## Automation Jobs
225
+
226
+ Automation commands print machine-readable JSON only. They are intended for runners, agents, schedulers, and CI systems.
227
+
228
+ List runnable jobs:
229
+
230
+ ```bash
231
+ agiflow-cli automation list-jobs \
232
+ --org "$AGIFLOW_ORGANIZATION_ID" \
233
+ --project "$AGIFLOW_PROJECT_ID" \
234
+ --status planning,todo \
235
+ --limit 50 \
236
+ --format json
237
+ ```
238
+
239
+ Get a normalized job:
240
+
241
+ ```bash
242
+ agiflow-cli automation get-job \
243
+ --org "$AGIFLOW_ORGANIZATION_ID" \
244
+ --project "$AGIFLOW_PROJECT_ID" \
245
+ --job-kind work-unit \
246
+ --job-id "$AGIFLOW_WORK_UNIT_ID" \
247
+ --format json
248
+ ```
249
+
250
+ Claim a job:
251
+
252
+ ```bash
253
+ agiflow-cli automation claim-job \
254
+ --org "$AGIFLOW_ORGANIZATION_ID" \
255
+ --project "$AGIFLOW_PROJECT_ID" \
256
+ --job-kind work-unit \
257
+ --job-id "$AGIFLOW_WORK_UNIT_ID" \
258
+ --name "runner-$(date +%Y%m%d%H%M%S)" \
259
+ --device-id "$AGIFLOW_DEVICE_ID" \
260
+ --format json
261
+ ```
262
+
263
+ If a job is already claimed, the command returns JSON with `claimed: false` instead of printing a stack trace.
264
+
265
+ Release a claimed job:
266
+
267
+ ```bash
268
+ agiflow-cli automation release-job \
269
+ --org "$AGIFLOW_ORGANIZATION_ID" \
270
+ --project "$AGIFLOW_PROJECT_ID" \
271
+ --workflow-id "$WORKFLOW_ID" \
272
+ --status completed \
273
+ --format json
274
+ ```
275
+
276
+ Release with an error:
277
+
278
+ ```bash
279
+ agiflow-cli automation release-job \
280
+ --org "$AGIFLOW_ORGANIZATION_ID" \
281
+ --project "$AGIFLOW_PROJECT_ID" \
282
+ --workflow-id "$WORKFLOW_ID" \
283
+ --status failed \
284
+ --error "Build failed" \
285
+ --format json
286
+ ```
287
+
288
+ Filter claimed jobs by runner identity:
289
+
290
+ ```bash
291
+ agiflow-cli automation list-jobs \
292
+ --org "$AGIFLOW_ORGANIZATION_ID" \
293
+ --project "$AGIFLOW_PROJECT_ID" \
294
+ --claimed \
295
+ --device-id "$AGIFLOW_DEVICE_ID" \
296
+ --format json
297
+ ```
298
+
299
+ ## Workflow Locks
300
+
301
+ Workflow locks are lower-level primitives for coordinating active work.
302
+
303
+ ```bash
304
+ agiflow-cli workflow create \
305
+ --org "$AGIFLOW_ORGANIZATION_ID" \
306
+ --project "$AGIFLOW_PROJECT_ID" \
307
+ --work-unit "$AGIFLOW_WORK_UNIT_ID" \
308
+ --name "release-run"
309
+
310
+ agiflow-cli workflow check \
311
+ --org "$AGIFLOW_ORGANIZATION_ID" \
312
+ --project "$AGIFLOW_PROJECT_ID" \
313
+ --work-unit "$AGIFLOW_WORK_UNIT_ID"
314
+
315
+ agiflow-cli workflow release "$WORKFLOW_ID" \
316
+ --org "$AGIFLOW_ORGANIZATION_ID" \
317
+ --project "$AGIFLOW_PROJECT_ID" \
318
+ --status completed
319
+ ```
320
+
321
+ Available workflow commands:
322
+
323
+ ```bash
324
+ agiflow-cli workflow create
325
+ agiflow-cli workflow get
326
+ agiflow-cli workflow list
327
+ agiflow-cli workflow update
328
+ agiflow-cli workflow release
329
+ agiflow-cli workflow check
330
+ ```
331
+
332
+ ## Artifacts
333
+
334
+ Artifacts are project files stored through the Agiflow API.
335
+
336
+ ```bash
337
+ agiflow-cli artifact upload ./report.json \
338
+ --org "$AGIFLOW_ORGANIZATION_ID" \
339
+ --project "$AGIFLOW_PROJECT_ID" \
340
+ --name report.json \
341
+ --type application/json
342
+
343
+ agiflow-cli artifact list \
344
+ --org "$AGIFLOW_ORGANIZATION_ID" \
345
+ --project "$AGIFLOW_PROJECT_ID"
346
+
347
+ agiflow-cli artifact download "artifact-key" \
348
+ --org "$AGIFLOW_ORGANIZATION_ID" \
349
+ --project "$AGIFLOW_PROJECT_ID" \
350
+ --output ./report.json
351
+ ```
352
+
353
+ Artifact upload requires artifact storage to be configured on the Agiflow API.
354
+
355
+ ## Automation Runner Pattern
356
+
357
+ A typical runner loop looks like this:
358
+
359
+ ```bash
360
+ job_json=$(agiflow-cli automation list-jobs \
361
+ --org "$AGIFLOW_ORGANIZATION_ID" \
362
+ --project "$AGIFLOW_PROJECT_ID" \
363
+ --status planning,todo \
364
+ --limit 1 \
365
+ --format json)
366
+
367
+ job_id=$(printf '%s' "$job_json" | jq -r '.items[0].id // empty')
368
+ job_kind=$(printf '%s' "$job_json" | jq -r '.items[0].kind // empty')
369
+
370
+ if [ -n "$job_id" ]; then
371
+ claim_json=$(agiflow-cli automation claim-job \
372
+ --org "$AGIFLOW_ORGANIZATION_ID" \
373
+ --project "$AGIFLOW_PROJECT_ID" \
374
+ --job-kind "$job_kind" \
375
+ --job-id "$job_id" \
376
+ --name "runner-$(hostname)" \
377
+ --format json)
378
+
379
+ workflow_id=$(printf '%s' "$claim_json" | jq -r '.workflowId // empty')
380
+
381
+ if [ -n "$workflow_id" ]; then
382
+ # Do the work here.
383
+ agiflow-cli automation release-job \
384
+ --org "$AGIFLOW_ORGANIZATION_ID" \
385
+ --project "$AGIFLOW_PROJECT_ID" \
386
+ --workflow-id "$workflow_id" \
387
+ --status completed \
388
+ --format json
389
+ fi
390
+ fi
391
+ ```
392
+
393
+ ## Troubleshooting
394
+
395
+ ### Missing API endpoint
396
+
397
+ Set the API endpoint:
398
+
399
+ ```bash
400
+ export VITE_INJECT_BACKEND_AGIFLOW_API_ENDPOINT="https://api.example.com"
401
+ ```
402
+
403
+ ### Missing API key
404
+
405
+ Authenticate or provide an API key:
406
+
407
+ ```bash
408
+ agiflow-cli login
409
+ ```
410
+
411
+ or:
412
+
413
+ ```bash
414
+ export AGIFLOW_API_KEY="..."
415
+ ```
416
+
417
+ ### Multiple organizations
418
+
419
+ Pass the organization explicitly in non-interactive environments:
420
+
421
+ ```bash
422
+ agiflow-cli login --api-key "$AGIFLOW_API_KEY" --org "$AGIFLOW_ORGANIZATION_ID"
423
+ ```
424
+
425
+ ### JSON parsing in shell scripts
426
+
427
+ Use `jq` for automation commands:
428
+
429
+ ```bash
430
+ agiflow-cli automation list-jobs --format json | jq '.items'
431
+ ```
432
+
433
+ ### Help
434
+
435
+ Use command-specific help to see all available options:
436
+
437
+ ```bash
438
+ agiflow-cli --help
439
+ agiflow-cli automation claim-job --help
440
+ agiflow-cli task create --help
441
+ ```
package/dist/cli.js ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+ import { n as e, t } from "./container-B7AsyVLJ.js";
3
+ import "reflect-metadata/lite";
4
+ import { Command as n, CommanderError as r } from "commander";
5
+ import i from "dotenv";
6
+ //#region src/systems/cli/entry/cli.ts
7
+ var a = process.stdout.write.bind(process.stdout);
8
+ process.stdout.write = () => !0;
9
+ try {
10
+ i.config({ debug: !1 });
11
+ } finally {
12
+ process.stdout.write = a;
13
+ }
14
+ async function o() {
15
+ let i = new n(), a = new Set([
16
+ "automation",
17
+ "project",
18
+ "task",
19
+ "work-unit",
20
+ "member",
21
+ "task-comment"
22
+ ]), o = process.argv.slice(2).some((e) => a.has(e)), s = process.stderr.write.bind(process.stderr);
23
+ i.name("agiflow-cli").description("Command-line interface for Agiflow workflow and artifact management").option("-v, --verbose", "enable verbose logging").option("--debug", "enable debug mode"), i.exitOverride(), i.configureOutput({ writeErr: (e) => {
24
+ o || s(e);
25
+ } });
26
+ let c = t.get(e.AuthCommand), l = t.get(e.WorkflowCommand), u = t.get(e.ArtifactCommand), d = t.get(e.AutomationCommand), f = t.get(e.ProjectCommand), p = t.get(e.TaskCommand), m = t.get(e.WorkUnitCommand), h = t.get(e.MemberCommand), g = t.get(e.TaskCommentCommand);
27
+ c.register(i), l.register(i), u.register(i), d.register(i), f.register(i), p.register(i), m.register(i), h.register(i), g.register(i);
28
+ try {
29
+ await i.parseAsync(process.argv);
30
+ } catch (e) {
31
+ if (e instanceof r && e.code === "commander.helpDisplayed" && process.exit(e.exitCode), o) {
32
+ let t = e instanceof Error ? e.message : String(e);
33
+ console.log(JSON.stringify({ error: t }, null, 2)), process.exit(1);
34
+ }
35
+ console.error("[cli] error", e.message), i.opts().debug && e instanceof Error && console.error(e.stack), process.exit(1);
36
+ }
37
+ }
38
+ o();
39
+ //#endregion