opencode-usage-coach 0.8.4 → 0.8.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.
Files changed (2) hide show
  1. package/dist/index.js +22 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/index.ts
2
2
  import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2, appendFileSync as appendFileSync2, readFileSync as readFileSync2, existsSync as existsSync2 } from "fs";
3
- import { spawn } from "child_process";
3
+ import { spawn, spawnSync } from "child_process";
4
4
  import { createHash } from "crypto";
5
5
  import { homedir } from "os";
6
6
  import { join as join2, resolve, dirname } from "path";
@@ -1359,8 +1359,27 @@ Then: harness_done(). Follow the [usage-coach NEXT] directive each tool returns.
1359
1359
  profile = { skipped: true, reason: "skip_scan requested", language: "unknown", frameworks: [], structure: [], manifestFiles: [], keyDeps: [], configFiles: [], totalFiles: 0 };
1360
1360
  } else {
1361
1361
  try {
1362
- const res = await input.$`find ${ctx.directory} -maxdepth 4 -type f -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/dist/*' -not -path '*/.cache/*' 2>/dev/null`;
1363
- const fileList = typeof res?.stdout === "string" ? res.stdout : res?.stdout?.toString?.() ?? "";
1362
+ const dir = ctx.directory || ".";
1363
+ const result2 = spawnSync("find", [
1364
+ dir,
1365
+ "-maxdepth",
1366
+ "4",
1367
+ "-type",
1368
+ "f",
1369
+ "-not",
1370
+ "-path",
1371
+ "*/node_modules/*",
1372
+ "-not",
1373
+ "-path",
1374
+ "*/.git/*",
1375
+ "-not",
1376
+ "-path",
1377
+ "*/dist/*",
1378
+ "-not",
1379
+ "-path",
1380
+ "*/.cache/*"
1381
+ ], { encoding: "utf8", timeout: 1e4, maxBuffer: 1024 * 1024 });
1382
+ const fileList = result2.stdout || "";
1364
1383
  profile = parseFileList(fileList, ctx.directory);
1365
1384
  if (profile.totalFiles < 5) {
1366
1385
  profile = { ...profile, skipped: true, reason: `directory nearly empty (${profile.totalFiles} files)` };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-usage-coach",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "description": "opencode closed-loop usage coach — quota SENSE -> coaching DECIDE -> loop ACT + TUI integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",