@bastani/atomic 0.5.34-0 → 0.6.0-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.
Files changed (94) hide show
  1. package/README.md +329 -50
  2. package/dist/commands/cli/session.d.ts +67 -0
  3. package/dist/commands/cli/session.d.ts.map +1 -0
  4. package/dist/commands/cli/workflow-status.d.ts +63 -0
  5. package/dist/commands/cli/workflow-status.d.ts.map +1 -0
  6. package/dist/sdk/commander.d.ts +74 -0
  7. package/dist/sdk/commander.d.ts.map +1 -0
  8. package/dist/sdk/components/workflow-picker-panel.d.ts +14 -17
  9. package/dist/sdk/components/workflow-picker-panel.d.ts.map +1 -1
  10. package/dist/sdk/define-workflow.d.ts +18 -9
  11. package/dist/sdk/define-workflow.d.ts.map +1 -1
  12. package/dist/sdk/index.d.ts +4 -3
  13. package/dist/sdk/index.d.ts.map +1 -1
  14. package/dist/sdk/management-commands.d.ts +42 -0
  15. package/dist/sdk/management-commands.d.ts.map +1 -0
  16. package/dist/sdk/registry.d.ts +27 -0
  17. package/dist/sdk/registry.d.ts.map +1 -0
  18. package/dist/sdk/runtime/attached-footer.d.ts +1 -1
  19. package/dist/sdk/runtime/executor-env.d.ts +20 -0
  20. package/dist/sdk/runtime/executor-env.d.ts.map +1 -0
  21. package/dist/sdk/runtime/executor.d.ts +61 -10
  22. package/dist/sdk/runtime/executor.d.ts.map +1 -1
  23. package/dist/sdk/types.d.ts +147 -4
  24. package/dist/sdk/types.d.ts.map +1 -1
  25. package/dist/sdk/worker-shared.d.ts +42 -0
  26. package/dist/sdk/worker-shared.d.ts.map +1 -0
  27. package/dist/sdk/workflow-cli.d.ts +103 -0
  28. package/dist/sdk/workflow-cli.d.ts.map +1 -0
  29. package/dist/sdk/workflows/builtin-registry.d.ts +113 -0
  30. package/dist/sdk/workflows/builtin-registry.d.ts.map +1 -0
  31. package/dist/sdk/workflows/index.d.ts +5 -5
  32. package/dist/sdk/workflows/index.d.ts.map +1 -1
  33. package/package.json +12 -8
  34. package/src/cli.ts +85 -144
  35. package/src/commands/cli/chat/index.ts +10 -0
  36. package/src/commands/cli/workflow-command.test.ts +279 -938
  37. package/src/commands/cli/workflow-inputs.test.ts +41 -11
  38. package/src/commands/cli/workflow-inputs.ts +47 -12
  39. package/src/commands/cli/workflow-list.test.ts +234 -0
  40. package/src/commands/cli/workflow-list.ts +0 -0
  41. package/src/commands/cli/workflow.ts +11 -798
  42. package/src/scripts/constants.ts +2 -1
  43. package/src/sdk/commander.ts +161 -0
  44. package/src/sdk/components/workflow-picker-panel.tsx +78 -258
  45. package/src/sdk/define-workflow.test.ts +104 -11
  46. package/src/sdk/define-workflow.ts +47 -11
  47. package/src/sdk/errors.test.ts +16 -0
  48. package/src/sdk/index.ts +8 -8
  49. package/src/sdk/management-commands.ts +151 -0
  50. package/src/sdk/registry.ts +132 -0
  51. package/src/sdk/runtime/attached-footer.ts +1 -1
  52. package/src/sdk/runtime/executor-env.ts +45 -0
  53. package/src/sdk/runtime/executor.test.ts +37 -0
  54. package/src/sdk/runtime/executor.ts +147 -68
  55. package/src/sdk/types.ts +169 -4
  56. package/src/sdk/worker-shared.test.ts +163 -0
  57. package/src/sdk/worker-shared.ts +155 -0
  58. package/src/sdk/workflow-cli.ts +409 -0
  59. package/src/sdk/workflows/builtin/deep-research-codebase/claude/index.ts +1 -1
  60. package/src/sdk/workflows/builtin/deep-research-codebase/copilot/index.ts +1 -1
  61. package/src/sdk/workflows/builtin/deep-research-codebase/opencode/index.ts +1 -1
  62. package/src/sdk/workflows/builtin/open-claude-design/claude/index.ts +1 -1
  63. package/src/sdk/workflows/builtin/open-claude-design/copilot/index.ts +1 -1
  64. package/src/sdk/workflows/builtin/open-claude-design/opencode/index.ts +1 -1
  65. package/src/sdk/workflows/builtin/ralph/claude/index.ts +1 -1
  66. package/src/sdk/workflows/builtin/ralph/copilot/index.ts +1 -1
  67. package/src/sdk/workflows/builtin/ralph/opencode/index.ts +1 -1
  68. package/src/sdk/workflows/builtin-registry.ts +23 -0
  69. package/src/sdk/workflows/index.ts +10 -20
  70. package/src/services/system/auth.test.ts +63 -1
  71. package/.agents/skills/workflow-creator/SKILL.md +0 -334
  72. package/.agents/skills/workflow-creator/references/agent-sessions.md +0 -888
  73. package/.agents/skills/workflow-creator/references/computation-and-validation.md +0 -201
  74. package/.agents/skills/workflow-creator/references/control-flow.md +0 -470
  75. package/.agents/skills/workflow-creator/references/discovery-and-verification.md +0 -232
  76. package/.agents/skills/workflow-creator/references/failure-modes.md +0 -903
  77. package/.agents/skills/workflow-creator/references/getting-started.md +0 -275
  78. package/.agents/skills/workflow-creator/references/running-workflows.md +0 -235
  79. package/.agents/skills/workflow-creator/references/session-config.md +0 -384
  80. package/.agents/skills/workflow-creator/references/state-and-data-flow.md +0 -357
  81. package/.agents/skills/workflow-creator/references/user-input.md +0 -234
  82. package/.agents/skills/workflow-creator/references/workflow-inputs.md +0 -272
  83. package/dist/sdk/runtime/discovery.d.ts +0 -132
  84. package/dist/sdk/runtime/discovery.d.ts.map +0 -1
  85. package/dist/sdk/runtime/executor-entry.d.ts +0 -11
  86. package/dist/sdk/runtime/executor-entry.d.ts.map +0 -1
  87. package/dist/sdk/runtime/loader.d.ts +0 -70
  88. package/dist/sdk/runtime/loader.d.ts.map +0 -1
  89. package/dist/version.d.ts +0 -2
  90. package/dist/version.d.ts.map +0 -1
  91. package/src/commands/cli/workflow.test.ts +0 -317
  92. package/src/sdk/runtime/discovery.ts +0 -368
  93. package/src/sdk/runtime/executor-entry.ts +0 -18
  94. package/src/sdk/runtime/loader.ts +0 -267
