Agent guide: complete plugin coverage, full ipal-setup, pointer block
- New skill ipal-reference: every ipalKit option (incl. nested keys) with default and how to turn it off/override it, what the plugin injects (collections, globals, endpoints, import-map components), every file the project wires with a minimal example and a check, every env var; resources/api.md indexes all 432 exports with import path and purpose - ipal-setup rewritten as a complete start-to-finish install: steps, code, verification and off/override per stage - ipal-skills writes a marked <!-- ipal-kit:start/end --> pointer block into AGENTS.md (creates it if missing) and CLAUDE.md (or creates CLAUDE.md with @AGENTS.md); only the marked block is ever rewritten; --no-pointer skips. tsconfig exclude check now matches whole entries - AGENT.md, PROGRAMISTA, README, docs index: point at ipal-reference and run `pnpm exec ipal-skills` right after install - docsConsistency: the agent guide must mention every export (runtime and types), every plugin option incl. nested keys, every env var the code reads and every @/lib/content helper Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d39bbd01a8
commit
465c5706f8
@@ -180,6 +180,69 @@ describe('docs ↔ code', () => {
|
||||
})
|
||||
})
|
||||
|
||||
/**
|
||||
* The agent guide (AGENT.md + the ipal-* skills copied into projects) is all an agent in a
|
||||
* consumer project reads. Every export, option and env var must be findable there, or the
|
||||
* agent re-implements what the plugin already does.
|
||||
*/
|
||||
describe('agent guide covers the whole plugin', () => {
|
||||
const guide = [read('docs/agent/AGENT.md'), ...walk('docs/agent/skills').map(read)].join('\n')
|
||||
const missingFrom = (names: Iterable<string>) => [...new Set(names)].filter((n) => !new RegExp(`\\b${n}\\b`).test(guide)).sort()
|
||||
|
||||
test('every export of every entry (runtime and types)', () => {
|
||||
const missing = Object.entries(exported).flatMap(([sub, { runtime, types }]) =>
|
||||
missingFrom([...runtime, ...types]).map((name) => `${name} (@intecion/ipal-kit${sub})`),
|
||||
)
|
||||
expect(missing).toEqual([])
|
||||
})
|
||||
|
||||
test('every plugin option, including nested option keys', () => {
|
||||
const typeKeys = (file: string, name: string) => {
|
||||
const src = read(file)
|
||||
const start = src.indexOf(`export type ${name} = {`)
|
||||
expect(start, `${name} in ${file}`).toBeGreaterThanOrEqual(0)
|
||||
const body = src.slice(start, src.indexOf('\n}', start))
|
||||
return [...body.matchAll(/^\s+(\w+)\??:/gm)].map((m) => m[1])
|
||||
}
|
||||
const keys = [
|
||||
...typeKeys('src/types.ts', 'IpalOptions'),
|
||||
...typeKeys('src/modules/access/types.ts', 'AccessOption'),
|
||||
...typeKeys('src/modules/content/types.ts', 'ContentCollectionOption'),
|
||||
...typeKeys('src/modules/content/types.ts', 'ContentOption'),
|
||||
...typeKeys('src/modules/forms/types.ts', 'FormsOption'),
|
||||
...typeKeys('src/modules/i18n/types.ts', 'I18nConfig'),
|
||||
...typeKeys('src/modules/i18n/types.ts', 'LocaleDefinition'),
|
||||
...typeKeys('src/modules/pages/types.ts', 'PagesOption'),
|
||||
...typeKeys('src/modules/seo/types.ts', 'SeoOption'),
|
||||
...typeKeys('src/modules/stats/collection.ts', 'StatsOptions'),
|
||||
]
|
||||
expect(keys.length).toBeGreaterThan(50)
|
||||
expect(missingFrom(keys)).toEqual([])
|
||||
})
|
||||
|
||||
test('every env var the code reads', () => {
|
||||
const code = srcFiles().map(read).join('\n')
|
||||
const env = [
|
||||
...[...code.matchAll(/process\.env\.([A-Z][\dA-Z_]+)/g)].map((m) => m[1]),
|
||||
// names held in constants, e.g. TURNSTILE_SECRET_ENV = 'TURNSTILE_SECRET_KEY'
|
||||
...[...code.matchAll(/_ENV\s*=\s*'([A-Z][\dA-Z_]+)'/g)].map((m) => m[1]),
|
||||
]
|
||||
expect(env.length).toBeGreaterThan(10)
|
||||
expect(missingFrom(env)).toEqual([])
|
||||
})
|
||||
|
||||
test('every @/lib/content helper', () => {
|
||||
expect(missingFrom(contentHelperNames())).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
function walk(dir: string): string[] {
|
||||
return readdirSync(path.join(root, dir)).flatMap((name) => {
|
||||
const rel = path.join(dir, name)
|
||||
return statSync(path.join(root, rel)).isDirectory() ? walk(rel) : [rel]
|
||||
})
|
||||
}
|
||||
|
||||
function srcFiles(dir = 'src'): string[] {
|
||||
return readdirSync(path.join(root, dir)).flatMap((name) => {
|
||||
const rel = path.join(dir, name)
|
||||
|
||||
Reference in New Issue
Block a user