@yawlabs/ctxlint 0.18.3 → 0.18.5

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/index.js CHANGED
@@ -13906,6 +13906,8 @@ var init_parser = __esm({
13906
13906
  "config",
13907
13907
  "bin",
13908
13908
  "cmd",
13909
+ "core",
13910
+ "services",
13909
13911
  "internal",
13910
13912
  "public",
13911
13913
  "static",
@@ -25430,7 +25432,7 @@ function loadSettingsSources2(projectRoot, homeDir, includeUserGlobal) {
25430
25432
  }
25431
25433
  return sources;
25432
25434
  }
25433
- function expandPath(raw, projectRoot, homeDir) {
25435
+ function expandPath(raw, projectRoot, homeDir, platform) {
25434
25436
  let s = raw;
25435
25437
  if (s === "~" || s.startsWith("~/") || s.startsWith("~\\")) {
25436
25438
  s = path10.join(homeDir, s.slice(1));
@@ -25451,6 +25453,7 @@ function expandPath(raw, projectRoot, homeDir) {
25451
25453
  });
25452
25454
  if (/\$\{?[A-Za-z_]/.test(s)) return null;
25453
25455
  if (/%[A-Za-z_][A-Za-z0-9_]*%/.test(s)) return null;
25456
+ s = translateMsysDrivePath(s, platform);
25454
25457
  if (!path10.isAbsolute(s)) s = path10.resolve(projectRoot, s);
25455
25458
  return s;
25456
25459
  }
@@ -25459,19 +25462,32 @@ function looksLikePath(token) {
25459
25462
  if (PATH_PREFIX.test(token)) return true;
25460
25463
  return hasSep && SCRIPT_EXT.test(token);
25461
25464
  }
25462
- function extractCommandPaths(command, projectRoot, homeDir) {
25465
+ function stripMatcherWildcard(token) {
25466
+ return token.replace(/:?\*+$/, "");
25467
+ }
25468
+ function isMsysFlag(token) {
25469
+ return /^\/\/[A-Za-z]+$/.test(token);
25470
+ }
25471
+ function translateMsysDrivePath(s, platform) {
25472
+ if (platform !== "win32") return s;
25473
+ const m = /^\/([A-Za-z])\/(.*)$/.exec(s);
25474
+ return m ? `${m[1]}:/${m[2]}` : s;
25475
+ }
25476
+ function extractCommandPaths(command, projectRoot, homeDir, platform) {
25463
25477
  const tokens = command.match(/"[^"]*"|'[^']*'|\S+/g) ?? [];
25464
25478
  const out = [];
25465
25479
  for (const t2 of tokens) {
25466
25480
  const token = t2.replace(/^['"]|['"]$/g, "");
25467
- if (!looksLikePath(token)) continue;
25468
- out.push({ raw: token, resolved: expandPath(token, projectRoot, homeDir) });
25481
+ const pathToken = stripMatcherWildcard(token);
25482
+ if (isMsysFlag(pathToken)) continue;
25483
+ if (!looksLikePath(pathToken)) continue;
25484
+ out.push({ raw: token, resolved: expandPath(pathToken, projectRoot, homeDir, platform) });
25469
25485
  }
25470
25486
  return out;
25471
25487
  }
25472
- function extractPermissionPaths(entry, projectRoot, homeDir) {
25488
+ function extractPermissionPaths(entry, projectRoot, homeDir, platform) {
25473
25489
  const inner = entry.replace(/^[A-Za-z]+\((.*)\)$/, "$1");
25474
- return extractCommandPaths(inner, projectRoot, homeDir);
25490
+ return extractCommandPaths(inner, projectRoot, homeDir, platform);
25475
25491
  }
25476
25492
  function lineForPath(source, jsonPath) {
25477
25493
  if (!source.tree) return 1;
@@ -25479,7 +25495,7 @@ function lineForPath(source, jsonPath) {
25479
25495
  if (!node) return 1;
25480
25496
  return offsetToPosition(source.content, node.offset).line;
25481
25497
  }
25482
- function checkSource(source, projectRoot, homeDir) {
25498
+ function checkSource(source, projectRoot, homeDir, platform) {
25483
25499
  if (!source.tree) return [];
25484
25500
  const data = getNodeValue2(source.tree);
25485
25501
  if (!data || typeof data !== "object") return [];
@@ -25506,7 +25522,7 @@ function checkSource(source, projectRoot, homeDir) {
25506
25522
  subHooks.forEach((h2, hi2) => {
25507
25523
  if (!h2 || typeof h2.command !== "string") return;
25508
25524
  const line = lineForPath(source, ["hooks", event, mi2, "hooks", hi2, "command"]);
25509
- for (const cand of extractCommandPaths(h2.command, projectRoot, homeDir)) {
25525
+ for (const cand of extractCommandPaths(h2.command, projectRoot, homeDir, platform)) {
25510
25526
  report(cand, line, `${event} hook`);
25511
25527
  }
25512
25528
  });
@@ -25519,18 +25535,18 @@ function checkSource(source, projectRoot, homeDir) {
25519
25535
  list.forEach((entry, i2) => {
25520
25536
  if (typeof entry !== "string") return;
25521
25537
  const line = lineForPath(source, ["permissions", listName, i2]);
25522
- for (const cand of extractPermissionPaths(entry, projectRoot, homeDir)) {
25538
+ for (const cand of extractPermissionPaths(entry, projectRoot, homeDir, platform)) {
25523
25539
  report(cand, line, `permissions.${listName} entry`);
25524
25540
  }
25525
25541
  });
25526
25542
  }
25527
25543
  return issues;
25528
25544
  }
25529
- async function checkHookCoverage(projectRoot, homeDir = os3.homedir(), options = {}) {
25545
+ async function checkHookCoverage(projectRoot, homeDir = os3.homedir(), options = {}, platform = process.platform) {
25530
25546
  const sources = loadSettingsSources2(projectRoot, homeDir, options.userGlobal ?? false);
25531
25547
  const issues = [];
25532
25548
  for (const source of sources) {
25533
- issues.push(...checkSource(source, projectRoot, homeDir));
25549
+ issues.push(...checkSource(source, projectRoot, homeDir, platform));
25534
25550
  }
25535
25551
  return issues;
25536
25552
  }
@@ -27788,7 +27804,7 @@ import { readFileSync as readFileSync7 } from "node:fs";
27788
27804
  import { resolve as resolve14, dirname as dirname6 } from "node:path";
27789
27805
  import { fileURLToPath as fileURLToPath2 } from "node:url";
27790
27806
  function loadVersion() {
27791
- if (true) return "0.18.3";
27807
+ if (true) return "0.18.4";
27792
27808
  try {
27793
27809
  const __dir = dirname6(fileURLToPath2(import.meta.url));
27794
27810
  const pkgPath = resolve14(__dir, "../package.json");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yawlabs/ctxlint",
3
- "version": "0.18.3",
3
+ "version": "0.18.5",
4
4
  "mcpName": "io.github.YawLabs/ctxlint",
5
5
  "description": "Lint your AI agent context files, MCP server configs, and session data against your actual codebase",
6
6
  "bin": {