chore(skill): Own tttk-authoring in the repo

Move the skill to .agents/skills/tttk-authoring and point gen:skill-reference at it. Activate it by symlinking ~/.agents/skills/tttk-authoring to the in-repo copy.

Extend the reference drift guard to cover the skill copy now that it is versioned, and document activation in docs/development.md.
This commit is contained in:
2026-09-12 17:19:38 +08:00
parent 6d94a99b42
commit d8ccaecade
15 changed files with 870 additions and 16 deletions
+2 -2
View File
@@ -337,7 +337,7 @@ Exit code is the contract that makes `check` usable in an agent loop.
11. **Reference generator** — `scripts/generate-reference.ts` renders the
`known.ts` catalog to markdown. Canonical output `docs/reference.md`
(versioned, testable); `--out` can target the skill copy at
`~/.agents/skills/tttk-authoring/reference.md`. Add `npm run
`.agents/skills/tttk-authoring/reference.md`. Add `npm run
gen:reference`.
12. **Drift guard** — a test that greps `customElement("md-*")` call sites
under `src/components` and asserts each appears in `known.ts` (and vice
@@ -363,7 +363,7 @@ Exit code is the contract that makes `check` usable in an agent loop.
- Update `docs/cli.md`: replace the `compile` section with `check`; document
codes, `--json`, exit codes.
- Update `README.md`.
- Update `~/.agents/skills/tttk-authoring/SKILL.md`: the verification step
- Update `.agents/skills/tttk-authoring/SKILL.md`: the verification step
becomes **`npx tttk check ./content`**, and the workflow becomes
write → check → fix. Remove the "compile is a no-op stub" note. Cross-link
the code catalog (`reference.md`) with the diagnostic codes.
+26
View File
@@ -60,6 +60,9 @@ tttk/
│ ├── styles.css # 样式
│ ├── index.html # HTML 模板
│ └── global.d.ts # 类型声明
├── .agents/
│ └── skills/
│ └── tttk-authoring/ # 随项目维护的 agent skill(见下文)
├── bin/
│ └── cli/ # CLI 二进制文件
├── content/ # 示例内容
@@ -71,6 +74,29 @@ tttk/
└── jest.config.js
```
## Agent skills
`tttk-authoring` skill 由本项目维护,源码位于
`.agents/skills/tttk-authoring/`。要让 agent 加载它,把全局 skill 目录
链接到仓库内的副本:
```bash
# Windows(无需管理员权限的目录联接)
cmd //c mklink /J %USERPROFILE%\.agents\skills\tttk-authoring "%CD%\.agents\skills\tttk-authoring"
# macOS / Linux
ln -s "$PWD/.agents/skills/tttk-authoring" ~/.agents/skills/tttk-authoring
```
`reference.md` 由 `known.ts` 生成,不要手改:
```bash
npm run gen:skill-reference
```
其余文件(`SKILL.md`、`yaml-tag.md`、`csv.md`、`layout.md`、`markdown.md`)
为手写内容。
## 技术栈
| 类别 | 技术 |
+13 -8
View File
@@ -10,6 +10,10 @@ skill's `reference.md` is now generated and byte-identical to
`docs/reference.md`, with the extra content moved to `layout.md`, `yaml-tag.md`,
`csv.md`, and `markdown.md`.
The skill is now **owned by the repo** at `.agents/skills/tttk-authoring/` and
activated by symlinking `~/.agents/skills/tttk-authoring` to it (see
`docs/development.md` § Agent skills).
## 1. Goal
Make the `tttk-authoring` skill's `reference.md` a **generated** file — the same
@@ -19,10 +23,10 @@ hand-maintained element list, and no content lost in the swap.
## 2. Current state
The skill (`~/.agents/skills/tttk-authoring/`) has a hand-written
`reference.md` (~465 lines) and `SKILL.md`. The repo now generates
`docs/reference.md` from `src/cli/validate/known.ts` via `npm run
gen:reference`.
The skill (originally `~/.agents/skills/tttk-authoring/`, now
`.agents/skills/tttk-authoring/`) had a hand-written `reference.md` (~465 lines)
and `SKILL.md`. The repo generates `docs/reference.md` from
`src/cli/validate/known.ts` via `npm run gen:reference`.
What the generated doc already covers:
@@ -109,7 +113,7 @@ generator exists to prevent.
`package.json`:
- `gen:reference` — unchanged (writes `docs/reference.md`).
- `gen:skill-reference` — `gen:reference -- --out ~/.agents/skills/tttk-authoring/reference.md`.
- `gen:skill-reference` — `gen:reference -- --out .agents/skills/tttk-authoring/reference.md`.
## 6. New skill file outlines
@@ -156,9 +160,10 @@ generator exists to prevent.
checklist and a manual diff before deleting the old file.
- **`known.ts` bloat.** Keep `details` to one paragraph per element; long-form
material belongs in the companion files.
- **Skill path portability.** `~` expansion in the generator; the skill lives
outside the repo, so the drift guard cannot cover it — document that
`gen:skill-reference` is the refresh command.
- **Skill path portability.** The skill now lives in the repo, so
`gen:skill-reference` writes to a stable path; `~` expansion in `--out`
remains for ad-hoc targets. Activation is a symlink, which is environment
setup rather than repo state — documented in `docs/development.md`.
- **Two references.** `docs/reference.md` and the skill copy are both generated
from `known.ts`; they must be regenerated together. Note this in
`docs/check-plan.md` §9.