@yawlabs/ctxlint 0.13.3 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pre-commit-hooks.yaml +1 -1
- package/README.md +4 -44
- package/dist/index.js +3200 -3690
- package/package.json +7 -4
- package/schemas/ctxlint-catalog.schema.json +2 -2
- package/mcph-config-lint-rules.json +0 -151
package/.pre-commit-hooks.yaml
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# Version-pinned so a checkout at `rev: vX.Y.Z` runs exactly that release
|
|
5
5
|
# of ctxlint — matches the pinning done by `ctxlint init`. release.sh keeps
|
|
6
6
|
# this in sync with package.json on each bump.
|
|
7
|
-
entry: npx @yawlabs/ctxlint@0.
|
|
7
|
+
entry: npx @yawlabs/ctxlint@0.14.1 --strict
|
|
8
8
|
language: node
|
|
9
9
|
always_run: true
|
|
10
10
|
pass_filenames: false
|
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ ctxlint is a linter purpose-built for this. It reads your context files, cross-r
|
|
|
32
32
|
- **Token-aware** — shows how much context window your files consume and flags redundant content
|
|
33
33
|
- **Every AI tool** — supports Claude Code, Cursor, Copilot, Windsurf, Gemini, Cline, Aider, and 9 more
|
|
34
34
|
- **Multiple outputs** — text, JSON, and SARIF (GitHub Code Scanning)
|
|
35
|
-
- **MCP server** —
|
|
35
|
+
- **MCP server** — 6 tools for IDE/agent integration with tool annotations for auto-approval
|
|
36
36
|
- **Watch mode** — `--watch` re-lints automatically when context files change
|
|
37
37
|
|
|
38
38
|
## Install
|
|
@@ -180,36 +180,6 @@ The full specification for MCP config linting rules, the cross-client config lan
|
|
|
180
180
|
- **[`MCP_CONFIG_LINT_SPEC.md`](./MCP_CONFIG_LINT_SPEC.md)** — the full lint-rule set (rule count in the [Specifications](#specifications) family table), the complete client/format reference, and implementation guidance. Tool-agnostic — any linter can implement it.
|
|
181
181
|
- **[`mcp-config-lint-rules.json`](./mcp-config-lint-rules.json)** — Machine-readable rule catalog for programmatic consumption by AI agents, CI systems, and other tools.
|
|
182
182
|
|
|
183
|
-
## mcph Config Linting
|
|
184
|
-
|
|
185
|
-
ctxlint also lints `.mcph.json` — the config file read by the [`@yawlabs/mcph`](https://github.com/YawLabs/mcph) CLI. Distinct from `.mcp.json` (different schema, different threat model). Applies across the user-global (`~/.mcph.json`), per-project (`.mcph.json`), and machine-local (`.mcph.local.json`) scope cascade.
|
|
186
|
-
|
|
187
|
-
> **Note:** the mcph rule family (and the `ctxlint_mcph_audit` MCP tool) is **under review** — the upstream mcp.hosting platform is archived, so this family's future is being reassessed. The rules and tool still ship and work; only their long-term status is undecided.
|
|
188
|
-
|
|
189
|
-
```bash
|
|
190
|
-
# Lint context files + .mcph.json
|
|
191
|
-
npx @yawlabs/ctxlint@latest --mcph
|
|
192
|
-
|
|
193
|
-
# Lint only .mcph.json
|
|
194
|
-
npx @yawlabs/ctxlint@latest --mcph-only
|
|
195
|
-
|
|
196
|
-
# Include the user-global ~/.mcph.json
|
|
197
|
-
npx @yawlabs/ctxlint@latest --mcph-global
|
|
198
|
-
|
|
199
|
-
# Treat any token in any .mcph.json as an error (env-var-only posture)
|
|
200
|
-
npx @yawlabs/ctxlint@latest --mcph --mcph-strict-env-token
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
### What mcph config checks catch
|
|
204
|
-
|
|
205
|
-
| Check | What it finds |
|
|
206
|
-
| --------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
207
|
-
| **mcph-token-security** | mcp.hosting PAT (`mcp_pat_*`) leaks, malformed tokens, and prefers env-var (`MCPH_TOKEN`) over file-stored tokens |
|
|
208
|
-
| **mcph-apibase** | Invalid `apiBase` URLs and plaintext HTTP to public hosts (private hosts like `localhost` / RFC 1918 are exempt) |
|
|
209
|
-
| **mcph-schema-conformance** | Unknown / typo'd fields and stale `version` numbers vs the current `mcph.config.v1.json` schema |
|
|
210
|
-
| **mcph-lists** | Conflicts (entries in both `servers` allow-list and `blocked` deny-list) and duplicates within either list |
|
|
211
|
-
| **mcph-gitignore** | `.mcph.local.json` not covered by `.gitignore` — machine-local overrides exist precisely to stay machine-local |
|
|
212
|
-
|
|
213
183
|
## Session Linting
|
|
214
184
|
|
|
215
185
|
ctxlint can audit AI agent session data — history files and memory entries — for cross-project consistency. Session checks compare your current project against sibling repos to catch drift and missing setup.
|
|
@@ -297,10 +267,6 @@ Options:
|
|
|
297
267
|
--mcp Enable MCP config linting alongside context file checks
|
|
298
268
|
--mcp-only Run only MCP config checks, skip context file checks
|
|
299
269
|
--mcp-global Also scan user/global MCP config files (implies --mcp)
|
|
300
|
-
--mcph Enable .mcph.json (mcp.hosting CLI config) linting
|
|
301
|
-
--mcph-only Run only mcph config checks
|
|
302
|
-
--mcph-global Also scan ~/.mcph.json (implies --mcph)
|
|
303
|
-
--mcph-strict-env-token Upgrade mcph-token-security/prefer-env-token from warning to error
|
|
304
270
|
--session Enable session audit checks (cross-project consistency)
|
|
305
271
|
--session-only Run only session checks, skip context and MCP checks
|
|
306
272
|
--mcp-server Start the MCP server (alias: `serve` subcommand)
|
|
@@ -312,9 +278,9 @@ Commands:
|
|
|
312
278
|
init Set up a git pre-commit hook
|
|
313
279
|
```
|
|
314
280
|
|
|
315
|
-
**Available checks:** `paths`, `commands`, `staleness`, `tokens`, `tier-tokens`, `redundancy`, `contradictions`, `frontmatter`, `ci-coverage`, `ci-secrets`, `mcp-schema`, `mcp-security`, `mcp-commands`, `mcp-deprecated`, `mcp-env`, `mcp-urls`, `mcp-consistency`, `mcp-redundancy`, `
|
|
281
|
+
**Available checks:** `paths`, `commands`, `staleness`, `tokens`, `tier-tokens`, `redundancy`, `contradictions`, `frontmatter`, `ci-coverage`, `ci-secrets`, `mcp-schema`, `mcp-security`, `mcp-commands`, `mcp-deprecated`, `mcp-env`, `mcp-urls`, `mcp-consistency`, `mcp-redundancy`, `session-missing-secret`, `session-diverged-file`, `session-missing-workflow`, `session-stale-memory`, `session-duplicate-memory`, `session-loop-detection`, `session-memory-index-overflow`
|
|
316
282
|
|
|
317
|
-
Passing any `mcp-*` check name implies `--mcp`. Passing any `
|
|
283
|
+
Passing any `mcp-*` check name implies `--mcp`. Passing any `session-*` check name implies `--session`.
|
|
318
284
|
|
|
319
285
|
## Watch Mode
|
|
320
286
|
|
|
@@ -440,10 +406,6 @@ The `contextFiles` array adds custom file patterns to scan alongside the built-i
|
|
|
440
406
|
| `mcp` | `boolean` | `false` | Enable MCP config checks by default (same as `--mcp`). |
|
|
441
407
|
| `mcpOnly` | `boolean` | `false` | Run only MCP config checks, skip context-file checks (same as `--mcp-only`). |
|
|
442
408
|
| `mcpGlobal` | `boolean` | `false` | Also scan user/global MCP configs (same as `--mcp-global`). |
|
|
443
|
-
| `mcph` | `boolean` | `false` | Enable `.mcph.json` (mcp.hosting CLI config) checks (same as `--mcph`). |
|
|
444
|
-
| `mcphOnly` | `boolean` | `false` | Run only mcph config checks, skip context-file checks (same as `--mcph-only`). |
|
|
445
|
-
| `mcphGlobal` | `boolean` | `false` | Also scan `~/.mcph.json` user-global config (same as `--mcph-global`). |
|
|
446
|
-
| `mcphStrictEnvToken` | `boolean` | `false` | Upgrade `mcph-token-security/prefer-env-token` from warning to error (same as `--mcph-strict-env-token`). |
|
|
447
409
|
| `session` | `boolean` | `false` | Enable session audit checks (cross-project consistency); same as `--session`. |
|
|
448
410
|
| `sessionOnly` | `boolean` | `false` | Run only session checks, skip context and MCP checks (same as `--session-only`). |
|
|
449
411
|
|
|
@@ -453,7 +415,7 @@ CLI flags override config file settings. Use `--config <path>` to load a config
|
|
|
453
415
|
|
|
454
416
|
## Use as MCP Server
|
|
455
417
|
|
|
456
|
-
ctxlint ships with an MCP server that exposes
|
|
418
|
+
ctxlint ships with an MCP server that exposes six tools (`ctxlint_audit`, `ctxlint_mcp_audit`, `ctxlint_session_audit`, `ctxlint_validate_path`, `ctxlint_token_report`, `ctxlint_fix`). All read-only tools declare annotations so MCP clients can skip confirmation dialogs.
|
|
457
419
|
|
|
458
420
|
Launch it with the `serve` subcommand (or the equivalent `--mcp-server` flag, kept for back-compat):
|
|
459
421
|
|
|
@@ -545,7 +507,6 @@ ctxlint is the reference implementation of four open specifications for linting
|
|
|
545
507
|
| -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
546
508
|
| **[AI Context File Linting Spec](./CONTEXT_LINT_SPEC.md)** | 28 rules for validating context files (CLAUDE.md, .cursorrules, AGENTS.md, etc.) across 17 clients. Covers file formats, frontmatter schemas, path/command validation, staleness, token budgets, redundancy, and contradictions. |
|
|
547
509
|
| **[MCP Config Linting Spec](./MCP_CONFIG_LINT_SPEC.md)** | 27 rules for validating MCP server configs (.mcp.json, .cursor/mcp.json, .vscode/mcp.json, etc.) across 8 clients. Covers schema validation, hardcoded secrets, env var syntax, deprecated transports, and cross-file consistency. |
|
|
548
|
-
| **mcph Config Linting** (`mcph-config-lint-rules.json`) | 10 rules for validating `.mcph.json` — the config file read by the `@yawlabs/mcph` CLI. Covers PAT format + leakage, env-var posture, plaintext API endpoints, schema drift, and allow/deny list semantics across the scope cascade. |
|
|
549
510
|
| **[Agent Session Linting Spec](./AGENT_SESSION_LINT_SPEC.md)** | 8 rules for auditing agent session data (history, memory) across 8 agents. Covers cross-project secret consistency, config drift, stale memory, and loop detection. |
|
|
550
511
|
| **[Agent Skill Linting Spec](./AGENT_SKILL_LINT_SPEC.md)** | 5 rules for auditing Claude Code skill (`SKILL.md`) and agent (`.md`) definitions under `~/.claude`. Covers frontmatter presence, broken refs, trigger-phrase collisions, orphaned skills, and dead tool restrictions. (v1, experimental) |
|
|
551
512
|
|
|
@@ -553,7 +514,6 @@ All specs include machine-readable rule catalogs for programmatic consumption:
|
|
|
553
514
|
|
|
554
515
|
- [`context-lint-rules.json`](./context-lint-rules.json) — context file rules and 16 supported format definitions
|
|
555
516
|
- [`mcp-config-lint-rules.json`](./mcp-config-lint-rules.json) — MCP config rules and 8 client definitions
|
|
556
|
-
- [`mcph-config-lint-rules.json`](./mcph-config-lint-rules.json) — mcph CLI config rules (`.mcph.json`)
|
|
557
517
|
- [`agent-session-lint-rules.json`](./agent-session-lint-rules.json) — session lint rules and 8 agent data source definitions
|
|
558
518
|
- [`agent-skill-lint-rules.json`](./agent-skill-lint-rules.json) — agent-skill lint rules (`~/.claude/skills`, `~/.claude/agents`)
|
|
559
519
|
|