@@ -1 +1 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/sdk/runtime/executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,KAAK,EACV,kBAAkB,EAElB,aAAa,EAKb,SAAS,EAET,YAAY,EAMb,MAAM,aAAa,CAAC;AA0ErB,OAAO,EAAE,YAAY,EAAE,MAAM,c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AsB;IAC9B,aAAa,EAAE,4BAA4B,CAAC;IAC5C,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,aAAa,EAAE,kBAAkB,CAAC,SAAS,CAAC,EAC5C,kBAAkB,CAAC,EAAE,MAAM,GAC1B,sBAAsB,CAsBxB;AAomBD;;;;;;;;;GASG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAG5D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,KAAK,kBAAkB,GAAG,SAAS,GAC1E,OAAO,CAAC,OAAO,CAAC,CAmBlB;AAED,wBAAsB,eAAe,CACnC,UAAU,EAAE,kBAAkB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAgKf"}
@@ -319,7 +319,7 @@ export interface WorkflowOptions<I extends readonly WorkflowInput[] = readonly W
319
319
  *
320
320
  * When set, the CLI refuses to load the workflow on an older install
321
321
  * and surfaces an actionable "update required" entry in the picker
322
- * and `atomic workflow -l` output instead of silently dropping it.
322
+ * and `atomic workflow list` output instead of silently dropping it.
323
323
  *
324
324
  * Leave unset (the default) to opt out entirely — the workflow will
325
325
  * be treated as compatible with every CLI version. Use this when you
@@ -331,21 +331,164 @@ export interface WorkflowOptions<I extends readonly WorkflowInput[] = readonly W
331
331
  */
332
332
  minSDKVersion?: string;
333
333
  }
