-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
431 lines (416 loc) · 16 KB
/
action.yml
File metadata and controls
431 lines (416 loc) · 16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
name: 'SET'
description: 'Thin orchestration entrypoint for agentsgen repo-docs, site-ai, and check flows.'
inputs:
agentsgen:
description: 'Enable the agentsgen tool family.'
required: false
default: ''
init:
description: 'Run agentsgen init. Leave empty to inherit workflow_preset or default behavior.'
required: false
default: ''
pack:
description: 'Run agentsgen pack. Leave empty to inherit workflow_preset or default behavior.'
required: false
default: ''
site_pack:
description: 'Run agentsgen pack in public-site mode. Leave empty to inherit workflow_preset or default behavior.'
required: false
default: ''
site_url:
description: 'Public URL passed to agentsgen pack --site.'
required: false
default: ''
check:
description: 'Run agentsgen check --all --ci. Leave empty to inherit workflow_preset or default behavior.'
required: false
default: ''
repomap:
description: 'Run agentsgen understand for deterministic repo map artifacts. Leave empty to inherit workflow_preset or default behavior.'
required: false
default: ''
repomap_compact_budget:
description: 'Approximate token budget passed to agentsgen understand --compact-budget.'
required: false
default: '4000'
repomap_focus:
description: 'Optional query passed to agentsgen understand --focus.'
required: false
default: ''
repomap_changed:
description: 'When true, passes --changed to agentsgen understand.'
required: false
default: ''
snippets:
description: 'Run agentsgen snippets for canonical README extracts. Leave empty to inherit workflow_preset or default behavior.'
required: false
default: ''
analyze:
description: 'Run agentsgen analyze against a public URL. Leave empty to inherit workflow_preset or default behavior.'
required: false
default: ''
analyze_url:
description: 'Public URL passed to agentsgen analyze.'
required: false
default: ''
meta:
description: 'Run agentsgen meta against a public URL. Leave empty to inherit workflow_preset or default behavior.'
required: false
default: ''
meta_url:
description: 'Public URL passed to agentsgen meta.'
required: false
default: ''
proof_loop:
description: 'Run the optional proof-loop artifact flow. Leave empty to inherit workflow_preset or default behavior.'
required: false
default: ''
proof_task_id:
description: 'Task id used for agentsgen task init/evidence/verdict when proof_loop=true.'
required: false
default: ''
proof_expected_artifacts:
description: 'Optional comma-separated list of proof artifacts that must exist before verdict can become review-ready.'
required: false
default: ''
id_enabled:
description: 'Enable repo-local ID integration hooks for ID-compatible repositories.'
required: false
default: ''
id_owner_id:
description: 'Owner id passed to the ID integration hook runner.'
required: false
default: ''
id_target:
description: 'ID integration target passed to pre_task. Defaults to set.'
required: false
default: ''
id_pre_task:
description: 'Run the repo-local ID pre_task hook before orchestration steps.'
required: false
default: ''
id_weekly_review:
description: 'Run the repo-local ID weekly_review hook after orchestration steps.'
required: false
default: ''
autodetect:
description: 'Enable agentsgen autodetect where supported.'
required: false
default: 'true'
workflow_preset:
description: 'Optional orchestration preset: minimal, repo-docs, or site-ai.'
required: false
default: ''
preset:
description: 'Optional preset name passed to agentsgen init.'
required: false
default: ''
path:
description: 'Target path.'
required: false
default: '.'
agentsgen_ref:
description: 'Git ref used when installing agentsgen from GitHub.'
required: false
default: 'main'
runs:
using: 'composite'
steps:
- name: Resolve workflow preset
shell: bash
env:
INPUT_AGENTSGEN: ${{ inputs.agentsgen }}
INPUT_INIT: ${{ inputs.init }}
INPUT_PACK: ${{ inputs.pack }}
INPUT_SITE_PACK: ${{ inputs.site_pack }}
INPUT_SITE_URL: ${{ inputs.site_url }}
INPUT_CHECK: ${{ inputs.check }}
INPUT_REPOMAP: ${{ inputs.repomap }}
INPUT_REPOMAP_COMPACT_BUDGET: ${{ inputs.repomap_compact_budget }}
INPUT_REPOMAP_FOCUS: ${{ inputs.repomap_focus }}
INPUT_REPOMAP_CHANGED: ${{ inputs.repomap_changed }}
INPUT_SNIPPETS: ${{ inputs.snippets }}
INPUT_ANALYZE: ${{ inputs.analyze }}
INPUT_ANALYZE_URL: ${{ inputs.analyze_url }}
INPUT_META: ${{ inputs.meta }}
INPUT_META_URL: ${{ inputs.meta_url }}
INPUT_PROOF_LOOP: ${{ inputs.proof_loop }}
INPUT_PROOF_TASK_ID: ${{ inputs.proof_task_id }}
INPUT_PROOF_EXPECTED_ARTIFACTS: ${{ inputs.proof_expected_artifacts }}
INPUT_ID_ENABLED: ${{ inputs.id_enabled }}
INPUT_ID_OWNER_ID: ${{ inputs.id_owner_id }}
INPUT_ID_TARGET: ${{ inputs.id_target }}
INPUT_ID_PRE_TASK: ${{ inputs.id_pre_task }}
INPUT_ID_WEEKLY_REVIEW: ${{ inputs.id_weekly_review }}
INPUT_AUTODETECT: ${{ inputs.autodetect }}
INPUT_WORKFLOW_PRESET: ${{ inputs.workflow_preset }}
INPUT_PRESET: ${{ inputs.preset }}
INPUT_PATH: ${{ inputs.path }}
INPUT_AGENTSGEN_REF: ${{ inputs.agentsgen_ref }}
run: |
set -euo pipefail
python "${GITHUB_ACTION_PATH}/scripts/resolve_inputs.py"
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Run ID pre_task hook
if: ${{ env.SET_RESOLVED_ID_ENABLED == 'true' && env.SET_RESOLVED_ID_PRE_TASK == 'true' }}
shell: bash
run: |
set -euo pipefail
hook_path="${{ inputs.path }}/scripts/run_integration_hook.sh"
if [ ! -f "${hook_path}" ]; then
echo "ERROR: missing repo-local ID hook runner at ${hook_path}" >&2
exit 1
fi
if [ -z "${SET_RESOLVED_ID_OWNER_ID}" ]; then
echo "ERROR: id_owner_id is required when id_pre_task=true" >&2
exit 1
fi
if [ -z "${SET_RESOLVED_ID_TARGET}" ]; then
echo "ERROR: id_target is required when id_pre_task=true" >&2
exit 1
fi
cmd=(bash "${hook_path}" pre_task --owner-id "${SET_RESOLVED_ID_OWNER_ID}" --target "${SET_RESOLVED_ID_TARGET}")
printf 'Running:'
printf ' %q' "${cmd[@]}"
printf '\n'
"${cmd[@]}"
- name: Install agentsgen
if: ${{ env.SET_RESOLVED_AGENTSGEN == 'true' }}
shell: bash
run: |
set -euo pipefail
python -m pip install --upgrade pip
python -m pip install "git+https://github.com/markoblogo/AGENTS.md_generator.git@${{ inputs.agentsgen_ref }}"
- name: Run agentsgen init
if: ${{ env.SET_RESOLVED_AGENTSGEN == 'true' && env.SET_RESOLVED_INIT == 'true' }}
shell: bash
run: |
set -euo pipefail
cmd=(agentsgen init "${{ inputs.path }}" --defaults)
if [ "${{ inputs.autodetect }}" = "true" ]; then
cmd+=(--autodetect)
fi
if [ -n "${{ inputs.preset }}" ]; then
cmd+=(--preset "${{ inputs.preset }}")
fi
printf 'Running:'
printf ' %q' "${cmd[@]}"
printf '\n'
"${cmd[@]}"
- name: Run agentsgen pack
if: ${{ env.SET_RESOLVED_AGENTSGEN == 'true' && env.SET_RESOLVED_PACK == 'true' }}
shell: bash
run: |
set -euo pipefail
cmd=(agentsgen pack "${{ inputs.path }}")
if [ "${{ inputs.autodetect }}" = "true" ]; then
cmd+=(--autodetect)
fi
if [ "${SET_RESOLVED_SITE_PACK}" = "true" ]; then
if [ -z "${SET_RESOLVED_SITE_URL}" ]; then
echo "ERROR: site_url is required when site_pack=true or workflow_preset enables site mode" >&2
exit 1
fi
cmd+=(--site "${SET_RESOLVED_SITE_URL}")
fi
printf 'Running:'
printf ' %q' "${cmd[@]}"
printf '\n'
"${cmd[@]}"
- name: Run agentsgen check
if: ${{ env.SET_RESOLVED_AGENTSGEN == 'true' && env.SET_RESOLVED_CHECK == 'true' }}
shell: bash
run: |
set -euo pipefail
agentsgen check "${{ inputs.path }}" --all --ci
- name: Run agentsgen repomap
if: ${{ env.SET_RESOLVED_AGENTSGEN == 'true' && env.SET_RESOLVED_REPOMAP == 'true' }}
shell: bash
run: |
set -euo pipefail
cmd=(agentsgen understand "${{ inputs.path }}")
if [ -n "${{ inputs.repomap_compact_budget }}" ]; then
cmd+=(--compact-budget "${{ inputs.repomap_compact_budget }}")
fi
if [ -n "${{ inputs.repomap_focus }}" ]; then
cmd+=(--focus "${{ inputs.repomap_focus }}")
fi
if [ "${{ inputs.repomap_changed }}" = "true" ]; then
cmd+=(--changed)
fi
printf 'Running:'
printf ' %q' "${cmd[@]}"
printf '\n'
"${cmd[@]}"
- name: Run agentsgen snippets
if: ${{ env.SET_RESOLVED_AGENTSGEN == 'true' && env.SET_RESOLVED_SNIPPETS == 'true' }}
shell: bash
run: |
set -euo pipefail
cmd=(agentsgen snippets "${{ inputs.path }}")
printf 'Running:'
printf ' %q' "${cmd[@]}"
printf '\n'
"${cmd[@]}"
- name: Run agentsgen analyze
if: ${{ env.SET_RESOLVED_AGENTSGEN == 'true' && env.SET_RESOLVED_ANALYZE == 'true' }}
shell: bash
run: |
set -euo pipefail
if [ -z "${SET_RESOLVED_ANALYZE_URL}" ]; then
echo "ERROR: analyze_url is required when analyze=true or workflow_preset enables analyze" >&2
exit 1
fi
cmd=(agentsgen analyze "${SET_RESOLVED_ANALYZE_URL}" "${{ inputs.path }}")
printf 'Running:'
printf ' %q' "${cmd[@]}"
printf '\n'
"${cmd[@]}"
- name: Run agentsgen meta
if: ${{ env.SET_RESOLVED_AGENTSGEN == 'true' && env.SET_RESOLVED_META == 'true' }}
shell: bash
run: |
set -euo pipefail
if [ -z "${SET_RESOLVED_META_URL}" ]; then
echo "ERROR: meta_url is required when meta=true or workflow_preset enables meta" >&2
exit 1
fi
cmd=(agentsgen meta "${SET_RESOLVED_META_URL}" "${{ inputs.path }}")
printf 'Running:'
printf ' %q' "${cmd[@]}"
printf '\n'
"${cmd[@]}"
- name: Run agentsgen proof loop
if: ${{ env.SET_RESOLVED_AGENTSGEN == 'true' && env.SET_RESOLVED_PROOF_LOOP == 'true' }}
shell: bash
run: |
set -euo pipefail
if [ -z "${SET_RESOLVED_PROOF_TASK_ID}" ]; then
echo "ERROR: proof_task_id is required when proof_loop=true" >&2
exit 1
fi
init_cmd=(
agentsgen task init "${SET_RESOLVED_PROOF_TASK_ID}" "${{ inputs.path }}"
--summary "SET proof-loop contract for ${{ inputs.path }}"
--acceptance "Requested orchestration steps are captured in repo-local proof artifacts."
--acceptance "Evidence reflects current repo state and generated artifacts."
--acceptance "Verdict is explicit and reviewable."
)
evidence_cmd=(
agentsgen task evidence "${SET_RESOLVED_PROOF_TASK_ID}" "${{ inputs.path }}"
--note "Automated proof bundle generated by SET."
--note "Generated by the SET composite action after orchestration steps completed."
)
verdict_cmd=(
agentsgen task verdict "${SET_RESOLVED_PROOF_TASK_ID}" "${{ inputs.path }}"
--status needs-review
--summary "Automated proof bundle generated by SET. Review evidence and checks before marking pass."
)
if [ "${SET_RESOLVED_CHECK}" = "true" ]; then
evidence_cmd+=(--check "agentsgen-check=passed")
fi
evidence_cmd+=(--check "set-proof-loop=passed")
if [ "${SET_RESOLVED_REPOMAP}" = "true" ]; then
evidence_cmd+=(--artifact "docs/ai/repomap.compact.md" --artifact "agents.knowledge.json")
fi
if [ "${SET_RESOLVED_SNIPPETS}" = "true" ]; then
evidence_cmd+=(--artifact "README_SNIPPETS.generated.md")
fi
if [ "${SET_RESOLVED_ANALYZE}" = "true" ]; then
evidence_cmd+=(--artifact "docs/ai/llmo-score.json")
fi
if [ "${SET_RESOLVED_META}" = "true" ]; then
evidence_cmd+=(--artifact "docs/ai/llmo-meta.json")
fi
if [ "${SET_RESOLVED_PACK}" = "true" ]; then
evidence_cmd+=(--artifact "docs/ai/how-to-run.md" --artifact "llms.txt")
fi
if [ -n "${{ inputs.proof_expected_artifacts }}" ]; then
IFS=',' read -r -a extra_expected <<< "${{ inputs.proof_expected_artifacts }}"
else
extra_expected=()
fi
printf 'Running:'
printf ' %q' "${init_cmd[@]}"
printf '\n'
"${init_cmd[@]}"
printf 'Running:'
printf ' %q' "${evidence_cmd[@]}"
printf '\n'
"${evidence_cmd[@]}"
blocking_items=()
while IFS= read -r artifact_path; do
[ -n "${artifact_path}" ] || continue
if [ ! -e "${{ inputs.path }}/${artifact_path}" ]; then
blocking_items+=("high: expected proof artifact is missing: ${artifact_path}")
fi
done < <(
printf '%s\n' \
"docs/ai/tasks/${SET_RESOLVED_PROOF_TASK_ID}/contract.md" \
"docs/ai/tasks/${SET_RESOLVED_PROOF_TASK_ID}/evidence.json" \
"docs/ai/tasks/${SET_RESOLVED_PROOF_TASK_ID}/verdict.json"
if [ "${SET_RESOLVED_REPOMAP}" = "true" ]; then
printf '%s\n' "docs/ai/repomap.compact.md" "agents.knowledge.json"
fi
if [ "${SET_RESOLVED_SNIPPETS}" = "true" ]; then
printf '%s\n' "README_SNIPPETS.generated.md"
fi
if [ "${SET_RESOLVED_ANALYZE}" = "true" ]; then
printf '%s\n' "docs/ai/llmo-score.json"
fi
if [ "${SET_RESOLVED_META}" = "true" ]; then
printf '%s\n' "docs/ai/llmo-meta.json"
fi
if [ "${SET_RESOLVED_PACK}" = "true" ]; then
printf '%s\n' "docs/ai/how-to-run.md" "llms.txt"
fi
for artifact_path in "${extra_expected[@]}"; do
artifact_path="$(printf '%s' "${artifact_path}" | xargs)"
[ -n "${artifact_path}" ] && printf '%s\n' "${artifact_path}"
done
)
for item in "${blocking_items[@]}"; do
verdict_cmd+=(--blocking-item "${item}")
done
printf 'Running:'
printf ' %q' "${verdict_cmd[@]}"
printf '\n'
"${verdict_cmd[@]}"
- name: Run ID weekly_review hook
if: ${{ env.SET_RESOLVED_ID_ENABLED == 'true' && env.SET_RESOLVED_ID_WEEKLY_REVIEW == 'true' }}
shell: bash
run: |
set -euo pipefail
hook_path="${{ inputs.path }}/scripts/run_integration_hook.sh"
if [ ! -f "${hook_path}" ]; then
echo "ERROR: missing repo-local ID hook runner at ${hook_path}" >&2
exit 1
fi
if [ -z "${SET_RESOLVED_ID_OWNER_ID}" ]; then
echo "ERROR: id_owner_id is required when id_weekly_review=true" >&2
exit 1
fi
cmd=(bash "${hook_path}" weekly_review --owner-id "${SET_RESOLVED_ID_OWNER_ID}")
printf 'Running:'
printf ' %q' "${cmd[@]}"
printf '\n'
"${cmd[@]}"
- name: Write execution summary
if: ${{ always() }}
shell: bash
env:
INPUT_REPOMAP_COMPACT_BUDGET: ${{ inputs.repomap_compact_budget }}
INPUT_REPOMAP_FOCUS: ${{ inputs.repomap_focus }}
INPUT_REPOMAP_CHANGED: ${{ inputs.repomap_changed }}
INPUT_ID_OWNER_ID: ${{ inputs.id_owner_id }}
INPUT_ID_TARGET: ${{ inputs.id_target }}
INPUT_WORKFLOW_PRESET: ${{ inputs.workflow_preset }}
INPUT_PATH: ${{ inputs.path }}
INPUT_AUTODETECT: ${{ inputs.autodetect }}
INPUT_PRESET: ${{ inputs.preset }}
INPUT_AGENTSGEN_REF: ${{ inputs.agentsgen_ref }}
run: |
set -euo pipefail
python "${GITHUB_ACTION_PATH}/scripts/write_summary.py"