great-cto 1.0.145 → 1.0.146

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
@@ -3,7 +3,7 @@
3
3
  import { existsSync, mkdirSync, writeFileSync, readFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
5
  import { dim, success, warn } from "./ui.js";
6
- export function bootstrap(dir, detection, archetype, compliance) {
6
+ export function bootstrap(dir, detection, archetype, compliance, detectionMeta) {
7
7
  const greatCtoDir = join(dir, ".great_cto");
8
8
  const projectMd = join(greatCtoDir, "PROJECT.md");
9
9
  if (existsSync(projectMd)) {
@@ -29,10 +29,12 @@ project_size: medium
29
29
  stack: ${stackLine}
30
30
  languages: ${detection.languages.join(", ") || "to be defined"}
31
31
  package-manager: ${detection.packageManager ?? "none"}
32
-
32
+ ${detectionMeta ? `archetype_confidence: ${detectionMeta.confidence}\n` : ""}${detectionMeta && detectionMeta.alternatives.length > 0 ? `archetype_alternatives: [${detectionMeta.alternatives.join(", ")}]\n` : ""}${detectionMeta?.rationale ? `archetype_rationale: ${detectionMeta.rationale.replace(/\n/g, " ")}\n` : ""}
33
33
  > \`archetype:\` drives tier/gate selection (see references/security-tiers.md).
34
34
  > \`project_size:\` is one of nano | small | medium | large | enterprise — agents
35
35
  > scale gate depth accordingly. Edit either if auto-detection got it wrong.
36
+ > \`archetype_confidence:\` is one of high | medium | low | user-specified — when
37
+ > < high, /inbox surfaces a warning so you can override before committing.
36
38
 
37
39
  ## Phase
38
40
 
package/dist/main.js CHANGED
@@ -254,15 +254,44 @@ async function runInit(args) {
254
254
  }
255
255
  }
256
256
  }
257
- // Run skill-discover.sh to build initial registry
257
+ // Run skill-discover.sh to build initial registry.
258
+ // v1.0.146: version-sort properly (semver) and force refresh if registry
259
+ // plugin_version != installed plugin_version (stale cache from prior version).
258
260
  const pluginCacheBase = join(homedir(), ".claude", "plugins", "cache", "local", "great_cto");
259
- const { readdirSync } = await import("node:fs");
261
+ const { readdirSync, readFileSync, unlinkSync } = await import("node:fs");
260
262
  if (existsSync(pluginCacheBase)) {
261
- const versions = readdirSync(pluginCacheBase).sort().reverse();
263
+ const semverCmp = (a, b) => {
264
+ const pa = a.split(".").map(n => parseInt(n, 10) || 0);
265
+ const pb = b.split(".").map(n => parseInt(n, 10) || 0);
266
+ for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
267
+ const d = (pa[i] ?? 0) - (pb[i] ?? 0);
268
+ if (d !== 0)
269
+ return d;
270
+ }
271
+ return 0;
272
+ };
273
+ const versions = readdirSync(pluginCacheBase).sort(semverCmp).reverse();
262
274
  if (versions.length > 0) {
263
- const discover = join(pluginCacheBase, versions[0], "scripts", "skill-discover.sh");
275
+ const latest = versions[0];
276
+ const discover = join(pluginCacheBase, latest, "scripts", "skill-discover.sh");
264
277
  if (existsSync(discover)) {
265
- spawnSync("bash", [discover], { stdio: "ignore", timeout: 15_000 });
278
+ // Force refresh: unlink existing registry if it pins to a different version
279
+ const registryPath = join(greatCtoDir, "skills-registry.json");
280
+ if (existsSync(registryPath)) {
281
+ try {
282
+ const reg = JSON.parse(readFileSync(registryPath, "utf-8"));
283
+ if (reg.plugin_version && reg.plugin_version !== latest) {
284
+ unlinkSync(registryPath);
285
+ log(` ${dim(`registry version mismatch (${reg.plugin_version} → ${latest}) — refreshing`)}`);
286
+ }
287
+ }
288
+ catch { /* malformed — let discover overwrite */ }
289
+ }
290
+ spawnSync("bash", [discover], {
291
+ stdio: "ignore",
292
+ timeout: 15_000,
293
+ env: { ...process.env, PLUGIN_DIR: join(pluginCacheBase, latest) },
294
+ });
266
295
  log(` ${dim("skills registry built at ~/.great_cto/skills-registry.json")}`);
267
296
  }
268
297
  }
@@ -273,7 +302,11 @@ async function runInit(args) {
273
302
  }
274
303
  // ── 5. bootstrap ─────────────────────────────────────────
275
304
  step(5, 5, "bootstrapping .great_cto/PROJECT.md");
276
- const bs = bootstrap(args.dir, detection, archetype, compliance);
305
+ const bs = bootstrap(args.dir, detection, archetype, compliance, {
306
+ confidence,
307
+ alternatives,
308
+ rationale,
309
+ });
277
310
  if (!bs.created) {
278
311
  log(` ${dim("PROJECT.md already exists at")} ${bs.projectMdPath} ${dim("— kept as-is")}`);
279
312
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "great-cto",
3
- "version": "1.0.145",
3
+ "version": "1.0.146",
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",