@workflow-manager/runner 0.1.0 → 0.3.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 (40) hide show
  1. package/README.md +123 -12
  2. package/dist/adapters.d.ts +4 -0
  3. package/dist/adapters.js +11 -0
  4. package/dist/claudeCodeExecutor.d.ts +4 -0
  5. package/dist/claudeCodeExecutor.js +173 -0
  6. package/dist/cliRunRenderer.d.ts +36 -0
  7. package/dist/cliRunRenderer.js +286 -0
  8. package/dist/engine.d.ts +4 -2
  9. package/dist/engine.js +622 -44
  10. package/dist/events.d.ts +1 -1
  11. package/dist/events.js +4 -2
  12. package/dist/index.js +371 -41
  13. package/dist/manPage.d.ts +1 -0
  14. package/dist/manPage.js +147 -0
  15. package/dist/mockExecutor.d.ts +2 -2
  16. package/dist/mockExecutor.js +62 -13
  17. package/dist/opencodeExecutor.d.ts +2 -2
  18. package/dist/opencodeExecutor.js +101 -138
  19. package/dist/parser.js +98 -2
  20. package/dist/piAgentExecutor.d.ts +4 -0
  21. package/dist/piAgentExecutor.js +298 -0
  22. package/dist/remote/api.d.ts +1 -0
  23. package/dist/remote/commands.d.ts +2 -0
  24. package/dist/remote/commands.js +76 -4
  25. package/dist/runnerApi.d.ts +7 -0
  26. package/dist/runnerApi.js +221 -0
  27. package/dist/runnerSession.d.ts +62 -0
  28. package/dist/runnerSession.js +260 -0
  29. package/dist/runtimePreflight.d.ts +16 -0
  30. package/dist/runtimePreflight.js +189 -0
  31. package/dist/skillResolver.d.ts +6 -0
  32. package/dist/skillResolver.js +75 -0
  33. package/dist/types.d.ts +148 -2
  34. package/man/wfm.1 +54 -4
  35. package/package.json +28 -4
  36. package/skills/commit-discipline/SKILL.md +109 -0
  37. package/skills/doc-sync/SKILL.md +83 -0
  38. package/skills/repo-hygiene/SKILL.md +70 -0
  39. package/skills/spec-driven-development/SKILL.md +33 -0
  40. package/skills/workflow-manager-cli/SKILL.md +14 -9
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: commit-discipline
3
+ description: >
4
+ Load this skill before staging commits or opening a pull request in
5
+ workflow-manager. Enforces Conventional Commits, focused diffs, a clean
6
+ rebase onto origin/main, and PR descriptions that link to the work.
7
+ type: core
8
+ applies_to:
9
+ - ".git/**"
10
+ - "**/*"
11
+ ---
12
+
13
+ # Commit Discipline
14
+
15
+ Use this skill at the moment you are about to `git add`, `git commit`, or `gh pr create`. It encodes how this repo expects commits and PRs to look so that history stays readable and release tooling (release-please, changelogs) keeps working.
16
+
17
+ ## When to use this skill
18
+
19
+ Load it when you are about to:
20
+
21
+ - Stage changes for commit.
22
+ - Author a commit message.
23
+ - Rebase onto `origin/main` before opening a PR.
24
+ - Open or update a pull request.
25
+
26
+ Skip it for purely exploratory commands that do not touch git state.
27
+
28
+ ## Conventional Commits
29
+
30
+ This repo uses Conventional Commits. The release tooling (`release-please-config.json`) reads commit subjects to decide version bumps and changelog entries. Format:
31
+
32
+ ```
33
+ <type>(<optional-scope>): <imperative summary>
34
+ ```
35
+
36
+ Allowed `type` values:
37
+
38
+ - `feat` — user-visible new functionality.
39
+ - `fix` — user-visible bug fix.
40
+ - `perf` — performance improvement with no behavior change.
41
+ - `refactor` — internal restructuring, no behavior change, no new feature.
42
+ - `docs` — documentation only.
43
+ - `test` — tests only.
44
+ - `build` — build system, packaging, dependencies.
45
+ - `ci` — CI configuration only.
46
+ - `chore` — repo plumbing that does not fit the above and has no user impact.
47
+ - `revert` — reverts a previous commit; reference the reverted SHA.
48
+
49
+ Rules:
50
+
51
+ - Subject in the imperative mood, no trailing period, max 72 chars.
52
+ - Use a scope when the change is localized (e.g., `feat(cli): ...`, `fix(parser): ...`, `feat(remote-registry): ...`).
53
+ - Use `!` for breaking changes (e.g., `feat(cli)!: rename --token to --auth-token`) AND include a `BREAKING CHANGE:` footer explaining the migration.
54
+ - Body (optional) explains _why_, not _what_; reference issues/PRs by number.
55
+
56
+ ## Commit hygiene
57
+
58
+ - One logical change per commit. Do not bundle unrelated edits.
59
+ - Never commit secrets, `.env*` files, real tokens, generated `dist/` output (unless explicitly requested), `node_modules/`, or local Supabase data.
60
+ - Never amend or force-push commits that already exist on `main`. Force-push to feature branches is allowed only with `--force-with-lease`.
61
+ - If pre-commit / pre-push hooks fail, fix the underlying issue. Do not bypass with `--no-verify` unless the user explicitly asks.
62
+
63
+ ## Before opening a PR
64
+
65
+ Inside the feature worktree:
66
+
67
+ ```bash
68
+ git fetch origin
69
+ git rebase origin/main
70
+ bun run lint
71
+ bun test
72
+ bun run build
73
+ ```
74
+
75
+ Plus the conditional scripts from `repo-hygiene` / `doc-sync` when applicable.
76
+
77
+ If the rebase produces conflicts you cannot confidently resolve, stop and surface them to the user instead of force-pushing through them.
78
+
79
+ ## PR description template
80
+
81
+ Open PRs against `main` with a description that contains:
82
+
83
+ 1. **Summary** — 1–3 bullets describing the change in user-visible terms.
84
+ 2. **Why** — link to the issue, spec, or user request driving the change.
85
+ 3. **How** — short note on the approach; call out anything non-obvious.
86
+ 4. **Validation** — list the exact commands you ran and that they passed (lint, test, build, plus any conditional ones).
87
+ 5. **Docs** — link to the doc files updated, or state explicitly "no user-visible behavior changed".
88
+ 6. **Risk / rollout** — call out feature flags, migration steps, or follow-ups.
89
+
90
+ Example title:
91
+
92
+ ```
93
+ feat(cli): add `wfm pull --output` flag for redirecting fetched workflows
94
+ ```
95
+
96
+ ## Anti-patterns to refuse
97
+
98
+ - Subjects like `update stuff`, `wip`, `fix things`, `address review`.
99
+ - Squashing unrelated commits together to "clean up history" right before merge.
100
+ - Pushing to `main` directly.
101
+ - Opening a PR with failing CI and asking reviewers to "ignore the red".
102
+ - Mixing a refactor and a behavior change in the same commit.
103
+
104
+ ## Definition of done
105
+
106
+ - Every commit subject is a valid Conventional Commit.
107
+ - Branch is rebased on the latest `origin/main`.
108
+ - All required scripts (lint, test, build, plus conditional ones) passed locally.
109
+ - PR description follows the template and links updated docs.
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: doc-sync
3
+ description: >
4
+ Load this skill whenever a change affects user-visible behavior in
5
+ workflow-manager: CLI flags, command output, workflow schema, public
6
+ TypeScript types, adapters, the remote registry surface, or environment
7
+ variables. Ensures README, doc/, AGENTS.md, and in-CLI help stay in sync.
8
+ type: core
9
+ applies_to:
10
+ - "src/index.ts"
11
+ - "src/parser.ts"
12
+ - "src/engine.ts"
13
+ - "src/types.ts"
14
+ - "src/remote/**"
15
+ - "apps/remote-registry/**"
16
+ - "doc/**"
17
+ - "README.md"
18
+ - "AGENTS.md"
19
+ ---
20
+
21
+ # Doc Sync
22
+
23
+ Use this skill to keep documentation honest. In this repo, documentation is part of the product surface — the CLI is published, workflows are shared via the remote registry, and the docs site is built from `doc/`. Out-of-date docs are a bug.
24
+
25
+ ## When to use this skill
26
+
27
+ Load it whenever the change does any of the following:
28
+
29
+ - Adds, removes, or renames a CLI command, flag, or argument in `src/index.ts`.
30
+ - Changes workflow schema, defaults, or validation rules in `src/parser.ts` or `src/types.ts`.
31
+ - Changes engine semantics (approvals, retries, rollback, restart, snapshot shape) in `src/engine.ts`.
32
+ - Adds or changes an adapter (`mock`, `opencode`, `codex`, `claude-code`, future adapters).
33
+ - Changes remote registry behavior in `src/remote/**` or `apps/remote-registry/**`.
34
+ - Introduces or renames an environment variable or required local service.
35
+ - Bumps a public type or contract referenced by docs or other packages.
36
+
37
+ If none of the above is true, this skill is not needed.
38
+
39
+ ## Required updates by change type
40
+
41
+ | Change | Update |
42
+ | --- | --- |
43
+ | New / renamed CLI command or flag | Usage text in `src/index.ts`, `README.md` Quickstart and CLI section, the matching `doc/` page, and the man page source if behavior is reflected there. |
44
+ | Workflow schema change | `README.md` schema section, the relevant page under `doc/guide/` or `doc/reference/`, plus the `workflow-manager-cli` skill checklist if authoring rules shift. |
45
+ | Engine semantics change | The corresponding `doc/` engine page and any example workflows in `example-workflow.{md,json}` that no longer demonstrate the new behavior accurately. |
46
+ | Adapter added or changed | List of supported adapters in `AGENTS.md`, `README.md`, and `doc/`. The `workflow-manager-cli` skill must also list it. |
47
+ | Remote registry change | `apps/remote-registry/DESIGN.md` if UI/UX shifts, `README.md` remote section, `doc/` remote pages, and any onboarding snippets. |
48
+ | New env var or required service | `README.md` setup section, `AGENTS.md` Install And Setup, and any `.env.example` files. Never commit real secrets. |
49
+
50
+ ## Workflow
51
+
52
+ 1. Diff your change and list every user-visible surface it touches.
53
+ 2. For each surface, open the matching doc file and update it in the same PR. Do not defer to a follow-up.
54
+ 3. Rebuild docs to catch broken links or examples:
55
+ ```bash
56
+ bun run docs:build
57
+ ```
58
+ 4. If you changed the remote-registry app, also run:
59
+ ```bash
60
+ bun run remote-registry:build
61
+ ```
62
+ 5. Re-read the README quickstart end-to-end and confirm the commands you ship still work as written.
63
+
64
+ ## Style rules
65
+
66
+ - Match the existing tone of the surrounding doc. Do not introduce a new voice.
67
+ - Prefer runnable examples over prose. Examples should match the actual current CLI output.
68
+ - Keep command examples copy-pasteable. No invented flags or fictitious env vars.
69
+ - When you remove or rename a flag, document the migration in the same section, not in a separate changelog-only entry.
70
+ - Cross-link related docs sparingly and only when they meaningfully help the reader.
71
+
72
+ ## Anti-patterns to refuse
73
+
74
+ - Updating code without updating docs "because the docs are out of date anyway".
75
+ - Adding a doc page that is not linked from the docs nav or another page.
76
+ - Copying README content into `doc/` instead of linking, creating two sources of truth.
77
+ - Leaving `TODO: update docs` markers in a finished PR.
78
+
79
+ ## Definition of done
80
+
81
+ - Every user-visible behavioral change is reflected in `README.md`, the relevant `doc/` pages, in-CLI `--help`, and `AGENTS.md` where applicable.
82
+ - `bun run docs:build` passes.
83
+ - Examples in updated docs were actually executed (or visually verified) against the new behavior.
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: repo-hygiene
3
+ description: >
4
+ Load this skill on any code change in workflow-manager. It enforces the
5
+ "leave the repo cleaner than you found it" rules: no dead code, no orphan
6
+ files, no stray comments, no unrelated formatting churn, and validated
7
+ scripts before declaring done.
8
+ type: core
9
+ applies_to:
10
+ - "src/**"
11
+ - "apps/**"
12
+ - "tests/**"
13
+ - "scripts/**"
14
+ ---
15
+
16
+ # Repo Hygiene
17
+
18
+ Use this skill whenever you edit, add, or delete code in this repository. It encodes the cleanliness rules already implied by `AGENTS.md` and `biome.json`, made explicit so they are followed every time.
19
+
20
+ ## When to use this skill
21
+
22
+ Load it for any change under `src/`, `apps/`, `tests/`, or `scripts/`. Skip only for pure docs work in `doc/` and pure markdown edits at the repo root (those load `doc-sync` instead).
23
+
24
+ ## Core rules
25
+
26
+ 1. Smallest viable change. Edit only what the task requires. Do not refactor unrelated code, do not reformat unrelated files, do not rename unrelated symbols.
27
+ 2. No dead code. Remove unused imports, unused exports, unused locals, unreachable branches, and obsolete helpers in the files you touch. Do not leave `TODO`/`FIXME` without an associated issue link or a short, dated reason.
28
+ 3. No stray comments. Per `AGENTS.md` code style, do not add explanatory comments unless the user explicitly asks for them. Keep existing comments only if they are still accurate; delete misleading ones.
29
+ 4. File placement matters. Source goes in `src/`. Tests go in `tests/`. Remote-registry UI code stays inside `apps/remote-registry/`. Scripts stay in `scripts/`. Do not create new top-level files unless the task explicitly calls for them.
30
+ 5. Import discipline. ESM only. Node built-ins use the `node:` prefix. In `src/`, local imports use `.js` extensions; in `tests/`, local imports use `.ts` paths. Keep value imports first, then `import type` imports.
31
+ 6. Strict typing. Prefer `unknown` over `any` for untrusted input and narrow it before use. Reuse shared types from `src/types.ts` instead of inventing parallel shapes. Keep payloads JSON-serializable where possible.
32
+ 7. Error handling. CLI-facing code exits with clear messages and non-zero codes for failure. Validation errors are returned as strings for ordinary user-input problems, not thrown. Executor flows return structured `OutputEnvelope` failures rather than ad hoc exceptions.
33
+ 8. No silent swallowing. Never `catch` and ignore. If an error is intentionally non-fatal, log it with enough context to debug.
34
+ 9. No secrets. Never log tokens, env values, or credentials. Never commit `.env*` files or any local Supabase keys.
35
+
36
+ ## Pre-completion checklist
37
+
38
+ Before declaring a task done, run inside the worktree:
39
+
40
+ ```bash
41
+ bun run lint
42
+ bun test # narrowest relevant subset first; then full suite
43
+ bun run build
44
+ ```
45
+
46
+ Plus, when applicable:
47
+
48
+ ```bash
49
+ bun run remote-registry:test && bun run remote-registry:build # apps/remote-registry/**
50
+ bun run docs:build # doc/** or user-facing CLI/schema
51
+ ```
52
+
53
+ If any script fails, fix it or stop and report it. Do not declare completion with a red script.
54
+
55
+ ## Anti-patterns to refuse
56
+
57
+ - Adding a new dependency without checking `package.json` first.
58
+ - Introducing a new top-level config file when an existing one can be extended.
59
+ - Reformatting whole files because the editor auto-formatted them.
60
+ - Leaving commented-out code "in case we need it later" — git history is the archive.
61
+ - Mixing an unrelated refactor into a feature PR.
62
+
63
+ ## Definition of clean
64
+
65
+ A change is clean when:
66
+
67
+ - The diff contains only lines required by the task.
68
+ - `git status` shows no unintended new files.
69
+ - `bun run lint`, `bun test`, and `bun run build` are all green.
70
+ - A future reader can understand the change without an accompanying explanation message.
@@ -0,0 +1,33 @@
1
+ # Spec-Driven Development
2
+
3
+ Write a structured specification before writing any code. The spec is the shared source of truth between you and the engineer - it defines what we're building, why, and how we'll know it's done.
4
+
5
+ ## When to apply
6
+
7
+ Use spec-driven development when starting projects, handling ambiguous requirements, making architectural decisions, or tackling changes requiring 30+ minutes of work. Skip it for single-line fixes or unambiguous, self-contained changes.
8
+
9
+ ## Six-section spec format
10
+
11
+ Every spec must cover these six sections in this order:
12
+
13
+ 1. **Objective** - One paragraph: what we are building, why, and the success criteria. Surface assumptions explicitly.
14
+ 2. **Commands** - The exact CLI / API surface. Flags, exit codes, examples.
15
+ 3. **Project Structure** - File layout with one-line responsibilities per file.
16
+ 4. **Code Style** - Language version, modules, error handling pattern, no-classes / no-comments rules, max function length.
17
+ 5. **Testing Strategy** - Unit vs integration, what gets mocked vs real, coverage gates, naming conventions.
18
+ 6. **Boundaries** - In scope, out of scope, and any non-negotiable constraints.
19
+
20
+ ## Practices
21
+
22
+ - List assumptions before writing spec content. If they are wrong, the spec is wrong.
23
+ - Reframe vague requirements as measurable success criteria.
24
+ - Treat specs as living documents - update when decisions change.
25
+ - Reference the spec from pull requests so the audit trail is visible.
26
+
27
+ ## Output rules
28
+
29
+ - Plain markdown only. No preamble.
30
+ - Every spec must contain all six sections, even if a section is "N/A".
31
+ - Code style and testing strategy must include concrete rules, not vague aspirations.
32
+
33
+ 15 minutes of specification prevents hours of rework.
@@ -3,7 +3,7 @@ name: @workflow-manager/runner/cli
3
3
  description: >
