@plainconceptsplatform/workflows 0.6.1 → 0.16.2

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/README.md +107 -88
  2. package/dist/catalog-installation.d.ts +39 -2
  3. package/dist/catalog-installation.js +172 -109
  4. package/dist/index.js +128 -73
  5. package/dist/package-baseline.d.ts +25 -0
  6. package/dist/package-baseline.js +138 -0
  7. package/dist/route-processing.d.ts +0 -2
  8. package/dist/route-processing.js +22 -91
  9. package/dist/stack-defaults.js +18 -12
  10. package/dist/tui.js +27 -43
  11. package/dist/worker-env.d.ts +46 -0
  12. package/dist/worker-env.js +179 -0
  13. package/dist/workflow-catalog.d.ts +4 -2
  14. package/dist/workflow-catalog.js +5 -3
  15. package/loops/actions/add-issue-labels/action.yml +20 -0
  16. package/loops/actions/audit-close/action.yml +180 -128
  17. package/loops/actions/classify-route/classify-route.sh +8 -2
  18. package/loops/actions/housekeeping/action.yml +251 -0
  19. package/loops/actions/merge-agent-pr/action.yml +13 -0
  20. package/loops/actions/report-workflow-errors/action.yml +414 -0
  21. package/loops/actions/validate-merge-gate-output/validate-merge-gate-output.sh +13 -1
  22. package/loops/actions/validate-triage-output/action.yml +1 -1
  23. package/loops/actions/validate-triage-output/validate-triage-output.sh +9 -5
  24. package/loops/actions/verify-composite-actions/verify-composite-actions.sh +53 -0
  25. package/loops/actions/verify-route-matrix/verify-route-matrix.sh +911 -170
  26. package/loops/templates/agentics/agentics-error-report.yml +98 -0
  27. package/loops/templates/opencode/opencode.ci.json +1 -1
  28. package/loops/workflows/agent-apply-review.md +438 -469
  29. package/loops/workflows/agent-audit.md +200 -213
  30. package/loops/workflows/agent-implement.md +591 -640
  31. package/loops/workflows/agent-merge-gate.md +826 -844
  32. package/loops/workflows/agent-refine.md +590 -633
  33. package/loops/workflows/agent-release.md +244 -258
  34. package/loops/workflows/agent-triage.md +476 -447
  35. package/loops/workflows/authorize-bot-work.yml +26 -6
  36. package/loops/workflows/shared/platform-defaults.md +18 -1
  37. package/loops/workflows/work-router.yml +1185 -1038
  38. package/package.json +9 -8
  39. package/dist/action-validation.test.d.ts +0 -1
  40. package/dist/action-validation.test.js +0 -87
  41. package/dist/catalog-installation.test.d.ts +0 -1
  42. package/dist/catalog-installation.test.js +0 -485
  43. package/dist/catalog-listing.test.d.ts +0 -1
  44. package/dist/catalog-listing.test.js +0 -150
  45. package/dist/index.test.d.ts +0 -1
  46. package/dist/index.test.js +0 -273
  47. package/dist/repository-inspection.test.d.ts +0 -1
  48. package/dist/repository-inspection.test.js +0 -77
  49. package/dist/route-processing.test.d.ts +0 -1
  50. package/dist/route-processing.test.js +0 -283
  51. package/dist/stack-defaults.test.d.ts +0 -1
  52. package/dist/stack-defaults.test.js +0 -266
  53. package/dist/tui.test.d.ts +0 -1
  54. package/dist/tui.test.js +0 -249
  55. package/dist/workflow-catalog.test.d.ts +0 -1
  56. package/dist/workflow-catalog.test.js +0 -29
  57. package/loops/actions/stale-recovery/action.yml +0 -288
  58. package/loops/actions/update-changelog/action.yml +0 -113
