MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / daemonMain

Function daemonMain

src/daemon/main.ts:52–102  ·  view source on GitHub ↗
(args: string[])

Source from the content-addressed store, hash-verified

50 * kill — kill a session
51 */
52export async function daemonMain(args: string[]): Promise<void> {
53 const subcommand = args[0] || 'status'
54
55 switch (subcommand) {
56 // --- Supervisor management ---
57 case 'start':
58 await runSupervisor(args.slice(1))
59 break
60 case 'stop':
61 await handleDaemonStop()
62 break
63
64 // --- Unified status ---
65 case 'status':
66 case 'ps':
67 await showUnifiedStatus()
68 break
69
70 // --- Session management (delegates to bg.ts) ---
71 case 'bg': {
72 const bg = await import('../cli/bg.js')
73 await bg.handleBgStart(args.slice(1))
74 break
75 }
76 case 'attach': {
77 const bg = await import('../cli/bg.js')
78 await bg.attachHandler(args[1])
79 break
80 }
81 case 'logs': {
82 const bg = await import('../cli/bg.js')
83 await bg.logsHandler(args[1])
84 break
85 }
86 case 'kill': {
87 const bg = await import('../cli/bg.js')
88 await bg.killHandler(args[1])
89 break
90 }
91
92 case '--help':
93 case '-h':
94 case 'help':
95 printHelp()
96 break
97 default:
98 console.error(`Unknown daemon subcommand: ${subcommand}`)
99 printHelp()
100 process.exitCode = 1
101 }
102}
103
104function printHelp(): void {
105 console.log(`

Callers 3

callFunction · 0.85
mainFunction · 0.85
daemonMain.test.tsFile · 0.85

Calls 5

runSupervisorFunction · 0.85
handleDaemonStopFunction · 0.85
showUnifiedStatusFunction · 0.85
printHelpFunction · 0.70
errorMethod · 0.65

Tested by

no test coverage detected