@wix/ditto-codegen-public 1.0.362 → 1.0.363
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 +123 -156
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -12263,7 +12263,7 @@ TOOL USAGE:
|
|
|
12263
12263
|
IMPLEMENTATION WORKFLOW:
|
|
12264
12264
|
1. **Plan**: Determine extension types using the \`wix-app\` skill. Generate ALL UUIDs upfront. Include a \`progress\` call (e.g. "Planning extensions").
|
|
12265
12265
|
2. **Research**: Load relevant SDK docs and skills for each extension type. Include a \`progress\` call (e.g. "Reading documentation").
|
|
12266
|
-
3. **Build**:
|
|
12266
|
+
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
12267
|
4. **Register**: Register all extensions in \`src/extensions.ts\`. Include a \`progress\` call (e.g. "Registering extensions").
|
|
12268
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 you added a new dependency to package.json in this iteration; otherwise omit it (node_modules is pre-installed). Include a \`progress\` call (e.g. "Building project").
|
|
12269
12269
|
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.
|
|
@@ -12681,19 +12681,6 @@ var require_types4 = __commonJS({
|
|
|
12681
12681
|
}
|
|
12682
12682
|
});
|
|
12683
12683
|
|
|
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
12684
|
// dist/opencode-integration/normalize-tool-string.js
|
|
12698
12685
|
var require_normalize_tool_string = __commonJS({
|
|
12699
12686
|
"dist/opencode-integration/normalize-tool-string.js"(exports2) {
|
|
@@ -12726,17 +12713,13 @@ var require_parser = __commonJS({
|
|
|
12726
12713
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12727
12714
|
exports2.parseRequiredPermissions = parseRequiredPermissions;
|
|
12728
12715
|
exports2.parseUserActions = parseUserActions;
|
|
12729
|
-
exports2.parseFilesChanged = parseFilesChanged;
|
|
12730
12716
|
exports2.parseAnswerText = parseAnswerText;
|
|
12731
12717
|
exports2.createEmptyUsageStats = createEmptyUsageStats;
|
|
12732
12718
|
exports2.parseUsageStats = parseUsageStats;
|
|
12733
12719
|
exports2.mergeUsageStats = mergeUsageStats;
|
|
12734
12720
|
exports2.hasSessionError = hasSessionError;
|
|
12735
12721
|
exports2.summarizeOpenCodeLine = summarizeOpenCodeLine;
|
|
12736
|
-
var ditto_codegen_types_12 = require_dist4();
|
|
12737
12722
|
var types_1 = require_types4();
|
|
12738
|
-
var constants_1 = require_constants5();
|
|
12739
|
-
var internal_paths_1 = require_internal_paths();
|
|
12740
12723
|
var normalize_tool_string_1 = require_normalize_tool_string();
|
|
12741
12724
|
function parseEvents(output, type) {
|
|
12742
12725
|
return output.split("\n").filter((line) => line.trim()).map((line) => (0, types_1.tryParseJson)(line)).filter((event) => event !== null && event.type === type);
|
|
@@ -12775,54 +12758,6 @@ var require_parser = __commonJS({
|
|
|
12775
12758
|
}
|
|
12776
12759
|
return markdown;
|
|
12777
12760
|
}
|
|
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
12761
|
function parseAnswerText(output) {
|
|
12827
12762
|
return parseEvents(output, "text").map((event) => event.part?.text).filter(Boolean).join("").trim();
|
|
12828
12763
|
}
|
|
@@ -12941,6 +12876,100 @@ var require_parser = __commonJS({
|
|
|
12941
12876
|
}
|
|
12942
12877
|
});
|
|
12943
12878
|
|
|
12879
|
+
// dist/opencode-integration/internal-paths.js
|
|
12880
|
+
var require_internal_paths = __commonJS({
|
|
12881
|
+
"dist/opencode-integration/internal-paths.js"(exports2) {
|
|
12882
|
+
"use strict";
|
|
12883
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12884
|
+
exports2.isInternalPath = isInternalPath;
|
|
12885
|
+
var INTERNAL_PATH_PREFIXES = [".agents/"];
|
|
12886
|
+
function isInternalPath(path) {
|
|
12887
|
+
return INTERNAL_PATH_PREFIXES.some((prefix) => path.startsWith(prefix));
|
|
12888
|
+
}
|
|
12889
|
+
}
|
|
12890
|
+
});
|
|
12891
|
+
|
|
12892
|
+
// dist/opencode-integration/git-file-changes.js
|
|
12893
|
+
var require_git_file_changes = __commonJS({
|
|
12894
|
+
"dist/opencode-integration/git-file-changes.js"(exports2) {
|
|
12895
|
+
"use strict";
|
|
12896
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12897
|
+
exports2.captureGitBaseline = captureGitBaseline;
|
|
12898
|
+
exports2.collectGitFileChanges = collectGitFileChanges;
|
|
12899
|
+
var child_process_1 = require("child_process");
|
|
12900
|
+
var util_1 = require("util");
|
|
12901
|
+
var ditto_codegen_types_12 = require_dist4();
|
|
12902
|
+
var internal_paths_1 = require_internal_paths();
|
|
12903
|
+
var logger_12 = require_logger();
|
|
12904
|
+
var execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
|
|
12905
|
+
async function captureGitBaseline(cwd) {
|
|
12906
|
+
try {
|
|
12907
|
+
const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD"], {
|
|
12908
|
+
cwd
|
|
12909
|
+
});
|
|
12910
|
+
return stdout.trim();
|
|
12911
|
+
} catch (error) {
|
|
12912
|
+
logger_12.logger.warn("[OpenCode] Failed to capture git baseline, file tracking may be incomplete", {
|
|
12913
|
+
error: error instanceof Error ? error.message : String(error)
|
|
12914
|
+
});
|
|
12915
|
+
return "";
|
|
12916
|
+
}
|
|
12917
|
+
}
|
|
12918
|
+
async function collectGitFileChanges(cwd, baseline) {
|
|
12919
|
+
try {
|
|
12920
|
+
const [diffResult, untrackedResult] = await Promise.all([
|
|
12921
|
+
execFileAsync("git", [
|
|
12922
|
+
"-c",
|
|
12923
|
+
"core.quotepath=off",
|
|
12924
|
+
"diff",
|
|
12925
|
+
"--name-status",
|
|
12926
|
+
"--no-renames",
|
|
12927
|
+
"-z",
|
|
12928
|
+
baseline
|
|
12929
|
+
], { cwd, maxBuffer: 10 * 1024 * 1024 }),
|
|
12930
|
+
execFileAsync("git", ["ls-files", "--others", "--exclude-standard", "-z"], { cwd, maxBuffer: 10 * 1024 * 1024 })
|
|
12931
|
+
]);
|
|
12932
|
+
const files = parseDiffNameStatus(diffResult.stdout);
|
|
12933
|
+
appendUntrackedFiles(untrackedResult.stdout, files);
|
|
12934
|
+
const userFiles = files.filter((f) => !(0, internal_paths_1.isInternalPath)(f.path));
|
|
12935
|
+
userFiles.sort((a, b) => a.path.localeCompare(b.path));
|
|
12936
|
+
return userFiles;
|
|
12937
|
+
} catch (error) {
|
|
12938
|
+
logger_12.logger.error("[OpenCode] Failed to collect git file changes", {
|
|
12939
|
+
error: error instanceof Error ? error.message : String(error)
|
|
12940
|
+
});
|
|
12941
|
+
return [];
|
|
12942
|
+
}
|
|
12943
|
+
}
|
|
12944
|
+
var GIT_STATUS_TO_OPERATION = {
|
|
12945
|
+
A: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT,
|
|
12946
|
+
M: ditto_codegen_types_12.ExtensionGenerationOperation.EDIT,
|
|
12947
|
+
D: ditto_codegen_types_12.ExtensionGenerationOperation.DELETE
|
|
12948
|
+
};
|
|
12949
|
+
function parseDiffNameStatus(raw) {
|
|
12950
|
+
const files = [];
|
|
12951
|
+
const parts = raw.split("\0").filter(Boolean);
|
|
12952
|
+
for (let i = 0; i < parts.length - 1; i += 2) {
|
|
12953
|
+
const operation = GIT_STATUS_TO_OPERATION[parts[i]];
|
|
12954
|
+
const path = parts[i + 1];
|
|
12955
|
+
if (path && operation) {
|
|
12956
|
+
files.push({ path, operation });
|
|
12957
|
+
}
|
|
12958
|
+
}
|
|
12959
|
+
return files;
|
|
12960
|
+
}
|
|
12961
|
+
function appendUntrackedFiles(raw, files) {
|
|
12962
|
+
const knownPaths = new Set(files.map((f) => f.path));
|
|
12963
|
+
const paths = raw.split("\0").filter(Boolean);
|
|
12964
|
+
for (const path of paths) {
|
|
12965
|
+
if (!knownPaths.has(path)) {
|
|
12966
|
+
files.push({ path, operation: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT });
|
|
12967
|
+
}
|
|
12968
|
+
}
|
|
12969
|
+
}
|
|
12970
|
+
}
|
|
12971
|
+
});
|
|
12972
|
+
|
|
12944
12973
|
// dist/opencode-integration/cost-tracker.js
|
|
12945
12974
|
var require_cost_tracker = __commonJS({
|
|
12946
12975
|
"dist/opencode-integration/cost-tracker.js"(exports2) {
|
|
@@ -13179,7 +13208,7 @@ var require_process_manager = __commonJS({
|
|
|
13179
13208
|
exports2.clearTimers = clearTimers;
|
|
13180
13209
|
exports2.killProcess = killProcess;
|
|
13181
13210
|
var logger_12 = require_logger();
|
|
13182
|
-
exports2.IDLE_TIMEOUT_MS =
|
|
13211
|
+
exports2.IDLE_TIMEOUT_MS = 24e4;
|
|
13183
13212
|
exports2.IDLE_CHECK_INTERVAL_MS = 15e3;
|
|
13184
13213
|
exports2.KILL_GRACE_PERIOD_MS = 5e3;
|
|
13185
13214
|
function clearTimers(timers) {
|
|
@@ -13241,7 +13270,6 @@ var require_result_builder = __commonJS({
|
|
|
13241
13270
|
error: new ditto_codegen_types_12.TimeoutError(message),
|
|
13242
13271
|
durationMs: Date.now() - startTime,
|
|
13243
13272
|
requiredPermissions: [],
|
|
13244
|
-
filesChanged: (0, parser_1.parseFilesChanged)(stdout),
|
|
13245
13273
|
usage: (0, parser_1.parseUsageStats)(stdout),
|
|
13246
13274
|
skillsUsed: []
|
|
13247
13275
|
};
|
|
@@ -13260,7 +13288,6 @@ var require_result_builder = __commonJS({
|
|
|
13260
13288
|
}) : void 0,
|
|
13261
13289
|
durationMs: Date.now() - startTime,
|
|
13262
13290
|
requiredPermissions: (0, parser_1.parseRequiredPermissions)(stdout),
|
|
13263
|
-
filesChanged: (0, parser_1.parseFilesChanged)(stdout),
|
|
13264
13291
|
usage: (0, parser_1.parseUsageStats)(stdout),
|
|
13265
13292
|
skillsUsed: []
|
|
13266
13293
|
};
|
|
@@ -13278,7 +13305,6 @@ var require_result_builder = __commonJS({
|
|
|
13278
13305
|
}),
|
|
13279
13306
|
durationMs: Date.now() - startTime,
|
|
13280
13307
|
requiredPermissions: [],
|
|
13281
|
-
filesChanged: [],
|
|
13282
13308
|
usage: (0, parser_1.createEmptyUsageStats)(),
|
|
13283
13309
|
skillsUsed: []
|
|
13284
13310
|
};
|
|
@@ -13388,6 +13414,7 @@ var require_executor = __commonJS({
|
|
|
13388
13414
|
var job_context_storage_12 = require_job_context_storage();
|
|
13389
13415
|
var parser_1 = require_parser();
|
|
13390
13416
|
var prompts_1 = require_prompts();
|
|
13417
|
+
var git_file_changes_1 = require_git_file_changes();
|
|
13391
13418
|
var cost_tracker_1 = require_cost_tracker();
|
|
13392
13419
|
var task_tracker_1 = require_task_tracker2();
|
|
13393
13420
|
var process_manager_1 = require_process_manager();
|
|
@@ -13404,7 +13431,7 @@ var require_executor = __commonJS({
|
|
|
13404
13431
|
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
|
13405
13432
|
if (attempt > 1) {
|
|
13406
13433
|
logger_12.logger.info(`[OpenCode] Retry attempt ${attempt}/${MAX_RETRIES} - starting fresh session with recovery context`);
|
|
13407
|
-
const filesChanged = (0,
|
|
13434
|
+
const filesChanged = await (0, git_file_changes_1.collectGitFileChanges)(options.outputPath, options.gitBaseline);
|
|
13408
13435
|
currentPrompt = (0, prompts_1.buildRecoveryPrompt)(options.prompt, filesChanged, lastResult?.error?.message || lastResult?.stderr || "Process timed out");
|
|
13409
13436
|
continueSession = false;
|
|
13410
13437
|
}
|
|
@@ -13420,7 +13447,6 @@ var require_executor = __commonJS({
|
|
|
13420
13447
|
const finalResult2 = {
|
|
13421
13448
|
...result,
|
|
13422
13449
|
userActions: (0, parser_1.parseUserActions)(accumulatedStdout),
|
|
13423
|
-
filesChanged: (0, parser_1.parseFilesChanged)(accumulatedStdout),
|
|
13424
13450
|
usage: accumulatedUsage,
|
|
13425
13451
|
skillsUsed: accumulatedSkills
|
|
13426
13452
|
};
|
|
@@ -13441,7 +13467,6 @@ var require_executor = __commonJS({
|
|
|
13441
13467
|
const finalResult = {
|
|
13442
13468
|
...lastResult,
|
|
13443
13469
|
userActions: (0, parser_1.parseUserActions)(accumulatedStdout),
|
|
13444
|
-
filesChanged: (0, parser_1.parseFilesChanged)(accumulatedStdout),
|
|
13445
13470
|
usage: accumulatedUsage,
|
|
13446
13471
|
skillsUsed: Array.from(accumulatedSkills)
|
|
13447
13472
|
};
|
|
@@ -13530,7 +13555,6 @@ var require_executor = __commonJS({
|
|
|
13530
13555
|
}),
|
|
13531
13556
|
durationMs: Date.now() - startTime,
|
|
13532
13557
|
requiredPermissions: [],
|
|
13533
|
-
filesChanged: [],
|
|
13534
13558
|
usage: (0, parser_1.createEmptyUsageStats)(),
|
|
13535
13559
|
skillsUsed: []
|
|
13536
13560
|
});
|
|
@@ -13552,30 +13576,39 @@ var require_opencode_runner = __commonJS({
|
|
|
13552
13576
|
var executor_1 = require_executor();
|
|
13553
13577
|
var parser_1 = require_parser();
|
|
13554
13578
|
async function runOpenCodeInit(options) {
|
|
13555
|
-
const { blueprint, outputPath, projectId, chatHistory, onStdout, onStderr } = options;
|
|
13579
|
+
const { blueprint, outputPath, projectId, chatHistory, gitBaseline, onStdout, onStderr } = options;
|
|
13556
13580
|
const prompt = (0, prompts_1.buildInitPrompt)(blueprint, chatHistory);
|
|
13557
|
-
return (0, executor_1.executeOpenCode)({
|
|
13581
|
+
return (0, executor_1.executeOpenCode)({
|
|
13582
|
+
prompt,
|
|
13583
|
+
outputPath,
|
|
13584
|
+
projectId,
|
|
13585
|
+
gitBaseline,
|
|
13586
|
+
onStdout,
|
|
13587
|
+
onStderr
|
|
13588
|
+
});
|
|
13558
13589
|
}
|
|
13559
13590
|
async function runOpenCodeIteration(options) {
|
|
13560
|
-
const { outputPath, projectId, chatHistory, onStdout, onStderr } = options;
|
|
13591
|
+
const { outputPath, projectId, chatHistory, gitBaseline, onStdout, onStderr } = options;
|
|
13561
13592
|
const prompt = (0, prompts_1.buildIterationPrompt)(chatHistory);
|
|
13562
13593
|
return (0, executor_1.executeOpenCode)({
|
|
13563
13594
|
prompt,
|
|
13564
13595
|
outputPath,
|
|
13565
13596
|
projectId,
|
|
13566
13597
|
continueSession: true,
|
|
13598
|
+
gitBaseline,
|
|
13567
13599
|
onStdout,
|
|
13568
13600
|
onStderr
|
|
13569
13601
|
});
|
|
13570
13602
|
}
|
|
13571
13603
|
async function runOpenCodeAsk(options) {
|
|
13572
|
-
const { outputPath, projectId, chatHistory, onStdout, onStderr } = options;
|
|
13604
|
+
const { outputPath, projectId, chatHistory, gitBaseline, onStdout, onStderr } = options;
|
|
13573
13605
|
const prompt = (0, prompts_1.buildAskPrompt)(chatHistory);
|
|
13574
13606
|
const result = await (0, executor_1.executeOpenCode)({
|
|
13575
13607
|
prompt,
|
|
13576
13608
|
outputPath,
|
|
13577
13609
|
projectId,
|
|
13578
13610
|
continueSession: true,
|
|
13611
|
+
gitBaseline,
|
|
13579
13612
|
onStdout,
|
|
13580
13613
|
onStderr
|
|
13581
13614
|
});
|
|
@@ -13703,7 +13736,7 @@ var require_OpenCodeOrchestrator = __commonJS({
|
|
|
13703
13736
|
super();
|
|
13704
13737
|
}
|
|
13705
13738
|
async generateCode(request) {
|
|
13706
|
-
const { blueprint, outputPath, projectId, chatHistory } = request;
|
|
13739
|
+
const { blueprint, outputPath, projectId, chatHistory, gitBaseline } = request;
|
|
13707
13740
|
this.emitEvent("start:init", {
|
|
13708
13741
|
appName: blueprint.appName ?? "",
|
|
13709
13742
|
summary: blueprint.summary ?? "",
|
|
@@ -13717,6 +13750,7 @@ var require_OpenCodeOrchestrator = __commonJS({
|
|
|
13717
13750
|
outputPath,
|
|
13718
13751
|
projectId,
|
|
13719
13752
|
chatHistory,
|
|
13753
|
+
gitBaseline,
|
|
13720
13754
|
onStdout: (data) => {
|
|
13721
13755
|
this.emitEvent("opencode:output", { data });
|
|
13722
13756
|
},
|
|
@@ -13895,78 +13929,6 @@ var require_agent_io = __commonJS({
|
|
|
13895
13929
|
}
|
|
13896
13930
|
});
|
|
13897
13931
|
|
|
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
13932
|
// dist/opencode-integration/inject-created-by.js
|
|
13971
13933
|
var require_inject_created_by = __commonJS({
|
|
13972
13934
|
"dist/opencode-integration/inject-created-by.js"(exports2) {
|
|
@@ -19036,7 +18998,8 @@ var require_opencode_init = __commonJS({
|
|
|
19036
18998
|
blueprint: finalBlueprint,
|
|
19037
18999
|
outputPath,
|
|
19038
19000
|
projectId: context_12.ctx.projectId,
|
|
19039
|
-
chatHistory: history
|
|
19001
|
+
chatHistory: history,
|
|
19002
|
+
gitBaseline
|
|
19040
19003
|
});
|
|
19041
19004
|
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19042
19005
|
const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
|
|
@@ -19125,7 +19088,7 @@ var require_OpenCodeIterationOrchestrator = __commonJS({
|
|
|
19125
19088
|
super();
|
|
19126
19089
|
}
|
|
19127
19090
|
async generateIterationCode(request) {
|
|
19128
|
-
const { outputPath, projectId, chatHistory } = request;
|
|
19091
|
+
const { outputPath, projectId, chatHistory, gitBaseline } = request;
|
|
19129
19092
|
this.emitEvent("start:iteration", { outputPath });
|
|
19130
19093
|
const start = Date.now();
|
|
19131
19094
|
this.emitEvent("opencode:start", { outputPath });
|
|
@@ -19133,6 +19096,7 @@ var require_OpenCodeIterationOrchestrator = __commonJS({
|
|
|
19133
19096
|
outputPath,
|
|
19134
19097
|
projectId,
|
|
19135
19098
|
chatHistory,
|
|
19099
|
+
gitBaseline,
|
|
19136
19100
|
onStdout: (data) => {
|
|
19137
19101
|
this.emitEvent("opencode:output", { data });
|
|
19138
19102
|
},
|
|
@@ -19220,7 +19184,8 @@ var require_opencode_iterate = __commonJS({
|
|
|
19220
19184
|
const result = await iterationOrchestrator.generateIterationCode({
|
|
19221
19185
|
outputPath,
|
|
19222
19186
|
projectId: context_12.ctx.projectId,
|
|
19223
|
-
chatHistory
|
|
19187
|
+
chatHistory,
|
|
19188
|
+
gitBaseline
|
|
19224
19189
|
});
|
|
19225
19190
|
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19226
19191
|
const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
|
|
@@ -19309,7 +19274,7 @@ var require_OpenCodeAskOrchestrator = __commonJS({
|
|
|
19309
19274
|
super();
|
|
19310
19275
|
}
|
|
19311
19276
|
async ask(request) {
|
|
19312
|
-
const { outputPath, projectId, chatHistory } = request;
|
|
19277
|
+
const { outputPath, projectId, chatHistory, gitBaseline } = request;
|
|
19313
19278
|
this.emitEvent("start:ask", { outputPath });
|
|
19314
19279
|
this.emitEvent("opencode:start", { outputPath });
|
|
19315
19280
|
const start = Date.now();
|
|
@@ -19317,6 +19282,7 @@ var require_OpenCodeAskOrchestrator = __commonJS({
|
|
|
19317
19282
|
outputPath,
|
|
19318
19283
|
projectId,
|
|
19319
19284
|
chatHistory,
|
|
19285
|
+
gitBaseline,
|
|
19320
19286
|
onStdout: (data) => {
|
|
19321
19287
|
this.emitEvent("opencode:output", { data });
|
|
19322
19288
|
},
|
|
@@ -19399,7 +19365,8 @@ var require_opencode_ask = __commonJS({
|
|
|
19399
19365
|
const result = await askOrchestrator.ask({
|
|
19400
19366
|
outputPath,
|
|
19401
19367
|
projectId: context_12.ctx.projectId,
|
|
19402
|
-
chatHistory
|
|
19368
|
+
chatHistory,
|
|
19369
|
+
gitBaseline
|
|
19403
19370
|
});
|
|
19404
19371
|
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19405
19372
|
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.363",
|
|
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": "0b15b4a7e8f690a7e6e84353807fc9297d4c1292a2b1013cbf248858"
|
|
33
33
|
}
|