Release: v2.36.9 - Integrate Blog Production Manual & Writing Patterns
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
import * as fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import { AgentExecutor } from '../src/agent';
|
||||
|
||||
function stateStore() {
|
||||
const store = new Map<string, any>();
|
||||
return {
|
||||
get: (key: string) => store.get(key),
|
||||
update: async (key: string, value: any) => {
|
||||
store.set(key, value);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
describe('local project path preflight', () => {
|
||||
let root: string;
|
||||
|
||||
beforeEach(() => {
|
||||
root = fs.mkdtempSync(path.join(os.tmpdir(), 'g1-local-preflight-'));
|
||||
fs.mkdirSync(path.join(root, 'src', 'features', 'game', 'systems'), { recursive: true });
|
||||
fs.writeFileSync(path.join(root, 'package.json'), '{"scripts":{"dev":"vite"}}', 'utf8');
|
||||
fs.writeFileSync(path.join(root, 'src', 'features', 'game', 'systems', 'CombatSystem.ts'), 'export class CombatSystem {}', 'utf8');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fs.rmSync(root, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it('previews deep source files instead of treating a project folder as empty', () => {
|
||||
const context: any = {
|
||||
globalStorageUri: { fsPath: path.join(root, '.storage') },
|
||||
workspaceState: stateStore(),
|
||||
globalState: stateStore()
|
||||
};
|
||||
const agent = new AgentExecutor(context) as any;
|
||||
|
||||
const inspected = agent.inspectLocalProjectPath(root, root);
|
||||
|
||||
expect(inspected).toContain('Access: succeeded');
|
||||
expect(inspected).toContain('Priority file previews');
|
||||
expect(inspected).toContain('package.json');
|
||||
expect(inspected).toContain('src/features/game/systems/CombatSystem.ts');
|
||||
expect(inspected).toContain('export class CombatSystem');
|
||||
});
|
||||
|
||||
it('removes upload requests when local project access already succeeded', () => {
|
||||
const context: any = {
|
||||
globalStorageUri: { fsPath: path.join(root, '.storage') },
|
||||
workspaceState: stateStore(),
|
||||
globalState: stateStore()
|
||||
};
|
||||
const agent = new AgentExecutor(context) as any;
|
||||
const answer = '코드를 업로드해 주시면 검토하겠습니다.';
|
||||
const fixed = agent.enforceLocalPathReviewAnswer(answer, 'Access: succeeded\nPriority file previews:\n### package.json');
|
||||
|
||||
expect(fixed).toContain('제공된 로컬 프로젝트 경로에는 접근할 수 있고');
|
||||
expect(fixed).not.toContain('코드를 업로드해 주시면');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user