claudekit-cli 3.36.0-dev.8 → 3.36.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/README.md CHANGED
@@ -9,8 +9,9 @@ Command-line tool and web dashboard for managing ClaudeKit projects.
9
9
  ClaudeKit Config UI (`ck`) provides both CLI and web dashboard for managing ClaudeKit projects. Built with Bun, TypeScript, and React, enables fast, secure project setup and comprehensive configuration management.
10
10
 
11
11
  **Key Features:**
12
- - **CLI Commands (14)**: new, init, config, projects, setup, skills, agents, commands, migrate, doctor, versions, update, uninstall, easter-egg
12
+ - **CLI Commands (16)**: new, init, config, projects, setup, skills, agents, commands, migrate, doctor, versions, update, uninstall, watch, content, easter-egg
13
13
  - **Web Dashboard**: Interactive React UI via `ck config ui` for configuration and project management
14
+ - **Hook Diagnostics Dashboard**: Inspect recent Claude hook activity and failures from `ck config` across global and project scopes
14
15
  - **Projects Registry**: Centralized registry at `~/.claudekit/projects.json` with file locking
15
16
  - **Skill Installation**: Install ClaudeKit skills to other coding agents (Cursor, Codex, etc.)
16
17
  - **Multi-tier Authentication**: gh CLI → env vars → keychain → prompt fallback
@@ -32,6 +33,8 @@ Comprehensive documentation in `/docs`:
32
33
  - **[Code Standards](./docs/code-standards.md)** - Coding conventions, best practices
33
34
  - **[Project Roadmap](./docs/project-roadmap.md)** - Release timeline, feature status
34
35
  - **[Deployment Guide](./docs/deployment-guide.md)** - Release procedures
36
+ - **[ck watch](./docs/ck-watch.md)** - GitHub issue monitoring daemon
37
+ - **[ck content](./docs/ck-content.md)** - Automated content generation from git activity
35
38
 
36
39
  ## Prerequisites
37
40
 
@@ -306,6 +309,64 @@ ck uninstall --yes # Non-interactive - skip confirmation (for scripts)
306
309
 
307
310
  **Note:** Only removes valid ClaudeKit installations (with metadata.json). Regular `.claude` directories from Claude Desktop are not affected.
308
311
 
312
+ ### Watch GitHub Issues (`ck watch`)
313
+
314
+ Autonomous daemon that monitors GitHub issues, analyzes them with Claude, generates plans, and creates PRs.
315
+
316
+ ```bash
317
+ # Start watching (single repo)
318
+ ck watch
319
+
320
+ # Dry-run mode (no posts/PRs)
321
+ ck watch --dry-run
322
+
323
+ # Custom poll interval (ms)
324
+ ck watch --interval 60000
325
+
326
+ # Force restart (clear state)
327
+ ck watch --force
328
+
329
+ # Verbose logging
330
+ ck watch --verbose
331
+ ```
332
+
333
+ **Features:** issue lifecycle management (10 statuses), Claude-powered brainstorming/planning, automatic PR creation, rate limiting (persisted across restarts), maintainer reply filtering, processedIssues TTL, optional git worktree isolation per issue, multi-repo support, graceful shutdown.
334
+
335
+ **Config:** `.ck.json` under `watch` key. See [docs/ck-watch.md](./docs/ck-watch.md) for full configuration reference.
336
+
337
+ ### Content Generation (`ck content`)
338
+
339
+ Daemon that scans git activity (commits, PRs, tags), generates social media content with Claude, and publishes to X/Twitter and Facebook.
340
+
341
+ ```bash
342
+ # Interactive setup wizard
343
+ ck content setup
344
+
345
+ # Start daemon
346
+ ck content start
347
+
348
+ # Check status
349
+ ck content status
350
+
351
+ # View logs
352
+ ck content logs
353
+
354
+ # Queue manual content
355
+ ck content queue
356
+
357
+ # Review workflow
358
+ ck content approve <id>
359
+ ck content reject <id>
360
+
361
+ # Dry-run / verbose
362
+ ck content start --dry-run
363
+ ck content start --verbose
364
+ ```
365
+
366
+ **Features:** 11-phase pipeline (scan → filter → classify → context → create → validate → review → photo → publish → engage → analyze), noise filtering, context caching (24h TTL), content validation, photo generation, 3 review modes (auto/manual/hybrid), quiet hours scheduling, engagement tracking, SQLite database, platform-specific adapters.
367
+
368
+ **Config:** `.ck.json` under `content` key. See [docs/ck-content.md](./docs/ck-content.md) for full configuration reference.
369
+
309
370
  ### Other Commands
310
371
 
