@wix/ditto-codegen-public 1.0.361 → 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 +144 -151
- 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,15 +12681,27 @@ var require_types4 = __commonJS({
|
|
|
12681
12681
|
}
|
|
12682
12682
|
});
|
|
12683
12683
|
|
|
12684
|
-
// dist/opencode-integration/
|
|
12685
|
-
var
|
|
12686
|
-
"dist/opencode-integration/
|
|
12684
|
+
// dist/opencode-integration/normalize-tool-string.js
|
|
12685
|
+
var require_normalize_tool_string = __commonJS({
|
|
12686
|
+
"dist/opencode-integration/normalize-tool-string.js"(exports2) {
|
|
12687
12687
|
"use strict";
|
|
12688
12688
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12689
|
-
exports2.
|
|
12690
|
-
|
|
12691
|
-
|
|
12692
|
-
|
|
12689
|
+
exports2.normalizeToolString = normalizeToolString;
|
|
12690
|
+
function unescapeString(str) {
|
|
12691
|
+
return str.replace(/\\(n|t|r|"|\\)/g, (_, c) => {
|
|
12692
|
+
if (c === "n")
|
|
12693
|
+
return "\n";
|
|
12694
|
+
if (c === "t")
|
|
12695
|
+
return " ";
|
|
12696
|
+
if (c === "r")
|
|
12697
|
+
return "\r";
|
|
12698
|
+
if (c === '"')
|
|
12699
|
+
return '"';
|
|
12700
|
+
return "\\";
|
|
12701
|
+
});
|
|
12702
|
+
}
|
|
12703
|
+
function normalizeToolString(text) {
|
|
12704
|
+
return unescapeString(text).replace(/\r\n/g, "\n");
|
|
12693
12705
|
}
|
|
12694
12706
|
}
|
|
12695
12707
|
});
|
|
@@ -12701,17 +12713,14 @@ var require_parser = __commonJS({
|
|
|
12701
12713
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12702
12714
|
exports2.parseRequiredPermissions = parseRequiredPermissions;
|
|
12703
12715
|
exports2.parseUserActions = parseUserActions;
|
|
12704
|
-
exports2.parseFilesChanged = parseFilesChanged;
|
|
12705
12716
|
exports2.parseAnswerText = parseAnswerText;
|
|
12706
12717
|
exports2.createEmptyUsageStats = createEmptyUsageStats;
|
|
12707
12718
|
exports2.parseUsageStats = parseUsageStats;
|
|
12708
12719
|
exports2.mergeUsageStats = mergeUsageStats;
|
|
12709
12720
|
exports2.hasSessionError = hasSessionError;
|
|
12710
12721
|
exports2.summarizeOpenCodeLine = summarizeOpenCodeLine;
|
|
12711
|
-
var ditto_codegen_types_12 = require_dist4();
|
|
12712
12722
|
var types_1 = require_types4();
|
|
12713
|
-
var
|
|
12714
|
-
var internal_paths_1 = require_internal_paths();
|
|
12723
|
+
var normalize_tool_string_1 = require_normalize_tool_string();
|
|
12715
12724
|
function parseEvents(output, type) {
|
|
12716
12725
|
return output.split("\n").filter((line) => line.trim()).map((line) => (0, types_1.tryParseJson)(line)).filter((event) => event !== null && event.type === type);
|
|
12717
12726
|
}
|
|
@@ -12745,58 +12754,10 @@ var require_parser = __commonJS({
|
|
|
12745
12754
|
const declared = event.part.state.input?.output;
|
|
12746
12755
|
if (typeof declared !== "string")
|
|
12747
12756
|
continue;
|
|
12748
|
-
markdown = declared;
|
|
12757
|
+
markdown = (0, normalize_tool_string_1.normalizeToolString)(declared);
|
|
12749
12758
|
}
|
|
12750
12759
|
return markdown;
|
|
12751
12760
|
}
|
|
12752
|
-
function parseFilesChanged(output) {
|
|
12753
|
-
const filesChanged = [];
|
|
12754
|
-
const seenPaths = /* @__PURE__ */ new Set();
|
|
12755
|
-
const addFileChange = (filePath, operation) => {
|
|
12756
|
-
const normalizedPath = (0, constants_1.normalizeFilePath)(filePath);
|
|
12757
|
-
if (normalizedPath && !(0, internal_paths_1.isInternalPath)(normalizedPath) && !seenPaths.has(normalizedPath)) {
|
|
12758
|
-
seenPaths.add(normalizedPath);
|
|
12759
|
-
filesChanged.push({ path: normalizedPath, operation });
|
|
12760
|
-
}
|
|
12761
|
-
};
|
|
12762
|
-
const lines = output.split("\n");
|
|
12763
|
-
for (const line of lines) {
|
|
12764
|
-
if (!line.trim())
|
|
12765
|
-
continue;
|
|
12766
|
-
const event = (0, types_1.tryParseJson)(line);
|
|
12767
|
-
if (!event || event.type !== "tool_use" || event.part?.state?.status !== "completed") {
|
|
12768
|
-
continue;
|
|
12769
|
-
}
|
|
12770
|
-
const tool = event.part.tool;
|
|
12771
|
-
const metadata = event.part.state.metadata;
|
|
12772
|
-
if (tool === "batch-write") {
|
|
12773
|
-
for (const f of event.part.state.input?.files ?? []) {
|
|
12774
|
-
addFileChange(f.path, ditto_codegen_types_12.ExtensionGenerationOperation.INSERT);
|
|
12775
|
-
}
|
|
12776
|
-
}
|
|
12777
|
-
if (tool === "multi-edit") {
|
|
12778
|
-
for (const e of event.part.state.input?.edits ?? []) {
|
|
12779
|
-
addFileChange(e.path, ditto_codegen_types_12.ExtensionGenerationOperation.EDIT);
|
|
12780
|
-
}
|
|
12781
|
-
}
|
|
12782
|
-
const operation = (0, constants_1.resolveFileOperation)(tool, metadata);
|
|
12783
|
-
if (operation) {
|
|
12784
|
-
const filePath = event.part.state.input?.filePath;
|
|
12785
|
-
if (filePath) {
|
|
12786
|
-
addFileChange(filePath, operation);
|
|
12787
|
-
}
|
|
12788
|
-
}
|
|
12789
|
-
if (tool === "task" && event.part.state.metadata?.summary) {
|
|
12790
|
-
for (const item of event.part.state.metadata.summary) {
|
|
12791
|
-
const summaryOperation = (0, constants_1.resolveFileOperation)(item.tool);
|
|
12792
|
-
if (summaryOperation && item.state?.status === "completed" && item.state?.title) {
|
|
12793
|
-
addFileChange(item.state.title, summaryOperation);
|
|
12794
|
-
}
|
|
12795
|
-
}
|
|
12796
|
-
}
|
|
12797
|
-
}
|
|
12798
|
-
return filesChanged;
|
|
12799
|
-
}
|
|
12800
12761
|
function parseAnswerText(output) {
|
|
12801
12762
|
return parseEvents(output, "text").map((event) => event.part?.text).filter(Boolean).join("").trim();
|
|
12802
12763
|
}
|
|
@@ -12915,6 +12876,100 @@ var require_parser = __commonJS({
|
|
|
12915
12876
|
}
|
|
12916
12877
|
});
|
|
12917
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
|
+
|
|
12918
12973
|
// dist/opencode-integration/cost-tracker.js
|
|
12919
12974
|
var require_cost_tracker = __commonJS({
|
|
12920
12975
|
"dist/opencode-integration/cost-tracker.js"(exports2) {
|
|
@@ -13153,7 +13208,7 @@ var require_process_manager = __commonJS({
|
|
|
13153
13208
|
exports2.clearTimers = clearTimers;
|
|
13154
13209
|
exports2.killProcess = killProcess;
|
|
13155
13210
|
var logger_12 = require_logger();
|
|
13156
|
-
exports2.IDLE_TIMEOUT_MS =
|
|
13211
|
+
exports2.IDLE_TIMEOUT_MS = 24e4;
|
|
13157
13212
|
exports2.IDLE_CHECK_INTERVAL_MS = 15e3;
|
|
13158
13213
|
exports2.KILL_GRACE_PERIOD_MS = 5e3;
|
|
13159
13214
|
function clearTimers(timers) {
|
|
@@ -13215,7 +13270,6 @@ var require_result_builder = __commonJS({
|
|
|
13215
13270
|
error: new ditto_codegen_types_12.TimeoutError(message),
|
|
13216
13271
|
durationMs: Date.now() - startTime,
|
|
13217
13272
|
requiredPermissions: [],
|
|
13218
|
-
filesChanged: (0, parser_1.parseFilesChanged)(stdout),
|
|
13219
13273
|
usage: (0, parser_1.parseUsageStats)(stdout),
|
|
13220
13274
|
skillsUsed: []
|
|
13221
13275
|
};
|
|
@@ -13234,7 +13288,6 @@ var require_result_builder = __commonJS({
|
|
|
13234
13288
|
}) : void 0,
|
|
13235
13289
|
durationMs: Date.now() - startTime,
|
|
13236
13290
|
requiredPermissions: (0, parser_1.parseRequiredPermissions)(stdout),
|
|
13237
|
-
filesChanged: (0, parser_1.parseFilesChanged)(stdout),
|
|
13238
13291
|
usage: (0, parser_1.parseUsageStats)(stdout),
|
|
13239
13292
|
skillsUsed: []
|
|
13240
13293
|
};
|
|
@@ -13252,7 +13305,6 @@ var require_result_builder = __commonJS({
|
|
|
13252
13305
|
}),
|
|
13253
13306
|
durationMs: Date.now() - startTime,
|
|
13254
13307
|
requiredPermissions: [],
|
|
13255
|
-
filesChanged: [],
|
|
13256
13308
|
usage: (0, parser_1.createEmptyUsageStats)(),
|
|
13257
13309
|
skillsUsed: []
|
|
13258
13310
|
};
|
|
@@ -13362,6 +13414,7 @@ var require_executor = __commonJS({
|
|
|
13362
13414
|
var job_context_storage_12 = require_job_context_storage();
|
|
13363
13415
|
var parser_1 = require_parser();
|
|
13364
13416
|
var prompts_1 = require_prompts();
|
|
13417
|
+
var git_file_changes_1 = require_git_file_changes();
|
|
13365
13418
|
var cost_tracker_1 = require_cost_tracker();
|
|
13366
13419
|
var task_tracker_1 = require_task_tracker2();
|
|
13367
13420
|
var process_manager_1 = require_process_manager();
|
|
@@ -13378,7 +13431,7 @@ var require_executor = __commonJS({
|
|
|
13378
13431
|
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
|
13379
13432
|
if (attempt > 1) {
|
|
13380
13433
|
logger_12.logger.info(`[OpenCode] Retry attempt ${attempt}/${MAX_RETRIES} - starting fresh session with recovery context`);
|
|
13381
|
-
const filesChanged = (0,
|
|
13434
|
+
const filesChanged = await (0, git_file_changes_1.collectGitFileChanges)(options.outputPath, options.gitBaseline);
|
|
13382
13435
|
currentPrompt = (0, prompts_1.buildRecoveryPrompt)(options.prompt, filesChanged, lastResult?.error?.message || lastResult?.stderr || "Process timed out");
|
|
13383
13436
|
continueSession = false;
|
|
13384
13437
|
}
|
|
@@ -13394,7 +13447,6 @@ var require_executor = __commonJS({
|
|
|
13394
13447
|
const finalResult2 = {
|
|
13395
13448
|
...result,
|
|
13396
13449
|
userActions: (0, parser_1.parseUserActions)(accumulatedStdout),
|
|
13397
|
-
filesChanged: (0, parser_1.parseFilesChanged)(accumulatedStdout),
|
|
13398
13450
|
usage: accumulatedUsage,
|
|
13399
13451
|
skillsUsed: accumulatedSkills
|
|
13400
13452
|
};
|
|
@@ -13415,7 +13467,6 @@ var require_executor = __commonJS({
|
|
|
13415
13467
|
const finalResult = {
|
|
13416
13468
|
...lastResult,
|
|
13417
13469
|
userActions: (0, parser_1.parseUserActions)(accumulatedStdout),
|
|
13418
|
-
filesChanged: (0, parser_1.parseFilesChanged)(accumulatedStdout),
|
|
13419
13470
|
usage: accumulatedUsage,
|
|
13420
13471
|
skillsUsed: Array.from(accumulatedSkills)
|
|
13421
13472
|
};
|
|
@@ -13504,7 +13555,6 @@ var require_executor = __commonJS({
|
|
|
13504
13555
|
}),
|
|
13505
13556
|
durationMs: Date.now() - startTime,
|
|
13506
13557
|
requiredPermissions: [],
|
|
13507
|
-
filesChanged: [],
|
|
13508
13558
|
usage: (0, parser_1.createEmptyUsageStats)(),
|
|
13509
13559
|
skillsUsed: []
|
|
13510
13560
|
});
|
|
@@ -13526,30 +13576,39 @@ var require_opencode_runner = __commonJS({
|
|
|
13526
13576
|
var executor_1 = require_executor();
|
|
13527
13577
|
var parser_1 = require_parser();
|
|
13528
13578
|
async function runOpenCodeInit(options) {
|
|
13529
|
-
const { blueprint, outputPath, projectId, chatHistory, onStdout, onStderr } = options;
|
|
13579
|
+
const { blueprint, outputPath, projectId, chatHistory, gitBaseline, onStdout, onStderr } = options;
|
|
13530
13580
|
const prompt = (0, prompts_1.buildInitPrompt)(blueprint, chatHistory);
|
|
13531
|
-
return (0, executor_1.executeOpenCode)({
|
|
13581
|
+
return (0, executor_1.executeOpenCode)({
|
|
13582
|
+
prompt,
|
|
13583
|
+
outputPath,
|
|
13584
|
+
projectId,
|
|
13585
|
+
gitBaseline,
|
|
13586
|
+
onStdout,
|
|
13587
|
+
onStderr
|
|
13588
|
+
});
|
|
13532
13589
|
}
|
|
13533
13590
|
async function runOpenCodeIteration(options) {
|
|
13534
|
-
const { outputPath, projectId, chatHistory, onStdout, onStderr } = options;
|
|
13591
|
+
const { outputPath, projectId, chatHistory, gitBaseline, onStdout, onStderr } = options;
|
|
13535
13592
|
const prompt = (0, prompts_1.buildIterationPrompt)(chatHistory);
|
|
13536
13593
|
return (0, executor_1.executeOpenCode)({
|
|
13537
13594
|
prompt,
|
|
13538
13595
|
outputPath,
|
|
13539
13596
|
projectId,
|
|
13540
13597
|
continueSession: true,
|
|
13598
|
+
gitBaseline,
|
|
13541
13599
|
onStdout,
|
|
13542
13600
|
onStderr
|
|
13543
13601
|
});
|
|
13544
13602
|
}
|
|
13545
13603
|
async function runOpenCodeAsk(options) {
|
|
13546
|
-
const { outputPath, projectId, chatHistory, onStdout, onStderr } = options;
|
|
13604
|
+
const { outputPath, projectId, chatHistory, gitBaseline, onStdout, onStderr } = options;
|
|
13547
13605
|
const prompt = (0, prompts_1.buildAskPrompt)(chatHistory);
|
|
13548
13606
|
const result = await (0, executor_1.executeOpenCode)({
|
|
13549
13607
|
prompt,
|
|
13550
13608
|
outputPath,
|
|
13551
13609
|
projectId,
|
|
13552
13610
|
continueSession: true,
|
|
13611
|
+
gitBaseline,
|
|
13553
13612
|
onStdout,
|
|
13554
13613
|
onStderr
|
|
13555
13614
|
});
|
|
@@ -13677,7 +13736,7 @@ var require_OpenCodeOrchestrator = __commonJS({
|
|
|
13677
13736
|
super();
|
|
13678
13737
|
}
|
|
13679
13738
|
async generateCode(request) {
|
|
13680
|
-
const { blueprint, outputPath, projectId, chatHistory } = request;
|
|
13739
|
+
const { blueprint, outputPath, projectId, chatHistory, gitBaseline } = request;
|
|
13681
13740
|
this.emitEvent("start:init", {
|
|
13682
13741
|
appName: blueprint.appName ?? "",
|
|
13683
13742
|
summary: blueprint.summary ?? "",
|
|
@@ -13691,6 +13750,7 @@ var require_OpenCodeOrchestrator = __commonJS({
|
|
|
13691
13750
|
outputPath,
|
|
13692
13751
|
projectId,
|
|
13693
13752
|
chatHistory,
|
|
13753
|
+
gitBaseline,
|
|
13694
13754
|
onStdout: (data) => {
|
|
13695
13755
|
this.emitEvent("opencode:output", { data });
|
|
13696
13756
|
},
|
|
@@ -13869,78 +13929,6 @@ var require_agent_io = __commonJS({
|
|
|
13869
13929
|
}
|
|
13870
13930
|
});
|
|
13871
13931
|
|
|
13872
|
-
// dist/opencode-integration/git-file-changes.js
|
|
13873
|
-
var require_git_file_changes = __commonJS({
|
|
13874
|
-
"dist/opencode-integration/git-file-changes.js"(exports2) {
|
|
13875
|
-
"use strict";
|
|
13876
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
13877
|
-
exports2.captureGitBaseline = captureGitBaseline;
|
|
13878
|
-
exports2.collectGitFileChanges = collectGitFileChanges;
|
|
13879
|
-
var child_process_1 = require("child_process");
|
|
13880
|
-
var util_1 = require("util");
|
|
13881
|
-
var ditto_codegen_types_12 = require_dist4();
|
|
13882
|
-
var internal_paths_1 = require_internal_paths();
|
|
13883
|
-
var logger_12 = require_logger();
|
|
13884
|
-
var execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
|
|
13885
|
-
async function captureGitBaseline(cwd) {
|
|
13886
|
-
const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD"], { cwd });
|
|
13887
|
-
return stdout.trim();
|
|
13888
|
-
}
|
|
13889
|
-
async function collectGitFileChanges(cwd, baseline) {
|
|
13890
|
-
try {
|
|
13891
|
-
const [diffResult, untrackedResult] = await Promise.all([
|
|
13892
|
-
execFileAsync("git", [
|
|
13893
|
-
"-c",
|
|
13894
|
-
"core.quotepath=off",
|
|
13895
|
-
"diff",
|
|
13896
|
-
"--name-status",
|
|
13897
|
-
"--no-renames",
|
|
13898
|
-
"-z",
|
|
13899
|
-
baseline
|
|
13900
|
-
], { cwd, maxBuffer: 10 * 1024 * 1024 }),
|
|
13901
|
-
execFileAsync("git", ["ls-files", "--others", "--exclude-standard", "-z"], { cwd, maxBuffer: 10 * 1024 * 1024 })
|
|
13902
|
-
]);
|
|
13903
|
-
const files = parseDiffNameStatus(diffResult.stdout);
|
|
13904
|
-
appendUntrackedFiles(untrackedResult.stdout, files);
|
|
13905
|
-
const userFiles = files.filter((f) => !(0, internal_paths_1.isInternalPath)(f.path));
|
|
13906
|
-
userFiles.sort((a, b) => a.path.localeCompare(b.path));
|
|
13907
|
-
return userFiles;
|
|
13908
|
-
} catch (error) {
|
|
13909
|
-
logger_12.logger.error("[OpenCode] Failed to collect git file changes", {
|
|
13910
|
-
error: error instanceof Error ? error.message : String(error)
|
|
13911
|
-
});
|
|
13912
|
-
return [];
|
|
13913
|
-
}
|
|
13914
|
-
}
|
|
13915
|
-
var GIT_STATUS_TO_OPERATION = {
|
|
13916
|
-
A: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT,
|
|
13917
|
-
M: ditto_codegen_types_12.ExtensionGenerationOperation.EDIT,
|
|
13918
|
-
D: ditto_codegen_types_12.ExtensionGenerationOperation.DELETE
|
|
13919
|
-
};
|
|
13920
|
-
function parseDiffNameStatus(raw) {
|
|
13921
|
-
const files = [];
|
|
13922
|
-
const parts = raw.split("\0").filter(Boolean);
|
|
13923
|
-
for (let i = 0; i < parts.length - 1; i += 2) {
|
|
13924
|
-
const operation = GIT_STATUS_TO_OPERATION[parts[i]];
|
|
13925
|
-
const path = parts[i + 1];
|
|
13926
|
-
if (path && operation) {
|
|
13927
|
-
files.push({ path, operation });
|
|
13928
|
-
}
|
|
13929
|
-
}
|
|
13930
|
-
return files;
|
|
13931
|
-
}
|
|
13932
|
-
function appendUntrackedFiles(raw, files) {
|
|
13933
|
-
const knownPaths = new Set(files.map((f) => f.path));
|
|
13934
|
-
const paths = raw.split("\0").filter(Boolean);
|
|
13935
|
-
for (const path of paths) {
|
|
13936
|
-
if (!knownPaths.has(path)) {
|
|
13937
|
-
files.push({ path, operation: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT });
|
|
13938
|
-
}
|
|
13939
|
-
}
|
|
13940
|
-
}
|
|
13941
|
-
}
|
|
13942
|
-
});
|
|
13943
|
-
|
|
13944
13932
|
// dist/opencode-integration/inject-created-by.js
|
|
13945
13933
|
var require_inject_created_by = __commonJS({
|
|
13946
13934
|
"dist/opencode-integration/inject-created-by.js"(exports2) {
|
|
@@ -19010,7 +18998,8 @@ var require_opencode_init = __commonJS({
|
|
|
19010
18998
|
blueprint: finalBlueprint,
|
|
19011
18999
|
outputPath,
|
|
19012
19000
|
projectId: context_12.ctx.projectId,
|
|
19013
|
-
chatHistory: history
|
|
19001
|
+
chatHistory: history,
|
|
19002
|
+
gitBaseline
|
|
19014
19003
|
});
|
|
19015
19004
|
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19016
19005
|
const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
|
|
@@ -19099,7 +19088,7 @@ var require_OpenCodeIterationOrchestrator = __commonJS({
|
|
|
19099
19088
|
super();
|
|
19100
19089
|
}
|
|
19101
19090
|
async generateIterationCode(request) {
|
|
19102
|
-
const { outputPath, projectId, chatHistory } = request;
|
|
19091
|
+
const { outputPath, projectId, chatHistory, gitBaseline } = request;
|
|
19103
19092
|
this.emitEvent("start:iteration", { outputPath });
|
|
19104
19093
|
const start = Date.now();
|
|
19105
19094
|
this.emitEvent("opencode:start", { outputPath });
|
|
@@ -19107,6 +19096,7 @@ var require_OpenCodeIterationOrchestrator = __commonJS({
|
|
|
19107
19096
|
outputPath,
|
|
19108
19097
|
projectId,
|
|
19109
19098
|
chatHistory,
|
|
19099
|
+
gitBaseline,
|
|
19110
19100
|
onStdout: (data) => {
|
|
19111
19101
|
this.emitEvent("opencode:output", { data });
|
|
19112
19102
|
},
|
|
@@ -19194,7 +19184,8 @@ var require_opencode_iterate = __commonJS({
|
|
|
19194
19184
|
const result = await iterationOrchestrator.generateIterationCode({
|
|
19195
19185
|
outputPath,
|
|
19196
19186
|
projectId: context_12.ctx.projectId,
|
|
19197
|
-
chatHistory
|
|
19187
|
+
chatHistory,
|
|
19188
|
+
gitBaseline
|
|
19198
19189
|
});
|
|
19199
19190
|
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19200
19191
|
const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
|
|
@@ -19283,7 +19274,7 @@ var require_OpenCodeAskOrchestrator = __commonJS({
|
|
|
19283
19274
|
super();
|
|
19284
19275
|
}
|
|
19285
19276
|
async ask(request) {
|
|
19286
|
-
const { outputPath, projectId, chatHistory } = request;
|
|
19277
|
+
const { outputPath, projectId, chatHistory, gitBaseline } = request;
|
|
19287
19278
|
this.emitEvent("start:ask", { outputPath });
|
|
19288
19279
|
this.emitEvent("opencode:start", { outputPath });
|
|
19289
19280
|
const start = Date.now();
|
|
@@ -19291,6 +19282,7 @@ var require_OpenCodeAskOrchestrator = __commonJS({
|
|
|
19291
19282
|
outputPath,
|
|
19292
19283
|
projectId,
|
|
19293
19284
|
chatHistory,
|
|
19285
|
+
gitBaseline,
|
|
19294
19286
|
onStdout: (data) => {
|
|
19295
19287
|
this.emitEvent("opencode:output", { data });
|
|
19296
19288
|
},
|
|
@@ -19373,7 +19365,8 @@ var require_opencode_ask = __commonJS({
|
|
|
19373
19365
|
const result = await askOrchestrator.ask({
|
|
19374
19366
|
outputPath,
|
|
19375
19367
|
projectId: context_12.ctx.projectId,
|
|
19376
|
-
chatHistory
|
|
19368
|
+
chatHistory,
|
|
19369
|
+
gitBaseline
|
|
19377
19370
|
});
|
|
19378
19371
|
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19379
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
|
}
|