Skip to content

feat: workflow as a valid default export - #258

Merged
pelikhan merged 2 commits into
mainfrom
copilot/review-skill-md-clarity
Jul 28, 2026
Merged

feat: workflow as a valid default export#258
pelikhan merged 2 commits into
mainfrom
copilot/review-skill-md-clarity

Conversation

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

SKILL.md only documented agent as the valid root export, and the launcher only handled AgentFn, strings, and PromptBuilder — exporting a workflow would silently error.

Changes

  • Launcher (skills/rig/rig.ts): Added isWorkflow() type guard; asRootProgram() now wraps a Workflow default export in runWorkflow automatically — no manual call needed in the program file. No-input workflows use the string schema so inline mode works unchanged.
  • SKILL.md: Rules 1, 2, 7 updated; new "Deterministic TypeScript fan-out" row in the decisions table; "Runnable output" and "Final check" updated to name both agent and workflow as valid roots; // Workflow role: convention introduced alongside // Agent role:.
  • references/dynamic-workflows.md: Added "Workflow as default export" section with a worked example and the decision rule — workflow when TypeScript owns the orchestration, agent + agents: when the LLM should improvise the order.
  • samples/60-workflow-parallel-linter.md: New 24-line sample showing workflow as root — discovers files via call.text(), fans out with pipeline.
// Workflow role: discover and lint TypeScript source files in parallel.
const linter = workflow({
  meta: { name: "linter", description: "Lint TypeScript files in parallel", phases: ["Discover", "Lint"] },
  body: async ({ call, phase, pipeline }) => {
    phase("Discover");
    const raw = await call.text("List TypeScript source files to lint, one path per line.");
    const files = (raw ?? "").split("\n").map((f) => f.trim()).filter(Boolean);
    phase("Lint");
    return pipeline(files, (file) => call(lintFile, { file }, { label: file }));
  },
});

export default linter; // launcher calls runWorkflow(linter, ...) automatically

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title feat: support workflow as default export, clarify in SKILL.md feat: workflow as a valid default export Jul 28, 2026
Copilot AI requested a review from pelikhan July 28, 2026 16:31
@pelikhan
pelikhan marked this pull request as ready for review July 28, 2026 19:34
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts on this branch.

…md-clarity

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts on this branch.

Merge conflicts resolved in 99050f5. The only conflict was in skills/rig/SKILL.md — the "High-frequency decisions" table now includes both the new "Deterministic TypeScript fan-out" row (from this branch) and the "Custom model-callable operation" row (from main), with the corrected addons: [repair()] syntax. All 342 tests pass.

@pelikhan
pelikhan merged commit ab95e22 into main Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants