Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions .agents/skills/igniteui-cli-ai-config-skills-refresh/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: igniteui-cli-ai-config-skills-refresh
description: "Refresh the Ignite UI AI skills bundled in the ai-config project templates (what ig ai-config copies when the project has no Ignite UI package with its own skills/) from the skills/ folders of the igniteui-angular, igniteui-react, igniteui-webcomponents and igniteui-blazor repositories. WHEN TO USE: syncing or checking the bundled ai-config skills; asking how far they lag behind a branch or tag (dry-run). WHEN NOT TO USE: this repository's own maintenance skills under .agents/skills; editing a skill's content (that belongs in the framework repository)."
description: "Refresh the Ignite UI AI skills bundled in the ai-config project templates (what ig ai-config copies when the project has no Ignite UI package with its own skills/) from the skills/ folders of the igniteui-angular, igniteui-react, igniteui-webcomponents and igniteui-blazor repositories. WHEN TO USE: syncing or checking the bundled ai-config skills; asking how far they lag behind the latest release, a branch or a tag (dry-run). WHEN NOT TO USE: this repository's own maintenance skills under .agents/skills; editing a skill's content (that belongs in the framework repository)."
license: MIT
---

Expand All @@ -17,43 +17,48 @@ Mirrors each framework repository's `skills/` folder into the **bundled skills**

In the bundled copy every `SKILL.md` is stored as `SKILL.md.template`, so `gh skill` and other tools that index `SKILL.md` files do not list this repository as a second source of the framework skills. `copyAISkillsToProject` writes it back as `SKILL.md` in the user's project. Both copy tools apply the rename; a file named `SKILL.md` under a bundled `skills/` folder is a mistake, and `spec/templates/*-spec.ts` fail on it.

The release build (`npm run build-pack`, run by `npm-publish.yml`) re-copies the same folders from `master` through `scripts/update-skills.ts`, so the published package always ships `master`'s skills. This workflow keeps the **committed** copies (used by local runs, specs and reviewers) in step with what ships, or pins them to another ref when asked.
Next to each bundled `skills/` folder sits the **source record**, `skills-source.json`: the repository, ref, commit and each skill folder's git tree SHA. `copyAISkillsToProject` writes these into every bundled `SKILL.md` as the `github-*` metadata that `gh skill list` and `gh skill update` track a skill by (`packages/core/util/gh-skill-metadata.ts`). The record must describe exactly the files beside it, so it is only written by the two copy tools, never by hand. Without a record the skills are copied without metadata.

The source is each repository's **latest release**, not `master`: `gh skill update` compares an installed skill with the latest release and would move a copy taken from `master` back to it.

The release build (`npm run build-pack`, run by `npm-publish.yml`) re-copies the same folders from the latest release through `scripts/update-skills.ts`, so the published package ships the skills of the releases current at publish time. This workflow keeps the **committed** copies (used by local runs, specs and reviewers) in step with what ships, or sets them to another ref when asked.

---

## Input

- **Frameworks**: one or more of `angular`, `react`, `webcomponents`, `blazor`, or `all`.
- **Ref** (optional): branch, tag or commit in the source repositories. Default `master`, matching the release build.
- **Ref** (optional): branch, tag or commit in the source repositories. Default: each repository's latest release, matching the release build.
- **Mode**:
- `update` (default): Steps 1-5.
- `dry-run`: Steps 1-2, then the dry-run report. No files change.

If the frameworks are missing, stop and ask. A ref other than `master` is a deliberate choice: repeat it in the report, because the next release build still copies from `master`.
If the frameworks are missing, stop and ask. An explicit ref is a deliberate choice: repeat it in the report, because the next release build still copies from the latest release. With a branch, `gh skill update` reports the skills as outdated whenever the branch differs from the latest release. With a commit SHA the record has no ref and the skills are written without `gh skill` metadata.

---

## Limits

- Your changes are the files under the bundled `skills/` folders in the table, nothing else. The `ai-config` templates' other files (`AGENTS.md`, instruction files, `index.ts`) stay as they are.
- Your changes are the files under the bundled `skills/` folders in the table and the `skills-source.json` beside each, nothing else. The `ai-config` templates' other files (`AGENTS.md`, instruction files, `index.ts`) stay as they are.
- The bundled copy is an exact mirror of the source `skills/` folder, apart from the `SKILL.md.template` file name. Content problems (broken links, bad frontmatter) are reported for the framework repository to fix, not edited here.
- Do not run `scripts/update-skills.ts` or `npm run build:update-skills`: they `git fetch` and `git checkout -B` inside the documentation submodules, which writes to git and moves submodule pointers. Use the script below, which reads from GitHub over HTTPS and runs no git commands.

