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
6 changes: 6 additions & 0 deletions .changeset/remove-legacy-tool-docs-list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@agentproto/runtime": patch
"@agentproto/skill-pack-agentproto": patch
---

Remove `LEGACY_UNDOCUMENTED_TOOLS` from `@agentproto/runtime/tool-docs` and the "Not yet documented" section of the `ap-tool-index` skill: every daemon tool now has a family doc, and a test requires it.
5 changes: 3 additions & 2 deletions .github/agent-skills/aip-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ Apply these repo-specific rules to any review, fix, or PR you produce.
- Touching a tool's code (schema, description, behavior) means re-reading its
family doc in `packages/runtime/src/tool-docs/`; flag a doc the change made
stale (tests only catch schema drift, not behavior drift).
- Never add a name to `LEGACY_UNDOCUMENTED_TOOLS`. The list only shrinks; a new
tool needs its family doc in the same PR.
- A new tool ships with its family doc in the same PR: the partition test in
`packages/runtime/src/__tests__/tool-docs.test.ts` fails for a tool no family
documents.

## Review tone
- Lead with correctness and type-safety findings; nits last and clearly labeled.
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -796,13 +796,6 @@ jobs:
- name: Run provenance-footer check tests
run: node --test scripts/check-provenance-footer.test.mjs

# LEGACY_UNDOCUMENTED_TOOLS may only shrink: fail when a name is added
# relative to main. Skips while the file does not exist.
- name: Check the legacy undocumented-tools list only shrinks
run: |
node --test scripts/check-tool-docs-legacy.test.mjs
node scripts/check-tool-docs-legacy.mjs --base origin/main

- name: Check scratch docs, AI-attribution trailers, and provenance footer
# Pass PR_TITLE via env, not inline `${{ … }}` interpolation — see the
# changeset-check step above for why (shell injection via backticks).
Expand Down
5 changes: 2 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,8 @@ gate when you genuinely want CI to write it.
**Tool family docs (`packages/runtime/src/tool-docs/`).** Two review rules:
touching a tool's code (its schema, description or behavior) means re-reading
its family doc and fixing it if it went stale (the tests catch a schema drift,
not a behavior change); and never add a name to `LEGACY_UNDOCUMENTED_TOOLS`:
the list only shrinks, a new tool ships with its family doc
(`scripts/check-tool-docs-legacy.mjs` refuses an added line).
not a behavior change); and a new tool ships with its family doc: the
partition test in `tool-docs.test.ts` fails for a tool no family documents.

**Don't stamp `[agentflow-reviewed]`** in a commit message, and don't run
`review:ai --stamp` locally, unless a human explicitly told you to. That
Expand Down
23 changes: 6 additions & 17 deletions packages/runtime/src/__tests__/tool-docs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { fileURLToPath } from "node:url"
import { afterAll, beforeAll, describe, expect, it } from "vitest"
import { DAEMON_TOOL_NAMES } from "../daemon-tool-names.generated.js"
import { bootToolSurface, type ToolSurfaceHandle } from "../tool-surface.js"
import { isDeprecatedDescription, LEGACY_UNDOCUMENTED_TOOLS, missingKeys, TOOL_FAMILY_DOCS } from "../tool-docs/index.js"
import { isDeprecatedDescription, missingKeys, TOOL_FAMILY_DOCS } from "../tool-docs/index.js"
import type { ToolFamilyDoc } from "../tool-docs/types.js"

