great-cto 2.21.0 → 2.22.0

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/bootstrap.js CHANGED
@@ -68,18 +68,6 @@ jurisdiction: [${jurisdictionLine}]
68
68
  > Supported codes: eu · us · us-ca · uk · in · br · au · sg
69
69
  > See docs/jurisdiction-compliance.md for what each code activates.
70
70
 
71
- ## Leash
72
-
73
- leash:
74
- tenant_id: ${slugifyTenant(title)}
75
- daily_cap_usd: 10
76
- session_prefix: gcto
77
-
78
- > \`leash.tenant_id\` is sent as \`X-LLM-Leash-Tenant-Id\` on every LLM call
79
- > through the proxy. Board's Security tab scopes stats to the active project
80
- > via this id. Change here if multiple repos share the same logical project.
81
- > \`session_prefix\` is prepended to auto-generated session ids so logs are
82
- > easy to filter across machines.
83
71
 
84
72
  ## Memory & Query Rule
85
73
 
package/dist/main.js CHANGED
@@ -23,7 +23,6 @@ import { shouldUseLlmFallback, suggestArchetypeFromLlm } from "./llm-fallback.js
23
23
  import { readFileSync, copyFileSync, chmodSync, existsSync as fsExistsSync } from "node:fs";
24
24
  import { dirname, join } from "node:path";
25
25
  import { fileURLToPath } from "node:url";
26
- import { homedir } from "node:os";
27
26
  function getCliVersion() {
28
27
  try {
29
28
  const here = dirname(fileURLToPath(import.meta.url));
@@ -98,8 +97,6 @@ function parseArgs(argv) {
98
97
  args.command = "webhook";
99
98
  else if (a === "report")
100
99
  args.command = "report";
101
- else if (a === "leash")
102
- args.command = "leash";
103
100
  else if (a === "upgrade")
104
101
  args.command = "upgrade";
105
102
  // Slash-commands surfaced as CLI subcommands so users get a clear hint
@@ -119,9 +116,7 @@ function parseArgs(argv) {
119
116
  else if (a === "--dir")
120
117
  args.dir = argv[++i] ?? args.dir;
121
118
  else if (a === "init" || a === "install" || a === "help" || a === "version") {
122
- // `install` is an alias for `init`. Both run the same flow; only
123
- // difference: `install` upgrades llm-leash to latest on every run,
124
- // while `init` is silent-skip when already installed.
119
+ // `install` is an alias for `init`. Both run the same flow.
125
120
  args.command = (a === "install" ? "init" : a);
126
121
  if (a === "install") {
127
122
  args._fromInstall = true;
@@ -359,8 +354,8 @@ function printHelp() {
359
354
  log(`${bold("great-cto")} — one-command install for the great_cto Claude Code plugin
360
355
 
361
356
  ${bold("Usage:")}
362
- npx great-cto install [options] Same as init; also upgrades llm-leash
363
- npx great-cto [init] [options] Detect + bootstrap; installs llm-leash if absent
357
+ npx great-cto install [options] Same as init
358
+ npx great-cto [init] [options] Detect + bootstrap
364
359
  npx great-cto board [--port 3141] [--no-open]
365
360
  npx great-cto register [--dir PATH]
366
361
  npx great-cto scan [path] [--severity LVL] [--scanner NAME] [--sarif FILE]
@@ -800,12 +795,6 @@ async function runInit(args) {
800
795
  }
801
796
  // ── 6. install pre-push git hook ─────────────────────────
802
797
  installPrePushHook(args.dir);
803
- // ── 7. install / update llm-leash (runtime governance) ───
804
- // `init` is idempotent (silent skip when present). `install` always
805
- // upgrades to the latest commit on llm-leash main. Both best-effort:
806
- // missing git/python doesn't fail the flow.
807
- const fromInstall = args._fromInstall === true;
808
- await tryInstallLeash(fromInstall);
809
798
  // ── done ─────────────────────────────────────────────────
810
799
  log("");
811
800
  log(green(bold("✓ great_cto is ready.")));
@@ -851,41 +840,6 @@ function installPrePushHook(projectDir) {
851
840
  // Best-effort: hook failure must never block init
852
841
  }
853
842
  }
854
- /**
855
- * Best-effort llm-leash install — runs after bootstrap so every great-cto
856
- * init turns on runtime governance for free.
857
- *
858
- * forceUpdate=false (called from `init`) — silent-skip if installed
859
- * forceUpdate=true (called from `install`) — git pull + reinstall
860
- *
861
- * Never throws. Opt out via env: GREAT_CTO_SKIP_LEASH=1
862
- */
863
- async function tryInstallLeash(forceUpdate = false) {
864
- if (process.env.GREAT_CTO_SKIP_LEASH === "1") {
865
- log(` ${dim("skipped llm-leash install (GREAT_CTO_SKIP_LEASH=1)")}`);
866
- return;
867
- }
868
- try {
869
- const { runLeash } = await import("./leash.js");
870
- const { existsSync } = await import("node:fs");
871
- const installRoot = join(homedir(), ".great_cto", "llm-leash");
872
- if (existsSync(installRoot)) {
873
- if (forceUpdate) {
874
- log(` ${dim("updating llm-leash to latest …")}`);
875
- await runLeash(["update"]);
876
- }
877
- else {
878
- log(` ${dim("llm-leash already installed — skipped")}`);
879
- }
880
- return;
881
- }
882
- log(` ${dim("installing llm-leash (runtime governance) …")}`);
883
- await runLeash(["install"]);
884
- }
885
- catch {
886
- warn("llm-leash install failed — run `great-cto leash install` manually later");
887
- }
888
- }
889
843
  async function runUpgrade(rawArgv) {
890
844
  const { upgradePlugin, upgradeAll } = await import("./upgrade.js");
891
845
  const { COMPANION_PLUGINS } = await import("./companion.js");
@@ -1043,19 +997,6 @@ async function main() {
1043
997
  process.exit(2);
1044
998
  }
1045
999
  }
