@oisincoveney/pipeline 1.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.
- package/.claude/commands/work-next.md +20 -0
- package/README.md +224 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +189843 -0
- package/dist/install-commands.d.ts +23 -0
- package/dist/mastra/backlog.d.ts +50 -0
- package/dist/mastra/gates.d.ts +22 -0
- package/dist/mastra/index.d.ts +22 -0
- package/dist/mastra/pipeline-primitive.d.ts +17 -0
- package/dist/mastra/pipeline-primitive.js +187349 -0
- package/dist/mastra/runner.d.ts +18 -0
- package/dist/mastra/runner.js +7298 -0
- package/dist/mastra/steps/green.d.ts +17 -0
- package/dist/mastra/steps/knowledge-inject.d.ts +12 -0
- package/dist/mastra/steps/learn.d.ts +10 -0
- package/dist/mastra/steps/red.d.ts +17 -0
- package/dist/mastra/steps/research.d.ts +15 -0
- package/dist/mastra/steps/verify.d.ts +17 -0
- package/dist/mastra/workflows/pipeline.d.ts +70 -0
- package/docs/slash-command-adapter-contract.md +74 -0
- package/package.json +70 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!-- Generated by @oisincoveney/pipeline. -->
|
|
2
|
+
<!-- @oisincoveney/pipeline:host=claude; version=1.0.0 -->
|
|
3
|
+
|
|
4
|
+
---
|
|
5
|
+
description: Run the oisin pipeline for a task
|
|
6
|
+
argument-hint: "<ticket id or task description>"
|
|
7
|
+
allowed-tools: Bash(./node_modules/.bin/work-next:*), Bash(bunx @oisincoveney/pipeline:*)
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
Run the oisin pipeline mechanically for the provided task.
|
|
11
|
+
|
|
12
|
+
Do not reimplement the pipeline inside this chat. Execute the installed CLI command and report its result.
|
|
13
|
+
|
|
14
|
+
Task:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
$ARGUMENTS
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
!`if [ -x ./node_modules/.bin/work-next ]; then ./node_modules/.bin/work-next "$ARGUMENTS"; else bunx @oisincoveney/pipeline work-next "$ARGUMENTS"; fi`
|
package/README.md
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# @oisincoveney/pipeline
|
|
2
|
+
|
|
3
|
+
Mastra workflow and CLI for running repository work through a fixed pipeline:
|
|
4
|
+
collect project knowledge, research the task, write failing tests, implement the
|
|
5
|
+
fix, verify the result, and record learnings for future runs.
|
|
6
|
+
|
|
7
|
+
The reusable primitive is `runPipelinePrimitive()`. It is intended to run from
|
|
8
|
+
an isolated worktree for one Backlog.md ticket or task description at a time.
|
|
9
|
+
Slash commands call it with a host-native in-process agent adapter; the CLI
|
|
10
|
+
calls it with the subprocess adapter.
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
|
|
14
|
+
- Bun 1.1 or newer
|
|
15
|
+
- Node.js 22.13 or newer
|
|
16
|
+
- Backlog.md CLI available as `backlog`
|
|
17
|
+
- One supported agent harness CLI available on `PATH`
|
|
18
|
+
|
|
19
|
+
Supported harnesses:
|
|
20
|
+
|
|
21
|
+
| Harness | CLI command used by the runner |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| `claude` | `claude --print -p ...` |
|
|
24
|
+
| `codex` | `codex exec --json ...` |
|
|
25
|
+
| `opencode` | `opencode run --format json ...` |
|
|
26
|
+
| `pi` | `pi --mode rpc --no-session` |
|
|
27
|
+
|
|
28
|
+
Install dependencies:
|
|
29
|
+
|
|
30
|
+
```shell
|
|
31
|
+
bun install --frozen-lockfile
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The selected harness must already be authenticated and configured in the local
|
|
35
|
+
environment. Any provider-specific API keys are managed by that harness.
|
|
36
|
+
|
|
37
|
+
## Installing In Another Repository
|
|
38
|
+
|
|
39
|
+
Install the package as a normal dependency, then run the installed binary:
|
|
40
|
+
|
|
41
|
+
```shell
|
|
42
|
+
bun add -D @oisincoveney/pipeline
|
|
43
|
+
work-next "Implement PIPE-123 user-facing behavior"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The package-level binary is also available:
|
|
47
|
+
|
|
48
|
+
```shell
|
|
49
|
+
oisin-pipeline work-next "Implement PIPE-123 user-facing behavior"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Slash-command adapters can import the primitive and adapter types from package
|
|
53
|
+
subpaths:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { runPipelinePrimitive } from "@oisincoveney/pipeline/pipeline-primitive";
|
|
57
|
+
import type { AgentAdapter } from "@oisincoveney/pipeline/runner";
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Install all generated command adapters into the current repository:
|
|
61
|
+
|
|
62
|
+
```shell
|
|
63
|
+
bunx @oisincoveney/pipeline install-commands --host all
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
This creates or updates the supported host files:
|
|
67
|
+
|
|
68
|
+
| Host | File | Invocation |
|
|
69
|
+
| --- | --- | --- |
|
|
70
|
+
| Claude Code | `.claude/commands/work-next.md` | `/work-next "Implement PIPE-123"` |
|
|
71
|
+
| OpenCode | `.opencode/commands/work-next.md` | `/work-next "Implement PIPE-123"` |
|
|
72
|
+
| Pi | `.pi/prompts/work-next.md` | `/work-next "Implement PIPE-123"` |
|
|
73
|
+
| Codex | `.agents/skills/work-next/SKILL.md` | `/use work-next "Implement PIPE-123"` |
|
|
74
|
+
|
|
75
|
+
Re-run the installer after package updates. It updates generated files it owns,
|
|
76
|
+
refuses to overwrite manual edits, supports `--check`, `--dry-run`, and
|
|
77
|
+
requires `--force` to overwrite a manually edited command file.
|
|
78
|
+
|
|
79
|
+
For local unpublished validation, install from a packed tarball instead of
|
|
80
|
+
linking:
|
|
81
|
+
|
|
82
|
+
```shell
|
|
83
|
+
bun pm pack
|
|
84
|
+
bun add /path/to/oisincoveney-pipeline-1.0.0.tgz
|
|
85
|
+
work-next "Implement PIPE-123 user-facing behavior"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Invocation Modes
|
|
89
|
+
|
|
90
|
+
Use a slash command when you are already inside Claude Code, Codex, OpenCode, or
|
|
91
|
+
Pi and want the host interface to execute the phase agents with its native
|
|
92
|
+
subagent/session mechanism. The slash command supplies the task text, target
|
|
93
|
+
path, in-process agent adapter, and phase reporter to the primitive.
|
|
94
|
+
|
|
95
|
+
Use the CLI when you are outside an agent host, when automation needs a shell
|
|
96
|
+
entrypoint, or when you explicitly want harness CLIs launched as subprocesses.
|
|
97
|
+
|
|
98
|
+
The slash-command adapter contract for Claude Code, Codex, OpenCode, and Pi is
|
|
99
|
+
documented in `docs/slash-command-adapter-contract.md`. This repository also
|
|
100
|
+
ships a Claude Code template at `.claude/commands/work-next.md`.
|
|
101
|
+
|
|
102
|
+
## Running The CLI
|
|
103
|
+
|
|
104
|
+
Use the package script to start a pipeline run with a task description:
|
|
105
|
+
|
|
106
|
+
```shell
|
|
107
|
+
PIPELINE_HARNESS=codex PIPELINE_TARGET_PATH=/path/to/worktree bun run work-next "Implement PIPE-123 user-facing behavior"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
`PIPELINE_HARNESS` is optional and defaults to `claude`. If it is set, it must be
|
|
111
|
+
one of `claude`, `codex`, `opencode`, or `pi`. Unsupported values are rejected
|
|
112
|
+
before Backlog.md tasks or workflow runs are created.
|
|
113
|
+
|
|
114
|
+
`PIPELINE_TARGET_PATH` is optional and defaults to the current working
|
|
115
|
+
directory. Set it when starting the CLI from outside the worktree that should be
|
|
116
|
+
modified.
|
|
117
|
+
|
|
118
|
+
The direct entrypoint is also available:
|
|
119
|
+
|
|
120
|
+
```shell
|
|
121
|
+
bun src/index.ts work-next "Implement PIPE-123 user-facing behavior"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The CLI path uses the same primitive as slash commands, but passes the
|
|
125
|
+
subprocess adapter from `src/mastra/runner.ts`. Environment variables are only
|
|
126
|
+
needed for the CLI adapter; slash commands should supply those values through
|
|
127
|
+
their host adapter contract.
|
|
128
|
+
|
|
129
|
+
## Pipeline Lifecycle
|
|
130
|
+
|
|
131
|
+
Every run follows the same lifecycle:
|
|
132
|
+
|
|
133
|
+
1. `knowledge-inject` builds the run context from repository rules and recent
|
|
134
|
+
pipeline knowledge.
|
|
135
|
+
2. `research` asks the selected harness to inspect the codebase and summarize
|
|
136
|
+
the task.
|
|
137
|
+
3. `RED/test-write` asks the harness to add failing tests and requires the RED
|
|
138
|
+
gate to see tests fail.
|
|
139
|
+
4. `GREEN/code-write` asks the harness to implement the change and requires
|
|
140
|
+
tests and typecheck to pass.
|
|
141
|
+
5. `VERIFY` runs repository quality checks and an LLM verifier.
|
|
142
|
+
6. `LEARN` writes a compact learning artifact for future context injection.
|
|
143
|
+
|
|
144
|
+
The workflow output has this shape:
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
{
|
|
148
|
+
outcome: "PASS" | "FAIL";
|
|
149
|
+
failureDetails: Array<{
|
|
150
|
+
gate: "RED" | "GREEN" | "VERIFY";
|
|
151
|
+
reason: string;
|
|
152
|
+
evidence: string[];
|
|
153
|
+
}>;
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
`failureDetails` is empty for a full pass. On failure, it reports the first gate
|
|
158
|
+
or gates that prevented the run from passing with captured evidence.
|
|
159
|
+
|
|
160
|
+
## Backlog.md Phase Mapping
|
|
161
|
+
|
|
162
|
+
The CLI creates one parent run id and five Backlog.md phase tasks. Their status
|
|
163
|
+
tracks the pipeline lifecycle:
|
|
164
|
+
|
|
165
|
+
| Backlog suffix | Pipeline phase | Meaning |
|
|
166
|
+
| --- | --- | --- |
|
|
167
|
+
| `R` | `research` | Understand the task and repository context. |
|
|
168
|
+
| `TW` | `test-write` / RED | Add failing tests for the requested behavior. |
|
|
169
|
+
| `CW` | `implement` / GREEN | Implement code until tests and typecheck pass. |
|
|
170
|
+
| `V` | `verify` | Run style, duplication, and LLM verification gates. |
|
|
171
|
+
| `L` | `learn` | Persist learnings from the completed run. |
|
|
172
|
+
|
|
173
|
+
When a gate fails, later phase tasks remain `To Do`, the failing phase remains
|
|
174
|
+
`In Progress`, and the failure evidence is appended to that phase task.
|
|
175
|
+
|
|
176
|
+
## Generated Artifacts
|
|
177
|
+
|
|
178
|
+
Pipeline artifacts are written under the target worktree:
|
|
179
|
+
|
|
180
|
+
- `.pipeline/knowledge-context.md`: context assembled from `rules/*.md` and
|
|
181
|
+
recent `.pipeline/knowledge/*.md` files.
|
|
182
|
+
- `.pipeline/research.json`: captured research output from the research phase.
|
|
183
|
+
- `.pipeline/knowledge/*.md`: learning notes created during the LEARN phase.
|
|
184
|
+
|
|
185
|
+
The runner also creates Backlog.md phase tasks with ids based on
|
|
186
|
+
`TASK-<timestamp>`.
|
|
187
|
+
|
|
188
|
+
## Verification
|
|
189
|
+
|
|
190
|
+
Use these exact commands before committing changes in this repository:
|
|
191
|
+
|
|
192
|
+
```shell
|
|
193
|
+
bun run test
|
|
194
|
+
bun run typecheck
|
|
195
|
+
bun run check
|
|
196
|
+
bun run build
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
`bun run test` is the supported test command for this project. It runs the
|
|
200
|
+
Vitest suite configured in `package.json`; Bun's native test runner is not the
|
|
201
|
+
project suite runner.
|
|
202
|
+
|
|
203
|
+
## Development
|
|
204
|
+
|
|
205
|
+
Start Mastra Studio locally:
|
|
206
|
+
|
|
207
|
+
```shell
|
|
208
|
+
bun run dev
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Open <http://localhost:4111> to inspect and run the Mastra application.
|
|
212
|
+
|
|
213
|
+
## Known Limitations
|
|
214
|
+
|
|
215
|
+
- The CLI does not create or switch git worktrees; provide the intended worktree
|
|
216
|
+
with `PIPELINE_TARGET_PATH` or run from that directory.
|
|
217
|
+
- The pipeline can modify files in the target worktree through the selected
|
|
218
|
+
harness. Review the diff before committing.
|
|
219
|
+
- Harness authentication, model selection, and provider API keys are owned by
|
|
220
|
+
the harness CLI, not this repository.
|
|
221
|
+
- The Backlog.md phase ids use `TASK-<timestamp>`, so repeated runs create new
|
|
222
|
+
task groups rather than updating an existing ticket.
|
|
223
|
+
- Verification depends on the repository scripts and the verifier output. A
|
|
224
|
+
passing LLM verifier is not a substitute for human review.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { type PipelineLifecycleResult } from "./mastra/backlog.js";
|
|
4
|
+
import { type PipelinePrimitiveInput } from "./mastra/pipeline-primitive.js";
|
|
5
|
+
interface WorkNextOptions {
|
|
6
|
+
pipelineRunner?: (input: PipelinePrimitiveInput) => Promise<PipelineLifecycleResult>;
|
|
7
|
+
}
|
|
8
|
+
export declare function workNext(description: string, options?: WorkNextOptions): Promise<void>;
|
|
9
|
+
export declare function createCliProgram(): Command;
|
|
10
|
+
export declare function runCli(argv: string[]): Promise<void>;
|
|
11
|
+
export {};
|