@wix/ditto-codegen-public 1.0.362 → 1.0.364
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/dist/out.js +125 -157
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -12249,6 +12249,7 @@ TOOL USAGE:
|
|
|
12249
12249
|
- \`wix-generate\` to scaffold extensions non-interactively (wraps \`wix generate --params\`). Prefer it over hand-writing extension boilerplate. It RETURNS the full contents of every file the CLI created, so trust that output and do NOT \`read\`/\`batch-read\` those files afterward. If it returns a \`FAILED\` block, fix the params per the error and retry. Pass an array to scaffold several extensions in one call.
|
|
12250
12250
|
- \`required-permissions\` to declare the Wix app permissions the generated code needs. Call it ONCE at the end, and ONLY if permissions are actually needed \u2014 don't call it otherwise (see PERMISSIONS).
|
|
12251
12251
|
- \`user-actions\` to declare manual steps the user must perform for the app to work. Call it ONCE at the end, and ONLY if there are manual steps \u2014 don't call it otherwise (see USER ACTIONS).
|
|
12252
|
+
- Package dependencies \u2014 before importing from any package that is not already declared in \`package.json\`, run \`npm install <package-name>\` before the first \`validate\` call. Install ALL needed packages in ONE command when possible (e.g. \`npm install <package-1> <package-2>\`) \u2014 it is much faster than separate \`npm install\` calls. Do NOT wait for \`TS2307\`. \`npm install\` updates both \`package.json\` and \`node_modules\`; do not edit \`package.json\` manually for dependencies unless npm cannot be used.
|
|
12252
12253
|
- File operations \u2014 pick the BATCH tool whenever you have 2+ files; the single-file variants are 5\u201310\xD7 slower:
|
|
12253
12254
|
- \`batch-write\` to create N new files in one call. NEVER call \`write\` more than once per turn \u2014 use batch-write instead. \`write\` is reserved for single-file creation.
|
|
12254
12255
|
- \`batch-read\` to read N files in one call. NEVER call \`read\` more than once per turn \u2014 use batch-read instead.
|
|
@@ -12263,9 +12264,9 @@ TOOL USAGE:
|
|
|
12263
12264
|
IMPLEMENTATION WORKFLOW:
|
|
12264
12265
|
1. **Plan**: Determine extension types using the \`wix-app\` skill. Generate ALL UUIDs upfront. Include a \`progress\` call (e.g. "Planning extensions").
|
|
12265
12266
|
2. **Research**: Load relevant SDK docs and skills for each extension type. Include a \`progress\` call (e.g. "Reading documentation").
|
|
12266
|
-
3. **Build**:
|
|
12267
|
+
3. **Build**: Write files incrementally \u2014 group by logical section, NOT all at once. For complex tasks (300+ total lines across files), split into multiple \`batch-write\` calls. NEVER hold back writing until all code is planned \u2014 write each logical piece as soon as it is ready. Build all extensions before registering. Include one \`progress\` call per extension type (e.g. "Creating dashboard page", "Creating service plugin").
|
|
12267
12268
|
4. **Register**: Register all extensions in \`src/extensions.ts\`. Include a \`progress\` call (e.g. "Registering extensions").
|
|
12268
|
-
5. **Validate**: Run \`validate\` (typecheck only). Fix any errors and re-validate until tsc passes. Include a \`progress\` call (e.g. "Running type checks"). Then run \`validate({ runBuild: true })\` ONCE to verify the build. Pass \`installDeps: true\` ONLY when
|
|
12269
|
+
5. **Validate**: Run \`validate\` (typecheck only). Fix any errors and re-validate until tsc passes. Include a \`progress\` call (e.g. "Running type checks"). Then run \`validate({ runBuild: true })\` ONCE to verify the build. Pass \`installDeps: true\` ONLY when \`package.json\` changed without already running \`npm install <package-name>\` in this iteration; otherwise omit it (node_modules is pre-installed). Include a \`progress\` call (e.g. "Building project").
|
|
12269
12270
|
6. **Declare permissions**: If the generated code requires Wix app permissions, call \`required-permissions\` ONCE with their SCOPE IDs (see PERMISSIONS below). Skip this step entirely if no permissions are needed.
|
|
12270
12271
|
7. **Declare user actions**: If the user must perform manual steps for the app to work, call \`user-actions\` ONCE with them (see USER ACTIONS below). Skip this step entirely if there are none.
|
|
12271
12272
|
8. **Stop**: STOP immediately. Do NOT refactor, clean up, or verify.
|
|
@@ -12681,19 +12682,6 @@ var require_types4 = __commonJS({
|
|
|
12681
12682
|
}
|
|
12682
12683
|
});
|
|
12683
12684
|
|
|
12684
|
-
// dist/opencode-integration/internal-paths.js
|
|
12685
|
-
var require_internal_paths = __commonJS({
|
|
12686
|
-
"dist/opencode-integration/internal-paths.js"(exports2) {
|
|
12687
|
-
"use strict";
|
|
12688
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12689
|
-
exports2.isInternalPath = isInternalPath;
|
|
12690
|
-
var INTERNAL_PATH_PREFIXES = [".agents/"];
|
|
12691
|
-
function isInternalPath(path) {
|
|
12692
|
-
return INTERNAL_PATH_PREFIXES.some((prefix) => path.startsWith(prefix));
|
|
12693
|
-
}
|
|
12694
|
-
}
|
|
12695
|
-
});
|
|
12696
|
-
|
|
12697
12685
|
// dist/opencode-integration/normalize-tool-string.js
|
|
12698
12686
|
var require_normalize_tool_string = __commonJS({
|
|
12699
12687
|
"dist/opencode-integration/normalize-tool-string.js"(exports2) {
|
|
@@ -12726,17 +12714,13 @@ var require_parser = __commonJS({
|
|
|
12726
12714
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12727
12715
|
exports2.parseRequiredPermissions = parseRequiredPermissions;
|
|
12728
12716
|
exports2.parseUserActions = parseUserActions;
|
|
12729
|
-
exports2.parseFilesChanged = parseFilesChanged;
|
|
12730
12717
|
exports2.parseAnswerText = parseAnswerText;
|
|
12731
12718
|
exports2.createEmptyUsageStats = createEmptyUsageStats;
|
|
12732
12719
|
exports2.parseUsageStats = parseUsageStats;
|
|
12733
12720
|
exports2.mergeUsageStats = mergeUsageStats;
|
|
12734
12721
|
exports2.hasSessionError = hasSessionError;
|
|
12735
12722
|
exports2.summarizeOpenCodeLine = summarizeOpenCodeLine;
|
|
12736
|
-
var ditto_codegen_types_12 = require_dist4();
|
|
12737
12723
|
var types_1 = require_types4();
|
|
12738
|
-
var constants_1 = require_constants5();
|
|
12739
|
-
var internal_paths_1 = require_internal_paths();
|
|
12740
12724
|
var normalize_tool_string_1 = require_normalize_tool_string();
|
|
12741
12725
|
function parseEvents(output, type) {
|
|
12742
12726
|
return output.split("\n").filter((line) => line.trim()).map((line) => (0, types_1.tryParseJson)(line)).filter((event) => event !== null && event.type === type);
|
|
@@ -12775,54 +12759,6 @@ var require_parser = __commonJS({
|
|
|
12775
12759
|
}
|
|
12776
12760
|
return markdown;
|
|
12777
12761
|
}
|
|
12778
|
-
function parseFilesChanged(output) {
|
|
12779
|
-
const filesChanged = [];
|
|
12780
|
-
const seenPaths = /* @__PURE__ */ new Set();
|
|
12781
|
-
const addFileChange = (filePath, operation) => {
|
|
12782
|
-
const normalizedPath = (0, constants_1.normalizeFilePath)(filePath);
|
|
12783
|
-
if (normalizedPath && !(0, internal_paths_1.isInternalPath)(normalizedPath) && !seenPaths.has(normalizedPath)) {
|
|
12784
|
-
seenPaths.add(normalizedPath);
|
|
12785
|
-
filesChanged.push({ path: normalizedPath, operation });
|
|
12786
|
-
}
|
|
12787
|
-
};
|
|
12788
|
-
const lines = output.split("\n");
|
|
12789
|
-
for (const line of lines) {
|
|
12790
|
-
if (!line.trim())
|
|
12791
|
-
continue;
|
|
12792
|
-
const event = (0, types_1.tryParseJson)(line);
|
|
12793
|
-
if (!event || event.type !== "tool_use" || event.part?.state?.status !== "completed") {
|
|
12794
|
-
continue;
|
|
12795
|
-
}
|
|
12796
|
-
const tool = event.part.tool;
|
|
12797
|
-
const metadata = event.part.state.metadata;
|
|
12798
|
-
if (tool === "batch-write") {
|
|
12799
|
-
for (const f of event.part.state.input?.files ?? []) {
|
|
12800
|
-
addFileChange(f.path, ditto_codegen_types_12.ExtensionGenerationOperation.INSERT);
|
|
12801
|
-
}
|
|
12802
|
-
}
|
|
12803
|
-
if (tool === "multi-edit") {
|
|
12804
|
-
for (const e of event.part.state.input?.edits ?? []) {
|
|
12805
|
-
addFileChange(e.path, ditto_codegen_types_12.ExtensionGenerationOperation.EDIT);
|
|
12806
|
-
}
|
|
12807
|
-
}
|
|
12808
|
-
const operation = (0, constants_1.resolveFileOperation)(tool, metadata);
|
|
12809
|
-
if (operation) {
|
|
12810
|
-
const filePath = event.part.state.input?.filePath;
|
|
12811
|
-
if (filePath) {
|
|
12812
|
-
addFileChange(filePath, operation);
|
|
12813
|
-
}
|
|
12814
|
-
}
|
|
12815
|
-
if (tool === "task" && event.part.state.metadata?.summary) {
|
|
12816
|
-
for (const item of event.part.state.metadata.summary) {
|
|
12817
|
-
const summaryOperation = (0, constants_1.resolveFileOperation)(item.tool);
|
|
12818
|
-
if (summaryOperation && item.state?.status === "completed" && item.state?.title) {
|
|
12819
|
-
addFileChange(item.state.title, summaryOperation);
|
|
12820
|
-
}
|
|
12821
|
-
}
|
|
12822
|
-
}
|
|
12823
|
-
}
|
|
12824
|
-
return filesChanged;
|
|
12825
|
-
}
|
|
12826
12762
|
function parseAnswerText(output) {
|
|
12827
12763
|
return parseEvents(output, "text").map((event) => event.part?.text).filter(Boolean).join("").trim();
|
|
12828
12764
|
}
|
|
@@ -12941,6 +12877,100 @@ var require_parser = __commonJS({
|
|
|
12941
12877
|
}
|
|
12942
12878
|
});
|
|
12943
12879
|
|
|
12880
|
+
// dist/opencode-integration/internal-paths.js
|
|
12881
|
+
var require_internal_paths = __commonJS({
|
|
12882
|
+
"dist/opencode-integration/internal-paths.js"(exports2) {
|
|
12883
|
+
"use strict";
|
|
12884
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12885
|
+
exports2.isInternalPath = isInternalPath;
|
|
12886
|
+
var INTERNAL_PATH_PREFIXES = [".agents/"];
|
|
12887
|
+
function isInternalPath(path) {
|
|
12888
|
+
return INTERNAL_PATH_PREFIXES.some((prefix) => path.startsWith(prefix));
|
|
12889
|
+
}
|
|
12890
|
+
}
|
|
12891
|
+
});
|
|
12892
|
+
|
|
12893
|
+
// dist/opencode-integration/git-file-changes.js
|
|
12894
|
+
var require_git_file_changes = __commonJS({
|
|
12895
|
+
"dist/opencode-integration/git-file-changes.js"(exports2) {
|
|
12896
|
+
"use strict";
|
|
12897
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12898
|
+
exports2.captureGitBaseline = captureGitBaseline;
|
|
12899
|
+
exports2.collectGitFileChanges = collectGitFileChanges;
|
|
12900
|
+
var child_process_1 = require("child_process");
|
|
12901
|
+
var util_1 = require("util");
|
|
12902
|
+
var ditto_codegen_types_12 = require_dist4();
|
|
12903
|
+
var internal_paths_1 = require_internal_paths();
|
|
12904
|
+
var logger_12 = require_logger();
|
|
12905
|
+
var execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
|
|
12906
|
+
async function captureGitBaseline(cwd) {
|
|
12907
|
+
try {
|
|
12908
|
+
const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD"], {
|
|
12909
|
+
cwd
|
|
12910
|
+
});
|
|
12911
|
+
return stdout.trim();
|
|
12912
|
+
} catch (error) {
|
|
12913
|
+
logger_12.logger.warn("[OpenCode] Failed to capture git baseline, file tracking may be incomplete", {
|
|
12914
|
+
error: error instanceof Error ? error.message : String(error)
|
|
12915
|
+
});
|
|
12916
|
+
return "";
|
|
12917
|
+
}
|
|
12918
|
+
}
|
|
12919
|
+
async function collectGitFileChanges(cwd, baseline) {
|
|
12920
|
+
try {
|
|
12921
|
+
const [diffResult, untrackedResult] = await Promise.all([
|
|
12922
|
+
execFileAsync("git", [
|
|
12923
|
+
"-c",
|
|
12924
|
+
"core.quotepath=off",
|
|
12925
|
+
"diff",
|
|
12926
|
+
"--name-status",
|
|
12927
|
+
"--no-renames",
|
|
12928
|
+
"-z",
|
|
12929
|
+
baseline
|
|
12930
|
+
], { cwd, maxBuffer: 10 * 1024 * 1024 }),
|
|
12931
|
+
execFileAsync("git", ["ls-files", "--others", "--exclude-standard", "-z"], { cwd, maxBuffer: 10 * 1024 * 1024 })
|
|
12932
|
+
]);
|
|
12933
|
+
const files = parseDiffNameStatus(diffResult.stdout);
|
|
12934
|
+
appendUntrackedFiles(untrackedResult.stdout, files);
|
|
12935
|
+
const userFiles = files.filter((f) => !(0, internal_paths_1.isInternalPath)(f.path));
|
|
12936
|
+
userFiles.sort((a, b) => a.path.localeCompare(b.path));
|
|
12937
|
+
return userFiles;
|
|
12938
|
+
} catch (error) {
|
|
12939
|
+
logger_12.logger.error("[OpenCode] Failed to collect git file changes", {
|
|
12940
|
+
error: error instanceof Error ? error.message : String(error)
|
|
12941
|
+
});
|
|
12942
|
+
return [];
|
|
12943
|
+
}
|
|
12944
|
+
}
|
|
12945
|
+
var GIT_STATUS_TO_OPERATION = {
|
|
12946
|
+
A: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT,
|
|
12947
|
+
M: ditto_codegen_types_12.ExtensionGenerationOperation.EDIT,
|
|
12948
|
+
D: ditto_codegen_types_12.ExtensionGenerationOperation.DELETE
|
|
12949
|
+
};
|
|
12950
|
+
function parseDiffNameStatus(raw) {
|
|
12951
|
+
const files = [];
|
|
12952
|
+
const parts = raw.split("\0").filter(Boolean);
|
|
12953
|
+
for (let i = 0; i < parts.length - 1; i += 2) {
|
|
12954
|
+
const operation = GIT_STATUS_TO_OPERATION[parts[i]];
|
|
12955
|
+
const path = parts[i + 1];
|
|
12956
|
+
if (path && operation) {
|
|
12957
|
+
files.push({ path, operation });
|
|
12958
|
+
}
|
|
12959
|
+
}
|
|
12960
|
+
return files;
|
|
12961
|
+
}
|
|
12962
|
+
function appendUntrackedFiles(raw, files) {
|
|
12963
|
+
const knownPaths = new Set(files.map((f) => f.path));
|
|
12964
|
+
const paths = raw.split("\0").filter(Boolean);
|
|
12965
|
+
for (const path of paths) {
|
|
12966
|
+
if (!knownPaths.has(path)) {
|
|
12967
|
+
files.push({ path, operation: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT });
|
|
12968
|
+
}
|
|
12969
|
+
}
|
|
12970
|
+
}
|
|
12971
|
+
}
|
|
12972
|
+
});
|
|
12973
|
+
|
|
12944
12974
|
// dist/opencode-integration/cost-tracker.js
|
|
12945
12975
|
var require_cost_tracker = __commonJS({
|
|
12946
12976
|
"dist/opencode-integration/cost-tracker.js"(exports2) {
|
|
@@ -13179,7 +13209,7 @@ var require_process_manager = __commonJS({
|
|
|
13179
13209
|
exports2.clearTimers = clearTimers;
|
|
13180
13210
|
exports2.killProcess = killProcess;
|
|
13181
13211
|
var logger_12 = require_logger();
|
|
13182
|
-
exports2.IDLE_TIMEOUT_MS =
|
|
13212
|
+
exports2.IDLE_TIMEOUT_MS = 24e4;
|
|
13183
13213
|
exports2.IDLE_CHECK_INTERVAL_MS = 15e3;
|
|
13184
13214
|
exports2.KILL_GRACE_PERIOD_MS = 5e3;
|
|
13185
13215
|
function clearTimers(timers) {
|
|
@@ -13241,7 +13271,6 @@ var require_result_builder = __commonJS({
|
|
|
13241
13271
|
error: new ditto_codegen_types_12.TimeoutError(message),
|
|
13242
13272
|
durationMs: Date.now() - startTime,
|
|
13243
13273
|
requiredPermissions: [],
|
|
13244
|
-
filesChanged: (0, parser_1.parseFilesChanged)(stdout),
|
|
13245
13274
|
usage: (0, parser_1.parseUsageStats)(stdout),
|
|
13246
13275
|
skillsUsed: []
|
|
13247
13276
|
};
|
|
@@ -13260,7 +13289,6 @@ var require_result_builder = __commonJS({
|
|
|
13260
13289
|
}) : void 0,
|
|
13261
13290
|
durationMs: Date.now() - startTime,
|
|
13262
13291
|
requiredPermissions: (0, parser_1.parseRequiredPermissions)(stdout),
|
|
13263
|
-
filesChanged: (0, parser_1.parseFilesChanged)(stdout),
|
|
13264
13292
|
usage: (0, parser_1.parseUsageStats)(stdout),
|
|
13265
13293
|
skillsUsed: []
|
|
13266
13294
|
};
|
|
@@ -13278,7 +13306,6 @@ var require_result_builder = __commonJS({
|
|
|
13278
13306
|
}),
|
|
13279
13307
|
durationMs: Date.now() - startTime,
|
|
13280
13308
|
requiredPermissions: [],
|
|
13281
|
-
filesChanged: [],
|
|
13282
13309
|
usage: (0, parser_1.createEmptyUsageStats)(),
|
|
13283
13310
|
skillsUsed: []
|
|
13284
13311
|
};
|
|
@@ -13388,6 +13415,7 @@ var require_executor = __commonJS({
|
|
|
13388
13415
|
var job_context_storage_12 = require_job_context_storage();
|
|
13389
13416
|
var parser_1 = require_parser();
|
|
13390
13417
|
var prompts_1 = require_prompts();
|
|
13418
|
+
var git_file_changes_1 = require_git_file_changes();
|
|
13391
13419
|
var cost_tracker_1 = require_cost_tracker();
|
|
13392
13420
|
var task_tracker_1 = require_task_tracker2();
|
|
13393
13421
|
var process_manager_1 = require_process_manager();
|
|
@@ -13404,7 +13432,7 @@ var require_executor = __commonJS({
|
|
|
13404
13432
|
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
|
13405
13433
|
if (attempt > 1) {
|
|
13406
13434
|
logger_12.logger.info(`[OpenCode] Retry attempt ${attempt}/${MAX_RETRIES} - starting fresh session with recovery context`);
|
|
13407
|
-
const filesChanged = (0,
|
|
13435
|
+
const filesChanged = await (0, git_file_changes_1.collectGitFileChanges)(options.outputPath, options.gitBaseline);
|
|
13408
13436
|
currentPrompt = (0, prompts_1.buildRecoveryPrompt)(options.prompt, filesChanged, lastResult?.error?.message || lastResult?.stderr || "Process timed out");
|
|
13409
13437
|
continueSession = false;
|
|
13410
13438
|
}
|
|
@@ -13420,7 +13448,6 @@ var require_executor = __commonJS({
|
|
|
13420
13448
|
const finalResult2 = {
|
|
13421
13449
|
...result,
|
|
13422
13450
|
userActions: (0, parser_1.parseUserActions)(accumulatedStdout),
|
|
13423
|
-
filesChanged: (0, parser_1.parseFilesChanged)(accumulatedStdout),
|
|
13424
13451
|
usage: accumulatedUsage,
|
|
13425
13452
|
skillsUsed: accumulatedSkills
|
|
13426
13453
|
};
|
|
@@ -13441,7 +13468,6 @@ var require_executor = __commonJS({
|
|
|
13441
13468
|
const finalResult = {
|
|
13442
13469
|
...lastResult,
|
|
13443
13470
|
userActions: (0, parser_1.parseUserActions)(accumulatedStdout),
|
|
13444
|
-
filesChanged: (0, parser_1.parseFilesChanged)(accumulatedStdout),
|
|
13445
13471
|
usage: accumulatedUsage,
|
|
13446
13472
|
skillsUsed: Array.from(accumulatedSkills)
|
|
13447
13473
|
};
|
|
@@ -13530,7 +13556,6 @@ var require_executor = __commonJS({
|
|
|
13530
13556
|
}),
|
|
13531
13557
|
durationMs: Date.now() - startTime,
|
|
13532
13558
|
requiredPermissions: [],
|
|
13533
|
-
filesChanged: [],
|
|
13534
13559
|
usage: (0, parser_1.createEmptyUsageStats)(),
|
|
13535
13560
|
skillsUsed: []
|
|
13536
13561
|
});
|
|
@@ -13552,30 +13577,39 @@ var require_opencode_runner = __commonJS({
|
|
|
13552
13577
|
var executor_1 = require_executor();
|
|
13553
13578
|
var parser_1 = require_parser();
|
|
13554
13579
|
async function runOpenCodeInit(options) {
|
|
13555
|
-
const { blueprint, outputPath, projectId, chatHistory, onStdout, onStderr } = options;
|
|
13580
|
+
const { blueprint, outputPath, projectId, chatHistory, gitBaseline, onStdout, onStderr } = options;
|
|
13556
13581
|
const prompt = (0, prompts_1.buildInitPrompt)(blueprint, chatHistory);
|
|
13557
|
-
return (0, executor_1.executeOpenCode)({
|
|
13582
|
+
return (0, executor_1.executeOpenCode)({
|
|
13583
|
+
prompt,
|
|
13584
|
+
outputPath,
|
|
13585
|
+
projectId,
|
|
13586
|
+
gitBaseline,
|
|
13587
|
+
onStdout,
|
|
13588
|
+
onStderr
|
|
13589
|
+
});
|
|
13558
13590
|
}
|
|
13559
13591
|
async function runOpenCodeIteration(options) {
|
|
13560
|
-
const { outputPath, projectId, chatHistory, onStdout, onStderr } = options;
|
|
13592
|
+
const { outputPath, projectId, chatHistory, gitBaseline, onStdout, onStderr } = options;
|
|
13561
13593
|
const prompt = (0, prompts_1.buildIterationPrompt)(chatHistory);
|
|
13562
13594
|
return (0, executor_1.executeOpenCode)({
|
|
13563
13595
|
prompt,
|
|
13564
13596
|
outputPath,
|
|
13565
13597
|
projectId,
|
|
13566
13598
|
continueSession: true,
|
|
13599
|
+
gitBaseline,
|
|
13567
13600
|
onStdout,
|
|
13568
13601
|
onStderr
|
|
13569
13602
|
});
|
|
13570
13603
|
}
|
|
13571
13604
|
async function runOpenCodeAsk(options) {
|
|
13572
|
-
const { outputPath, projectId, chatHistory, onStdout, onStderr } = options;
|
|
13605
|
+
const { outputPath, projectId, chatHistory, gitBaseline, onStdout, onStderr } = options;
|
|
13573
13606
|
const prompt = (0, prompts_1.buildAskPrompt)(chatHistory);
|
|
13574
13607
|
const result = await (0, executor_1.executeOpenCode)({
|
|
13575
13608
|
prompt,
|
|
13576
13609
|
outputPath,
|
|
13577
13610
|
projectId,
|
|
13578
13611
|
continueSession: true,
|
|
13612
|
+
gitBaseline,
|
|
13579
13613
|
onStdout,
|
|
13580
13614
|
onStderr
|
|
13581
13615
|
});
|
|
@@ -13703,7 +13737,7 @@ var require_OpenCodeOrchestrator = __commonJS({
|
|
|
13703
13737
|
super();
|
|
13704
13738
|
}
|
|
13705
13739
|
async generateCode(request) {
|
|
13706
|
-
const { blueprint, outputPath, projectId, chatHistory } = request;
|
|
13740
|
+
const { blueprint, outputPath, projectId, chatHistory, gitBaseline } = request;
|
|
13707
13741
|
this.emitEvent("start:init", {
|
|
13708
13742
|
appName: blueprint.appName ?? "",
|
|
13709
13743
|
summary: blueprint.summary ?? "",
|
|
@@ -13717,6 +13751,7 @@ var require_OpenCodeOrchestrator = __commonJS({
|
|
|
13717
13751
|
outputPath,
|
|
13718
13752
|
projectId,
|
|
13719
13753
|
chatHistory,
|
|
13754
|
+
gitBaseline,
|
|
13720
13755
|
onStdout: (data) => {
|
|
13721
13756
|
this.emitEvent("opencode:output", { data });
|
|
13722
13757
|
},
|
|
@@ -13895,78 +13930,6 @@ var require_agent_io = __commonJS({
|
|
|
13895
13930
|
}
|
|
13896
13931
|
});
|
|
13897
13932
|
|
|
13898
|
-
// dist/opencode-integration/git-file-changes.js
|
|
13899
|
-
var require_git_file_changes = __commonJS({
|
|
13900
|
-
"dist/opencode-integration/git-file-changes.js"(exports2) {
|
|
13901
|
-
"use strict";
|
|
13902
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
13903
|
-
exports2.captureGitBaseline = captureGitBaseline;
|
|
13904
|
-
exports2.collectGitFileChanges = collectGitFileChanges;
|
|
13905
|
-
var child_process_1 = require("child_process");
|
|
13906
|
-
var util_1 = require("util");
|
|
13907
|
-
var ditto_codegen_types_12 = require_dist4();
|
|
13908
|
-
var internal_paths_1 = require_internal_paths();
|
|
13909
|
-
var logger_12 = require_logger();
|
|
13910
|
-
var execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
|
|
13911
|
-
async function captureGitBaseline(cwd) {
|
|
13912
|
-
const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD"], { cwd });
|
|
13913
|
-
return stdout.trim();
|
|
13914
|
-
}
|
|
13915
|
-
async function collectGitFileChanges(cwd, baseline) {
|
|
13916
|
-
try {
|
|
13917
|
-
const [diffResult, untrackedResult] = await Promise.all([
|
|
13918
|
-
execFileAsync("git", [
|
|
13919
|
-
"-c",
|
|
13920
|
-
"core.quotepath=off",
|
|
13921
|
-
"diff",
|
|
13922
|
-
"--name-status",
|
|
13923
|
-
"--no-renames",
|
|
13924
|
-
"-z",
|
|
13925
|
-
baseline
|
|
13926
|
-
], { cwd, maxBuffer: 10 * 1024 * 1024 }),
|
|
13927
|
-
execFileAsync("git", ["ls-files", "--others", "--exclude-standard", "-z"], { cwd, maxBuffer: 10 * 1024 * 1024 })
|
|
13928
|
-
]);
|
|
13929
|
-
const files = parseDiffNameStatus(diffResult.stdout);
|
|
13930
|
-
appendUntrackedFiles(untrackedResult.stdout, files);
|
|
13931
|
-
const userFiles = files.filter((f) => !(0, internal_paths_1.isInternalPath)(f.path));
|
|
13932
|
-
userFiles.sort((a, b) => a.path.localeCompare(b.path));
|
|
13933
|
-
return userFiles;
|
|
13934
|
-
} catch (error) {
|
|
13935
|
-
logger_12.logger.error("[OpenCode] Failed to collect git file changes", {
|
|
13936
|
-
error: error instanceof Error ? error.message : String(error)
|
|
13937
|
-
});
|
|
13938
|
-
return [];
|
|
13939
|
-
}
|
|
13940
|
-
}
|
|
13941
|
-
var GIT_STATUS_TO_OPERATION = {
|
|
13942
|
-
A: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT,
|
|
13943
|
-
M: ditto_codegen_types_12.ExtensionGenerationOperation.EDIT,
|
|
13944
|
-
D: ditto_codegen_types_12.ExtensionGenerationOperation.DELETE
|
|
13945
|
-
};
|
|
13946
|
-
function parseDiffNameStatus(raw) {
|
|
13947
|
-
const files = [];
|
|
13948
|
-
const parts = raw.split("\0").filter(Boolean);
|
|
13949
|
-
for (let i = 0; i < parts.length - 1; i += 2) {
|
|
13950
|
-
const operation = GIT_STATUS_TO_OPERATION[parts[i]];
|
|
13951
|
-
const path = parts[i + 1];
|
|
13952
|
-
if (path && operation) {
|
|
13953
|
-
files.push({ path, operation });
|
|
13954
|
-
}
|
|
13955
|
-
}
|
|
13956
|
-
return files;
|
|
13957
|
-
}
|
|
13958
|
-
function appendUntrackedFiles(raw, files) {
|
|
13959
|
-
const knownPaths = new Set(files.map((f) => f.path));
|
|
13960
|
-
const paths = raw.split("\0").filter(Boolean);
|
|
13961
|
-
for (const path of paths) {
|
|
13962
|
-
if (!knownPaths.has(path)) {
|
|
13963
|
-
files.push({ path, operation: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT });
|
|
13964
|
-
}
|
|
13965
|
-
}
|
|
13966
|
-
}
|
|
13967
|
-
}
|
|
13968
|
-
});
|
|
13969
|
-
|
|
13970
13933
|
// dist/opencode-integration/inject-created-by.js
|
|
13971
13934
|
var require_inject_created_by = __commonJS({
|
|
13972
13935
|
"dist/opencode-integration/inject-created-by.js"(exports2) {
|
|
@@ -19036,7 +18999,8 @@ var require_opencode_init = __commonJS({
|
|
|
19036
18999
|
blueprint: finalBlueprint,
|
|
19037
19000
|
outputPath,
|
|
19038
19001
|
projectId: context_12.ctx.projectId,
|
|
19039
|
-
chatHistory: history
|
|
19002
|
+
chatHistory: history,
|
|
19003
|
+
gitBaseline
|
|
19040
19004
|
});
|
|
19041
19005
|
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19042
19006
|
const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
|
|
@@ -19125,7 +19089,7 @@ var require_OpenCodeIterationOrchestrator = __commonJS({
|
|
|
19125
19089
|
super();
|
|
19126
19090
|
}
|
|
19127
19091
|
async generateIterationCode(request) {
|
|
19128
|
-
const { outputPath, projectId, chatHistory } = request;
|
|
19092
|
+
const { outputPath, projectId, chatHistory, gitBaseline } = request;
|
|
19129
19093
|
this.emitEvent("start:iteration", { outputPath });
|
|
19130
19094
|
const start = Date.now();
|
|
19131
19095
|
this.emitEvent("opencode:start", { outputPath });
|
|
@@ -19133,6 +19097,7 @@ var require_OpenCodeIterationOrchestrator = __commonJS({
|
|
|
19133
19097
|
outputPath,
|
|
19134
19098
|
projectId,
|
|
19135
19099
|
chatHistory,
|
|
19100
|
+
gitBaseline,
|
|
19136
19101
|
onStdout: (data) => {
|
|
19137
19102
|
this.emitEvent("opencode:output", { data });
|
|
19138
19103
|
},
|
|
@@ -19220,7 +19185,8 @@ var require_opencode_iterate = __commonJS({
|
|
|
19220
19185
|
const result = await iterationOrchestrator.generateIterationCode({
|
|
19221
19186
|
outputPath,
|
|
19222
19187
|
projectId: context_12.ctx.projectId,
|
|
19223
|
-
chatHistory
|
|
19188
|
+
chatHistory,
|
|
19189
|
+
gitBaseline
|
|
19224
19190
|
});
|
|
19225
19191
|
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19226
19192
|
const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
|
|
@@ -19309,7 +19275,7 @@ var require_OpenCodeAskOrchestrator = __commonJS({
|
|
|
19309
19275
|
super();
|
|
19310
19276
|
}
|
|
19311
19277
|
async ask(request) {
|
|
19312
|
-
const { outputPath, projectId, chatHistory } = request;
|
|
19278
|
+
const { outputPath, projectId, chatHistory, gitBaseline } = request;
|
|
19313
19279
|
this.emitEvent("start:ask", { outputPath });
|
|
19314
19280
|
this.emitEvent("opencode:start", { outputPath });
|
|
19315
19281
|
const start = Date.now();
|
|
@@ -19317,6 +19283,7 @@ var require_OpenCodeAskOrchestrator = __commonJS({
|
|
|
19317
19283
|
outputPath,
|
|
19318
19284
|
projectId,
|
|
19319
19285
|
chatHistory,
|
|
19286
|
+
gitBaseline,
|
|
19320
19287
|
onStdout: (data) => {
|
|
19321
19288
|
this.emitEvent("opencode:output", { data });
|
|
19322
19289
|
},
|
|
@@ -19399,7 +19366,8 @@ var require_opencode_ask = __commonJS({
|
|
|
19399
19366
|
const result = await askOrchestrator.ask({
|
|
19400
19367
|
outputPath,
|
|
19401
19368
|
projectId: context_12.ctx.projectId,
|
|
19402
|
-
chatHistory
|
|
19369
|
+
chatHistory,
|
|
19370
|
+
gitBaseline
|
|
19403
19371
|
});
|
|
19404
19372
|
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19405
19373
|
const extensions = await (0, collect_extensions_created_1.buildExtensionsJobPayload)(outputPath, files);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/ditto-codegen-public",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.364",
|
|
4
4
|
"description": "AI-powered Wix CLI app generator - standalone executable",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "node build.mjs",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"esbuild": "^0.27.2",
|
|
30
30
|
"vitest": "^4.0.16"
|
|
31
31
|
},
|
|
32
|
-
"falconPackageHash": "
|
|
32
|
+
"falconPackageHash": "d3f73d5ef81d405259fbb65db9cd00e9d67193b0aec3a09b82a69337"
|
|
33
33
|
}
|