@crewbie/cli 0.1.0-alpha.49
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/LICENSE +21 -0
- package/README.md +253 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +506 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +84 -0
- package/dist/config.js +178 -0
- package/dist/config.js.map +1 -0
- package/dist/core.d.ts +31 -0
- package/dist/core.js +186 -0
- package/dist/core.js.map +1 -0
- package/dist/execution/attribution.d.ts +10 -0
- package/dist/execution/attribution.js +102 -0
- package/dist/execution/attribution.js.map +1 -0
- package/dist/execution/cancel.d.ts +3 -0
- package/dist/execution/cancel.js +59 -0
- package/dist/execution/cancel.js.map +1 -0
- package/dist/execution/capabilities.d.ts +22 -0
- package/dist/execution/capabilities.js +101 -0
- package/dist/execution/capabilities.js.map +1 -0
- package/dist/execution/controls.d.ts +51 -0
- package/dist/execution/controls.js +257 -0
- package/dist/execution/controls.js.map +1 -0
- package/dist/execution/dispatch.d.ts +69 -0
- package/dist/execution/dispatch.js +831 -0
- package/dist/execution/dispatch.js.map +1 -0
- package/dist/execution/fix.d.ts +3 -0
- package/dist/execution/fix.js +267 -0
- package/dist/execution/fix.js.map +1 -0
- package/dist/execution/github.d.ts +15 -0
- package/dist/execution/github.js +43 -0
- package/dist/execution/github.js.map +1 -0
- package/dist/execution/merge.d.ts +15 -0
- package/dist/execution/merge.js +133 -0
- package/dist/execution/merge.js.map +1 -0
- package/dist/execution/planning-approval.d.ts +33 -0
- package/dist/execution/planning-approval.js +227 -0
- package/dist/execution/planning-approval.js.map +1 -0
- package/dist/execution/pr-review.d.ts +86 -0
- package/dist/execution/pr-review.js +339 -0
- package/dist/execution/pr-review.js.map +1 -0
- package/dist/execution/review-loop.d.ts +63 -0
- package/dist/execution/review-loop.js +463 -0
- package/dist/execution/review-loop.js.map +1 -0
- package/dist/execution/test-feature.d.ts +29 -0
- package/dist/execution/test-feature.js +240 -0
- package/dist/execution/test-feature.js.map +1 -0
- package/dist/execution/watch.d.ts +12 -0
- package/dist/execution/watch.js +34 -0
- package/dist/execution/watch.js.map +1 -0
- package/dist/memory/context.d.ts +14 -0
- package/dist/memory/context.js +82 -0
- package/dist/memory/context.js.map +1 -0
- package/dist/memory/improvement.d.ts +25 -0
- package/dist/memory/improvement.js +168 -0
- package/dist/memory/improvement.js.map +1 -0
- package/dist/memory/launch.d.ts +9 -0
- package/dist/memory/launch.js +65 -0
- package/dist/memory/launch.js.map +1 -0
- package/dist/memory/runner.d.ts +4 -0
- package/dist/memory/runner.js +74 -0
- package/dist/memory/runner.js.map +1 -0
- package/dist/memory/state.d.ts +10 -0
- package/dist/memory/state.js +42 -0
- package/dist/memory/state.js.map +1 -0
- package/dist/presentation.d.ts +19 -0
- package/dist/presentation.js +128 -0
- package/dist/presentation.js.map +1 -0
- package/dist/reporting/dashboard.d.ts +2 -0
- package/dist/reporting/dashboard.js +106 -0
- package/dist/reporting/dashboard.js.map +1 -0
- package/dist/reporting/pr-usage.d.ts +24 -0
- package/dist/reporting/pr-usage.js +179 -0
- package/dist/reporting/pr-usage.js.map +1 -0
- package/dist/reporting/records.d.ts +28 -0
- package/dist/reporting/records.js +152 -0
- package/dist/reporting/records.js.map +1 -0
- package/dist/setup/agents.d.ts +8 -0
- package/dist/setup/agents.js +83 -0
- package/dist/setup/agents.js.map +1 -0
- package/dist/setup/assessment.d.ts +31 -0
- package/dist/setup/assessment.js +75 -0
- package/dist/setup/assessment.js.map +1 -0
- package/dist/setup/auto-loaded.d.ts +17 -0
- package/dist/setup/auto-loaded.js +49 -0
- package/dist/setup/auto-loaded.js.map +1 -0
- package/dist/setup/copilot-version.d.ts +7 -0
- package/dist/setup/copilot-version.js +39 -0
- package/dist/setup/copilot-version.js.map +1 -0
- package/dist/setup/copilot.d.ts +22 -0
- package/dist/setup/copilot.js +164 -0
- package/dist/setup/copilot.js.map +1 -0
- package/dist/setup/init.d.ts +41 -0
- package/dist/setup/init.js +315 -0
- package/dist/setup/init.js.map +1 -0
- package/dist/setup/install.d.ts +12 -0
- package/dist/setup/install.js +211 -0
- package/dist/setup/install.js.map +1 -0
- package/dist/setup/instruction-quality.d.ts +25 -0
- package/dist/setup/instruction-quality.js +258 -0
- package/dist/setup/instruction-quality.js.map +1 -0
- package/dist/setup/inventory.d.ts +26 -0
- package/dist/setup/inventory.js +78 -0
- package/dist/setup/inventory.js.map +1 -0
- package/dist/setup/onboarding.d.ts +40 -0
- package/dist/setup/onboarding.js +472 -0
- package/dist/setup/onboarding.js.map +1 -0
- package/dist/setup/package.d.ts +2 -0
- package/dist/setup/package.js +8 -0
- package/dist/setup/package.js.map +1 -0
- package/dist/setup/planning-workflow.d.ts +3 -0
- package/dist/setup/planning-workflow.js +250 -0
- package/dist/setup/planning-workflow.js.map +1 -0
- package/dist/setup/repository-map.d.ts +34 -0
- package/dist/setup/repository-map.js +89 -0
- package/dist/setup/repository-map.js.map +1 -0
- package/dist/setup/review.d.ts +8 -0
- package/dist/setup/review.js +137 -0
- package/dist/setup/review.js.map +1 -0
- package/dist/setup/team.d.ts +18 -0
- package/dist/setup/team.js +172 -0
- package/dist/setup/team.js.map +1 -0
- package/dist/setup/templates.d.ts +11 -0
- package/dist/setup/templates.js +494 -0
- package/dist/setup/templates.js.map +1 -0
- package/dist/setup/terminal.d.ts +12 -0
- package/dist/setup/terminal.js +11 -0
- package/dist/setup/terminal.js.map +1 -0
- package/dist/setup/update.d.ts +6 -0
- package/dist/setup/update.js +71 -0
- package/dist/setup/update.js.map +1 -0
- package/dist/specification/batch.d.ts +50 -0
- package/dist/specification/batch.js +127 -0
- package/dist/specification/batch.js.map +1 -0
- package/dist/specification/plan-checks.d.ts +6 -0
- package/dist/specification/plan-checks.js +73 -0
- package/dist/specification/plan-checks.js.map +1 -0
- package/dist/specification/planning.d.ts +26 -0
- package/dist/specification/planning.js +507 -0
- package/dist/specification/planning.js.map +1 -0
- package/dist/specification/prose.d.ts +1 -0
- package/dist/specification/prose.js +15 -0
- package/dist/specification/prose.js.map +1 -0
- package/dist/tracking/ado.d.ts +19 -0
- package/dist/tracking/ado.js +128 -0
- package/dist/tracking/ado.js.map +1 -0
- package/dist/tracking/github.d.ts +8 -0
- package/dist/tracking/github.js +112 -0
- package/dist/tracking/github.js.map +1 -0
- package/dist/tracking/issues.d.ts +28 -0
- package/dist/tracking/issues.js +180 -0
- package/dist/tracking/issues.js.map +1 -0
- package/dist/tracking/native.d.ts +5 -0
- package/dist/tracking/native.js +30 -0
- package/dist/tracking/native.js.map +1 -0
- package/dist/tracking/refs.d.ts +14 -0
- package/dist/tracking/refs.js +56 -0
- package/dist/tracking/refs.js.map +1 -0
- package/dist/tracking/sources.d.ts +5 -0
- package/dist/tracking/sources.js +29 -0
- package/dist/tracking/sources.js.map +1 -0
- package/docs/operations.md +1114 -0
- package/examples/batch.json +27 -0
- package/examples/runs.json +22 -0
- package/package.json +50 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { PLANNING_LABEL } from "../config.js";
|
|
2
|
+
export function planningWorkflow(setup, enabled) {
|
|
3
|
+
return `name: Crewbie planning
|
|
4
|
+
on:
|
|
5
|
+
${enabled ? " issues:\n types: [labeled]\n issue_comment:\n types: [created]\n" : ""} workflow_dispatch:
|
|
6
|
+
inputs:
|
|
7
|
+
pr:
|
|
8
|
+
description: Open planning PR to revise
|
|
9
|
+
required: true
|
|
10
|
+
type: string
|
|
11
|
+
feedback:
|
|
12
|
+
description: Specific changes requested (one paid revision, reusing context)
|
|
13
|
+
required: true
|
|
14
|
+
type: string
|
|
15
|
+
head:
|
|
16
|
+
description: Expected PR head (set by crewbie revise-plan)
|
|
17
|
+
required: false
|
|
18
|
+
type: string
|
|
19
|
+
source:
|
|
20
|
+
description: Current source fingerprint (set by crewbie revise-plan)
|
|
21
|
+
required: true
|
|
22
|
+
type: string
|
|
23
|
+
permissions:
|
|
24
|
+
contents: read
|
|
25
|
+
concurrency:
|
|
26
|
+
group: crewbie-planning-\${{ github.event.issue.number || inputs.pr || github.run_id }}
|
|
27
|
+
cancel-in-progress: false
|
|
28
|
+
jobs:
|
|
29
|
+
prepare:
|
|
30
|
+
if: \${{ (github.event_name == 'issues' && github.event.label.name == '${PLANNING_LABEL}') || github.event_name == 'workflow_dispatch' || (github.event_name == 'issue_comment' && github.event.issue.pull_request && github.event.comment.user.type != 'Bot' && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) }}
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
timeout-minutes: 3
|
|
33
|
+
permissions:
|
|
34
|
+
actions: read
|
|
35
|
+
contents: read
|
|
36
|
+
issues: read
|
|
37
|
+
pull-requests: read
|
|
38
|
+
outputs:
|
|
39
|
+
ready: \${{ steps.context.outputs.ready }}
|
|
40
|
+
model: \${{ steps.context.outputs.model }}
|
|
41
|
+
steps:
|
|
42
|
+
${setup} - name: Verify ready label and prepare coordinator context
|
|
43
|
+
id: context
|
|
44
|
+
env:
|
|
45
|
+
GH_TOKEN: \${{ github.token }}
|
|
46
|
+
run: node "$RUNNER_TEMP/crewbie/node_modules/@crewbie/cli/dist/cli.js" internal-plan --prepare
|
|
47
|
+
- uses: actions/upload-artifact@v7.0.1
|
|
48
|
+
if: \${{ steps.context.outputs.ready == 'true' }}
|
|
49
|
+
with:
|
|
50
|
+
name: crewbie-planning-input
|
|
51
|
+
include-hidden-files: true
|
|
52
|
+
retention-days: 1
|
|
53
|
+
path: |
|
|
54
|
+
.crewbie-planning-input.json
|
|
55
|
+
.crewbie-planning-prompt.txt
|
|
56
|
+
if-no-files-found: error
|
|
57
|
+
analyze:
|
|
58
|
+
needs: prepare
|
|
59
|
+
if: \${{ needs.prepare.outputs.ready == 'true' }}
|
|
60
|
+
runs-on: ubuntu-latest
|
|
61
|
+
timeout-minutes: 9
|
|
62
|
+
permissions:
|
|
63
|
+
copilot-requests: write
|
|
64
|
+
steps:
|
|
65
|
+
- uses: actions/setup-node@v7.0.0
|
|
66
|
+
with:
|
|
67
|
+
node-version: '22'
|
|
68
|
+
- uses: actions/download-artifact@v8.0.1
|
|
69
|
+
with:
|
|
70
|
+
name: crewbie-planning-input
|
|
71
|
+
- name: Run named coordinator planning
|
|
72
|
+
env:
|
|
73
|
+
GITHUB_TOKEN: \${{ github.token }}
|
|
74
|
+
CREWBIE_PLANNING_MODEL: \${{ needs.prepare.outputs.model }}
|
|
75
|
+
CREWBIE_COPILOT_VERSION: \${{ vars.CREWBIE_COPILOT_VERSION }}
|
|
76
|
+
run: |
|
|
77
|
+
[[ "$CREWBIE_COPILOT_VERSION" =~ ^[0-9]+\\.[0-9]+\\.[0-9]+([.-][A-Za-z0-9.-]+)?$ ]] || { echo "Set an approved exact Copilot CLI version."; exit 1; }
|
|
78
|
+
test -n "$CREWBIE_PLANNING_MODEL" || { echo "Approve an explicit planning model."; exit 1; }
|
|
79
|
+
npm install --prefix "$RUNNER_TEMP/copilot" --no-audit --no-fund "@github/copilot@$CREWBIE_COPILOT_VERSION"
|
|
80
|
+
"$RUNNER_TEMP/copilot/node_modules/.bin/copilot" --model "$CREWBIE_PLANNING_MODEL" --no-custom-instructions --disable-builtin-mcps --available-tools --silent --deny-tool shell write url --prompt "$(cat .crewbie-planning-prompt.txt)" > .crewbie-planning-output.txt
|
|
81
|
+
- uses: actions/upload-artifact@v7.0.1
|
|
82
|
+
with:
|
|
83
|
+
name: crewbie-planning-output
|
|
84
|
+
include-hidden-files: true
|
|
85
|
+
retention-days: 1
|
|
86
|
+
path: .crewbie-planning-output.txt
|
|
87
|
+
if-no-files-found: error
|
|
88
|
+
publish:
|
|
89
|
+
needs: [prepare, analyze]
|
|
90
|
+
runs-on: ubuntu-latest
|
|
91
|
+
timeout-minutes: 3
|
|
92
|
+
permissions:
|
|
93
|
+
actions: read
|
|
94
|
+
contents: write
|
|
95
|
+
issues: read
|
|
96
|
+
pull-requests: write
|
|
97
|
+
steps:
|
|
98
|
+
${setup} - uses: actions/download-artifact@v8.0.1
|
|
99
|
+
with:
|
|
100
|
+
name: crewbie-planning-input
|
|
101
|
+
- uses: actions/download-artifact@v8.0.1
|
|
102
|
+
with:
|
|
103
|
+
name: crewbie-planning-output
|
|
104
|
+
- name: Validate and publish planning PR only
|
|
105
|
+
env:
|
|
106
|
+
GH_TOKEN: \${{ github.token }}
|
|
107
|
+
run: node "$RUNNER_TEMP/crewbie/node_modules/@crewbie/cli/dist/cli.js" internal-plan --apply
|
|
108
|
+
`;
|
|
109
|
+
}
|
|
110
|
+
export function executionWorkflow(setup, enabled) {
|
|
111
|
+
return `name: Crewbie execute approved plan
|
|
112
|
+
on:
|
|
113
|
+
${enabled ? " pull_request_target:\n types: [closed]\n" : ""} workflow_dispatch:
|
|
114
|
+
inputs:
|
|
115
|
+
pr:
|
|
116
|
+
description: Merged planning PR number to verify and resume
|
|
117
|
+
required: true
|
|
118
|
+
type: string
|
|
119
|
+
permissions:
|
|
120
|
+
contents: read
|
|
121
|
+
concurrency:
|
|
122
|
+
group: crewbie-plan-release-\${{ github.event.pull_request.number || inputs.pr }}
|
|
123
|
+
cancel-in-progress: false
|
|
124
|
+
jobs:
|
|
125
|
+
release:
|
|
126
|
+
if: \${{ github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true && github.event.pull_request.head.repo.full_name == github.repository && startsWith(github.event.pull_request.head.ref, 'crewbie/plans/')) }}
|
|
127
|
+
runs-on: ubuntu-latest
|
|
128
|
+
timeout-minutes: 15
|
|
129
|
+
steps:
|
|
130
|
+
${setup} - name: Verify human approval and merge, publish tasks and dispatch
|
|
131
|
+
env:
|
|
132
|
+
GH_TOKEN: \${{ secrets.CREWBIE_USER_TOKEN }}
|
|
133
|
+
CREWBIE_ADO_TOKEN: \${{ secrets.CREWBIE_ADO_TOKEN }}
|
|
134
|
+
PR_NUMBER: \${{ github.event.pull_request.number || inputs.pr }}
|
|
135
|
+
run: |
|
|
136
|
+
test -n "$GH_TOKEN" || { echo "Configure a supported user-authorized CREWBIE_USER_TOKEN for native cloud assignment. No credential fallback is used."; exit 1; }
|
|
137
|
+
node "$RUNNER_TEMP/crewbie/node_modules/@crewbie/cli/dist/cli.js" internal-release-plan --pr "$PR_NUMBER"
|
|
138
|
+
`;
|
|
139
|
+
}
|
|
140
|
+
export function reviewWorkflow(setup) {
|
|
141
|
+
return `name: Crewbie review
|
|
142
|
+
run-name: "Crewbie review PR #\${{ inputs.pr }} at \${{ inputs.head }}"
|
|
143
|
+
# Dispatch requests one run per PR head. The PR's code is never checked out; the reviewer reads its API diff.
|
|
144
|
+
on:
|
|
145
|
+
workflow_dispatch:
|
|
146
|
+
inputs:
|
|
147
|
+
pr:
|
|
148
|
+
description: PR number to review
|
|
149
|
+
required: true
|
|
150
|
+
type: string
|
|
151
|
+
head:
|
|
152
|
+
description: PR head SHA to review
|
|
153
|
+
required: true
|
|
154
|
+
type: string
|
|
155
|
+
permissions:
|
|
156
|
+
contents: read
|
|
157
|
+
concurrency:
|
|
158
|
+
group: crewbie-review-\${{ inputs.pr }}
|
|
159
|
+
cancel-in-progress: false
|
|
160
|
+
jobs:
|
|
161
|
+
prepare:
|
|
162
|
+
runs-on: ubuntu-latest
|
|
163
|
+
timeout-minutes: 3
|
|
164
|
+
permissions:
|
|
165
|
+
checks: read
|
|
166
|
+
contents: read
|
|
167
|
+
issues: read
|
|
168
|
+
pull-requests: read
|
|
169
|
+
statuses: read
|
|
170
|
+
outputs:
|
|
171
|
+
ready: \${{ steps.context.outputs.ready }}
|
|
172
|
+
model: \${{ steps.context.outputs.model }}
|
|
173
|
+
steps:
|
|
174
|
+
${setup} - name: Prepare reviewer context
|
|
175
|
+
id: context
|
|
176
|
+
env:
|
|
177
|
+
GH_TOKEN: \${{ github.token }}
|
|
178
|
+
PR_NUMBER: \${{ inputs.pr }}
|
|
179
|
+
HEAD_SHA: \${{ inputs.head }}
|
|
180
|
+
run: node "$RUNNER_TEMP/crewbie/node_modules/@crewbie/cli/dist/cli.js" internal-review --prepare
|
|
181
|
+
- uses: actions/upload-artifact@v7.0.1
|
|
182
|
+
if: \${{ steps.context.outputs.ready == 'true' }}
|
|
183
|
+
with:
|
|
184
|
+
name: crewbie-review-input
|
|
185
|
+
include-hidden-files: true
|
|
186
|
+
retention-days: 1
|
|
187
|
+
path: |
|
|
188
|
+
.crewbie-review-input.json
|
|
189
|
+
.crewbie-review-prompt.txt
|
|
190
|
+
if-no-files-found: error
|
|
191
|
+
analyze:
|
|
192
|
+
needs: prepare
|
|
193
|
+
if: \${{ needs.prepare.outputs.ready == 'true' }}
|
|
194
|
+
runs-on: ubuntu-latest
|
|
195
|
+
timeout-minutes: 9
|
|
196
|
+
permissions:
|
|
197
|
+
copilot-requests: write
|
|
198
|
+
steps:
|
|
199
|
+
- uses: actions/setup-node@v7.0.0
|
|
200
|
+
with:
|
|
201
|
+
node-version: '22'
|
|
202
|
+
- uses: actions/download-artifact@v8.0.1
|
|
203
|
+
with:
|
|
204
|
+
name: crewbie-review-input
|
|
205
|
+
- name: Run the Crewbie reviewer
|
|
206
|
+
env:
|
|
207
|
+
GITHUB_TOKEN: \${{ github.token }}
|
|
208
|
+
CREWBIE_REVIEW_MODEL: \${{ needs.prepare.outputs.model }}
|
|
209
|
+
CREWBIE_COPILOT_VERSION: \${{ vars.CREWBIE_COPILOT_VERSION }}
|
|
210
|
+
run: |
|
|
211
|
+
[[ "$CREWBIE_COPILOT_VERSION" =~ ^[0-9]+\\.[0-9]+\\.[0-9]+([.-][A-Za-z0-9.-]+)?$ ]] || { echo "Set an approved exact Copilot CLI version."; exit 1; }
|
|
212
|
+
test -n "$CREWBIE_REVIEW_MODEL" || { echo "Approve an explicit reviewer model."; exit 1; }
|
|
213
|
+
npm install --prefix "$RUNNER_TEMP/copilot" --no-audit --no-fund "@github/copilot@$CREWBIE_COPILOT_VERSION"
|
|
214
|
+
"$RUNNER_TEMP/copilot/node_modules/.bin/copilot" --model "$CREWBIE_REVIEW_MODEL" --no-custom-instructions --disable-builtin-mcps --available-tools --silent --deny-tool shell write url --prompt "$(cat .crewbie-review-prompt.txt)" > .crewbie-review-output.txt
|
|
215
|
+
- uses: actions/upload-artifact@v7.0.1
|
|
216
|
+
with:
|
|
217
|
+
name: crewbie-review-output
|
|
218
|
+
include-hidden-files: true
|
|
219
|
+
retention-days: 1
|
|
220
|
+
path: .crewbie-review-output.txt
|
|
221
|
+
if-no-files-found: error
|
|
222
|
+
publish:
|
|
223
|
+
needs: [prepare, analyze]
|
|
224
|
+
runs-on: ubuntu-latest
|
|
225
|
+
timeout-minutes: 3
|
|
226
|
+
permissions:
|
|
227
|
+
actions: write
|
|
228
|
+
contents: read
|
|
229
|
+
issues: write
|
|
230
|
+
pull-requests: write
|
|
231
|
+
steps:
|
|
232
|
+
${setup} - uses: actions/download-artifact@v8.0.1
|
|
233
|
+
with:
|
|
234
|
+
name: crewbie-review-input
|
|
235
|
+
- uses: actions/download-artifact@v8.0.1
|
|
236
|
+
with:
|
|
237
|
+
name: crewbie-review-output
|
|
238
|
+
- name: Post the review comment
|
|
239
|
+
env:
|
|
240
|
+
GH_TOKEN: \${{ github.token }}
|
|
241
|
+
run: node "$RUNNER_TEMP/crewbie/node_modules/@crewbie/cli/dist/cli.js" internal-review --apply
|
|
242
|
+
- name: Ask dispatch to act on the verdict
|
|
243
|
+
env:
|
|
244
|
+
GH_TOKEN: \${{ github.token }}
|
|
245
|
+
REPOSITORY: \${{ github.repository }}
|
|
246
|
+
BRANCH: \${{ github.event.repository.default_branch }}
|
|
247
|
+
run: gh workflow run crewbie-dispatch.yml --repo "$REPOSITORY" --ref "$BRANCH"
|
|
248
|
+
`;
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=planning-workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planning-workflow.js","sourceRoot":"","sources":["../../src/setup/planning-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,UAAU,gBAAgB,CAAC,KAAa,EAAE,OAAgB;IAC9D,OAAO;;EAEP,OAAO,CAAC,CAAC,CAAC,2EAA2E,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;6EAyBf,cAAc;;;;;;;;;;;;EAYzF,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwDL,KAAK;;;;;;;;;;CAUN,CAAC;AACF,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,OAAgB;IAC/D,OAAO;;EAEP,OAAO,CAAC,CAAC,CAAC,+CAA+C,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;EAiB9D,KAAK;;;;;;;;CAQN,CAAC;AACF,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCP,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0DL,KAAK;;;;;;;;;;;;;;;;CAgBN,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A names-only map of the working tree, so generated guidance can be checked against paths that actually exist.
|
|
3
|
+
* No file contents are read; the model sees directories and workspaces, and Crewbie checks cited paths locally.
|
|
4
|
+
*/
|
|
5
|
+
export interface RepositoryMap {
|
|
6
|
+
/** Non-ignored file paths for local checks. Not serialized into saved proposals; absent after reloading one. */
|
|
7
|
+
files?: string[];
|
|
8
|
+
truncated: boolean;
|
|
9
|
+
directories: string[];
|
|
10
|
+
/** Directories below the root that hold their own package or project manifest. */
|
|
11
|
+
workspaces: string[];
|
|
12
|
+
}
|
|
13
|
+
export declare function repositoryMap(paths: string[]): RepositoryMap;
|
|
14
|
+
/** The map of a checkout: tracked and untracked, non-ignored names. */
|
|
15
|
+
export declare function workingTree(root: string): RepositoryMap;
|
|
16
|
+
/** The directory summary and workspaces a prompt may carry, bounded. */
|
|
17
|
+
export declare function promptMap(map: RepositoryMap): {
|
|
18
|
+
directories: string[];
|
|
19
|
+
directoriesOmitted: number;
|
|
20
|
+
workspaces: string[];
|
|
21
|
+
workspacesOmitted: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Repository-relative path references in generated text: backticked code spans, and path-shaped words outside prose pairs.
|
|
25
|
+
* Module specifiers (node:x/y, @scope/pkg), placeholders (NNNN, <name>) and slash-joined words are not paths.
|
|
26
|
+
* An extensionless span counts only when its first segment is one of `roots`, the repository's top-level directories.
|
|
27
|
+
*/
|
|
28
|
+
export declare function pathReferences(text: string, roots?: ReadonlySet<string>): string[];
|
|
29
|
+
/** True when the path, directory or glob prefix names something in the working tree. */
|
|
30
|
+
export declare function pathExists(map: RepositoryMap, reference: string): boolean;
|
|
31
|
+
/** Cited paths absent from the working tree, excluding files the proposal itself creates. */
|
|
32
|
+
export declare function missingPaths(map: RepositoryMap, text: string, created?: string[]): string[];
|
|
33
|
+
/** Workspaces that no role names by path or directory name. */
|
|
34
|
+
export declare function unownedWorkspaces(map: RepositoryMap, roleTexts: string[]): string[];
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
const MAP_FILES = 20_000;
|
|
3
|
+
const PROMPT_DIRECTORIES = 400;
|
|
4
|
+
const PROMPT_WORKSPACES = 100;
|
|
5
|
+
const DIRECTORY_DEPTH = 4;
|
|
6
|
+
const MANIFEST = /(^|\/)(?:package\.json|pyproject\.toml|setup\.py|go\.mod|Cargo\.toml|pom\.xml|build\.gradle(?:\.kts)?|composer\.json|Gemfile|[^/]+\.csproj|[^/]+\.fsproj)$/;
|
|
7
|
+
const GENERATED = /^(?:\.crewbie\/|\.github\/agents\/crewbie-)/;
|
|
8
|
+
export function repositoryMap(paths) {
|
|
9
|
+
const directories = new Set();
|
|
10
|
+
for (const path of paths) {
|
|
11
|
+
const parts = path.split("/").slice(0, -1);
|
|
12
|
+
for (let depth = 1; depth <= Math.min(parts.length, DIRECTORY_DEPTH); depth++)
|
|
13
|
+
directories.add(parts.slice(0, depth).join("/"));
|
|
14
|
+
}
|
|
15
|
+
const workspaces = [...new Set(paths.filter((path) => MANIFEST.test(path) && path.includes("/"))
|
|
16
|
+
.map((path) => path.slice(0, path.lastIndexOf("/")))
|
|
17
|
+
.filter((dir) => !/(^|\/)(?:node_modules|vendor|dist|build|fixtures?|examples?|test|tests|__tests__)(\/|$)/.test(dir)))].sort();
|
|
18
|
+
const truncated = paths.length > MAP_FILES;
|
|
19
|
+
const map = { truncated, directories: [...directories].sort(), workspaces };
|
|
20
|
+
Object.defineProperty(map, "files", { value: truncated ? [] : [...paths].sort(), enumerable: false });
|
|
21
|
+
return map;
|
|
22
|
+
}
|
|
23
|
+
/** The map of a checkout: tracked and untracked, non-ignored names. */
|
|
24
|
+
export function workingTree(root) {
|
|
25
|
+
const output = execFileSync("git", ["-C", root, "ls-files", "--cached", "--others", "--exclude-standard", "-z"], {
|
|
26
|
+
encoding: "utf8", maxBuffer: 8 * 1024 * 1024, stdio: ["ignore", "pipe", "pipe"],
|
|
27
|
+
});
|
|
28
|
+
return repositoryMap([...new Set(output.split("\0").filter(Boolean))]);
|
|
29
|
+
}
|
|
30
|
+
/** The directory summary and workspaces a prompt may carry, bounded. */
|
|
31
|
+
export function promptMap(map) {
|
|
32
|
+
return {
|
|
33
|
+
directories: map.directories.slice(0, PROMPT_DIRECTORIES), directoriesOmitted: Math.max(0, map.directories.length - PROMPT_DIRECTORIES),
|
|
34
|
+
workspaces: map.workspaces.slice(0, PROMPT_WORKSPACES), workspacesOmitted: Math.max(0, map.workspaces.length - PROMPT_WORKSPACES),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const REFERENCE = /(?<![\w/.:@~-])((?:\.{0,2}[\w@-][\w.@-]*\/)+(?:[\w.*@-]*[\w*])?\/?)(?![\w/(])/g;
|
|
38
|
+
const PROSE = /^(?:and\/or|either\/or|input\/output|read\/write|yes\/no|on\/off|true\/false|client\/server|ci\/cd|i\/o|n\/a|w\/o|pass\/fail|get\/set|frontend\/backend|front-end\/back-end|pros\/cons|[a-z]+\/[a-z]+)$/i;
|
|
39
|
+
/**
|
|
40
|
+
* Repository-relative path references in generated text: backticked code spans, and path-shaped words outside prose pairs.
|
|
41
|
+
* Module specifiers (node:x/y, @scope/pkg), placeholders (NNNN, <name>) and slash-joined words are not paths.
|
|
42
|
+
* An extensionless span counts only when its first segment is one of `roots`, the repository's top-level directories.
|
|
43
|
+
*/
|
|
44
|
+
export function pathReferences(text, roots = new Set()) {
|
|
45
|
+
const found = new Set();
|
|
46
|
+
const spans = [...text.matchAll(/`([^`\n]+)`/g)].map((match) => match[1].trim());
|
|
47
|
+
const withoutUrls = text.replace(/`[^`\n]+`/g, " ").replace(/(?<![\w+.-])[a-z][\w+.-]{0,30}:\/\/\S+/gi, " ");
|
|
48
|
+
for (const [candidate, strict] of [...spans.map((span) => [span, true]), ...[...withoutUrls.matchAll(REFERENCE)].map((match) => [match[1], false])]) {
|
|
49
|
+
const path = candidate.replace(/^\.\//, "").replace(/[.,;:)]+$/, "");
|
|
50
|
+
if (!path.includes("/") || path.startsWith("/") || path.startsWith("@") || path.startsWith("..") || /[\s:<>{}]|^[\w-]+\/[\w-]+#\d+$|N{3,}|X{3,}|\.\.\./.test(path))
|
|
51
|
+
continue;
|
|
52
|
+
const last = path.replace(/\/$/, "").split("/").at(-1);
|
|
53
|
+
const unmistakable = /\.[A-Za-z0-9]+$/.test(last) || path.endsWith("/") || path.includes("*");
|
|
54
|
+
if (strict ? !unmistakable && !roots.has(path.split("/")[0]) : PROSE.test(path) || !(unmistakable || (path.split("/").length >= 3 && roots.has(path.split("/")[0]))))
|
|
55
|
+
continue;
|
|
56
|
+
found.add(path);
|
|
57
|
+
}
|
|
58
|
+
return [...found];
|
|
59
|
+
}
|
|
60
|
+
/** True when the path, directory or glob prefix names something in the working tree. */
|
|
61
|
+
export function pathExists(map, reference) {
|
|
62
|
+
const glob = reference.indexOf("*");
|
|
63
|
+
const base = (glob === -1 ? reference : reference.slice(0, glob)).replace(/\/$/, "");
|
|
64
|
+
if (!base)
|
|
65
|
+
return true;
|
|
66
|
+
const files = map.files ?? [];
|
|
67
|
+
if (glob !== -1)
|
|
68
|
+
return files.some((file) => file.startsWith(base)) || map.directories.some((dir) => dir.startsWith(base));
|
|
69
|
+
if (files.includes(base) || map.directories.includes(base) || files.some((file) => file.startsWith(`${base}/`)))
|
|
70
|
+
return true;
|
|
71
|
+
// Guidance inside a workspace often cites paths relative to that workspace (src/render.js for frontend/src/render.js).
|
|
72
|
+
return files.some((file) => file.endsWith(`/${base}`) || file.includes(`/${base}/`));
|
|
73
|
+
}
|
|
74
|
+
/** Cited paths absent from the working tree, excluding files the proposal itself creates. */
|
|
75
|
+
export function missingPaths(map, text, created = []) {
|
|
76
|
+
if (map.truncated || !map.files)
|
|
77
|
+
return [];
|
|
78
|
+
const roots = new Set(map.directories.filter((dir) => !dir.includes("/")));
|
|
79
|
+
return pathReferences(text, roots).filter((path) => !GENERATED.test(path) && !created.includes(path.replace(/\/$/, "")) && !pathExists(map, path));
|
|
80
|
+
}
|
|
81
|
+
/** Workspaces that no role names by path or directory name. */
|
|
82
|
+
export function unownedWorkspaces(map, roleTexts) {
|
|
83
|
+
const text = roleTexts.join("\n").toLowerCase();
|
|
84
|
+
return map.workspaces.filter((workspace) => {
|
|
85
|
+
const name = workspace.split("/").at(-1).toLowerCase();
|
|
86
|
+
return !text.includes(workspace.toLowerCase()) && !(name.length >= 3 && new RegExp(`(^|[^\\w-])${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}([^\\w-]|$)`).test(text));
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=repository-map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-map.js","sourceRoot":"","sources":["../../src/setup/repository-map.ts"],"names":[],"mappings":"AAAA,OAAO,EA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CAAC,CAAC;IAC3E,OAAO,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AACrJ,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,iBAAiB,CAAC,GAAkB,EAAE,SAAmB;IACvE,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IAChD,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE;QACzC,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC,WAAW,EAAE,CAAC;QACxD,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,IAAI,MAAM,CAAC,cAAc,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACzK,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type FileChange } from "./install.js";
|
|
2
|
+
export declare function setupReportPath(output: string): string;
|
|
3
|
+
export declare function describeInstallationFile(change: FileChange): FileChange & {
|
|
4
|
+
ownership: string;
|
|
5
|
+
purpose: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function renderSetupMarkdown(value: unknown, changes?: FileChange[]): string;
|
|
8
|
+
export declare function renderInstallationPreview(changes: FileChange[], labels: readonly string[], repository: string, kept?: readonly string[]): string;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { agentArchivePath, DEFAULT_EXECUTION_LIMITS } from "../config.js";
|
|
2
|
+
import { record, string } from "../core.js";
|
|
3
|
+
import { LEGACY_DECISIONS } from "../memory/context.js";
|
|
4
|
+
import { setupConfiguration } from "./install.js";
|
|
5
|
+
function cell(value) { return value.replaceAll("|", "\\|").replace(/\r?\n/g, " "); }
|
|
6
|
+
function block(content) {
|
|
7
|
+
const length = Math.max(3, ...(content.match(/`+/g) ?? []).map((run) => run.length + 1));
|
|
8
|
+
const fence = "`".repeat(length);
|
|
9
|
+
return `${fence}markdown\n${content}\n${fence}`;
|
|
10
|
+
}
|
|
11
|
+
export function setupReportPath(output) {
|
|
12
|
+
return /\.json$/i.test(output) ? output.replace(/\.json$/i, ".md") : `${output}.md`;
|
|
13
|
+
}
|
|
14
|
+
export function describeInstallationFile(change) {
|
|
15
|
+
const path = change.path;
|
|
16
|
+
const workflowPurposes = {
|
|
17
|
+
"crewbie-plan.yml": "Prepare a coordinator plan from approved issue intake; the planning opt-in gate still applies.",
|
|
18
|
+
"crewbie-execute-plan.yml": "Verify exact-head human approval and merge before publishing implementation tasks.",
|
|
19
|
+
"crewbie-dispatch.yml": "Release approved tasks when dependencies, capacity and launch controls permit; merge each finished task PR into its plan's feature branch once checks pass, then open the feature PR to the default branch and request its review.",
|
|
20
|
+
"crewbie-review.yml": "Have the configured Crewbie reviewer comment on each task and feature PR head; reads the API diff and never runs PR code.",
|
|
21
|
+
"crewbie-maintain.yml": "Offer bounded knowledge-maintenance proposals; scheduled analysis remains opt-in.",
|
|
22
|
+
"crewbie-report.yml": "Collect execution evidence into a static report without starting implementation agents.",
|
|
23
|
+
};
|
|
24
|
+
const detail = change.merged ? ["Merged with your edits", "Crewbie refreshed only its managed block; everything you wrote outside it is kept."]
|
|
25
|
+
: change.after === null && path === LEGACY_DECISIONS ? ["Moved shared decisions", "Replaced by .crewbie/decisions/hot.md; custom content moves there, an unchanged template is dropped."]
|
|
26
|
+
: change.after === null ? ["Archived original", "Remove the original only after preserving its approved charter in the agent archive."]
|
|
27
|
+
: path === ".crewbie/config.json" ? ["User policy", "Team, explicit models, approvals and limits; update preserves your configuration."]
|
|
28
|
+
: path === ".crewbie/managed.json" ? ["Crewbie bookkeeping", "Fingerprints protect human edits during updates; do not reset to bypass conflicts."]
|
|
29
|
+
: path.startsWith(".crewbie/agent-archive/") ? ["Preserved original", "Keep the adopted agent's original domain guidance and restrictions."]
|
|
30
|
+
: path.startsWith(".crewbie/team/") ? ["User knowledge", path.endsWith("/index.md")
|
|
31
|
+
? "Seed topic pointers for selective context loading; existing knowledge is never regenerated."
|
|
32
|
+
: "Seed current role handoffs and lessons once; existing knowledge is never regenerated by update."]
|
|
33
|
+
: /(?:constitution|decisions)\.md$/.test(path) || path.startsWith(".crewbie/decisions/") ? ["User guidance", path.endsWith("/index.md")
|
|
34
|
+
? "Seed shared-decision topic pointers; existing knowledge is never regenerated."
|
|
35
|
+
: "Keep approved principles or shared decisions; reuse existing documents."]
|
|
36
|
+
: path.startsWith(".github/agents/crewbie-") ? ["Crewbie-managed", "The specialist charter links shared rules and scoped memory; edit freely outside the managed block."]
|
|
37
|
+
: path.startsWith(".github/workflows/crewbie-") ? ["Crewbie-managed", `${workflowPurposes[path.slice(".github/workflows/".length)] ?? "Run the named Crewbie operation with bounded permissions."} Human-edited workflows block update.`]
|
|
38
|
+
: path === ".github/skills/crewbie/SKILL.md" ? ["Crewbie-managed", "Discover the local implementation workflow on demand instead of always loading it."]
|
|
39
|
+
: path === ".crewbie/instructions.md" ? ["Crewbie-managed", "Single shared working policy referenced by specialists, not duplicated into each charter."]
|
|
40
|
+
: /pull_request_template/i.test(path) ? ["Crewbie-managed", "Prompt for concise implementation evidence, handoffs and learning."]
|
|
41
|
+
: ["Reviewed guidance", "Apply only the separately approved instruction replacement; preserve subsequent edits."];
|
|
42
|
+
return { ...change, ownership: detail[0], purpose: detail[1] };
|
|
43
|
+
}
|
|
44
|
+
function filePreview(change) {
|
|
45
|
+
const detail = describeInstallationFile(change);
|
|
46
|
+
return `${change.after === null ? "Archive/remove" : change.before === null ? "Create" : "Update"} ${change.path} [${detail.ownership}] - ${detail.purpose}`;
|
|
47
|
+
}
|
|
48
|
+
export function renderSetupMarkdown(value, changes) {
|
|
49
|
+
const data = record(value, "setup proposal");
|
|
50
|
+
const config = setupConfiguration(data);
|
|
51
|
+
const review = data.review === undefined ? undefined : record(data.review, "setup review");
|
|
52
|
+
const installed = new Set(Array.isArray(data.installedRoles) ? data.installedRoles.map((role) => string(record(role, "installed role").id, "installed role id")) : []);
|
|
53
|
+
const instructions = Array.isArray(data.instructions) ? data.instructions.map((raw) => record(raw, "guidance edit")) : [];
|
|
54
|
+
const lines = [
|
|
55
|
+
"# Crewbie assessment", "",
|
|
56
|
+
review ? string(review.summary, "assessment summary") : "Reviewed setup proposal.", "",
|
|
57
|
+
"## Proposed crew", "",
|
|
58
|
+
"| Specialist | Action | Model | Responsibility |", "| --- | --- | --- | --- |",
|
|
59
|
+
...config.roles.map((role) => `| ${cell(role.id)} | ${installed.has(role.id) ? "Keep/update installed specialist" : role.sourceAgent ? `Adopt ${cell(role.sourceAgent)}` : "New specialist"} | ${cell(role.model)} | ${cell(role.purpose)} |`),
|
|
60
|
+
"", `Concurrency: ${config.maxActive} active sessions. This is not a limit on team size.`,
|
|
61
|
+
config.review?.enabled ? `PR reviewer: crewbie-${config.review.role} reviews each feature PR before you merge it into the default branch.` : "PR reviewer: off.", "",
|
|
62
|
+
`Model profile: **${config.modelProfile ?? "balanced"}**. Explicit model overrides remain authoritative.`,
|
|
63
|
+
`Crewbie launch limits: **${(config.execution ?? DEFAULT_EXECUTION_LIMITS).maxLaunchesPerBatch} per batch / ${(config.execution ?? DEFAULT_EXECUTION_LIMITS).maxAttemptsPerTask} per task**, including the first attempt and uncertain requests. Not a monetary cap.`, "",
|
|
64
|
+
];
|
|
65
|
+
for (const role of config.roles) {
|
|
66
|
+
lines.push(`### ${role.id}`, "");
|
|
67
|
+
if (role.sourceAgent)
|
|
68
|
+
lines.push(`Original: \`${role.sourceAgent}\` -> \`.github/agents/crewbie-${role.id}.agent.md\`.`, `Archive: \`${agentArchivePath(role.sourceAgent)}\` (backup provenance). The active charter contains the complete original instructions, with tool restrictions and persona preserved; only lines that just point to guidance Copilot loads automatically are left out.`, "");
|
|
69
|
+
if (role.checks?.length)
|
|
70
|
+
lines.push("**Checks**", ...role.checks.map((check) => `- ${check}`), "");
|
|
71
|
+
if (role.modelReason)
|
|
72
|
+
lines.push(`**Model proposal (${role.complexity ?? "unclassified"}):** ${role.modelReason}`, "");
|
|
73
|
+
if (role.nonNegotiables?.length)
|
|
74
|
+
lines.push("**Boundaries**", ...role.nonNegotiables.map((rule) => `- ${rule}`), "");
|
|
75
|
+
}
|
|
76
|
+
if (review && Array.isArray(review.warnings) && review.warnings.length) {
|
|
77
|
+
lines.push("## Repository checks", "", "Crewbie compared the proposal with the working tree (names only). These are advisory and change nothing.", "", ...review.warnings.map((warning) => `- ${string(warning, "repository warning")}`), "");
|
|
78
|
+
}
|
|
79
|
+
if (review && Array.isArray(review.agentDecisions) && review.agentDecisions.length) {
|
|
80
|
+
lines.push("## Existing agent decisions", "");
|
|
81
|
+
for (const raw of review.agentDecisions) {
|
|
82
|
+
const decision = record(raw, "agent decision");
|
|
83
|
+
lines.push(`- **${string(decision.action, "agent action")} \`${string(decision.path, "agent path")}\`**: ${string(decision.reason, "agent reason")}`);
|
|
84
|
+
}
|
|
85
|
+
lines.push("");
|
|
86
|
+
}
|
|
87
|
+
lines.push("## Proposed guidance edits", "", instructions.length ? `${instructions.length} concrete edits. These are applied only when guidance changes are approved.`
|
|
88
|
+
: "**No existing guidance edits proposed.** Recommendations below are advisory; choosing to apply guidance does not turn recommendations into file edits.", "");
|
|
89
|
+
for (const instruction of instructions)
|
|
90
|
+
lines.push(`### ${string(instruction.path, "guidance path")}`, "", typeof instruction.reason === "string" ? instruction.reason : "Reviewed replacement text.", "", block(string(instruction.content, "guidance content")), "");
|
|
91
|
+
if (typeof data.constitutionText === "string")
|
|
92
|
+
lines.push("### Proposed constitution", "", block(data.constitutionText), "");
|
|
93
|
+
lines.push("## Hosted planning", "", config.planning?.enabled
|
|
94
|
+
? `Enabled with model \`${config.planning.model}\`. The ready-for-planning label authorizes a potentially billable planning run. Execution after exact-head human approval and merge: **${config.planning.executeOnMerge ? "enabled (paid work authorized by that approval and merge)" : "disabled (manual execution approval required)"}**.`
|
|
95
|
+
: "**Disabled.** The ready-for-planning label will not create a plan. Dispatch only handles published, approved implementation tasks.", "");
|
|
96
|
+
if (review && Array.isArray(review.findings)) {
|
|
97
|
+
lines.push("## Assessment findings and recommendations", "", "Recommendations are not automatically applied. Only the concrete guidance edits above are proposed writes.", "");
|
|
98
|
+
for (const raw of review.findings) {
|
|
99
|
+
const finding = record(raw, "assessment finding");
|
|
100
|
+
lines.push(`### ${string(finding.area, "finding area")}${typeof finding.path === "string" ? ` - ${finding.path}` : ""}`, "", string(finding.assessment, "finding assessment"), "", `**Recommendation:** ${string(finding.recommendation, "finding recommendation")}`, "", ...(typeof finding.action === "string" ? [`**Disposition:** ${finding.action}`, ""] : []), ...(typeof finding.deferReason === "string" ? [`**Deferred because:** ${finding.deferReason}`, ""] : []));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (data.inventory !== undefined) {
|
|
104
|
+
const inventory = record(data.inventory, "inventory");
|
|
105
|
+
lines.push("## Coverage", "", string(inventory.scope, "inventory scope"), "");
|
|
106
|
+
if (Array.isArray(inventory.omitted))
|
|
107
|
+
for (const raw of inventory.omitted) {
|
|
108
|
+
const item = record(raw, "omitted file");
|
|
109
|
+
lines.push(`- \`${string(item.path, "omitted path")}\`: ${string(item.reason, "omission reason")}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (Array.isArray(data.questions) && data.questions.length)
|
|
113
|
+
lines.push("", "## Open questions", "", ...data.questions.map((question) => `- ${string(question, "question")}`));
|
|
114
|
+
if (changes)
|
|
115
|
+
lines.push("", "## Reviewed installation files", "", ...changes.map((change) => `- ${filePreview(change)}`));
|
|
116
|
+
return lines.join("\n") + "\n";
|
|
117
|
+
}
|
|
118
|
+
export function renderInstallationPreview(changes, labels, repository, kept = []) {
|
|
119
|
+
return [
|
|
120
|
+
`\nInstallation preview: ${changes.length} files`, "",
|
|
121
|
+
...[
|
|
122
|
+
{ label: "CREATE", files: changes.filter((change) => change.before === null) },
|
|
123
|
+
{ label: "UPDATE", files: changes.filter((change) => change.before !== null && change.after !== null) },
|
|
124
|
+
{ label: "ARCHIVE / REMOVE ORIGINAL", files: changes.filter((change) => change.after === null) },
|
|
125
|
+
].flatMap((group) => group.files.length ? [
|
|
126
|
+
`${group.label} | ${group.files.length} files`,
|
|
127
|
+
...group.files.map((change) => {
|
|
128
|
+
const detail = describeInstallationFile(change);
|
|
129
|
+
return ` ${change.path}\n ${detail.ownership}: ${detail.purpose}`;
|
|
130
|
+
}), "",
|
|
131
|
+
] : []),
|
|
132
|
+
...(kept.length ? [`KEPT AS YOU EDITED | ${kept.length} files`, ...kept.map((path) => ` ${path}`), ""] : []),
|
|
133
|
+
labels.length ? `GITHUB LABELS | ${labels.length} in ${repository || "(repository not set)"}\n${labels.map((label) => ` ${label}`).join("\n")}` : "GitHub labels skipped.",
|
|
134
|
+
"", "Preview only. Nothing above is applied until confirmed.",
|
|
135
|
+
].join("\n");
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=review.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.js","sourceRoot":"","sources":["../../src/setup/review.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAA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EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;YACxC,GAAG,KAAK,CAAC,KAAK,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,QAAQ;YAC9C,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;gBAC5B,MAAM,MAAM,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC;gBAChD,OAAO,KAAK,MAAM,CAAC,IAAI,SAAS,MAAM,CAAC,SAAS,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC;YACxE,CAAC,CAAC,EAAE,EAAE;SACP,CAAC,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,wBAAwB,IAAI,CAAC,MAAM,QAAQ,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7G,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,mBAAmB,MAAM,CAAC,MAAM,OAAO,UAAU,IAAI,sBAAsB,KAAK,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,wBAAwB;QAC3K,EAAE,EAAE,yDAAyD;KAC9D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Role } from "../config.js";
|
|
2
|
+
export interface TeamAssessment {
|
|
3
|
+
suggestions: {
|
|
4
|
+
role: Role;
|
|
5
|
+
evidence: string[];
|
|
6
|
+
reason: string;
|
|
7
|
+
}[];
|
|
8
|
+
reviewExisting: {
|
|
9
|
+
id: string;
|
|
10
|
+
reason: string;
|
|
11
|
+
}[];
|
|
12
|
+
coverage: {
|
|
13
|
+
inspected: string[];
|
|
14
|
+
omitted: string[];
|
|
15
|
+
warnings: string[];
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare function assessTeam(root: string, paths: string[], current: Role[]): Promise<TeamAssessment>;
|