komplian 0.3.6 → 0.3.8

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/README.md CHANGED
@@ -6,7 +6,8 @@
6
6
  2. Browser login: `gh auth login -h github.com -s repo -s read:org -w`
7
7
  3. `npx komplian onboard --yes`
8
8
 
9
- No OAuth App registration — `gh` uses GitHub’s built-in flow. Default workspace: `~/komplian`.
9
+ No OAuth App registration — `gh` uses GitHub’s built-in flow. **Default workspace:** current working directory (`process.cwd()`), not `~/komplian`. Pass a path as last argument to clone elsewhere.
10
+ **Dependencies:** repos with `package-lock.json` use **`npm ci`** (does not modify the lockfile, so no spurious git changes). Repos without a lockfile use **`npm install --no-package-lock`** so onboarding does not create a new `package-lock.json`. Yarn / pnpm repos use frozen lock installs when `yarn` / `pnpm` is on PATH. Unless `KOMPLIAN_NPM_AUDIT=1`, npm runs with `--no-audit --no-fund`.
10
11
 
11
12
  **Maintainers:** publish from **`scripts/`** (folder with `package.json`), not the monorepo root:
12
13
 
@@ -304,24 +304,91 @@ function copyCursorPack(workspace, cursorRepoUrl) {
304
304
  );
305
305
  }
306
306
 
