@driftless-sh/cli 0.1.36 → 0.1.37

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
@@ -217,9 +217,22 @@ var require_identity = __commonJS({
217
217
  return "";
218
218
  }
219
219
  }
220
+ function findPackageJson(startPath) {
221
+ let dir = startPath;
222
+ for (let i = 0; i < 4; i++) {
223
+ const candidate = node_path_1.default.join(dir, "package.json");
224
+ if (node_fs_1.default.existsSync(candidate))
225
+ return candidate;
226
+ const parent = node_path_1.default.dirname(dir);
227
+ if (parent === dir)
228
+ break;
229
+ dir = parent;
230
+ }
231
+ return null;
232
+ }
220
233
  function detectFramework(fileNames, rootPath, cache) {
221
- const pkgPath = node_path_1.default.join(rootPath, "package.json");
222
- const pkgContent = readFileCached(pkgPath, cache);
234
+ const pkgPath = findPackageJson(rootPath);
235
+ const pkgContent = pkgPath ? readFileCached(pkgPath, cache) : "";
223
236
  if (pkgContent) {
224
237
  try {
225
238
  const pkg = JSON.parse(pkgContent);
@@ -213318,15 +213331,16 @@ var require_nestjs_extractor = __commonJS({
213318
213331
  var typescript_1 = __importDefault(require_typescript());
213319
213332
  function discoverFiles(rootPath) {
213320
213333
  const files = [];
213321
- const srcDir = node_path_1.default.join(rootPath, "src");
213334
+ const srcDir = node_fs_1.default.existsSync(node_path_1.default.join(rootPath, "src")) ? node_path_1.default.join(rootPath, "src") : rootPath;
213322
213335
  if (!node_fs_1.default.existsSync(srcDir))
213323
213336
  return files;
213337
+ const SKIP = /* @__PURE__ */ new Set(["node_modules", "dist", ".next", "build", ".turbo", "coverage"]);
213324
213338
  function walk(dir) {
213325
213339
  const entries = node_fs_1.default.readdirSync(dir, { withFileTypes: true });
213326
213340
  for (const entry of entries) {
213327
213341
  const full = node_path_1.default.join(dir, entry.name);
213328
213342
  if (entry.isDirectory()) {
213329
- if (entry.name === "node_modules" || entry.name === "dist" || entry.name === ".next" || entry.name === "build" || entry.name === ".turbo" || entry.name === "coverage")
213343
+ if (SKIP.has(entry.name))
213330
213344
  continue;
213331
213345
  walk(full);
213332
213346
  } else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts") && !entry.name.endsWith(".spec.ts") && !entry.name.endsWith(".test.ts")) {
@@ -213590,7 +213604,7 @@ var require_nestjs_extractor = __commonJS({
213590
213604
  function isInSourceDir(filePath) {
213591
213605
  if (filePath.includes("node_modules") || filePath.includes("/dist/"))
213592
213606
  return false;
213593
- return filePath.startsWith("src/") || filePath.includes("/src/");
213607
+ return filePath.startsWith("src/") || filePath.includes("/src/") || !filePath.startsWith("..");
213594
213608
  }
213595
213609
  var HTTP_METHODS = {
213596
213610
  Get: "GET",
@@ -214567,7 +214581,7 @@ async function installSkillCommand() {
214567
214581
  // src/commands/init.ts
214568
214582
  function getVersion() {
214569
214583
  try {
214570
- return "0.1.36";
214584
+ return "0.1.37";
214571
214585
  } catch {
214572
214586
  return "0.0.0";
214573
214587
  }
@@ -216040,17 +216054,18 @@ async function resolveRepo() {
216040
216054
  workspaceSlug = me?.slug;
216041
216055
  } catch {
216042
216056
  }
216043
- if (!workspaceSlug) return { ok: false, reason: "no_workspace", remote };
216044
- let repo;
216057
+ const slug = workspaceSlug ?? remote.org;
216058
+ let repos = null;
216045
216059
  try {
216046
- const repos = await api.get(`/workspaces/${workspaceSlug}/repos`);
216047
- repo = repos.find((r) => r.github_org === remote.org && r.github_repo === remote.repo);
216060
+ repos = await api.get(`/workspaces/${slug}/repos`);
216048
216061
  } catch {
216049
216062
  }
216050
- if (!repo) return { ok: false, reason: "not_linked", workspaceSlug, remote };
216063
+ if (!repos) return { ok: false, reason: "no_workspace", remote };
216064
+ const repo = repos.find((r) => r.github_org === remote.org && r.github_repo === remote.repo);
216065
+ if (!repo) return { ok: false, reason: "not_linked", workspaceSlug: slug, remote };
216051
216066
  return {
216052
216067
  ok: true,
216053
- workspaceSlug,
216068
+ workspaceSlug: slug,
216054
216069
  repoId: repo.id,
216055
216070
  remote,
216056
216071
  hasScanBaseline: !!repo.scan_summary
@@ -216374,7 +216389,7 @@ function pad2(s, n) {
216374
216389
  }
216375
216390
 
216376
216391
  // src/index.ts
216377
- var VERSION = "0.1.36";
216392
+ var VERSION = "0.1.37";
216378
216393
  var HELP_TEXT = `Driftless CLI v${VERSION} \u2014 Living repo context for humans and coding agents
216379
216394
 
216380
216395
  Install: npm install -g @driftless-sh/cli