codekin 0.6.4 → 0.6.5

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 (46) hide show
  1. package/README.md +2 -2
  2. package/bin/codekin.mjs +69 -6
  3. package/dist/assets/{index-BRB_Ksyk.js → index-B0xIzdCK.js} +39 -34
  4. package/dist/index.html +1 -1
  5. package/package.json +3 -3
  6. package/server/dist/claude-process.d.ts +1 -0
  7. package/server/dist/claude-process.js +4 -1
  8. package/server/dist/claude-process.js.map +1 -1
  9. package/server/dist/commit-event-handler.d.ts +14 -1
  10. package/server/dist/commit-event-handler.js +40 -8
  11. package/server/dist/commit-event-handler.js.map +1 -1
  12. package/server/dist/config.d.ts +12 -0
  13. package/server/dist/config.js +24 -0
  14. package/server/dist/config.js.map +1 -1
  15. package/server/dist/orchestrator-children.d.ts +41 -1
  16. package/server/dist/orchestrator-children.js +87 -1
  17. package/server/dist/orchestrator-children.js.map +1 -1
  18. package/server/dist/orchestrator-monitor.js +13 -0
  19. package/server/dist/orchestrator-monitor.js.map +1 -1
  20. package/server/dist/orchestrator-notify.d.ts +29 -0
  21. package/server/dist/orchestrator-notify.js +27 -0
  22. package/server/dist/orchestrator-notify.js.map +1 -0
  23. package/server/dist/orchestrator-session-router.js +3 -0
  24. package/server/dist/orchestrator-session-router.js.map +1 -1
  25. package/server/dist/session-lifecycle.d.ts +1 -0
  26. package/server/dist/session-lifecycle.js +1 -0
  27. package/server/dist/session-lifecycle.js.map +1 -1
  28. package/server/dist/session-manager.d.ts +30 -0
  29. package/server/dist/session-manager.js +105 -6
  30. package/server/dist/session-manager.js.map +1 -1
  31. package/server/dist/session-routes.js +4 -1
  32. package/server/dist/session-routes.js.map +1 -1
  33. package/server/dist/tsconfig.tsbuildinfo +1 -1
  34. package/server/dist/upload-routes.js +33 -5
  35. package/server/dist/upload-routes.js.map +1 -1
  36. package/server/dist/workflow-engine.d.ts +1 -0
  37. package/server/dist/workflow-engine.js +25 -12
  38. package/server/dist/workflow-engine.js.map +1 -1
  39. package/server/dist/workflow-loader.js +95 -11
  40. package/server/dist/workflow-loader.js.map +1 -1
  41. package/server/dist/workflow-routes.js +36 -2
  42. package/server/dist/workflow-routes.js.map +1 -1
  43. package/server/dist/ws-message-handler.js +5 -1
  44. package/server/dist/ws-message-handler.js.map +1 -1
  45. package/server/dist/ws-server.js +28 -10
  46. package/server/dist/ws-server.js.map +1 -1
package/README.md CHANGED
@@ -63,8 +63,8 @@ codekin uninstall # Remove Codekin entirely
63
63
  - **Subscription & API key auth** — Works with both Claude subscription (OAuth) and API key authentication
64
64
  - **Mobile-friendly** — Responsive layout that works on phones and tablets
65
65
  - **Markdown browser** — Browse and view `.md` files directly in the UI
66
- - **AI Workflows** — Scheduled code and repository audits and maintenance, with support for custom workflows defined as Markdown files; resilient across server restarts with automatic resume of in-flight runs
67
- - **GitHub webhooks** — Automated bugfixing on CI failures and PR code review via webhook integration, with auto-setup wizard for PR Review workflows
66
+ - **AI Workflows** — Scheduled code and repository audits and maintenance, with support for custom workflows defined as Markdown files
67
+ - **GitHub webhooks** — Automated bugfixing on CI failures and PR code review via webhook integration
68
68
  - **Upgrade notifications** — In-app banner when a newer version is available
69
69
 
70
70
  ## Upgrade
package/bin/codekin.mjs CHANGED
@@ -4,6 +4,7 @@
4
4
  *
5
5
  * Usage:
6
6
  * codekin start Run server in foreground
7
+ * codekin stop Stop the running background service
7
8
  * codekin setup First-time setup wizard
8
9
  * codekin service install Install + start background service
9
10
  * codekin service uninstall Remove background service
@@ -216,8 +217,17 @@ ${envEntries}
216
217
  \t</dict>
217
218
  \t<key>RunAtLoad</key>
218
219
  \t<true/>
