komplian 0.3.5 → 0.3.7

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
+ **npm install** runs with `--no-audit --no-fund` unless `KOMPLIAN_NPM_AUDIT=1`. Run `npm audit` in each repo when you work on it.
10
11
 
11
12
  **Maintainers:** publish from **`scripts/`** (folder with `package.json`), not the monorepo root:
12
13
 
@@ -96,7 +96,8 @@ function ghApiJson(path) {
96
96
  function verifyOrgMembership(org) {
97
97
  const enc = encodeURIComponent(org);
98
98
  const mem = ghApiJson(`user/memberships/orgs/${enc}`);
99
- if (mem.status === 200) {
99
+ /** spawnSync().status = código de salida de `gh` (0 = éxito), no código HTTP. */
100
+ if (mem.status === 0) {
100
101
  try {
101
102
  const j = JSON.parse(mem.stdout);
102
103
  if (j.state === "active") return;
@@ -109,7 +110,8 @@ function verifyOrgMembership(org) {
109
110
  process.exit(1);
110
111
  }
111
112
  }
112
- if (mem.status === 404) {
113
+ const hint = (mem.stderr + mem.stdout).toLowerCase();
114
+ if (hint.includes("404") || hint.includes("not found")) {
113
115
  log(
114
116
  `${c.red}✗${c.reset} Esta cuenta ${c.bold}no es miembro${c.reset} de la org ${c.bold}${org}${c.reset}.`
115
117
  );
@@ -118,21 +120,20 @@ function verifyOrgMembership(org) {
118
120
  );
119
121
  process.exit(1);
120
122
  }
121
- const hint = (mem.stderr + mem.stdout).toLowerCase();
122
- if (mem.status === 403 || hint.includes("read:org") || hint.includes("scope")) {
123
+ if (hint.includes("403") || hint.includes("read:org") || hint.includes("scope")) {
123
124
  log(`${c.red}✗${c.reset} Falta scope ${c.bold}read:org${c.reset} en gh.`);
124
125
  log(`${c.dim} gh auth refresh -h github.com -s repo -s read:org${c.reset}`);
125
126
  process.exit(1);
126
127
  }
127
128
  log(
128
- `${c.red}✗${c.reset} No se pudo verificar la org (${mem.status}):\n${c.dim}${(mem.stderr || mem.stdout).trim()}${c.reset}`
129
+ `${c.red}✗${c.reset} No se pudo verificar la org (código ${mem.status}):\n${c.dim}${(mem.stderr || mem.stdout).trim()}${c.reset}`
129
130
  );
130
131
  process.exit(1);
131
132
  }
132
133
 
133
134
  function logGhIdentity() {
134
135
  const u = ghApiJson("user");
135
- if (u.status !== 200) return;
136
+ if (u.status !== 0) return;
136
137
  try {
137
138
  const j = JSON.parse(u.stdout);
138
139
  if (j.login) {
@@ -310,13 +311,18 @@ function npmInstallEach(workspace) {
310
311
  log(`${c.yellow}○${c.reset} npm no está en PATH — omito installs`);
311
312
  return;
312
313
  }
314
+ const audit =
315
+ process.env.KOMPLIAN_NPM_AUDIT === "1" || process.env.KOMPLIAN_NPM_AUDIT === "true";
316
+ const installArgs = audit
317
+ ? ["install"]
318
+ : ["install", "--no-audit", "--no-fund"];
313
319
  for (const ent of readdirSync(workspace)) {
314
320
  const d = join(workspace, ent);
315
321
  if (!statSync(d).isDirectory()) continue;
316
322
  const pkg = join(d, "package.json");
317
323
  if (!existsSync(pkg)) continue;
318
324
  log(`${c.dim}→${c.reset} ${ent}`);
319
- const ir = spawnSync("npm", ["install"], spawnWin({ cwd: d, stdio: "inherit" }));
325
+ const ir = spawnSync("npm", installArgs, spawnWin({ cwd: d, stdio: "inherit" }));
320
326
  if (ir.status !== 0) {
321
327
  log(`${c.yellow}○${c.reset} npm install con avisos en ${ent}`);
322
328
  } else {
@@ -333,6 +339,7 @@ function usage() {
333
339
  log(` Requisitos: Node 18+, git, GitHub CLI (gh)`);
334
340
  log(``);
335
341
  log(` onboard implica --install salvo --no-install`);
342
+ log(` [carpeta] Destino (por defecto: directorio actual, no ~/komplian)`);
336
343
  log(` -y, --yes Sin menú interactivo (equipo por defecto del JSON)`);
337
344
  log(` -t, --team <slug> Equipo en komplian-team-repos.json`);
338
345
  log(` -i, --install npm install en cada repo con package.json`);
@@ -479,7 +486,7 @@ async function main() {
479
486
 
480
487
  let workspace = args.workspace.trim();
481
488
  if (!workspace) {
482
- workspace = join(homedir(), "komplian");
489
+ workspace = process.cwd();
483
490
  }
484
491
  const abs = resolve(workspace.replace(/^~(?=$|[/\\])/, homedir()));
485
492
  if (!isSafeTargetDir(abs)) {
@@ -513,6 +520,9 @@ async function main() {
513
520
  log(`${c.yellow}○${c.reset} ${failed} repo(s) fallaron — revisa acceso y reintenta.`);
514
521
  }
515
522
  log(`${c.green}✓${c.reset} Cursor: ${c.bold}File → Open Folder → ${abs}${c.reset}`);
523
+ log(
524
+ `${c.dim} npm install usa --no-audit --no-fund (menos ruido). Auditoría: cd cada repo y npm audit. KOMPLIAN_NPM_AUDIT=1 para resumen completo.${c.reset}`
525
+ );
516
526
  log(`${c.dim} .env.example → .env por proyecto; secretos en 1Password — nunca commit.${c.reset}`);
517
527
  }
518
528
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "komplian",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
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": {