---

## Script

[`scripts/sync-skills.mjs`](./scripts/sync-skills.mjs) (Node 18+). It makes two `api.github.com` requests per framework (commit and file list), through `gh` when `gh auth status` passes, otherwise directly with `GH_TOKEN` / `GITHUB_TOKEN` if set (without a token GitHub allows 60 requests an hour). File contents come from `raw.githubusercontent.com` and are checked against the tree's hashes. In a cloud agent session, an `ERROR` naming `api.github.com` means the firewall blocks it: report that for every framework and stop.
[`scripts/sync-skills.mjs`](./scripts/sync-skills.mjs) (Node 18+). It makes a few `api.github.com` requests per framework (latest release or ref lookup, commit and file list), through `gh` when `gh auth status` passes, otherwise directly with `GH_TOKEN` / `GITHUB_TOKEN` if set (without a token GitHub allows 60 requests an hour). File contents come from `raw.githubusercontent.com` and are checked against the tree's hashes. In a cloud agent session, an `ERROR` naming `api.github.com` means the firewall blocks it: report that for every framework and stop.

```bash
node .agents/skills/igniteui-cli-ai-config-skills-refresh/scripts/sync-skills.mjs \
[--framework angular,react,webcomponents,blazor] [--ref <branch|tag|sha>] [--apply] [--json]
```

- Resolves the ref to a commit, lists `skills/` through the GitHub tree API and compares each file's git blob hash with the bundled copy (CRLF in the working tree is ignored). Only changed or new files are downloaded.
- Resolves the ref (by default the latest release) to a commit, lists `skills/` through the GitHub tree API and compares each file's git blob hash with the bundled copy (CRLF in the working tree is ignored). Only changed or new files are downloaded.
- Prints `+` added, `~` modified, `-` deleted per framework, with the source commit. These paths are the bundled file names (`SKILL.md.template`); a stray `SKILL.md` in the bundled copy is listed as deleted.
- `!` lines are content issues in the result, with the upstream file name (`SKILL.md`): a `SKILL.md` without frontmatter, `name` or `description`; a `name` that differs from its folder; relative Markdown links that point to a missing file or outside the `skills/` folder (they break once copied into a project).
- Without `--apply` nothing is written. `--apply` writes added and modified files, deletes removed ones and prunes empty folders.
- Prints `skills-source.json=added|modified|unchanged` for the source record.
- Without `--apply` nothing is written. `--apply` writes added and modified files and the source record, deletes removed ones and prunes empty folders.

---

Expand All @@ -71,17 +76,17 @@ In `dry-run` mode, stop here.

### 3. Apply

Run the script again with `--apply` and the same arguments. Then run it once more without `--apply`: every framework in scope should report `added=0 modified=0 deleted=0`.
Run the script again with `--apply` and the same arguments. Then run it once more without `--apply`: every framework in scope should report `added=0 modified=0 deleted=0` and `skills-source.json=unchanged`.

### 4. Validate

1. `npm run build` if it has not run in this checkout. The spec runs compiled code.
2. `npx jasmine spec/unit/ai-config-spec.js`.
2. `npx jasmine spec/unit/ai-skills-spec.js spec/unit/ai-config-spec.js spec/unit/gh-skill-metadata-spec.js`.
3. End to end, per framework in scope, in a new empty temporary directory **outside the repository** (no `package.json`, so the bundled skills are used):
```bash
node <repo>/packages/cli/bin/execute.js ai-config --framework <fw> --agents claude --assistants none
```
It must report `<n> AI skill file(s) created or updated`, with `<n>` equal to the number of files in that framework's bundled `skills/` folder, and `.claude/skills/` must contain them, each skill with a `SKILL.md` and no `.template` file. Delete the temporary directory afterwards.
It must report `<n> AI skill file(s) created or updated`, with `<n>` equal to the number of files in that framework's bundled `skills/` folder, and `.claude/skills/` must contain them, each skill with a `SKILL.md` and no `.template` file. The output names the tracked repository and ref from the source record, and each `SKILL.md` has `github-repo`, `github-path`, `github-ref`, `github-tree-sha` and `managed-by: igniteui-cli` under `metadata:`. Delete the temporary directory afterwards.

