release: v2.58.0
This commit is contained in:
@@ -70,6 +70,117 @@ describe('local project path preflight', () => {
|
||||
expect(agent.shouldPreflightLocalProjectPath(prompt)).toBe(true);
|
||||
});
|
||||
|
||||
it('does not mistake a knowledge collection tool review for project knowledge creation', () => {
|
||||
const context: any = {
|
||||
globalStorageUri: { fsPath: path.join(root, '.storage') },
|
||||
workspaceState: stateStore(),
|
||||
globalState: stateStore()
|
||||
};
|
||||
const agent = new AgentExecutor(context) as any;
|
||||
const prompt = '/Volumes/Data/project/Antigravity/Datacollector_MAC 이 프로젝트는 재가 지식을 수집하는데 사용하는 프로그램이야. 이 프로그램을 너가 코드리뷰를 하고 이 프로그램에 대한 너의 평가를 듣고 싶어. 장점과 단점, 앞으로의 확장성은 어떻게 잡아야할지.';
|
||||
|
||||
expect(agent.shouldPreflightLocalProjectPath(prompt)).toBe(true);
|
||||
expect(agent.isProjectReviewEvaluationRequest(prompt)).toBe(true);
|
||||
expect(agent.isProjectKnowledgeCreationRequest(prompt)).toBe(false);
|
||||
});
|
||||
|
||||
it('classifies local project intent by requested task instead of subject words', () => {
|
||||
const context: any = {
|
||||
globalStorageUri: { fsPath: path.join(root, '.storage') },
|
||||
workspaceState: stateStore(),
|
||||
globalState: stateStore()
|
||||
};
|
||||
const agent = new AgentExecutor(context) as any;
|
||||
const projectPath = '/Volumes/Data/project/Antigravity/Datacollector_MAC';
|
||||
|
||||
expect(agent.classifyLocalProjectIntent(`${projectPath} 지식 수집용 앱인데 한번 봐줘. 앞으로 확장성은?`)).toBe('review-evaluation');
|
||||
expect(agent.classifyLocalProjectIntent(`${projectPath} 데이터 수집 프로그램이야. 장단점과 리스크 평가해줘.`)).toBe('review-evaluation');
|
||||
expect(agent.classifyLocalProjectIntent(`${projectPath} 이 프로젝트에 대한 지식을 만들어줘.`)).toBe('knowledge-creation');
|
||||
expect(agent.classifyLocalProjectIntent(`${projectPath} 이 프로젝트 README와 사용 가이드를 문서로 정리해줘.`)).toBe('documentation');
|
||||
expect(agent.classifyLocalProjectIntent(`${projectPath} 이 프로젝트의 아키텍처 방향은 어떻게 생각해?`)).toBe('thinking');
|
||||
});
|
||||
|
||||
it('adds deep review lenses for local project review intent', () => {
|
||||
const context: any = {
|
||||
globalStorageUri: { fsPath: path.join(root, '.storage') },
|
||||
workspaceState: stateStore(),
|
||||
globalState: stateStore()
|
||||
};
|
||||
const agent = new AgentExecutor(context) as any;
|
||||
const guidance = agent.buildLocalProjectIntentGuidance('review-evaluation');
|
||||
|
||||
expect(guidance).toContain('purpose fit');
|
||||
expect(guidance).toContain('architecture shape');
|
||||
expect(guidance).toContain('data/control flow');
|
||||
expect(guidance).toContain('failure recovery');
|
||||
expect(guidance).toContain('operability/observability');
|
||||
expect(guidance).toContain('extensibility');
|
||||
});
|
||||
|
||||
it('adds an Astra stance layer for opinionated project collaboration', () => {
|
||||
const context: any = {
|
||||
globalStorageUri: { fsPath: path.join(root, '.storage') },
|
||||
workspaceState: stateStore(),
|
||||
globalState: stateStore()
|
||||
};
|
||||
const agent = new AgentExecutor(context) as any;
|
||||
const prompt = '/Volumes/Data/project/Antigravity/Datacollector_MAC 이 지식 수집 앱을 평가해줘. 장점 단점 확장성도 보고 싶어.';
|
||||
const localPathContext = [
|
||||
'Path: /Volumes/Data/project/Antigravity/Datacollector_MAC',
|
||||
'Access: succeeded'
|
||||
].join('\n');
|
||||
|
||||
const stance = agent.buildAstraStanceContext(prompt, localPathContext);
|
||||
|
||||
expect(stance).toContain('[ASTRA STANCE LAYER]');
|
||||
expect(stance).toContain('not a template');
|
||||
expect(stance).toContain('State the real bet');
|
||||
expect(stance).toContain('Review stance');
|
||||
expect(stance).toContain('would rely on this project today');
|
||||
expect(stance).toContain('Local project intent for tone: review-evaluation');
|
||||
});
|
||||
|
||||
it('quality-gates template-like review answers into an Astra verdict', () => {
|
||||
const context: any = {
|
||||
globalStorageUri: { fsPath: path.join(root, '.storage') },
|
||||
workspaceState: stateStore(),
|
||||
globalState: stateStore()
|
||||
};
|
||||
const agent = new AgentExecutor(context) as any;
|
||||
const prompt = '/Volumes/Data/project/Antigravity/Datacollector_MAC 이 지식 수집 앱을 평가해줘. 장점 단점 확장성도 보고 싶어.';
|
||||
const localPathContext = [
|
||||
'Path: /Volumes/Data/project/Antigravity/Datacollector_MAC',
|
||||
'Access: succeeded'
|
||||
].join('\n');
|
||||
const templateAnswer = [
|
||||
'## 간단 요약',
|
||||
'좋은 프로젝트입니다.',
|
||||
'## 요청 요약',
|
||||
'프로젝트 평가 요청입니다.',
|
||||
'## 추론된 사용자 의도',
|
||||
'방향성을 알고 싶어합니다.'
|
||||
].join('\n');
|
||||
|
||||
const gated = agent.applyAstraQualityGate(templateAnswer, prompt, localPathContext);
|
||||
|
||||
expect(gated).toContain('## Astra 판단');
|
||||
expect(gated).toContain('## 내가 보는 위험');
|
||||
expect(gated).toContain('## 다음 한 수');
|
||||
expect(gated).toContain('실제로 의존해도 되는 도구');
|
||||
});
|
||||
|
||||
it('does not quality-gate tiny non-project replies', () => {
|
||||
const context: any = {
|
||||
globalStorageUri: { fsPath: path.join(root, '.storage') },
|
||||
workspaceState: stateStore(),
|
||||
globalState: stateStore()
|
||||
};
|
||||
const agent = new AgentExecutor(context) as any;
|
||||
const answer = '좋아요. 바로 진행할게요.';
|
||||
|
||||
expect(agent.applyAstraQualityGate(answer, '좋아', '')).toBe(answer);
|
||||
});
|
||||
|
||||
it('treats architecture opinion requests with local paths as inspectable work', () => {
|
||||
const context: any = {
|
||||
globalStorageUri: { fsPath: path.join(root, '.storage') },
|
||||
@@ -164,6 +275,56 @@ describe('local project path preflight', () => {
|
||||
expect(fallback).not.toContain('어떤 기능 영역을 가장 먼저');
|
||||
});
|
||||
|
||||
it('replaces misrouted project-knowledge answers for code review requests', () => {
|
||||
const context: any = {
|
||||
globalStorageUri: { fsPath: path.join(root, '.storage') },
|
||||
workspaceState: stateStore(),
|
||||
globalState: stateStore()
|
||||
};
|
||||
const agent = new AgentExecutor(context) as any;
|
||||
const localPathContext = [
|
||||
'Path: /Volumes/Data/project/Antigravity/Datacollector_MAC',
|
||||
'Access: succeeded',
|
||||
'Type: directory',
|
||||
'Scanned tree:',
|
||||
'src/App.tsx',
|
||||
'src/lib/engine.ts',
|
||||
'src/lib/api.ts',
|
||||
'Priority file previews:',
|
||||
'File: src/lib/engine.ts',
|
||||
'export async function runMission() {}',
|
||||
'File: src/lib/api.ts',
|
||||
'export async function fetchSources() {}'
|
||||
].join('\n');
|
||||
const wrongAnswer = '## 기본 지식 생성 방향\n## 바로 만들 지식 초안\n# Datacollector_MAC Project Knowledge Overview';
|
||||
|
||||
expect(agent.isMisroutedProjectKnowledgeAnswer(wrongAnswer)).toBe(true);
|
||||
const fixed = agent.buildProjectReviewFallbackAnswer(localPathContext);
|
||||
expect(fixed).toContain('코드리뷰와 제품 평가 요청');
|
||||
expect(fixed).toContain('## 코드리뷰 관점 평가');
|
||||
expect(fixed).toContain('목적 적합성');
|
||||
expect(fixed).toContain('데이터/제어 흐름');
|
||||
expect(fixed).toContain('실패 복구');
|
||||
expect(fixed).toContain('운영성/관측성');
|
||||
expect(fixed).toContain('## 확장성 방향');
|
||||
expect(fixed).not.toContain('바로 만들 지식 초안');
|
||||
});
|
||||
|
||||
it('detects shallow project review answers', () => {
|
||||
const context: any = {
|
||||
globalStorageUri: { fsPath: path.join(root, '.storage') },
|
||||
workspaceState: stateStore(),
|
||||
globalState: stateStore()
|
||||
};
|
||||
const agent = new AgentExecutor(context) as any;
|
||||
|
||||
expect(agent.isShallowProjectReviewAnswer('좋은 프로젝트입니다. 장점은 구조가 좋고 단점은 테스트가 필요합니다.')).toBe(true);
|
||||
expect(agent.isShallowProjectReviewAnswer([
|
||||
'## 코드리뷰 관점 평가',
|
||||
'목적 적합성, 아키텍처 구조, 데이터 흐름, 실패 복구, 운영 로그, 확장성을 기준으로 봅니다.'
|
||||
].join('\n'))).toBe(false);
|
||||
});
|
||||
|
||||
it('treats no-record-created answers as incomplete project knowledge creation', () => {
|
||||
const context: any = {
|
||||
globalStorageUri: { fsPath: path.join(root, '.storage') },
|
||||
|
||||
Reference in New Issue
Block a user