@yawlabs/ctxlint 0.9.11 → 0.9.13
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/dist/index.js +18 -12
- package/package.json +1 -1
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.9.
|
|
7
|
+
entry: npx @yawlabs/ctxlint@0.9.13 --strict
|
|
8
8
|
language: node
|
|
9
9
|
always_run: true
|
|
10
10
|
pass_filenames: false
|
package/dist/index.js
CHANGED
|
@@ -41615,10 +41615,11 @@ async function checkRedundancy(file2, projectRoot) {
|
|
|
41615
41615
|
}
|
|
41616
41616
|
function checkDuplicateContent(files) {
|
|
41617
41617
|
const issues = [];
|
|
41618
|
+
const DUPLICATE_CONTENT_THRESHOLD = 0.6;
|
|
41618
41619
|
for (let i2 = 0; i2 < files.length; i2++) {
|
|
41619
41620
|
for (let j3 = i2 + 1; j3 < files.length; j3++) {
|
|
41620
41621
|
const overlap = calculateLineOverlap(files[i2].content, files[j3].content);
|
|
41621
|
-
if (overlap
|
|
41622
|
+
if (overlap >= DUPLICATE_CONTENT_THRESHOLD) {
|
|
41622
41623
|
issues.push({
|
|
41623
41624
|
severity: "warning",
|
|
41624
41625
|
check: "redundancy",
|
|
@@ -41640,11 +41641,12 @@ function calculateLineOverlap(contentA, contentB) {
|
|
|
41640
41641
|
contentB.split("\n").map((l) => l.trim()).filter((l) => l.length > 10)
|
|
41641
41642
|
);
|
|
41642
41643
|
if (linesA.size === 0 || linesB.size === 0) return 0;
|
|
41643
|
-
let
|
|
41644
|
+
let intersection2 = 0;
|
|
41644
41645
|
for (const line of linesA) {
|
|
41645
|
-
if (linesB.has(line))
|
|
41646
|
+
if (linesB.has(line)) intersection2++;
|
|
41646
41647
|
}
|
|
41647
|
-
|
|
41648
|
+
const unionSize = linesA.size + linesB.size - intersection2;
|
|
41649
|
+
return intersection2 / unionSize;
|
|
41648
41650
|
}
|
|
41649
41651
|
function escapeRegex2(str) {
|
|
41650
41652
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -43058,6 +43060,7 @@ import { createInterface } from "node:readline";
|
|
|
43058
43060
|
import { dirname as dirname2, join as join5, resolve as resolve4 } from "node:path";
|
|
43059
43061
|
import { existsSync } from "node:fs";
|
|
43060
43062
|
function detectProviders() {
|
|
43063
|
+
if (!home) return [];
|
|
43061
43064
|
return AGENT_DIRS.filter((a) => existsSync(a.dir)).map((a) => a.provider);
|
|
43062
43065
|
}
|
|
43063
43066
|
async function parseJsonlFiltered(filePath, filter) {
|
|
@@ -43851,7 +43854,7 @@ import { readFileSync as readFileSync4 } from "node:fs";
|
|
|
43851
43854
|
import { resolve as resolve8, dirname as dirname3 } from "node:path";
|
|
43852
43855
|
import { fileURLToPath } from "node:url";
|
|
43853
43856
|
function loadVersion() {
|
|
43854
|
-
if (true) return "0.9.
|
|
43857
|
+
if (true) return "0.9.13";
|
|
43855
43858
|
const __dir = dirname3(fileURLToPath(import.meta.url));
|
|
43856
43859
|
const pkgPath = resolve8(__dir, "../package.json");
|
|
43857
43860
|
const pkg = JSON.parse(readFileSync4(pkgPath, "utf-8"));
|
|
@@ -44768,7 +44771,7 @@ var init_fixer = __esm({
|
|
|
44768
44771
|
// src/mcp/server.ts
|
|
44769
44772
|
var server_exports = {};
|
|
44770
44773
|
import * as path9 from "node:path";
|
|
44771
|
-
var
|
|
44774
|
+
var contextCheckEnum, mcpCheckEnum, sessionCheckEnum, server, transport;
|
|
44772
44775
|
var init_server3 = __esm({
|
|
44773
44776
|
async "src/mcp/server.ts"() {
|
|
44774
44777
|
"use strict";
|
|
@@ -44785,8 +44788,11 @@ var init_server3 = __esm({
|
|
|
44785
44788
|
init_git();
|
|
44786
44789
|
init_paths();
|
|
44787
44790
|
init_version2();
|
|
44788
|
-
|
|
44789
|
-
|
|
44791
|
+
contextCheckEnum = external_exports3.enum(ALL_CHECKS);
|
|
44792
|
+
mcpCheckEnum = external_exports3.enum(ALL_MCP_CHECKS);
|
|
44793
|
+
sessionCheckEnum = external_exports3.enum(
|
|
44794
|
+
ALL_SESSION_CHECKS
|
|
44795
|
+
);
|
|
44790
44796
|
server = new McpServer({
|
|
44791
44797
|
name: "ctxlint",
|
|
44792
44798
|
version: VERSION
|
|
@@ -44796,7 +44802,7 @@ var init_server3 = __esm({
|
|
|
44796
44802
|
"Audit AI agent context files (CLAUDE.md, AGENTS.md, etc.) in the project. Checks for stale references, invalid commands, redundant content, contradictions, frontmatter issues, and token waste. Use ctxlint_mcp_audit for MCP configs or ctxlint_session_audit for session checks.",
|
|
44797
44803
|
{
|
|
44798
44804
|
projectPath: external_exports3.string().optional().describe("Path to the project root. Defaults to current working directory."),
|
|
44799
|
-
checks: external_exports3.array(
|
|
44805
|
+
checks: external_exports3.array(contextCheckEnum).optional().describe("Which context-file checks to run. Defaults to all.")
|
|
44800
44806
|
},
|
|
44801
44807
|
{
|
|
44802
44808
|
readOnlyHint: true,
|
|
@@ -44920,7 +44926,7 @@ var init_server3 = __esm({
|
|
|
44920
44926
|
"Run the linter with --fix mode to auto-correct broken file paths in context files using git history and fuzzy matching. Returns a summary of what was fixed.",
|
|
44921
44927
|
{
|
|
44922
44928
|
projectPath: external_exports3.string().optional().describe("Path to the project root. Defaults to current working directory."),
|
|
44923
|
-
checks: external_exports3.array(
|
|
44929
|
+
checks: external_exports3.array(contextCheckEnum).optional().describe("Which context-file checks to run before fixing. Defaults to all.")
|
|
44924
44930
|
},
|
|
44925
44931
|
{
|
|
44926
44932
|
// ctxlint_fix writes to disk via applyFixes() → fs.writeFileSync, so it
|
|
@@ -44972,7 +44978,7 @@ var init_server3 = __esm({
|
|
|
44972
44978
|
"Lint MCP server configuration files in a project. Checks for schema errors, hardcoded secrets, deprecated transports, wrong env var syntax, URL issues, and cross-client inconsistencies.",
|
|
44973
44979
|
{
|
|
44974
44980
|
projectPath: external_exports3.string().optional().describe("Path to the project root. Defaults to current working directory."),
|
|
44975
|
-
checks: external_exports3.array(
|
|
44981
|
+
checks: external_exports3.array(mcpCheckEnum).optional().describe("Specific MCP checks to run (default: all mcp-* checks)."),
|
|
44976
44982
|
includeGlobal: external_exports3.boolean().optional().describe("Also scan global/user-level MCP configs.")
|
|
44977
44983
|
},
|
|
44978
44984
|
{
|
|
@@ -45010,7 +45016,7 @@ var init_server3 = __esm({
|
|
|
45010
45016
|
"Audit AI agent session data for cross-project consistency. Checks for missing GitHub secrets, diverged config files, missing workflows, stale memory entries, and duplicate memories across sibling repositories.",
|
|
45011
45017
|
{
|
|
45012
45018
|
projectPath: external_exports3.string().optional().describe("Path to the project root. Defaults to current working directory."),
|
|
45013
|
-
checks: external_exports3.array(
|
|
45019
|
+
checks: external_exports3.array(sessionCheckEnum).optional().describe("Specific session checks to run (default: all session-* checks).")
|
|
45014
45020
|
},
|
|
45015
45021
|
{
|
|
45016
45022
|
readOnlyHint: true,
|