nativeapptemplate-agent 0.1.2 → 0.2.1
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/CLAUDE.md +10 -8
- package/README.md +65 -21
- package/dist/agents/judge.d.ts +8 -0
- package/dist/agents/judge.d.ts.map +1 -1
- package/dist/agents/judge.js +167 -29
- package/dist/agents/judge.js.map +1 -1
- package/dist/agents/repair.d.ts +14 -0
- package/dist/agents/repair.d.ts.map +1 -0
- package/dist/agents/repair.js +103 -0
- package/dist/agents/repair.js.map +1 -0
- package/dist/agents/types.d.ts +34 -1
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/dispatch.d.ts +21 -2
- package/dist/dispatch.d.ts.map +1 -1
- package/dist/dispatch.js +250 -14
- package/dist/dispatch.js.map +1 -1
- package/dist/env-bridge.d.ts +17 -0
- package/dist/env-bridge.d.ts.map +1 -0
- package/dist/env-bridge.js +211 -0
- package/dist/env-bridge.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +88 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.ts +5 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +83 -0
- package/dist/mcp.js.map +1 -0
- package/dist/mobile.d.ts +31 -0
- package/dist/mobile.d.ts.map +1 -0
- package/dist/mobile.js +179 -0
- package/dist/mobile.js.map +1 -0
- package/dist/rails-lifecycle.d.ts +16 -0
- package/dist/rails-lifecycle.d.ts.map +1 -0
- package/dist/rails-lifecycle.js +184 -0
- package/dist/rails-lifecycle.js.map +1 -0
- package/dist/rename-overrides.d.ts +23 -0
- package/dist/rename-overrides.d.ts.map +1 -0
- package/dist/rename-overrides.js +58 -0
- package/dist/rename-overrides.js.map +1 -0
- package/dist/repair-loop.d.ts +25 -0
- package/dist/repair-loop.d.ts.map +1 -0
- package/dist/repair-loop.js +67 -0
- package/dist/repair-loop.js.map +1 -0
- package/dist/report/collect.d.ts +28 -0
- package/dist/report/collect.d.ts.map +1 -0
- package/dist/report/collect.js +117 -0
- package/dist/report/collect.js.map +1 -0
- package/dist/report/model.d.ts +49 -0
- package/dist/report/model.d.ts.map +1 -0
- package/dist/report/model.js +2 -0
- package/dist/report/model.js.map +1 -0
- package/dist/report/render.d.ts +3 -0
- package/dist/report/render.d.ts.map +1 -0
- package/dist/report/render.js +242 -0
- package/dist/report/render.js.map +1 -0
- package/dist/report/theme.d.ts +2 -0
- package/dist/report/theme.d.ts.map +1 -0
- package/dist/report/theme.js +115 -0
- package/dist/report/theme.js.map +1 -0
- package/dist/slug.d.ts +3 -0
- package/dist/slug.d.ts.map +1 -1
- package/dist/slug.js +30 -0
- package/dist/slug.js.map +1 -1
- package/dist/validation/capture.d.ts.map +1 -1
- package/dist/validation/capture.js +19 -2
- package/dist/validation/capture.js.map +1 -1
- package/dist/validation/discover.js +1 -1
- package/dist/validation/discover.js.map +1 -1
- package/dist/validation/index.d.ts +8 -2
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +4 -1
- package/dist/validation/index.js.map +1 -1
- package/dist/validation/launch.d.ts +10 -0
- package/dist/validation/launch.d.ts.map +1 -1
- package/dist/validation/launch.js +127 -12
- package/dist/validation/launch.js.map +1 -1
- package/dist/validation/layer1.d.ts.map +1 -1
- package/dist/validation/layer1.js +12 -4
- package/dist/validation/layer1.js.map +1 -1
- package/dist/validation/layer2.js +1 -1
- package/dist/validation/layer2.js.map +1 -1
- package/dist/validation/scenarios/queue.d.ts +12 -0
- package/dist/validation/scenarios/queue.d.ts.map +1 -0
- package/dist/validation/scenarios/queue.js +216 -0
- package/dist/validation/scenarios/queue.js.map +1 -0
- package/dist/validation/stage1.d.ts +2 -0
- package/dist/validation/stage1.d.ts.map +1 -1
- package/dist/validation/stage1.js +2 -0
- package/dist/validation/stage1.js.map +1 -1
- package/dist/validation/stage2-judge.d.ts +23 -0
- package/dist/validation/stage2-judge.d.ts.map +1 -0
- package/dist/validation/stage2-judge.js +225 -0
- package/dist/validation/stage2-judge.js.map +1 -0
- package/dist/validation/stage2.d.ts +74 -0
- package/dist/validation/stage2.d.ts.map +1 -0
- package/dist/validation/stage2.js +328 -0
- package/dist/validation/stage2.js.map +1 -0
- package/dist/validation/visual-judge.d.ts +37 -0
- package/dist/validation/visual-judge.d.ts.map +1 -1
- package/dist/validation/visual-judge.js +100 -16
- package/dist/validation/visual-judge.js.map +1 -1
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +17 -0
- package/dist/version.js.map +1 -0
- package/package.json +6 -3
- package/scripts/ruby/rename.rb +7 -3
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { query } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
+
import { trace } from "../trace.js";
|
|
3
|
+
import { isStub } from "../stub.js";
|
|
4
|
+
const MODEL = "claude-opus-4-7";
|
|
5
|
+
// One repair pass over a single failing platform. Drives the Claude Agent
|
|
6
|
+
// SDK's agentic loop (Read/Edit/Bash) scoped to the generated project, then
|
|
7
|
+
// returns a summary. The caller re-validates and records resolved/unresolved.
|
|
8
|
+
export async function runRepair(target, domain) {
|
|
9
|
+
if (isStub("repair"))
|
|
10
|
+
return runStubRepair(target);
|
|
11
|
+
const apiKey = process.env["NATIVEAPPTEMPLATE_AGENT_ANTHROPIC_KEY"] ?? process.env["ANTHROPIC_API_KEY"];
|
|
12
|
+
if (!apiKey) {
|
|
13
|
+
return { action: "skipped — no Anthropic API key in env" };
|
|
14
|
+
}
|
|
15
|
+
trace("repair", `${target.platform}/${target.layer}: invoking repair agent in ${target.outDir}`);
|
|
16
|
+
// Layer 2 may need to re-run the compiler to confirm; Layer 1 is a pure
|
|
17
|
+
// source edit, so it gets no shell.
|
|
18
|
+
const allowedTools = target.layer === "layer2"
|
|
19
|
+
? ["Read", "Edit", "Grep", "Glob", "Bash"]
|
|
20
|
+
: ["Read", "Edit", "Grep", "Glob"];
|
|
21
|
+
const response = query({
|
|
22
|
+
prompt: buildPrompt(target, domain),
|
|
23
|
+
options: {
|
|
24
|
+
cwd: target.outDir,
|
|
25
|
+
model: MODEL,
|
|
26
|
+
systemPrompt: SYSTEM_PROMPT,
|
|
27
|
+
allowedTools,
|
|
28
|
+
permissionMode: "bypassPermissions",
|
|
29
|
+
allowDangerouslySkipPermissions: true,
|
|
30
|
+
maxTurns: target.layer === "layer2" ? 40 : 20,
|
|
31
|
+
// Hermetic: don't inherit the developer's ~/.claude settings, project
|
|
32
|
+
// CLAUDE.md, or custom agents — the repair agent runs only with the
|
|
33
|
+
// system prompt below.
|
|
34
|
+
settingSources: [],
|
|
35
|
+
env: { ...stringEnv(process.env), ANTHROPIC_API_KEY: apiKey },
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
let action = `attempted ${target.layer} fix`;
|
|
39
|
+
let turns = 0;
|
|
40
|
+
for await (const message of response) {
|
|
41
|
+
if (message.type === "result") {
|
|
42
|
+
turns = message.num_turns;
|
|
43
|
+
if (message.subtype === "success" && !message.is_error) {
|
|
44
|
+
action = firstLine(message.result) || action;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
action = `repair agent did not converge (${message.subtype})`;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
trace("repair", `${target.platform}/${target.layer}: ${turns} turns — ${action}`);
|
|
52
|
+
return { action };
|
|
53
|
+
}
|
|
54
|
+
const SYSTEM_PROMPT = `You are a repair agent for a generated three-platform SaaS project (Rails 8.1 API, SwiftUI iOS, Jetpack Compose Android). A generated project failed one validation layer; your job is to make the smallest correct edit that fixes it. You operate ONLY inside the current working directory (one generated platform project) — never touch any other path.
|
|
55
|
+
|
|
56
|
+
Two failure classes:
|
|
57
|
+
- Layer 1 (structural): leftover substrate tokens (e.g. Shop, Shopkeeper, ItemTag, NativeAppTemplate and derived forms) survived the rename. Replace each remaining occurrence with its renamed equivalent, consistently, preserving case style (PascalCase→PascalCase, snake_case→snake_case). Do not rename anything that is NOT a substrate token. Do not introduce a token that collides with a language/framework reserved word.
|
|
58
|
+
- Layer 2 (runtime): the project failed to build/compile. Read the compiler error, find the root cause, and fix it with a minimal, idiomatic change.
|
|
59
|
+
|
|
60
|
+
Known-cryptic failure modes — slow down and verify rather than pattern-match:
|
|
61
|
+
- Jetpack Compose compilation errors (often a missing import, a @Composable context mismatch, or a type-inference failure).
|
|
62
|
+
- Hilt dependency-injection errors (missing @Inject / @Provides / module binding, or a scope mismatch).
|
|
63
|
+
|
|
64
|
+
Make targeted edits; do not refactor unrelated code, add dependencies, or rewrite files wholesale. When done, reply with ONE concise sentence describing exactly what you changed.`;
|
|
65
|
+
function buildPrompt(target, domain) {
|
|
66
|
+
const renamePlan = domain.renamePlan.map((r) => `${r.from} → ${r.to}`).join(", ");
|
|
67
|
+
if (target.layer === "layer1") {
|
|
68
|
+
const forbidden = (target.forbiddenTokens ?? []).join(", ");
|
|
69
|
+
return `This generated ${target.platform} project still contains leftover substrate tokens that must not appear. Forbidden tokens: ${forbidden || "(see findings)"}. The intended renames are: ${renamePlan}.
|
|
70
|
+
|
|
71
|
+
Leftover findings (token · file:line · excerpt):
|
|
72
|
+
${target.detail}
|
|
73
|
+
|
|
74
|
+
Replace every leftover occurrence with its renamed equivalent, then confirm none remain.`;
|
|
75
|
+
}
|
|
76
|
+
return `This generated ${target.platform} project failed to build. The intended domain renames were: ${renamePlan}.
|
|
77
|
+
|
|
78
|
+
Compiler error (stderr tail):
|
|
79
|
+
${target.detail}
|
|
80
|
+
|
|
81
|
+
Diagnose and fix the root cause with a minimal edit. If you have a shell available, you may re-run the build to confirm, but keep it bounded.`;
|
|
82
|
+
}
|
|
83
|
+
// process.env is Record<string, string | undefined>; the SDK env option
|
|
84
|
+
// wants string values only. Drop undefined entries.
|
|
85
|
+
function stringEnv(env) {
|
|
86
|
+
const out = {};
|
|
87
|
+
for (const [k, v] of Object.entries(env)) {
|
|
88
|
+
if (typeof v === "string")
|
|
89
|
+
out[k] = v;
|
|
90
|
+
}
|
|
91
|
+
return out;
|
|
92
|
+
}
|
|
93
|
+
function firstLine(text) {
|
|
94
|
+
const line = text.trim().split("\n")[0] ?? "";
|
|
95
|
+
return line.length > 200 ? `${line.slice(0, 197)}…` : line;
|
|
96
|
+
}
|
|
97
|
+
const delay = (ms) => new Promise((r) => { setTimeout(r, ms); });
|
|
98
|
+
async function runStubRepair(target) {
|
|
99
|
+
trace("repair", `(stub mode) ${target.platform}/${target.layer}`);
|
|
100
|
+
await delay(50);
|
|
101
|
+
return { action: `stub repair: no-op for ${target.platform} ${target.layer}` };
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=repair.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repair.js","sourceRoot":"","sources":["../../src/agents/repair.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGpC,MAAM,KAAK,GAAG,iBAAiB,CAAC;AA4BhC,0EAA0E;AAC1E,4EAA4E;AAC5E,8EAA8E;AAC9E,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAAoB,EAAE,MAAkB;IACtE,IAAI,MAAM,CAAC,QAAQ,CAAC;QAAE,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;IAEnD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACxG,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,EAAE,MAAM,EAAE,uCAAuC,EAAE,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,KAAK,8BAA8B,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAEjG,wEAAw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xC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9C,OAAO,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7D,CAAC;AAED,MAAM,KAAK,GAAG,CAAC,EAAU,EAAiB,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAExF,KAAK,UAAU,aAAa,CAAC,MAAoB;IAC/C,KAAK,CAAC,QAAQ,EAAE,eAAe,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IAClE,MAAM,KAAK,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,0BAA0B,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;AACjF,CAAC"}
|
package/dist/agents/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Layer1Finding } from "../validation/layer1.js";
|
|
1
2
|
export type DomainSpec = {
|
|
2
3
|
slug: string;
|
|
3
4
|
displayName: string;
|
|
@@ -21,7 +22,7 @@ export type RenamePair = {
|
|
|
21
22
|
to: string;
|
|
22
23
|
};
|
|
23
24
|
export type Platform = "rails" | "ios" | "android";
|
|
24
|
-
export type AgentName = "planner" | Platform | "reviewer" | "judge";
|
|
25
|
+
export type AgentName = "planner" | Platform | "reviewer" | "judge" | "dispatch" | "repair";
|
|
25
26
|
export type WorkerResult = {
|
|
26
27
|
platform: Platform;
|
|
27
28
|
outDir: string;
|
|
@@ -36,6 +37,23 @@ export type JudgeResult = {
|
|
|
36
37
|
overallPass: boolean;
|
|
37
38
|
summary: string;
|
|
38
39
|
visual?: VisualJudgeReport;
|
|
40
|
+
platforms?: readonly PlatformDetail[];
|
|
41
|
+
};
|
|
42
|
+
export type PlatformDetail = {
|
|
43
|
+
platform: Platform;
|
|
44
|
+
layer1: {
|
|
45
|
+
pass: boolean;
|
|
46
|
+
findings: readonly Layer1Finding[];
|
|
47
|
+
};
|
|
48
|
+
layer2: {
|
|
49
|
+
pass: boolean;
|
|
50
|
+
command: string;
|
|
51
|
+
mode: "fast" | "build";
|
|
52
|
+
exitCode: number | null;
|
|
53
|
+
durationMs: number;
|
|
54
|
+
stderrTail?: string;
|
|
55
|
+
};
|
|
56
|
+
layer3?: VisualJudgePlatformReport;
|
|
39
57
|
};
|
|
40
58
|
export type VisualJudgeReport = {
|
|
41
59
|
ios?: VisualJudgePlatformReport;
|
|
@@ -50,5 +68,20 @@ export type VisualJudgePlatformReport = {
|
|
|
50
68
|
rationale: string;
|
|
51
69
|
}[];
|
|
52
70
|
error?: string;
|
|
71
|
+
stage2?: Stage2PlatformReport;
|
|
72
|
+
};
|
|
73
|
+
export type Stage2PlatformReport = {
|
|
74
|
+
pass: boolean;
|
|
75
|
+
scenarioName: string;
|
|
76
|
+
stepCount: number;
|
|
77
|
+
stepsPassed: number;
|
|
78
|
+
screenshots: readonly string[];
|
|
79
|
+
representativeScreenshot?: string;
|
|
80
|
+
layer3Scores?: readonly {
|
|
81
|
+
criterionId: string;
|
|
82
|
+
pass: boolean;
|
|
83
|
+
rationale: string;
|
|
84
|
+
}[];
|
|
85
|
+
error?: string;
|
|
53
86
|
};
|
|
54
87
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agents/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IAC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|
|
|
1
|
-
import type
|
|
2
|
-
|
|
1
|
+
import { type ReportFormat, type ReportPaths } from "./report/collect.js";
|
|
2
|
+
import type { RunReport } from "./report/model.js";
|
|
3
|
+
import type { JudgeResult, RenamePair } from "./agents/types.js";
|
|
4
|
+
import { type OverrideOutcome } from "./rename-overrides.js";
|
|
5
|
+
export type DispatchReportOptions = {
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
format?: ReportFormat;
|
|
8
|
+
embed?: boolean;
|
|
9
|
+
dir?: string;
|
|
10
|
+
};
|
|
11
|
+
export type DispatchOptions = {
|
|
12
|
+
report?: DispatchReportOptions;
|
|
13
|
+
renameOverrides?: readonly RenamePair[];
|
|
14
|
+
projectName?: string;
|
|
15
|
+
};
|
|
16
|
+
export type DispatchResult = JudgeResult & {
|
|
17
|
+
report: RunReport;
|
|
18
|
+
reportPaths: ReportPaths;
|
|
19
|
+
renameOverrideOutcomes: readonly OverrideOutcome[];
|
|
20
|
+
};
|
|
21
|
+
export declare function dispatch(spec: string, options?: DispatchOptions): Promise<DispatchResult>;
|
|
3
22
|
//# sourceMappingURL=dispatch.d.ts.map
|
package/dist/dispatch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAWA,OAAO,EAA+B,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAMvG,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAA4B,UAAU,EAAgB,MAAM,mBAAmB,CAAC;AACzG,OAAO,EAAyC,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGpG,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAG/B,eAAe,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IAKxC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG;IACzC,MAAM,EAAE,SAAS,CAAC;IAClB,WAAW,EAAE,WAAW,CAAC;IACzB,sBAAsB,EAAE,SAAS,eAAe,EAAE,CAAC;CACpD,CAAC;AAEF,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,CA+OnG"}
|
package/dist/dispatch.js
CHANGED
|
@@ -5,34 +5,270 @@ import { runIosWorker } from "./agents/workers/ios.js";
|
|
|
5
5
|
import { runAndroidWorker } from "./agents/workers/android.js";
|
|
6
6
|
import { runReviewer } from "./agents/reviewer.js";
|
|
7
7
|
import { runJudge } from "./agents/judge.js";
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import { applyBridgeToProcessEnv, buildBridgeValues, syncGradleProperties } from "./env-bridge.js";
|
|
9
|
+
import { startRails } from "./rails-lifecycle.js";
|
|
10
|
+
import { isStub } from "./stub.js";
|
|
11
|
+
import { trace } from "./trace.js";
|
|
12
|
+
import { buildRunReport, writeReport } from "./report/collect.js";
|
|
13
|
+
import { readPackageVersion } from "./version.js";
|
|
14
|
+
import { runRepairLoop, REPAIR_ITERATION_CAP } from "./repair-loop.js";
|
|
15
|
+
import { runRepair } from "./agents/repair.js";
|
|
16
|
+
import { runLayer1 } from "./validation/layer1.js";
|
|
17
|
+
import { runLayer2 } from "./validation/layer2.js";
|
|
18
|
+
import { applyRenameOverrides, syncEntityNames } from "./rename-overrides.js";
|
|
19
|
+
import { isValidSlug, slugToPascal, projectNameToSlug, projectNameToDisplayName } from "./slug.js";
|
|
20
|
+
export async function dispatch(spec, options = {}) {
|
|
21
|
+
const startedAt = Date.now();
|
|
22
|
+
let domain = await runPlanner(spec);
|
|
23
|
+
// Manual project name (CLI --project-name). Derive the slug + display name
|
|
24
|
+
// from it and override the planner's. The slug drives the output dir, DB
|
|
25
|
+
// prefix, env-bridge token, and the Pascal project name — so it must land
|
|
26
|
+
// before the env-bridge and workers read domain.slug. A name that yields no
|
|
27
|
+
// valid slug is traced and ignored rather than corrupting paths downstream.
|
|
28
|
+
const projectName = options.projectName;
|
|
29
|
+
if (projectName !== undefined) {
|
|
30
|
+
const slug = projectNameToSlug(projectName);
|
|
31
|
+
if (isValidSlug(slug)) {
|
|
32
|
+
const displayName = projectNameToDisplayName(projectName);
|
|
33
|
+
trace("dispatch", `project name: "${projectName}" -> ${slugToPascal(slug)} (slug ${slug}, display "${displayName}")`);
|
|
34
|
+
domain = { ...domain, slug, displayName };
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
trace("dispatch", `project name ignored: "${projectName}" yields no valid slug`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Manual overrides take precedence over the planner's noun choices, but only
|
|
41
|
+
// for renames the planner actually scheduled — unmatched overrides are traced
|
|
42
|
+
// and dropped, not silently added. Apply before workers/reviewer/judge/report
|
|
43
|
+
// so every downstream consumer sees the final plan.
|
|
44
|
+
const renameOverrides = options.renameOverrides ?? [];
|
|
45
|
+
let renameOverrideOutcomes = [];
|
|
46
|
+
if (renameOverrides.length > 0) {
|
|
47
|
+
const merged = applyRenameOverrides(domain.renamePlan, renameOverrides);
|
|
48
|
+
renameOverrideOutcomes = merged.outcomes;
|
|
49
|
+
for (const o of merged.outcomes) {
|
|
50
|
+
if (o.kind === "changed")
|
|
51
|
+
trace("dispatch", `rename override: ${o.from} ${o.was}->${o.to} (overrode planner's pick)`);
|
|
52
|
+
else if (o.kind === "noop")
|
|
53
|
+
trace("dispatch", `rename override: ${o.from}=${o.to} already the planned target — no change`);
|
|
54
|
+
else
|
|
55
|
+
trace("dispatch", `rename override ignored: no planned rename for "${o.from}" (got ${o.from}=${o.to})`);
|
|
56
|
+
}
|
|
57
|
+
// Carry the override into entity names too, so the report's entity cards
|
|
58
|
+
// agree with its rename plan (the planner names entities after their
|
|
59
|
+
// targets). Code generation keys off renamePlan, not entities — this is
|
|
60
|
+
// metadata coherence, not a code-affecting change.
|
|
61
|
+
const entities = syncEntityNames(domain.entities, merged.outcomes);
|
|
62
|
+
domain = { ...domain, renamePlan: merged.plan, entities };
|
|
63
|
+
}
|
|
64
|
+
// Mirror the substrate's NATIVEAPPTEMPLATE_API_* config to the
|
|
65
|
+
// renamed product equivalents (<PRODUCT>_API_*) so the agent's auto-
|
|
66
|
+
// validation runs see the right values without forcing the user to
|
|
67
|
+
// hand-set per-app env vars. See src/env-bridge.ts.
|
|
68
|
+
const bridge = await buildBridgeValues(domain);
|
|
69
|
+
if (Object.keys(bridge.values).length > 0) {
|
|
70
|
+
applyBridgeToProcessEnv(bridge);
|
|
71
|
+
const sync = await syncGradleProperties(bridge);
|
|
72
|
+
const keys = Object.keys(bridge.values).sort().join(", ");
|
|
73
|
+
trace("dispatch", `env-bridge: mirrored ${keys}`);
|
|
74
|
+
switch (sync.mode) {
|
|
75
|
+
case "wrote":
|
|
76
|
+
trace("dispatch", `env-bridge: wrote sentinel block to ${sync.path}`);
|
|
77
|
+
break;
|
|
78
|
+
case "skipped":
|
|
79
|
+
trace("dispatch", `env-bridge: file write skipped (NATIVEAPPTEMPLATE_BRIDGE=off); process.env still injected`);
|
|
80
|
+
break;
|
|
81
|
+
case "dry-run":
|
|
82
|
+
trace("dispatch", `env-bridge: DRY RUN — would write to ${sync.path}:`);
|
|
83
|
+
for (const line of (sync.preview ?? "").split("\n"))
|
|
84
|
+
trace("dispatch", ` ${line}`);
|
|
85
|
+
break;
|
|
86
|
+
case "noop":
|
|
87
|
+
// Same content already in place — nothing to log.
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// No substrate values to mirror — clean up any stale sentinel block
|
|
93
|
+
// from a prior run so we don't leave dangling values behind.
|
|
94
|
+
await syncGradleProperties(bridge);
|
|
95
|
+
trace("dispatch", "env-bridge: no HOST/PORT in $NATIVEAPPTEMPLATE_API/.env; nothing to mirror");
|
|
96
|
+
}
|
|
10
97
|
const [rails, ios, android] = await Promise.all([
|
|
11
98
|
runRailsWorker(domain),
|
|
12
99
|
runIosWorker(domain),
|
|
13
100
|
runAndroidWorker(domain),
|
|
14
101
|
]);
|
|
15
102
|
const reviewer = await runReviewer({ domain, rails, ios, android });
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
103
|
+
// Visual judging is opt-in via NATIVEAPPTEMPLATE_VISUAL:
|
|
104
|
+
// =1 Stage 1 only — post-launch home screen rubric (substrate-leak
|
|
105
|
+
// detection + render sanity). Adds 60-180s for build mode.
|
|
106
|
+
// =2 Stage 1 + Stage 2 — same plus a scripted-CRUD walk via
|
|
107
|
+
// mobile-mcp (sign up → create resource → toggle state) with
|
|
108
|
+
// Layer 3 scoring on the post-toggle screen. Adds another
|
|
109
|
+
// 60-120s and requires a sim/emulator booted with the app
|
|
110
|
+
// already launched after Stage 1. Off by default.
|
|
111
|
+
const visualLevelRaw = process.env['NATIVEAPPTEMPLATE_VISUAL'] ?? "";
|
|
112
|
+
const visualLevel = visualLevelRaw === "2" ? 2 : visualLevelRaw === "1" ? 1 : 0;
|
|
113
|
+
// Visual levels force build mode so Stage 1 has an artifact to launch;
|
|
114
|
+
// level 0 stays in the cheaper fast mode. The repair loop re-validates
|
|
115
|
+
// Layer 2 in the same mode the judge used.
|
|
116
|
+
const layer2Mode = visualLevel >= 1 ? "build" : "fast";
|
|
117
|
+
const visual = visualLevel >= 1
|
|
22
118
|
? {
|
|
23
119
|
iosDir: resolve(process.cwd(), ios.outDir),
|
|
24
120
|
androidDir: resolve(process.cwd(), android.outDir),
|
|
25
121
|
spec: domain.displayName,
|
|
122
|
+
...(visualLevel >= 2
|
|
123
|
+
? {
|
|
124
|
+
stage2: {
|
|
125
|
+
primaryResourceName: domain.displayName,
|
|
126
|
+
fullName: "Stage Two Test",
|
|
127
|
+
// Unique per-run email so re-runs don't collide on
|
|
128
|
+
// "email already taken". The substrate's signup
|
|
129
|
+
// accepts "+tag" addresses as distinct identities.
|
|
130
|
+
email: `stage2+${Date.now()}@example.com`,
|
|
131
|
+
password: "ValidPassword1!",
|
|
132
|
+
railsOutDir: resolve(process.cwd(), rails.outDir),
|
|
133
|
+
},
|
|
134
|
+
}
|
|
135
|
+
: {}),
|
|
26
136
|
}
|
|
27
137
|
: undefined;
|
|
28
|
-
|
|
138
|
+
// For NATIVEAPPTEMPLATE_VISUAL=2, Stage 2 needs a live Rails server
|
|
139
|
+
// to talk to (the iOS/Android apps make real HTTP calls during
|
|
140
|
+
// signup, resource create, etc.). Layer 2 build mode validates that
|
|
141
|
+
// rails *boots*; we own keeping it *running* during Stage 2 here.
|
|
142
|
+
// Skip in judge-stub mode (smoke tests) — there's no real judge to
|
|
143
|
+
// serve, so spawning Rails would be useless and require `mise` in
|
|
144
|
+
// the test environment.
|
|
145
|
+
let railsServer;
|
|
146
|
+
if (visualLevel >= 2 && !isStub("judge")) {
|
|
147
|
+
railsServer = await startRails({ outDir: resolve(process.cwd(), rails.outDir) });
|
|
148
|
+
trace("dispatch", `rails-lifecycle: live at ${railsServer.url} for Stage 2`);
|
|
149
|
+
}
|
|
150
|
+
let judge;
|
|
151
|
+
try {
|
|
152
|
+
judge = await runJudge({
|
|
153
|
+
domain,
|
|
154
|
+
rails,
|
|
155
|
+
ios,
|
|
156
|
+
android,
|
|
157
|
+
reviewer,
|
|
158
|
+
layer2Mode,
|
|
159
|
+
...(visual ? { visual } : {}),
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
finally {
|
|
163
|
+
if (railsServer) {
|
|
164
|
+
await railsServer.stop().catch((err) => {
|
|
165
|
+
trace("dispatch", `rails-lifecycle: stop() error: ${err instanceof Error ? err.message : String(err)}`);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// Self-repair loop (opt-in via NATIVEAPPTEMPLATE_REPAIR). When the first
|
|
170
|
+
// judge pass fails on a code-repairable layer (Layer 1 leftover tokens or
|
|
171
|
+
// Layer 2 build errors), iterate: patch the failing platform with the
|
|
172
|
+
// repair agent, re-validate, record the attempt — bounded by the cap. Off
|
|
173
|
+
// by default; skipped in stub mode (no real judge/agent to drive).
|
|
174
|
+
let repairAttempts = [];
|
|
175
|
+
const repairMax = parseRepairMax(process.env['NATIVEAPPTEMPLATE_REPAIR']);
|
|
176
|
+
if (repairMax > 0 && !judge.overallPass && judge.platforms && judge.platforms.length > 0 && !isStub("judge")) {
|
|
177
|
+
const workers = { rails, ios, android };
|
|
178
|
+
const deps = {
|
|
179
|
+
repair: async (platform, layer, detail) => {
|
|
180
|
+
const w = workers[platform];
|
|
181
|
+
const outDir = resolve(process.cwd(), w.outDir);
|
|
182
|
+
const detailStr = layer === "layer1"
|
|
183
|
+
? formatFindings(detail.layer1.findings)
|
|
184
|
+
: detail.layer2.stderrTail ?? "(no stderr captured)";
|
|
185
|
+
return runRepair({
|
|
186
|
+
platform,
|
|
187
|
+
outDir,
|
|
188
|
+
layer,
|
|
189
|
+
detail: detailStr,
|
|
190
|
+
...(layer === "layer1" ? { forbiddenTokens: w.renamedFrom } : {}),
|
|
191
|
+
}, domain);
|
|
192
|
+
},
|
|
193
|
+
revalidate: async (platform) => {
|
|
194
|
+
const w = workers[platform];
|
|
195
|
+
const outDir = resolve(process.cwd(), w.outDir);
|
|
196
|
+
const [layer1, layer2] = await Promise.all([
|
|
197
|
+
runLayer1({ projectDir: outDir, forbiddenTokens: w.renamedFrom }),
|
|
198
|
+
runLayer2({ platform, outDir, mode: layer2Mode }),
|
|
199
|
+
]);
|
|
200
|
+
return {
|
|
201
|
+
layer1: { pass: layer1.pass, findings: layer1.findings },
|
|
202
|
+
layer2: {
|
|
203
|
+
pass: layer2.pass,
|
|
204
|
+
command: layer2.command,
|
|
205
|
+
mode: layer2Mode,
|
|
206
|
+
exitCode: layer2.exitCode,
|
|
207
|
+
durationMs: layer2.durationMs,
|
|
208
|
+
...(layer2.stderrTail !== undefined ? { stderrTail: layer2.stderrTail } : {}),
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
trace("dispatch", `self-repair: enabled (cap ${repairMax}); first pass failed — entering loop`);
|
|
214
|
+
const loop = await runRepairLoop({
|
|
215
|
+
platforms: judge.platforms,
|
|
216
|
+
reviewerPass: reviewer.contractParity === "pass",
|
|
217
|
+
maxIterations: repairMax,
|
|
218
|
+
deps,
|
|
219
|
+
});
|
|
220
|
+
repairAttempts = loop.attempts;
|
|
221
|
+
judge = { ...judge, overallPass: loop.overallPass, summary: loop.summary, platforms: loop.platforms };
|
|
222
|
+
const resolved = loop.attempts.filter((a) => a.resolved).length;
|
|
223
|
+
trace("dispatch", `self-repair: ${loop.attempts.length} attempt(s), ${resolved} resolved — overall now ${loop.overallPass ? "PASS" : "FAIL"}`);
|
|
224
|
+
}
|
|
225
|
+
const report = buildRunReport({
|
|
226
|
+
spec,
|
|
29
227
|
domain,
|
|
30
|
-
|
|
31
|
-
ios,
|
|
32
|
-
android,
|
|
228
|
+
judge,
|
|
33
229
|
reviewer,
|
|
34
|
-
|
|
35
|
-
|
|
230
|
+
agentVersion: readPackageVersion(),
|
|
231
|
+
judgeModel: "claude-opus-4-7",
|
|
232
|
+
visualLevel: visualLevel,
|
|
233
|
+
startedAt,
|
|
234
|
+
finishedAt: Date.now(),
|
|
235
|
+
repairAttempts,
|
|
36
236
|
});
|
|
237
|
+
// Default off in stub mode so the test suite never writes into ./out.
|
|
238
|
+
const reportOpts = options.report ?? {};
|
|
239
|
+
const reportEnabled = reportOpts.enabled ?? !isStub("dispatch");
|
|
240
|
+
let reportPaths = {};
|
|
241
|
+
if (reportEnabled) {
|
|
242
|
+
const dir = reportOpts.dir ?? resolve(process.cwd(), "out", domain.slug);
|
|
243
|
+
reportPaths = await writeReport(report, {
|
|
244
|
+
dir,
|
|
245
|
+
...(reportOpts.format !== undefined ? { format: reportOpts.format } : {}),
|
|
246
|
+
...(reportOpts.embed !== undefined ? { embed: reportOpts.embed } : {}),
|
|
247
|
+
});
|
|
248
|
+
const written = Object.values(reportPaths).filter(Boolean);
|
|
249
|
+
if (written.length > 0)
|
|
250
|
+
trace("dispatch", `report: wrote ${written.join(", ")}`);
|
|
251
|
+
}
|
|
252
|
+
return { ...judge, report, reportPaths, renameOverrideOutcomes };
|
|
253
|
+
}
|
|
254
|
+
// NATIVEAPPTEMPLATE_REPAIR control: unset / "0" / "off" / "false" → disabled;
|
|
255
|
+
// "on" / "true" → run up to the cap; a positive integer N → up to min(N, cap).
|
|
256
|
+
function parseRepairMax(raw) {
|
|
257
|
+
if (!raw)
|
|
258
|
+
return 0;
|
|
259
|
+
const lowered = raw.trim().toLowerCase();
|
|
260
|
+
if (lowered === "" || lowered === "0" || lowered === "off" || lowered === "false")
|
|
261
|
+
return 0;
|
|
262
|
+
if (lowered === "on" || lowered === "true")
|
|
263
|
+
return REPAIR_ITERATION_CAP;
|
|
264
|
+
const n = Number.parseInt(lowered, 10);
|
|
265
|
+
if (Number.isFinite(n) && n > 0)
|
|
266
|
+
return Math.min(n, REPAIR_ITERATION_CAP);
|
|
267
|
+
return 0;
|
|
268
|
+
}
|
|
269
|
+
function formatFindings(findings) {
|
|
270
|
+
if (findings.length === 0)
|
|
271
|
+
return "(no findings recorded)";
|
|
272
|
+
return findings.map((f) => `${f.token} · ${f.file}:${f.line} · ${f.text}`).join("\n");
|
|
37
273
|
}
|
|
38
274
|
//# sourceMappingURL=dispatch.js.map
|
package/dist/dispatch.js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AAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DomainSpec } from "./agents/types.js";
|
|
2
|
+
export type BridgeValues = {
|
|
3
|
+
readonly values: Readonly<Record<string, string>>;
|
|
4
|
+
};
|
|
5
|
+
export declare function productTokenFor(domain: DomainSpec): string;
|
|
6
|
+
export declare function readSubstrateApiVars(): Promise<Readonly<Record<string, string>>>;
|
|
7
|
+
export declare function buildBridgeValues(domain: DomainSpec): Promise<BridgeValues>;
|
|
8
|
+
export declare function applyBridgeToProcessEnv(bridge: BridgeValues): void;
|
|
9
|
+
export type SyncMode = "wrote" | "skipped" | "dry-run" | "noop";
|
|
10
|
+
export type SyncResult = {
|
|
11
|
+
path: string;
|
|
12
|
+
mode: SyncMode;
|
|
13
|
+
removedStale: boolean;
|
|
14
|
+
preview?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function syncGradleProperties(bridge: BridgeValues): Promise<SyncResult>;
|
|
17
|
+
//# sourceMappingURL=env-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-bridge.d.ts","sourceRoot":"","sources":["../src/env-bridge.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAsCpD,MAAM,MAAM,YAAY,GAAG;IAGzB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACnD,CAAC;AAEF,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAE1D;AAKD,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAyBtF;AAkBD,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAQjF;AAMD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAKlE;AAED,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;AAEhE,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,EAAE,OAAO,CAAC;IAGtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAoBF,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CA8BpF"}
|