paqad-ai 1.60.1 → 1.60.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # paqad-ai
2
2
 
3
+ ## 1.60.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 3900daf: Prevent onboarding repository discovery from scanning dot directories, ignored paths, generated trees, and nested Git checkouts.
8
+
3
9
  ## 1.60.1
4
10
 
5
11
  ### Patch Changes
package/dist/cli/index.js CHANGED
@@ -15707,7 +15707,7 @@ function buildDetectionReport(input3) {
15707
15707
  init_esm_shims();
15708
15708
  import { existsSync as existsSync24, readFileSync as readFileSync25 } from "fs";
15709
15709
  import { join as join49 } from "path";
15710
- import fg5 from "fast-glob";
15710
+ import fg6 from "fast-glob";
15711
15711
 
15712
15712
  // src/introspection/stack-introspector.ts
15713
15713
  init_esm_shims();
@@ -15715,8 +15715,41 @@ import { join as join47 } from "path";
15715
15715
 
15716
15716
  // src/repository/discovery.ts
15717
15717
  init_esm_shims();
15718
- import { readdir as readdir4 } from "fs/promises";
15718
+ import { lstat as lstat2, readdir as readdir4 } from "fs/promises";
15719
15719
  import { basename as basename4, join as join42 } from "path";
15720
+
15721
+ // src/core/fs/gitignore-scan.ts
15722
+ init_esm_shims();
15723
+ import { execFileSync as execFileSync2 } from "child_process";
15724
+ import fg5 from "fast-glob";
15725
+ var DEFAULT_SOURCE_GLOBS = ["**/*.{ts,tsx,js,jsx,mjs,cjs,vue,svelte}"];
15726
+ var DEFAULT_IGNORE_GLOBS = [
15727
+ "**/node_modules/**",
15728
+ "**/dist/**",
15729
+ "**/.paqad/**",
15730
+ "**/build/**",
15731
+ "**/vendor/**"
15732
+ ];
15733
+ function dropGitIgnored(projectRoot, files) {
15734
+ try {
15735
+ const out = execFileSync2("git", ["check-ignore", "-z", "--stdin"], {
15736
+ cwd: projectRoot,
15737
+ input: files.join("\0"),
15738
+ stdio: ["pipe", "pipe", "ignore"]
15739
+ });
15740
+ const ignored = new Set(out.toString("utf8").split("\0").filter(Boolean));
15741
+ return files.filter((f) => !ignored.has(f));
15742
+ } catch {
15743
+ return files;
15744
+ }
15745
+ }
15746
+ function scanWorkingTree(projectRoot, globs = DEFAULT_SOURCE_GLOBS, ignore = DEFAULT_IGNORE_GLOBS) {
15747
+ const listed = fg5.sync(globs, { cwd: projectRoot, ignore, onlyFiles: true });
15748
+ return dropGitIgnored(projectRoot, listed).sort();
15749
+ }
15750
+
15751
+ // src/repository/discovery.ts
15752
+ init_path_utils();
15720
15753
  var DEFAULT_SCAN_MAX_DEPTH = 5;
15721
15754
  var PROJECT_MARKERS = /* @__PURE__ */ new Map([
15722
15755
  ["package.json", "node"],
@@ -15745,9 +15778,12 @@ var IGNORED_DIRECTORIES = /* @__PURE__ */ new Set([
15745
15778
  "build",
15746
15779
  "coverage",
15747
15780
  "dist",
15781
+ "docs",
15782
+ "modules",
15748
15783
  "node_modules",
15749
15784
  "out",
15750
15785
  "target",
15786
+ "tests",
15751
15787
  "vendor"
15752
15788
  ]);
15753
15789
  var NON_CANONICAL_DIRECTORIES = /* @__PURE__ */ new Set([
@@ -15794,7 +15830,19 @@ async function walk(projectRoot, relativeDir, depth, maxDepth, candidates, ignor
15794
15830
  return;
15795
15831
  }
15796
15832
  const entryNames = new Set(entries.map((entry) => entry.name));
15797
- const markers = Array.from(PROJECT_MARKERS.keys()).filter((marker) => entryNames.has(marker));
15833
+ const markerCandidates = Array.from(PROJECT_MARKERS.keys()).filter(
15834
+ (marker) => entryNames.has(marker)
15835
+ );
15836
+ const markerPaths = markerCandidates.map((marker) => repositoryPath(relativeDir, marker));
15837
+ const visibleMarkerPaths = new Set(dropGitIgnored(projectRoot, markerPaths));
15838
+ const markers = markerCandidates.filter((marker) => {
15839
+ const markerPath = repositoryPath(relativeDir, marker);
15840
+ if (visibleMarkerPaths.has(markerPath)) {
15841
+ return true;
15842
+ }
15843
+ ignoredPaths.add(markerPath);
15844
+ return false;
15845
+ });
15798
15846
  if (markers.length > 0) {
15799
15847
  const ecosystems = Array.from(
15800
15848
  new Set(markers.map((marker) => PROJECT_MARKERS.get(marker)).filter(isDefined))
@@ -15810,16 +15858,48 @@ async function walk(projectRoot, relativeDir, depth, maxDepth, candidates, ignor
15810
15858
  if (depth >= maxDepth) {
15811
15859
  return;
15812
15860
  }
15861
+ const childDirectories = [];
15813
15862
  for (const entry of entries) {
15863
+ const childRelativePath = repositoryPath(relativeDir, entry.name);
15864
+ if (entry.name.startsWith(".")) {
15865
+ ignoredPaths.add(childRelativePath);
15866
+ continue;
15867
+ }
15814
15868
  if (!entry.isDirectory()) {
15815
15869
  continue;
15816
15870
  }
15817
- const childRelativePath = relativeDir === "." ? entry.name : join42(relativeDir, entry.name);
15818
15871
  if (IGNORED_DIRECTORIES.has(entry.name) || NON_CANONICAL_DIRECTORIES.has(entry.name)) {
15819
15872
  ignoredPaths.add(childRelativePath);
15820
15873
  continue;
15821
15874
  }
15822
- await walk(projectRoot, childRelativePath, depth + 1, maxDepth, candidates, ignoredPaths);
15875
+ childDirectories.push({
15876
+ absolutePath: join42(absoluteDir, entry.name),
15877
+ relativePath: childRelativePath
15878
+ });
15879
+ }
15880
+ const visibleDirectories = new Set(
15881
+ dropGitIgnored(
15882
+ projectRoot,
15883
+ childDirectories.map((directory) => directory.relativePath)
15884
+ )
15885
+ );
15886
+ for (const child of childDirectories) {
15887
+ if (!visibleDirectories.has(child.relativePath) || await hasVcsBoundary(child.absolutePath)) {
15888
+ ignoredPaths.add(child.relativePath);
15889
+ continue;
15890
+ }
15891
+ await walk(projectRoot, child.relativePath, depth + 1, maxDepth, candidates, ignoredPaths);
15892
+ }
15893
+ }
15894
+ function repositoryPath(relativeDir, entryName) {
15895
+ return toPosixPath(relativeDir === "." ? entryName : join42(relativeDir, entryName));
15896
+ }
15897
+ async function hasVcsBoundary(absoluteDir) {
15898
+ try {
15899
+ await lstat2(join42(absoluteDir, ".git"));
15900
+ return true;
15901
+ } catch {
15902
+ return false;
15823
15903
  }
15824
15904
  }
15825
15905
  function classifyProjects(candidates) {
@@ -17149,7 +17229,7 @@ function matchesRuleAtRoot(projectRoot, root, rule, packageNames) {
17149
17229
  const absoluteRoot = root === "." ? projectRoot : join49(projectRoot, root);
17150
17230
  const fileMatched = rule.file ? existsSync24(join49(absoluteRoot, rule.file)) : true;
17151
17231
  const directoryMatched = rule.directory ? existsSync24(join49(absoluteRoot, rule.directory)) : true;
17152
- const patternsMatched = rule.patterns === void 0 || rule.patterns.every((pattern) => fg5.sync(pattern, { cwd: absoluteRoot }).length > 0);
17232
+ const patternsMatched = rule.patterns === void 0 || rule.patterns.every((pattern) => fg6.sync(pattern, { cwd: absoluteRoot }).length > 0);
17153
17233
  const contentMatched = rule.content_match === void 0 || rule.file !== void 0 && existsSync24(join49(absoluteRoot, rule.file)) && readFileSync25(join49(absoluteRoot, rule.file), "utf8").includes(rule.content_match);
17154
17234
  const fieldsMatched = evaluateFieldRules(absoluteRoot, rule);
17155
17235
  const fieldAbsentMatched = evaluateFieldAbsentRules(absoluteRoot, rule);
@@ -17757,7 +17837,7 @@ init_esm_shims();
17757
17837
 
17758
17838
  // src/health/checker.ts
17759
17839
  init_esm_shims();
17760
- import { execFileSync as execFileSync2 } from "child_process";
17840
+ import { execFileSync as execFileSync3 } from "child_process";
17761
17841
  import { existsSync as existsSync32, readdirSync as readdirSync9, readFileSync as readFileSync33, statSync as statSync4 } from "fs";
17762
17842
  import { join as join60, relative as relative4 } from "path";
17763
17843
  init_chunk_index();
@@ -17811,7 +17891,7 @@ init_runtime_paths();
17811
17891
  import { createHash as createHash16 } from "crypto";
17812
17892
  import { mkdir as mkdir21, readFile as readFile23, readdir as readdir5, rm as rm4, stat as stat5, writeFile as writeFile20 } from "fs/promises";
17813
17893
  import { join as join57 } from "path";
17814
- import fg6 from "fast-glob";
17894
+ import fg7 from "fast-glob";
17815
17895
 
17816
17896
  // src/skills/frontmatter-parser.ts
17817
17897
  init_esm_shims();
@@ -18213,7 +18293,7 @@ var SkillCacheManager = class {
18213
18293
  }
18214
18294
  }
18215
18295
  async loadCacheability() {
18216
- const files = await fg6(
18296
+ const files = await fg7(
18217
18297
  [
18218
18298
  "base/skills/**/SKILL.md",
18219
18299
  "capabilities/coding/skills/**/SKILL.md",
@@ -18242,7 +18322,7 @@ init_esm_shims();
18242
18322
  // src/test-output/service.ts
18243
18323
  init_esm_shims();
18244
18324
  import { readFile as readFile24 } from "fs/promises";
18245
- import fg7 from "fast-glob";
18325
+ import fg8 from "fast-glob";
18246
18326
 
18247
18327
  // src/token-efficiency/index.ts
18248
18328
  init_esm_shims();
@@ -18843,7 +18923,7 @@ async function collectRawSources(options) {
18843
18923
  if (!options.runner.output_path_pattern) {
18844
18924
  return [];
18845
18925
  }
18846
- const matches = await fg7(options.runner.output_path_pattern, {
18926
+ const matches = await fg8(options.runner.output_path_pattern, {
18847
18927
  cwd: options.cwd,
18848
18928
  absolute: true,
18849
18929
  onlyFiles: true
@@ -19578,7 +19658,7 @@ Time: 0.01s`
19578
19658
  init_esm_shims();
19579
19659
  import { mkdir as mkdir22, readFile as readFile25, rename as rename5, writeFile as writeFile21 } from "fs/promises";
19580
19660
  import { dirname as dirname29, join as join58 } from "path";
19581
- import fg8 from "fast-glob";
19661
+ import fg9 from "fast-glob";
19582
19662
  init_paths();
19583
19663
  function deriveHealthTier(metrics) {
19584
19664
  const coverage = metrics.coverage_pct ?? null;
@@ -19608,7 +19688,7 @@ async function writeModuleHealthProfile(root, profile) {
19608
19688
  async function readAllModuleHealth(root) {
19609
19689
  const dir = join58(root, PATHS.PLANNING_MODULE_HEALTH_DIR);
19610
19690
  try {
19611
- const files = await fg8("**/*.json", { cwd: dir, onlyFiles: true });
19691
+ const files = await fg9("**/*.json", { cwd: dir, onlyFiles: true });
19612
19692
  const profiles = await Promise.all(
19613
19693
  files.filter((file) => !file.split("/").includes("evidence")).map(async (file) => {
19614
19694
  const raw = await readFile25(join58(dir, file), "utf8");
@@ -19776,7 +19856,7 @@ var HealthChecker = class {
19776
19856
  isPathIgnored(projectRoot, relPath) {
19777
19857
  const target = relPath.replace(/\/$/, "");
19778
19858
  try {
19779
- execFileSync2("git", ["check-ignore", "-q", "--", target], {
19859
+ execFileSync3("git", ["check-ignore", "-q", "--", target], {
19780
19860
  cwd: projectRoot,
19781
19861
  stdio: "ignore"
19782
19862
  });
@@ -21267,7 +21347,7 @@ init_project_packs();
21267
21347
 
21268
21348
  // src/resolver/resolver.ts
21269
21349
  init_esm_shims();
21270
- import fg9 from "fast-glob";
21350
+ import fg10 from "fast-glob";
21271
21351
  import { basename as basename6, extname as extname3, relative as relative8 } from "pathe";
21272
21352
 
21273
21353
  // src/resolver/artifact-types.ts
@@ -21525,7 +21605,7 @@ var Resolver = class {
21525
21605
  const entries = [];
21526
21606
  const overrides = /* @__PURE__ */ new Map();
21527
21607
  for (const directory of directories) {
21528
- const files = await fg9("**/*", {
21608
+ const files = await fg10("**/*", {
21529
21609
  cwd: directory.path,
21530
21610
  onlyFiles: true,
21531
21611
  absolute: true,
@@ -21577,7 +21657,7 @@ init_paths();
21577
21657
  init_path_utils();
21578
21658
  import { readFileSync as readFileSync36, writeFileSync as writeFileSync16 } from "fs";
21579
21659
  import { join as join71 } from "path";
21580
- import fg10 from "fast-glob";
21660
+ import fg11 from "fast-glob";
21581
21661
 
21582
21662
  // src/rule-scripts/rule-file.ts
21583
21663
  init_esm_shims();
@@ -21682,7 +21762,7 @@ var RULE_SCRIPT_MAP_SCHEMA_VERSION = 1;
21682
21762
 
21683
21763
  // src/rule-scripts/analyzer.ts
21684
21764
  function collectRuleFiles(projectRoot) {
21685
- const rel = fg10.sync("**/*.md", {
21765
+ const rel = fg11.sync("**/*.md", {
21686
21766
  cwd: join71(projectRoot, PATHS.RULES_DIR),
21687
21767
  onlyFiles: true
21688
21768
  });
@@ -21924,36 +22004,6 @@ import { createHash as createHash19 } from "crypto";
21924
22004
  import { existsSync as existsSync37, mkdirSync as mkdirSync22, readFileSync as readFileSync39, writeFileSync as writeFileSync18 } from "fs";
21925
22005
  import { dirname as dirname37, join as join75 } from "path";
21926
22006
 
21927
- // src/core/fs/gitignore-scan.ts
21928
- init_esm_shims();
21929
- import { execFileSync as execFileSync3 } from "child_process";
21930
- import fg11 from "fast-glob";
21931
- var DEFAULT_SOURCE_GLOBS = ["**/*.{ts,tsx,js,jsx,mjs,cjs,vue,svelte}"];
21932
- var DEFAULT_IGNORE_GLOBS = [
21933
- "**/node_modules/**",
21934
- "**/dist/**",
21935
- "**/.paqad/**",
21936
- "**/build/**",
21937
- "**/vendor/**"
21938
- ];
21939
- function dropGitIgnored(projectRoot, files) {
21940
- try {
21941
- const out = execFileSync3("git", ["check-ignore", "-z", "--stdin"], {
21942
- cwd: projectRoot,
21943
- input: files.join("\0"),
21944
- stdio: ["pipe", "pipe", "ignore"]
21945
- });
21946
- const ignored = new Set(out.toString("utf8").split("\0").filter(Boolean));
21947
- return files.filter((f) => !ignored.has(f));
21948
- } catch {
21949
- return files;
21950
- }
21951
- }
21952
- function scanWorkingTree(projectRoot, globs = DEFAULT_SOURCE_GLOBS, ignore = DEFAULT_IGNORE_GLOBS) {
21953
- const listed = fg11.sync(globs, { cwd: projectRoot, ignore, onlyFiles: true });
21954
- return dropGitIgnored(projectRoot, listed).sort();
21955
- }
21956
-
21957
22007
  // src/rule-scripts/execute.ts
21958
22008
  init_esm_shims();
21959
22009
  import { spawnSync } from "child_process";
@@ -30360,7 +30410,7 @@ init_cancelled_error();
30360
30410
  init_events();
30361
30411
 
30362
30412
  // src/index.ts
30363
- var VERSION = "1.60.1";
30413
+ var VERSION = "1.60.2";
30364
30414
 
30365
30415
  // src/cli/commands/audit.ts
30366
30416
  init_esm_shims();