feat(commands): multi-select ordered command pipeline with step reordering and single-pass composition (AI-05, AI-07)

This commit is contained in:
Yun Chan 2026-10-31 02:54:54 +09:00
parent f49acf0105
commit 10af20a0ad
157 changed files with 29455 additions and 913 deletions

View file

@ -9,10 +9,12 @@ import { describe, expect, it } from 'vitest'
import {
COMMAND_NONE,
commandSelection,
commandSelections,
commandTestRequest,
conversationBadge,
documentIndexLabelKey,
llmActionLabelKey,
removeInstructionFromActiveIds,
resolveCommandPipeline,
withoutHidden,
isInstructionInUse,
@ -32,6 +34,21 @@ describe('resolveCommandPipeline', () => {
const p = resolveCommandPipeline({ defaultLLMAction: 'custom', activeInstructionId: 'i1' }, list)
expect(p).toEqual({ kind: 'instruction', instruction: polish })
expect(commandSelection(p)).toBe('i1')
expect(commandSelections(p)).toEqual(['i1'])
})
it("'custom' + 복수 지시문('i2,i1')이면 선택한 순서대로 다단계 파이프라인을 구성한다", () => {
const p = resolveCommandPipeline({ defaultLLMAction: 'custom', activeInstructionId: 'i2,i1' }, list)
expect(p).toEqual({ kind: 'instructions', instructions: [list[1], polish] })
expect(commandSelection(p)).toBe('i2,i1')
expect(commandSelections(p)).toEqual(['i2', 'i1'])
const testReq = commandTestRequest(p, ' 어 오늘 회의 내용 정리 ')
expect(testReq.ok).toBe(true)
if (testReq.ok) {
expect(testReq.params.action).toBe('custom')
expect(testReq.params.customPrompt).toContain('[1단계: 요약]')
expect(testReq.params.customPrompt).toContain('[2단계: 정중하게]')
}
})
it("'custom' 인데 지시문이 지워졌으면 '선택 안 됨'으로 정직하게", () => {
@ -98,8 +115,10 @@ describe('withoutHidden / documentIndexLabelKey', () => {
})
describe('isInstructionInUse — 명령 삭제 확정 시점의 설정으로 판단', () => {
it('지운 명령이 아직 선택돼 있을 때만 true', () => {
it('지운 명령이 아직 선택돼 있을 때만 true (단일 및 복수 파이프라인 포함)', () => {
expect(isInstructionInUse({ defaultLLMAction: 'custom', activeInstructionId: 'x' }, 'x')).toBe(true)
expect(isInstructionInUse({ defaultLLMAction: 'custom', activeInstructionId: 'y,x' }, 'x')).toBe(true)
expect(removeInstructionFromActiveIds('y,x', 'x')).toEqual(['y'])
// 되돌리기 알림 동안 다른 명령을 골랐다 — 덮으면 안 된다
expect(isInstructionInUse({ defaultLLMAction: 'custom', activeInstructionId: 'y' }, 'x')).toBe(false)
expect(isInstructionInUse({ defaultLLMAction: 'refine', activeInstructionId: 'x' }, 'x')).toBe(false)