Commit Graph

14 Commits

Author SHA1 Message Date
John Lindquist 657e96a294 feat(hooks): add lexical skill index
Add a MiniSearch-backed lexical index for retrieval frontmatter with synonym and contraction expansion so hooks can rank skills from short natural-language queries.

Verified: bun test hooks/lexical-index.test.ts
Verified: ./node_modules/.bin/tsc --noEmit --module NodeNext --moduleResolution NodeNext --target ES2022 --strict --skipLibCheck --types node hooks/src/lexical-index.mts
Swarm-Agent: codex-lexical-index
2026-03-09 19:04:18 -06:00
John Lindquist 525258f2d3 feat: add @vercel/sandbox dep and benchmark-sandbox spike
Add @vercel/sandbox as a dev dependency for sandbox benchmarking.
Include initial spike scripts and regenerated manifests.
2026-03-09 18:58:11 -06:00
John Lindquist ff965cc377 fix(skills): remove styled-jsx, regenerate catalog, add investigation-mode skill, build-from-skills templates; bump to 0.9.10 2026-03-09 11:38:08 -06:00
John Lindquist 86dcaa8600 fix(tests): align fuzz and validate tests with skill-map validate field; bump to 0.5.0 2026-03-07 11:18:54 -07:00
John Lindquist cd5f369dcb Add new skills, typecheck gate, remove arg/ms/serve skills, bump to 0.4.2
- Add 8 new skills: edge-runtime, geist, micro, ncc, satori, streamdown, styled-jsx, swr
- Remove arg, ms, serve skills (standalone utilities, not relevant to shipping apps on Vercel)
- Add typecheck script and wire into `bun run test` and pre-commit hook
- Fix StdioOptions type error in session-start-profiler
- Add hook-env module and posttooluse-shadcn-font-fix hook
- Refactor skill-map-frontmatter, patterns, pretooluse-skill-inject
- Update generated catalog and manifest (42 skills)
- Add .gitignore with .DS_Store
2026-03-06 19:04:25 -07:00
John Lindquist b725f5308e refactor(hooks): switch to tsup, remove compiled/ intermediate dir
- Replace tsc+cp+rm pipeline with tsup (7ms builds, no intermediate dir)
- tsup compiles hooks/src/*.mts directly to hooks/*.mjs
- tsconfig.json retained for type-checking only (noEmit)
- Remove all .sh references from tests, docs, and hooks.json
- Fix glob pattern test to handle tsup's output format
2026-03-06 13:08:58 -07:00
John Lindquist 5a0591c292 feat(hooks): convert hooks to TypeScript with SDK type-checking
Hook source now lives in hooks/src/*.mts and compiles to hooks/*.mjs via tsc.
The formatOutput() return type is checked against SyncHookJSONOutput from
@anthropic-ai/claude-agent-sdk, preventing unknown fields in hookSpecificOutput
that Claude Code's strict Zod validation would silently reject.

Root cause: skillInjection metadata was a sibling key in hookSpecificOutput,
which Claude Code rejected as "Hook JSON output validation failed: Invalid input".
All skill injections were silently discarded. Now skillInjection metadata is
embedded as an HTML comment inside additionalContext.

- Add hooks/src/*.mts (TypeScript source for all 6 hook modules)
- Add hooks/tsconfig.json (strict, NodeNext, compiles .mts → .mjs)
- Add build:hooks script and pre-commit hook for auto-compilation
- Install @anthropic-ai/claude-agent-sdk as devDependency for types
- Bump plugin version to 0.4.0
2026-03-06 12:48:39 -07:00
John Lindquist b6dc63c269 Bump plugin.json version from 0.1.0 to 0.2.0 and remove the version field from package.json since it is a private package and the canonical version lives in .plugin/plugin.json. 2026-03-06 08:09:58 -07:00
John Lindquist c323ddea37 Add version field "0.1.0" to package.json to establish initial semver versioning for the vercel-plugin package. 2026-03-06 08:08:52 -07:00
John Lindquist 242d69f686 Extract the match/rank engine from pretooluse-skill-inject.mjs into patterns.mjs so it can be shared between the PreToolUse hook and a new CLI explain command. Add compileSkillPatterns() and rankMatches() to patterns.mjs. Refactor pretooluse-skill-inject.mjs to import and use the shared engine instead of inline matching logic.
Create hooks/vercel-config.mjs that reads vercel.json and maps top-level keys (rewrites, redirects, headers, crons, functions) to skill slugs, so skills are injected when the project uses those Vercel features.

Create hooks/logger.mjs with structured logging at four levels (off, summary, debug, trace) controlled by VERCEL_PLUGIN_LOG_LEVEL env var. Support legacy VERCEL_PLUGIN_DEBUG=1 mapping to debug level.

Create src/cli/explain.ts that takes a tool name and input JSON, runs the match engine, and prints which skills would fire and why. Create src/cli/index.ts as the CLI entry point. Create src/commands/doctor.ts for diagnosing plugin setup issues.

Create src/shared/logger.ts and src/shared/match-engine.ts as TypeScript versions of the shared utilities.

Create scripts/build-manifest.ts that reads all SKILL.md files, parses frontmatter, and generates generated/skill-manifest.json.

Add CLAUDE.md documenting the architecture, dedup contract, YAML parser quirks, test conventions, and log levels.

Add tests: tests/cli-explain.test.ts, tests/logger.test.ts, tests/vercel-config.test.ts, tests/snapshot-runner.test.ts with snapshot files in tests/snapshots/. Add test fixtures in tests/fixtures/. Update existing tests to copy new hook modules (logger.mjs, vercel-config.mjs) into temp dirs.

Update package.json with new bin entry and dependencies.
2026-03-06 06:01:17 -07:00
John Lindquist 8781dbf6a7 chore(package): remove js-yaml runtime dependency
The plugin should not require a bundled node_modules runtime dependency for YAML parsing.
Removing the only dependency entry avoids shipping a dead dependency declaration.

Verified: node -e "const fs=require('fs'); JSON.parse(fs.readFileSync('package.json','utf8')); console.log('package.json parse ok')"
How to test: node -e "JSON.parse(require('fs').readFileSync('package.json','utf8'))"
Swarm-Agent: remove-js-yaml-package-dependency
2026-03-05 21:25:55 -07:00
John Lindquist 138090762e Migrate skill triggers from skill-map.json to SKILL.md frontmatter
Replace centralized skill-map.json with frontmatter-based triggers in
each SKILL.md. Add hooks/skill-map-frontmatter.mjs to parse triggers
at runtime. Update validation, tests, and hook logic accordingly.
2026-03-05 15:35:05 -07:00
John Lindquist 7316796d68 test(validation): add test harness, coverage baseline, and orphan detection
Add bun test suite with validate.test.ts, coverage-baseline.ts for
llms.txt gap analysis, orphan-skill detection in validate.ts, structured
JSON output with --format json, and per-check timing metrics.
2026-03-03 20:18:21 -07:00
John Lindquist 2a56636bbe Initial commit: vercel-plugin project setup 2026-03-03 15:13:06 -07:00