311
372
  ```bash
package/bin/ck.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * This is the entry point that NPM symlinks to when installing globally.
7
7
  */
8
8
 
9
- import { spawn } from "node:child_process";
9
+ import { execSync, spawn, spawnSync } from "node:child_process";
10
10
  import { existsSync } from "node:fs";
11
11
  import { dirname, join } from "node:path";
12
12
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -48,7 +48,56 @@ const getErrorMessage = (err) => {
48
48
  };
49
49
 
50
50
  /**
51
- * Run CLI via Node.js as fallback (slower but works on all platforms).
51
+ * Check if bun runtime is available on the system.
52
+ * Used to run dist/index.js with bun when no platform binary exists (e.g., dev releases).
53
+ * dist/index.js may contain bun-specific imports (bun:sqlite) that Node.js can't handle.
54
+ * Result is cached to avoid repeated execSync calls across fallback paths.
55
+ */
56
+ let _bunAvailable = undefined;
57
+ const hasBun = () => {
58
+ if (_bunAvailable !== undefined) return _bunAvailable;
59
+ try {
60
+ execSync("bun --version", { stdio: "ignore", timeout: 3000 });
61
+ _bunAvailable = true;
62
+ } catch {
63
+ _bunAvailable = false;
64
+ }
65
+ return _bunAvailable;
66
+ };
67
+
68
+ /**
69
+ * Run CLI via bun runtime. Preferred over Node.js when dist/index.js contains
70
+ * bun-specific imports (e.g., bun:sqlite) that the Node.js ESM loader rejects.
71
+ * Uses spawnSync to hand full terminal control to bun — this prevents Unicode
72
+ * rendering issues (garbled @clack/prompts box-drawing chars) that occur when
73
+ * bun runs as an async child of a Node.js parent process.
74
+ * @param {boolean} showWarning - Whether to show runtime info message
75
+ * @returns {boolean} true if bun ran successfully, false if spawn failed
76
+ */
77
+ const runWithBun = (showWarning = false) => {
78
+ const distPath = join(__dirname, "..", "dist", "index.js");
79
+ if (!existsSync(distPath)) {
80
+ throw new Error("Compiled distribution not found. This may indicate a packaging issue.");
81
+ }
82
+ if (showWarning) {
83
+ console.error("⚠️ Native binary not found, using bun runtime");
84
+ }
85
+ const result = spawnSync("bun", [distPath, ...process.argv.slice(2)], {
86
+ stdio: "inherit",
87
+ windowsHide: true,
88
+ });
89
+ if (result.error) {
90
+ // bun spawn failed (e.g., ENOENT) — caller handles fallback
91
+ return false;
92
+ }
93
+ if (result.signal) {
94
+ process.kill(process.pid, result.signal);
95
+ }
96
+ process.exit(result.status || 0);
97
+ };
98
+
99
+ /**
100
+ * Run CLI via Node.js as last-resort fallback (slower, no bun: protocol support).
52
101
  * The imported dist/index.js handles its own process lifecycle via the cac CLI framework.
53
102
  * @param {boolean} showWarning - Whether to show fallback warning message
54
103
  * @throws {Error} If dist/index.js is missing or fails to load
@@ -115,17 +164,29 @@ const runBinary = (binaryPath) => {
115
164
 
116
165
  child.on("error", async (err) => {
117
166
  // Binary execution failed (e.g., ENOENT on Alpine/musl due to missing glibc)
118
- // Fall back to Node.js execution
167
+ // Fall back to bun (exits process on success), then Node.js
119
168
  errorOccurred = true;
169
+ if (hasBun()) {
170
+ // runWithBun calls process.exit() on success — won't return here
171
+ runWithBun(true);
172
+ }
120
173
  try {
121
174
  await runWithNode(true);
122
175
  resolve();
123
176
  } catch (fallbackErr) {
177
+ const fallbackMsg = getErrorMessage(fallbackErr);
124
178
  console.error(`❌ Binary failed: ${getErrorMessage(err)}`);
125
- console.error(`❌ Fallback also failed: ${getErrorMessage(fallbackErr)}`);
126
- console.error(
127
- "Please report this issue at: https://github.com/mrgoonie/claudekit-cli/issues",
128
- );
179
+ console.error(`❌ Fallback also failed: ${fallbackMsg}`);
180
+ if (fallbackMsg.includes("bun:") || fallbackMsg.includes("Received protocol")) {
181
+ console.error("");
182
+ console.error("This version of ClaudeKit CLI requires the bun runtime.");
183
+ console.error("Install bun: curl -fsSL https://bun.sh/install | bash");
184
+ console.error("Or switch to stable: npm install -g claudekit-cli@latest");
185
+ } else {
186
+ console.error(
187
+ "Please report this issue at: https://github.com/mrgoonie/claudekit-cli/issues",
188
+ );
189
+ }
129
190
  process.exit(1);
130
191
  }
131
192
  });
@@ -148,16 +209,29 @@ const runBinary = (binaryPath) => {
148
209
  };
149
210
 
150
211
  /**
151
- * Handle fallback execution with error reporting
152
- * @param {string} errorPrefix - Prefix for error message if fallback fails
212
+ * Handle fallback execution: try bun first (handles bun: imports), then Node.js.
213
+ * @param {string} errorPrefix - Prefix for error message if all fallbacks fail
153
214
  * @param {boolean} showIssueLink - Whether to show issue reporting link
154
215
  */
155
216
  const handleFallback = async (errorPrefix, showIssueLink = false) => {
217
+ // Prefer bun — dist/index.js may contain bun-specific imports (bun:sqlite)
218
+ // runWithBun calls process.exit() on success — won't return here
219
+ if (hasBun()) {
220
+ runWithBun(true);
221
+ }
222
+ // Last resort: Node.js (works for stable builds without bun: imports)
156
223
  try {
157
224
  await runWithNode();
158
225
  } catch (err) {
159
- console.error(`❌ ${errorPrefix}: ${getErrorMessage(err)}`);
160
- if (showIssueLink) {
226
+ const errMsg = getErrorMessage(err);
227
+ console.error(`❌ ${errorPrefix}: ${errMsg}`);
228
+ // Detect bun-specific import failures and guide user to install bun
229
+ if (errMsg.includes("bun:") || errMsg.includes("Received protocol")) {
230
+ console.error("");
231
+ console.error("This version of ClaudeKit CLI requires the bun runtime.");
232
+ console.error("Install bun: curl -fsSL https://bun.sh/install | bash");
233
+ console.error("Or switch to stable: npm install -g claudekit-cli@latest");
234
+ } else if (showIssueLink) {
161
235
  console.error(
162
236
  "Please report this issue at: https://github.com/mrgoonie/claudekit-cli/issues",
163
237
  );