220
+ \t<!--
221
+ \t KeepAlive as a dict (not <true/>) so a clean exit (e.g. \`codekin stop\`,
222
+ \t which sends SIGTERM and triggers gracefulShutdown → exit(0)) is NOT
223
+ \t respawned. Only crashes (non-zero exit) trigger restart, preserving
224
+ \t the daemon UX without making the process unkillable.
225
+ \t-->
219
226
  \t<key>KeepAlive</key>
220
- \t<true/>
227
+ \t<dict>
228
+ \t\t<key>SuccessfulExit</key>
229
+ \t\t<false/>
230
+ \t</dict>
221
231
  \t<key>StandardOutPath</key>
222
232
  \t<string>${join(homedir(), '.codekin', 'server.log')}</string>
223
233
  \t<key>StandardErrorPath</key>
@@ -253,7 +263,7 @@ function serviceUninstallMac() {
253
263
  return
254
264
  }
255
265
  spawnSync('launchctl', ['unload', LAUNCHD_PLIST], { stdio: 'inherit' })
256
- import('fs').then(fs => fs.unlinkSync(LAUNCHD_PLIST))
266
+ rmSync(LAUNCHD_PLIST, { force: true })
257
267
  console.log('Codekin service removed.')
258
268
  }
259
269
 
@@ -284,7 +294,9 @@ After=network.target
284
294
  Type=simple
285
295
  ExecStart=${runner} ${script}
286
296
  EnvironmentFile=${ENV_FILE}
287
- Restart=always
297
+ # on-failure (not always) so \`codekin stop\` / \`systemctl --user stop\` exits
298
+ # cleanly without an immediate respawn. Crashes still get restarted.
299
+ Restart=on-failure
288
300
  RestartSec=5
289
301
 
290
302
  [Install]
@@ -315,9 +327,7 @@ function serviceInstallLinux() {
315
327
 
316
328
  function serviceUninstallLinux() {
317
329
  spawnSync('systemctl', ['--user', 'disable', '--now', 'codekin'], { stdio: 'inherit' })
318
- if (existsSync(SYSTEMD_SERVICE_FILE)) {
319
- import('fs').then(fs => fs.unlinkSync(SYSTEMD_SERVICE_FILE))
320
- }
330
+ rmSync(SYSTEMD_SERVICE_FILE, { force: true })
321
331
  spawnSync('systemctl', ['--user', 'daemon-reload'], { stdio: 'inherit' })
322
332
  console.log('Codekin service removed.')
323
333
  }
@@ -333,6 +343,56 @@ function serviceStatusLinux() {
333
343
  }
334
344
  }
335
345
 
346
+ // ---------------------------------------------------------------------------
347
+ // Stop (cross-platform)
348
+ // ---------------------------------------------------------------------------
349
+
350
+ function cmdStop() {
351
+ const os = platform()
352
+ if (os === 'darwin') {
353
+ if (!existsSync(LAUNCHD_PLIST)) {
354
+ console.log('Codekin background service is not installed.')
355
+ console.log('If a foreground server is running, switch to its terminal and press Ctrl+C.')
356
+ return
357
+ }
358
+ const result = spawnSync('launchctl', ['unload', LAUNCHD_PLIST], { stdio: 'inherit' })
359
+ if (result.status === 0) {
360
+ // launchctl unload (no -w) takes the agent out of the current session's
361
+ // launchd job list. The plist file stays in ~/Library/LaunchAgents/, so
362
+ // loginwindow loads it again at next user login (which fires RunAtLoad).
363
+ // The user has to take an explicit action to opt out of that.
364
+ console.log('Codekin service stopped (launchctl unload).')
365
+ console.log('Notes:')
366
+ console.log(' - Plist file is still at ' + LAUNCHD_PLIST + '.')
367
+ console.log(' - It will reload automatically at next user login (RunAtLoad re-fires).')
368
+ console.log(' - To resume now without waiting: launchctl load ' + LAUNCHD_PLIST)
369
+ console.log(' - To stop permanently (no auto-load): codekin service uninstall')
370
+ } else {
371
+ console.error('Failed to stop launchd service.')
372
+ process.exit(1)
373
+ }
374
+ } else if (os === 'linux') {
375
+ if (!existsSync(SYSTEMD_SERVICE_FILE)) {
376
+ console.log('Codekin background service is not installed.')
377
+ console.log('If a foreground server is running, switch to its terminal and press Ctrl+C.')
378
+ return
379
+ }
380
+ const result = spawnSync('systemctl', ['--user', 'stop', 'codekin'], { stdio: 'pipe', encoding: 'utf-8' })
381
+ if (result.status === 0) {
382
+ console.log('Codekin service stopped. The unit remains installed —')
383
+ console.log(' - to start it again: systemctl --user start codekin')
384
+ console.log(' - to remove permanently: codekin service uninstall')
385
+ } else {
386
+ const msg = (result.stderr || '').trim()
387
+ if (msg) console.error(msg)
388
+ process.exit(1)
389
+ }
390
+ } else {
391
+ console.error(`Service stop is not supported on ${os}. Press Ctrl+C in the foreground server's terminal.`)
392
+ process.exit(1)
393
+ }
394
+ }
395
+
336
396
  // ---------------------------------------------------------------------------
337
397
  // Service dispatch
338
398
  // ---------------------------------------------------------------------------
@@ -445,6 +505,8 @@ const cmd = args[0]
445
505
 
446
506
  if (cmd === 'start') {
447
507
  cmdStart()
508
+ } else if (cmd === 'stop') {
509
+ cmdStop()
448
510
  } else if (cmd === 'setup') {
449
511
  await cmdSetup({ regenerate: args.includes('--regenerate') })
450
512
  } else if (cmd === 'config') {
@@ -467,6 +529,7 @@ if (cmd === 'start') {
467
529
 
468
530
  Usage:
469
531
  codekin start Run server in foreground
532
+ codekin stop Stop the running background service
470
533
  codekin setup First-time setup wizard
471
534
  codekin setup --regenerate Regenerate auth token
472
535
  codekin config Update settings