lula2 0.6.6-nightly.0 → 0.7.0

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 (50) hide show
  1. package/README.md +1 -0
  2. package/dist/_app/immutable/assets/0.KSamNhnP.css +1 -0
  3. package/dist/_app/immutable/chunks/24UDoAn4.js +65 -0
  4. package/dist/_app/immutable/chunks/B0ygo1VA.js +2 -0
  5. package/dist/_app/immutable/chunks/B2nEDjq4.js +1 -0
  6. package/dist/_app/immutable/chunks/BNHHvtTX.js +1 -0
  7. package/dist/_app/immutable/chunks/CpBmCwmc.js +1 -0
  8. package/dist/_app/immutable/chunks/CttDkklr.js +2 -0
  9. package/dist/_app/immutable/chunks/P3psI8RV.js +1 -0
  10. package/dist/_app/immutable/chunks/iLqChAUt.js +1 -0
  11. package/dist/_app/immutable/chunks/iYE0hyoB.js +1 -0
  12. package/dist/_app/immutable/chunks/l0xMBaDV.js +1 -0
  13. package/dist/_app/immutable/entry/app.DK674slU.js +2 -0
  14. package/dist/_app/immutable/entry/start.BzhV34ug.js +1 -0
  15. package/dist/_app/immutable/nodes/0.CX00wLgP.js +2 -0
  16. package/dist/_app/immutable/nodes/1.eWlwSy7C.js +1 -0
  17. package/dist/_app/immutable/nodes/2.C8hXOpRf.js +1 -0
  18. package/dist/_app/immutable/nodes/3.DeLiyve3.js +1 -0
  19. package/dist/_app/immutable/nodes/{4.CjJtAzwd.js → 4.CSVxIlBM.js} +1 -1
  20. package/dist/_app/version.json +1 -1
  21. package/dist/cli/commands/ui.js +281 -14
  22. package/dist/cli/server/index.js +281 -14
  23. package/dist/cli/server/server.js +281 -14
  24. package/dist/cli/server/serverState.js +247 -3
  25. package/dist/cli/server/spreadsheetRoutes.js +821 -2
  26. package/dist/cli/server/websocketServer.js +281 -14
  27. package/dist/index.html +11 -11
  28. package/dist/index.js +281 -14
  29. package/package.json +21 -20
  30. package/src/lib/components/git-status/GitStatusDropdown.svelte +261 -0
  31. package/src/lib/components/git-status/index.ts +4 -0
  32. package/src/lib/types.ts +19 -0
  33. package/src/routes/+layout.svelte +4 -0
  34. package/dist/_app/immutable/assets/0.DT0yw00X.css +0 -1
  35. package/dist/_app/immutable/chunks/BAMA-SMn.js +0 -1
  36. package/dist/_app/immutable/chunks/BIpNkEdo.js +0 -65
  37. package/dist/_app/immutable/chunks/BOeu7SQt.js +0 -2
  38. package/dist/_app/immutable/chunks/Bvx51L6t.js +0 -1
  39. package/dist/_app/immutable/chunks/DQTRhwGS.js +0 -1
  40. package/dist/_app/immutable/chunks/DkIUt-Ae.js +0 -1
  41. package/dist/_app/immutable/chunks/DoNUPQ2F.js +0 -1
  42. package/dist/_app/immutable/chunks/DsnmJJEf.js +0 -1
  43. package/dist/_app/immutable/chunks/kqS9jm6m.js +0 -2
  44. package/dist/_app/immutable/chunks/oPg1Ic49.js +0 -1
  45. package/dist/_app/immutable/entry/app.Dqwn7sww.js +0 -2
  46. package/dist/_app/immutable/entry/start.B-O5NM7y.js +0 -1
  47. package/dist/_app/immutable/nodes/0.CZ3i370e.js +0 -2
  48. package/dist/_app/immutable/nodes/1.C9kqHM-h.js +0 -1
  49. package/dist/_app/immutable/nodes/2.BDP2l8IW.js +0 -1
  50. package/dist/_app/immutable/nodes/3.HVBwzXF9.js +0 -1
