Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
91 lines
2.7 KiB
TypeScript
91 lines
2.7 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import {
|
|
getCodingCliCommandBasename,
|
|
matchCodingCliProviderFromCommand,
|
|
matchCodingCliProviderFromTitle,
|
|
resolveSessionCodingCliProvider,
|
|
} from './codingCliProviderMatch';
|
|
|
|
test('getCodingCliCommandBasename extracts executable name from paths', () => {
|
|
assert.equal(getCodingCliCommandBasename('/usr/local/bin/claude --resume abc'), 'claude');
|
|
assert.equal(getCodingCliCommandBasename('codex.exe'), 'codex');
|
|
});
|
|
|
|
test('matchCodingCliProviderFromCommand resolves known CLIs', () => {
|
|
assert.equal(matchCodingCliProviderFromCommand('opencode')?.id, 'opencode');
|
|
assert.equal(matchCodingCliProviderFromCommand('droid')?.id, 'droid');
|
|
assert.equal(matchCodingCliProviderFromCommand('factory')?.id, 'droid');
|
|
assert.equal(matchCodingCliProviderFromCommand('grok')?.id, 'grok');
|
|
assert.equal(matchCodingCliProviderFromCommand('C:\\\\Tools\\\\grok.exe')?.id, 'grok');
|
|
});
|
|
|
|
test('matchCodingCliProviderFromTitle detects Claude Code and Codex titles', () => {
|
|
assert.equal(
|
|
matchCodingCliProviderFromTitle('✳ Claude Code · refactor auth')?.id,
|
|
'claude',
|
|
);
|
|
assert.equal(
|
|
matchCodingCliProviderFromTitle('⠋ codex · my-project')?.id,
|
|
'codex',
|
|
);
|
|
assert.equal(
|
|
matchCodingCliProviderFromTitle('⠋ Working · netcatty')?.id,
|
|
'codex',
|
|
);
|
|
assert.equal(
|
|
matchCodingCliProviderFromTitle('Factory Droid · auth flow')?.id,
|
|
'droid',
|
|
);
|
|
assert.equal(
|
|
matchCodingCliProviderFromTitle('android@pixel:~'),
|
|
undefined,
|
|
);
|
|
});
|
|
|
|
test('resolveSessionCodingCliProvider detects providers from dynamic titles', () => {
|
|
assert.equal(
|
|
resolveSessionCodingCliProvider(
|
|
{ dynamicTitle: 'Claude Code' },
|
|
)?.id,
|
|
'claude',
|
|
);
|
|
});
|
|
|
|
test('resolveSessionCodingCliProvider ignores dynamic title for renamed sessions', () => {
|
|
assert.equal(
|
|
resolveSessionCodingCliProvider({
|
|
customName: 'Prod deploy',
|
|
dynamicTitle: 'Claude Code',
|
|
}),
|
|
undefined,
|
|
);
|
|
});
|
|
|
|
test('resolveSessionCodingCliProvider falls back to host startup command', () => {
|
|
assert.equal(
|
|
resolveSessionCodingCliProvider({}, { startupCommand: 'codex' })?.id,
|
|
'codex',
|
|
);
|
|
});
|
|
|
|
test('resolveSessionCodingCliProvider prefers sticky provider over launch command', () => {
|
|
assert.equal(
|
|
resolveSessionCodingCliProvider({
|
|
codingCliProviderId: 'codex',
|
|
startupCommand: 'droid',
|
|
})?.id,
|
|
'codex',
|
|
);
|
|
});
|
|
|
|
test('resolveSessionCodingCliProvider keeps sticky provider when title is only a project name', () => {
|
|
assert.equal(
|
|
resolveSessionCodingCliProvider({
|
|
codingCliProviderId: 'codex',
|
|
dynamicTitle: 'netcatty',
|
|
})?.id,
|
|
'codex',
|
|
);
|
|
});
|