1046
- if (args.command === "leash") {
1047
- try {
1048
- const { runLeash } = await import("./leash.js");
1049
- // rawArgv[0] is "leash" — pass the rest as subcommand + flags
1050
- const leashArgs = rawArgv.slice(rawArgv.indexOf("leash") + 1);
1051
- const result = await runLeash(leashArgs);
1052
- process.exit(result.exitCode);
1053
- }
1054
- catch (e) {
1055
- error(e.message);
1056
- process.exit(2);
1057
- }
1058
- }
1059
1000
  if (args.command === "upgrade") {
1060
1001
  try {
1061
1002
  const code = await runUpgrade(rawArgv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "great-cto",
3
- "version": "2.21.0",
3
+ "version": "2.22.0",
4
4
  "description": "One command install for the great_cto Claude Code plugin. Auto-detects your stack, picks the right archetype, bootstraps PROJECT.md.",
5
5
  "keywords": [
6
6
  "claude-code",
package/postinstall.mjs CHANGED
@@ -1,86 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * great-cto postinstall — best-effort one-time setup that runs when the npm
4
- * package is installed globally or as a dependency.
5
- *
6
- * Currently does one thing: install llm-leash (https://github.com/avelikiy/llm-leash)
7
- * for runtime governance — budget caps, audit log, kill switch, HITL gates.
8
- *
9
- * Design rules:
10
- * - NEVER fail the npm install. All errors swallowed.
11
- * - Idempotent — skips if ~/.great_cto/llm-leash already cloned.
12
- * - Honors GREAT_CTO_SKIP_LEASH=1 to opt out (CI envs, restricted machines).
13
- * - Skips on CI by default unless GREAT_CTO_FORCE_LEASH=1 — npm install in
14
- * CI shouldn't trigger 30s of git clone + pip install per build.
15
- * - Skips if `npm install` was invoked with --ignore-scripts (npm sets
16
- * `npm_config_ignore_scripts=true` — actually no, it just doesn't run
17
- * scripts; we can't detect it from inside).
18
- * - Detached output — postinstall noise is intentional and short.
19
- *
20
- * The "real" install path remains `great-cto leash install`. This hook just
21
- * makes the common case (one-shot `npm install -g great-cto`) feel zero-config.
3
+ * great-cto postinstall — no-op placeholder.
4
+ * Reserved for future setup steps; currently does nothing.
22
5
  */
23
-
24
- import { existsSync } from 'node:fs';
25
- import { spawnSync } from 'node:child_process';
26
- import { homedir } from 'node:os';
27
- import path from 'node:path';
28
-
29
- const INSTALL_ROOT = path.join(homedir(), '.great_cto', 'llm-leash');
30
-
31
- function main() {
32
- // ── opt-outs ─────────────────────────────────────────────────────────────
33
- if (process.env.GREAT_CTO_SKIP_LEASH === '1') {
34
- return; // silent
35
- }
36
-
37
- // Skip in CI unless explicitly forced — CI builds get no benefit from
38
- // having leash installed in the runner's home dir, and the latency hurts.
39
- const inCI = process.env.CI === 'true' || process.env.CI === '1';
40
- if (inCI && process.env.GREAT_CTO_FORCE_LEASH !== '1') {
41
- return;
42
- }
43
-
44
- // Already installed — fast exit
45
- if (existsSync(INSTALL_ROOT)) {
46
- return;
47
- }
48
-
49
- // Need git + python3 — bail silently if either is missing
50
- if (!hasCommand('git') || !hasCommand('python3')) {
51
- console.log('[great-cto] llm-leash skipped — git or python3 not on PATH');
52
- console.log('[great-cto] run `great-cto leash install` later to enable runtime governance');
53
- return;
54
- }
55
-
56
- // Locate the bundled dist/main.js — postinstall runs with cwd=package root
57
- const here = path.dirname(new URL(import.meta.url).pathname);
58
- const cli = path.join(here, 'dist', 'main.js');
59
- if (!existsSync(cli)) {
60
- return; // package built incorrectly — fail-safe
61
- }
62
-
63
- console.log('[great-cto] installing llm-leash for runtime governance (~30s) …');
64
- console.log('[great-cto] opt out next time: GREAT_CTO_SKIP_LEASH=1 npm install -g great-cto');
65
-
66
- const result = spawnSync(process.execPath, [cli, 'leash', 'install'], {
67
- stdio: 'inherit',
68
- timeout: 300_000,
69
- env: { ...process.env, NO_COLOR: process.env.NO_COLOR || '1' },
70
- });
71
-
72
- if (result.status !== 0) {
73
- console.log('[great-cto] llm-leash install hit an issue — run `great-cto leash install` later');
74
- }
75
- }
76
-
77
- function hasCommand(cmd) {
78
- try {
79
- const r = spawnSync(cmd, ['--version'], { stdio: 'ignore', timeout: 3000 });
80
- return r.status === 0;
81
- } catch {
82
- return false;
83
- }
84
- }
85
-
86
- try { main(); } catch { /* never fail npm install */ }