Skip to content

Commit 4f06230

Browse files
roli-lpciclaude
andcommitted
Add llms.txt, AGENTS.md, and CLAUDE.md for agent discoverability
llms.txt: llmstxt.org-spec navigation index for external AI tools. AGENTS.md: AAIF-convention agent instructions with commands, code style examples, and Always/Ask/Never boundaries. CLAUDE.md: Lean Claude Code context with architecture and gotchas. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8d4322f commit 4f06230

3 files changed

Lines changed: 188 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# AGENTS.md
2+
3+
## Commands
4+
5+
- `npm install` -- Install dependencies
6+
- `node --test test/*.test.js` -- Run all 44 tests
7+
- `node --test test/gates.test.js` -- Single test file
8+
- `npm run test` -- Same as above via npm script
9+
- `npx quick-gate run` -- Run all quality gates
10+
- `npx quick-gate repair --max-attempts 3` -- Auto-fix lint failures
11+
- `npx quick-gate summarize` -- Generate agent brief
12+
13+
## Testing
14+
15+
- Framework: Node.js built-in test runner (`node:test` + `node:assert`)
16+
- Test location: `test/`, named `*.test.js`
17+
- All tests run offline — subprocess execution is mocked
18+
- No test framework dependency — uses Node 18+ native test runner
19+
- Run single test: `node --test test/gates.test.js`
20+
21+
## Project Structure
22+
23+
```
24+
src/
25+
cli.js # Entry point, argument parsing, subcommand dispatch
26+
run-command.js # `quick-gate run` — orchestrates gate execution
27+
repair-command.js # `quick-gate repair` — bounded auto-fix loop
28+
summarize-command.js # `quick-gate summarize` — agent brief generation
29+
gates.js # Gate implementations (lint, typecheck, test, lighthouse)
30+
schema.js # AJV-based JSON schema validation
31+
model-adapter.js # LLM model adapter for summarize command
32+
config.js # Config loading (quick-gate.config.js / package.json)
33+
constants.js # Exit codes, default policy, escalation codes
34+
exec.js # Child process execution wrapper
35+
env-check.js # Environment detection (CI, tool availability)
36+
fs-utils.js # File operations (artifact writes to .quick-gate/)
37+
deterministic-prefix.js # Deterministic lint fix prefix generation
38+
schemas/
39+
failures.schema.json # JSON schema for gate failure output
40+
agent-brief.schema.json # JSON schema for summarize output
41+
test/ # Tests (node:test)
42+
scripts/ # Benchmark scripts (not published to npm)
43+
```
44+
45+
Gate resolution: reads `package.json` scripts → matches gate name → falls back to defaults (e.g., `npx tsc --noEmit` for typecheck).
46+
47+
## Code Style
48+
49+
- ESM modules (`import`/`export`, `"type": "module"` in package.json)
50+
- Node 18+ only — use `node:` protocol for builtins (`node:fs`, `node:path`, etc.)
51+
- No TypeScript — plain JavaScript with JSDoc comments where helpful
52+
- Two runtime dependencies only: `ajv` + `ajv-formats` (schema validation)
53+
- Version read dynamically from package.json via `createRequire`:
54+
55+
Good:
56+
```js
57+
import { createRequire } from 'node:module';
58+
const require = createRequire(import.meta.url);
59+
const { version } = require('../package.json');
60+
```
61+
62+
Bad:
63+
```js
64+
// No hardcoded versions
65+
const VERSION = '0.2.0';
66+
67+
// No CommonJS
68+
const fs = require('fs');
69+
```
70+
71+
Function and file naming: kebab-case for filenames (`run-command.js`), camelCase for functions (`resolveGateCommand`).
72+
73+
## Git Workflow
74+
75+
- Branch from `main`
76+
- Conventional commits: `feat:`, `fix:`, `test:`, `docs:`, `chore:`
77+
- Run `node --test test/*.test.js` before pushing
78+
- JSON schemas in `schemas/` must stay in sync with validation logic in `schema.js`
79+
80+
## Boundaries
81+
82+
**Always:**
83+
- Run tests after modifying source files
84+
- Use ESM imports with `node:` protocol for builtins
85+
- Maintain Node 18 compatibility
86+
- Keep runtime deps minimal (ajv + ajv-formats only)
87+
- Write artifacts to `.quick-gate/` directory
88+
89+
**Ask first:**
90+
- Adding new runtime dependencies
91+
- Adding new gate types
92+
- Changing escalation codes in `constants.js`
93+
- Modifying the repair loop policy defaults
94+
- Changing artifact output format (breaks downstream consumers)
95+
96+
**Never:**
97+
- Use CommonJS `require()` in source files (except `createRequire` for JSON imports)
98+
- Add TypeScript compilation — this is intentionally plain JS
99+
- Execute real subprocesses in tests
100+
- Commit `.quick-gate/` output directory
101+
- Break JSON schema backward compatibility without a version bump