const here = dirname(fileURLToPath(import.meta.url))
Expand Down Expand Up @@ -52,30 +52,19 @@ function deprecatedFields(args: unknown, schema: unknown, path = ""): string[] {

describe("tool docs: partition", () => {
const documented = TOOL_FAMILY_DOCS.flatMap(d => Object.keys(d.tools))
const legacy = [...LEGACY_UNDOCUMENTED_TOOLS]
const known = new Set<string>(DAEMON_TOOL_NAMES)

it("lists no unknown tool name", () => {
expect([...documented, ...legacy].filter(n => !known.has(n))).toEqual([])
it("documents no unknown tool name", () => {
expect(documented.filter(n => !known.has(n))).toEqual([])
})

it("never documents a tool twice or lists it twice", () => {
it("never documents a tool twice", () => {
expect(documented.filter((n, i) => documented.indexOf(n) !== i)).toEqual([])
expect(legacy.filter((n, i) => legacy.indexOf(n) !== i)).toEqual([])
})

it("puts every daemon tool in exactly one place (doc xor legacy)", () => {
it("documents every daemon tool", () => {
const inDoc = new Set(documented)
const inLegacy = new Set(legacy)
expect(DAEMON_TOOL_NAMES.filter(n => inDoc.has(n) && inLegacy.has(n)), "in both").toEqual([])
expect(DAEMON_TOOL_NAMES.filter(n => !inDoc.has(n) && !inLegacy.has(n)), "in neither").toEqual([])
})

it("keeps the legacy list sorted, one entry per line (the CI guard parses it that way)", () => {
expect(legacy).toEqual([...legacy].sort())
const text = readFileSync(resolve(here, "../tool-docs/legacy.ts"), "utf8")
const lines = text.split("\n").filter(l => /^\s+"[a-z0-9_]+",$/.test(l))
expect(lines.length).toBe(legacy.length)
expect(DAEMON_TOOL_NAMES.filter(n => !inDoc.has(n)), "without a family doc").toEqual([])
})

it("declares distinct, non-empty family ids", () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/runtime/src/tool-docs/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Tool family docs. Pure data, exported as `@agentproto/runtime/tool-docs`.
* A tool is documented here, or listed in `LEGACY_UNDOCUMENTED_TOOLS`, never both.
* Every daemon tool is documented in exactly one family.
*/
import { authProfileToolDoc } from "./auth-profile.js"
import { catalogToolDoc } from "./catalog.js"
Expand Down Expand Up @@ -62,7 +62,6 @@ import { workspaceBrainToolDoc } from "./workspace-brain.js"
import type { ToolFamilyDoc } from "./types.js"
import { worktreeToolDoc } from "./worktree.js"

export { LEGACY_UNDOCUMENTED_TOOLS } from "./legacy.js"
export { isDeprecatedDescription, missingKeys } from "./check-helpers.js"
export { defineToolFamilyDoc } from "./types.js"
export type {
Expand Down
11 changes: 0 additions & 11 deletions packages/runtime/src/tool-docs/legacy.ts

This file was deleted.

5 changes: 2 additions & 3 deletions packages/skill-pack-agentproto/scripts/gen-skills.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async function listMarkdown(dir) {
* Pure staging: returns `{ files: Map<relPath, content>, manifest }`-like data
* written by `generate`. Kept separate from disk reads where possible.
*/
export async function generate({ packageDir, surface, families, legacy, log = () => {} }) {
export async function generate({ packageDir, surface, families, log = () => {} }) {
const srcSkills = join(packageDir, "src", "skills")
const genDir = join(packageDir, "dist", "gen")
const outSkills = join(genDir, "skills")
Expand Down Expand Up @@ -122,7 +122,7 @@ export async function generate({ packageDir, surface, families, legacy, log = ()
// 2. The index skill and its reference pages.
const indexDir = join(outSkills, INDEX)
await mkdir(join(indexDir, "reference"), { recursive: true })
await writeFile(join(indexDir, "SKILL.md"), renderIndexSkill({ families, surface, legacy, claims }))
await writeFile(join(indexDir, "SKILL.md"), renderIndexSkill({ families, claims }))
for (const doc of families) {
await writeFile(join(indexDir, "reference", `${doc.family}.md`), renderReferencePage(doc, surface))
}
Expand Down Expand Up @@ -178,7 +178,6 @@ async function main() {
packageDir,
surface,
families: docs.TOOL_FAMILY_DOCS,
legacy: docs.LEGACY_UNDOCUMENTED_TOOLS,
log: (m) => process.stdout.write(`${m}\n`),
})
}
Expand Down
16 changes: 3 additions & 13 deletions packages/skill-pack-agentproto/scripts/render/index-skill.mjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import { finish, firstSentence } from "./text.mjs"
import { finish } from "./text.mjs"

/**
* The `ap-tool-index` SKILL.md.
* @param {object} input
* @param {Array} input.families family docs
* @param {{tools: Array}} input.surface
* @param {readonly string[]} input.legacy tool names without a doc
* @param {Record<string,string>} [input.claims] family -> dedicated skill name
*/
export function renderIndexSkill({ families, surface, legacy, claims = {} }) {
const byName = new Map(surface.tools.map((t) => [t.name, t]))
export function renderIndexSkill({ families, claims = {} }) {
const lines = [
"---",
"name: ap-tool-index",
"description: Find the right agentproto daemon tool before guessing a name. Index of every documented tool family (desktop chats, sessions, reviews, apps, tunnels, accounts and more) with a reference page per family, plus the tools not yet documented. Open it for any agentproto need not covered by another skill.",
"description: Find the right agentproto daemon tool before guessing a name. Index of every documented tool family (desktop chats, sessions, reviews, apps, tunnels, accounts and more) with a reference page per family. Open it for any agentproto need not covered by another skill.",
"---",
"",
"# Tool index",
Expand All @@ -26,13 +24,5 @@ export function renderIndexSkill({ families, surface, legacy, claims = {} }) {
const tail = skill ? ` Dedicated skill: \`${skill}\`.` : ""
lines.push(`- **${f.family}**: ${f.summary} [reference](reference/${f.family}.md).${tail}`)
}
lines.push("", "## Not yet documented", "")
const names = [...legacy].sort()
if (names.length === 0) lines.push("None.")
for (const n of names) {
const t = byName.get(n)
if (!t) throw new Error(`legacy tool "${n}" is absent from the tool surface`)
lines.push(`- \`${n}\`: ${firstSentence(t.description)}`)
}
return finish(lines)
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ The staging step (`scripts/gen-skills.mjs`) replaces that line with the family
block and writes `dist/gen/`. It also:

- writes the `ap-tool-index` skill with one `reference/<family>.md` page per
family and a "Not yet documented" list for tools without a doc;
family;
- fills the tool count and the skills table of the master card from the markers
`<!-- gen:tool-count -->` and `<!-- gen:skills-table -->`;
- writes the derived `dist/gen/manifest.json`, which
Expand Down
4 changes: 2 additions & 2 deletions packages/skill-pack-agentproto/test/gen-skills.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function skill(name, body, description = `The ${name} skill. Second sentence.`)
}
const read = (...p) => readFileSync(join(dir, "dist", "gen", ...p), "utf8")
const run = () =>
generate({ packageDir: dir, surface, families: [widgetDoc, gadgetDoc], legacy: ["orphan_tool"] })
generate({ packageDir: dir, surface, families: [widgetDoc, gadgetDoc] })

beforeEach(() => {
writeFileSync(join(dir, "manifest.json"), JSON.stringify({ name: "p", description: "d", skills: ["zeta"] }))
Expand All @@ -37,7 +37,7 @@ describe("gen-skills", () => {
expect(zeta).not.toContain("<!--")
expect(claims).toEqual({ widget: "zeta" })
expect(read("skills", "ap-tool-index", "SKILL.md")).toContain("Dedicated skill: `zeta`")
expect(read("skills", "ap-tool-index", "SKILL.md")).toContain("`orphan_tool`")
expect(read("skills", "ap-tool-index", "SKILL.md")).not.toContain("Not yet documented")
expect(existsSync(join(dir, "dist", "gen", "skills", "ap-tool-index", "reference", "gadget.md"))).toBe(true)
expect(read("skills", "agentproto", "SKILL.md")).toContain("| `alpha` | The alpha skill. |")
expect(manifest.skills).toEqual(["zeta", "agentproto", "alpha", "ap-tool-index"])
Expand Down
11 changes: 2 additions & 9 deletions packages/skill-pack-agentproto/test/render.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ describe("ap-tool-index", () => {
const index = renderIndexSkill({
families: [widgetDoc, gadgetDoc],
surface,
legacy: ["orphan_tool"],
claims: { widget: "ap-widget" },
})

Expand All @@ -84,17 +83,11 @@ describe("ap-tool-index", () => {
expect(index).not.toMatch(/gadget\.md\)\. Dedicated/)
})

it("lists undocumented tools with their first description sentence", () => {
expect(index).toContain("## Not yet documented")
expect(index).toContain("- `orphan_tool`: Does something old.")
expect(index).not.toContain("Has no doc yet")
it("ends with a newline and lists no raw tool", () => {
expect(index).not.toContain("Not yet documented")
expect(index).not.toMatch(/- `widget_list`/)
expect(index.endsWith("\n")).toBe(true)
})

it("rejects a legacy name absent from the surface", () => {
expect(() => renderIndexSkill({ families: [], surface, legacy: ["nope"] })).toThrow(/nope/)
})
})

describe("skills table", () => {
Expand Down
98 changes: 0 additions & 98 deletions scripts/check-tool-docs-legacy.mjs

This file was deleted.

Loading
Loading