Execution Rules メタデータを追加(git commit 禁止)
buildInstruction で自動付与される実行ルールを追加。 エージェントがコミットすると git diff が空になりレビューできなくなる問題を防ぐ。
This commit is contained in:
parent
82193e6db4
commit
48e055ac8a
@ -192,13 +192,13 @@ describe('instruction-builder', () => {
|
||||
});
|
||||
|
||||
describe('renderExecutionMetadata', () => {
|
||||
it('should render Working Directory only', () => {
|
||||
it('should render Working Directory and Execution Rules', () => {
|
||||
const rendered = renderExecutionMetadata({ workingDirectory: '/project', language: 'en' });
|
||||
|
||||
expect(rendered).toContain('## Execution Context');
|
||||
expect(rendered).toContain('- Working Directory: /project');
|
||||
expect(rendered).not.toContain('Project Root');
|
||||
expect(rendered).not.toContain('Mode:');
|
||||
expect(rendered).toContain('## Execution Rules');
|
||||
expect(rendered).toContain('Do NOT run git commit');
|
||||
});
|
||||
|
||||
it('should end with a trailing empty line', () => {
|
||||
@ -212,8 +212,8 @@ describe('instruction-builder', () => {
|
||||
|
||||
expect(rendered).toContain('## 実行コンテキスト');
|
||||
expect(rendered).toContain('- 作業ディレクトリ: /project');
|
||||
expect(rendered).not.toContain('Execution Context');
|
||||
expect(rendered).not.toContain('Working Directory');
|
||||
expect(rendered).toContain('## 実行ルール');
|
||||
expect(rendered).toContain('git commit を実行しないでください');
|
||||
});
|
||||
|
||||
it('should include English note only for en, not for ja', () => {
|
||||
|
||||
@ -60,11 +60,15 @@ const METADATA_STRINGS = {
|
||||
en: {
|
||||
heading: '## Execution Context',
|
||||
workingDirectory: 'Working Directory',
|
||||
rulesHeading: '## Execution Rules',
|
||||
noCommit: '**Do NOT run git commit.** Commits are handled automatically by the system after workflow completion.',
|
||||
note: 'Note: This section is metadata. Follow the language used in the rest of the prompt.',
|
||||
},
|
||||
ja: {
|
||||
heading: '## 実行コンテキスト',
|
||||
workingDirectory: '作業ディレクトリ',
|
||||
rulesHeading: '## 実行ルール',
|
||||
noCommit: '**git commit を実行しないでください。** コミットはワークフロー完了後にシステムが自動で行います。',
|
||||
note: '',
|
||||
},
|
||||
} as const;
|
||||
@ -73,7 +77,7 @@ const METADATA_STRINGS = {
|
||||
* Render execution metadata as a markdown string.
|
||||
*
|
||||
* Pure function: ExecutionMetadata → string.
|
||||
* Always includes heading + Working Directory.
|
||||
* Always includes heading + Working Directory + Execution Rules.
|
||||
* Language determines the output language; 'en' includes a note about language consistency.
|
||||
*/
|
||||
export function renderExecutionMetadata(metadata: ExecutionMetadata): string {
|
||||
@ -81,6 +85,9 @@ export function renderExecutionMetadata(metadata: ExecutionMetadata): string {
|
||||
const lines = [
|
||||
strings.heading,
|
||||
`- ${strings.workingDirectory}: ${metadata.workingDirectory}`,
|
||||
'',
|
||||
strings.rulesHeading,
|
||||
`- ${strings.noCommit}`,
|
||||
];
|
||||
if (strings.note) {
|
||||
lines.push('');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user