CLAUDE.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Quick Gate JS
2+
3+
Deterministic quality gate CLI for TypeScript/ESLint projects. Runs lint + typecheck + test gates, produces structured JSON artifacts, supports bounded auto-repair.
4+
5+
## Commands
6+
7+
- `npm install` -- Install
8+
- `node --test test/*.test.js` -- 44 tests, all offline
9+
- `node --test test/gates.test.js` -- Single file
10+
- `npx quick-gate run` -- Run gates
11+
- `npx quick-gate repair` -- Auto-fix loop
12+
- `npx quick-gate summarize` -- Agent brief
13+
14+
## Architecture
15+
16+
Three subcommands: `run` (execute gates) → `repair` (auto-fix loop) → `summarize` (agent brief).
17+
18+
```
19+
src/
20+
cli.js → run-command.js / repair-command.js / summarize-command.js
21+
gates.js # Gate resolution + execution (lint, typecheck, test, lighthouse)
22+
schema.js # AJV validation of output artifacts
23+
model-adapter.js # LLM adapter for summarize
24+
constants.js # Policy defaults: maxAttempts=3, maxPatchLines=150, timeCap=20min
25+
config.js # Loads quick-gate.config.js or package.json [quick-gate] section
26+
```
27+
28+
Gate resolution: reads target project's `package.json` scripts → matches gate name (lint, typecheck, test) → falls back to sensible defaults (`npx tsc --noEmit`, etc.).
29+
30+
All artifacts written to `.quick-gate/` directory.
31+
32+
## Key Constraints
33+
34+
- ESM only (`"type": "module"`) — use `node:` protocol for all builtins
35+
- Node 18+ required
36+
- Two runtime deps: `ajv` + `ajv-formats` (JSON schema validation)
37+
- Plain JavaScript, no TypeScript compilation
38+
- Tests use Node built-in test runner (`node:test`), no framework deps
39+
- `createRequire(import.meta.url)` for JSON imports (package.json version)
40+
41+
## Gotchas
42+
43+
- npm package name is `quick-gate` but repo name is `quick-gate-js`
44+
- `scripts/` directory contains benchmark tools — excluded from npm via `.npmignore`
45+
- Gate command resolution checks `package.json` scripts first, config second, defaults last
46+
- Repair loop has three abort conditions: no improvement (2x), patch budget (150 lines), time cap (20min)
47+
- `.quick-gate/` output dir should be gitignored in target projects

llms.txt

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Quick Gate JS
2+
3+
> Deterministic quality gate CLI for TypeScript and ESLint projects. Runs lint, typecheck, and test gates with structured JSON output. Bounded auto-repair fixes ESLint issues automatically. Produces machine-readable escalation evidence for AI agents. Node 18+, zero config, Apache 2.0.
4+
5+
## Docs
6+
7+
- [README](https://github.com/roli-lpci/quick-gate-js/blob/main/README.md): Install, commands, configuration, CI integration, escalation schema
8+
- [CHANGELOG](https://github.com/roli-lpci/quick-gate-js/blob/main/CHANGELOG.md): Version history
9+
- [CONTRIBUTING](https://github.com/roli-lpci/quick-gate-js/blob/main/CONTRIBUTING.md): Development setup, PR guidelines
10+
11+
## Commands
12+
13+
The CLI has three subcommands:
14+
- `quick-gate run` -- Run quality gates (ESLint + TypeScript + tests), output structured JSON
15+
- `quick-gate repair` -- Auto-fix lint failures with bounded retry loop
16+
- `quick-gate summarize` -- Generate agent-readable brief from gate results
17+
18+
## Core Modules
19+
20+
- [CLI](https://github.com/roli-lpci/quick-gate-js/blob/main/src/cli.js): Argument parsing, subcommand dispatch
21+
- [Run Command](https://github.com/roli-lpci/quick-gate-js/blob/main/src/run-command.js): Orchestrates gate execution
22+
- [Repair Command](https://github.com/roli-lpci/quick-gate-js/blob/main/src/repair-command.js): Bounded auto-fix loop
23+
- [Summarize Command](https://github.com/roli-lpci/quick-gate-js/blob/main/src/summarize-command.js): Agent brief generation
24+
- [Gates](https://github.com/roli-lpci/quick-gate-js/blob/main/src/gates.js): Gate implementations (ESLint, TypeScript, test runner)
25+
- [Schema](https://github.com/roli-lpci/quick-gate-js/blob/main/src/schema.js): AJV-based JSON schema validation
26+
- [Model Adapter](https://github.com/roli-lpci/quick-gate-js/blob/main/src/model-adapter.js): LLM model integration for summarize
27+
28+
## Schemas
29+
30+
- [Failures Schema](https://github.com/roli-lpci/quick-gate-js/blob/main/schemas/failures.schema.json): JSON schema for gate failure output
31+
- [Agent Brief Schema](https://github.com/roli-lpci/quick-gate-js/blob/main/schemas/agent-brief.schema.json): JSON schema for summarize output
32+
33+
## GitHub Action
34+
35+
- [Action Definition](https://github.com/roli-lpci/quick-gate-js/blob/main/.github/actions/quick-gate/action.yml): Composite GitHub Action for CI integration
36+
- [Example Workflow](https://github.com/roli-lpci/quick-gate-js/blob/main/.github/workflows/example-usage.yml): Reference CI workflow
37+
38+
## Optional
39+
40+
- [Security Policy](https://github.com/roli-lpci/quick-gate-js/blob/main/SECURITY.md): Vulnerability reporting

0 commit comments

Comments
 (0)