relayLeadInboxMessages only processes unread messages after provisioningComplete, but CLI marks permission_request messages as read after native delivery -- before our relay runs. Move permission_request inbox scan BEFORE provisioningComplete check. Scan ALL messages (including read=true), track processed IDs via processedPermissionRequestIds Set on ProvisioningRun to prevent re-emitting. Also look up both alive and provisioning runs so the scan works during team bootstrap.
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import {
|
|
getKnownSlashCommand,
|
|
KNOWN_SLASH_COMMANDS,
|
|
parseStandaloneSlashCommand,
|
|
} from '@shared/utils/slashCommands';
|
|
|
|
describe('slashCommands', () => {
|
|
it('exposes exactly the curated known commands', () => {
|
|
expect(KNOWN_SLASH_COMMANDS.map((command) => command.command)).toEqual([
|
|
'/compact',
|
|
'/clear',
|
|
'/reset',
|
|
'/new',
|
|
'/plan',
|
|
'/model',
|
|
'/effort',
|
|
'/fast',
|
|
'/cost',
|
|
'/usage',
|
|
]);
|
|
});
|
|
|
|
it('parses known standalone slash commands', () => {
|
|
expect(parseStandaloneSlashCommand(' /compact keep kanban ')).toEqual({
|
|
name: 'compact',
|
|
command: '/compact',
|
|
args: 'keep kanban',
|
|
raw: '/compact keep kanban',
|
|
startIndex: 2,
|
|
endIndex: 22,
|
|
});
|
|
});
|
|
|
|
it('parses unknown standalone slash commands', () => {
|
|
expect(parseStandaloneSlashCommand('/foo bar')).toEqual({
|
|
name: 'foo',
|
|
command: '/foo',
|
|
args: 'bar',
|
|
raw: '/foo bar',
|
|
startIndex: 0,
|
|
endIndex: 8,
|
|
});
|
|
});
|
|
|
|
it('rejects slash-like text that is not a standalone command', () => {
|
|
expect(parseStandaloneSlashCommand('please run /compact now')).toBeNull();
|
|
expect(parseStandaloneSlashCommand('/')).toBeNull();
|
|
});
|
|
|
|
it('returns metadata for known commands only', () => {
|
|
expect(getKnownSlashCommand('MODEL')?.description).toContain('Claude model');
|
|
expect(getKnownSlashCommand('foo')).toBeNull();
|
|
});
|
|
});
|