@@ -884,13 +884,10 @@ var init_yamlDiff = __esm({
884
884
  });
885
885
 
886
886
  // cli/server/infrastructure/gitHistory.ts
887
- var gitHistory_exports = {};
888
- __export(gitHistory_exports, {
889
- GitHistoryUtil: () => GitHistoryUtil
890
- });
891
887
  import * as fs2 from "fs";
892
888
  import * as git from "isomorphic-git";
893
889
  import { relative } from "path";
890
+ import { execSync } from "child_process";
894
891
  var GitHistoryUtil;
895
892
  var init_gitHistory = __esm({
896
893
  "cli/server/infrastructure/gitHistory.ts"() {
@@ -898,8 +895,30 @@ var init_gitHistory = __esm({
898
895
  init_yamlDiff();
899
896
  GitHistoryUtil = class {
900
897
  baseDir;
901
- constructor(baseDir) {
898
+ execSync;
899
+ constructor(baseDir, execSyncFn) {
902
900
  this.baseDir = baseDir;
901
+ this.execSync = execSyncFn || execSync;
902
+ }
903
+ /**
904
+ * Execute a git command using native git binary with credentials support
905
+ */
906
+ async executeGitCommand(command, cwd) {
907
+ try {
908
+ const workingDir = cwd || await git.findRoot({ fs: fs2, filepath: process.cwd() });
909
+ const output = this.execSync(command, {
910
+ cwd: workingDir,
911
+ encoding: "utf8",
912
+ stdio: ["pipe", "pipe", "pipe"]
913
+ });
914
+ return { success: true, output: output.toString() };
915
+ } catch (error) {
916
+ return {
917
+ success: false,
918
+ output: "",
919
+ error: error.stderr?.toString() || error.message
920
+ };
921
+ }
903
922
  }
904
923
  /**
905
924
  * Check if the directory is a git repository
@@ -1083,7 +1102,7 @@ var init_gitHistory = __esm({
1083
1102
  }
1084
1103
  const currentLines = currentContent ? currentContent.split("\n") : [];
1085
1104
  const parentLines = parentContent ? parentContent.split("\n") : [];
1086
- const diff = this.createSimpleDiff(parentLines, currentLines, relativePath);
1105
+ const diff = await this.createSimpleDiff(parentLines, currentLines, relativePath);
1087
1106
  const { insertions, deletions } = this.countChanges(parentLines, currentLines);
1088
1107
  const isMappingFile = relativePath.includes("-mappings.yaml");
1089
1108
  const yamlDiff = createYamlDiff(parentContent || "", currentContent || "", isMappingFile);
@@ -1115,7 +1134,7 @@ var init_gitHistory = __esm({
1115
1134
  /**
1116
1135
  * Create a simple unified diff between two file versions
1117
1136
  */
1118
- createSimpleDiff(oldLines, newLines, filepath) {
1137
+ async createSimpleDiff(oldLines, newLines, filepath) {
1119
1138
  const diffLines = [];
1120
1139
  diffLines.push(`--- a/${filepath}`);
1121
1140
  diffLines.push(`+++ b/${filepath}`);
@@ -1197,6 +1216,227 @@ var init_gitHistory = __esm({
1197
1216
  };
1198
1217
  }
1199
1218
  }
1219
+ /**
1220
+ * Get current branch name
1221
+ */
1222
+ async getCurrentBranch() {
1223
+ try {
1224
+ const isGitRepo = await this.isGitRepository();
1225
+ if (!isGitRepo) {
1226
+ return null;
1227
+ }
1228
+ const gitRoot = await git.findRoot({ fs: fs2, filepath: process.cwd() });
1229
+ const branch = await git.currentBranch({ fs: fs2, dir: gitRoot });
1230
+ return branch || null;
1231
+ } catch (error) {
1232
+ console.error("Error getting current branch:", error);
1233
+ return null;
1234
+ }
1235
+ }
1236
+ /**
1237
+ * Get git status information
1238
+ */
1239
+ async getGitStatus() {
1240
+ try {
1241
+ const isGitRepo = await this.isGitRepository();
1242
+ if (!isGitRepo) {
1243
+ return {
1244
+ isGitRepository: false,
1245
+ currentBranch: null,
1246
+ branchInfo: null,
1247
+ canPull: false,
1248
+ canPush: false
1249
+ };
1250
+ }
1251
+ const currentBranch2 = await this.getCurrentBranch();
1252
+ if (!currentBranch2) {
1253
+ return {
1254
+ isGitRepository: true,
1255
+ currentBranch: null,
1256
+ branchInfo: null,
1257
+ canPull: false,
1258
+ canPush: false
1259
+ };
1260
+ }
1261
+ const branchInfo = await this.getBranchInfo(currentBranch2);
1262
+ return {
1263
+ isGitRepository: true,
1264
+ currentBranch: currentBranch2,
1265
+ branchInfo,
1266
+ canPull: branchInfo?.isBehind || false,
1267
+ canPush: branchInfo?.isAhead || false
1268
+ };
1269
+ } catch (error) {
1270
+ console.error("Error getting git status:", error);
1271
+ return {
1272
+ isGitRepository: false,
1273
+ currentBranch: null,
1274
+ branchInfo: null,
1275
+ canPull: false,
1276
+ canPush: false
1277
+ };
1278
+ }
1279
+ }
1280
+ /**
1281
+ * Get branch comparison information
1282
+ */
1283
+ async getBranchInfo(branchName) {
1284
+ try {
1285
+ const gitRoot = await git.findRoot({ fs: fs2, filepath: process.cwd() });
1286
+ const localCommits = await git.log({ fs: fs2, dir: gitRoot, ref: branchName });
1287
+ try {
1288
+ const remotes = await git.listRemotes({ fs: fs2, dir: gitRoot });
1289
+ for (const remote of remotes) {
1290
+ try {
1291
+ const fetchResult = await this.executeGitCommand(`git fetch ${remote.remote}`, gitRoot);
1292
+ if (!fetchResult.success) {
1293
+ console.warn(`Could not fetch from remote ${remote.remote}:`, fetchResult.error);
1294
+ }
1295
+ } catch (fetchError) {
1296
+ console.warn(`Could not fetch from remote ${remote.remote}:`, fetchError);
1297
+ }
1298
+ }
1299
+ let remoteCommits = [];
1300
+ let foundRemote = false;
1301
+ for (const remote of remotes) {
1302
+ const remoteBranchRef = `${remote.remote}/${branchName}`;
1303
+ try {
1304
+ remoteCommits = await git.log({ fs: fs2, dir: gitRoot, ref: remoteBranchRef });
1305
+ foundRemote = true;
1306
+ break;
1307
+ } catch (error) {
1308
+ console.warn(`Could not get commits for ${remoteBranchRef}: ${error}`);
1309
+ }
1310
+ }
1311
+ if (!foundRemote || remoteCommits.length === 0) {
1312
+ const lastCommit2 = localCommits[0];
1313
+ return {
1314
+ currentBranch: branchName,
1315
+ isAhead: false,
1316
+ isBehind: false,
1317
+ aheadCount: 0,
1318
+ behindCount: 0,
1319
+ lastCommitDate: lastCommit2 ? new Date(lastCommit2.commit.author.timestamp * 1e3).toISOString() : null,
1320
+ lastCommitMessage: lastCommit2?.commit.message || null,
1321
+ hasUnpushedChanges: false
1322
+ };
1323
+ }
1324
+ const localHashes = new Set(localCommits.map((c) => c.oid));
1325
+ const remoteHashes = new Set(remoteCommits.map((c) => c.oid));
1326
+ const aheadCount = localCommits.filter((c) => !remoteHashes.has(c.oid)).length;
1327
+ const behindCount = remoteCommits.filter((c) => !localHashes.has(c.oid)).length;
1328
+ const lastCommit = localCommits[0];
1329
+ return {
1330
+ currentBranch: branchName,
1331
+ isAhead: aheadCount > 0,
1332
+ isBehind: behindCount > 0,
1333
+ aheadCount,
1334
+ behindCount,
1335
+ lastCommitDate: lastCommit ? new Date(lastCommit.commit.author.timestamp * 1e3).toISOString() : null,
1336
+ lastCommitMessage: lastCommit?.commit.message || null,
1337
+ hasUnpushedChanges: aheadCount > 0
1338
+ };
1339
+ } catch {
1340
+ const lastCommit = localCommits[0];
1341
+ return {
1342
+ currentBranch: branchName,
1343
+ isAhead: false,
1344
+ isBehind: false,
1345
+ aheadCount: 0,
1346
+ behindCount: 0,
1347
+ lastCommitDate: lastCommit ? new Date(lastCommit.commit.author.timestamp * 1e3).toISOString() : null,
1348
+ lastCommitMessage: lastCommit?.commit.message || null,
1349
+ hasUnpushedChanges: false
1350
+ };
1351
+ }
1352
+ } catch (error) {
1353
+ console.error("Error getting branch info:", error);
1354
+ return null;
1355
+ }
1356
+ }
1357
+ /**
1358
+ * Fetch updates from remote repositories using native git command
1359
+ */
1360
+ async fetchFromRemotes() {
1361
+ try {
1362
+ const isGitRepo = await this.isGitRepository();
1363
+ if (!isGitRepo) {
1364
+ return { success: false, message: "Not a git repository", details: [] };
1365
+ }
1366
+ const gitRoot = await git.findRoot({ fs: fs2, filepath: process.cwd() });
1367
+ const remotes = await git.listRemotes({ fs: fs2, dir: gitRoot });
1368
+ if (remotes.length === 0) {
1369
+ return { success: true, message: "No remotes configured", details: [] };
1370
+ }
1371
+ const details = [];
1372
+ let hasErrors = false;
1373
+ for (const remote of remotes) {
1374
+ try {
1375
+ const fetchResult = await this.executeGitCommand(`git fetch ${remote.remote}`, gitRoot);
1376
+ if (fetchResult.success) {
1377
+ details.push(`Fetched from ${remote.remote}`);
1378
+ } else {
1379
+ details.push(`Failed to fetch from ${remote.remote}: ${fetchResult.error}`);
1380
+ hasErrors = true;
1381
+ }
1382
+ } catch (error) {
1383
+ details.push(`Error fetching from ${remote.remote}: ${error}`);
1384
+ hasErrors = true;
1385
+ }
1386
+ }
1387
+ return {
1388
+ success: !hasErrors,
1389
+ message: hasErrors ? "Fetch completed with some errors" : "Successfully fetched from all remotes",
1390
+ details
1391
+ };
1392
+ } catch (error) {
1393
+ console.error("Error fetching from remotes:", error);
1394
+ return {
1395
+ success: false,
1396
+ message: error instanceof Error ? error.message : "Unknown error occurred",
1397
+ details: []
1398
+ };
1399
+ }
1400
+ }
1401
+ /**
1402
+ * Pull changes from remote using native git command
1403
+ */
1404
+ async pullChanges() {
1405
+ try {
1406
+ const isGitRepo = await this.isGitRepository();
1407
+ if (!isGitRepo) {
1408
+ return { success: false, message: "Not a git repository" };
1409
+ }
1410
+ const currentBranch2 = await this.getCurrentBranch();
1411
+ if (!currentBranch2) {
1412
+ return { success: false, message: "No current branch found" };
1413
+ }
1414
+ const gitRoot = await git.findRoot({ fs: fs2, filepath: process.cwd() });
1415
+ const remotes = await git.listRemotes({ fs: fs2, dir: gitRoot });
1416
+ if (remotes.length === 0) {
1417
+ return { success: false, message: "No remotes configured" };
1418
+ }
1419
+ const targetRemote = remotes[0].remote;
1420
+ const pullCommand = `git pull ${targetRemote} ${currentBranch2}`;
1421
+ const pullResult = await this.executeGitCommand(pullCommand, gitRoot);
1422
+ if (!pullResult.success) {
1423
+ return {
1424
+ success: false,
1425
+ message: `Failed to pull changes: ${pullResult.error}`
1426
+ };
1427
+ }
1428
+ return {
1429
+ success: true,
1430
+ message: pullResult.output || "Successfully pulled changes"
1431
+ };
1432
+ } catch (error) {
1433
+ console.error("Error pulling changes:", error);
1434
+ return {
1435
+ success: false,
1436
+ message: error instanceof Error ? error.message : "Unknown error occurred"
1437
+ };
1438
+ }
1439
+ }
1200
1440
  };
1201
1441
  }
1202
1442
  });
@@ -2047,6 +2287,7 @@ var init_spreadsheetRoutes = __esm({
2047
2287
  "use strict";
2048
2288
  init_debug();
2049
2289
  init_serverState();
2290
+ init_gitHistory();
2050
2291
  MAX_HEADER_CANDIDATES = 5;
2051
2292
  PREVIEW_COLUMNS = 4;
2052
2293
  router = express.Router();
@@ -2366,6 +2607,32 @@ var init_spreadsheetRoutes = __esm({
2366
2607
  res.status(500).json({ error: "Failed to get sheet previews" });
2367
2608
  }
2368
2609
  });
2610
+ router.get("/git-status", async (req, res) => {
2611
+ try {
2612
+ const state = getServerState();
2613
+ const gitUtil = new GitHistoryUtil(state.CONTROL_SET_DIR);
2614
+ const gitStatus = await gitUtil.getGitStatus();
2615
+ res.json(gitStatus);
2616
+ } catch (error) {
2617
+ console.error("Error getting git status:", error);
2618
+ res.status(500).json({ error: "Failed to get git status" });
2619
+ }
2620
+ });
2621
+ router.post("/git-pull", async (req, res) => {
2622
+ try {
2623
+ const state = getServerState();
2624
+ const gitUtil = new GitHistoryUtil(state.CONTROL_SET_DIR);
2625
+ const result = await gitUtil.pullChanges();
2626
+ if (result.success) {
2627
+ res.json(result);
2628
+ } else {
2629
+ res.status(400).json(result);
2630
+ }
2631
+ } catch (error) {
2632
+ console.error("Error pulling changes:", error);
2633
+ res.status(500).json({ error: "Failed to pull changes" });
2634
+ }
2635
+ });
2369
2636
  spreadsheetRoutes_default = router;
2370
2637
  }
2371
2638
  });
@@ -2375,6 +2642,7 @@ import { readFileSync as readFileSync4 } from "fs";
2375
2642
  init_debug();
2376
2643
  init_controlHelpers();
2377
2644
  init_serverState();
2645
+ init_gitHistory();
2378
2646
  import * as yaml5 from "js-yaml";
2379
2647
  import { join as join5 } from "path";
2380
2648
  import { WebSocket, WebSocketServer } from "ws";
@@ -2538,8 +2806,7 @@ var WebSocketManager = class {
2538
2806
  if (!control.id) {
2539
2807
  control.id = controlId;
2540
2808
  }
2541
- const { GitHistoryUtil: GitHistoryUtil2 } = await Promise.resolve().then(() => (init_gitHistory(), gitHistory_exports));
2542
- const { execSync } = await import("child_process");
2809
+ const { execSync: execSync2 } = await import("child_process");
2543
2810
  let timeline = null;
2544
2811
  try {
2545
2812
  const currentPath2 = getCurrentControlSetPath();
@@ -2579,7 +2846,7 @@ var WebSocketManager = class {
2579
2846
  console.error(`Could not find file for control ${control.id}`);
2580
2847
  timeline = null;
2581
2848
  } else {
2582
- const gitUtil = new GitHistoryUtil2(currentPath2);
2849
+ const gitUtil = new GitHistoryUtil(currentPath2);
2583
2850
  const controlHistory = await gitUtil.getFileHistory(controlPath);
2584
2851
  debug(`Git history for ${control.id}:`, {
2585
2852
  path: controlPath,
@@ -2600,12 +2867,12 @@ var WebSocketManager = class {
2600
2867
  let hasPendingChanges = false;
2601
2868
  try {
2602
2869
  try {
2603
- execSync(`git ls-files --error-unmatch "${controlPath}"`, {
2870
+ execSync2(`git ls-files --error-unmatch "${controlPath}"`, {
2604
2871
  encoding: "utf8",
2605
2872
  cwd: process.cwd(),
2606
2873
  stdio: "pipe"
2607
2874
  });
2608
- const gitStatus = execSync(`git status --porcelain "${controlPath}"`, {
2875
+ const gitStatus = execSync2(`git status --porcelain "${controlPath}"`, {
2609
2876
  encoding: "utf8",
2610
2877
  cwd: process.cwd()
2611
2878
  }).trim();
@@ -2624,12 +2891,12 @@ var WebSocketManager = class {
2624
2891
  if (existsSync4(mappingPath)) {
2625
2892
  try {
2626
2893
  try {
2627
- execSync(`git ls-files --error-unmatch "${mappingPath}"`, {
2894
+ execSync2(`git ls-files --error-unmatch "${mappingPath}"`, {
2628
2895
  encoding: "utf8",
2629
2896
  cwd: process.cwd(),
2630
2897
  stdio: "pipe"
2631
2898
  });
2632
- const gitStatus = execSync(`git status --porcelain "${mappingPath}"`, {
2899
+ const gitStatus = execSync2(`git status --porcelain "${mappingPath}"`, {
2633
2900
  encoding: "utf8",
2634
2901
  cwd: process.cwd()
2635
2902
  }).trim();
package/dist/index.html CHANGED
@@ -6,28 +6,28 @@
6
6
  <link rel="icon" href="/lula.png" />
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1" />
8
8
 
9
- <link rel="modulepreload" href="/_app/immutable/entry/start.B-O5NM7y.js">
10
- <link rel="modulepreload" href="/_app/immutable/chunks/DkIUt-Ae.js">
11
- <link rel="modulepreload" href="/_app/immutable/chunks/kqS9jm6m.js">
12
- <link rel="modulepreload" href="/_app/immutable/entry/app.Dqwn7sww.js">
13
- <link rel="modulepreload" href="/_app/immutable/chunks/DsnmJJEf.js">
14
- <link rel="modulepreload" href="/_app/immutable/chunks/DoNUPQ2F.js">
15
- <link rel="modulepreload" href="/_app/immutable/chunks/DQTRhwGS.js">
16
- <link rel="modulepreload" href="/_app/immutable/chunks/oPg1Ic49.js">
9
+ <link rel="modulepreload" href="/_app/immutable/entry/start.BzhV34ug.js">
10
+ <link rel="modulepreload" href="/_app/immutable/chunks/l0xMBaDV.js">
11
+ <link rel="modulepreload" href="/_app/immutable/chunks/iLqChAUt.js">
12
+ <link rel="modulepreload" href="/_app/immutable/entry/app.DK674slU.js">
13
+ <link rel="modulepreload" href="/_app/immutable/chunks/B0ygo1VA.js">
14
+ <link rel="modulepreload" href="/_app/immutable/chunks/CpBmCwmc.js">
15
+ <link rel="modulepreload" href="/_app/immutable/chunks/P3psI8RV.js">
16
+ <link rel="modulepreload" href="/_app/immutable/chunks/iYE0hyoB.js">
17
17
  </head>
18
18
  <body data-sveltekit-preload-data="hover">
19
19
  <div style="display: contents">
20
20
  <script>
21
21
  {
22
- __sveltekit_1v2zit3 = {
22
+ __sveltekit_prn659 = {
23
23
  base: ""
24
24
  };
25
25
 
26
26
  const element = document.currentScript.parentElement;
27
27
 
28
28
  Promise.all([
29
- import("/_app/immutable/entry/start.B-O5NM7y.js"),
30
- import("/_app/immutable/entry/app.Dqwn7sww.js")
29
+ import("/_app/immutable/entry/start.BzhV34ug.js"),
30
+ import("/_app/immutable/entry/app.DK674slU.js")
31
31
  ]).then(([kit, app]) => {
32
32
  kit.start(app, element);
33
33
  });