334
+ /**
335
+ * Structural constraint for workflows accepted by `Registry.register()`.
336
+ *
337
+ * Uses `run: (...args: never[]) => Promise<void>` instead of the full
338
+ * `WorkflowDefinition<A, I>` constraint to avoid contravariance failures.
339
+ * A narrowly-typed `run(ctx: WorkflowContext<"claude">) => void` is not
340
+ * assignable to `run(ctx: WorkflowContext<AgentType>) => void` under
341
+ * `--strictFunctionTypes` (contravariant parameter position). Using
342
+ * `(...args: never[]) => Promise<void>` sidesteps this: any callable is
343
+ * assignable to a function that takes `never` args. Type narrowing on the
344
+ * accumulating `T` generic is still preserved via `W["agent"]`/`W["name"]`.
345
+ */
346
+ export type RegistrableWorkflow = {
347
+ readonly __brand: "WorkflowDefinition";
348
+ readonly agent: AgentType;
349
+ readonly name: string;
350
+ readonly description: string;
351
+ readonly inputs: readonly WorkflowInput[];
352
+ readonly minSDKVersion: string | null;
353
+ readonly run: (...args: never[]) => Promise<void>;
354
+ };
355
+ /**
356
+ * Immutable, chainable registry of compiled workflow definitions.
357
+ *
358
+ * The generic parameter `T` accumulates the registered set as a
359
+ * `Record<"${agent}/${name}", WorkflowDefinition>` intersection, giving
360
+ * `get()` a typed return without casting.
361
+ */
362
+ export type Registry<T extends Record<string, WorkflowDefinition> = Record<string, WorkflowDefinition>> = {
363
+ /**
364
+ * Register a workflow definition. Returns a new Registry with the
365
+ * definition added. Throws if the same `${agent}/${name}` key is
366
+ * already registered.
367
+ */
368
+ register<W extends RegistrableWorkflow>(wf: W): Registry<T & Record<`${W["agent"]}/${W["name"]}`, W>>;
369
+ /**
370
+ * Retrieve a registered definition by its composite key.
371
+ * Compile-time typed based on the accumulated registry type.
372
+ */
373
+ get<K extends keyof T>(key: K): T[K];
374
+ /** Return true if a workflow with the given composite key is registered. */
375
+ has(key: string): boolean;
376
+ /** Return all registered definitions as a readonly array. */
377
+ list(): readonly WorkflowDefinition[];
378
+ /**
379
+ * Resolve a workflow by name + agent. Composes the composite key
380
+ * internally. Returns `undefined` when not found.
381
+ */
382
+ resolve(name: string, agent: AgentType): WorkflowDefinition | undefined;
383
+ };
384
+ /**
385
+ * Argv control for `WorkflowCli.run`.
386
+ *
387
+ * - `undefined` — parse `process.argv` (default).
388
+ * - `string[]` — parse this explicit argv list (tests, embedding).
389
+ * - `false` — skip parsing; use `inputs` / `name` / `agent` as provided.
390
+ */
391
+ export type ArgvMode = string[] | false;
392
+ /** Options for constructing a WorkflowCli via `createWorkflowCli()`. */
393
+ export interface CreateWorkflowCliOptions {
394
+ /** Programmatic inputs. CLI flags override these. */
395
+ inputs?: Record<string, string>;
396
+ /**
397
+ * Absolute path to the composition root file. The executor re-executes
398
+ * this path with `ATOMIC_ORCHESTRATOR_MODE=1` when detach is requested,
399
+ * so re-entry lands on the module that wired the dispatcher. Defaults
400
+ * to `process.argv[1]` — override when your composition root isn't
401
+ * argv[1] (test harnesses, bundled CLIs, embedded programs).
402
+ */
403
+ entry?: string;
404
+ /**
405
+ * Hook to attach sibling commands to the standalone `run()` CLI. The
406
+ * callback runs once against the Commander program `run()` built
407
+ * internally. Not used by the `toCommand` adapter — if you're embedding,
408
+ * add your siblings to the parent directly.
409
+ */
410
+ extend?: (program: import("@commander-js/extra-typings").Command) => void;
411
+ /**
412
+ * When `true` (the default), the generated CLI auto-registers the
413
+ * session + status management subcommands — `session list`,
414
+ * `session connect`, `session kill`, and `status` — so SDK users get
415
+ * the same monitoring UX as `atomic workflow …` without needing the
416
+ * global `atomic` binary.
417
+ *
418
+ * Every session spawned by the SDK lives on the shared `atomic` tmux
419
+ * socket, so these commands are pure pass-throughs to the same
420
+ * implementations the global CLI uses; there's no divergence. Set to
421
+ * `false` only when you want a minimal CLI (e.g. programmatic invocation
422
+ * or embedding under a parent Commander program where the parent owns
423
+ * session management).
424
+ *
425
+ * The `session` and `status` names are reserved — workflow inputs
426
+ * declared with those names will throw at `defineWorkflow` time to
427
+ * avoid flag collisions.
428
+ */
429
+ includeManagementCommands?: boolean;
430
+ }
431
+ /**
432
+ * A CLI program that resolves `--name` + `--agent` from argv and runs the
433
+ * matching workflow from a registry. Used by multi-workflow CLIs (e.g.
434
+ * the internal `atomic workflow` command) and single-workflow entry points.
435
+ *
436
+ * Framework-agnostic by design. To embed under a parent CLI, use the
437
+ * `toCommand` adapter in `@bastani/atomic/workflows/commander`.
438
+ */
439
+ export interface WorkflowCli<T extends Record<string, WorkflowDefinition> = Record<string, WorkflowDefinition>> {
440
+ /** Registry the CLI was constructed with. */
441
+ readonly registry: Registry<T>;
442
+ /**
443
+ * Absolute path the executor re-execs on `--detach`. Defaults to
444
+ * `process.argv[1]`; override via `createWorkflowCli(reg, { entry })`.
445
+ */
446
+ readonly entry: string;
447
+ /**
448
+ * Input defaults supplied at construction. The adapter reads these so
449
+ * CLI-built Commands merge them identically to `run()`.
450
+ */
451
+ readonly defaults: Record<string, string> | undefined;
452
+ /**
453
+ * Run the workflow CLI.
454
+ *
455
+ * - Default (`argv` unset): parses `process.argv` with `-n/--name`,
456
+ * `-a/--agent`, and the per-input union across the registry;
457
+ * `inputs`/`name`/`agent` layer in as defaults.
458
+ * - `argv: [...]`: parses the given argv list the same way.
459
+ * - `argv: false`: skip parsing; `name` and `agent` are required and
460
+ * `inputs` are used as-is.
461
+ */
462
+ run(options?: {
463
+ name?: string;
464
+ agent?: AgentType;
465
+ inputs?: Record<string, string>;
466
+ argv?: ArgvMode;
467
+ detach?: boolean;
468
+ }): Promise<void>;
469
+ }
334
470
  /**
335
471
  * A compiled workflow definition — the sealed output of defineWorkflow().compile().
336
472
  */