@@ -1,213 +1,200 @@
1
- ---
2
- # Managed by @plainconceptsplatform/workflows. Source: loops/workflows/agent-audit.md. Update with `workflows update --force`; consumer edits may be overwritten.
3
- env:
4
- REPO_RULES: "Read-only repository audit. Report only reproducible, actionable defects with evidence. Look for: architectural layer violations, missing tests, security gaps, performance issues, and documentation drift. Do not modify files, commit, push, or run write operations."
5
- AUDIT_MARKER: "<!-- agent-audit -->"
6
- GIT_AUTHOR_NAME: "github-actions[bot]"
7
- GIT_AUTHOR_EMAIL: "github-actions[bot]@users.noreply.github.com"
8
- GIT_COMMITTER_NAME: "github-actions[bot]"
9
- GIT_COMMITTER_EMAIL: "github-actions[bot]@users.noreply.github.com"
10
- description: |
11
- Read-only repository audit. Finds 5-7 problems, scores each 1-10, files a single issue
12
- with all findings listed and the top 3 refined as actionable user stories. The issue is
13
- labelled `audit` + `bug` + `refine`, so Refine sizes it and splits a multi-defect report
14
- into one estimated issue per finding rather than one pull request that has to fix them all. Replaces .loops/recipes/guardrails-audit-loop.yaml.
15
-
16
- Router-only worker: triggered exclusively via workflow_call from work-router.yml.
17
- Contract input: trigger-kind(scheduled|manual).
18
- The router owns the weekly Monday schedule and manual dispatch.
19
-
20
- The `skip-if-match` below is backpressure, so the audit stops filing reports while three
21
- are still unactioned.
22
-
23
- name: "Agent: Audit"
24
-
25
- # Shared: network policy only. This workflow owns its Safe Outputs and OpenCode configuration.
26
- # permissions, engine, model and runs-on cannot be shared , see shared/platform-defaults.md.
27
- imports:
28
- - github/gh-aw/.github/workflows/shared/opencode.md@v0.87.5
29
- - shared/platform-defaults.md
30
- - shared/opencode-ci.md
31
-
32
- on:
33
- workflow_call:
34
- inputs:
35
- trigger-kind:
36
- description: "Audit trigger: scheduled or manual"
37
- required: false
38
- type: string
39
- default: manual
40
-
41
- # Rung 1. Do not pile reports on top of unactioned reports.
42
- skip-if-match:
43
- query: "is:issue is:open label:audit"
44
- max: 3
45
-
46
- runs-on: agents-arc
47
- runs-on-slim: agents-arc
48
-
49
- secrets:
50
- OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
51
-
52
- engine:
53
- id: opencode
54
- version: "1.2.14"
55
- env:
56
- OPENAI_BASE_URL: https://forge.plainconcepts.com/v1
57
-
58
- model: openai/glm-5-3
59
-
60
- max-turns: 300
61
- max-turn-cache-misses: 3000
62
- max-ai-credits: 5000
63
-
64
- permissions: read-all
65
-
66
- steps:
67
- - name: List what is already tracked
68
- uses: ./.github/actions/list-open-issues
69
- with:
70
- token: ${{ github.token }}
71
- repo: ${{ github.repository }}
72
-
73
- jobs:
74
- conclude:
75
- needs: [activation, agent, safe_outputs]
76
- if: >
77
- needs.agent.result == 'success' &&
78
- needs.safe_outputs.result == 'success' &&
79
- needs.safe_outputs.outputs.process_safe_outputs_processed_count != '0'
80
- runs-on: agents-arc
81
- permissions:
82
- contents: read
83
- issues: write
84
- steps:
85
- - name: Checkout workflow actions
86
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
87
- with:
88
- persist-credentials: false
89
- - name: Create bot token
90
- id: app-token
91
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
92
- with:
93
- client-id: ${{ secrets.BOT_APP_ID }}
94
- private-key: ${{ secrets.BOT_PRIVATE_KEY }}
95
- # No apply-agent-output here. The safe_outputs job already created the issue and
96
- # exposes its number; calling the action with create-issues would file a second copy
97
- # of the same report. It was only needed while staged: true suppressed the native
98
- # write, and staged is gone.
99
- - name: Apply audit labels to created issues
100
- if: needs.safe_outputs.outputs.created_issue_number != ''
101
- uses: ./.github/actions/add-issue-labels
102
- with:
103
- token: ${{ steps.app-token.outputs.token }}
104
- issue-number: ${{ needs.safe_outputs.outputs.created_issue_number }}
105
- labels: |
106
- audit
107
- bug
108
- refine
109
-
110
- safe-outputs:
111
- # A failed run is already a red run. An issue per failure buries the real backlog
112
- # under noise nobody closes.
113
- report-failure-as-issue: false
114
- threat-detection: false
115
- create-issue:
116
- max: 1
117
-
118
- timeout-minutes: 45
119
- ---
120
-
121
- 1. Call skill("pc-repo-audit"), then run `/repo-audit` as a read-only audit of this
122
- repository. Do not modify any file, do not commit, and do not push.
123
-
124
- 2. Apply repository documentation and established conventions while auditing. Focus on
125
- concrete defects and avoid recommendations that weaken security, tests, or checks.
126
- Adhere to ${{ env.REPO_RULES }}.
127
-
128
- From the audit report, find **5 to 7 problems**. For each finding, verify it meets ALL
129
- of these criteria before keeping it:
130
- - A specific, reproducible problem in a specific file or component.
131
- - Has real impact: security risk, data loss, crash, or broken functionality.
132
- - Something a developer could pick up and fix without further investigation.
133
- Discard anything vague, stylistic, theoretical, or nice-to-have. If you cannot find 5 that
134
- meet this bar, file as many as you can. If you find zero, call `noop` and stop , that is a
135
- good result.
136
-
137
- 3. **Score each surviving finding from 1 to 10**, based on:
138
- | Factor | Weight |
139
- |---|---|
140
- | Severity (how bad is the impact?) | high |
141
- | Likelihood (how often does it trigger?) | medium |
142
- | Blast radius (how many users/components affected?) | medium |
143
- | Ease of fix (can it be fixed in one PR?) | low bonus |
144
-
145
- Write the score next to each finding in your reasoning.
146
-
147
- 4. Read `/tmp/gh-aw/agent/open-issues.json`, which lists every open issue with its title and
148
- labels. Discard any finding already tracked there. Exact-title duplicates are rejected for
149
- you; your job is the ones worded differently that mean the same thing.
150
-
151
- Open issues only cover what is still open, so a finding reported weeks ago and closed
152
- without a fix, or deliberately rejected, would come back every single run. Before scoring,
153
- call `memory_smart_search` for prior audits of this repository and drop any finding that
154
- was already reported and consciously not acted on. After you have decided what to file,
155
- call `memory_save` once with a compact record of this audit: the date, each finding's file
156
- and one-line description, and its disposition (filed, already tracked, or previously
157
- rejected). Keep it short; it is read by the next audit, not by a person.
158
-
159
- A finding you have reported before and that is genuinely still broken IS worth filing
160
- again. What this prevents is re-filing something the team looked at and chose to live
161
- with, which is the noise that makes an audit backlog get ignored.
162
-
163
- 5. Call `create_issue` **once** with title "Audit: <date>". Do NOT specify labels , the
164
- conclude job will apply them. The body MUST have two sections:
165
-
166
- **Section 1 , All findings:** A numbered list of every finding (5-7) with its score,
167
- file path, and a one-line description. Order by score descending.
168
-
169
- **Section 2 , Top 3 to implement:** Call skill("pc-plan-story") and refine the top 3
170
- findings by score into user stories in Mike Cohn's As a / I want to / so that format
171
- with Given/When/Then acceptance criteria, edge cases, and likely files to change. Mark
172
- this section clearly with a heading like `## Top 3 , To Implement`.
173
-
174
- The issue you file goes to Refine, not straight to implementation. Refine sizes it and,
175
- because a report of several unrelated defects across different files is exactly the shape
176
- that does not land as one pull request, splits it into one properly estimated issue per
177
- finding. Write each finding so it survives that split: self-contained, naming its own
178
- files and its own acceptance criteria, never "as above" or "same as finding 2".
179
-
180
- 6. If nothing met the bar, call `noop` and stop. Filing nothing is the right outcome when
181
- the codebase is clean.
182
-
183
- ## Diagram
184
-
185
- ```mermaid
186
- flowchart TD
187
- auditStart("Work Router<br/>audit route<br/>(Mondays or dispatch)") --> auditBackpressure
188
- auditBackpressure["Backpressure (rung 1)<br/>Fewer than 3 open reports?"] -->|✓| auditTracked
189
- auditBackpressure -.->|✗| auditIdle
190
- auditTracked("Tracked (rung 3)<br/>Open issue titles to disk") --> auditRun
191
- auditRun("Audit<br/>/repo-audit, read-only") -->|✓| auditTriage
192
- auditRun -.->|✗| auditFail
193
- auditTriage["Triage<br/>Find 5-7 problems, score 1-10, dedupe"] -->|✓| auditPropose
194
- auditTriage -.->|nothing found| auditQuiet
195
- auditPropose("Propose<br/>Single issue: all findings + top 3 refined") -->|✓| auditReport
196
- auditPropose -.->|✗| auditFail
197
- auditReport(("Conclude<br/>audit+bug+refine on single issue<br/>Refine sizes and splits it"))
198
- auditQuiet(("Quiet<br/>Nothing actionable, nothing proposed"))
199
- auditIdle(("Idle<br/>Reports still awaiting action"))
200
- auditFail(("Fail<br/>Audit or proposal failed"))
201
- classDef start fill:#ffffff,stroke:#172033,stroke-width:2px,color:#172033
202
- classDef action fill:#eef0ff,stroke:#554cff,stroke-width:2px,color:#172033
203
- classDef decision fill:#fff8e8,stroke:#c75b00,stroke-width:2px,color:#172033
204
- classDef idle fill:#202c40,stroke:#738198,stroke-width:2px,color:#ffffff
205
- classDef failure fill:#fff0f0,stroke:#ef2929,stroke-width:2px,color:#8b1a2a
206
- classDef success fill:#e8f8ec,stroke:#18883c,stroke-width:2px,color:#145a32
207
- class auditStart start
208
- class auditTracked,auditRun,auditPropose action
209
- class auditBackpressure,auditTriage decision
210
- class auditQuiet,auditIdle idle
211
- class auditFail failure
212
- class auditReport success
213
- ```
1
+ ---
2
+ # Managed by @plainconceptsplatform/workflows. Source: loops/workflows/agent-audit.md. Update with `workflows update --force`; consumer edits may be overwritten.
3
+ env:
4
+ REPO_RULES: "Read-only repository audit. Report only reproducible, actionable defects with evidence. Do not modify files, commit, push, or run write operations."
5
+ # Split out of REPO_RULES, which carried both the read-only discipline above and the list
6
+ # below. All four consuming repositories had customised the list and none could touch it
7
+ # without restating the discipline; they are different kinds of rule with different owners.
8
+ # One line: gh-aw joins a multi-line env value onto a single line when it compiles the lock.
9
+ AUDIT_FOCUS: "Architectural layer violations and dependencies pointing the wrong way. Missing or misleading tests around behaviour that already shipped. Security gaps: unvalidated input, missing authorization, secrets in code. Performance anti-patterns, N+1 queries in particular. Documentation that no longer matches the code it describes."
10
+ AUDIT_MARKER: "<!-- agent-audit -->"
11
+ GIT_AUTHOR_NAME: "github-actions[bot]"
12
+ GIT_AUTHOR_EMAIL: "github-actions[bot]@users.noreply.github.com"
13
+ GIT_COMMITTER_NAME: "github-actions[bot]"
14
+ GIT_COMMITTER_EMAIL: "github-actions[bot]@users.noreply.github.com"
15
+ description: |
16
+ Read-only repository audit. Finds 5-7 problems, scores each 1-10, files a single issue
17
+ with all findings listed and the top 3 refined as actionable user stories. The issue is
18
+ labelled `audit` + `bug` + `refine`, so Refine sizes it and splits a multi-defect report
19
+ into one estimated issue per finding rather than one pull request that has to fix them all. Replaces .loops/recipes/guardrails-audit-loop.yaml.
20
+
21
+ Router-only worker: triggered exclusively via workflow_call from work-router.yml.
22
+ Contract input: trigger-kind(scheduled|manual).
23
+ The router owns the weekly Monday schedule and manual dispatch.
24
+
25
+ The `skip-if-match` below is backpressure, so the audit stops filing reports while three
26
+ are still unactioned.
27
+
28
+ name: "Agent: Audit"
29
+
30
+ # Shared: network policy only. This workflow owns its Safe Outputs and OpenCode configuration.
31
+ # permissions, engine, model and runs-on cannot be shared , see shared/platform-defaults.md.
32
+ imports:
33
+ - github/gh-aw/.github/workflows/shared/opencode.md@v0.87.5
34
+ - shared/platform-defaults.md
35
+ - shared/opencode-ci.md
36
+
37
+ on:
38
+ workflow_call:
39
+ inputs:
40
+ trigger-kind:
41
+ description: "Audit trigger: scheduled or manual"
42
+ required: false
43
+ type: string
44
+ default: manual
45
+
46
+ # Rung 1. Do not pile reports on top of unactioned reports.
47
+ #
48
+ # `-label:stale-audit` is what keeps this backpressure from becoming a stop. Three reports
49
+ # nobody ever actioned used to disable the weekly audit for good: the query counted them
50
+ # forever, the run skipped with a green tick, and no report was ever filed again. The
51
+ # janitor labels a report `stale-audit` once it has sat open past its budget, which both
52
+ # frees the slot and lists the report in the "Needs a human" digest. Backpressure now
53
+ # means "three live reports", not "three reports, ever".
54
+ skip-if-match:
55
+ query: "is:issue is:open label:audit -label:stale-audit"
56
+ max: 3
57
+
58
+ runs-on: agents-arc
59
+ runs-on-slim: agents-arc
60
+
61
+ secrets:
62
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
63
+
64
+ engine:
65
+ id: opencode
66
+ version: "1.2.14"
67
+ env:
68
+ OPENAI_BASE_URL: https://forge.plainconcepts.com/v1
69
+
70
+ model: openai/glm-5-3
71
+
72
+ max-turns: 300
73
+ max-turn-cache-misses: 3000
74
+ max-ai-credits: 5000
75
+
76
+ permissions: read-all
77
+
78
+ steps:
79
+ - name: List what is already tracked
80
+ uses: ./.github/actions/list-open-issues
81
+ with:
82
+ token: ${{ github.token }}
83
+ repo: ${{ github.repository }}
84
+
85
+ jobs:
86
+ conclude:
87
+ needs: [activation, agent, safe_outputs]
88
+ if: >
89
+ needs.agent.result == 'success' &&
90
+ needs.safe_outputs.result == 'success' &&
91
+ needs.safe_outputs.outputs.process_safe_outputs_processed_count != '0'
92
+ runs-on: agents-arc
93
+ permissions:
94
+ contents: read
95
+ issues: write
96
+ steps:
97
+ - name: Checkout workflow actions
98
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
99
+ with:
100
+ persist-credentials: false
101
+ - name: Create bot token
102
+ id: app-token
103
+ uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
104
+ with:
105
+ client-id: ${{ secrets.BOT_APP_ID }}
106
+ private-key: ${{ secrets.BOT_PRIVATE_KEY }}
107
+ # No apply-agent-output here. The safe_outputs job already created the issue and
108
+ # exposes its number; calling the action with create-issues would file a second copy
109
+ # of the same report. It was only needed while staged: true suppressed the native
110
+ # write, and staged is gone.
111
+ - name: Apply audit labels to created issues
112
+ if: needs.safe_outputs.outputs.created_issue_number != ''
113
+ uses: ./.github/actions/add-issue-labels
114
+ with:
115
+ token: ${{ steps.app-token.outputs.token }}
116
+ issue-number: ${{ needs.safe_outputs.outputs.created_issue_number }}
117
+ labels: |
118
+ audit
119
+ bug
120
+ refine
121
+
122
+ safe-outputs:
123
+ # A failed run is already a red run. An issue per failure buries the real backlog
124
+ # under noise nobody closes.
125
+ report-failure-as-issue: false
126
+ threat-detection: false
127
+ create-issue:
128
+ max: 1
129
+
130
+ # The fleet is two machines, so this clock is also how long a stuck run can hold half of it.
131
+ # 240 went on to every worker at once when the provider was slow, which fixed the deaths and
132
+ # made every worker equally expensive to hang. These numbers are per worker: enough headroom
133
+ # for a slow gateway on the work it actually does, and not four hours for a run that reads one
134
+ # issue. Turns remain the guard against a confused agent looping; for a custom model the credit
135
+ # ceiling is models.dev fallback pricing and guards nothing.
136
+ #
137
+ # Sweeps the repository read-only and writes one findings issue. Observed around 45 minutes.
138
+ timeout-minutes: 90
139
+ ---
140
+
141
+ 1. Call skill("pc-repo-audit"), then run `/repo-audit` as a read-only audit of this
142
+ repository. Do not modify any file, do not commit, and do not push.
143
+
144
+ 2. Apply repository documentation and established conventions while auditing. Focus on
145
+ concrete defects and avoid recommendations that weaken security, tests, or checks.
146
+ Adhere to ${{ env.REPO_RULES }}. Look for: ${{ env.AUDIT_FOCUS }}
147
+
148
+ From the audit report, find **5 to 7 problems**. For each finding, verify it meets ALL
149
+ of these criteria before keeping it:
150
+ - A specific, reproducible problem in a specific file or component.
151
+ - Has real impact: security risk, data loss, crash, or broken functionality.
152
+ - Something a developer could pick up and fix without further investigation.
153
+ Discard anything vague, stylistic, theoretical, or nice-to-have. If you cannot find 5 that
154
+ meet this bar, file as many as you can. If you find zero, call `noop` and stop , that is a
155
+ good result.
156
+
157
+ 3. **Score each surviving finding from 1 to 10**, based on:
158
+ | Factor | Weight |
159
+ |---|---|
160
+ | Severity (how bad is the impact?) | high |
161
+ | Likelihood (how often does it trigger?) | medium |
162
+ | Blast radius (how many users/components affected?) | medium |
163
+ | Ease of fix (can it be fixed in one PR?) | low bonus |
164
+
165
+ Write the score next to each finding in your reasoning.
166
+
167
+ 4. Read `/tmp/gh-aw/agent/open-issues.json`, which lists every open issue with its title and
168
+ labels. Discard any finding already tracked there. Exact-title duplicates are rejected for
169
+ you; your job is the ones worded differently that mean the same thing.
170
+
171
+ Open issues only cover what is still open, so a finding reported weeks ago and closed
172
+ without a fix, or deliberately rejected, would come back every single run. Before scoring,
173
+ call `memory_smart_search` for prior audits of this repository and drop any finding that
174
+ was already reported and consciously not acted on. After you have decided what to file,
175
+ call `memory_save` once with a compact record of this audit: the date, each finding's file
176
+ and one-line description, and its disposition (filed, already tracked, or previously
177
+ rejected). Keep it short; it is read by the next audit, not by a person.
178
+
179
+ A finding you have reported before and that is genuinely still broken IS worth filing
180
+ again. What this prevents is re-filing something the team looked at and chose to live
181
+ with, which is the noise that makes an audit backlog get ignored.
182
+
183
+ 5. Call `create_issue` **once** with title "Audit: <date>". Do NOT specify labels , the
184
+ conclude job will apply them. The body MUST have two sections:
185
+
186
+ **Section 1 , All findings:** A numbered list of every finding (5-7) with its score,
187
+ file path, and a one-line description. Order by score descending.
188
+
189
+ **Section 2 , Top 3 to implement:** Call skill("pc-plan-story") and refine the top 3
190
+ findings by score into user stories; that skill owns their shape. Name the likely files to
191
+ change. Mark this section clearly with a heading like `## Top 3 , To Implement`.
192
+
193
+ The issue you file goes to Refine, not straight to implementation. Refine sizes it and,
194
+ because a report of several unrelated defects across different files is exactly the shape
195
+ that does not land as one pull request, splits it into one properly estimated issue per
196
+ finding. Write each finding so it survives that split: self-contained, naming its own
197
+ files and its own acceptance criteria, never "as above" or "same as finding 2".
198
+
199
+ 6. If nothing met the bar, call `noop` and stop. Filing nothing is the right outcome when
200
+ the codebase is clean.