4
4
  Load this skill when working with the wfm CLI from @workflow-manager/runner, authoring or
5
5
  validating workflow definitions, configuring step skills and adapters, or
6
- publishing workflows to the remote registry. Covers questions, scaffold,
6
+ publishing workflows to the remote registry. Covers doctor, agent, scaffold,
7
7
  validate, run, auth, publish, pull, search, and remote info.
8
8
  type: core
9
9
  library: @workflow-manager/runner
@@ -25,6 +25,7 @@ Use this skill when you need to create or operate `workflow-manager` workflows f
25
25
  Use it when the user wants to:
26
26
 
27
27
  - scaffold a new workflow definition
28
+ - create local agent rules for WFM usage
28
29
  - validate or run a workflow file
29
30
  - configure approvals, retry policy, or adapter initialization
30
31
  - publish a workflow to the remote registry
@@ -35,17 +36,19 @@ Use it when the user wants to:
35
36
 
36
37
  Use this sequence unless the user asks for a narrower task:
37
38
 
38
- 1. Discover the workflow intent with `wfm questions`
39
- 2. Scaffold a starter file with `wfm scaffold`
40
- 3. Edit the workflow definition
41
- 4. Validate the file with `wfm validate`
42
- 5. Execute it with `wfm run`
43
- 6. If needed, authenticate and publish with the remote registry commands
39
+ 1. Inspect local setup with `wfm doctor`
40
+ 2. Create project agent rules with `wfm agent` when local agent guidance is useful
41
+ 3. Scaffold a starter file with `wfm scaffold`
42
+ 4. Edit the workflow definition
43
+ 5. Validate the file with `wfm validate`
44
+ 6. Execute it with `wfm run`
45
+ 7. If needed, authenticate and publish with the remote registry commands
44
46
 
45
47
  ## Local workflow commands
46
48
 
47
49
  ```bash
48
- wfm questions
50
+ wfm doctor
51
+ wfm agent ./AGENTS.md
49
52
 
50
53
  wfm scaffold ./example-workflow.md
51
54
  wfm scaffold ./example-workflow.json --format json
@@ -90,7 +93,9 @@ wfm pull alice/remote-bunny --output ./remote-bunny.json
90
93
 
91
94
  ## Adapter and validation notes
92
95
 
93
- - Supported adapters include `mock`, `opencode`, `codex`, and `claude-code`
96
+ - Supported adapters include default `pi-agent` plus explicit `mock`, `opencode`, `codex`, and `claude-code`
97
+ - Omit `taskSpec.adapterKey` to run a task with the `pi` coding agent CLI
98
+ - Put skills, MCP endpoints, system prompts, model, and context under `taskSpec.init`
94
99
  - Human approvals should stay explicit in workflow definitions
95
100
  - External validation should be deterministic where possible
96
101
  - Use the mock adapter for fast tests and scaffolding flows