337
473
  export interface WorkflowDefinition<A extends AgentType = AgentType, I extends readonly WorkflowInput[] = readonly WorkflowInput[]> {
338
474
  readonly __brand: "WorkflowDefinition";
339
475
  readonly name: string;
476
+ /** The agent this workflow targets. Set via `.for(agent)` in the builder. */
477
+ readonly agent: A;
340
478
  readonly description: string;
341
- /** Declared input schema — empty array for free-form workflows. */
342
- readonly inputs: readonly WorkflowInput[];
479
+ /**
480
+ * Declared input schema — empty tuple for free-form workflows.
481
+ * Typed as the builder-supplied `I` so consumers (e.g.
482
+ * `createWorkflowCli(def)`) can derive the narrow `InputsOf<I>` shape
483
+ * without carrying a second generic parameter.
484
+ */
485
+ readonly inputs: I;
343
486
  /**
344
487
  * Minimum Atomic SDK version required. `null` when the workflow
345
488
  * declared no requirement — treated as compatible with every CLI.
346
489
  */
347
490
  readonly minSDKVersion: string | null;
348
491
  /** The workflow's entry point. Called by the executor with a WorkflowContext. */
349
- readonly run: (ctx: WorkflowContext<A, I>) => Promise<void>;
492
+ run(ctx: WorkflowContext<A, I>): Promise<void>;
350
493
  }
351
494
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sdk/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,aAAa,IAAI,oBAAoB,EACtC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,cAAc,EACd,OAAO,IAAI,eAAe,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAE/B,4BAA4B;AAC5B,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;AAI1D;;;GAGG;AACH,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,wBAAwB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACpE,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;IAC9C,MAAM,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAClC,CAAC;AAEF;;;;;GAKG;AACH,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE;QACR,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC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;IAC7E,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,iFAAiF;IAMjF,GAAG,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Shared helpers for the single-definition worker (`./worker.ts`) and
3
+ * the multi-workflow dispatcher (`./workflow-cli.ts`). These were all
4
+ * inlined in the original `worker.ts` before the split.
5
+ */
6
+ import type { WorkflowInput } from "./types.ts";
7
+ /**
8
+ * Convert a hyphenated option name to the camelCase key Commander uses
9
+ * when storing options in `opts()`. Commander applies this transform
10
+ * automatically: `--output-type` → `opts.outputType`.
11
+ *
12
+ * @example toCamelCase("output-type") // → "outputType"
13
+ * @example toCamelCase("max-loops") // → "maxLoops"
14
+ * @example toCamelCase("simple") // → "simple"
15
+ */
16
+ export declare function toCamelCase(name: string): string;
17
+ /**
18
+ * Validate and resolve inputs against a workflow's declared schema.
19
+ * Throws on unknown flags, missing required fields, invalid enum values,
20
+ * and non-integer values for integer fields.
21
+ */
22
+ export declare function validateAndResolve(inputs: Record<string, string>, schema: readonly WorkflowInput[]): Record<string, string>;
23
+ /**
24
+ * Coerce a typed defaults map (InputsOf shape — string | number values)
25
+ * into the string-valued map the executor and CLI flag layer consume.
26
+ * Returns `undefined` when `defaults` is `undefined` so callers can
27
+ * skip merging entirely.
28
+ */
29
+ export declare function stringifyDefaults(defaults: Record<string, string | number | undefined> | undefined): Record<string, string> | undefined;
30
+ /**
31
+ * Inspect every workflow in a registry snapshot and build a
32
+ * union-of-inputs map. Throws on reserved-name use and on same-name /
33
+ * different-type collisions. Returns the deduplicated union map
34
+ * (name → WorkflowInput). Used by the multi-workflow dispatcher to
35
+ * expose a single set of flags across heterogeneous registry entries.
36
+ */
37
+ export declare function buildInputUnion(workflows: readonly {
38
+ readonly agent: string;
39
+ readonly name: string;
40
+ readonly inputs: readonly WorkflowInput[];
41
+ }[]): Map<string, WorkflowInput>;
42
+ //# sourceMappingURL=worker-shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-shared.d.ts","sourceRoot":"","sources":["../../src/sdk/worker-shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,MAAM,EAAE,SAAS,aAAa,EAAE,GAC/B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA2DxB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,GAChE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAQpC;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,SAAS;IAClB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;CAC3C,EAAE,GACF,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAgC5B"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * WorkflowCli — the single entry-point factory for workflow CLIs.
3
+ *
4
+ * Parses `-n/--name` + `-a/--agent` from argv, exposes a union of flags
5
+ * across every workflow in the registry, opens an interactive picker when
6
+ * agent is given without a name in a TTY, and handles orchestrator
7
+ * re-entry from detached runs.
8
+ *
9
+ * Framework-agnostic: the returned `WorkflowCli` type has no direct
10
+ * Commander dependency. To embed under a parent Commander CLI, use
11
+ * `toCommand(cli)` from `@bastani/atomic/workflows/commander`.
12
+ *
13
+ * Used by the internal `atomic workflow` command. Per-workflow CLI
14
+ * files call `createWorkflowCli(workflow)` — the same factory supports
15
+ * a lone workflow, an array, or a full `Registry`.
16
+ */
17
+ import { Command } from "@commander-js/extra-typings";
18
+ import type { AgentType, Registry, RegistrableWorkflow, WorkflowCli, WorkflowDefinition, WorkflowInput, CreateWorkflowCliOptions } from "./types.ts";
19
+ /**
20
+ * Resolve the workflow definition, merge inputs (with precedence), validate,
21
+ * and hand off to the executor.
22
+ *
23
+ * Input precedence (highest → lowest):
24
+ * cliInputs > runInputs > dispatcherInputs > defineWorkflow defaults
25
+ *
26
+ * Exported for `./commander.ts` — not part of the public API.
27
+ */
28
+ export declare function resolveAndStart(registry: Registry, name: string, agent: AgentType, opts: {
29
+ cliInputs?: Record<string, string>;
30
+ runInputs?: Record<string, string>;
31
+ dispatcherInputs?: Record<string, string>;
32
+ detach?: boolean;
33
+ entry: string;
34
+ }): Promise<void>;
35
+ /**
36
+ * Build the Commander Command that drives the workflow CLI. Used by both
37
+ * the standalone `run()` path and the `toCommand` adapter.
38
+ *
39
+ * Exported for `./commander.ts` — not part of the public API.
40
+ */
41
+ export declare function buildCliCommand(registry: Registry, unionInputs: Map<string, WorkflowInput>, onAction: (params: {
42
+ name: string | undefined;
43
+ agent: AgentType | undefined;
44
+ cliInputs: Record<string, string>;
45
+ detach: boolean;
46
+ }) => Promise<void>, mountName?: string): Command;
47
+ /**
48
+ * Interactive-picker path used by both `run()` and the Commander adapter.
49
+ * Depends on `process.stdout.isTTY`; returns without side effects when
50
+ * the user cancels or no terminal is attached.
51
+ *
52
+ * Exported for `./commander.ts` — not part of the public API.
53
+ */
54
+ export declare function runPicker(registry: Registry, agent: AgentType, detach: boolean, entry: string, dispatcherInputs: Record<string, string> | undefined): Promise<void>;
55
+ /**
56
+ * Create a workflow CLI that resolves `--name` + `--agent` from argv and
57
+ * runs the matching workflow from the registry.
58
+ *
59
+ * Accepts three input shapes — pick whichever is cleanest:
60
+ *
61
+ * - **A single workflow.** `createWorkflowCli(workflow).run()`.
62
+ * - **An array of workflows.** `createWorkflowCli([claude, copilot]).run()`.
63
+ * - **A `Registry`.** For programmatic/dynamic composition, or sharing a
64
+ * registry across multiple CLIs. Build with `createRegistry().register(...)`.
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * // Single workflow — ~70% of use cases
69
+ * const cli = createWorkflowCli(workflow);
70
+ * await cli.run();
71
+ *
72
+ * // Multi-workflow, multi-agent — by far the most common multi-case
73
+ * await createWorkflowCli([claude, copilot, opencode]).run();
74
+ *
75
+ * // Dynamic composition
76
+ * const registry = workflowFiles.reduce(
77
+ * (r, wf) => r.register(wf),
78
+ * createRegistry(),
79
+ * );
80
+ * await createWorkflowCli(registry).run();
81
+ * ```
82
+ *
83
+ * To embed under a parent Commander CLI:
84
+ *
85
+ * ```ts
86
+ * import { toCommand, runCli } from "@bastani/atomic/workflows/commander";
87
+ * parent.addCommand(toCommand(cli));
88
+ * await runCli(cli, () => parent.parseAsync());
89
+ * ```
90
+ *
91
+ * The single/array overloads use generic constraints (`W extends
92
+ * RegistrableWorkflow`) rather than a plain parameter type. This matters
93
+ * under `--strictFunctionTypes`: a `WorkflowDefinition<"claude", ...>`
94
+ * will not assign to a property-typed parameter because its narrow
95
+ * `run(ctx: WorkflowContext<"claude">)` is contravariant against the
96
+ * broader target. Routing through a generic `W` lets TS check bivariantly
97
+ * via `extends`, which matches how `Registry.register` already accepts
98
+ * the same inputs.
99
+ */
100
+ export declare function createWorkflowCli<W extends RegistrableWorkflow>(target: W, options?: CreateWorkflowCliOptions): WorkflowCli;
101
+ export declare function createWorkflowCli<W extends RegistrableWorkflow>(target: readonly W[], options?: CreateWorkflowCliOptions): WorkflowCli;
102
+ export declare function createWorkflowCli<T extends Record<string, WorkflowDefinition>>(target: Registry<T>, options?: CreateWorkflowCliOptions): WorkflowCli<T>;
103
+ //# sourceMappingURL=workflow-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-cli.d.ts","sourceRoot":"","sources":["../../src/sdk/workflow-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,KAAK,EACV,SAAS,EACT,QAAQ,EACR,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,wBAAwB,EACzB,MAAM,YAAY,CAAC;AAsDpB;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE;IACJ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,GACA,OAAO,CAAC,IAAI,CAAC,CAmCf;AAID;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,EACvC,QAAQ,EAAE,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,MAAM,EAAE,OAAO,CAAC;CACjB,KAAK,OAAO,CAAC,IAAI,CAAC,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAwET;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,MAAM,EACb,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GACnD,OAAO,CAAC,IAAI,CAAC,CAef;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,mBAAmB,EAC7D,MAAM,EAAE,CAAC,EACT,OAAO,CAAC,EAAE,wBAAwB,GACjC,WAAW,CAAC;AACf,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,mBAAmB,EAC7D,MAAM,EAAE,SAAS,CAAC,EAAE,EACpB,OAAO,CAAC,EAAE,wBAAwB,GACjC,WAAW,CAAC;AACf,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAC5E,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EACnB,OAAO,CAAC,EAAE,wBAAwB,GACjC,WAAW,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,113 @@
1
+ export declare function createBuiltinRegistry(): import(".").Registry<Record<string, never> & Record<`claude/${string}`, import(".").WorkflowDefinition<"claude", readonly [{
2
+ readonly name: "prompt";
3
+ readonly type: "text";
4
+ readonly required: true;
5
+ readonly description: "task prompt";
6
+ }, {
7
+ readonly name: "max_loops";
8
+ readonly type: "integer";
9
+ readonly description: "maximum number of plan/orchestrate/review iterations";
10
+ readonly default: 10;
11
+ }]>> & Record<`copilot/${string}`, import(".").WorkflowDefinition<"copilot", readonly [{
12
+ readonly name: "prompt";
13
+ readonly type: "text";
14
+ readonly required: true;
15
+ readonly description: "task prompt";
16
+ }, {
17
+ readonly name: "max_loops";
18
+ readonly type: "integer";
19
+ readonly description: "maximum number of plan/orchestrate/review iterations";
20
+ readonly default: 10;
21
+ }]>> & Record<`opencode/${string}`, import(".").WorkflowDefinition<"opencode", readonly [{
22
+ readonly name: "prompt";
23
+ readonly type: "text";
24
+ readonly required: true;
25
+ readonly description: "task prompt";
26
+ }, {
27
+ readonly name: "max_loops";
28
+ readonly type: "integer";
29
+ readonly description: "maximum number of plan/orchestrate/review iterations";
30
+ readonly default: 10;
31
+ }]>> & Record<`claude/${string}`, import(".").WorkflowDefinition<"claude", readonly [{
32
+ readonly name: "prompt";
33
+ readonly type: "text";
34
+ readonly required: true;
35
+ readonly description: "research question";
36
+ }]>> & Record<`copilot/${string}`, import(".").WorkflowDefinition<"copilot", readonly [{
37
+ readonly name: "prompt";
38
+ readonly type: "text";
39
+ readonly required: true;
40
+ readonly description: "research question";
41
+ }]>> & Record<`opencode/${string}`, import(".").WorkflowDefinition<"opencode", readonly [{
42
+ readonly name: "prompt";
43
+ readonly type: "text";
44
+ readonly required: true;
45
+ readonly description: "research question";
46
+ }]>> & Record<`claude/${string}`, import(".").WorkflowDefinition<"claude", readonly [{
47
+ readonly name: "prompt";
48
+ readonly type: "text";
49
+ readonly required: true;
50
+ readonly description: "What to design (e.g., 'a dashboard for monitoring API latency')";
51
+ }, {
52
+ readonly name: "reference";
53
+ readonly type: "text";
54
+ readonly required: false;
55
+ readonly description: "URL, file path, or codebase path to import as design reference";
56
+ }, {
57
+ readonly name: "output-type";
58
+ readonly type: "enum";
59
+ readonly required: false;
60
+ readonly values: readonly ["prototype", "wireframe", "page", "component"];
61
+ readonly default: "prototype";
62
+ readonly description: "Type of design output to generate";
63
+ }, {
64
+ readonly name: "design-system";
65
+ readonly type: "text";
66
+ readonly required: false;
67
+ readonly description: "Path to existing Design.md (skips onboarding if provided)";
68
+ }]>> & Record<`copilot/${string}`, import(".").WorkflowDefinition<"copilot", readonly [{
69
+ readonly name: "prompt";
70
+ readonly type: "text";
71
+ readonly required: true;
72
+ readonly description: "What to design (e.g., 'a dashboard for monitoring API latency')";
73
+ }, {
74
+ readonly name: "reference";
75
+ readonly type: "text";
76
+ readonly required: false;
77
+ readonly description: "URL, file path, or codebase path to import as design reference";
78
+ }, {
79
+ readonly name: "output-type";
80
+ readonly type: "enum";
81
+ readonly required: false;
82
+ readonly values: readonly ["prototype", "wireframe", "page", "component"];
83
+ readonly default: "prototype";
84
+ readonly description: "Type of design output to generate";
85
+ }, {
86
+ readonly name: "design-system";
87
+ readonly type: "text";
88
+ readonly required: false;
89
+ readonly description: "Path to existing Design.md (skips onboarding if provided)";
90
+ }]>> & Record<`opencode/${string}`, import(".").WorkflowDefinition<"opencode", readonly [{
91
+ readonly name: "prompt";
92
+ readonly type: "text";
93
+ readonly required: true;
94
+ readonly description: "What to design (e.g., 'a dashboard for monitoring API latency')";
95
+ }, {
96
+ readonly name: "reference";
97
+ readonly type: "text";
98
+ readonly required: false;
99
+ readonly description: "URL, file path, or codebase path to import as design reference";
100
+ }, {
101
+ readonly name: "output-type";
102
+ readonly type: "enum";
103
+ readonly required: false;
104
+ readonly values: readonly ["prototype", "wireframe", "page", "component"];
105
+ readonly default: "prototype";
106
+ readonly description: "Type of design output to generate";
107
+ }, {
108
+ readonly name: "design-system";
109
+ readonly type: "text";
110
+ readonly required: false;
111
+ readonly description: "Path to existing Design.md (skips onboarding if provided)";
112
+ }]>>>;
113
+ //# sourceMappingURL=builtin-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin-registry.d.ts","sourceRoot":"","sources":["../../../src/sdk/workflows/builtin-registry.ts"],"names":[],"mappings":"AAiBA,wBAAgB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAKpC"}
@@ -6,6 +6,11 @@
6
6
  * for spawning agent sessions using native TypeScript control flow.
