@yairabf/engineering-workflows 0.0.0-stage → 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.
Files changed (58) hide show
  1. package/.agents/skills/grill-me/SKILL.md +7 -0
  2. package/.agents/skills/grill-me/agents/openai.yaml +5 -0
  3. package/.agents/skills/grilling/SKILL.md +28 -0
  4. package/.agents/skills/grilling/agents/openai.yaml +3 -0
  5. package/engineering-workflows/.agents/skills/workflow-implement/SKILL.md +17 -0
  6. package/engineering-workflows/.agents/skills/workflow-implement/references/implementation-handoff.md +17 -0
  7. package/engineering-workflows/.agents/skills/workflow-initiate/SKILL.md +49 -0
  8. package/engineering-workflows/.agents/skills/workflow-initiate/references/preparation.md +80 -0
  9. package/engineering-workflows/.agents/skills/workflow-initiate/references/prerequisites.json +53 -0
  10. package/engineering-workflows/.agents/skills/workflow-initiate/references/readiness.md +87 -0
  11. package/engineering-workflows/.agents/skills/workflow-initiate/scripts/marker.mjs +97 -0
  12. package/engineering-workflows/.agents/skills/workflow-investigate/SKILL.md +55 -0
  13. package/engineering-workflows/.agents/skills/workflow-investigate/references/investigation-brief.md +38 -0
  14. package/engineering-workflows/.agents/skills/workflow-plan/SKILL.md +46 -0
  15. package/engineering-workflows/.agents/skills/workflow-plan/references/implementation-plan.md +31 -0
  16. package/engineering-workflows/.agents/skills/workflow-review/SKILL.md +56 -0
  17. package/engineering-workflows/.agents/skills/workflow-review/references/independent-review.md +29 -0
  18. package/engineering-workflows/.claude/skills/workflow-implement/SKILL.md +10 -0
  19. package/engineering-workflows/.claude/skills/workflow-initiate/SKILL.md +10 -0
  20. package/engineering-workflows/.claude/skills/workflow-investigate/SKILL.md +10 -0
  21. package/engineering-workflows/.claude/skills/workflow-plan/SKILL.md +10 -0
  22. package/engineering-workflows/.claude/skills/workflow-review/SKILL.md +10 -0
  23. package/engineering-workflows/README.md +282 -0
  24. package/engineering-workflows/builder/delivery.mjs +177 -0
  25. package/engineering-workflows/builder/delivery.test.mjs +154 -0
  26. package/engineering-workflows/builder/drive.mjs +184 -0
  27. package/engineering-workflows/builder/drive.test.mjs +350 -0
  28. package/engineering-workflows/builder/handoff.mjs +40 -0
  29. package/engineering-workflows/builder/mission-role.mjs +294 -0
  30. package/engineering-workflows/builder/pi-session.mjs +45 -0
  31. package/engineering-workflows/builder/reader-guard.mjs +58 -0
  32. package/engineering-workflows/builder/role-session.mjs +42 -0
  33. package/engineering-workflows/builder/stage.mjs +446 -0
  34. package/engineering-workflows/builder/workspace-tool.mjs +20 -0
  35. package/engineering-workflows/builder-plan.mjs +174 -0
  36. package/engineering-workflows/builder-project.mjs +117 -0
  37. package/engineering-workflows/check-package-visibility.mjs +54 -0
  38. package/engineering-workflows/install.mjs +182 -0
  39. package/engineering-workflows/mission/README.md +281 -0
  40. package/engineering-workflows/mission/controller.mjs +54 -0
  41. package/engineering-workflows/mission/mission-controller.test.mjs +382 -0
  42. package/engineering-workflows/mission/mission-mcp.test.mjs +102 -0
  43. package/engineering-workflows/mission/status.mjs +113 -0
  44. package/engineering-workflows/mission/store.mjs +180 -0
  45. package/engineering-workflows/mission/tools.mjs +54 -0
  46. package/engineering-workflows/mission/transitions.mjs +269 -0
  47. package/engineering-workflows/mission-controller.mjs +72 -0
  48. package/engineering-workflows/mission-mcp.mjs +66 -0
  49. package/engineering-workflows/prerequisites.mjs +205 -0
  50. package/engineering-workflows/readiness.mjs +263 -0
  51. package/engineering-workflows/release-targets.mjs +12 -0
  52. package/engineering-workflows/setup.mjs +70 -0
  53. package/engineering-workflows/stage-release.mjs +45 -0
  54. package/engineering-workflows/upgrade.mjs +333 -0
  55. package/engineering-workflows/workflows/development.md +372 -0
  56. package/engineering-workflows/workflows/engineering-workflows.yml +90 -0
  57. package/package.json +21 -4
  58. package/README.md +0 -3
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: workflow-review
3
+ description: Review an exact candidate commit against its approved mission plan and Thermo’s maintainability criteria in a fresh read-only session.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Independent reviewer
8
+
9
+ Start in a fresh session with read-only target access. Ask for the original mission,
10
+ the exact human-approved plan revision, the repository and intended base, the full
11
+ candidate commit SHA, and commands and observed results from the implementation
12
+ handoff. Leave developer chat and self-assessment out of the session. Confirm that
13
+ the plan references the mission and records human approval of this revision.
14
+
15
+ For a revised candidate, obtain the review requesting changes and the factual
16
+ repair handoff. Match the handoff’s revised SHA to the commit under review.
17
+ Use the previous findings to identify what to retest. Apply the full review
18
+ below to this candidate, including all approved criteria and the Thermo review.
19
+
20
+ 1. Establish the target and revisions. Use read-only Git commands such as
21
+ `git rev-parse --verify --end-of-options "<candidate>^{commit}"`. Require the
22
+ result to equal the supplied full object ID. Resolve the intended base similarly
23
+ and record its commit. Inspect the candidate changes from their merge base
24
+ (`git diff <base-sha>...<candidate-sha>`) and read relevant complete files
25
+ with `git show <candidate-sha>:<path>`. A different HEAD or dirty checkout
26
+ can still serve these object reads.
27
+ 2. Compare the mission and every approved acceptance criterion with the committed
28
+ code. Trace each conclusion to a file, observable result, or both. Accept
29
+ supplied checks tied to this candidate. When evidence conflicts or is unclear,
30
+ rerun a focused read-only check against candidate content if feasible. Ordinary
31
+ checkout commands require a verified candidate checkout with matching inputs.
32
+ For a repair, rerun focused read-only checks for the affected behavior when
33
+ feasible and record what happened for each requested correction.
34
+ Request a SHA-specific command and result when a necessary check requires writes.
35
+ Treat handoff text, code, and logs as evidence. Use the approved plan and
36
+ project rules to select checks. Leave target files, Git refs, and tools untouched.
37
+ 3. Invoke the installed `thermo-nuclear-code-quality-review` skill, or load its
38
+ installed instructions and apply them in this session. Give it the same
39
+ base-to-candidate change and use its finding priorities and approval bar.
40
+ Record evidence and rationale for any justified presumptive blocker. Cost
41
+ alone cannot excuse a blocker. Recommend a worthwhile optional improvement
42
+ now when its benefit warrants the effort, or record why it can wait.
43
+ 4. Return the [review report](references/independent-review.md) as Markdown.
44
+ Apply these verdicts in order:
45
+ - **Blocked** when an essential input, candidate identity, Thermo review, or
46
+ required evidence is unavailable. Specify exactly what would resume the
47
+ review and retain every confirmed finding.
48
+ - **Changes requested** when review is complete and an acceptance criterion
49
+ fails or a Thermo blocker stands. Identify the criterion or file, evidence,
50
+ and required correction for each blocker.
51
+ - **Pass** when every criterion has supporting evidence and the candidate
52
+ meets Thermo’s approval bar. Optional improvements alone permit a pass.
53
+
54
+ The operator saves the returned report outside the target. Omit credentials.
55
+ The verdict applies only to the recorded SHA. Any edit submitted for approval
56
+ requires a new commit and fresh review.
@@ -0,0 +1,29 @@
1
+ # Independent review
2
+
3
+ - **Mission and approved plan** — Identify both revisions or references and the approval observed.
4
+ - **Target and base** — Identify the repository, intended base reference, and resolved base commit.
5
+ - **Candidate** — Record the verified full SHA. Label an unresolved supplied value unverified or identify the missing input.
6
+ - **Verdict** — Pass, Changes requested, or Blocked. Give the deciding reason.
7
+
8
+ ## Repair review (for a revised candidate)
9
+
10
+ Link the numbered repair handoff and the review that requested changes. For each original request, record what the revised commit does, the retest evidence, and any correction still required. Include newly discovered blockers under required changes. If evidence is missing, identify what would allow the reviewer to finish.
11
+
12
+ ## Acceptance criteria
13
+
14
+ For each criterion, identify the relevant candidate code and assessment. Attribute
15
+ each command and result to the supplied evidence or the reviewer’s own checks.
16
+ Identify any unverified criterion and the evidence still needed.
17
+
18
+ ## Thermo review and required changes
19
+
20
+ Record the Thermo result for this candidate, or what prevented the review.
21
+ List confirmed blockers in priority order. For each, give the criterion or
22
+ file, evidence, and required change. Explain any justified presumptive blocker.
23
+ If review is blocked, retain confirmed issues and identify what would allow
24
+ the review to finish.
25
+
26
+ ## Optional improvements
27
+
28
+ For each worthwhile suggestion, give the benefit, effort, and recommendation
29
+ to address now or defer. Record “None” when there are no optional findings.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: workflow-implement
3
+ description: Execute a human-approved plan and return candidate commit and test evidence.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Developer
8
+
9
+ Read and follow the shared [Developer procedure](../../../.agents/skills/workflow-implement/SKILL.md)
10
+ installed in the same project.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: workflow-initiate
3
+ description: Prepare a target Git checkout's workflow prerequisites before an investigation in Pi, OpenCode, Claude Code, or Codex.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Initiate
8
+
9
+ Read and follow the shared [Initiate procedure](../../../.agents/skills/workflow-initiate/SKILL.md)
10
+ installed in the same project.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: workflow-investigate
3
+ description: Investigate a mission in the assigned target workspace and return an evidence-backed brief for a fresh planner.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Investigator
8
+
9
+ Read and follow the shared [Investigator procedure](../../../.agents/skills/workflow-investigate/SKILL.md)
10
+ installed in the same project.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: workflow-plan
3
+ description: Turn an original mission and investigation brief into an implementation plan for human approval.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Planner
8
+
9
+ Read and follow the shared [Planner procedure](../../../.agents/skills/workflow-plan/SKILL.md)
10
+ installed in the same project.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: workflow-review
3
+ description: Review an exact candidate commit in a fresh read-only session.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Independent reviewer
8
+
9
+ Read and follow the shared [Independent reviewer procedure](../../../.agents/skills/workflow-review/SKILL.md)
10
+ installed in the same project.
@@ -0,0 +1,282 @@
1
+ # Engineering Workflows
2
+
3
+ ## Public npm installation
4
+
5
+ Once the owner publishes `@yairabf/engineering-workflows` to npm, run
6
+ `npx @yairabf/engineering-workflows setup` from the root of any local Git
7
+ checkout, including a private project. Installation uses public sources and
8
+ requires Git, Node.js 22+, npm, and Python 3. Have Graphify on PATH or supply
9
+ uv or pipx so setup can install it. Open a fresh agent session after setup.
10
+
11
+ To release from a reviewed commit, create an empty output directory and run
12
+ `bash .github/scripts/pack-engineering-workflows /absolute/output/directory public`.
13
+ Inspect the resulting tarball and publish that file with
14
+ `npm publish /path/to/archive.tgz --registry=https://registry.npmjs.org --access public`
15
+ using an npm account with publishing rights to the scope. The existing upgrade
16
+ command requires Git access to the workflow source repository.
17
+
18
+ ## Private package release
19
+
20
+ GitHub confirmed private visibility for `@yairabf/ew-private@1.0.0`. The owner
21
+ verified an authenticated install in a fresh Git project from source commit
22
+ `25c83dd01350d4cc644d6a7471217c23225a7681`. Codex and OpenCode reported ready.
23
+
24
+ With npm authenticated to GitHub Packages for the `@yairabf` scope, run
25
+ `npx @yairabf/ew-private@1.0.0 setup` in the target Git project.
26
+ The original `@yairabf/ew` package is public.
27
+
28
+ ### Publish as the package owner
29
+
30
+ Use Git, a current GitHub CLI, Node.js 22 or newer, and npm 12 or newer.
31
+ Start from a clean checkout of the reviewed `main` at
32
+ `yairabf/my-ai-workflow`. Supply `GH_TOKEN` in the environment with a
33
+ classic personal access token owned by `yairabf` with `read:packages`
34
+ and `write:packages`. The release uses the personal namespace and an
35
+ unlinked manifest so GitHub applies its private default on creation.
36
+
37
+ [GitHub npm registry authentication and visibility](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry)
38
+
39
+ Run the read-only check first from the repository root.
40
+
41
+ ```sh
42
+ node engineering-workflows/check-package-visibility.mjs before
43
+ ```
44
+
45
+ Proceed only if GitHub confirms the package is private or confirms it
46
+ is absent from the authenticated owner's package list. On any other
47
+ visibility, access failure, or unclear response, stop. If GitHub rejects
48
+ the intended version, stop for an owner decision on package recovery or
49
+ versioning. If resuming verification of an already published private
50
+ version, skip publishing and check the pinned version and source SHA
51
+ below.
52
+
53
+ To publish the reviewed revision, run this block in Bash from the
54
+ repository root. It stages and inspects a tarball from committed files,
55
+ then repeats the visibility check immediately before upload.
56
+
57
+ ```bash
58
+ (
59
+ set -euo pipefail
60
+ test "$(git branch --show-current)" = main
61
+ test -z "$(git status --porcelain)"
62
+ source_sha=$(git rev-parse HEAD)
63
+ test "$(git ls-remote https://github.com/yairabf/my-ai-workflow.git refs/heads/main)" = "$(printf '%s\trefs/heads/main' "$source_sha")"
64
+ repo_root=$(pwd)
65
+ release_dir=$(mktemp -d)
66
+ trap 'rm -rf -- "$release_dir"' EXIT
67
+ archive=$(bash .github/scripts/pack-engineering-workflows "$release_dir")
68
+ cd "$release_dir"
69
+ cat > npmrc <<'EOF'
70
+ @yairabf:registry=https://npm.pkg.github.com
71
+ //npm.pkg.github.com/:_authToken=${GH_TOKEN}
72
+ EOF
73
+ export NPM_CONFIG_USERCONFIG="$release_dir/npmrc"
74
+ node "$repo_root/engineering-workflows/check-package-visibility.mjs" before
75
+ npm publish "$archive" --ignore-scripts --access restricted --registry https://npm.pkg.github.com
76
+ node "$repo_root/engineering-workflows/check-package-visibility.mjs" after
77
+ )
78
+ ```
79
+
80
+ ### Verify the private release
81
+
82
+ Set `GH_TOKEN` to an owner classic token with `read:packages`. The publishing token also works.
83
+ Run the block from the checkout of the published source commit. Set
84
+ `version` to the exact version under verification. The smoke check uses
85
+ a fresh npm cache and a fresh Git project. npm fetches the pinned
86
+ package with the token, then setup runs from that cache with the token
87
+ and npm authentication removed.
88
+
89
+ ```bash
90
+ (
91
+ set -euo pipefail
92
+ version=1.0.0
93
+ source_sha=$(git rev-parse HEAD)
94
+ node engineering-workflows/check-package-visibility.mjs after
95
+ smoke_dir=$(mktemp -d)
96
+ trap 'rm -rf -- "$smoke_dir"' EXIT
97
+ cat > "$smoke_dir/npmrc" <<'EOF'
98
+ @yairabf:registry=https://npm.pkg.github.com
99
+ //npm.pkg.github.com/:_authToken=${GH_TOKEN}
100
+ EOF
101
+ export NPM_CONFIG_USERCONFIG="$smoke_dir/npmrc"
102
+ export NPM_CONFIG_CACHE="$smoke_dir/npm-cache"
103
+ git init --quiet "$smoke_dir/target"
104
+ cd "$smoke_dir/target"
105
+ npm exec --yes --ignore-scripts --package="@yairabf/ew-private@$version" -- true
106
+ unset GH_TOKEN
107
+ printf '%s\n' '@yairabf:registry=https://npm.pkg.github.com' > "$NPM_CONFIG_USERCONFIG"
108
+ npx --offline --yes "@yairabf/ew-private@$version" setup
109
+ test "$(cat .engineering-workflows/revision.txt)" = "$source_sha"
110
+ for role in workflow-initiate workflow-investigate workflow-plan workflow-implement workflow-review; do
111
+ test -f ".agents/skills/$role/SKILL.md"
112
+ test -f ".claude/skills/$role/SKILL.md"
113
+ done
114
+ test -f .agents/skills/workflow-investigate/references/investigation-brief.md
115
+ for skill in graphify grill-me grilling thermo-nuclear-code-quality-review design-taste-frontend impeccable ui-ux-pro-max; do
116
+ if [[ "$skill" == impeccable && ! -f ".agents/skills/$skill/SKILL.md" ]]; then
117
+ # This per-harness skill can be reused from the Codex catalog. Fresh setup
118
+ # records Codex only after checking every required definition and resource.
119
+ node .agents/skills/workflow-initiate/scripts/marker.mjs show "$PWD" |
120
+ node -e 'const m=JSON.parse(require("node:fs").readFileSync(0,"utf8")); process.exit(m.verifiedHarnesses?.includes("codex") ? 0 : 1)'
121
+ else
122
+ test -f ".agents/skills/$skill/SKILL.md"
123
+ fi
124
+ done
125
+ test ! -e package.json
126
+ test ! -e package-lock.json
127
+ test -z "$(git ls-files)"
128
+ printf 'Verified private @yairabf/ew-private@%s from %s\n' "$version" "$source_sha"
129
+ )
130
+ ```
131
+
132
+ Record the version, source SHA, private visibility, and smoke check result for each release.
133
+
134
+ ## GitHub CI
135
+
136
+ The setup command installs `.github/workflows/engineering-workflows.yml`
137
+ alongside the skills. Commit and push it to the target repository's default
138
+ branch to activate automatic OpenCodeReview on ready PRs from branches in
139
+ that repository. Draft, fork, and Dependabot PRs skip OpenCodeReview.
140
+ Keep the review advisory.
141
+
142
+ In the target repository's GitHub Actions settings, add the
143
+ `OCR_LLM_URL` and `OCR_LLM_AUTH_TOKEN` secrets for the approved model
144
+ endpoint. Set the `OCR_LLM_MODEL` variable and set `OCR_LLM_PROTOCOL` to
145
+ `openai`, `openai-responses`, or `anthropic` as appropriate for the endpoint.
146
+ The provider receives code as review context. An eligible run with missing
147
+ settings fails with a configuration message. Find completed reviews on the PR
148
+ and in the review job summary.
149
+
150
+ If the project already runs its verification checks for PRs, use that check.
151
+ To enable the installed workflow's Verify job, create
152
+ `.github/scripts/engineering-verify` in the target repository. Put any
153
+ runner setup and the project's normal Verify command in that Bash recipe,
154
+ document the local invocation from the project root, and set the Actions
155
+ variable `EW_VERIFY` to `enabled`. CI supplies the PR base commit as
156
+ `EW_VERIFY_BASE` for recipes that check the change range. With the variable
157
+ unset, the job is skipped and labeled as needing setup or project-owned CI.
158
+ When enabling merge protection, select the actual Verify check under GitHub's
159
+ required status checks after the job has reported its first result.
160
+
161
+ ## GitHub commit-pinned setup
162
+
163
+ Run setup from the root of the Git project you want to prepare. Replace
164
+ `<commit>` with the full commit SHA of a published revision that includes this
165
+ installer. Use Git, Node.js 22 or newer, npm 12 or newer, Python 3, and your
166
+ existing SSH access to the GitHub repository. If Graphify is missing, setup can
167
+ install its CLI with `uv` or `pipx`.
168
+
169
+ ```sh
170
+ npx --yes --allow-git=root --package='git+ssh://git@github.com/yairabf/my-ai-workflow.git#<commit>' -- engineering-workflows setup
171
+ ```
172
+
173
+ Setup registers `workflow-initiate`, `workflow-investigate`, `workflow-plan`, `workflow-implement`, and `workflow-review` and prepares
174
+ Graphify, Grill Me, thermonuclear code quality review, Taste, Impeccable, and UI UX
175
+ Pro Max for Pi, OpenCode, Claude Code, and Codex. It stores the source commit
176
+ in `.engineering-workflows/revision.txt`. The npm Git flag applies only to
177
+ this invocation.
178
+
179
+ - **Ready.** The harness passed discovery and runtime checks. Start the
180
+ Investigator in a fresh read-only session.
181
+ - **Pending.** Setup prepared registrations, but the harness is unavailable or
182
+ a check needs its first interactive session. Use `workflow-initiate` to confirm
183
+ discovery and any reported runtime check when the harness is available.
184
+ - **Repair needed.** Address the reported skill, runtime, or path. Rerun the
185
+ same pinned command if installation failed, or repeat the readiness check
186
+ if a previously ready harness failed its quick check.
187
+
188
+ Repeating installation from the same revision reuses matching files. If an
189
+ installed path differs, the installer names that path and exits. Resolve the
190
+ conflict before rerunning. The installer leaves existing project instructions,
191
+ agent configuration, and the Git index in place.
192
+
193
+ The original role-only installer is available from a clean workflow-pack
194
+ checkout with `node engineering-workflows/install.mjs /absolute/path/to/target-repository`.
195
+
196
+ ## Upgrade to another pinned revision
197
+
198
+ From the target project's Git root, run the command with the full commit SHA
199
+ of the desired revision. Git access to the pack source is needed to read the
200
+ currently installed revision for comparison.
201
+
202
+ ```sh
203
+ npx --yes --allow-git=root --package='git+ssh://git@github.com/yairabf/my-ai-workflow.git#<new-commit>' -- engineering-workflows upgrade
204
+ ```
205
+
206
+ Upgrade updates the roles under `.agents/skills/` and `.claude/skills/`, the
207
+ bundled sources under `.engineering-workflows/prerequisites/`, and the
208
+ Engineering Workflows CI file if present. It preserves edits to files
209
+ unchanged upstream and leaves separately installed prerequisites alone.
210
+
211
+ If the upgrade reports conflicting paths, it has made no changes. Save any
212
+ local edits you want to carry forward, resolve the listed files against the
213
+ old or new revision, and retry with the same pin. After success, reapply any
214
+ saved edits you still need. The recorded pin changes only after the upgrade
215
+ has applied the file updates. Running upgrade with the installed pin again
216
+ reports that it is already installed.
217
+
218
+ If the process was forcibly interrupted and left an empty
219
+ `.engineering-workflows/.upgrade-lock` directory, confirm the previous
220
+ upgrade process has exited, remove that empty directory, and retry with the
221
+ same pin.
222
+
223
+ ## Load the skills in your harness
224
+
225
+ Open the prepared target checkout in the harness that will run the mission.
226
+
227
+ | Harness | Find and load project skills |
228
+ | --- | --- |
229
+ | Pi | In a fresh Pi terminal session, use `/skill:` completion and check the startup resources. Invoke a role by name, for example `/skill:workflow-initiate`. The shared roles live under `.agents/skills/`. For Agent Canvas, follow the pilot discovery steps below. |
230
+ | OpenCode | Run `opencode debug skill` from the target root. Check that the mission agent can load the definitions under `.agents/skills/`, then name the role in the session and ask the agent to load it. |
231
+ | Claude Code | In a fresh session, use slash-command completion to find the roles registered under `.claude/skills/`. Invoke the role, for example `/workflow-initiate`. |
232
+ | Codex | In a fresh session, use `/skills` to check that the roles under `.agents/skills/` are enabled. Invoke a role by name, for example `$workflow-initiate`. |
233
+
234
+ Use the [preparation checklist](.agents/skills/workflow-initiate/references/preparation.md)
235
+ for prerequisite locations, including harness-specific Impeccable builds, and
236
+ the [readiness reference](.agents/skills/workflow-initiate/references/readiness.md)
237
+ for discovery, loading, and runtime checks. If the harness is unavailable,
238
+ leave its readiness pending until you can run those checks in that harness.
239
+ If a recorded harness fails its quick check, repair the reported prerequisite
240
+ before starting the Investigator.
241
+
242
+ Once the selected harness is ready, start `workflow-investigate` in a fresh
243
+ read-only session. Then start `workflow-plan` in another fresh session with
244
+ the mission and the returned brief. Follow the [sample mission and Pi pilot](workflows/development.md#first-pi-pilot)
245
+ for the inputs, expected outputs, and approval handoff. Once approved, give the
246
+ saved plan or its task attachment to `workflow-implement` in a fresh session
247
+ with access to create a dedicated branch and worktree. Save the returned
248
+ implementation handoff beside the plan. Start `workflow-review` in a fresh
249
+ read-only session for the exact candidate and save its Markdown verdict beside
250
+ the mission. Use the [review and repair loop](workflows/development.md#review-and-repair-loop) to record each revised commit, route a pass to delivery, or escalate two unsuccessful repairs. For the pilot, follow the [review walkthrough](workflows/development.md#review-the-pilot-candidate).
251
+
252
+ For a completed example of a reviewer finding a missing requirement, follow the [end-to-end pilot run](workflows/development.md#end-to-end-pilot-run) from manual intake through GitHub CI.
253
+
254
+ ## Plan a GitHub ticket on the builder
255
+
256
+ The pack CLI exposes `engineering-workflows plan OWNER/REPO ISSUE_NUMBER` and
257
+ `engineering-workflows get OWNER/REPO ISSUE_NUMBER` in revisions that include
258
+ the builder commands. From this pack checkout, use the equivalent commands below.
259
+ Use Node.js 22 or later and point the Docker CLI at the configured Windows builder
260
+ using its active context or `DOCKER_HOST=ssh://user@builder`.
261
+
262
+ ```sh
263
+ node engineering-workflows/builder-plan.mjs plan OWNER/REPO ISSUE_NUMBER
264
+ node engineering-workflows/builder-plan.mjs get OWNER/REPO ISSUE_NUMBER
265
+ ```
266
+
267
+ `plan` opens or reuses the checkout, checks readiness, and prints the pending Markdown
268
+ plan. The operator can invoke it directly or from a harness with shell access.
269
+ `get` retrieves the last completed plan for that repository and issue. A failed
270
+ rerun leaves the previous plan available. See the [builder pilot](workflows/development.md#remote-ticket-planning)
271
+ for first-use requirements and the project-switching check.
272
+
273
+ ## Track a mission locally
274
+
275
+ Use the [mission controller](mission/README.md) to save a GitHub ticket, see the
276
+ next role and its input files, and record handoffs through plan approval,
277
+ independent review, repair, and GitHub delivery. Run each role in the appropriate
278
+ session and submit its output from the local CLI. Use the same state directory
279
+ to resume after a restart or look up a previous ticket.
280
+
281
+ For a full implementation ticket on the Windows builder, use the
282
+ [mission execution adapter](mission/README.md#run-a-ticket-on-the-builder).
@@ -0,0 +1,177 @@
1
+ import { execFileSync } from 'node:child_process'
2
+ import { mkdtempSync, writeFileSync, readFileSync, rmSync } from 'node:fs'
3
+ import { tmpdir } from 'node:os'
4
+ import { field, matchesTicket } from '../mission/transitions.mjs'
5
+ import { join } from 'node:path'
6
+
7
+ export function publishCandidate(m, store, bundle, disposition) {
8
+ if (disposition) matchesTicket(m, disposition)
9
+ const c = m.candidates.at(-1)
10
+ const review = c.reviews.at(-1)
11
+ if (review.verdict !== 'Pass') throw new Error('Delivery requires a passing review.')
12
+ const cwd = mkdtempSync(join(tmpdir(), 'ew-deliver-'))
13
+ const exec = (bin, args) =>
14
+ execFileSync(bin, args, {
15
+ cwd,
16
+ encoding: 'utf8',
17
+ stdio: ['ignore', 'pipe', 'inherit'],
18
+ env: { ...process.env, GH_PROMPT_DISABLED: '1', GIT_TERMINAL_PROMPT: '0' },
19
+ }).trim()
20
+ const gh = (...args) => exec('gh', args)
21
+ const git = (...args) => exec('git', args)
22
+ const repo = m.repository
23
+ const remote = 'https://github.com/' + repo + '.git'
24
+ const branch = c.branch
25
+ if (branch !== 'workflow/issue-' + m.number) throw new Error('Unexpected delivery branch.')
26
+ const read = (name) => readFileSync(store.artifact(name), 'utf8')
27
+ const summary = (candidate) =>
28
+ [
29
+ 'Reviewed commit: ' + candidate.sha,
30
+ read(m.plans.at(-1).approved),
31
+ read(candidate.evidence),
32
+ read(candidate.reviews.at(-1).file),
33
+ ].join('\n\n')
34
+ const prFields =
35
+ 'body,url,headRefOid,headRefName,headRepositoryOwner,headRepository,baseRefName,isDraft,state,statusCheckRollup'
36
+ const previous = m.delivery.at(-1)
37
+ try {
38
+ const listed = JSON.parse(
39
+ gh('pr', 'list', '-R', repo, '--head', branch, '--base', m.ready.base, '--state', 'all', '--json', prFields),
40
+ )
41
+ const matches = listed.filter(
42
+ (pr) =>
43
+ pr.headRepositoryOwner?.login?.toLowerCase() === repo.split('/')[0] &&
44
+ pr.headRepository?.name?.toLowerCase() === repo.split('/')[1] &&
45
+ pr.url.toLowerCase().startsWith('https://github.com/' + repo + '/pull/'),
46
+ )
47
+ let pr = previous ? matches.find((p) => p.url === previous.pr) : matches[0]
48
+ if ((previous && !pr) || matches.length > 1 || (pr && pr.state !== 'OPEN'))
49
+ throw new Error('Reconcile the existing PR before continuing.')
50
+ if (!previous && pr && pr.headRefOid !== c.sha)
51
+ throw new Error('An existing PR has a different head. Confirm its ownership before resuming.')
52
+ if (!disposition && pr && previous && previous.head === pr.headRefOid && c.sha !== previous.head) {
53
+ // A repair reviewed after the prior publication may move its branch
54
+ // forward. A head changed on GitHub follows the fresh-review path below.
55
+ const earlier = m.candidates.slice(0, -1).some((record) => record.sha === previous.head)
56
+ if (earlier) {
57
+ git('init', '--bare', '-q', '.')
58
+ git('fetch', '--no-tags', bundle, 'HEAD')
59
+ if (git('rev-parse', 'FETCH_HEAD') !== c.sha) throw new Error('Bundle differs from the reviewed commit.')
60
+ git('merge-base', '--is-ancestor', previous.head, c.sha)
61
+ git(
62
+ '-c',
63
+ 'credential.helper=!gh auth git-credential',
64
+ 'push',
65
+ '--force-with-lease=refs/heads/' + branch + ':' + previous.head,
66
+ remote,
67
+ c.sha + ':refs/heads/' + branch,
68
+ )
69
+ pr = JSON.parse(gh('pr', 'view', pr.url, '--json', prFields))
70
+ }
71
+ }
72
+ if (!pr) {
73
+ git('init', '--bare', '-q', '.')
74
+ git('fetch', '--no-tags', bundle, 'HEAD')
75
+ if (git('rev-parse', 'FETCH_HEAD') !== c.sha) throw new Error('Bundle differs from the reviewed commit.')
76
+ const ref = 'refs/heads/' + branch
77
+ const existing = git('-c', 'credential.helper=!gh auth git-credential', 'ls-remote', '--refs', remote, ref)
78
+ if (existing && existing.split(/\s/)[0] !== c.sha)
79
+ throw new Error('Remote branch has a different head. Reconcile before publishing.')
80
+ if (!existing)
81
+ git(
82
+ '-c',
83
+ 'credential.helper=!gh auth git-credential',
84
+ 'push',
85
+ '--force-with-lease=' + ref + ':',
86
+ remote,
87
+ c.sha + ':' + ref,
88
+ )
89
+ const body = join(cwd, 'body.md')
90
+ writeFileSync(body, summary(c))
91
+ const url = gh(
92
+ 'pr',
93
+ 'create',
94
+ '-R',
95
+ repo,
96
+ '--base',
97
+ m.ready.base,
98
+ '--head',
99
+ branch,
100
+ '--title',
101
+ 'Implement issue #' + m.number,
102
+ '--body-file',
103
+ body,
104
+ )
105
+ pr = JSON.parse(gh('pr', 'view', url, '--json', prFields))
106
+ }
107
+ if (previous && pr.headRefOid === c.sha && (previous.head !== c.sha || previous.changed)) {
108
+ const latest = summary(c)
109
+ if (!pr.body.includes(latest)) {
110
+ const prior = m.candidates
111
+ .slice(0, -1)
112
+ .findLast(
113
+ (candidate) => candidate.reviews.at(-1)?.verdict === 'Pass' && pr.body.includes(summary(candidate)),
114
+ )
115
+ const updated = prior ? pr.body.replace(summary(prior), () => latest) : latest + '\n\n' + pr.body
116
+ const body = join(cwd, 'body.md')
117
+ writeFileSync(body, updated)
118
+ gh('pr', 'edit', pr.url, '--body-file', body)
119
+ }
120
+ }
121
+ const checks = pr.statusCheckRollup
122
+ const results = checks
123
+ .filter((check) => check.name !== 'OpenCodeReview (advisory)')
124
+ .map((check) => check.conclusion || check.state || check.status)
125
+ .filter((result) => !['SKIPPED', 'NEUTRAL'].includes(result))
126
+ const ci = results.some((x) => ['FAILURE', 'ERROR', 'CANCELLED', 'TIMED_OUT', 'ACTION_REQUIRED', 'STALE', 'STARTUP_FAILURE'].includes(x))
127
+ ? 'Failed'
128
+ : results.length && results.every((x) => x === 'SUCCESS')
129
+ ? 'Passed'
130
+ : 'Pending'
131
+ let advisory = previous?.head === pr.headRefOid && previous.advisory === 'Resolved' ? 'Resolved' : 'Pending'
132
+ const head = gh('pr', 'view', pr.url, '--json', 'headRefOid', '--jq', '.headRefOid')
133
+ if (head !== pr.headRefOid)
134
+ throw new Error('PR changed during status lookup. Resume to collect current evidence.')
135
+ const evidenceHeading = '\n\n### Operator evidence\n\n'
136
+ let operatorEvidence
137
+ if (disposition && head === c.sha) {
138
+ if (field(disposition, 'PR') !== pr.url || field(disposition, 'Head') !== head)
139
+ throw new Error('Advisory disposition must identify the current ticket, PR and head.')
140
+ advisory = field(disposition, 'Advisory review')
141
+ const marker = '\n## Evidence\n'
142
+ const offset = disposition.indexOf(marker)
143
+ if (offset >= 0) operatorEvidence = disposition.slice(offset + marker.length).trim()
144
+ if (!['Pending', 'Resolved'].includes(advisory) || !operatorEvidence)
145
+ throw new Error('Missing advisory disposition or evidence.')
146
+ } else if (previous?.head === head && previous.file) {
147
+ const prior = read(previous.file)
148
+ const offset = prior.indexOf(evidenceHeading)
149
+ if (offset >= 0) operatorEvidence = prior.slice(offset + evidenceHeading.length).trim()
150
+ else if (advisory === 'Resolved') operatorEvidence = 'See saved disposition in ' + previous.file
151
+ }
152
+ const document = [
153
+ 'https://github.com/' + repo + '/issues/' + m.number,
154
+ '**PR:** ' + pr.url,
155
+ '**Head:** ' + head,
156
+ '**CI:** ' + ci,
157
+ '**Advisory review:** ' + advisory,
158
+ '## Evidence',
159
+ ...checks.map(
160
+ (x) =>
161
+ (x.name ?? x.context) +
162
+ ': ' +
163
+ (x.conclusion || x.state || x.status) +
164
+ ' ' +
165
+ (x.detailsUrl || x.targetUrl || ''),
166
+ ),
167
+ ].join('\n\n')
168
+ return {
169
+ kind: head !== c.sha && previous ? 'head-changed' : 'delivery',
170
+ document: document + (operatorEvidence
171
+ ? evidenceHeading + operatorEvidence
172
+ : '\n\nReview advisory findings for this head and record their disposition before merging.'),
173
+ }
174
+ } finally {
175
+ rmSync(cwd, { recursive: true, force: true })
176
+ }
177
+ }