@robhowley/pi-structured-return 1.7.3 → 1.7.4

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.
@@ -173,6 +173,19 @@ describe("expandArtifactPaths", () => {
173
173
  ]);
174
174
  });
175
175
 
176
+ it("expands globs with * in directory positions (multi-module Gradle)", () => {
177
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), "expand-dirglob-"));
178
+ const modA = path.join(dir, "moduleA", "build", "test-results", "test");
179
+ const modB = path.join(dir, "moduleB", "build", "test-results", "test");
180
+ fs.mkdirSync(modA, { recursive: true });
181
+ fs.mkdirSync(modB, { recursive: true });
182
+ fs.writeFileSync(path.join(modA, "TEST-FooTest.xml"), "<foo/>");
183
+ fs.writeFileSync(path.join(modB, "TEST-BarTest.xml"), "<bar/>");
184
+
185
+ const result = expandArtifactPaths(["*/build/test-results/test/TEST-*.xml"], dir);
186
+ expect(result).toEqual([path.join(modA, "TEST-FooTest.xml"), path.join(modB, "TEST-BarTest.xml")]);
187
+ });
188
+
176
189
  it("returns empty array for empty input", () => {
177
190
  expect(expandArtifactPaths([], "/any")).toEqual([]);
178
191
  });
@@ -1,7 +1,7 @@
1
1
  import { spawn } from "node:child_process";
2
- import fs from "node:fs";
3
2
  import path from "node:path";
4
3
  import { randomUUID } from "node:crypto";
4
+ import { globSync } from "glob";
5
5
  import { Type } from "@sinclair/typebox";
6
6
  import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
7
7
  import { Text } from "@mariozechner/pi-tui";
@@ -173,7 +173,7 @@ export function formatResult(result: ParsedResult): string {
173
173
  export function expandArtifactPaths(raw: string[], cwd: string): string[] {
174
174
  return raw.flatMap((p) => {
175
175
  const resolved = path.isAbsolute(p) ? p : path.join(cwd, p);
176
- const expanded = fs.globSync(resolved);
176
+ const expanded = globSync(resolved);
177
177
  return expanded.length > 0 ? expanded.sort() : [resolved];
178
178
  });
179
179
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robhowley/pi-structured-return",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "description": "Turn noisy CLI output into compact structured results (fewer tokens), full logs preserved.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -51,7 +51,8 @@
51
51
  "prepare": "node -e \"if (process.env.CI || process.env.GITHUB_ACTIONS) process.exit(0)\" || husky"
52
52
  },
53
53
  "dependencies": {
54
- "fast-xml-parser": "^5.4.1"
54
+ "fast-xml-parser": "^5.4.1",
55
+ "glob": "^11.0.0"
55
56
  },
56
57
  "devDependencies": {
57
58
  "@mariozechner/pi-coding-agent": "*",
@@ -150,14 +150,14 @@ Gradle writes one XML file per test class — there is no single-file option. Al
150
150
 
151
151
  - `structured_return({ command: "gradle test", parseAs: "junit-xml", artifactPaths: ["build/test-results/test/TEST-*.xml"] })` — full test suite; results aggregated across all matched files
152
152
  - `structured_return({ command: "gradle test --tests 'com.example.FooTest'", parseAs: "junit-xml", artifactPaths: ["build/test-results/test/TEST-*.xml"] })` — single class; glob still works (matches the one file)
153
- - For multi-module projects: `structured_return({ command: "gradle :module:test", parseAs: "junit-xml", artifactPaths: ["module/build/test-results/test/TEST-*.xml"] })` — scope the glob to the module's build dir
153
+ - For multi-module projects, use `*` in directory positions to match across modules: `structured_return({ command: "gradle test", parseAs: "junit-xml", artifactPaths: ["*/build/test-results/test/TEST-*.xml"] })` — or scope to one module: `structured_return({ command: "gradle :module:test", parseAs: "junit-xml", artifactPaths: ["module/build/test-results/test/TEST-*.xml"] })`
154
154
 
155
155
  #### Maven
156
156
 
157
157
  Maven Surefire writes one XML per test class — same as Gradle. Always use a glob pattern.
158
158
 
159
159
  - `structured_return({ command: "mvn test", parseAs: "junit-xml", artifactPaths: ["target/surefire-reports/TEST-*.xml"] })` — full test suite; any maven args (e.g. `-pl module`, `-Dtest=ClassName`) go before `test`
160
- - For multi-module projects: `structured_return({ command: "mvn test -pl module", parseAs: "junit-xml", artifactPaths: ["module/target/surefire-reports/TEST-*.xml"] })` — scope the glob to the module
160
+ - For multi-module projects, use `*` in directory positions: `structured_return({ command: "mvn test", parseAs: "junit-xml", artifactPaths: ["*/target/surefire-reports/TEST-*.xml"] })` — or scope to one module: `structured_return({ command: "mvn test -pl module", parseAs: "junit-xml", artifactPaths: ["module/target/surefire-reports/TEST-*.xml"] })`
161
161
 
162
162
  #### .NET / xUnit
163
163