Skip to content

Commit fe7cfa3

Browse files
committed
new workflow
1 parent 1248e44 commit fe7cfa3

2 files changed

Lines changed: 34 additions & 232 deletions

File tree

‎.github/workflows/check-skills.yml‎

Lines changed: 34 additions & 180 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
# check-skills.yml — Drop this into your library repo's .github/workflows/
22
#
3-
# Checks intent skills after a release and opens or updates one review PR when
4-
# existing skills, artifact coverage, or workspace package coverage need review.
3+
# Validates intent skills on PRs. After a release or manual run, opens or
4+
# updates one review PR when existing skills, artifact coverage, or workspace
5+
# package coverage need review.
56
#
6-
# Triggers: new release published, or manual workflow_dispatch.
7+
# Triggers: pull requests touching skills/artifacts, new release published, or
8+
# manual workflow_dispatch.
79
#
8-
# intent-workflow-version: 2
10+
# intent-workflow-version: 3
911
#
1012
# Template variables (replaced by `intent setup`):
1113
# @tanstack/router — e.g. @tanstack/query or my-workspace workspace
1214

1315
name: Check Skills
1416

1517
on:
18+
pull_request:
19+
paths:
20+
- 'skills/**'
21+
- '**/skills/**'
22+
- '_artifacts/**'
23+
- '**/_artifacts/**'
1624
release:
1725
types: [published]
1826
workflow_dispatch: {}
@@ -22,8 +30,28 @@ permissions:
2230
pull-requests: write
2331

