@wix/ditto-codegen-public 1.0.330 → 1.0.332

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.
Files changed (2) hide show
  1. package/dist/out.js +197 -21
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -11676,6 +11676,7 @@ var require_constants5 = __commonJS({
11676
11676
  exports2.detectExtension = detectExtension;
11677
11677
  exports2.toTitleCase = toTitleCase;
11678
11678
  exports2.extractExtensionName = extractExtensionName;
11679
+ exports2.extractExtensionDisplayTitle = extractExtensionDisplayTitle;
11679
11680
  exports2.injectCreatedBy = injectCreatedBy;
11680
11681
  exports2.getWrittenContent = getWrittenContent;
11681
11682
  var ditto_codegen_types_12 = require_dist4();
@@ -11754,6 +11755,33 @@ var require_constants5 = __commonJS({
11754
11755
  const folderName = parts[parts.length - 2] || "";
11755
11756
  return toTitleCase(folderName);
11756
11757
  }
11758
+ function matchQuotedExtensionConfigProperty(content, propName) {
11759
+ const objectPropertyQuotedStringValuePattern = `\\b${propName}\\s*:\\s*(?:"([^"\\\\]*)"|'([^'\\\\]*)')`;
11760
+ const objectPropertyQuotedStringValueRegex = new RegExp(
11761
+ objectPropertyQuotedStringValuePattern,
11762
+ // `m` = multiline: `^` / `$` match line starts/ends, not only the whole string.
11763
+ "m"
11764
+ );
11765
+ const quotedStringValueMatch = content.match(objectPropertyQuotedStringValueRegex);
11766
+ if (!quotedStringValueMatch)
11767
+ return null;
11768
+ return quotedStringValueMatch[1] ?? quotedStringValueMatch[2] ?? null;
11769
+ }
11770
+ function extractExtensionDisplayTitle(content, filePath) {
11771
+ const title = matchQuotedExtensionConfigProperty(content, "title");
11772
+ if (title)
11773
+ return title;
11774
+ const name = matchQuotedExtensionConfigProperty(content, "name");
11775
+ if (name)
11776
+ return name;
11777
+ const displayName = matchQuotedExtensionConfigProperty(content, "displayName");
11778
+ if (displayName)
11779
+ return displayName;
11780
+ const idSuffix = matchQuotedExtensionConfigProperty(content, "idSuffix");
11781
+ if (idSuffix)
11782
+ return idSuffix;
11783
+ return extractExtensionName(filePath);
11784
+ }
11757
11785
  function injectCreatedBy(content) {
11758
11786
  if (content.includes("createdBy"))
11759
11787
  return content;
@@ -14232,12 +14260,54 @@ var require_opencode_runner = __commonJS({
14232
14260
  }
14233
14261
  });
14234
14262
 
14263
+ // dist/opencode-integration/collect-extensions-created.js
14264
+ var require_collect_extensions_created = __commonJS({
14265
+ "dist/opencode-integration/collect-extensions-created.js"(exports2) {
14266
+ "use strict";
14267
+ Object.defineProperty(exports2, "__esModule", { value: true });
14268
+ exports2.collectInsertedExtensionsMetadata = collectInsertedExtensionsMetadata;
14269
+ exports2.buildExtensionsJobPayload = buildExtensionsJobPayload;
14270
+ var path_1 = require("path");
14271
+ var promises_1 = require("fs/promises");
14272
+ var ditto_codegen_types_12 = require_dist4();
14273
+ var constants_1 = require_constants5();
14274
+ async function collectInsertedExtensionsMetadata(outputPath, files) {
14275
+ const results = [];
14276
+ for (const f of files) {
14277
+ if (f.operation !== ditto_codegen_types_12.ExtensionGenerationOperation.INSERT)
14278
+ continue;
14279
+ if (!(0, constants_1.isExtensionsFile)(f.path))
14280
+ continue;
14281
+ const fullPath = (0, path_1.isAbsolute)(f.path) ? f.path : (0, path_1.join)(outputPath, f.path);
14282
+ try {
14283
+ const content = await (0, promises_1.readFile)(fullPath, "utf-8");
14284
+ const detected = (0, constants_1.detectExtension)(content);
14285
+ if (!detected)
14286
+ continue;
14287
+ results.push({
14288
+ path: f.path,
14289
+ extensionType: detected.extensionType,
14290
+ title: (0, constants_1.extractExtensionDisplayTitle)(content, f.path)
14291
+ });
14292
+ } catch {
14293
+ continue;
14294
+ }
14295
+ }
14296
+ return results;
14297
+ }
14298
+ async function buildExtensionsJobPayload(outputPath, files) {
14299
+ const created = await collectInsertedExtensionsMetadata(outputPath, files);
14300
+ return { created };
14301
+ }
14302
+ }
14303
+ });
14304
+
14235
14305
  // dist/opencode-integration/index.js
14236
14306
  var require_opencode_integration = __commonJS({
14237
14307
  "dist/opencode-integration/index.js"(exports2) {
14238
14308
  "use strict";
14239
14309
  Object.defineProperty(exports2, "__esModule", { value: true });
14240
- exports2.OpenCodeTaskTracker = exports2.runOpenCodeAsk = exports2.runOpenCodeIteration = exports2.runOpenCodeInit = void 0;
14310
+ exports2.collectInsertedExtensionsMetadata = exports2.buildExtensionsJobPayload = exports2.OpenCodeTaskTracker = exports2.runOpenCodeAsk = exports2.runOpenCodeIteration = exports2.runOpenCodeInit = void 0;
14241
14311
  var opencode_runner_1 = require_opencode_runner();
14242
14312
  Object.defineProperty(exports2, "runOpenCodeInit", { enumerable: true, get: function() {
14243
14313
  return opencode_runner_1.runOpenCodeInit;
@@ -14252,6 +14322,13 @@ var require_opencode_integration = __commonJS({
14252
14322
  Object.defineProperty(exports2, "OpenCodeTaskTracker", { enumerable: true, get: function() {
14253
14323
  return task_tracker_1.OpenCodeTaskTracker;
14254
14324
  } });
14325
+ var collect_extensions_created_1 = require_collect_extensions_created();
14326
+ Object.defineProperty(exports2, "buildExtensionsJobPayload", { enumerable: true, get: function() {
14327
+ return collect_extensions_created_1.buildExtensionsJobPayload;
14328
+ } });
14329
+ Object.defineProperty(exports2, "collectInsertedExtensionsMetadata", { enumerable: true, get: function() {
14330
+ return collect_extensions_created_1.collectInsertedExtensionsMetadata;
14331
+ } });
14255
14332
  }
14256
14333
  });
14257
14334
 
@@ -14373,6 +14450,76 @@ var require_agent_io = __commonJS({
14373
14450
  }
14374
14451
  });
14375
14452
 
14453
+ // dist/opencode-integration/git-file-changes.js
14454
+ var require_git_file_changes = __commonJS({
14455
+ "dist/opencode-integration/git-file-changes.js"(exports2) {
14456
+ "use strict";
14457
+ Object.defineProperty(exports2, "__esModule", { value: true });
14458
+ exports2.captureGitBaseline = captureGitBaseline;
14459
+ exports2.collectGitFileChanges = collectGitFileChanges;
14460
+ var child_process_1 = require("child_process");
14461
+ var util_1 = require("util");
14462
+ var ditto_codegen_types_12 = require_dist4();
14463
+ var logger_12 = require_logger();
14464
+ var execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
14465
+ async function captureGitBaseline(cwd) {
14466
+ const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD"], { cwd });
14467
+ return stdout.trim();
14468
+ }
14469
+ async function collectGitFileChanges(cwd, baseline) {
14470
+ try {
14471
+ const [diffResult, untrackedResult] = await Promise.all([
14472
+ execFileAsync("git", [
14473
+ "-c",
14474
+ "core.quotepath=off",
14475
+ "diff",
14476
+ "--name-status",
14477
+ "--no-renames",
14478
+ "-z",
14479
+ baseline
14480
+ ], { cwd, maxBuffer: 10 * 1024 * 1024 }),
14481
+ execFileAsync("git", ["ls-files", "--others", "--exclude-standard", "-z"], { cwd, maxBuffer: 10 * 1024 * 1024 })
14482
+ ]);
14483
+ const files = parseDiffNameStatus(diffResult.stdout);
14484
+ appendUntrackedFiles(untrackedResult.stdout, files);
14485
+ files.sort((a, b) => a.path.localeCompare(b.path));
14486
+ return files;
14487
+ } catch (error) {
14488
+ logger_12.logger.error("[OpenCode] Failed to collect git file changes", {
14489
+ error: error instanceof Error ? error.message : String(error)
14490
+ });
14491
+ return [];
14492
+ }
14493
+ }
14494
+ var GIT_STATUS_TO_OPERATION = {
14495
+ A: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT,
14496
+ M: ditto_codegen_types_12.ExtensionGenerationOperation.EDIT,
14497
+ D: ditto_codegen_types_12.ExtensionGenerationOperation.DELETE
14498
+ };
14499
+ function parseDiffNameStatus(raw) {
14500
+ const files = [];
14501
+ const parts = raw.split("\0").filter(Boolean);
14502
+ for (let i = 0; i < parts.length - 1; i += 2) {
14503
+ const operation = GIT_STATUS_TO_OPERATION[parts[i]];
14504
+ const path = parts[i + 1];
14505
+ if (path && operation) {
14506
+ files.push({ path, operation });
14507
+ }
14508
+ }
14509
+ return files;
14510
+ }
14511
+ function appendUntrackedFiles(raw, files) {
14512
+ const knownPaths = new Set(files.map((f) => f.path));
14513
+ const paths = raw.split("\0").filter(Boolean);
14514
+ for (const path of paths) {
14515
+ if (!knownPaths.has(path)) {
14516
+ files.push({ path, operation: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT });
14517
+ }
14518
+ }
14519
+ }
14520
+ }
14521
+ });
14522
+
14376
14523
  // ../../node_modules/@wix/bi-logger-dev-tools-data/dist/cjs/v2/index.js
14377
14524
  var require_v2 = __commonJS({
14378
14525
  "../../node_modules/@wix/bi-logger-dev-tools-data/dist/cjs/v2/index.js"(exports2) {
@@ -19328,6 +19475,8 @@ var require_opencode_init = __commonJS({
19328
19475
  var context_12 = require_context();
19329
19476
  var logger_12 = require_logger();
19330
19477
  var config_12 = require_config();
19478
+ var git_file_changes_1 = require_git_file_changes();
19479
+ var collect_extensions_created_1 = require_collect_extensions_created();
19331
19480
  var biEvents_1 = require_biEvents();
19332
19481
  var pre_run_decision_1 = require_pre_run_decision();
19333
19482
  var environments_12 = require_environments();
@@ -19360,6 +19509,7 @@ var require_opencode_init = __commonJS({
19360
19509
  taskType: kind
19361
19510
  });
19362
19511
  const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
19512
+ const gitBaseline = await (0, git_file_changes_1.captureGitBaseline)(outputPath);
19363
19513
  let caughtError;
19364
19514
  try {
19365
19515
  (0, agent_io_1.writeAgentInput)(outputPath, agentData);
@@ -19380,11 +19530,15 @@ var require_opencode_init = __commonJS({
19380
19530
  projectId: context_12.ctx.projectId,
19381
19531
  chatHistory: history
19382
19532
  });
19533
+ const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
19383
19534
  const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
19535
+ const extensions = await (0, collect_extensions_created_1.buildExtensionsJobPayload)(outputPath, files);
19384
19536
  await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
19385
19537
  requiredPermissions: result.requiredPermissions,
19538
+ files,
19386
19539
  history,
19387
- ...agentOutput
19540
+ ...agentOutput,
19541
+ extensions
19388
19542
  });
19389
19543
  if (!store.isCompleted) {
19390
19544
  await codeGenerationService_12.codeGenerationService.updateTask(jobId, taskId, ditto_codegen_types_12.Status.COMPLETED, {});
@@ -19395,12 +19549,7 @@ var require_opencode_init = __commonJS({
19395
19549
  taskType: kind,
19396
19550
  taskCost: Math.round(result.usage.cost * 1e6),
19397
19551
  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
- }),
19552
+ agentOutput: JSON.stringify({ files }),
19404
19553
  jobDuration: String(Date.now() - flowStartTime),
19405
19554
  skillsUsed: result.skillsUsed,
19406
19555
  extensionsCreated: result.extensionsCreated
@@ -19410,11 +19559,15 @@ var require_opencode_init = __commonJS({
19410
19559
  caughtError = error;
19411
19560
  const codegenError = (0, ditto_codegen_types_2.toCodegenError)(error);
19412
19561
  const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
19562
+ const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
19563
+ const extensions = await (0, collect_extensions_created_1.buildExtensionsJobPayload)(outputPath, files);
19413
19564
  await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
19414
19565
  requiredPermissions: [],
19415
19566
  requiredPermissionsErrors: codegenError,
19567
+ files,
19416
19568
  history,
19417
- ...agentOutput
19569
+ ...agentOutput,
19570
+ extensions
19418
19571
  });
19419
19572
  await (0, codegen_flow_helpers_12.updateParentTaskStatus)(localJobContext, ditto_codegen_types_12.Status.FAILED, codegenError);
19420
19573
  (0, biEvents_1.reportSessionEnd)({
@@ -19422,6 +19575,7 @@ var require_opencode_init = __commonJS({
19422
19575
  taskModel: config_12.DEFAULT_MODEL,
19423
19576
  taskType: kind,
19424
19577
  taskStatus: ditto_codegen_types_12.Status.FAILED,
19578
+ agentOutput: JSON.stringify({ files }),
19425
19579
  jobDuration: String(Date.now() - flowStartTime)
19426
19580
  });
19427
19581
  (0, biEvents_1.reportSessionError)({
@@ -19519,6 +19673,8 @@ var require_opencode_iterate = __commonJS({
19519
19673
  var context_12 = require_context();
19520
19674
  var logger_12 = require_logger();
19521
19675
  var config_12 = require_config();
19676
+ var git_file_changes_1 = require_git_file_changes();
19677
+ var collect_extensions_created_1 = require_collect_extensions_created();
19522
19678
  var biEvents_1 = require_biEvents();
19523
19679
  var hooks_1 = require_hooks();
19524
19680
  var runOpencodeIterateFlow = async (chatHistory, agentData) => {
@@ -19549,6 +19705,7 @@ var require_opencode_iterate = __commonJS({
19549
19705
  taskType: kind
19550
19706
  });
19551
19707
  const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
19708
+ const gitBaseline = await (0, git_file_changes_1.captureGitBaseline)(outputPath);
19552
19709
  let caughtError;
19553
19710
  try {
19554
19711
  (0, agent_io_1.writeAgentInput)(outputPath, agentData);
@@ -19559,19 +19716,17 @@ var require_opencode_iterate = __commonJS({
19559
19716
  projectId: context_12.ctx.projectId,
19560
19717
  chatHistory
19561
19718
  });
19719
+ const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
19562
19720
  const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
19721
+ const extensions = await (0, collect_extensions_created_1.buildExtensionsJobPayload)(outputPath, files);
19563
19722
  await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
19564
19723
  requiredPermissions: result.requiredPermissions,
19565
- ...agentOutput
19724
+ files,
19725
+ ...agentOutput,
19726
+ extensions
19566
19727
  });
19567
- const taskOutput = {
19568
- files: result.filesChanged.map((file) => ({
19569
- path: file.path,
19570
- operation: file.operation
19571
- }))
19572
- };
19573
19728
  await codeGenerationService_12.codeGenerationService.updateTask(jobId, taskId, ditto_codegen_types_12.Status.COMPLETED, {
19574
- taskOutput
19729
+ taskOutput: { files }
19575
19730
  });
19576
19731
  (0, biEvents_1.reportSessionEnd)({
19577
19732
  ...biBase,
@@ -19579,7 +19734,7 @@ var require_opencode_iterate = __commonJS({
19579
19734
  taskType: kind,
19580
19735
  taskCost: Math.round(result.usage.cost * 1e6),
19581
19736
  taskStatus: ditto_codegen_types_12.Status.COMPLETED,
19582
- agentOutput: JSON.stringify(taskOutput),
19737
+ agentOutput: JSON.stringify({ files }),
19583
19738
  jobDuration: String(Date.now() - flowStartTime),
19584
19739
  skillsUsed: result.skillsUsed,
19585
19740
  extensionsCreated: result.extensionsCreated
@@ -19589,10 +19744,14 @@ var require_opencode_iterate = __commonJS({
19589
19744
  caughtError = error;
19590
19745
  const codegenError = (0, ditto_codegen_types_2.toCodegenError)(error);
19591
19746
  const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
19747
+ const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
19748
+ const extensions = await (0, collect_extensions_created_1.buildExtensionsJobPayload)(outputPath, files);
19592
19749
  await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
19593
19750
  requiredPermissions: [],
19594
19751
  requiredPermissionsErrors: codegenError,
19595
- ...agentOutput
19752
+ files,
19753
+ ...agentOutput,
19754
+ extensions
19596
19755
  });
19597
19756
  await (0, codegen_flow_helpers_12.updateParentTaskStatus)(localJobContext, ditto_codegen_types_12.Status.FAILED, codegenError);
19598
19757
  (0, biEvents_1.reportSessionEnd)({
@@ -19600,6 +19759,7 @@ var require_opencode_iterate = __commonJS({
19600
19759
  taskModel: config_12.DEFAULT_MODEL,
19601
19760
  taskType: kind,
19602
19761
  taskStatus: ditto_codegen_types_12.Status.FAILED,
19762
+ agentOutput: JSON.stringify({ files }),
19603
19763
  jobDuration: String(Date.now() - flowStartTime)
19604
19764
  });
19605
19765
  (0, biEvents_1.reportSessionError)({
@@ -19695,6 +19855,8 @@ var require_opencode_ask = __commonJS({
19695
19855
  var context_12 = require_context();
19696
19856
  var logger_12 = require_logger();
19697
19857
  var config_12 = require_config();
19858
+ var git_file_changes_1 = require_git_file_changes();
19859
+ var collect_extensions_created_1 = require_collect_extensions_created();
19698
19860
  var biEvents_1 = require_biEvents();
19699
19861
  var runOpencodeAskFlow = async (chatHistory) => {
19700
19862
  const store = job_context_storage_12.jobContextStorage.getStore();
@@ -19723,8 +19885,9 @@ var require_opencode_ask = __commonJS({
19723
19885
  taskModel: config_12.DEFAULT_MODEL,
19724
19886
  taskType: kind
19725
19887
  });
19888
+ const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
19889
+ const gitBaseline = await (0, git_file_changes_1.captureGitBaseline)(outputPath);
19726
19890
  try {
19727
- const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
19728
19891
  const askOrchestrator = new OpenCodeAskOrchestrator_1.OpenCodeAskOrchestrator();
19729
19892
  (0, cli_listeners_1.attachOrchestratorListeners)(askOrchestrator);
19730
19893
  const result = await askOrchestrator.ask({
@@ -19732,6 +19895,12 @@ var require_opencode_ask = __commonJS({
19732
19895
  projectId: context_12.ctx.projectId,
19733
19896
  chatHistory
19734
19897
  });
19898
+ const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
19899
+ const extensions = await (0, collect_extensions_created_1.buildExtensionsJobPayload)(outputPath, files);
19900
+ await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
19901
+ files,
19902
+ extensions
19903
+ });
19735
19904
  await codeGenerationService_12.codeGenerationService.updateTask(jobId, taskId, ditto_codegen_types_12.Status.COMPLETED, {
19736
19905
  taskOutput: {
19737
19906
  answer: result.answer
@@ -19743,18 +19912,25 @@ var require_opencode_ask = __commonJS({
19743
19912
  taskType: kind,
19744
19913
  taskCost: Math.round(result.usage.cost * 1e6),
19745
19914
  taskStatus: ditto_codegen_types_12.Status.COMPLETED,
19746
- agentOutput: JSON.stringify({ answer: result.answer }),
19915
+ agentOutput: JSON.stringify({ answer: result.answer, files }),
19747
19916
  jobDuration: String(Date.now() - flowStartTime)
19748
19917
  });
19749
19918
  logger_12.logger.info("[OpenCode Ask] Completed task", { taskId });
19750
19919
  } catch (error) {
19751
19920
  const codegenError = (0, ditto_codegen_types_2.toCodegenError)(error);
19921
+ const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
19922
+ const extensions = await (0, collect_extensions_created_1.buildExtensionsJobPayload)(outputPath, files);
19923
+ await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
19924
+ files,
19925
+ extensions
19926
+ });
19752
19927
  await (0, codegen_flow_helpers_12.updateParentTaskStatus)(localJobContext, ditto_codegen_types_12.Status.FAILED, codegenError);
19753
19928
  (0, biEvents_1.reportSessionEnd)({
19754
19929
  ...biBase,
19755
19930
  taskModel: config_12.DEFAULT_MODEL,
19756
19931
  taskType: kind,
19757
19932
  taskStatus: ditto_codegen_types_12.Status.FAILED,
19933
+ agentOutput: JSON.stringify({ files }),
19758
19934
  jobDuration: String(Date.now() - flowStartTime)
19759
19935
  });
19760
19936
  (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.330",
3
+ "version": "1.0.332",
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": "8c4af062d644318f9c2614e0e31d60cc5ad1ec2dfed82afcc0120b46"
31
+ "falconPackageHash": "afb93089cd6a55134fc2b969f6f956a3fa1e65f0aca41037a5eacc96"
32
32
  }