@lousy-agents/mcp 5.23.10 → 5.23.11
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/dist/mcp-server.js +633 -130
- package/package.json +1 -1
package/dist/mcp-server.js
CHANGED
|
@@ -6559,7 +6559,7 @@ function escapeJsonPtr(str) {
|
|
|
6559
6559
|
|
|
6560
6560
|
|
|
6561
6561
|
},
|
|
6562
|
-
|
|
6562
|
+
7698(__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
|
|
6563
6563
|
// NAMESPACE OBJECT: ../../node_modules/micromark/lib/constructs.js
|
|
6564
6564
|
var constructs_namespaceObject = {};
|
|
6565
6565
|
__webpack_require__.r(constructs_namespaceObject);
|
|
@@ -55325,7 +55325,7 @@ const BYTES_PER_MIB = 1_048_576;
|
|
|
55325
55325
|
* Lint rule registry entity.
|
|
55326
55326
|
* Defines all known lint rule IDs with their default severities, organized by target.
|
|
55327
55327
|
*/ /** Valid severity values for rule configuration */ /** Reported when an instruction file could not be read or parsed. */ const INSTRUCTION_PARSE_ERROR_RULE_ID = "instruction/parse-error";
|
|
55328
|
-
/** Reported when instruction discovery stopped at one of its limits. */ const
|
|
55328
|
+
/** Reported when instruction discovery stopped at one of its limits. */ const lint_rules_DISCOVERY_LIMIT_REACHED_RULE_ID = "instruction/discovery-limit-reached";
|
|
55329
55329
|
/** Reported when instruction discovery skipped symbolic links that lead outside the repository. */ const DISCOVERY_SYMLINK_SKIPPED_RULE_ID = "instruction/discovery-symlink-skipped";
|
|
55330
55330
|
/** Default severity levels for all known lint rules */ const DEFAULT_LINT_RULES = (/* unused pure expression or super */ null && ({
|
|
55331
55331
|
agents: {
|
|
@@ -55378,7 +55378,7 @@ const BYTES_PER_MIB = 1_048_576;
|
|
|
55378
55378
|
"instruction/import-cycle": "warn",
|
|
55379
55379
|
"instruction/import-depth-exceeded": "warn",
|
|
55380
55380
|
"instruction/import-size-exceeded": "warn",
|
|
55381
|
-
[
|
|
55381
|
+
[lint_rules_DISCOVERY_LIMIT_REACHED_RULE_ID]: "warn",
|
|
55382
55382
|
[DISCOVERY_SYMLINK_SKIPPED_RULE_ID]: "warn"
|
|
55383
55383
|
},
|
|
55384
55384
|
skills: {
|
|
@@ -55394,7 +55394,7 @@ const BYTES_PER_MIB = 1_048_576;
|
|
|
55394
55394
|
}
|
|
55395
55395
|
}));
|
|
55396
55396
|
const RUN_LEVEL_RULE_IDS = new Set([
|
|
55397
|
-
|
|
55397
|
+
lint_rules_DISCOVERY_LIMIT_REACHED_RULE_ID,
|
|
55398
55398
|
DISCOVERY_SYMLINK_SKIPPED_RULE_ID
|
|
55399
55399
|
]);
|
|
55400
55400
|
/**
|
|
@@ -55407,41 +55407,6 @@ const RUN_LEVEL_RULE_IDS = new Set([
|
|
|
55407
55407
|
return ruleId !== undefined && RUN_LEVEL_RULE_IDS.has(ruleId);
|
|
55408
55408
|
}
|
|
55409
55409
|
|
|
55410
|
-
;// CONCATENATED MODULE: ../core/src/entities/discovery-limit-message.ts
|
|
55411
|
-
/**
|
|
55412
|
-
* The one wording for a directory walk that stopped at a limit, shared by lint
|
|
55413
|
-
* (instruction/discovery-limit-reached) and doctor (discovery-limit-reached)
|
|
55414
|
-
* so the two cannot describe the same limits differently. Each caller says
|
|
55415
|
-
* what it was looking for and what the user should take from the gap.
|
|
55416
|
-
*/ /** The limits a walk reached; a limit it did not reach is left out. */ /** One sentence for each limit that was reached: directories, depth, entries. */ function describeDiscoveryLimits(reached, { subject, missing, consequence }) {
|
|
55417
|
-
const sentences = [];
|
|
55418
|
-
if (reached.maxDirectories !== undefined) {
|
|
55419
|
-
sentences.push(`${subject} stopped after listing ${reached.maxDirectories} directories, so ${missing} in the remaining directories ${consequence}.`);
|
|
55420
|
-
}
|
|
55421
|
-
if (reached.maxDepth !== undefined) {
|
|
55422
|
-
sentences.push(`${subject} did not go more than ${reached.maxDepth} directories deep, so ${missing} in deeper directories ${consequence}.`);
|
|
55423
|
-
}
|
|
55424
|
-
if (reached.maxEntries !== undefined) {
|
|
55425
|
-
sentences.push(`${subject} stopped after examining ${reached.maxEntries} directory entries, so ${missing} in the remaining entries ${consequence}.`);
|
|
55426
|
-
}
|
|
55427
|
-
return sentences;
|
|
55428
|
-
}
|
|
55429
|
-
/** How many paths a message names before it counts the rest. */ const NAMED_PATHS = 5;
|
|
55430
|
-
/**
|
|
55431
|
-
* The first few paths joined with commas, and a count of the rest, so a
|
|
55432
|
-
* message about a fan-out stays readable: "a, b, c, d, e, and 3 more".
|
|
55433
|
-
*/ function listPaths(paths) {
|
|
55434
|
-
const listed = paths.slice(0, NAMED_PATHS).join(", ");
|
|
55435
|
-
const unlisted = paths.length - NAMED_PATHS;
|
|
55436
|
-
return unlisted > 0 ? `${listed}, and ${unlisted} more` : listed;
|
|
55437
|
-
}
|
|
55438
|
-
/**
|
|
55439
|
-
* The message for instruction file discovery skipping symbolic links that
|
|
55440
|
-
* point outside the repository, so their targets were not analyzed.
|
|
55441
|
-
*/ function describeSkippedSymlinks(paths) {
|
|
55442
|
-
return `Instruction file discovery skipped ${paths.length} symbolic link(s) that point outside the repository, so their targets were not analyzed: ${listPaths(paths)}. Replace a link with a file inside the repository to have it analyzed.`;
|
|
55443
|
-
}
|
|
55444
|
-
|
|
55445
55410
|
;// CONCATENATED MODULE: ../core/src/entities/agentic-location-catalog.ts
|
|
55446
55411
|
/**
|
|
55447
55412
|
* Canonical catalog of agentic construct locations shared by lint and doctor.
|
|
@@ -55685,6 +55650,41 @@ function agentic_location_catalog_isNestedInstructionFilename(fileName) {
|
|
|
55685
55650
|
return NESTED_INSTRUCTION_FILENAMES.has(fileName);
|
|
55686
55651
|
}
|
|
55687
55652
|
|
|
55653
|
+
;// CONCATENATED MODULE: ../core/src/entities/discovery-limit-message.ts
|
|
55654
|
+
/**
|
|
55655
|
+
* The one wording for a directory walk that stopped at a limit, shared by lint
|
|
55656
|
+
* (instruction/discovery-limit-reached) and doctor (discovery-limit-reached)
|
|
55657
|
+
* so the two cannot describe the same limits differently. Each caller says
|
|
55658
|
+
* what it was looking for and what the user should take from the gap.
|
|
55659
|
+
*/ /** The limits a walk reached; a limit it did not reach is left out. */ /** One sentence for each limit that was reached: directories, depth, entries. */ function discovery_limit_message_describeDiscoveryLimits(reached, { subject, missing, consequence }) {
|
|
55660
|
+
const sentences = [];
|
|
55661
|
+
if (reached.maxDirectories !== undefined) {
|
|
55662
|
+
sentences.push(`${subject} stopped after listing ${reached.maxDirectories} directories, so ${missing} in the remaining directories ${consequence}.`);
|
|
55663
|
+
}
|
|
55664
|
+
if (reached.maxDepth !== undefined) {
|
|
55665
|
+
sentences.push(`${subject} did not go more than ${reached.maxDepth} directories deep, so ${missing} in deeper directories ${consequence}.`);
|
|
55666
|
+
}
|
|
55667
|
+
if (reached.maxEntries !== undefined) {
|
|
55668
|
+
sentences.push(`${subject} stopped after examining ${reached.maxEntries} directory entries, so ${missing} in the remaining entries ${consequence}.`);
|
|
55669
|
+
}
|
|
55670
|
+
return sentences;
|
|
55671
|
+
}
|
|
55672
|
+
/** How many paths a message names before it counts the rest. */ const NAMED_PATHS = 5;
|
|
55673
|
+
/**
|
|
55674
|
+
* The first few paths joined with commas, and a count of the rest, so a
|
|
55675
|
+
* message about a fan-out stays readable: "a, b, c, d, e, and 3 more".
|
|
55676
|
+
*/ function listPaths(paths) {
|
|
55677
|
+
const listed = paths.slice(0, NAMED_PATHS).join(", ");
|
|
55678
|
+
const unlisted = paths.length - NAMED_PATHS;
|
|
55679
|
+
return unlisted > 0 ? `${listed}, and ${unlisted} more` : listed;
|
|
55680
|
+
}
|
|
55681
|
+
/**
|
|
55682
|
+
* The message for instruction file discovery skipping symbolic links that
|
|
55683
|
+
* point outside the repository, so their targets were not analyzed.
|
|
55684
|
+
*/ function describeSkippedSymlinks(paths) {
|
|
55685
|
+
return `Instruction file discovery skipped ${paths.length} symbolic link(s) that point outside the repository, so their targets were not analyzed: ${listPaths(paths)}. Replace a link with a file inside the repository to have it analyzed.`;
|
|
55686
|
+
}
|
|
55687
|
+
|
|
55688
55688
|
;// CONCATENATED MODULE: ../core/src/lib/agentic-location-matchers.ts
|
|
55689
55689
|
/**
|
|
55690
55690
|
* Pure path→construct matching helpers over the agentic location catalog.
|
|
@@ -55727,7 +55727,7 @@ function matchesLocationEntry(path, entry) {
|
|
|
55727
55727
|
}
|
|
55728
55728
|
return normalized === entry.path || normalized.startsWith(`${entry.path}/`) && (entry.fileSuffix === undefined || normalized.endsWith(entry.fileSuffix));
|
|
55729
55729
|
}
|
|
55730
|
-
function entriesMatchingPath(path, catalog =
|
|
55730
|
+
function entriesMatchingPath(path, catalog = agentic_location_catalog_AGENTIC_LOCATION_CATALOG) {
|
|
55731
55731
|
return catalog.filter((entry)=>matchesLocationEntry(path, entry));
|
|
55732
55732
|
}
|
|
55733
55733
|
/**
|
|
@@ -55750,7 +55750,7 @@ function specificityScore(entry) {
|
|
|
55750
55750
|
const kindBonus = entry.matchKind === "exact" ? 1_000_000 : 0;
|
|
55751
55751
|
return kindBonus + entry.path.length;
|
|
55752
55752
|
}
|
|
55753
|
-
function bestMatchingEntry(path, catalog =
|
|
55753
|
+
function bestMatchingEntry(path, catalog = agentic_location_catalog_AGENTIC_LOCATION_CATALOG) {
|
|
55754
55754
|
const matches = entriesMatchingPath(path, catalog);
|
|
55755
55755
|
if (matches.length === 0) {
|
|
55756
55756
|
return null;
|
|
@@ -55786,16 +55786,16 @@ function constructTypesForPath(path, catalog = AGENTIC_LOCATION_CATALOG) {
|
|
|
55786
55786
|
...secondary
|
|
55787
55787
|
];
|
|
55788
55788
|
}
|
|
55789
|
-
function lintTargetEntries(target, catalog =
|
|
55789
|
+
function lintTargetEntries(target, catalog = AGENTIC_LOCATION_CATALOG) {
|
|
55790
55790
|
return catalog.filter((entry)=>entry.lintTarget === target);
|
|
55791
55791
|
}
|
|
55792
|
-
function
|
|
55792
|
+
function agentic_location_matchers_skillDirectoryRoots(catalog = AGENTIC_LOCATION_CATALOG) {
|
|
55793
55793
|
return lintTargetEntries("skills", catalog).filter((entry)=>entry.matchKind === "directory-prefix").map((entry)=>entry.path);
|
|
55794
55794
|
}
|
|
55795
|
-
function
|
|
55795
|
+
function agentic_location_matchers_agentDirectoryRoots(catalog = AGENTIC_LOCATION_CATALOG) {
|
|
55796
55796
|
return lintTargetEntries("agents", catalog).filter((entry)=>entry.matchKind === "directory-prefix").map((entry)=>entry.path);
|
|
55797
55797
|
}
|
|
55798
|
-
function
|
|
55798
|
+
function agentic_location_matchers_subagentDirectoryRoots(catalog = AGENTIC_LOCATION_CATALOG) {
|
|
55799
55799
|
return lintTargetEntries("subagents", catalog).filter((entry)=>entry.matchKind === "directory-prefix").map((entry)=>entry.path);
|
|
55800
55800
|
}
|
|
55801
55801
|
function isHookConfigEntry(entry) {
|
|
@@ -55810,6 +55810,86 @@ function hookConfigPaths(catalog = AGENTIC_LOCATION_CATALOG) {
|
|
|
55810
55810
|
function instructionDiscoveryEntries(catalog = agentic_location_catalog_AGENTIC_LOCATION_CATALOG) {
|
|
55811
55811
|
return catalog.filter((entry)=>entry.instructionFormat != null);
|
|
55812
55812
|
}
|
|
55813
|
+
/**
|
|
55814
|
+
* Format for a `CLAUDE.md`, `AGENTS.md`, `AGENTS.MD`, or `agents.md` that the
|
|
55815
|
+
* catalog's exact paths and suffix walks do not already load.
|
|
55816
|
+
*
|
|
55817
|
+
* A directory that loads every markdown file keeps the file (`null` here).
|
|
55818
|
+
* A suffix-restricted directory such as `.github/instructions` does not load
|
|
55819
|
+
* these names, so they stay Claude or shared instructions.
|
|
55820
|
+
*/ function formatForAdditionalInstructionFile(path, catalog = agentic_location_catalog_AGENTIC_LOCATION_CATALOG) {
|
|
55821
|
+
const normalized = normalizeRepoRelativePath(path);
|
|
55822
|
+
if (normalized === "") {
|
|
55823
|
+
return null;
|
|
55824
|
+
}
|
|
55825
|
+
const slash = normalized.lastIndexOf("/");
|
|
55826
|
+
const fileName = slash === -1 ? normalized : normalized.slice(slash + 1);
|
|
55827
|
+
if (!agentic_location_catalog_isNestedInstructionFilename(fileName)) {
|
|
55828
|
+
return null;
|
|
55829
|
+
}
|
|
55830
|
+
const best = bestMatchingEntry(normalized, catalog);
|
|
55831
|
+
if (best?.matchKind === "exact") {
|
|
55832
|
+
return null;
|
|
55833
|
+
}
|
|
55834
|
+
if (best?.matchKind === "directory-prefix" && best.fileSuffix === undefined) {
|
|
55835
|
+
return null;
|
|
55836
|
+
}
|
|
55837
|
+
return fileName === "CLAUDE.md" ? "claude-md" : "agents-md";
|
|
55838
|
+
}
|
|
55839
|
+
|
|
55840
|
+
;// CONCATENATED MODULE: ../core/src/entities/code-unit-order.ts
|
|
55841
|
+
/**
|
|
55842
|
+
* Orders strings by UTF-16 code unit.
|
|
55843
|
+
*
|
|
55844
|
+
* Unlike `localeCompare`, the result does not depend on the machine's locale
|
|
55845
|
+
* or ICU data, so anything sorted with it (directory entries, inventory
|
|
55846
|
+
* paths) comes out in the same order on every machine and in CI.
|
|
55847
|
+
*/ function compareCodeUnits(a, b) {
|
|
55848
|
+
if (a < b) {
|
|
55849
|
+
return -1;
|
|
55850
|
+
}
|
|
55851
|
+
return a > b ? 1 : 0;
|
|
55852
|
+
}
|
|
55853
|
+
|
|
55854
|
+
;// CONCATENATED MODULE: ../core/src/lib/agentic-discovery-skips.ts
|
|
55855
|
+
/**
|
|
55856
|
+
* Directories lint and doctor both leave out of discovery.
|
|
55857
|
+
* Pure path rules. No filesystem I/O.
|
|
55858
|
+
*/ const BUILD_OUTPUT_DIRECTORY_NAMES = [
|
|
55859
|
+
"dist"
|
|
55860
|
+
];
|
|
55861
|
+
const NAMED_SKIP_DIRECTORIES = new Set([
|
|
55862
|
+
"node_modules",
|
|
55863
|
+
".git",
|
|
55864
|
+
...BUILD_OUTPUT_DIRECTORY_NAMES
|
|
55865
|
+
]);
|
|
55866
|
+
/**
|
|
55867
|
+
* True when `relativePath` is a fixture directory met below the scan root.
|
|
55868
|
+
* The root itself is not passed here. When the relative path has no parent
|
|
55869
|
+
* segment, `rootDirectoryName` is that parent, so a scan started in a
|
|
55870
|
+
* directory named `tests` still skips its `fixtures` child.
|
|
55871
|
+
*
|
|
55872
|
+
* `tests/fixtures` is the parent and child, not every directory named
|
|
55873
|
+
* `fixtures`, so `src/fixtures` stays in the scan. `__fixtures__` and
|
|
55874
|
+
* `testdata` are names at any depth.
|
|
55875
|
+
*/ function isFixtureDirectory(relativePath, rootDirectoryName) {
|
|
55876
|
+
const segments = relativePath.split("/");
|
|
55877
|
+
const name = segments[segments.length - 1] ?? "";
|
|
55878
|
+
if (name === "__fixtures__" || name === "testdata") {
|
|
55879
|
+
return true;
|
|
55880
|
+
}
|
|
55881
|
+
const parent = segments.length >= 2 ? segments[segments.length - 2] : rootDirectoryName;
|
|
55882
|
+
return parent === "tests" && name === "fixtures";
|
|
55883
|
+
}
|
|
55884
|
+
/**
|
|
55885
|
+
* True when a discovered directory should not be entered. Callers that use
|
|
55886
|
+
* `walkRepository` pass `isFixtureDirectory` as `skipDirectory` and add
|
|
55887
|
+
* `BUILD_OUTPUT_DIRECTORY_NAMES` to `skipDirectoryNames` instead.
|
|
55888
|
+
*/ function isSkippedDiscoveryDirectory(relativePath, rootDirectoryName) {
|
|
55889
|
+
const segments = relativePath.split("/");
|
|
55890
|
+
const name = segments[segments.length - 1] ?? "";
|
|
55891
|
+
return NAMED_SKIP_DIRECTORIES.has(name) || isFixtureDirectory(relativePath, rootDirectoryName);
|
|
55892
|
+
}
|
|
55813
55893
|
|
|
55814
55894
|
;// CONCATENATED MODULE: ../core/src/gateways/real-path-within-root.ts
|
|
55815
55895
|
/**
|
|
@@ -55933,20 +56013,6 @@ async function kindOutsideRoot(real, fs) {
|
|
|
55933
56013
|
} : null;
|
|
55934
56014
|
}
|
|
55935
56015
|
|
|
55936
|
-
;// CONCATENATED MODULE: ../core/src/entities/code-unit-order.ts
|
|
55937
|
-
/**
|
|
55938
|
-
* Orders strings by UTF-16 code unit.
|
|
55939
|
-
*
|
|
55940
|
-
* Unlike `localeCompare`, the result does not depend on the machine's locale
|
|
55941
|
-
* or ICU data, so anything sorted with it (directory entries, inventory
|
|
55942
|
-
* paths) comes out in the same order on every machine and in CI.
|
|
55943
|
-
*/ function compareCodeUnits(a, b) {
|
|
55944
|
-
if (a < b) {
|
|
55945
|
-
return -1;
|
|
55946
|
-
}
|
|
55947
|
-
return a > b ? 1 : 0;
|
|
55948
|
-
}
|
|
55949
|
-
|
|
55950
56016
|
;// CONCATENATED MODULE: ../core/src/gateways/repository-walk.ts
|
|
55951
56017
|
/**
|
|
55952
56018
|
* The shared, bounded walk over a repository tree, used by instruction
|
|
@@ -55973,7 +56039,7 @@ async function kindOutsideRoot(real, fs) {
|
|
|
55973
56039
|
* Directory entries examined before the walk stops. The directory cap counts
|
|
55974
56040
|
* listings, not the entries in them, and a fan-out of directory aliases lists
|
|
55975
56041
|
* a wide directory many times over, so this bounds the work itself.
|
|
55976
|
-
*/ const
|
|
56042
|
+
*/ const repository_walk_DEFAULT_MAX_WALK_ENTRIES = 200_000;
|
|
55977
56043
|
const DEFAULT_SKIPPED_DIRECTORY_NAMES = [
|
|
55978
56044
|
"node_modules",
|
|
55979
56045
|
".git"
|
|
@@ -55991,9 +56057,10 @@ function resolveSettings(options) {
|
|
|
55991
56057
|
includeFile: options.includeFile,
|
|
55992
56058
|
includeSubdirectories: options.includeSubdirectories ?? true,
|
|
55993
56059
|
revisit: options.revisit ?? "once-per-real-directory",
|
|
56060
|
+
symbolicLinks: options.symbolicLinks ?? "follow-within-root",
|
|
55994
56061
|
maxDepth: options.maxDepth ?? DEFAULT_MAX_WALK_DEPTH,
|
|
55995
56062
|
maxDirectories: options.maxDirectories ?? DEFAULT_MAX_WALK_DIRECTORIES,
|
|
55996
|
-
maxEntries: options.maxEntries ??
|
|
56063
|
+
maxEntries: options.maxEntries ?? repository_walk_DEFAULT_MAX_WALK_ENTRIES,
|
|
55997
56064
|
skipDirectoryNames: new Set(options.skipDirectoryNames ?? DEFAULT_SKIPPED_DIRECTORY_NAMES),
|
|
55998
56065
|
skipDirectory: options.skipDirectory ?? (()=>false),
|
|
55999
56066
|
listDirectory: options.listDirectory ?? listWithinRoot
|
|
@@ -56009,6 +56076,13 @@ function resolveSettings(options) {
|
|
|
56009
56076
|
/** Joins a repository-relative directory and an entry without a leading "/". */ function joinRelative(directory, name) {
|
|
56010
56077
|
return directory === "" ? name : `${directory}/${name}`;
|
|
56011
56078
|
}
|
|
56079
|
+
async function repository_walk_isSymbolicLink(absolutePath) {
|
|
56080
|
+
try {
|
|
56081
|
+
return (await (0,promises_.lstat)(absolutePath)).isSymbolicLink();
|
|
56082
|
+
} catch {
|
|
56083
|
+
return false;
|
|
56084
|
+
}
|
|
56085
|
+
}
|
|
56012
56086
|
function segmentsOf(relativePath) {
|
|
56013
56087
|
return relativePath.split("/").filter((segment)=>segment !== "");
|
|
56014
56088
|
}
|
|
@@ -56024,6 +56098,7 @@ function segmentsOf(relativePath) {
|
|
|
56024
56098
|
listedDirectories = 0;
|
|
56025
56099
|
limitReached = false;
|
|
56026
56100
|
depthLimitReached = false;
|
|
56101
|
+
depthLimitedDirectories = [];
|
|
56027
56102
|
entriesExamined = 0;
|
|
56028
56103
|
entryLimitReached = false;
|
|
56029
56104
|
skippedOutsideRoot = [];
|
|
@@ -56038,6 +56113,7 @@ function segmentsOf(relativePath) {
|
|
|
56038
56113
|
files: this.files,
|
|
56039
56114
|
directoryLimitReached: this.limitReached,
|
|
56040
56115
|
depthLimitReached: this.depthLimitReached,
|
|
56116
|
+
depthLimitedDirectories: this.depthLimitedDirectories,
|
|
56041
56117
|
entryLimitReached: this.entryLimitReached,
|
|
56042
56118
|
skippedOutsideRoot: this.skippedOutsideRoot,
|
|
56043
56119
|
limits: {
|
|
@@ -56086,6 +56162,9 @@ function segmentsOf(relativePath) {
|
|
|
56086
56162
|
}
|
|
56087
56163
|
}
|
|
56088
56164
|
async walkEntry(directoryReal, entryRelativePath, name, depth, ancestors) {
|
|
56165
|
+
if (this.settings.symbolicLinks === "skip" && await repository_walk_isSymbolicLink((0,external_node_path_.join)(directoryReal, name))) {
|
|
56166
|
+
return;
|
|
56167
|
+
}
|
|
56089
56168
|
const entry = await inspectPathWithinRoot(this.rootReal, (0,external_node_path_.join)(directoryReal, name));
|
|
56090
56169
|
if (entry.status === "outside-root") {
|
|
56091
56170
|
if (this.wouldHaveCollected(entry.kind, entryRelativePath, name, depth)) {
|
|
@@ -56104,6 +56183,7 @@ function segmentsOf(relativePath) {
|
|
|
56104
56183
|
await this.walkDirectory(entryRelativePath, depth + 1, ancestors);
|
|
56105
56184
|
} else if (this.isTooDeep(entryRelativePath, name, depth) && !this.isRevisit(entry.real, ancestors)) {
|
|
56106
56185
|
this.depthLimitReached = true;
|
|
56186
|
+
this.depthLimitedDirectories.push(entryRelativePath);
|
|
56107
56187
|
}
|
|
56108
56188
|
}
|
|
56109
56189
|
wouldHaveCollected(kind, relativePath, name, depth) {
|
|
@@ -56140,7 +56220,7 @@ function segmentsOf(relativePath) {
|
|
|
56140
56220
|
* directory reached through several aliases is counted each time it is
|
|
56141
56221
|
* listed. When the cap is hit the walk stops listing, keeps what it found and
|
|
56142
56222
|
* reports directoryLimitReached; it never throws for it.
|
|
56143
|
-
*/ async function
|
|
56223
|
+
*/ async function repository_walk_walkRepository(targetDir, options) {
|
|
56144
56224
|
const rootReal = await (0,promises_.realpath)((0,external_node_path_.resolve)(targetDir)).catch(()=>null);
|
|
56145
56225
|
const settings = resolveSettings(options);
|
|
56146
56226
|
if (rootReal === null) {
|
|
@@ -56148,6 +56228,7 @@ function segmentsOf(relativePath) {
|
|
|
56148
56228
|
files: [],
|
|
56149
56229
|
directoryLimitReached: false,
|
|
56150
56230
|
depthLimitReached: false,
|
|
56231
|
+
depthLimitedDirectories: [],
|
|
56151
56232
|
entryLimitReached: false,
|
|
56152
56233
|
skippedOutsideRoot: [],
|
|
56153
56234
|
limits: {
|
|
@@ -56160,6 +56241,307 @@ function segmentsOf(relativePath) {
|
|
|
56160
56241
|
return new RepositoryWalk(targetDir, rootReal, settings).run();
|
|
56161
56242
|
}
|
|
56162
56243
|
|
|
56244
|
+
;// CONCATENATED MODULE: ../core/src/gateways/agentic-artifact-discovery.ts
|
|
56245
|
+
/**
|
|
56246
|
+
* Instruction discovery shared by lint and doctor.
|
|
56247
|
+
*
|
|
56248
|
+
* Each directory-prefix instruction location is walked from that location, so
|
|
56249
|
+
* depth 10 is counted from the catalog root. The walk keeps every logical
|
|
56250
|
+
* path (`refuse-ancestors`). Lint collapses those paths to one per real file.
|
|
56251
|
+
*/
|
|
56252
|
+
|
|
56253
|
+
|
|
56254
|
+
|
|
56255
|
+
|
|
56256
|
+
|
|
56257
|
+
|
|
56258
|
+
|
|
56259
|
+
|
|
56260
|
+
|
|
56261
|
+
/** Directories below an agent or subagent catalog root that are still listed. */ const AGENT_CATALOG_DEPTH = 32;
|
|
56262
|
+
/** One skill directory below a skill root. `root/<name>/SKILL.md` is depth 1. */ const SKILL_CATALOG_DEPTH = 1;
|
|
56263
|
+
async function discoverInstructionLocations(targetDir, options) {
|
|
56264
|
+
const walks = [];
|
|
56265
|
+
for (const entry of instructionDiscoveryEntries()){
|
|
56266
|
+
if (entry.instructionFormat == null || entry.matchKind !== "directory-prefix") {
|
|
56267
|
+
continue;
|
|
56268
|
+
}
|
|
56269
|
+
walks.push({
|
|
56270
|
+
role: "catalog",
|
|
56271
|
+
format: entry.instructionFormat,
|
|
56272
|
+
walked: await repository_walk_walkRepository(targetDir, instructionWalkOptions(entry, options))
|
|
56273
|
+
});
|
|
56274
|
+
}
|
|
56275
|
+
if (options.includeNestedWalk !== false) {
|
|
56276
|
+
walks.push({
|
|
56277
|
+
role: "nested",
|
|
56278
|
+
format: null,
|
|
56279
|
+
walked: await repository_walk_walkRepository(targetDir, {
|
|
56280
|
+
...instructionWalkOptions({
|
|
56281
|
+
path: "",
|
|
56282
|
+
matchKind: "directory-prefix",
|
|
56283
|
+
includeSubdirectories: true,
|
|
56284
|
+
fileSuffix: undefined
|
|
56285
|
+
}, options),
|
|
56286
|
+
startRelativePath: "",
|
|
56287
|
+
includeFile: (name)=>agentic_location_catalog_isNestedInstructionFilename(name),
|
|
56288
|
+
includeSubdirectories: true
|
|
56289
|
+
})
|
|
56290
|
+
});
|
|
56291
|
+
}
|
|
56292
|
+
return walks;
|
|
56293
|
+
}
|
|
56294
|
+
/**
|
|
56295
|
+
* One logical path per real file. Paths are the same file when their
|
|
56296
|
+
* symlink-free real paths match, so symbolic-link aliases collapse while two
|
|
56297
|
+
* hard links to one inode stay separate files. The path kept is the full
|
|
56298
|
+
* relative path that sorts first by UTF-16 code unit. That is not the directory a
|
|
56299
|
+
* name-ordered walk meets first: `b-extra/file` sorts before `b/file`
|
|
56300
|
+
* because `-` comes before `/`.
|
|
56301
|
+
*
|
|
56302
|
+
* When `preferred` is given, a path it accepts wins over one it rejects, and
|
|
56303
|
+
* code-unit order only breaks a tie between equals. The result is in
|
|
56304
|
+
* code-unit order of the kept paths either way.
|
|
56305
|
+
*/ function collapseToFirstRealFile(files, preferred = ()=>false) {
|
|
56306
|
+
const sorted = [
|
|
56307
|
+
...files
|
|
56308
|
+
].sort((left, right)=>Number(preferred(right)) - Number(preferred(left)) || compareCodeUnits(left.relativePath, right.relativePath));
|
|
56309
|
+
const seen = new Set();
|
|
56310
|
+
const kept = [];
|
|
56311
|
+
for (const file of sorted){
|
|
56312
|
+
if (seen.has(file.real)) {
|
|
56313
|
+
continue;
|
|
56314
|
+
}
|
|
56315
|
+
seen.add(file.real);
|
|
56316
|
+
kept.push(file);
|
|
56317
|
+
}
|
|
56318
|
+
return kept.sort((left, right)=>compareCodeUnits(left.relativePath, right.relativePath));
|
|
56319
|
+
}
|
|
56320
|
+
/**
|
|
56321
|
+
* Markdown files under the agent catalog roots, to {@link AGENT_CATALOG_DEPTH}
|
|
56322
|
+
* from each root. Symlinks are followed when they stay inside the repository;
|
|
56323
|
+
* lint drops those paths afterwards.
|
|
56324
|
+
*/ async function discoverAgentFiles(targetDir, options) {
|
|
56325
|
+
return discoverMarkdownUnderRoots(targetDir, agentDirectoryRoots(), AGENT_CATALOG_DEPTH, options);
|
|
56326
|
+
}
|
|
56327
|
+
/** Markdown files under the subagent catalog roots, to the agent depth. */ async function discoverSubagentFiles(targetDir, options) {
|
|
56328
|
+
return discoverMarkdownUnderRoots(targetDir, subagentDirectoryRoots(), AGENT_CATALOG_DEPTH, options);
|
|
56329
|
+
}
|
|
56330
|
+
/**
|
|
56331
|
+
* `SKILL.md` files one directory below a skill root. A `SKILL.md` in the root
|
|
56332
|
+
* itself, or nested further, is not a skill file. The walk stops at that
|
|
56333
|
+
* depth by definition, so meeting a skill's own subdirectory, such as
|
|
56334
|
+
* `references/` or `scripts/`, is not a depth limit: nothing below it could
|
|
56335
|
+
* be a skill file.
|
|
56336
|
+
*/ async function agentic_artifact_discovery_discoverSkillFiles(targetDir, options) {
|
|
56337
|
+
const walked = await discoverMarkdownUnderRoots(targetDir, skillDirectoryRoots(), SKILL_CATALOG_DEPTH, options, (name)=>name === "SKILL.md");
|
|
56338
|
+
return {
|
|
56339
|
+
...walked,
|
|
56340
|
+
depthLimitReached: false,
|
|
56341
|
+
files: walked.files.filter((file)=>skillDirectoryRoots().some((root)=>isSkillFileUnderRoot(root, file.relativePath)))
|
|
56342
|
+
};
|
|
56343
|
+
}
|
|
56344
|
+
/**
|
|
56345
|
+
* Reports a directory, entry, or depth cap from a construct walk. The depth
|
|
56346
|
+
* number is that walk's own cap, not the repository root's depth of 10.
|
|
56347
|
+
*/ function agentic_artifact_discovery_reportConstructLimits(walk, onDiagnostic, wording) {
|
|
56348
|
+
if (onDiagnostic === undefined) {
|
|
56349
|
+
return;
|
|
56350
|
+
}
|
|
56351
|
+
const sentences = describeDiscoveryLimits({
|
|
56352
|
+
...walk.directoryLimitReached ? {
|
|
56353
|
+
maxDirectories: walk.limits.maxDirectories
|
|
56354
|
+
} : {},
|
|
56355
|
+
...walk.depthLimitReached ? {
|
|
56356
|
+
maxDepth: walk.limits.maxDepth
|
|
56357
|
+
} : {},
|
|
56358
|
+
...walk.entryLimitReached ? {
|
|
56359
|
+
maxEntries: walk.limits.maxEntries
|
|
56360
|
+
} : {}
|
|
56361
|
+
}, wording);
|
|
56362
|
+
if (sentences.length > 0) {
|
|
56363
|
+
onDiagnostic({
|
|
56364
|
+
ruleId: DISCOVERY_LIMIT_REACHED_RULE_ID,
|
|
56365
|
+
message: sentences.join(" ")
|
|
56366
|
+
});
|
|
56367
|
+
}
|
|
56368
|
+
}
|
|
56369
|
+
function isSkillFileUnderRoot(root, relativePath) {
|
|
56370
|
+
const rootSegments = root.split("/").filter((segment)=>segment !== "");
|
|
56371
|
+
const segments = relativePath.split("/").filter((segment)=>segment !== "");
|
|
56372
|
+
return segments.length === rootSegments.length + 2 && segments.at(-1) === "SKILL.md" && rootSegments.every((segment, index)=>segments[index] === segment);
|
|
56373
|
+
}
|
|
56374
|
+
/**
|
|
56375
|
+
* Drops a path that is a symbolic link or sits under one. Skills, agents,
|
|
56376
|
+
* subagents, and hooks keep this filter; the shared walk itself follows
|
|
56377
|
+
* in-repo links so doctor can inventory them.
|
|
56378
|
+
*/ async function agentic_artifact_discovery_omitSymlinkedPaths(targetDir, files) {
|
|
56379
|
+
const kept = [];
|
|
56380
|
+
for (const file of files){
|
|
56381
|
+
if (!await containsSymbolicLink(targetDir, file.relativePath)) {
|
|
56382
|
+
kept.push(file);
|
|
56383
|
+
}
|
|
56384
|
+
}
|
|
56385
|
+
return kept;
|
|
56386
|
+
}
|
|
56387
|
+
/**
|
|
56388
|
+
* Catalog paths that exist as regular files and are not symbolic links.
|
|
56389
|
+
* Hooks and MCP configs use this, then apply their own content checks.
|
|
56390
|
+
*/ async function discoverExactRegularFiles(targetDir, relativePaths) {
|
|
56391
|
+
const rootReal = await realpath(resolve(targetDir)).catch(()=>null);
|
|
56392
|
+
if (rootReal === null) {
|
|
56393
|
+
return [];
|
|
56394
|
+
}
|
|
56395
|
+
const found = [];
|
|
56396
|
+
for (const relativePath of relativePaths){
|
|
56397
|
+
if (relativePath.split("/").some((segment)=>segment === "..")) {
|
|
56398
|
+
continue;
|
|
56399
|
+
}
|
|
56400
|
+
if (await isRegularFileInsideRoot(targetDir, rootReal, relativePath)) {
|
|
56401
|
+
found.push(relativePath);
|
|
56402
|
+
}
|
|
56403
|
+
}
|
|
56404
|
+
return found;
|
|
56405
|
+
}
|
|
56406
|
+
async function isRegularFileInsideRoot(targetDir, rootReal, relativePath) {
|
|
56407
|
+
if (await containsSymbolicLink(targetDir, relativePath)) {
|
|
56408
|
+
return false;
|
|
56409
|
+
}
|
|
56410
|
+
try {
|
|
56411
|
+
const real = await realpath(join(targetDir, ...relativePath.split("/")));
|
|
56412
|
+
const fromRoot = relative(rootReal, real);
|
|
56413
|
+
if (fromRoot.startsWith("..") || fromRoot.startsWith("/") || fromRoot === "") {
|
|
56414
|
+
return false;
|
|
56415
|
+
}
|
|
56416
|
+
const stat = await lstat(real);
|
|
56417
|
+
return stat.isFile();
|
|
56418
|
+
} catch {
|
|
56419
|
+
return false;
|
|
56420
|
+
}
|
|
56421
|
+
}
|
|
56422
|
+
function isMissingDirectoryError(error) {
|
|
56423
|
+
return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
|
|
56424
|
+
}
|
|
56425
|
+
/** Lists a directory, treating only one that is gone as empty. */ function emptyWhenMissing(list) {
|
|
56426
|
+
return async (rootReal, path)=>{
|
|
56427
|
+
try {
|
|
56428
|
+
return await list(rootReal, path);
|
|
56429
|
+
} catch (error) {
|
|
56430
|
+
if (isMissingDirectoryError(error)) {
|
|
56431
|
+
return [];
|
|
56432
|
+
}
|
|
56433
|
+
throw error;
|
|
56434
|
+
}
|
|
56435
|
+
};
|
|
56436
|
+
}
|
|
56437
|
+
function hasDoubleDot(name) {
|
|
56438
|
+
return name.includes("..");
|
|
56439
|
+
}
|
|
56440
|
+
function lintWalkOptions(includeFile, skipDirectory, list) {
|
|
56441
|
+
return {
|
|
56442
|
+
includeFile: (name)=>!hasDoubleDot(name) && includeFile(name),
|
|
56443
|
+
skipDirectory: (relativePath)=>hasDoubleDot(relativePath.split("/").at(-1) ?? "") || skipDirectory(relativePath),
|
|
56444
|
+
symbolicLinks: "skip",
|
|
56445
|
+
listDirectory: emptyWhenMissing(list)
|
|
56446
|
+
};
|
|
56447
|
+
}
|
|
56448
|
+
async function discoverMarkdownUnderRoots(targetDir, roots, maxDepth, options, includeFile = (name)=>name.endsWith(".md")) {
|
|
56449
|
+
const files = [];
|
|
56450
|
+
const skippedOutsideRoot = [];
|
|
56451
|
+
let directoryLimitReached = false;
|
|
56452
|
+
let entryLimitReached = false;
|
|
56453
|
+
let depthLimitReached = false;
|
|
56454
|
+
let limits = {
|
|
56455
|
+
maxDirectories: options.maxDirectories ?? (/* inlined export .DEFAULT_MAX_WALK_DIRECTORIES */10000),
|
|
56456
|
+
maxDepth,
|
|
56457
|
+
maxEntries: options.maxEntries ?? DEFAULT_MAX_WALK_ENTRIES
|
|
56458
|
+
};
|
|
56459
|
+
for (const root of roots){
|
|
56460
|
+
if (await isLintSkippedRoot(targetDir, root, options)) {
|
|
56461
|
+
continue;
|
|
56462
|
+
}
|
|
56463
|
+
const walked = await walkRepository(targetDir, constructWalkOptions(root, maxDepth, options, includeFile));
|
|
56464
|
+
files.push(...walked.files);
|
|
56465
|
+
directoryLimitReached = directoryLimitReached || walked.directoryLimitReached;
|
|
56466
|
+
entryLimitReached = entryLimitReached || walked.entryLimitReached;
|
|
56467
|
+
depthLimitReached = depthLimitReached || walked.depthLimitReached;
|
|
56468
|
+
limits = walked.limits;
|
|
56469
|
+
for (const path of walked.skippedOutsideRoot){
|
|
56470
|
+
if (!skippedOutsideRoot.includes(path)) {
|
|
56471
|
+
skippedOutsideRoot.push(path);
|
|
56472
|
+
}
|
|
56473
|
+
}
|
|
56474
|
+
}
|
|
56475
|
+
return {
|
|
56476
|
+
files,
|
|
56477
|
+
directoryLimitReached,
|
|
56478
|
+
entryLimitReached,
|
|
56479
|
+
depthLimitReached,
|
|
56480
|
+
skippedOutsideRoot,
|
|
56481
|
+
limits
|
|
56482
|
+
};
|
|
56483
|
+
}
|
|
56484
|
+
/** A lint walk lists nothing below a catalog root that is itself a link. */ async function isLintSkippedRoot(targetDir, root, options) {
|
|
56485
|
+
return options.purpose === "lint" && await containsSymbolicLink(targetDir, root);
|
|
56486
|
+
}
|
|
56487
|
+
function constructWalkOptions(root, maxDepth, options, includeFile) {
|
|
56488
|
+
const base = instructionWalkOptions({
|
|
56489
|
+
path: root,
|
|
56490
|
+
matchKind: "directory-prefix",
|
|
56491
|
+
includeSubdirectories: true,
|
|
56492
|
+
fileSuffix: undefined
|
|
56493
|
+
}, {
|
|
56494
|
+
...options,
|
|
56495
|
+
maxDepth
|
|
56496
|
+
});
|
|
56497
|
+
const purposeOptions = options.purpose === "lint" ? lintWalkOptions(includeFile, base.skipDirectory ?? (()=>false), options.listDirectory ?? listDirectoryWithinRoot) : {
|
|
56498
|
+
includeFile,
|
|
56499
|
+
...options.listDirectory === undefined ? {} : {
|
|
56500
|
+
listDirectory: options.listDirectory
|
|
56501
|
+
}
|
|
56502
|
+
};
|
|
56503
|
+
return {
|
|
56504
|
+
...base,
|
|
56505
|
+
includeSubdirectories: true,
|
|
56506
|
+
maxDepth,
|
|
56507
|
+
...purposeOptions
|
|
56508
|
+
};
|
|
56509
|
+
}
|
|
56510
|
+
async function containsSymbolicLink(targetDir, relativePath) {
|
|
56511
|
+
const segments = relativePath.split("/").filter((segment)=>segment !== "");
|
|
56512
|
+
const walked = [];
|
|
56513
|
+
for (const segment of segments){
|
|
56514
|
+
walked.push(segment);
|
|
56515
|
+
try {
|
|
56516
|
+
const stat = await lstat(join(targetDir, ...walked));
|
|
56517
|
+
if (stat.isSymbolicLink()) {
|
|
56518
|
+
return true;
|
|
56519
|
+
}
|
|
56520
|
+
} catch {
|
|
56521
|
+
return false;
|
|
56522
|
+
}
|
|
56523
|
+
}
|
|
56524
|
+
return false;
|
|
56525
|
+
}
|
|
56526
|
+
function instructionWalkOptions(entry, options) {
|
|
56527
|
+
return {
|
|
56528
|
+
startRelativePath: entry.path,
|
|
56529
|
+
includeFile: (name)=>name.endsWith(entry.fileSuffix ?? ".md"),
|
|
56530
|
+
includeSubdirectories: entry.includeSubdirectories === true,
|
|
56531
|
+
revisit: "refuse-ancestors",
|
|
56532
|
+
maxDepth: options.maxDepth ?? (/* inlined export .DEFAULT_MAX_WALK_DEPTH */10),
|
|
56533
|
+
maxDirectories: options.maxDirectories ?? (/* inlined export .DEFAULT_MAX_WALK_DIRECTORIES */10000),
|
|
56534
|
+
skipDirectoryNames: [
|
|
56535
|
+
...DEFAULT_SKIPPED_DIRECTORY_NAMES,
|
|
56536
|
+
...BUILD_OUTPUT_DIRECTORY_NAMES
|
|
56537
|
+
],
|
|
56538
|
+
skipDirectory: (relativePath)=>isFixtureDirectory(relativePath, options.rootDirectoryName),
|
|
56539
|
+
...options.maxEntries === undefined ? {} : {
|
|
56540
|
+
maxEntries: options.maxEntries
|
|
56541
|
+
}
|
|
56542
|
+
};
|
|
56543
|
+
}
|
|
56544
|
+
|
|
56163
56545
|
;// CONCATENATED MODULE: ../core/src/gateways/instruction-file-discovery-gateway.ts
|
|
56164
56546
|
/**
|
|
56165
56547
|
* Gateway for discovering instruction files across multiple formats.
|
|
@@ -56171,6 +56553,8 @@ function segmentsOf(relativePath) {
|
|
|
56171
56553
|
|
|
56172
56554
|
|
|
56173
56555
|
|
|
56556
|
+
|
|
56557
|
+
|
|
56174
56558
|
/**
|
|
56175
56559
|
* File system implementation of the instruction file discovery gateway.
|
|
56176
56560
|
*
|
|
@@ -56200,34 +56584,77 @@ function segmentsOf(relativePath) {
|
|
|
56200
56584
|
rootReal
|
|
56201
56585
|
};
|
|
56202
56586
|
const findings = new DiscoveryFindings();
|
|
56587
|
+
const rootDirectoryName = (0,external_node_path_.basename)((0,external_node_path_.resolve)(targetDir));
|
|
56588
|
+
const locations = await discoverInstructionLocations(targetDir, {
|
|
56589
|
+
rootDirectoryName,
|
|
56590
|
+
maxDirectories: this.maxDirectories,
|
|
56591
|
+
...this.maxEntries === undefined ? {} : {
|
|
56592
|
+
maxEntries: this.maxEntries
|
|
56593
|
+
}
|
|
56594
|
+
});
|
|
56595
|
+
const catalogWalks = locations.filter((location)=>location.role === "catalog");
|
|
56596
|
+
let catalogIndex = 0;
|
|
56597
|
+
const seen = new Set();
|
|
56598
|
+
const exactFiles = [];
|
|
56203
56599
|
for (const entry of instructionDiscoveryEntries()){
|
|
56204
56600
|
const format = entry.instructionFormat;
|
|
56205
56601
|
if (format == null) {
|
|
56206
56602
|
continue;
|
|
56207
56603
|
}
|
|
56208
56604
|
if (entry.matchKind === "exact") {
|
|
56209
|
-
|
|
56605
|
+
const exact = await discoverExactFile(root, entry.path, format);
|
|
56606
|
+
findings.addExact(exact);
|
|
56607
|
+
if (exact.real !== undefined) {
|
|
56608
|
+
seen.add(entry.path);
|
|
56609
|
+
exactFiles.push(await instruction_file_discovery_gateway_exactFileIdentity(entry.path, exact.real));
|
|
56610
|
+
}
|
|
56210
56611
|
continue;
|
|
56211
56612
|
}
|
|
56212
|
-
|
|
56613
|
+
const walked = catalogWalks[catalogIndex]?.walked;
|
|
56614
|
+
catalogIndex += 1;
|
|
56615
|
+
if (walked === undefined) {
|
|
56616
|
+
continue;
|
|
56617
|
+
}
|
|
56618
|
+
const files = collapseToFirstRealFile(walked.files);
|
|
56619
|
+
findings.addWalk({
|
|
56620
|
+
...walked,
|
|
56621
|
+
files
|
|
56622
|
+
}, (file)=>toDiscoveredFile(root, file.relativePath, {
|
|
56213
56623
|
kind: "file",
|
|
56214
56624
|
real: file.real
|
|
56215
56625
|
}, format));
|
|
56626
|
+
for (const file of files){
|
|
56627
|
+
seen.add(file.relativePath);
|
|
56628
|
+
}
|
|
56629
|
+
}
|
|
56630
|
+
const nested = locations.find((location)=>location.role === "nested");
|
|
56631
|
+
if (nested !== undefined) {
|
|
56632
|
+
this.recordNestedInstructionFiles(root, seen, exactFiles, findings, nested.walked);
|
|
56216
56633
|
}
|
|
56217
56634
|
findings.report(onDiagnostic);
|
|
56218
56635
|
return findings.files;
|
|
56219
56636
|
}
|
|
56220
|
-
|
|
56221
|
-
|
|
56222
|
-
|
|
56223
|
-
|
|
56224
|
-
|
|
56225
|
-
revisit: "once-per-real-directory",
|
|
56226
|
-
maxDirectories: this.maxDirectories,
|
|
56227
|
-
...this.maxEntries === undefined ? {} : {
|
|
56228
|
-
maxEntries: this.maxEntries
|
|
56637
|
+
recordNestedInstructionFiles(root, seen, exactFiles, findings, additional) {
|
|
56638
|
+
const walkedPaths = new Set(additional.files.map((file)=>file.relativePath));
|
|
56639
|
+
const candidates = additional.files.filter((file)=>{
|
|
56640
|
+
if (seen.has(file.relativePath) || isExactFileAlias(file, exactFiles, walkedPaths)) {
|
|
56641
|
+
return false;
|
|
56229
56642
|
}
|
|
56230
|
-
|
|
56643
|
+
return formatForAdditionalInstructionFile(file.relativePath) !== null;
|
|
56644
|
+
});
|
|
56645
|
+
const files = collapseToFirstRealFile(candidates, (file)=>isAtItsRealPath(root, file));
|
|
56646
|
+
findings.addWalk({
|
|
56647
|
+
...additional,
|
|
56648
|
+
files,
|
|
56649
|
+
skippedOutsideRoot: additional.skippedOutsideRoot.filter(isAnalyzableNestedInstructionLinkPath),
|
|
56650
|
+
depthLimitReached: false
|
|
56651
|
+
}, (file)=>toDiscoveredFile(root, file.relativePath, {
|
|
56652
|
+
kind: "file",
|
|
56653
|
+
real: file.real
|
|
56654
|
+
}, formatForAdditionalInstructionFile(file.relativePath) ?? "agents-md"));
|
|
56655
|
+
if (additional.depthLimitedDirectories.some(isNestedFilenameAnalyzedBelow)) {
|
|
56656
|
+
findings.noteNestedFilenameDepth(additional.limits.maxDepth);
|
|
56657
|
+
}
|
|
56231
56658
|
}
|
|
56232
56659
|
}
|
|
56233
56660
|
/**
|
|
@@ -56238,6 +56665,7 @@ function segmentsOf(relativePath) {
|
|
|
56238
56665
|
skippedOutsideRoot = [];
|
|
56239
56666
|
directoryLimitReached = false;
|
|
56240
56667
|
depthLimitReached = false;
|
|
56668
|
+
nestedFilenameDepth;
|
|
56241
56669
|
entryLimitReached = false;
|
|
56242
56670
|
limits;
|
|
56243
56671
|
addExact(exact) {
|
|
@@ -56245,18 +56673,22 @@ function segmentsOf(relativePath) {
|
|
|
56245
56673
|
this.skippedOutsideRoot.push(...exact.skippedOutsideRoot);
|
|
56246
56674
|
}
|
|
56247
56675
|
addWalk(walked, toDiscovered) {
|
|
56248
|
-
this.
|
|
56249
|
-
|
|
56250
|
-
|
|
56251
|
-
|
|
56252
|
-
|
|
56676
|
+
this.recordLimits(walked);
|
|
56677
|
+
for (const path of walked.skippedOutsideRoot){
|
|
56678
|
+
if (!this.skippedOutsideRoot.includes(path)) {
|
|
56679
|
+
this.skippedOutsideRoot.push(path);
|
|
56680
|
+
}
|
|
56681
|
+
}
|
|
56253
56682
|
this.files.push(...walked.files.map(toDiscovered));
|
|
56254
56683
|
}
|
|
56684
|
+
noteNestedFilenameDepth(maxDepth) {
|
|
56685
|
+
this.nestedFilenameDepth = maxDepth;
|
|
56686
|
+
}
|
|
56255
56687
|
report(onDiagnostic) {
|
|
56256
56688
|
const reasons = this.describeLimits();
|
|
56257
56689
|
if (reasons.length > 0) {
|
|
56258
56690
|
onDiagnostic?.({
|
|
56259
|
-
ruleId:
|
|
56691
|
+
ruleId: lint_rules_DISCOVERY_LIMIT_REACHED_RULE_ID,
|
|
56260
56692
|
message: reasons.join(" ")
|
|
56261
56693
|
});
|
|
56262
56694
|
}
|
|
@@ -56267,11 +56699,39 @@ function segmentsOf(relativePath) {
|
|
|
56267
56699
|
});
|
|
56268
56700
|
}
|
|
56269
56701
|
}
|
|
56702
|
+
recordLimits(walked) {
|
|
56703
|
+
if (this.limits === undefined) {
|
|
56704
|
+
this.limits = {
|
|
56705
|
+
...walked.limits
|
|
56706
|
+
};
|
|
56707
|
+
}
|
|
56708
|
+
if (walked.directoryLimitReached) {
|
|
56709
|
+
this.directoryLimitReached = true;
|
|
56710
|
+
this.limits = {
|
|
56711
|
+
...this.limits,
|
|
56712
|
+
maxDirectories: walked.limits.maxDirectories
|
|
56713
|
+
};
|
|
56714
|
+
}
|
|
56715
|
+
if (walked.depthLimitReached) {
|
|
56716
|
+
this.depthLimitReached = true;
|
|
56717
|
+
this.limits = {
|
|
56718
|
+
...this.limits,
|
|
56719
|
+
maxDepth: walked.limits.maxDepth
|
|
56720
|
+
};
|
|
56721
|
+
}
|
|
56722
|
+
if (walked.entryLimitReached) {
|
|
56723
|
+
this.entryLimitReached = true;
|
|
56724
|
+
this.limits = {
|
|
56725
|
+
...this.limits,
|
|
56726
|
+
maxEntries: walked.limits.maxEntries
|
|
56727
|
+
};
|
|
56728
|
+
}
|
|
56729
|
+
}
|
|
56270
56730
|
describeLimits() {
|
|
56271
56731
|
if (this.limits === undefined) {
|
|
56272
56732
|
return [];
|
|
56273
56733
|
}
|
|
56274
|
-
|
|
56734
|
+
const sentences = discovery_limit_message_describeDiscoveryLimits({
|
|
56275
56735
|
...this.directoryLimitReached ? {
|
|
56276
56736
|
maxDirectories: this.limits.maxDirectories
|
|
56277
56737
|
} : {},
|
|
@@ -56282,6 +56742,12 @@ function segmentsOf(relativePath) {
|
|
|
56282
56742
|
maxEntries: this.limits.maxEntries
|
|
56283
56743
|
} : {}
|
|
56284
56744
|
}, DISCOVERY_WORDING);
|
|
56745
|
+
if (this.nestedFilenameDepth !== undefined) {
|
|
56746
|
+
sentences.push(...discovery_limit_message_describeDiscoveryLimits({
|
|
56747
|
+
maxDepth: this.nestedFilenameDepth
|
|
56748
|
+
}, NESTED_FILENAME_DEPTH_WORDING));
|
|
56749
|
+
}
|
|
56750
|
+
return sentences;
|
|
56285
56751
|
}
|
|
56286
56752
|
}
|
|
56287
56753
|
const DISCOVERY_WORDING = {
|
|
@@ -56289,6 +56755,62 @@ const DISCOVERY_WORDING = {
|
|
|
56289
56755
|
missing: "instruction files",
|
|
56290
56756
|
consequence: "were not analyzed"
|
|
56291
56757
|
};
|
|
56758
|
+
const NESTED_FILENAME_DEPTH_WORDING = {
|
|
56759
|
+
subject: "Instruction file discovery",
|
|
56760
|
+
missing: "CLAUDE.md, AGENTS.md, AGENTS.MD, and agents.md files",
|
|
56761
|
+
consequence: "may not have been analyzed"
|
|
56762
|
+
};
|
|
56763
|
+
/**
|
|
56764
|
+
* True when the walked path is the file's own location rather than a path
|
|
56765
|
+
* that reaches it through a symbolic link, so a file also visible through a
|
|
56766
|
+
* catalog-owned link is reported where it lives.
|
|
56767
|
+
*/ function isAtItsRealPath(root, file) {
|
|
56768
|
+
return file.real === (0,external_node_path_.join)(root.rootReal, ...file.relativePath.split("/"));
|
|
56769
|
+
}
|
|
56770
|
+
/**
|
|
56771
|
+
* True for a skipped link the nested walk would have analyzed: a nested
|
|
56772
|
+
* instruction filename at the root, or one no other catalog entry owns. A
|
|
56773
|
+
* link such as `.claude/skills/a/AGENTS.md` is owned by its skill directory,
|
|
56774
|
+
* so lint would not analyze it as an instruction even inside the repository.
|
|
56775
|
+
*/ function isAnalyzableNestedInstructionLinkPath(relativePath) {
|
|
56776
|
+
const slash = relativePath.lastIndexOf("/");
|
|
56777
|
+
if (slash === -1) {
|
|
56778
|
+
return agentic_location_catalog_isNestedInstructionFilename(relativePath);
|
|
56779
|
+
}
|
|
56780
|
+
return formatForAdditionalInstructionFile(relativePath) !== null;
|
|
56781
|
+
}
|
|
56782
|
+
async function instruction_file_discovery_gateway_exactFileIdentity(path, real) {
|
|
56783
|
+
const stats = await (0,promises_.stat)(real).catch(()=>null);
|
|
56784
|
+
return {
|
|
56785
|
+
path,
|
|
56786
|
+
real,
|
|
56787
|
+
identity: stats === null ? null : identityKey(stats)
|
|
56788
|
+
};
|
|
56789
|
+
}
|
|
56790
|
+
function identityKey(identity) {
|
|
56791
|
+
return `${identity.dev}:${identity.ino}`;
|
|
56792
|
+
}
|
|
56793
|
+
/**
|
|
56794
|
+
* True when a nested-walk file is an exact catalog file already discovered
|
|
56795
|
+
* under another name: the same real path (a symbolic link to it or from it),
|
|
56796
|
+
* or the same inode under a name that differs only in case, as a
|
|
56797
|
+
* case-insensitive file system reports `agents.md` for `AGENTS.md`. That
|
|
56798
|
+
* second form is one directory entry only when the walk did not also list the
|
|
56799
|
+
* catalog name: two entries listed by their own names are two files, even
|
|
56800
|
+
* when they are hard links to one inode.
|
|
56801
|
+
*/ function isExactFileAlias(file, exactFiles, walkedPaths) {
|
|
56802
|
+
const walkedIdentity = identityKey(file.identity);
|
|
56803
|
+
return exactFiles.some((exact)=>exact.real === file.real || exact.identity === walkedIdentity && exact.path.toLowerCase() === file.relativePath.toLowerCase() && !walkedPaths.has(exact.path));
|
|
56804
|
+
}
|
|
56805
|
+
/**
|
|
56806
|
+
* True when a directory the nested walk did not enter could hold a
|
|
56807
|
+
* CLAUDE.md or AGENTS.md that lint would analyze, so the depth limit may have
|
|
56808
|
+
* hidden one. Under a skill, hook, or agent directory those names belong to
|
|
56809
|
+
* the construct that owns the directory and are never analyzed as
|
|
56810
|
+
* instructions; under `.github/instructions` they are.
|
|
56811
|
+
*/ function isNestedFilenameAnalyzedBelow(directory) {
|
|
56812
|
+
return formatForAdditionalInstructionFile(`${directory}/CLAUDE.md`) !== null;
|
|
56813
|
+
}
|
|
56292
56814
|
/**
|
|
56293
56815
|
* Discovers one exact-path instruction file, or nothing when it is missing
|
|
56294
56816
|
* or resolves outside the root, in which case a link out of the repository is
|
|
@@ -56300,6 +56822,7 @@ const DISCOVERY_WORDING = {
|
|
|
56300
56822
|
files: [
|
|
56301
56823
|
toDiscoveredFile(root, relativePosixPath, inspected, format)
|
|
56302
56824
|
],
|
|
56825
|
+
real: inspected.real,
|
|
56303
56826
|
skippedOutsideRoot: []
|
|
56304
56827
|
};
|
|
56305
56828
|
}
|
|
@@ -58537,7 +59060,6 @@ const PackageJsonSchema = schemas_object({
|
|
|
58537
59060
|
|
|
58538
59061
|
|
|
58539
59062
|
/** Maximum skill file size: 1 MB */ const MAX_SKILL_FILE_BYTES = 1_048_576;
|
|
58540
|
-
/** Catalog skill roots converted to OS-native relative paths. */ const SKILL_DIRECTORIES = skillDirectoryRoots().map((root)=>(0,external_node_path_.join)(...root.split("/")));
|
|
58541
59063
|
/** Maximum lock file size: 256 KB */ const MAX_LOCK_FILE_BYTES = 262_144;
|
|
58542
59064
|
/** Relative path to the skills lock file. */ const SKILLS_LOCK_PATH = "skills-lock.json";
|
|
58543
59065
|
/** Zod schema for skills-lock.json structure */ const SkillsLockSchema = schemas_object({
|
|
@@ -58568,59 +59090,40 @@ const PackageJsonSchema = schemas_object({
|
|
|
58568
59090
|
/**
|
|
58569
59091
|
* File system implementation of the skill lint gateway.
|
|
58570
59092
|
*/ class FileSystemSkillLintGateway {
|
|
58571
|
-
|
|
58572
|
-
|
|
58573
|
-
|
|
58574
|
-
|
|
58575
|
-
|
|
58576
|
-
|
|
59093
|
+
limits;
|
|
59094
|
+
constructor(limits = {}){
|
|
59095
|
+
this.limits = limits;
|
|
59096
|
+
}
|
|
59097
|
+
async discoverSkills(targetDir, onDiagnostic) {
|
|
59098
|
+
const walk = await discoverSkillFiles(targetDir, {
|
|
59099
|
+
rootDirectoryName: basename(resolve(targetDir)),
|
|
59100
|
+
purpose: "lint",
|
|
59101
|
+
...this.limits
|
|
59102
|
+
});
|
|
59103
|
+
reportConstructLimits(walk, onDiagnostic, {
|
|
59104
|
+
subject: "Skill discovery",
|
|
59105
|
+
missing: "skill files",
|
|
59106
|
+
consequence: "were not analyzed"
|
|
59107
|
+
});
|
|
59108
|
+
const found = await omitSymlinkedPaths(targetDir, walk.files);
|
|
59109
|
+
const skills = found.flatMap((file)=>{
|
|
59110
|
+
const skillName = file.relativePath.split("/").at(-2) ?? "";
|
|
59111
|
+
if (skillName.includes("..") || skillName.includes("/") || skillName.includes("\\")) {
|
|
59112
|
+
return [];
|
|
59113
|
+
}
|
|
59114
|
+
return [
|
|
59115
|
+
{
|
|
59116
|
+
filePath: join(targetDir, ...file.relativePath.split("/")),
|
|
59117
|
+
skillName
|
|
59118
|
+
}
|
|
59119
|
+
];
|
|
59120
|
+
});
|
|
58577
59121
|
const lockedNames = await readLockedSkillNames(targetDir);
|
|
58578
59122
|
if (lockedNames.size === 0) {
|
|
58579
59123
|
return skills;
|
|
58580
59124
|
}
|
|
58581
59125
|
return skills.filter((skill)=>!lockedNames.has(skill.skillName));
|
|
58582
59126
|
}
|
|
58583
|
-
async discoverSkillsInDir(targetDir, skillsDir) {
|
|
58584
|
-
try {
|
|
58585
|
-
if (!await pathExistsWithinRoot(targetDir, skillsDir)) {
|
|
58586
|
-
return [];
|
|
58587
|
-
}
|
|
58588
|
-
} catch {
|
|
58589
|
-
return [];
|
|
58590
|
-
}
|
|
58591
|
-
let entries;
|
|
58592
|
-
try {
|
|
58593
|
-
entries = await listDirectoryWithinRoot(targetDir, skillsDir);
|
|
58594
|
-
} catch (error) {
|
|
58595
|
-
if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR")) {
|
|
58596
|
-
return [];
|
|
58597
|
-
}
|
|
58598
|
-
throw error;
|
|
58599
|
-
}
|
|
58600
|
-
const skills = [];
|
|
58601
|
-
for (const entry of entries){
|
|
58602
|
-
if (!entry.isDirectory()) {
|
|
58603
|
-
continue;
|
|
58604
|
-
}
|
|
58605
|
-
if (entry.name.includes("..") || entry.name.includes("/") || entry.name.includes("\\")) {
|
|
58606
|
-
continue;
|
|
58607
|
-
}
|
|
58608
|
-
const skillRelativePath = join(skillsDir, entry.name, "SKILL.md");
|
|
58609
|
-
let hasSkillFile = false;
|
|
58610
|
-
try {
|
|
58611
|
-
hasSkillFile = await pathExistsWithinRoot(targetDir, skillRelativePath);
|
|
58612
|
-
} catch {
|
|
58613
|
-
hasSkillFile = false;
|
|
58614
|
-
}
|
|
58615
|
-
if (hasSkillFile) {
|
|
58616
|
-
skills.push({
|
|
58617
|
-
filePath: join(targetDir, skillRelativePath),
|
|
58618
|
-
skillName: entry.name
|
|
58619
|
-
});
|
|
58620
|
-
}
|
|
58621
|
-
}
|
|
58622
|
-
return skills;
|
|
58623
|
-
}
|
|
58624
59127
|
async readSkillFileContent(filePath) {
|
|
58625
59128
|
return readFileNoFollow(filePath, MAX_SKILL_FILE_BYTES);
|
|
58626
59129
|
}
|
|
@@ -94677,4 +95180,4 @@ if (installedChunkData !== 0) { // 0 means "already installed".'
|
|
|
94677
95180
|
// module factories are used so entry inlining is disabled
|
|
94678
95181
|
// startup
|
|
94679
95182
|
// Load entry module and return exports
|
|
94680
|
-
var __webpack_exports__ = __webpack_require__(
|
|
95183
|
+
var __webpack_exports__ = __webpack_require__(7698);
|