Skip to content

Commit 45c9d23

Browse files
committed
chore: wire up tanstack intent skills, bin shim, and CI workflows
1 parent a5ca248 commit 45c9d23

File tree

17 files changed

+961
-51
lines changed

17 files changed

+961
-51
lines changed

.agents/index.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,26 @@ npx @tanstack/cli ecosystem --category database --json
116116
| `packages/cli/src/cli.ts` | CLI command definitions |
117117
| `packages/create/src/frameworks/` | Framework implementations |
118118
| `packages/create/src/app-*.ts` | App creation logic |
119-
| `.tanstack.json` | Generated project config |
119+
| `.cta.json` | Generated project config |
120120

121121

122-
## Playbook Skills
122+
## Intent Skills
123+
124+
This project uses [TanStack Intent](https://github.com/TanStack/intent). Run `npx @tanstack/intent install` to set up skill-to-task mappings for your coding agent. Before working on a task, read the relevant SKILL.md file in `packages/cli/skills/`.
125+
126+
<!-- intent-skills:start -->
127+
# Skill mappings — when working in these areas, load the linked skill file into context.
128+
skills:
129+
- task: "scaffold a new TanStack app with create command, framework, template, toolchain, deployment, or add-on flags"
130+
load: "packages/cli/skills/create-app-scaffold/SKILL.md"
131+
- task: "add add-ons to an existing project using tanstack add"
132+
load: "packages/cli/skills/add-addons-existing-app/SKILL.md"
133+
- task: "query docs, list add-ons, inspect add-on details, or fetch library metadata for agent context"
134+
load: "packages/cli/skills/query-docs-library-metadata/SKILL.md"
135+
- task: "choose ecosystem integrations like auth providers, ORMs, or deployment targets"
136+
load: "packages/cli/skills/choose-ecosystem-integrations/SKILL.md"
137+
- task: "author, compile, or dev-watch custom add-ons or templates"
138+
load: "packages/cli/skills/maintain-custom-addons-dev-watch/SKILL.md"
139+
<!-- intent-skills:end -->
140+
123141

124-
This project uses TanStack Playbooks. Run `npx playbook list` to discover
125-
available AI coding skills. Before working with a library that has skills,
126-
read the relevant SKILL.md file at the path shown in the list output.

.changeset/intent-skills-setup.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@tanstack/cli": patch
3+
---
4+
5+
Wire up TanStack Intent: add bin shim, CI workflows for skill validation and staleness checks, and update skill files to v0.62.1

.github/workflows/check-skills.yml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# check-skills.yml — Drop this into your library repo's .github/workflows/
2+
#
3+
# Checks for stale intent skills after a release and opens a review PR
4+
# if any skills need attention. The PR body includes a prompt you can
5+
# paste into Claude Code, Cursor, or any coding agent to update them.
6+
#
7+
# Triggers: new release published, or manual workflow_dispatch.
8+
#
9+
# Template variables (replaced by `intent setup`):
10+
# @tanstack/cli — e.g. @tanstack/query
11+
12+
name: Check Skills
13+
14+
on:
15+
release:
16+
types: [published]
17+
workflow_dispatch: {}
18+
19+
permissions:
20+
contents: write
21+
pull-requests: write
22+
23+
jobs:
24+
check:
25+
name: Check for stale skills
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Setup Node
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: 20
37+
38+
- name: Install intent
39+
run: npm install -g @tanstack/intent
40+
41+
- name: Check staleness
42+
id: stale
43+
run: |
44+
OUTPUT=$(npx @tanstack/intent stale --json 2>&1) || true
45+
echo "$OUTPUT"
46+
47+
# Check if any skills need review
48+
NEEDS_REVIEW=$(echo "$OUTPUT" | node -e "
49+
const input = require('fs').readFileSync('/dev/stdin','utf8');
50+
try {
51+
const reports = JSON.parse(input);
52+
const stale = reports.flatMap(r =>
53+
r.skills.filter(s => s.needsReview).map(s => ({ library: r.library, skill: s.name, reasons: s.reasons }))
54+
);
55+
if (stale.length > 0) {
56+
console.log(JSON.stringify(stale));
57+
}
58+
} catch {}
59+
")
60+
61+
if [ -z "$NEEDS_REVIEW" ]; then
62+
echo "has_stale=false" >> "$GITHUB_OUTPUT"
63+
else
64+
echo "has_stale=true" >> "$GITHUB_OUTPUT"
65+
# Escape for multiline GH output
66+
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
67+
echo "stale_json<<$EOF" >> "$GITHUB_OUTPUT"
68+
echo "$NEEDS_REVIEW" >> "$GITHUB_OUTPUT"
69+
echo "$EOF" >> "$GITHUB_OUTPUT"
70+
fi
71+
72+
- name: Build summary
73+
if: steps.stale.outputs.has_stale == 'true'
74+
id: summary
75+
run: |
76+
node -e "
77+
const stale = JSON.parse(process.env.STALE_JSON);
78+
const lines = stale.map(s =>
79+
'- **' + s.skill + '** (' + s.library + '): ' + s.reasons.join(', ')
80+
);
81+
const summary = lines.join('\n');
82+
83+
const prompt = [
84+
'Review and update the following stale intent skills for @tanstack/cli:',
85+
'',
86+
...stale.map(s => '- ' + s.skill + ': ' + s.reasons.join(', ')),
87+
'',
88+
'For each stale skill:',
89+
'1. Read the current SKILL.md file',
90+
'2. Check what changed in the library since the skill was last updated',
91+
'3. Update the skill content to reflect current APIs and behavior',
92+
'4. Run \`npx @tanstack/intent validate\` to verify the updated skill',
93+
].join('\n');
94+
95+
// Write outputs
96+
const fs = require('fs');
97+
const env = fs.readFileSync(process.env.GITHUB_OUTPUT, 'utf8');
98+
const eof = require('crypto').randomBytes(15).toString('base64');
99+
fs.appendFileSync(process.env.GITHUB_OUTPUT,
100+
'summary<<' + eof + '\n' + summary + '\n' + eof + '\n' +
101+
'prompt<<' + eof + '\n' + prompt + '\n' + eof + '\n'
102+
);
103+
"
104+
env:
105+
STALE_JSON: ${{ steps.stale.outputs.stale_json }}
106+
107+
- name: Open review PR
108+
if: steps.stale.outputs.has_stale == 'true'
109+
env:
110+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111+
run: |
112+
VERSION="${{ github.event.release.tag_name || 'manual' }}"
113+
BRANCH="skills/review-${VERSION}"
114+
115+
git config user.name "github-actions[bot]"
116+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
117+
git checkout -b "$BRANCH"
118+
git commit --allow-empty -m "chore: review stale skills for ${VERSION}"
119+
git push origin "$BRANCH"
120+
121+
gh pr create \
122+
--title "Review stale skills (${VERSION})" \
123+
--body "$(cat <<'PREOF'
124+
## Stale Skills Detected
125+
126+
The following skills may need updates after the latest release:
127+
128+
${{ steps.summary.outputs.summary }}
129+
130+
---
131+
132+
### Update Prompt
133+
134+
Paste this into your coding agent (Claude Code, Cursor, etc.):
135+
136+
~~~
137+
${{ steps.summary.outputs.prompt }}
138+
~~~
139+
140+
PREOF
141+
)" \
142+
--head "$BRANCH" \
143+
--base main
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# notify-intent.yml — Drop this into your library repo's .github/workflows/
2+
#
3+
# Fires a repository_dispatch event to TanStack/intent whenever docs or
4+
# source files change on merge to main. This triggers the skill staleness
5+
# check workflow in the intent repo.
6+
#
7+
# Requirements:
8+
# - A fine-grained PAT with contents:write on TanStack/intent stored
9+
# as the INTENT_NOTIFY_TOKEN repository secret.
10+
#
11+
# Template variables (replaced by `intent setup`):
12+
# @tanstack/cli — e.g. @tanstack/query
13+
# docs/** — e.g. docs/**
14+
# src/** — e.g. packages/query-core/src/**
15+
16+
name: Notify Intent
17+
18+
on:
19+
push:
20+
branches: [main]
21+
paths:
22+
- 'docs/**'
23+
- 'src/**'
24+
25+
jobs:
26+
notify:
27+
name: Notify TanStack Intent
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 2
34+
35+
- name: Collect changed files
36+
id: changes
37+
run: |
38+
FILES=$(git diff --name-only HEAD~1 HEAD | jq -R -s -c 'split("\n") | map(select(length > 0))')
39+
echo "files=$FILES" >> "$GITHUB_OUTPUT"
40+
41+
- name: Dispatch to intent repo
42+
uses: peter-evans/repository-dispatch@v3
43+
with:
44+
token: ${{ secrets.INTENT_NOTIFY_TOKEN }}
45+
repository: TanStack/intent
46+
event-type: skill-check
47+
client-payload: |
48+
{
49+
"package": "@tanstack/cli",
50+
"sha": "${{ github.sha }}",
51+
"changed_files": ${{ steps.changes.outputs.files }}
52+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# validate-skills.yml — Drop this into your library repo's .github/workflows/
2+
#
3+
# Validates skill files on PRs that touch the skills/ directory.
4+
# Ensures frontmatter is correct, names match paths, and files stay under
5+
# the 500-line limit.
6+
7+
name: Validate Skills
8+
9+
on:
10+
pull_request:
11+
paths:
12+
- 'skills/**'
13+
- '**/skills/**'
14+
15+
jobs:
16+
validate:
17+
name: Validate skill files
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 20
27+
28+
- name: Install intent CLI
29+
run: npm install -g @tanstack/intent
30+
31+
- name: Find and validate skills
32+
run: |
33+
# Find all directories containing SKILL.md files
34+
SKILLS_DIR=""
35+
if [ -d "skills" ]; then
36+
SKILLS_DIR="skills"
37+
elif [ -d "packages" ]; then
38+
# Monorepo — find skills/ under packages
39+
for dir in packages/*/skills; do
40+
if [ -d "$dir" ]; then
41+
echo "Validating $dir..."
42+
intent validate "$dir"
43+
fi
44+
done
45+
exit 0
46+
fi
47+
48+
if [ -n "$SKILLS_DIR" ]; then
49+
intent validate "$SKILLS_DIR"
50+
else
51+
echo "No skills/ directory found — skipping validation."
52+
fi

0 commit comments

Comments
 (0)