7
7
  */
8
8
  export { defineWorkflow, WorkflowBuilder } from "../define-workflow.ts";
9
+ export { createRegistry } from "../registry.ts";
10
+ export type { Registry } from "../registry.ts";
11
+ export { createWorkflowCli } from "../workflow-cli.ts";
12
+ export type { WorkflowCli, CreateWorkflowCliOptions } from "../types.ts";
13
+ export type { ArgvMode } from "../types.ts";
9
14
  export type { AgentType, ValidationWarning, Transcript, SavedMessage, SaveTranscript, SessionContext, SessionRef, SessionHandle, SessionRunOptions, WorkflowContext, WorkflowOptions, WorkflowDefinition, WorkflowInput, WorkflowInputType, StageClientOptions, StageSessionOptions, ProviderClient, ProviderSession, CopilotClient, CopilotClientOptions, CopilotSession, CopilotSessionConfig, OpencodeClient, OpencodeSession, ClaudeClientWrapper, ClaudeSessionWrapper, } from "../types.ts";
10
15
  export type { SessionEvent as CopilotSessionEvent } from "@github/copilot-sdk";
11
16
  export type { SessionPromptResponse as OpenCodePromptResponse } from "@opencode-ai/sdk/v2";
@@ -16,9 +21,4 @@ export { validateCopilotWorkflow } from "../providers/copilot.ts";
16
21
  export { validateOpenCodeWorkflow } from "../providers/opencode.ts";
