@geraldmaron/construct 1.5.0 → 1.5.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.
@@ -1234,15 +1234,10 @@ async function main() {
1234
1234
  try {
1235
1235
  const { startServices } = await import('./service-manager.mjs');
1236
1236
  const { homedir } = await import('node:os');
1237
- const { detectDockerCompose } = await import('./setup.mjs');
1238
-
1239
- const homeDir = homedir();
1240
- const composeRunner = detectDockerCompose();
1241
-
1237
+
1242
1238
  const { results } = await startServices({
1243
1239
  rootDir: target,
1244
- homeDir,
1245
- detectDockerComposeFn: () => composeRunner,
1240
+ homeDir: homedir(),
1246
1241
  });
1247
1242
 
1248
1243
  if (!quiet) {
@@ -10,14 +10,18 @@
10
10
  *
11
11
  * Config (per call):
12
12
  * - root: absolute or relative path to the directory root (required)
13
- * - include: array of minimatch glob patterns (optional, defaults to ["**\/*"])
14
- * - exclude: array of minimatch glob patterns to filter out (optional)
13
+ * - include: array of glob patterns (optional, defaults to ["**\/*"])
14
+ * - exclude: array of glob patterns to filter out (optional)
15
15
  * - maxFileKB: integer max file size in KB (default 1024, max 10240)
16
+ *
17
+ * Glob support is the in-tree subset (ADR-0001, lib/rules-delivery.mjs):
18
+ * `**\/` spans directories, `*` stays within a segment, and a pattern without
19
+ * a slash matches basenames (`*.md` matches nested files).
16
20
  */
17
21
 
18
22
  import { existsSync, statSync, readdirSync, readFileSync } from 'node:fs';
19
23
  import { resolve, relative, isAbsolute } from 'node:path';
20
- import { minimatch } from 'minimatch';
24
+ import { globToRegExp } from '../../rules-delivery.mjs';
21
25
 
22
26
  /**
23
27
  * Verify that path is within root and not a symlink escape.
@@ -74,6 +78,14 @@ function resolvePath(root, candidate) {
74
78
  return { ok: true, path: resolved, root: rootPath };
75
79
  }
76
80
 
81
+ // A pattern without a slash tests the basename so `*.md` matches nested files,
82
+ // mirroring the matchBase behavior read() and search() have always documented.
83
+
84
+ function compileMatchers(patterns) {
85
+ const compiled = patterns.map((pat) => ({ re: globToRegExp(pat), baseOnly: !pat.includes('/') }));
86
+ return (relativePath, name) => compiled.some(({ re, baseOnly }) => re.test(baseOnly ? name : relativePath));
87
+ }
88
+
77
89
  /**
78
90
  * Walk directory recursively, matching include/exclude globs.
79
91
  */
@@ -82,6 +94,9 @@ function walkDir(dirPath, { include = ['**/*'], exclude = [] }) {
82
94
  const stat = statSync(dirPath);
83
95
  if (!stat.isDirectory()) return results;
84
96
 
97
+ const includes = compileMatchers(include);
98
+ const excludes = compileMatchers(exclude);
99
+
85
100
  function walk(dir, prefix = '') {
86
101
  let entries;
87
102
  try {
@@ -97,10 +112,7 @@ function walkDir(dirPath, { include = ['**/*'], exclude = [] }) {
97
112
  if (entry.isDirectory()) {
98
113
  walk(fullPath, relativePath);
99
114
  } else if (entry.isFile()) {
100
- const matches = include.some((pat) => minimatch(relativePath, pat, { matchBase: true }));
101
- const excludes = exclude.some((pat) => minimatch(relativePath, pat, { matchBase: true }));
102
-
103
- if (matches && !excludes) {
115
+ if (includes(relativePath, entry.name) && !excludes(relativePath, entry.name)) {
104
116
  results.push({ path: fullPath, relativePath, name: entry.name });
105
117
  }
106
118
  }
@@ -80,6 +80,7 @@ export function defaultCorpusInventoryPath(rootDir = process.cwd()) {
80
80
  }
81
81
 
82
82
  function listTestFiles(testsDir) {
83
+ if (!fs.existsSync(testsDir)) return [];
83
84
  const files = [];
84
85
  const walk = (dir) => {
85
86
  for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geraldmaron/construct",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "type": "module",
5
5
  "packageManager": "npm@11.5.1",
6
6
  "description": "Construct — agent orchestration layer for OpenCode, Claude Code, and other coding surfaces",