307
- function npmInstallEach(workspace) {
308
- log("");
309
- log(`${c.cyan}━━ npm install por repo ━━${c.reset}`);
307
+ /** Sin esto, `npm install` crea o retoca package-lock.json y git muestra cambios sin querer. */
308
+ function npmQuietFlags() {
309
+ const audit =
310
+ process.env.KOMPLIAN_NPM_AUDIT === "1" || process.env.KOMPLIAN_NPM_AUDIT === "true";
311
+ return audit ? [] : ["--no-audit", "--no-fund"];
312
+ }
313
+
314
+ function npmInstallOneRepo(dir, name) {
315
+ const pkg = join(dir, "package.json");
316
+ if (!existsSync(pkg)) return { ok: true, skipped: true };
317
+
318
+ const yarnLock = join(dir, "yarn.lock");
319
+ const pnpmLock = join(dir, "pnpm-lock.yaml");
320
+ const npmLock = join(dir, "package-lock.json");
321
+
322
+ if (existsSync(yarnLock)) {
323
+ if (!canRun("yarn", ["--version"])) {
324
+ log(
325
+ `${c.yellow}○${c.reset} ${name} ${c.dim}(yarn.lock; instala yarn o ejecuta yarn install a mano)${c.reset}`
326
+ );
327
+ return { ok: true, skipped: true };
328
+ }
329
+ log(`${c.dim}→${c.reset} ${name} ${c.dim}(yarn)${c.reset}`);
330
+ const r = spawnSync(
331
+ "yarn",
332
+ ["install", "--frozen-lockfile"],
333
+ spawnWin({ cwd: dir, stdio: "inherit" })
334
+ );
335
+ return { ok: r.status === 0, skipped: false };
336
+ }
337
+
338
+ if (existsSync(pnpmLock)) {
339
+ if (!canRun("pnpm", ["--version"])) {
340
+ log(
341
+ `${c.yellow}○${c.reset} ${name} ${c.dim}(pnpm-lock; instala pnpm o pnpm install a mano)${c.reset}`
342
+ );
343
+ return { ok: true, skipped: true };
344
+ }
345
+ log(`${c.dim}→${c.reset} ${name} ${c.dim}(pnpm)${c.reset}`);
346
+ const r = spawnSync(
347
+ "pnpm",
348
+ ["install", "--frozen-lockfile"],
349
+ spawnWin({ cwd: dir, stdio: "inherit" })
350
+ );
351
+ return { ok: r.status === 0, skipped: false };
352
+ }
353
+
310
354
  if (!canRun("npm", ["--version"])) {
311
- log(`${c.yellow}○${c.reset} npm no está en PATH — omito installs`);
312
- return;
355
+ log(`${c.yellow}○${c.reset} npm no está en PATH — omito ${name}`);
356
+ return { ok: true, skipped: true };
313
357
  }
358
+
359
+ const quiet = npmQuietFlags();
360
+
361
+ if (existsSync(npmLock)) {
362
+ log(`${c.dim}→${c.reset} ${name} ${c.dim}(npm ci — lock sin cambios)${c.reset}`);
363
+ const r = spawnSync("npm", ["ci", ...quiet], spawnWin({ cwd: dir, stdio: "inherit" }));
364
+ if (r.status === 0) return { ok: true, skipped: false };
365
+ log(
366
+ `${c.yellow}○${c.reset} ${name}: npm ci falló (¿lock desincronizado?). ${c.dim}Revisa con npm install en ese repo.${c.reset}`
367
+ );
368
+ return { ok: false, skipped: false };
369
+ }
370
+
371
+ log(`${c.dim}→${c.reset} ${name} ${c.dim}(npm install — sin crear package-lock)${c.reset}`);
372
+ const r = spawnSync(
373
+ "npm",
374
+ ["install", ...quiet, "--no-package-lock"],
375
+ spawnWin({ cwd: dir, stdio: "inherit" })
376
+ );
377
+ return { ok: r.status === 0, skipped: false };
378
+ }
379
+
380
+ function npmInstallEach(workspace) {
381
+ log("");
382
+ log(`${c.cyan}━━ Dependencias por repo ━━${c.reset}`);
314
383
  for (const ent of readdirSync(workspace)) {
315
384
  const d = join(workspace, ent);
316
385
  if (!statSync(d).isDirectory()) continue;
317
- const pkg = join(d, "package.json");
318
- if (!existsSync(pkg)) continue;
319
- log(`${c.dim}→${c.reset} ${ent}`);
320
- const ir = spawnSync("npm", ["install"], spawnWin({ cwd: d, stdio: "inherit" }));
321
- if (ir.status !== 0) {
322
- log(`${c.yellow}○${c.reset} npm install con avisos en ${ent}`);
323
- } else {
386
+ const { ok, skipped } = npmInstallOneRepo(d, ent);
387
+ if (skipped) continue;
388
+ if (ok) {
324
389
  log(`${c.green}✓${c.reset} ${ent}`);
390
+ } else {
391
+ log(`${c.yellow}○${c.reset} ${ent}`);
325
392
  }
326
393
  }
327
394
  }
@@ -334,6 +401,7 @@ function usage() {
334
401
  log(` Requisitos: Node 18+, git, GitHub CLI (gh)`);
335
402
  log(``);
336
403
  log(` onboard implica --install salvo --no-install`);
404
+ log(` [carpeta] Destino (por defecto: directorio actual, no ~/komplian)`);
337
405
  log(` -y, --yes Sin menú interactivo (equipo por defecto del JSON)`);
338
406
  log(` -t, --team <slug> Equipo en komplian-team-repos.json`);
339
407
  log(` -i, --install npm install en cada repo con package.json`);
@@ -480,7 +548,7 @@ async function main() {
480
548
 
481
549
  let workspace = args.workspace.trim();
482
550
  if (!workspace) {
483
- workspace = join(homedir(), "komplian");
551
+ workspace = process.cwd();
484
552
  }
485
553
  const abs = resolve(workspace.replace(/^~(?=$|[/\\])/, homedir()));
486
554
  if (!isSafeTargetDir(abs)) {
@@ -514,6 +582,9 @@ async function main() {
514
582
  log(`${c.yellow}○${c.reset} ${failed} repo(s) fallaron — revisa acceso y reintenta.`);
515
583
  }
516
584
  log(`${c.green}✓${c.reset} Cursor: ${c.bold}File → Open Folder → ${abs}${c.reset}`);
585
+ log(
586
+ `${c.dim} Con package-lock.json: npm ci (no retoca el lock). Sin lock: npm install --no-package-lock. yarn/pnpm: lock congelado. KOMPLIAN_NPM_AUDIT=1 activa auditoría en npm.${c.reset}`
587
+ );
517
588
  log(`${c.dim} .env.example → .env por proyecto; secretos en 1Password — nunca commit.${c.reset}`);
518
589
  }
519
590
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "komplian",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "Komplian developer workspace setup: GitHub CLI (browser login) + git clone by team. Node 18+, git, gh — no OAuth App to register.",
5
5
  "type": "module",
6
6
  "engines": {