17
22
  export type { TmuxResult, TmuxSession, SessionType } from "../runtime/tmux.ts";
18
23
  export { SOCKET_NAME, isTmuxInstalled, getMuxBinary, resetMuxBinaryCache, isInsideTmux, isInsideAtomicSocket, createSession, createWindow, createPane, sendLiteralText, sendSpecialKey, capturePane, capturePaneVisible, capturePaneScrollback, killSession, killSessionOnPaneExit, killWindow, sessionExists, listSessions, attachSession, spawnMuxAttach, switchClient, getCurrentSession, attachOrSwitch, detachAndAttachAtomic, selectWindow, setSessionEnv, getSessionEnv, parseSessionName, tmuxRun, normalizeTmuxCapture, normalizeTmuxLines, } from "../runtime/tmux.ts";
19
- export { AGENTS, discoverWorkflows, findWorkflow, loadWorkflowsMetadata, WORKFLOWS_GITIGNORE, } from "../runtime/discovery.ts";
20
- export type { DiscoveredWorkflow, WorkflowWithMetadata, WorkflowMetadataStatus, } from "../runtime/discovery.ts";
21
- export { WorkflowLoader } from "../runtime/loader.ts";
22
- export { executeWorkflow } from "../runtime/executor.ts";
23
- export type { WorkflowRunOptions } from "../runtime/executor.ts";
24
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/workflows/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExE,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,cAAc,EACd,cAAc,EACd,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAGrB,YAAY,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,YAAY,EAAE,qBAAqB,IAAI,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC3F,YAAY,EAAE,cAAc,IAAI,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAG7F,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC5I,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAGpE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,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AAa,EACb,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/atomic",
3
- "version": "0.5.34-0",
3
+ "version": "0.6.0-0",
4
4
  "description": "Configuration management CLI and SDK for coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,6 +34,10 @@
