@wix/ditto-codegen-public 1.0.330 → 1.0.331
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 +100 -16
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -14373,6 +14373,76 @@ var require_agent_io = __commonJS({
|
|
|
14373
14373
|
}
|
|
14374
14374
|
});
|
|
14375
14375
|
|
|
14376
|
+
// dist/opencode-integration/git-file-changes.js
|
|
14377
|
+
var require_git_file_changes = __commonJS({
|
|
14378
|
+
"dist/opencode-integration/git-file-changes.js"(exports2) {
|
|
14379
|
+
"use strict";
|
|
14380
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
14381
|
+
exports2.captureGitBaseline = captureGitBaseline;
|
|
14382
|
+
exports2.collectGitFileChanges = collectGitFileChanges;
|
|
14383
|
+
var child_process_1 = require("child_process");
|
|
14384
|
+
var util_1 = require("util");
|
|
14385
|
+
var ditto_codegen_types_12 = require_dist4();
|
|
14386
|
+
var logger_12 = require_logger();
|
|
14387
|
+
var execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
|
|
14388
|
+
async function captureGitBaseline(cwd) {
|
|
14389
|
+
const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD"], { cwd });
|
|
14390
|
+
return stdout.trim();
|
|
14391
|
+
}
|
|
14392
|
+
async function collectGitFileChanges(cwd, baseline) {
|
|
14393
|
+
try {
|
|
14394
|
+
const [diffResult, untrackedResult] = await Promise.all([
|
|
14395
|
+
execFileAsync("git", [
|
|
14396
|
+
"-c",
|
|
14397
|
+
"core.quotepath=off",
|
|
14398
|
+
"diff",
|
|
14399
|
+
"--name-status",
|
|
14400
|
+
"--no-renames",
|
|
14401
|
+
"-z",
|
|
14402
|
+
baseline
|
|
14403
|
+
], { cwd, maxBuffer: 10 * 1024 * 1024 }),
|
|
14404
|
+
execFileAsync("git", ["ls-files", "--others", "--exclude-standard", "-z"], { cwd, maxBuffer: 10 * 1024 * 1024 })
|
|
14405
|
+
]);
|
|
14406
|
+
const files = parseDiffNameStatus(diffResult.stdout);
|
|
14407
|
+
appendUntrackedFiles(untrackedResult.stdout, files);
|
|
14408
|
+
files.sort((a, b) => a.path.localeCompare(b.path));
|
|
14409
|
+
return files;
|
|
14410
|
+
} catch (error) {
|
|
14411
|
+
logger_12.logger.error("[OpenCode] Failed to collect git file changes", {
|
|
14412
|
+
error: error instanceof Error ? error.message : String(error)
|
|
14413
|
+
});
|
|
14414
|
+
return [];
|
|
14415
|
+
}
|
|
14416
|
+
}
|
|
14417
|
+
var GIT_STATUS_TO_OPERATION = {
|
|
14418
|
+
A: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT,
|
|
14419
|
+
M: ditto_codegen_types_12.ExtensionGenerationOperation.EDIT,
|
|
14420
|
+
D: ditto_codegen_types_12.ExtensionGenerationOperation.DELETE
|
|
14421
|
+
};
|
|
14422
|
+
function parseDiffNameStatus(raw) {
|
|
14423
|
+
const files = [];
|
|
14424
|
+
const parts = raw.split("\0").filter(Boolean);
|
|
14425
|
+
for (let i = 0; i < parts.length - 1; i += 2) {
|
|
14426
|
+
const operation = GIT_STATUS_TO_OPERATION[parts[i]];
|
|
14427
|
+
const path = parts[i + 1];
|
|
14428
|
+
if (path && operation) {
|
|
14429
|
+
files.push({ path, operation });
|
|
14430
|
+
}
|
|
14431
|
+
}
|
|
14432
|
+
return files;
|
|
14433
|
+
}
|
|
14434
|
+
function appendUntrackedFiles(raw, files) {
|
|
14435
|
+
const knownPaths = new Set(files.map((f) => f.path));
|
|
14436
|
+
const paths = raw.split("\0").filter(Boolean);
|
|
14437
|
+
for (const path of paths) {
|
|
14438
|
+
if (!knownPaths.has(path)) {
|
|
14439
|
+
files.push({ path, operation: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT });
|
|
14440
|
+
}
|
|
14441
|
+
}
|
|
14442
|
+
}
|
|
14443
|
+
}
|
|
14444
|
+
});
|
|
14445
|
+
|
|
14376
14446
|
// ../../node_modules/@wix/bi-logger-dev-tools-data/dist/cjs/v2/index.js
|
|
14377
14447
|
var require_v2 = __commonJS({
|
|
14378
14448
|
"../../node_modules/@wix/bi-logger-dev-tools-data/dist/cjs/v2/index.js"(exports2) {
|
|
@@ -19328,6 +19398,7 @@ var require_opencode_init = __commonJS({
|
|
|
19328
19398
|
var context_12 = require_context();
|
|
19329
19399
|
var logger_12 = require_logger();
|
|
19330
19400
|
var config_12 = require_config();
|
|
19401
|
+
var git_file_changes_1 = require_git_file_changes();
|
|
19331
19402
|
var biEvents_1 = require_biEvents();
|
|
19332
19403
|
var pre_run_decision_1 = require_pre_run_decision();
|
|
19333
19404
|
var environments_12 = require_environments();
|
|
@@ -19360,6 +19431,7 @@ var require_opencode_init = __commonJS({
|
|
|
19360
19431
|
taskType: kind
|
|
19361
19432
|
});
|
|
19362
19433
|
const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
|
|
19434
|
+
const gitBaseline = await (0, git_file_changes_1.captureGitBaseline)(outputPath);
|
|
19363
19435
|
let caughtError;
|
|
19364
19436
|
try {
|
|
19365
19437
|
(0, agent_io_1.writeAgentInput)(outputPath, agentData);
|
|
@@ -19380,9 +19452,11 @@ var require_opencode_init = __commonJS({
|
|
|
19380
19452
|
projectId: context_12.ctx.projectId,
|
|
19381
19453
|
chatHistory: history
|
|
19382
19454
|
});
|
|
19455
|
+
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19383
19456
|
const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
|
|
19384
19457
|
await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
|
|
19385
19458
|
requiredPermissions: result.requiredPermissions,
|
|
19459
|
+
files,
|
|
19386
19460
|
history,
|
|
19387
19461
|
...agentOutput
|
|
19388
19462
|
});
|
|
@@ -19395,12 +19469,7 @@ var require_opencode_init = __commonJS({
|
|
|
19395
19469
|
taskType: kind,
|
|
19396
19470
|
taskCost: Math.round(result.usage.cost * 1e6),
|
|
19397
19471
|
taskStatus: ditto_codegen_types_12.Status.COMPLETED,
|
|
19398
|
-
agentOutput: JSON.stringify({
|
|
19399
|
-
files: result.filesChanged.map((file) => ({
|
|
19400
|
-
path: file.path,
|
|
19401
|
-
operation: file.operation
|
|
19402
|
-
}))
|
|
19403
|
-
}),
|
|
19472
|
+
agentOutput: JSON.stringify({ files }),
|
|
19404
19473
|
jobDuration: String(Date.now() - flowStartTime),
|
|
19405
19474
|
skillsUsed: result.skillsUsed,
|
|
19406
19475
|
extensionsCreated: result.extensionsCreated
|
|
@@ -19410,9 +19479,11 @@ var require_opencode_init = __commonJS({
|
|
|
19410
19479
|
caughtError = error;
|
|
19411
19480
|
const codegenError = (0, ditto_codegen_types_2.toCodegenError)(error);
|
|
19412
19481
|
const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
|
|
19482
|
+
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19413
19483
|
await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
|
|
19414
19484
|
requiredPermissions: [],
|
|
19415
19485
|
requiredPermissionsErrors: codegenError,
|
|
19486
|
+
files,
|
|
19416
19487
|
history,
|
|
19417
19488
|
...agentOutput
|
|
19418
19489
|
});
|
|
@@ -19422,6 +19493,7 @@ var require_opencode_init = __commonJS({
|
|
|
19422
19493
|
taskModel: config_12.DEFAULT_MODEL,
|
|
19423
19494
|
taskType: kind,
|
|
19424
19495
|
taskStatus: ditto_codegen_types_12.Status.FAILED,
|
|
19496
|
+
agentOutput: JSON.stringify({ files }),
|
|
19425
19497
|
jobDuration: String(Date.now() - flowStartTime)
|
|
19426
19498
|
});
|
|
19427
19499
|
(0, biEvents_1.reportSessionError)({
|
|
@@ -19519,6 +19591,7 @@ var require_opencode_iterate = __commonJS({
|
|
|
19519
19591
|
var context_12 = require_context();
|
|
19520
19592
|
var logger_12 = require_logger();
|
|
19521
19593
|
var config_12 = require_config();
|
|
19594
|
+
var git_file_changes_1 = require_git_file_changes();
|
|
19522
19595
|
var biEvents_1 = require_biEvents();
|
|
19523
19596
|
var hooks_1 = require_hooks();
|
|
19524
19597
|
var runOpencodeIterateFlow = async (chatHistory, agentData) => {
|
|
@@ -19549,6 +19622,7 @@ var require_opencode_iterate = __commonJS({
|
|
|
19549
19622
|
taskType: kind
|
|
19550
19623
|
});
|
|
19551
19624
|
const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
|
|
19625
|
+
const gitBaseline = await (0, git_file_changes_1.captureGitBaseline)(outputPath);
|
|
19552
19626
|
let caughtError;
|
|
19553
19627
|
try {
|
|
19554
19628
|
(0, agent_io_1.writeAgentInput)(outputPath, agentData);
|
|
@@ -19559,19 +19633,15 @@ var require_opencode_iterate = __commonJS({
|
|
|
19559
19633
|
projectId: context_12.ctx.projectId,
|
|
19560
19634
|
chatHistory
|
|
19561
19635
|
});
|
|
19636
|
+
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19562
19637
|
const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
|
|
19563
19638
|
await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
|
|
19564
19639
|
requiredPermissions: result.requiredPermissions,
|
|
19640
|
+
files,
|
|
19565
19641
|
...agentOutput
|
|
19566
19642
|
});
|
|
19567
|
-
const taskOutput = {
|
|
19568
|
-
files: result.filesChanged.map((file) => ({
|
|
19569
|
-
path: file.path,
|
|
19570
|
-
operation: file.operation
|
|
19571
|
-
}))
|
|
19572
|
-
};
|
|
19573
19643
|
await codeGenerationService_12.codeGenerationService.updateTask(jobId, taskId, ditto_codegen_types_12.Status.COMPLETED, {
|
|
19574
|
-
taskOutput
|
|
19644
|
+
taskOutput: { files }
|
|
19575
19645
|
});
|
|
19576
19646
|
(0, biEvents_1.reportSessionEnd)({
|
|
19577
19647
|
...biBase,
|
|
@@ -19579,7 +19649,7 @@ var require_opencode_iterate = __commonJS({
|
|
|
19579
19649
|
taskType: kind,
|
|
19580
19650
|
taskCost: Math.round(result.usage.cost * 1e6),
|
|
19581
19651
|
taskStatus: ditto_codegen_types_12.Status.COMPLETED,
|
|
19582
|
-
agentOutput: JSON.stringify(
|
|
19652
|
+
agentOutput: JSON.stringify({ files }),
|
|
19583
19653
|
jobDuration: String(Date.now() - flowStartTime),
|
|
19584
19654
|
skillsUsed: result.skillsUsed,
|
|
19585
19655
|
extensionsCreated: result.extensionsCreated
|
|
@@ -19589,9 +19659,11 @@ var require_opencode_iterate = __commonJS({
|
|
|
19589
19659
|
caughtError = error;
|
|
19590
19660
|
const codegenError = (0, ditto_codegen_types_2.toCodegenError)(error);
|
|
19591
19661
|
const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
|
|
19662
|
+
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19592
19663
|
await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
|
|
19593
19664
|
requiredPermissions: [],
|
|
19594
19665
|
requiredPermissionsErrors: codegenError,
|
|
19666
|
+
files,
|
|
19595
19667
|
...agentOutput
|
|
19596
19668
|
});
|
|
19597
19669
|
await (0, codegen_flow_helpers_12.updateParentTaskStatus)(localJobContext, ditto_codegen_types_12.Status.FAILED, codegenError);
|
|
@@ -19600,6 +19672,7 @@ var require_opencode_iterate = __commonJS({
|
|
|
19600
19672
|
taskModel: config_12.DEFAULT_MODEL,
|
|
19601
19673
|
taskType: kind,
|
|
19602
19674
|
taskStatus: ditto_codegen_types_12.Status.FAILED,
|
|
19675
|
+
agentOutput: JSON.stringify({ files }),
|
|
19603
19676
|
jobDuration: String(Date.now() - flowStartTime)
|
|
19604
19677
|
});
|
|
19605
19678
|
(0, biEvents_1.reportSessionError)({
|
|
@@ -19695,6 +19768,7 @@ var require_opencode_ask = __commonJS({
|
|
|
19695
19768
|
var context_12 = require_context();
|
|
19696
19769
|
var logger_12 = require_logger();
|
|
19697
19770
|
var config_12 = require_config();
|
|
19771
|
+
var git_file_changes_1 = require_git_file_changes();
|
|
19698
19772
|
var biEvents_1 = require_biEvents();
|
|
19699
19773
|
var runOpencodeAskFlow = async (chatHistory) => {
|
|
19700
19774
|
const store = job_context_storage_12.jobContextStorage.getStore();
|
|
@@ -19723,8 +19797,9 @@ var require_opencode_ask = __commonJS({
|
|
|
19723
19797
|
taskModel: config_12.DEFAULT_MODEL,
|
|
19724
19798
|
taskType: kind
|
|
19725
19799
|
});
|
|
19800
|
+
const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
|
|
19801
|
+
const gitBaseline = await (0, git_file_changes_1.captureGitBaseline)(outputPath);
|
|
19726
19802
|
try {
|
|
19727
|
-
const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
|
|
19728
19803
|
const askOrchestrator = new OpenCodeAskOrchestrator_1.OpenCodeAskOrchestrator();
|
|
19729
19804
|
(0, cli_listeners_1.attachOrchestratorListeners)(askOrchestrator);
|
|
19730
19805
|
const result = await askOrchestrator.ask({
|
|
@@ -19732,6 +19807,10 @@ var require_opencode_ask = __commonJS({
|
|
|
19732
19807
|
projectId: context_12.ctx.projectId,
|
|
19733
19808
|
chatHistory
|
|
19734
19809
|
});
|
|
19810
|
+
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19811
|
+
await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
|
|
19812
|
+
files
|
|
19813
|
+
});
|
|
19735
19814
|
await codeGenerationService_12.codeGenerationService.updateTask(jobId, taskId, ditto_codegen_types_12.Status.COMPLETED, {
|
|
19736
19815
|
taskOutput: {
|
|
19737
19816
|
answer: result.answer
|
|
@@ -19743,18 +19822,23 @@ var require_opencode_ask = __commonJS({
|
|
|
19743
19822
|
taskType: kind,
|
|
19744
19823
|
taskCost: Math.round(result.usage.cost * 1e6),
|
|
19745
19824
|
taskStatus: ditto_codegen_types_12.Status.COMPLETED,
|
|
19746
|
-
agentOutput: JSON.stringify({ answer: result.answer }),
|
|
19825
|
+
agentOutput: JSON.stringify({ answer: result.answer, files }),
|
|
19747
19826
|
jobDuration: String(Date.now() - flowStartTime)
|
|
19748
19827
|
});
|
|
19749
19828
|
logger_12.logger.info("[OpenCode Ask] Completed task", { taskId });
|
|
19750
19829
|
} catch (error) {
|
|
19751
19830
|
const codegenError = (0, ditto_codegen_types_2.toCodegenError)(error);
|
|
19831
|
+
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19832
|
+
await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
|
|
19833
|
+
files
|
|
19834
|
+
});
|
|
19752
19835
|
await (0, codegen_flow_helpers_12.updateParentTaskStatus)(localJobContext, ditto_codegen_types_12.Status.FAILED, codegenError);
|
|
19753
19836
|
(0, biEvents_1.reportSessionEnd)({
|
|
19754
19837
|
...biBase,
|
|
19755
19838
|
taskModel: config_12.DEFAULT_MODEL,
|
|
19756
19839
|
taskType: kind,
|
|
19757
19840
|
taskStatus: ditto_codegen_types_12.Status.FAILED,
|
|
19841
|
+
agentOutput: JSON.stringify({ files }),
|
|
19758
19842
|
jobDuration: String(Date.now() - flowStartTime)
|
|
19759
19843
|
});
|
|
19760
19844
|
(0, biEvents_1.reportSessionError)({
|
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.331",
|
|
4
4
|
"description": "AI-powered Wix CLI app generator - standalone executable",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "node build.mjs",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"esbuild": "^0.27.2",
|
|
29
29
|
"vitest": "^4.0.16"
|
|
30
30
|
},
|
|
31
|
-
"falconPackageHash": "
|
|
31
|
+
"falconPackageHash": "dc66760aa92eeb7347a2019b5b49c12bb33ea6af136c3f879f70d32d"
|
|
32
32
|
}
|