@bastani/atomic 0.5.18-0 → 0.5.19-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.
- package/.agents/skills/workflow-creator/SKILL.md +110 -1
- package/.agents/skills/workflow-creator/references/workflow-inputs.md +10 -0
- package/.mcp.json +9 -0
- package/.opencode/opencode.json +5 -2
- package/README.md +394 -645
- package/assets/settings.schema.json +0 -20
- package/dist/sdk/components/attached-statusline.d.ts +13 -0
- package/dist/sdk/components/attached-statusline.d.ts.map +1 -0
- package/dist/sdk/components/header.d.ts.map +1 -1
- package/dist/sdk/components/session-graph-panel.d.ts.map +1 -1
- package/dist/sdk/components/statusline.d.ts +1 -3
- package/dist/sdk/components/statusline.d.ts.map +1 -1
- package/dist/sdk/providers/claude.d.ts +16 -5
- package/dist/sdk/providers/claude.d.ts.map +1 -1
- package/dist/sdk/runtime/executor.d.ts +63 -0
- package/dist/sdk/runtime/executor.d.ts.map +1 -1
- package/dist/sdk/runtime/tmux.d.ts +0 -9
- package/dist/sdk/runtime/tmux.d.ts.map +1 -1
- package/dist/services/config/atomic-config.d.ts +1 -7
- package/dist/services/config/atomic-config.d.ts.map +1 -1
- package/dist/services/config/definitions.d.ts +0 -45
- package/dist/services/config/definitions.d.ts.map +1 -1
- package/dist/services/config/index.d.ts +1 -1
- package/dist/theme/colors.d.ts +33 -0
- package/dist/theme/colors.d.ts.map +1 -0
- package/package.json +3 -2
- package/src/cli.ts +16 -1
- package/src/commands/cli/chat/index.ts +1 -1
- package/src/commands/cli/footer.tsx +118 -0
- package/src/commands/cli/init/index.ts +6 -89
- package/src/commands/cli/workflow-command.test.ts +146 -0
- package/src/commands/cli/workflow.ts +43 -7
- package/src/completions/bash.ts +3 -8
- package/src/completions/fish.ts +1 -3
- package/src/completions/powershell.ts +1 -17
- package/src/completions/zsh.ts +0 -2
- package/src/scripts/bundle-configs.ts +0 -12
- package/src/sdk/components/attached-statusline.tsx +33 -0
- package/src/sdk/components/header.tsx +16 -2
- package/src/sdk/components/session-graph-panel.tsx +10 -51
- package/src/sdk/components/statusline.tsx +0 -17
- package/src/sdk/providers/claude.ts +179 -177
- package/src/sdk/runtime/executor-entry.ts +3 -1
- package/src/sdk/runtime/executor.test.ts +292 -1
- package/src/sdk/runtime/executor.ts +222 -1
- package/src/sdk/runtime/tmux.conf +35 -4
- package/src/sdk/runtime/tmux.ts +0 -22
- package/src/services/config/atomic-config.ts +1 -14
- package/src/services/config/definitions.ts +1 -102
- package/src/services/config/index.ts +1 -1
- package/src/services/config/settings.ts +2 -65
- package/src/services/system/skills.ts +2 -19
- package/src/commands/cli/init/scm.ts +0 -175
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: workflow-creator
|
|
3
|
-
description: Create multi-agent workflows for Atomic CLI using defineWorkflow().run().compile() with ctx.stage() for session orchestration across Claude, Copilot, and OpenCode SDKs. Use whenever the user wants to create, edit, or
|
|
3
|
+
description: Create multi-agent workflows for Atomic CLI using defineWorkflow().run().compile() with ctx.stage() for session orchestration across Claude, Copilot, and OpenCode SDKs, AND invoke existing workflows on behalf of the user. Use whenever the user wants to create, edit, debug, or RUN workflows ("run the ralph workflow", "kick off deep-research-codebase", "start the gen-spec workflow"), build agent pipelines, define multi-stage automations, set up review loops, declare workflow inputs, run background/headless stages, or mentions .atomic/workflows/, defineWorkflow, ctx.stage, ctx.inputs, headless, background stages, the atomic workflow picker, or `atomic workflow -n`.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Workflow Creator
|
|
@@ -209,6 +209,9 @@ Workflows that accept a free-form prompt should declare it explicitly: `{ name:
|
|
|
209
209
|
| Named, structured | `atomic workflow -n gen-spec -a claude --research_doc=notes.md` | Scripted structured runs |
|
|
210
210
|
| Interactive picker | `atomic workflow -a claude` | Discovery; shows fuzzy list + form |
|
|
211
211
|
| List | `atomic workflow -l` | Browse everything by source |
|
|
212
|
+
| Detached (background) | `atomic workflow -n ralph -a claude -d "..."` | Scripted/CI runs where the caller shouldn't block on the TUI — the orchestrator keeps running on the atomic tmux socket; attach later with `atomic workflow session connect <name>` |
|
|
213
|
+
|
|
214
|
+
Any of the named shapes above (positional or structured) accepts `-d` / `--detach` to run without attaching. Use it when you're automating from a script and want the CLI to return as soon as the session is spawned.
|
|
212
215
|
|
|
213
216
|
**Builtin workflows are reserved** — local/global workflows cannot shadow them. Pick distinct names.
|
|
214
217
|
|
|
@@ -341,4 +344,110 @@ atomic workflow -n <workflow-name> -a <agent> --research_doc=notes.md --focus=st
|
|
|
341
344
|
|
|
342
345
|
# Interactive picker (discovery)
|
|
343
346
|
atomic workflow -a <agent>
|
|
347
|
+
|
|
348
|
+
# Detached — run in the background without attaching. Useful when testing
|
|
349
|
+
# from scripts or CI, or when the workflow will run long enough that you
|
|
350
|
+
# want your terminal back. Reattach later with:
|
|
351
|
+
# atomic workflow session connect <printed-session-name>
|
|
352
|
+
atomic workflow -n <workflow-name> -a <agent> -d "<your prompt>"
|
|
344
353
|
```
|
|
354
|
+
|
|
355
|
+
## Running a Workflow on Behalf of the User
|
|
356
|
+
|
|
357
|
+
When the user asks you to **run** (or "kick off" / "start" / "execute") a workflow — *not* author one — your job is to translate their request into a single `atomic workflow` invocation and run it. This section is the playbook for that flow. It is different from the authoring playbook above: the workflow already exists on disk; you just need to invoke it correctly.
|
|
358
|
+
|
|
359
|
+
### You don't need to pass `-a` or `-d`
|
|
360
|
+
|
|
361
|
+
When you (the agent) are running inside an atomic chat or workflow pane, the CLI reads `$ATOMIC_AGENT` from your environment and:
|
|
362
|
+
|
|
363
|
+
- Fills in `-a <agent>` automatically if you don't pass it.
|
|
364
|
+
- Forces detached mode on, so launching a workflow never takes over your pane.
|
|
365
|
+
|
|
366
|
+
The practical result: your command is just `atomic workflow -n <name> <inputs>`. No provider flag, no detach flag, no chance of the orchestrator hijacking your terminal. The CLI prints the session name and returns immediately; you relay that name to the user.
|
|
367
|
+
|
|
368
|
+
Override only when the user explicitly asks for a different provider (e.g. "run it on Copilot") — pass `-a copilot` and the CLI will honor it over the env var.
|
|
369
|
+
|
|
370
|
+
### Always list first
|
|
371
|
+
|
|
372
|
+
**Before anything else, run `atomic workflow list`.** (Optionally filter with `-a <agent>` if the user's pinned to one — usually unnecessary.) This is a cheap, read-only call that tells you three things in one shot:
|
|
373
|
+
|
|
374
|
+
- Whether the workflow the user named actually exists.
|
|
375
|
+
- What other workflows are available (so you can suggest close matches on a typo).
|
|
376
|
+
- Source + metadata for every discoverable workflow (local vs. global vs. builtin).
|
|
377
|
+
|
|
378
|
+
Skipping this step is how you end up guessing a name, typing it into `atomic workflow -n <name>`, and getting a `workflow not found` error you could have predicted. List first, decide second, run third.
|
|
379
|
+
|
|
380
|
+
If the user's request is ambiguous ("run the research one"), the list output is also how you show them the candidates so they can pick — present the matching names and ask with AskUserQuestion.
|
|
381
|
+
|
|
382
|
+
### If the workflow doesn't exist: offer to create it
|
|
383
|
+
|
|
384
|
+
When the listed workflows don't include what the user asked for:
|
|
385
|
+
|
|
386
|
+
1. **Tell the user explicitly** — "I don't see a `<name>` workflow in `.atomic/workflows/` or `~/.atomic/workflows/`. Available: \<short list from `atomic workflow list`>."
|
|
387
|
+
2. **Check for typos first** — if one of the listed names is a close match, surface it via AskUserQuestion ("Did you mean `<close-match>`?") before offering to author anything.
|
|
388
|
+
3. **Offer to create it** — ask with AskUserQuestion: "Want me to create a `<name>` workflow first?" with choices `Yes, create it` / `No, pick from the list` / `No, cancel`.
|
|
389
|
+
4. **If yes → switch modes** — hand off to the authoring flow in the [Authoring Process](#authoring-process) section above (Steps 1-5). Interview the user for intent, write the file at `.atomic/workflows/<name>/<agent>/index.ts`, typecheck it, *then* come back to this runner section and invoke it. Do not skip the typecheck — an uncompiled workflow won't run.
|
|
390
|
+
5. **If no → stop** — don't fabricate a command that will fail. Let the user redirect you.
|
|
391
|
+
|
|
392
|
+
Never invent a workflow name or silently fall back to a different workflow. If the thing the user asked for doesn't exist, the correct answer is to say so and offer concrete next steps.
|
|
393
|
+
|
|
394
|
+
### Collecting inputs with AskUserQuestion
|
|
395
|
+
|
|
396
|
+
Once you've confirmed the workflow exists, you need to know two things about its invocation shape:
|
|
397
|
+
|
|
398
|
+
1. **Does it declare a `prompt` input?** If so, it's free-form — you pass a positional string.
|
|
399
|
+
2. **Does it declare structured inputs?** If so, you pass `--<field>=<value>` flags, one per required field.
|
|
400
|
+
|
|
401
|
+
Read the workflow file at `.atomic/workflows/<name>/<agent>/index.ts` and inspect the `inputs` array. The `atomic workflow list` output is good for discovery but doesn't print the full schema — for accurate field types, requireds, and enum values, read the source.
|
|
402
|
+
|
|
403
|
+
Once you know the schema, use the **AskUserQuestion tool** to collect any values the user hasn't already provided in their message. One question per missing input field. For enum fields, pass the declared `values` as multiple-choice options so the user sees exactly what's allowed. Keep questions tight and purposeful — if the user's message already answers a question, don't ask it again.
|
|
404
|
+
|
|
405
|
+
Skip AskUserQuestion entirely when:
|
|
406
|
+
- The user already supplied every required value in their message ("run ralph on 'add OAuth to the API'" — the prompt is right there).
|
|
407
|
+
- The workflow declares no required inputs and needs no prompt.
|
|
408
|
+
|
|
409
|
+
### End-to-end recipe
|
|
410
|
+
|
|
411
|
+
1. **List available workflows** — run `atomic workflow list`. Always. This is your ground truth.
|
|
412
|
+
2. **Resolve the target**:
|
|
413
|
+
- Exact match in the list → continue.
|
|
414
|
+
- Close match → confirm via AskUserQuestion before proceeding.
|
|
415
|
+
- No match → tell the user what's available and offer to author it (see previous section). If they decline, stop.
|
|
416
|
+
3. **Discover the inputs schema** — read the workflow source file and inspect `inputs`.
|
|
417
|
+
4. **Ask for missing inputs** — use AskUserQuestion, one question per unanswered required field. Enums become multiple-choice.
|
|
418
|
+
5. **Invoke** — build one of these commands:
|
|
419
|
+
- Free-form: `atomic workflow -n <name> "<prompt>"`
|
|
420
|
+
- Structured: `atomic workflow -n <name> --<field1>=<value1> --<field2>=<value2>`
|
|
421
|
+
6. **Report the session name** the CLI printed and tell the user: "attach any time with `atomic workflow session connect <session>` — or `atomic workflow session list` to see what's running."
|
|
422
|
+
|
|
423
|
+
### Worked examples
|
|
424
|
+
|
|
425
|
+
**Example A — workflow exists, structured inputs**
|
|
426
|
+
|
|
427
|
+
> **User:** "run gen-spec on research/docs/2026-04-11-auth.md"
|
|
428
|
+
|
|
429
|
+
1. Run `atomic workflow list`. Output includes `gen-spec` under local. Good.
|
|
430
|
+
2. Target resolved exactly: `gen-spec`.
|
|
431
|
+
3. Read the workflow source → inputs are `research_doc` (required string — already given), `focus` (required enum of `minimal|standard|exhaustive`, no default), `notes` (optional text).
|
|
432
|
+
4. Ask via AskUserQuestion once: "What focus level for the spec?" with choices `minimal`, `standard`, `exhaustive`. User picks `standard`. Skip `notes` since it's optional.
|
|
433
|
+
5. Run: `atomic workflow -n gen-spec --research_doc=research/docs/2026-04-11-auth.md --focus=standard`
|
|
434
|
+
6. The CLI prints a session name like `atomic-wf-claude-gen-spec-a1b2c3d4`. Tell the user: "Started in the background. Attach with `atomic workflow session connect atomic-wf-claude-gen-spec-a1b2c3d4` or check progress with `atomic workflow session list`."
|
|
435
|
+
|
|
436
|
+
**Example B — workflow does not exist**
|
|
437
|
+
|
|
438
|
+
> **User:** "run the security-audit workflow on src/auth"
|
|
439
|
+
|
|
440
|
+
1. Run `atomic workflow list`. Available: `ralph`, `deep-research-codebase`, `gen-spec`, `review-to-merge`. No `security-audit`.
|
|
441
|
+
2. Tell the user: "I don't see a `security-audit` workflow. Available: ralph, deep-research-codebase, gen-spec, review-to-merge."
|
|
442
|
+
3. Ask via AskUserQuestion: "Want me to create a `security-audit` workflow first?" with choices `Yes, create it`, `No, use one of the existing workflows`, `No, cancel`.
|
|
443
|
+
4. If **Yes**: switch to the Authoring Process — interview the user for what the workflow should do, draft it, typecheck, *then* return here and invoke it.
|
|
444
|
+
5. If **No, use existing**: ask which one via AskUserQuestion over the listed options, then continue from step 3 of the recipe.
|
|
445
|
+
6. If **Cancel**: stop, no command runs.
|
|
446
|
+
|
|
447
|
+
### Common mistakes to avoid
|
|
448
|
+
|
|
449
|
+
- **Skipping `atomic workflow list`** — leads to guessing and `workflow not found` errors. It's a one-line command; always run it.
|
|
450
|
+
- **Inventing a workflow name** — if it's not in the list, it doesn't exist. Say so and offer to author it.
|
|
451
|
+
- **Asking everything at once** — let AskUserQuestion drive one question per field. Enum fields are multiple-choice, not free text.
|
|
452
|
+
- **Re-asking what the user already said** — read their message first.
|
|
453
|
+
- **Forgetting to report the session name** — the user needs it to reattach.
|
|
@@ -241,12 +241,22 @@ atomic workflow -n gen-spec -a claude \
|
|
|
241
241
|
|
|
242
242
|
# Structured, long-form flag value (= form)
|
|
243
243
|
atomic workflow -n gen-spec -a claude --focus standard --research_doc notes.md
|
|
244
|
+
|
|
245
|
+
# Detached (background) — starts the orchestrator on the atomic tmux
|
|
246
|
+
# socket and returns immediately. The command prints the session name
|
|
247
|
+
# and hints for attaching later. Use this for scripted / CI runs where
|
|
248
|
+
# the caller shouldn't block on the TUI.
|
|
249
|
+
atomic workflow -n hello -a claude -d "hello world"
|
|
250
|
+
atomic workflow session connect atomic-wf-claude-hello-<id> # attach later
|
|
244
251
|
```
|
|
245
252
|
|
|
246
253
|
Both `--flag=value` and `--flag value` forms are accepted. Short flags
|
|
247
254
|
(`-x value`) are NOT parsed as structured inputs — only long-form
|
|
248
255
|
`--<name>` flags resolve against the schema.
|
|
249
256
|
|
|
257
|
+
The `-d` / `--detach` flag composes with any named shape (positional
|
|
258
|
+
prompt, structured flags) and is independent of the inputs schema.
|
|
259
|
+
|
|
250
260
|
## Pitfalls
|
|
251
261
|
|
|
252
262
|
### Declare every field you access
|
package/.mcp.json
ADDED
package/.opencode/opencode.json
CHANGED
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
"$schema": "https://opencode.ai/config.json",
|
|
3
3
|
"permission": "allow",
|
|
4
4
|
"mcp": {
|
|
5
|
-
"
|
|
5
|
+
"github": {
|
|
6
6
|
"type": "remote",
|
|
7
|
-
"url": "https://
|
|
7
|
+
"url": "https://api.githubcopilot.com/mcp",
|
|
8
|
+
"headers": {
|
|
9
|
+
"Authorization": "Bearer ${env:GITHUB_PERSONAL_ACCESS_TOKEN}"
|
|
10
|
+
}
|
|
8
11
|
}
|
|
9
12
|
}
|
|
10
13
|
}
|