34
34
  "bun": "./src/sdk/workflows/index.ts",
35
35
  "types": "./dist/sdk/workflows/index.d.ts"
36
36
  },
37
+ "./workflows/commander": {
38
+ "bun": "./src/sdk/commander.ts",
39
+ "types": "./dist/sdk/commander.d.ts"
40
+ },
37
41
  "./*": {
38
42
  "bun": "./src/sdk/*",
39
43
  "types": "./dist/sdk/*"
@@ -56,9 +60,9 @@
56
60
  "dev": "bun run src/cli.ts",
57
61
  "build": "rm -rf dist && bunx tsc --project tsconfig.build.json",
58
62
  "prepack": "bun run build",
59
- "test": "bun test ./src ./tests",
63
+ "test": "bun test --parallel ./src ./tests",
60
64
  "test:coverage": "bun test --coverage ./src ./tests",
61
- "typecheck": "bunx tsc --noEmit && bunx tsc -p tests --noEmit",
65
+ "typecheck": "bunx tsc --noEmit && bunx tsc -p tests --noEmit && bunx tsc -p examples --noEmit",
62
66
  "lint": "oxlint --config=oxlint.json src",
63
67
  "lint:fix": "oxlint --config=oxlint.json --fix src",
64
68
  "prepare": "prek install || true"
@@ -72,13 +76,13 @@
72
76
  "typescript-language-server": "^5.1.3"
73
77
  },
74
78
  "dependencies": {
75
- "@anthropic-ai/claude-agent-sdk": "^0.2.118",
79
+ "@anthropic-ai/claude-agent-sdk": "^0.2.119",
76
80
  "@clack/prompts": "^1.2.0",
77
81
  "@commander-js/extra-typings": "^14.0.0",
78
- "@github/copilot-sdk": "^0.2.2",
79
- "@opencode-ai/sdk": "^1.14.20",
80
- "@opentui/core": "^0.1.102",
81
- "@opentui/react": "^0.1.102",
82
+ "@github/copilot-sdk": "^0.3.0",
83
+ "@opencode-ai/sdk": "^1.14.24",
84
+ "@opentui/core": "^0.1.103",
85
+ "@opentui/react": "^0.1.103",
82
86
  "commander": "^14.0.3",
83
87
  "ignore": "^7.0.5",
84
88
  "yaml": "^2.8.3",