2432
jobs:
25-
check:
33+
validate:
34+
name: Validate intent skills
35+
if: github.event_name == 'pull_request'
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
41+
- name: Setup Node
42+
uses: actions/setup-node@v4
43+
with:
44+
node-version: 20
45+
46+
- name: Install intent
47+
run: npm install -g @tanstack/intent
48+
49+
- name: Validate skills
50+
run: intent validate --github-summary
51+
52+
review:
2653
name: Check intent skill coverage
54+
if: github.event_name != 'pull_request'
2755
runs-on: ubuntu-latest
2856
steps:
2957
- name: Checkout
@@ -42,181 +70,7 @@ jobs:
4270
- name: Check skills
4371
id: stale
4472
run: |
45-
set +e
46-
intent stale --json > stale.json
47-
STATUS=$?
48-
set -e
49-
50-
cat stale.json
51-
52-
if [ "$STATUS" -ne 0 ]; then
53-
echo "has_review=true" >> "$GITHUB_OUTPUT"
54-
echo "check_failed=true" >> "$GITHUB_OUTPUT"
55-
cat > review-items.json <<'JSON'
56-
[
57-
{
58-
"type": "stale-check-failed",
59-
"library": "@tanstack/router",
60-
"subject": "intent stale --json",
61-
"reasons": ["The stale check command failed. Review the workflow logs before updating skills."]
62-
}
63-
]
64-
JSON
65-
else
66-
node <<'NODE'
67-
const fs = require('fs')
68-
const reports = JSON.parse(fs.readFileSync('stale.json', 'utf8'))
69-
const items = []
70-
71-
for (const report of reports) {
72-
for (const skill of report.skills ?? []) {
73-
if (!skill?.needsReview) continue
74-
items.push({
75-
type: 'stale-skill',
76-
library: report.library,
77-
subject: skill.name,
78-
reasons: skill.reasons ?? [],
79-
})
80-
}
81-
82-
for (const signal of report.signals ?? []) {
83-
if (signal?.needsReview === false) continue
84-
items.push({
85-
type: signal?.type ?? 'review-signal',
86-
library: signal?.library ?? report.library,
87-
subject:
88-
signal?.packageName ??
89-
signal?.packageRoot ??
90-
signal?.skill ??
91-
signal?.artifactPath ??
92-
signal?.subject ??
93-
report.library,
94-
reasons: signal?.reasons ?? [],
95-
artifactPath: signal?.artifactPath,
96-
packageName: signal?.packageName,
97-
packageRoot: signal?.packageRoot,
98-
skill: signal?.skill,
99-
})
100-
}
101-
}
102-
103-
fs.writeFileSync('review-items.json', JSON.stringify(items, null, 2) + '\n')
104-
fs.appendFileSync(
105-
process.env.GITHUB_OUTPUT,
106-
`has_review=${items.length > 0 ? 'true' : 'false'}\n`,
107-
)
108-
NODE
109-
fi
110-
111-
{
112-
echo "review_items<<EOF"
113-
cat review-items.json
114-
echo "EOF"
115-
} >> "$GITHUB_OUTPUT"
116-
117-
- name: Write clean summary
118-
if: steps.stale.outputs.has_review == 'false'
119-
run: |
120-
{
121-
echo "### Intent skill review"
122-
echo ""
123-
echo "No stale skills or coverage gaps found."
124-
} >> "$GITHUB_STEP_SUMMARY"
125-
126-
- name: Build review PR body
127-
if: steps.stale.outputs.has_review == 'true'
128-
run: |
129-
node <<'NODE'
130-
const fs = require('fs')
131-
const items = JSON.parse(fs.readFileSync('review-items.json', 'utf8'))
132-
const grouped = new Map()
133-
134-
for (const item of items) {
135-
grouped.set(item.type, (grouped.get(item.type) ?? 0) + 1)
136-
}
137-
138-
const signalRows = [...grouped.entries()]
139-
.sort(([a], [b]) => a.localeCompare(b))
140-
.map(([type, count]) => `| \`${type}\` | ${count} |`)
141-
142-
const itemRows = items.map((item) => {
143-
const subject = item.subject ? `\`${item.subject}\`` : '-'
144-
const reasons = item.reasons?.length ? item.reasons.join('; ') : '-'
145-
return `| \`${item.type}\` | ${subject} | \`${item.library}\` | ${reasons} |`
146-
})
147-
148-
const prompt = [
149-
'You are helping maintain Intent skills for this repository.',
150-
'',
151-
'Goal:',
152-
'Resolve the Intent skill review signals below while preserving the existing scope, taxonomy, and maintainer-reviewed artifacts.',
153-
'',
154-
'Review signals:',
155-
JSON.stringify(items, null, 2),
156-
'',
157-
'Required workflow:',
158-
'1. Read the existing `_artifacts/*domain_map.yaml`, `_artifacts/*skill_tree.yaml`, and generated `skills/**/SKILL.md` files.',
159-
'2. Read each flagged package package.json, public exports, README/docs if present, and source entry points.',
160-
'3. Compare flagged packages against the existing domains, skills, tasks, packages, covers, sources, tensions, and cross-references in the artifacts.',
161-
'4. For each signal, decide whether it means existing skill coverage, a missing generated skill, a new skill candidate, out-of-scope coverage, or deferred work.',
162-
'',
163-
'Maintainer questions:',
164-
'Before editing skills or artifacts, ask the maintainer:',
165-
'1. For each flagged package, is this package user-facing enough to need agent guidance?',
166-
'2. If yes, should it extend an existing skill or become a new skill?',
167-
'3. If it extends an existing skill, which current skill should own it?',
168-
'4. If it is out of scope, what short reason should be recorded in artifact coverage ignores?',
169-
'5. Are any of these packages experimental or unstable enough to exclude for now?',
170-
'',
171-
'Decision rules:',
172-
'- Do not auto-generate skills.',
173-
'- Do not create broad new skill areas without maintainer confirmation.',
174-
'- Prefer adding package coverage to an existing skill when the package is an implementation variant of an existing domain.',
175-
'- Create a new skill only when the package introduces a distinct developer task or failure mode.',
176-
'- Preserve current naming, path, and package layout conventions.',
177-
'- Keep generated skills under the package-local `skills/` directory.',
178-
'- Keep repo-root `_artifacts` as the reviewed plan.',
179-
'',
180-
'If maintainer confirms updates:',
181-
'1. Update the relevant `_artifacts/*domain_map.yaml` or `_artifacts/*skill_tree.yaml`.',
182-
'2. Update or create `SKILL.md` files only for confirmed coverage changes.',
183-
'3. Keep `sources` aligned between artifact skill entries and SKILL frontmatter.',
184-
'4. Bump `library_version` only for skills whose covered source package version changed.',
185-
'5. Run `npx @tanstack/intent@latest validate` on touched skill directories.',
186-
'6. Summarize every package as one of: existing-skill coverage, new skill, ignored, or deferred.',
187-
].join('\n')
188-
189-
const body = [
190-
'## Intent Skill Review Needed',
191-
'',
192-
'Intent found skills, artifact coverage, or workspace package coverage that need maintainer review.',
193-
'',
194-
'### Summary',
195-
'',
196-
'| Signal | Count |',
197-
'| --- | ---: |',
198-
...signalRows,
199-
'',
200-
'### Review Items',
201-
'',
202-
'| Signal | Subject | Library | Reason |',
203-
'| --- | --- | --- | --- |',
204-
...itemRows,
205-
'',
206-
'### Agent Prompt',
207-
'',
208-
'Paste this into your coding agent:',
209-
'',
210-
'```text',
211-
prompt,
212-
'```',
213-
'',
214-
'This PR is a review reminder only. It does not update skills automatically.',
215-
].join('\n')
216-
217-
fs.writeFileSync('pr-body.md', body + '\n')
218-
fs.writeFileSync(process.env.GITHUB_STEP_SUMMARY, body + '\n')
219-
NODE
73+
intent stale --github-review --package-label "@tanstack/router"
22074
22175
- name: Open or update review PR
22276
if: steps.stale.outputs.has_review == 'true'

‎.github/workflows/validate-skills.yml‎

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)