The smoke test does not cover `ai-config` (hidden project), so it is not part of this workflow.

Expand Down Expand Up @@ -110,6 +115,6 @@ Items 1-3 above, plus the date. State that nothing was written.
In `dry-run` mode only the first item applies, plus: `git status --short` is unchanged from Step 1.

- [ ] Git was used only as the `AGENTS.md` git rules allow for this session, and `scripts/update-skills.ts` was not run.
- [ ] Only files under the bundled `skills/` folders in scope changed.
- [ ] Only files under the bundled `skills/` folders in scope and their `skills-source.json` changed.
- [ ] A rerun of the script without `--apply` reports no changes for every framework in scope.
- [ ] The spec passed and each framework's `ai-config` run copied every bundled file.
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/usr/bin/env node
// Mirror skills/ from the Ignite UI framework repos into the ai-config project templates.
// Commit and file list from api.github.com (gh CLI if logged in, else fetch with GH_TOKEN/GITHUB_TOKEN if set); file contents from raw.githubusercontent.com.
// Also writes skills-source.json next to each skills/ folder: the repo, ref, commit and each skill folder's git tree SHA,
// which ig ai-config turns into the metadata gh skill tracks the skills by.
// Read-only unless --apply. Never runs git.
// Usage: node sync-skills.mjs [--framework angular,react,webcomponents,blazor] [--ref <branch|tag|sha>] [--apply] [--json]
// Without --ref each repository's latest release is used, which is what gh skill update compares installed skills with.
import { execFile, execSync } from "node:child_process";
import { createHash } from "node:crypto";
import { existsSync, mkdirSync, readdirSync, readFileSync, rmdirSync, statSync, unlinkSync, writeFileSync } from "node:fs";
Expand Down Expand Up @@ -31,7 +34,7 @@ const value = (name, def) => {
return i > -1 && args[i + 1] && !args[i + 1].startsWith("--") ? args[i + 1] : def;
};
const frameworks = value("--framework", Object.keys(SOURCES).join(",")).split(",");
const ref = value("--ref", "master");
const requestedRef = value("--ref");
const apply = args.includes("--apply");
const asJson = args.includes("--json");

