@wix/ditto-codegen-public 1.0.509 → 1.0.510
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 +107 -20
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -16800,15 +16800,31 @@ var require_file_changes = __commonJS({
|
|
|
16800
16800
|
"dist/git/file-changes.js"(exports2) {
|
|
16801
16801
|
"use strict";
|
|
16802
16802
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
16803
|
+
exports2.EMPTY_GIT_BASELINE = void 0;
|
|
16803
16804
|
exports2.captureGitBaseline = captureGitBaseline;
|
|
16804
16805
|
exports2.collectGitFileChanges = collectGitFileChanges;
|
|
16805
16806
|
var child_process_1 = require("child_process");
|
|
16807
|
+
var promises_1 = require("fs/promises");
|
|
16808
|
+
var os_1 = require("os");
|
|
16809
|
+
var path_12 = require("path");
|
|
16806
16810
|
var util_1 = require("util");
|
|
16807
16811
|
var ditto_codegen_types_12 = require_dist4();
|
|
16808
16812
|
var internal_paths_1 = require_internal_paths();
|
|
16809
16813
|
var logger_12 = require_logger();
|
|
16810
16814
|
var execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
|
|
16815
|
+
var GIT_MAX_BUFFER = 10 * 1024 * 1024;
|
|
16816
|
+
exports2.EMPTY_GIT_BASELINE = { commit: "", tree: "" };
|
|
16811
16817
|
async function captureGitBaseline(cwd) {
|
|
16818
|
+
const [commit, tree] = await Promise.all([
|
|
16819
|
+
captureHead(cwd),
|
|
16820
|
+
snapshotWorkingTree(cwd).catch((error) => {
|
|
16821
|
+
logger_12.logger.warn("[OpenCode] Failed to snapshot the working tree, files uncommitted before the run will be reported as changes", { error: errorMessage(error) });
|
|
16822
|
+
return "";
|
|
16823
|
+
})
|
|
16824
|
+
]);
|
|
16825
|
+
return { commit, tree };
|
|
16826
|
+
}
|
|
16827
|
+
async function captureHead(cwd) {
|
|
16812
16828
|
try {
|
|
16813
16829
|
const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD"], {
|
|
16814
16830
|
cwd
|
|
@@ -16816,40 +16832,110 @@ var require_file_changes = __commonJS({
|
|
|
16816
16832
|
return stdout.trim();
|
|
16817
16833
|
} catch (error) {
|
|
16818
16834
|
logger_12.logger.warn("[OpenCode] Failed to capture git baseline, file tracking may be incomplete", {
|
|
16819
|
-
error:
|
|
16835
|
+
error: errorMessage(error)
|
|
16820
16836
|
});
|
|
16821
16837
|
return "";
|
|
16822
16838
|
}
|
|
16823
16839
|
}
|
|
16840
|
+
async function snapshotWorkingTree(cwd, seedTree) {
|
|
16841
|
+
const dir = await (0, promises_1.mkdtemp)((0, path_12.join)((0, os_1.tmpdir)(), "codegen-git-snapshot-"));
|
|
16842
|
+
const indexFile = (0, path_12.join)(dir, "index");
|
|
16843
|
+
const env = { ...process.env, GIT_INDEX_FILE: indexFile };
|
|
16844
|
+
try {
|
|
16845
|
+
if (seedTree) {
|
|
16846
|
+
await execFileAsync("git", ["read-tree", seedTree], { cwd, env });
|
|
16847
|
+
} else {
|
|
16848
|
+
await copyRealIndex(cwd, indexFile);
|
|
16849
|
+
}
|
|
16850
|
+
await execFileAsync("git", ["add", "--all"], {
|
|
16851
|
+
cwd,
|
|
16852
|
+
env,
|
|
16853
|
+
maxBuffer: GIT_MAX_BUFFER
|
|
16854
|
+
});
|
|
16855
|
+
const { stdout } = await execFileAsync("git", ["write-tree"], {
|
|
16856
|
+
cwd,
|
|
16857
|
+
env
|
|
16858
|
+
});
|
|
16859
|
+
return stdout.trim();
|
|
16860
|
+
} finally {
|
|
16861
|
+
await (0, promises_1.rm)(dir, { recursive: true, force: true });
|
|
16862
|
+
}
|
|
16863
|
+
}
|
|
16864
|
+
async function copyRealIndex(cwd, indexFile) {
|
|
16865
|
+
const { stdout: indexPath } = await execFileAsync("git", ["rev-parse", "--git-path", "index"], { cwd });
|
|
16866
|
+
try {
|
|
16867
|
+
await (0, promises_1.copyFile)((0, path_12.resolve)(cwd, indexPath.trim()), indexFile);
|
|
16868
|
+
} catch (error) {
|
|
16869
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) {
|
|
16870
|
+
throw error;
|
|
16871
|
+
}
|
|
16872
|
+
}
|
|
16873
|
+
}
|
|
16874
|
+
function errorMessage(error) {
|
|
16875
|
+
return error instanceof Error ? error.message : String(error);
|
|
16876
|
+
}
|
|
16824
16877
|
async function collectGitFileChanges(cwd, baseline) {
|
|
16825
16878
|
try {
|
|
16826
|
-
const
|
|
16827
|
-
execFileAsync("git", [
|
|
16828
|
-
"-c",
|
|
16829
|
-
"core.quotepath=off",
|
|
16830
|
-
"diff",
|
|
16831
|
-
"--name-status",
|
|
16832
|
-
"--no-renames",
|
|
16833
|
-
"-z",
|
|
16834
|
-
baseline
|
|
16835
|
-
], { cwd, maxBuffer: 10 * 1024 * 1024 }),
|
|
16836
|
-
execFileAsync("git", ["ls-files", "--others", "--exclude-standard", "-z"], { cwd, maxBuffer: 10 * 1024 * 1024 })
|
|
16837
|
-
]);
|
|
16838
|
-
const files = parseDiffNameStatus(diffResult.stdout);
|
|
16839
|
-
appendUntrackedFiles(untrackedResult.stdout, files);
|
|
16879
|
+
const files = await collectRawChanges(cwd, baseline);
|
|
16840
16880
|
const userFiles = files.filter((f) => !(0, internal_paths_1.isInternalPath)(f.path));
|
|
16841
16881
|
userFiles.sort((a, b) => a.path.localeCompare(b.path));
|
|
16842
16882
|
return userFiles;
|
|
16843
16883
|
} catch (error) {
|
|
16844
16884
|
logger_12.logger.error("[OpenCode] Failed to collect git file changes", {
|
|
16845
|
-
error:
|
|
16885
|
+
error: errorMessage(error)
|
|
16846
16886
|
});
|
|
16847
16887
|
return [];
|
|
16848
16888
|
}
|
|
16849
16889
|
}
|
|
16890
|
+
async function collectRawChanges(cwd, baseline) {
|
|
16891
|
+
if (baseline.tree) {
|
|
16892
|
+
try {
|
|
16893
|
+
return await diffAgainstSnapshot(cwd, baseline.tree);
|
|
16894
|
+
} catch (error) {
|
|
16895
|
+
logger_12.logger.warn("[OpenCode] Failed to diff against the working tree snapshot, falling back to the HEAD diff", { error: errorMessage(error) });
|
|
16896
|
+
}
|
|
16897
|
+
}
|
|
16898
|
+
return diffAgainstCommit(cwd, baseline.commit);
|
|
16899
|
+
}
|
|
16900
|
+
async function diffAgainstSnapshot(cwd, baselineTree) {
|
|
16901
|
+
const currentTree = await snapshotWorkingTree(cwd, baselineTree);
|
|
16902
|
+
const { stdout } = await execFileAsync("git", [
|
|
16903
|
+
"-c",
|
|
16904
|
+
"core.quotepath=off",
|
|
16905
|
+
"diff-tree",
|
|
16906
|
+
"-r",
|
|
16907
|
+
"--name-status",
|
|
16908
|
+
"--no-renames",
|
|
16909
|
+
"-z",
|
|
16910
|
+
baselineTree,
|
|
16911
|
+
currentTree
|
|
16912
|
+
], { cwd, maxBuffer: GIT_MAX_BUFFER });
|
|
16913
|
+
return parseDiffNameStatus(stdout);
|
|
16914
|
+
}
|
|
16915
|
+
async function diffAgainstCommit(cwd, commit) {
|
|
16916
|
+
const [diffResult, untrackedResult] = await Promise.all([
|
|
16917
|
+
execFileAsync("git", [
|
|
16918
|
+
"-c",
|
|
16919
|
+
"core.quotepath=off",
|
|
16920
|
+
"diff",
|
|
16921
|
+
"--name-status",
|
|
16922
|
+
"--no-renames",
|
|
16923
|
+
"-z",
|
|
16924
|
+
commit
|
|
16925
|
+
], { cwd, maxBuffer: GIT_MAX_BUFFER }),
|
|
16926
|
+
execFileAsync("git", ["ls-files", "--others", "--exclude-standard", "-z"], {
|
|
16927
|
+
cwd,
|
|
16928
|
+
maxBuffer: GIT_MAX_BUFFER
|
|
16929
|
+
})
|
|
16930
|
+
]);
|
|
16931
|
+
const files = parseDiffNameStatus(diffResult.stdout);
|
|
16932
|
+
appendUntrackedFiles(untrackedResult.stdout, files);
|
|
16933
|
+
return files;
|
|
16934
|
+
}
|
|
16850
16935
|
var GIT_STATUS_TO_OPERATION = {
|
|
16851
16936
|
A: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT,
|
|
16852
16937
|
M: ditto_codegen_types_12.ExtensionGenerationOperation.EDIT,
|
|
16938
|
+
T: ditto_codegen_types_12.ExtensionGenerationOperation.EDIT,
|
|
16853
16939
|
D: ditto_codegen_types_12.ExtensionGenerationOperation.DELETE
|
|
16854
16940
|
};
|
|
16855
16941
|
function parseDiffNameStatus(raw) {
|
|
@@ -18261,7 +18347,7 @@ var require_executor = __commonJS({
|
|
|
18261
18347
|
});
|
|
18262
18348
|
logger_12.logger.debug("[OpenCode] Full prompt", { prompt });
|
|
18263
18349
|
const env = (0, config_12.getOpenCodeEnv)(projectId, job_context_storage_12.jobContextStorage.getStore()?.kind);
|
|
18264
|
-
env.CODEGEN_VALIDATION_BASELINE = options.gitBaseline;
|
|
18350
|
+
env.CODEGEN_VALIDATION_BASELINE = options.gitBaseline.commit;
|
|
18265
18351
|
env.CODEGEN_PREPARE_EXTENSION_METADATA = options.prepareExtensionMetadata ? "1" : "0";
|
|
18266
18352
|
env.CODEGEN_REQUIRE_VALIDATION = attempt > 1 ? "1" : "0";
|
|
18267
18353
|
ctx.child = (0, child_process_1.spawn)("opencode", args, {
|
|
@@ -18362,7 +18448,7 @@ var require_opencode_runner = __commonJS({
|
|
|
18362
18448
|
projectId,
|
|
18363
18449
|
gitBaseline,
|
|
18364
18450
|
prepareExtensionMetadata: true,
|
|
18365
|
-
postRunValidation: (stdout) => (0, session_validation_1.validateSessionOrFallback)(outputPath, stdout, gitBaseline),
|
|
18451
|
+
postRunValidation: (stdout) => (0, session_validation_1.validateSessionOrFallback)(outputPath, stdout, gitBaseline.commit),
|
|
18366
18452
|
onStdout,
|
|
18367
18453
|
onStderr
|
|
18368
18454
|
});
|
|
@@ -18376,7 +18462,7 @@ var require_opencode_runner = __commonJS({
|
|
|
18376
18462
|
projectId,
|
|
18377
18463
|
gitBaseline,
|
|
18378
18464
|
prepareExtensionMetadata: true,
|
|
18379
|
-
postRunValidation: (stdout) => (0, session_validation_1.validateSessionOrFallback)(outputPath, stdout, gitBaseline),
|
|
18465
|
+
postRunValidation: (stdout) => (0, session_validation_1.validateSessionOrFallback)(outputPath, stdout, gitBaseline.commit),
|
|
18380
18466
|
onStdout,
|
|
18381
18467
|
onStderr
|
|
18382
18468
|
});
|
|
@@ -129231,6 +129317,7 @@ var require_job_timeout_monitor = __commonJS({
|
|
|
129231
129317
|
var logger_12 = require_logger();
|
|
129232
129318
|
var context_12 = require_context();
|
|
129233
129319
|
var job_context_storage_12 = require_job_context_storage();
|
|
129320
|
+
var file_changes_1 = require_file_changes();
|
|
129234
129321
|
var codegen_flow_helpers_12 = require_codegen_flow_helpers();
|
|
129235
129322
|
var types_1 = require_types_impl();
|
|
129236
129323
|
var bi_events_1 = require_bi_events();
|
|
@@ -129263,7 +129350,7 @@ var require_job_timeout_monitor = __commonJS({
|
|
|
129263
129350
|
const codegenError = this.resolveTimeoutError(jobId, job);
|
|
129264
129351
|
await (0, utils_12.updateAllRunningTasks)(jobId, ditto_codegen_types_12.Status.FAILED, codegenError);
|
|
129265
129352
|
await this.codeGenerationService.updateJobStatus(jobId, ditto_codegen_types_12.Status.FAILED);
|
|
129266
|
-
const failedRunPayload = await (0, codegen_flow_helpers_12.buildFailedRunPayload)(codegenError, (0, codegen_flow_helpers_12.getOutputPath)(), job_context_storage_12.jobContextStorage.getStore()?.gitBaseline ??
|
|
129353
|
+
const failedRunPayload = await (0, codegen_flow_helpers_12.buildFailedRunPayload)(codegenError, (0, codegen_flow_helpers_12.getOutputPath)(), job_context_storage_12.jobContextStorage.getStore()?.gitBaseline ?? file_changes_1.EMPTY_GIT_BASELINE);
|
|
129267
129354
|
await this.codeGenerationService.updateJob(jobId, {
|
|
129268
129355
|
...job?.payload,
|
|
129269
129356
|
...failedRunPayload
|
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.510",
|
|
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": "2d1d136d804abaa6830836b7336d55cd0faf10f65e3cc0fa36972440"
|
|
33
33
|
}
|