great-cto 1.0.159 → 1.0.161

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.
Files changed (2) hide show
  1. package/dist/main.js +58 -0
  2. package/package.json +2 -2
package/dist/main.js CHANGED
@@ -51,6 +51,8 @@ function parseArgs(argv) {
51
51
  args.boardNoOpen = true;
52
52
  else if (a === "board")
53
53
  args.command = "board";
54
+ else if (a === "register")
55
+ args.command = "register";
54
56
  else if (a.startsWith("--dir="))
55
57
  args.dir = a.slice("--dir=".length);
56
58
  else if (a === "--dir")
@@ -64,6 +66,46 @@ function parseArgs(argv) {
64
66
  args.dir = resolve(args.dir);
65
67
  return args;
66
68
  }
69
+ async function runRegister(args) {
70
+ const { join } = await import("node:path");
71
+ const { existsSync, readFileSync, writeFileSync, mkdirSync, statSync } = await import("node:fs");
72
+ const { homedir } = await import("node:os");
73
+ const cwd = args.dir;
74
+ const projectMd = join(cwd, ".great_cto", "PROJECT.md");
75
+ if (!existsSync(projectMd)) {
76
+ error(`No .great_cto/PROJECT.md found in ${cwd}`);
77
+ log("Run /audit or /start first inside a Claude Code session to bootstrap the project.");
78
+ return 1;
79
+ }
80
+ const text = readFileSync(projectMd, "utf8");
81
+ const get = (k) => (text.match(new RegExp(`^${k}:\\s*(.+)$`, "m")) || [])[1]?.trim() || "";
82
+ const meta = {
83
+ slug: get("project") || cwd.split("/").pop() || "project",
84
+ archetype: get("archetype") || "web-service",
85
+ description: get("description") || "",
86
+ path: cwd,
87
+ added_at: new Date().toISOString(),
88
+ };
89
+ const dir = join(homedir(), ".great_cto");
90
+ mkdirSync(dir, { recursive: true });
91
+ const f = join(dir, "projects.json");
92
+ let reg = { projects: [] };
93
+ if (existsSync(f)) {
94
+ try {
95
+ reg = JSON.parse(readFileSync(f, "utf8"));
96
+ }
97
+ catch { }
98
+ }
99
+ if (reg.projects.find(p => p.path === meta.path)) {
100
+ log(`✓ Already registered: ${meta.slug} (${cwd})`);
101
+ return 0;
102
+ }
103
+ reg.projects.push(meta);
104
+ writeFileSync(f, JSON.stringify(reg, null, 2));
105
+ log(`✓ Registered: ${meta.slug} (${meta.archetype})`);
106
+ log(` → will appear in great-cto board project switcher`);
107
+ return 0;
108
+ }
67
109
  async function runBoard(args) {
68
110
  const { join, dirname } = await import("node:path");
69
111
  const { fileURLToPath } = await import("node:url");
@@ -111,6 +153,7 @@ function printHelp() {
111
153
  ${bold("Usage:")}
112
154
  npx great-cto [init] [options]
113
155
  npx great-cto board [--port 3141] [--no-open]
156
+ npx great-cto register [--dir PATH]
114
157
  npx great-cto help
115
158
  npx great-cto version
116
159
 
@@ -119,6 +162,11 @@ ${bold("Board:")}
119
162
  great-cto board --port 4000 Use a different port
120
163
  great-cto board --no-open Start server without opening browser
121
164
 
165
+ ${bold("Register:")}
166
+ great-cto register Add this repo to ~/.great_cto/projects.json
167
+ (auto-discovered after /audit or /start, but
168
+ run this if the project doesn't appear in board)
169
+
122
170
  ${bold("Options:")}
123
171
  -y, --yes Skip confirmation prompts (non-interactive)
124
172
  --dry-run Show what would be done without doing it
@@ -410,6 +458,16 @@ async function main() {
410
458
  process.exit(1);
411
459
  }
412
460
  }
461
+ if (args.command === "register") {
462
+ try {
463
+ const code = await runRegister(args);
464
+ process.exit(code);
465
+ }
466
+ catch (e) {
467
+ error(e.message);
468
+ process.exit(1);
469
+ }
470
+ }
413
471
  if (args.command === "version") {
414
472
  // Version resolved in index.mjs or from package.json at runtime
415
473
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "great-cto",
3
- "version": "1.0.159",
3
+ "version": "1.0.161",
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",
@@ -67,7 +67,7 @@
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/node": "22.15.3",
70
- "typescript": "5.8.3"
70
+ "typescript": "^5.8.3"
71
71
  },
72
72
  "engines": {
73
73
  "node": ">=18.17.0"