Expand All @@ -40,10 +43,12 @@ if (unknown.length) {
console.error(`Unknown framework: ${unknown.join(", ")}. Use ${Object.keys(SOURCES).join(", ")}.`);
process.exit(1);
}
if (!/^[\w.\-/]+$/.test(ref) || ref.startsWith("-")) {
console.error(`Invalid ref '${ref}'.`);
const validRef = (ref) => typeof ref === "string" && /^[\w.\-/]+$/.test(ref) && !ref.startsWith("-");
if (requestedRef !== undefined && !validRef(requestedRef)) {
console.error(`Invalid ref '${requestedRef}'.`);
process.exit(1);
}
const RECORD_FILE = "skills-source.json";

let useGh;
async function gh(path) {
Expand Down Expand Up @@ -134,9 +139,20 @@ const results = [];
for (const fw of frameworks) {
const { repo, dest } = SOURCES[fw];
const destAbs = join(root, dest);
const result = { framework: fw, repo, ref, dest, added: [], modified: [], deleted: [], unchanged: 0, issues: [] };
const result = { framework: fw, repo, ref: requestedRef, dest, added: [], modified: [], deleted: [], unchanged: 0, issues: [] };
results.push(result);
try {
let fullRef;
if (requestedRef === undefined) {
result.ref = (await gh(`repos/${repo}/releases/latest`)).tag_name;
if (!validRef(result.ref)) throw new Error(`latest release has an unusable tag '${result.ref}'`);
fullRef = `refs/tags/${result.ref}`;
} else {
// a commit SHA is neither: the record then has no ref and ig ai-config writes no gh metadata
fullRef = await gh(`repos/${repo}/git/ref/tags/${requestedRef}`).then(() => `refs/tags/${requestedRef}`,
() => gh(`repos/${repo}/git/ref/heads/${requestedRef}`).then(() => `refs/heads/${requestedRef}`, () => null));
}
const ref = result.ref;
result.commit = (await gh(`repos/${repo}/commits/${encodeURIComponent(ref)}`)).sha;
const tree = await gh(`repos/${repo}/git/trees/${result.commit}?recursive=1`);
if (tree.truncated) throw new Error("tree listing truncated by GitHub");
Expand Down Expand Up @@ -173,6 +189,15 @@ for (const fw of frameworks) {
result.modified.sort();
result.issues = validate(files);

const skills = Object.fromEntries(tree.tree
.filter((e) => e.type === "tree" && /^skills\/[^/]+$/.test(e.path))
.map((e) => [e.path.slice("skills/".length), e.sha])
.sort(([a], [b]) => (a < b ? -1 : 1)));
const record = JSON.stringify({ repo: `https://github.com/${repo}`, ref: fullRef, commit: result.commit, skills }, null, 2) + "\n";
const recordAbs = join(root, dirname(dest), RECORD_FILE);
const currentRecord = existsSync(recordAbs) ? readFileSync(recordAbs, "utf8").replaceAll("\r\n", "\n") : null;
result.record = currentRecord === record ? "unchanged" : currentRecord === null ? "added" : "modified";

if (apply) {
for (const path of result.deleted) unlinkSync(join(destAbs, path));
if (existsSync(destAbs)) pruneEmptyDirs(destAbs, true);
Expand All @@ -181,6 +206,7 @@ for (const fw of frameworks) {
mkdirSync(dirname(abs), { recursive: true });
writeFileSync(abs, files[path]);
}
if (result.record !== "unchanged") writeFileSync(recordAbs, record);
result.applied = true;
}
result.added = result.added.map(onDisk);
Expand All @@ -203,10 +229,10 @@ if (asJson) {
list("+", r.added);
list("~", r.modified);
list("-", r.deleted);
console.log(` added=${r.added.length} modified=${r.modified.length} deleted=${r.deleted.length} unchanged=${r.unchanged}${r.applied ? " (applied)" : ""}`);
console.log(` added=${r.added.length} modified=${r.modified.length} deleted=${r.deleted.length} unchanged=${r.unchanged} ${RECORD_FILE}=${r.record}${r.applied ? " (applied)" : ""}`);
r.issues.forEach((i) => console.log(` ! ${i.path}: ${i.issue}`));
}
if (!apply && results.some((r) => r.added.length + r.modified.length + r.deleted.length)) {
if (!apply && results.some((r) => r.added.length + r.modified.length + r.deleted.length || (r.record && r.record !== "unchanged"))) {
console.log("\nDry run: no files written. Rerun with --apply to mirror these changes.");
}
}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
run: npm ci

- name: Build packages
env:
# update-skills looks up each framework repo's latest release through the GitHub API
GITHUB_TOKEN: ${{ github.token }}
run: |
npm run build-pack
node scripts/build-task.js
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## What's Changed
* **chore(templates):** The AI skills bundled with `ig ai-config` are now stored as `SKILL.md.template`, so `gh skill` no longer lists this repository as a second source of the Ignite UI framework skills. `ig ai-config` still writes them as `SKILL.md`.
* **feat(cli):** Skills written by `ig ai-config` are now tracked by `gh skill`: each `SKILL.md` gets the `github-*` metadata that `gh skill list` and `gh skill update` read. Skills from an installed Ignite UI package are tracked and pinned to your installed Ignite UI version (move them by updating the package and running `ig ai-config` again, or with `gh skill update --unpin`); `ig ai-config` always writes the installed package's skills and lists the skill folders it replaced that `gh` had updated. Skills bundled with the CLI are tracked without a pin, so `gh skill update` moves them to the framework's latest release, and `ig ai-config` leaves a skill folder that `gh` updated as it is and lists it. For agent folders that `gh skill` does not scan, `ig ai-config` prints the `--dir` command. `ig new` for React and Web Components copies the skills after the package install, so they come from the installed package.
* **chore(templates):** The AI skills bundled with `ig ai-config` are now taken from each framework repository's latest release instead of `master`, and were refreshed (Angular 22.3.1, React 19.11.0, Web Components 7.5.0, Blazor 1.0.1).

# 16.0.1 (2026-11-24)

Expand Down
Loading