Skip to content

Commit 6e6b64f

Browse files
committed
Update launchClaudeInNewTerminalWindow to use 'hb ignite' command instead of building complex Claude command
1 parent c49f348 commit 6e6b64f

File tree

2 files changed

+27
-36
lines changed

2 files changed

+27
-36
lines changed

src/utils/claude.test.ts

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ describe('claude utils', () => {
412412
})
413413

414414
describe('launchClaudeInNewTerminalWindow', () => {
415-
it('should open new terminal window with Claude command', async () => {
415+
it('should open new terminal window with hb ignite command', async () => {
416416
const prompt = 'Work on this issue'
417417
const workspacePath = '/path/to/workspace'
418418

@@ -423,7 +423,9 @@ describe('claude utils', () => {
423423

424424
await launchClaudeInNewTerminalWindow(prompt, { workspacePath })
425425

426-
// Verify osascript was called for terminal window
426+
// Verify osascript was called for terminal window with hb ignite command
427+
const applescript = vi.mocked(execa).mock.calls[0][1]?.[1] as string
428+
expect(applescript).toContain('hb ignite')
427429
expect(execa).toHaveBeenCalledWith(
428430
'osascript',
429431
['-e', expect.stringContaining('tell application "Terminal"')]
@@ -450,7 +452,9 @@ describe('claude utils', () => {
450452

451453
await launchClaudeInNewTerminalWindow(prompt, { workspacePath, branchName })
452454

453-
// Verify terminal window was opened
455+
// Verify terminal window was opened with hb ignite
456+
const applescript = vi.mocked(execa).mock.calls[0][1]?.[1] as string
457+
expect(applescript).toContain('hb ignite')
454458
expect(execa).toHaveBeenCalledWith(
455459
'osascript',
456460
['-e', expect.stringContaining('tell application "Terminal"')]
@@ -470,9 +474,10 @@ describe('claude utils', () => {
470474

471475
await launchClaudeInNewTerminalWindow(prompt, { workspacePath })
472476

473-
// Verify .env sourcing is included
477+
// Verify .env sourcing is included and hb ignite is used
474478
const applescript = vi.mocked(execa).mock.calls[0][1]?.[1] as string
475479
expect(applescript).toContain('source .env')
480+
expect(applescript).toContain('hb ignite')
476481
expect(existsSync).toHaveBeenCalledWith('/path/to/workspace/.env')
477482
})
478483

@@ -489,12 +494,13 @@ describe('claude utils', () => {
489494

490495
await launchClaudeInNewTerminalWindow(prompt, { workspacePath })
491496

492-
// Verify .env sourcing is NOT included
497+
// Verify .env sourcing is NOT included but hb ignite is used
493498
const applescript = vi.mocked(execa).mock.calls[0][1]?.[1] as string
494499
expect(applescript).not.toContain('source .env')
500+
expect(applescript).toContain('hb ignite')
495501
})
496502

497-
it('should properly escape prompt for AppleScript', async () => {
503+
it('should not build complex claude command with prompt', async () => {
498504
const prompt = "Fix the user's \"authentication\" issue"
499505
const workspacePath = '/path/to/workspace'
500506

@@ -505,14 +511,14 @@ describe('claude utils', () => {
505511

506512
await launchClaudeInNewTerminalWindow(prompt, { workspacePath })
507513

508-
// Verify command was constructed
509-
expect(execa).toHaveBeenCalledWith(
510-
'osascript',
511-
['-e', expect.stringContaining('tell application "Terminal"')]
512-
)
514+
// Verify simple hb ignite command is used, not complex claude command with prompt
515+
const applescript = vi.mocked(execa).mock.calls[0][1]?.[1] as string
516+
expect(applescript).toContain('hb ignite')
517+
expect(applescript).not.toContain('--append-system-prompt')
518+
expect(applescript).not.toContain(prompt)
513519
})
514520

515-
it('should use --append-system-prompt flag for terminal window mode', async () => {
521+
it('should use hb ignite instead of building claude command with args', async () => {
516522
const prompt = 'Work on this issue'
517523
const workspacePath = '/path/to/workspace'
518524

@@ -523,9 +529,12 @@ describe('claude utils', () => {
523529

524530
await launchClaudeInNewTerminalWindow(prompt, { workspacePath })
525531

526-
// Verify --append-system-prompt is used in the command
532+
// Verify hb ignite is used, not claude with model/permission args
527533
const applescript = vi.mocked(execa).mock.calls[0][1]?.[1] as string
528-
expect(applescript).toContain('--append-system-prompt')
534+
expect(applescript).toContain('hb ignite')
535+
expect(applescript).not.toContain('--model')
536+
expect(applescript).not.toContain('--permission-mode')
537+
expect(applescript).not.toContain('--add-dir')
529538
})
530539
})
531540

src/utils/claude.ts

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -120,40 +120,22 @@ export async function launchClaude(
120120
* Ports the terminal window opening, coloring, and .env sourcing behavior
121121
*/
122122
export async function launchClaudeInNewTerminalWindow(
123-
prompt: string,
123+
_prompt: string,
124124
options: ClaudeCliOptions & {
125125
workspacePath: string // Required for terminal window launch
126126
}
127127
): Promise<void> {
128-
const { model, permissionMode, workspacePath, branchName } = options
128+
const { workspacePath, branchName } = options
129129

130130
// Verify required parameter
131131
if (!workspacePath) {
132132
throw new Error('workspacePath is required for terminal window launch')
133133
}
134134

135-
// Build command arguments (same as launchClaude)
136-
const args: string[] = []
137-
138-
if (model) {
139-
args.push('--model', model)
140-
}
141-
142-
if (permissionMode && permissionMode !== 'default') {
143-
args.push('--permission-mode', permissionMode)
144-
}
145-
146-
args.push('--add-dir', workspacePath)
147-
args.push('--add-dir', '/tmp') //TODO: Won't work on Windows
148-
149135
// Import terminal launcher for new terminal window creation
150136
const { openTerminalWindow } = await import('./terminal.js')
151137

152-
// Build Claude command using --append-system-prompt flag
153-
// This is semantically correct for system instructions in terminal window mode
154-
const baseCommand = ['claude', ...args].join(' ')
155-
const quotedSystemPrompt = `'${prompt.replace(/'/g, "'\\''")}'`
156-
const claudeCommand = `${baseCommand} --append-system-prompt ${quotedSystemPrompt} -- 'Go!'`
138+
const launchCommand = "hb ignite"
157139

158140
// Apply terminal background color if branch name available
159141
let backgroundColor: { r: number; g: number; b: number } | undefined
@@ -175,7 +157,7 @@ export async function launchClaudeInNewTerminalWindow(
175157
// Open new terminal window with Claude
176158
await openTerminalWindow({
177159
workspacePath,
178-
command: claudeCommand,
160+
command: launchCommand,
179161
...(backgroundColor && { backgroundColor }),
180162
includeEnvSetup: hasEnvFile, // source .env only if it exists
181163
})

0 commit comments

Comments
 (0)