@bamptee/aia-code 2.0.9 → 2.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamptee/aia-code",
3
- "version": "2.0.9",
3
+ "version": "2.0.11",
4
4
  "description": "AI Architecture Assistant - orchestrate AI-assisted development workflows via CLI tools (Claude, Codex, Gemini)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,4 +1,5 @@
1
1
  import path from 'node:path';
2
+ import { execFile } from 'node:child_process';
2
3
  import fs from 'fs-extra';
3
4
  import yaml from 'yaml';
4
5
  import { AIA_DIR, FEATURE_STEPS } from './constants.js';
@@ -68,6 +69,34 @@ async function resolveKnowledgeCategories(feature, config, root) {
68
69
  return config.knowledge_default ?? [];
69
70
  }
70
71
 
72
+ function execGit(args, root) {
73
+ return new Promise((resolve) => {
74
+ execFile('git', args, { cwd: root, maxBuffer: 1024 * 1024 * 5 }, (err, stdout) => {
75
+ resolve(err ? '' : (stdout?.trim() || ''));
76
+ });
77
+ });
78
+ }
79
+
80
+ async function getGitDiff(root) {
81
+ // 1. Try uncommitted changes (staged + unstaged), excluding .aia
82
+ const uncommitted = await execGit(['diff', 'HEAD', '--', '.', ':!.aia'], root);
83
+ if (uncommitted) return uncommitted;
84
+
85
+ // 2. If no uncommitted changes, the implement step likely committed.
86
+ // Find the merge-base with main and diff from there.
87
+ const branch = await execGit(['rev-parse', '--abbrev-ref', 'HEAD'], root);
88
+ if (branch && branch !== 'main' && branch !== 'master') {
89
+ const base = await execGit(['merge-base', branch, 'main'], root) ||
90
+ await execGit(['merge-base', branch, 'master'], root);
91
+ if (base) {
92
+ return execGit(['diff', base, 'HEAD', '--', '.', ':!.aia'], root);
93
+ }
94
+ }
95
+
96
+ // 3. Fallback: diff last commit
97
+ return execGit(['diff', 'HEAD~1', 'HEAD', '--', '.', ':!.aia'], root);
98
+ }
99
+
71
100
  async function loadPromptTemplate(step, root) {
72
101
  const templatePath = path.join(root, AIA_DIR, 'prompts', `${step}.md`);
73
102
  const content = await readIfExists(templatePath);
@@ -150,6 +179,18 @@ export async function buildPrompt(feature, step, { description, instructions, hi
150
179
  parts.push(featureContent);
151
180
  }
152
181
 
182
+ // For the review step, include actual code changes so the reviewer can see the code
183
+ if (step === 'review') {
184
+ const diff = await getGitDiff(root);
185
+ if (diff) {
186
+ parts.push('\n\n=== CODE CHANGES (git diff) ===\n');
187
+ parts.push('Below is the actual git diff of the implementation. Review this code:\n');
188
+ parts.push('```diff');
189
+ parts.push(diff);
190
+ parts.push('```');
191
+ }
192
+ }
193
+
153
194
  if (previousOutput) {
154
195
  parts.push('\n\n=== PREVIOUS OUTPUT ===\n');
155
196
  parts.push(previousOutput);