@nathapp/nax 0.46.3 → 0.48.0
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/bin/nax.ts +20 -0
- package/dist/nax.js +1344 -747
- package/package.json +1 -1
- package/src/cli/generate.ts +86 -13
- package/src/cli/init-context.ts +57 -0
- package/src/cli/init.ts +14 -1
- package/src/cli/plan.ts +139 -8
- package/src/config/loader.ts +34 -1
- package/src/config/merge.ts +37 -0
- package/src/config/runtime-types.ts +12 -0
- package/src/context/generator.ts +181 -1
- package/src/execution/story-context.ts +33 -2
- package/src/pipeline/stages/context.ts +5 -1
- package/src/pipeline/stages/execution.ts +26 -3
- package/src/pipeline/stages/review.ts +6 -1
- package/src/pipeline/stages/verify.ts +23 -7
- package/src/prd/schema.ts +17 -0
- package/src/prd/types.ts +6 -0
- package/src/precheck/checks-system.ts +25 -87
- package/src/review/orchestrator.ts +6 -2
- package/src/verification/smart-runner.ts +24 -2
|
@@ -75,6 +75,7 @@ export class ReviewOrchestrator {
|
|
|
75
75
|
executionConfig: NaxConfig["execution"],
|
|
76
76
|
plugins?: PluginRegistry,
|
|
77
77
|
storyGitRef?: string,
|
|
78
|
+
scopePrefix?: string,
|
|
78
79
|
): Promise<OrchestratorReviewResult> {
|
|
79
80
|
const logger = getSafeLogger();
|
|
80
81
|
|
|
@@ -95,14 +96,17 @@ export class ReviewOrchestrator {
|
|
|
95
96
|
// Use the story's start ref if available to capture auto-committed changes
|
|
96
97
|
const baseRef = storyGitRef ?? executionConfig?.storyGitRef;
|
|
97
98
|
const changedFiles = await getChangedFiles(workdir, baseRef);
|
|
99
|
+
const scopedFiles = scopePrefix
|
|
100
|
+
? changedFiles.filter((f) => f === scopePrefix || f.startsWith(`${scopePrefix}/`))
|
|
101
|
+
: changedFiles;
|
|
98
102
|
const pluginResults: ReviewResult["pluginReviewers"] = [];
|
|
99
103
|
|
|
100
104
|
for (const reviewer of reviewers) {
|
|
101
105
|
logger?.info("review", `Running plugin reviewer: ${reviewer.name}`, {
|
|
102
|
-
changedFiles:
|
|
106
|
+
changedFiles: scopedFiles.length,
|
|
103
107
|
});
|
|
104
108
|
try {
|
|
105
|
-
const result = await reviewer.check(workdir,
|
|
109
|
+
const result = await reviewer.check(workdir, scopedFiles);
|
|
106
110
|
// Always log the result so skips/passes are visible in the log
|
|
107
111
|
logger?.info("review", `Plugin reviewer result: ${reviewer.name}`, {
|
|
108
112
|
passed: result.passed,
|
|
@@ -194,7 +194,27 @@ export function buildSmartTestCommand(testFiles: string[], baseCommand: string):
|
|
|
194
194
|
return newParts.join(" ");
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
/**
|
|
198
|
+
* Get TypeScript source files changed since the previous commit.
|
|
199
|
+
*
|
|
200
|
+
* Runs `git diff --name-only <ref>` in the given workdir and filters
|
|
201
|
+
* results to only `.ts` files under the relevant source prefix.
|
|
202
|
+
*
|
|
203
|
+
* In a monorepo, git returns paths relative to the git root (e.g.
|
|
204
|
+
* `packages/api/src/foo.ts`). When `packagePrefix` is set to the
|
|
205
|
+
* story's workdir (e.g. `"packages/api"`), the filter is scoped to
|
|
206
|
+
* `<packagePrefix>/src/` instead of just `src/`.
|
|
207
|
+
*
|
|
208
|
+
* @param workdir - Working directory to run git command in
|
|
209
|
+
* @param baseRef - Git ref for diff base (default: HEAD~1)
|
|
210
|
+
* @param packagePrefix - Story workdir relative to repo root (e.g. "packages/api")
|
|
211
|
+
* @returns Array of changed .ts file paths relative to the git root
|
|
212
|
+
*/
|
|
213
|
+
export async function getChangedSourceFiles(
|
|
214
|
+
workdir: string,
|
|
215
|
+
baseRef?: string,
|
|
216
|
+
packagePrefix?: string,
|
|
217
|
+
): Promise<string[]> {
|
|
198
218
|
try {
|
|
199
219
|
// FEAT-010: Use per-attempt baseRef for precise diff; fall back to HEAD~1 if not provided
|
|
200
220
|
const ref = baseRef ?? "HEAD~1";
|
|
@@ -204,7 +224,9 @@ export async function getChangedSourceFiles(workdir: string, baseRef?: string):
|
|
|
204
224
|
|
|
205
225
|
const lines = stdout.trim().split("\n").filter(Boolean);
|
|
206
226
|
|
|
207
|
-
|
|
227
|
+
// MW-006: scope filter to package prefix in monorepo
|
|
228
|
+
const srcPrefix = packagePrefix ? `${packagePrefix}/src/` : "src/";
|
|
229
|
+
return lines.filter((f) => f.startsWith(srcPrefix) && f.endsWith(".ts"));
|
|
208
230
|
} catch {
|
|
209
231
|
return [];
|
|
210
232
|
}
|