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
@@ -2455,13 +2455,10 @@ var init_yamlDiff = __esm({
2455
2455
  });
2456
2456
 
2457
2457
  // cli/server/infrastructure/gitHistory.ts
2458
- var gitHistory_exports = {};
2459
- __export(gitHistory_exports, {
2460
- GitHistoryUtil: () => GitHistoryUtil
2461
- });
2462
2458
  import * as fs2 from "fs";
2463
2459
  import * as git from "isomorphic-git";
2464
2460
  import { relative } from "path";
2461
+ import { execSync } from "child_process";
2465
2462
  var GitHistoryUtil;
2466
2463
  var init_gitHistory = __esm({
2467
2464
  "cli/server/infrastructure/gitHistory.ts"() {
@@ -2469,8 +2466,30 @@ var init_gitHistory = __esm({
2469
2466
  init_yamlDiff();
2470
2467
  GitHistoryUtil = class {
2471
2468
  baseDir;
2472
- constructor(baseDir) {
2469
+ execSync;
2470
+ constructor(baseDir, execSyncFn) {
2473
2471
  this.baseDir = baseDir;
2472
+ this.execSync = execSyncFn || execSync;
2473
+ }
2474
+ /**
2475
+ * Execute a git command using native git binary with credentials support
2476
+ */
2477
+ async executeGitCommand(command, cwd) {
2478
+ try {
2479
+ const workingDir = cwd || await git.findRoot({ fs: fs2, filepath: process.cwd() });
2480
+ const output = this.execSync(command, {
2481
+ cwd: workingDir,
2482
+ encoding: "utf8",
2483
+ stdio: ["pipe", "pipe", "pipe"]
2484
+ });
2485
+ return { success: true, output: output.toString() };
2486
+ } catch (error) {
2487
+ return {
2488
+ success: false,
2489
+ output: "",
2490
+ error: error.stderr?.toString() || error.message
2491
+ };
2492
+ }
2474
2493
  }
2475
2494
  /**
2476
2495
  * Check if the directory is a git repository
@@ -2654,7 +2673,7 @@ var init_gitHistory = __esm({
2654
2673
  }
2655
2674
  const currentLines = currentContent ? currentContent.split("\n") : [];
2656
2675
  const parentLines = parentContent ? parentContent.split("\n") : [];
2657
- const diff = this.createSimpleDiff(parentLines, currentLines, relativePath);
2676
+ const diff = await this.createSimpleDiff(parentLines, currentLines, relativePath);
2658
2677
  const { insertions, deletions } = this.countChanges(parentLines, currentLines);
2659
2678
  const isMappingFile = relativePath.includes("-mappings.yaml");
2660
2679
  const yamlDiff = createYamlDiff(parentContent || "", currentContent || "", isMappingFile);
@@ -2686,7 +2705,7 @@ var init_gitHistory = __esm({
2686
2705
  /**
2687
2706
  * Create a simple unified diff between two file versions
2688
2707
  */
2689
- createSimpleDiff(oldLines, newLines, filepath) {
2708
+ async createSimpleDiff(oldLines, newLines, filepath) {
2690
2709
  const diffLines = [];
2691
2710
  diffLines.push(`--- a/${filepath}`);
2692
2711
  diffLines.push(`+++ b/${filepath}`);
@@ -2768,6 +2787,227 @@ var init_gitHistory = __esm({
2768
2787
  };
2769
2788
  }
2770
2789
  }
2790
+ /**
2791
+ * Get current branch name
2792
+ */
2793
+ async getCurrentBranch() {
2794
+ try {
2795
+ const isGitRepo = await this.isGitRepository();
2796
+ if (!isGitRepo) {
2797
+ return null;
2798
+ }
2799
+ const gitRoot = await git.findRoot({ fs: fs2, filepath: process.cwd() });
2800
+ const branch = await git.currentBranch({ fs: fs2, dir: gitRoot });
2801
+ return branch || null;
2802
+ } catch (error) {
2803
+ console.error("Error getting current branch:", error);
2804
+ return null;
2805
+ }
2806
+ }
2807
+ /**
2808
+ * Get git status information
2809
+ */
2810
+ async getGitStatus() {
2811
+ try {
2812
+ const isGitRepo = await this.isGitRepository();
2813
+ if (!isGitRepo) {
2814
+ return {
2815
+ isGitRepository: false,
2816
+ currentBranch: null,
2817
+ branchInfo: null,
2818
+ canPull: false,
2819
+ canPush: false
2820
+ };
2821
+ }
2822
+ const currentBranch2 = await this.getCurrentBranch();
2823
+ if (!currentBranch2) {
2824
+ return {
2825
+ isGitRepository: true,
2826
+ currentBranch: null,
2827
+ branchInfo: null,
2828
+ canPull: false,
2829
+ canPush: false
2830
+ };
2831
+ }
2832
+ const branchInfo = await this.getBranchInfo(currentBranch2);
2833
+ return {
2834
+ isGitRepository: true,
2835
+ currentBranch: currentBranch2,
2836
+ branchInfo,
2837
+ canPull: branchInfo?.isBehind || false,
2838
+ canPush: branchInfo?.isAhead || false
2839
+ };
2840
+ } catch (error) {
2841
+ console.error("Error getting git status:", error);
2842
+ return {
2843
+ isGitRepository: false,
2844
+ currentBranch: null,
2845
+ branchInfo: null,
2846
+ canPull: false,
2847
+ canPush: false
2848
+ };
2849
+ }
2850
+ }
2851
+ /**
2852
+ * Get branch comparison information
2853
+ */
2854
+ async getBranchInfo(branchName) {
2855
+ try {
2856
+ const gitRoot = await git.findRoot({ fs: fs2, filepath: process.cwd() });
2857
+ const localCommits = await git.log({ fs: fs2, dir: gitRoot, ref: branchName });
2858
+ try {
2859
+ const remotes = await git.listRemotes({ fs: fs2, dir: gitRoot });
2860
+ for (const remote of remotes) {
2861
+ try {
2862
+ const fetchResult = await this.executeGitCommand(`git fetch ${remote.remote}`, gitRoot);
2863
+ if (!fetchResult.success) {
2864
+ console.warn(`Could not fetch from remote ${remote.remote}:`, fetchResult.error);
2865
+ }
2866
+ } catch (fetchError) {
2867
+ console.warn(`Could not fetch from remote ${remote.remote}:`, fetchError);
2868
+ }
2869
+ }
2870
+ let remoteCommits = [];
2871
+ let foundRemote = false;
2872
+ for (const remote of remotes) {
2873
+ const remoteBranchRef = `${remote.remote}/${branchName}`;
2874
+ try {
2875
+ remoteCommits = await git.log({ fs: fs2, dir: gitRoot, ref: remoteBranchRef });
2876
+ foundRemote = true;
2877
+ break;
2878
+ } catch (error) {
2879
+ console.warn(`Could not get commits for ${remoteBranchRef}: ${error}`);
2880
+ }
2881
+ }
2882
+ if (!foundRemote || remoteCommits.length === 0) {
2883
+ const lastCommit2 = localCommits[0];
2884
+ return {
2885
+ currentBranch: branchName,
2886
+ isAhead: false,
2887
+ isBehind: false,
2888
+ aheadCount: 0,
2889
+ behindCount: 0,
2890
+ lastCommitDate: lastCommit2 ? new Date(lastCommit2.commit.author.timestamp * 1e3).toISOString() : null,
2891
+ lastCommitMessage: lastCommit2?.commit.message || null,
2892
+ hasUnpushedChanges: false
2893
+ };
2894
+ }
2895
+ const localHashes = new Set(localCommits.map((c) => c.oid));
2896
+ const remoteHashes = new Set(remoteCommits.map((c) => c.oid));
2897
+ const aheadCount = localCommits.filter((c) => !remoteHashes.has(c.oid)).length;
2898
+ const behindCount = remoteCommits.filter((c) => !localHashes.has(c.oid)).length;
2899
+ const lastCommit = localCommits[0];
2900
+ return {
2901
+ currentBranch: branchName,
2902
+ isAhead: aheadCount > 0,
2903
+ isBehind: behindCount > 0,
2904
+ aheadCount,
2905
+ behindCount,
2906
+ lastCommitDate: lastCommit ? new Date(lastCommit.commit.author.timestamp * 1e3).toISOString() : null,
2907
+ lastCommitMessage: lastCommit?.commit.message || null,
2908
+ hasUnpushedChanges: aheadCount > 0
2909
+ };
2910
+ } catch {
2911
+ const lastCommit = localCommits[0];
2912
+ return {
2913
+ currentBranch: branchName,
2914
+ isAhead: false,
2915
+ isBehind: false,
2916
+ aheadCount: 0,
2917
+ behindCount: 0,
2918
+ lastCommitDate: lastCommit ? new Date(lastCommit.commit.author.timestamp * 1e3).toISOString() : null,
2919
+ lastCommitMessage: lastCommit?.commit.message || null,
2920
+ hasUnpushedChanges: false
2921
+ };
2922
+ }
2923
+ } catch (error) {
2924
+ console.error("Error getting branch info:", error);
2925
+ return null;
2926
+ }
2927
+ }
2928
+ /**
2929
+ * Fetch updates from remote repositories using native git command
2930
+ */
2931
+ async fetchFromRemotes() {
2932
+ try {
2933
+ const isGitRepo = await this.isGitRepository();
2934
+ if (!isGitRepo) {
2935
+ return { success: false, message: "Not a git repository", details: [] };
2936
+ }
2937
+ const gitRoot = await git.findRoot({ fs: fs2, filepath: process.cwd() });
2938
+ const remotes = await git.listRemotes({ fs: fs2, dir: gitRoot });
2939
+ if (remotes.length === 0) {
2940
+ return { success: true, message: "No remotes configured", details: [] };
2941
+ }
2942
+ const details = [];
2943
+ let hasErrors = false;
2944
+ for (const remote of remotes) {
2945
+ try {
2946
+ const fetchResult = await this.executeGitCommand(`git fetch ${remote.remote}`, gitRoot);
2947
+ if (fetchResult.success) {
2948
+ details.push(`Fetched from ${remote.remote}`);
2949
+ } else {
2950
+ details.push(`Failed to fetch from ${remote.remote}: ${fetchResult.error}`);
2951
+ hasErrors = true;
2952
+ }
2953
+ } catch (error) {
2954
+ details.push(`Error fetching from ${remote.remote}: ${error}`);
2955
+ hasErrors = true;
2956
+ }
2957
+ }
2958
+ return {
2959
+ success: !hasErrors,
2960
+ message: hasErrors ? "Fetch completed with some errors" : "Successfully fetched from all remotes",
2961
+ details
2962
+ };
2963
+ } catch (error) {
2964
+ console.error("Error fetching from remotes:", error);
2965
+ return {
2966
+ success: false,
2967
+ message: error instanceof Error ? error.message : "Unknown error occurred",
2968
+ details: []
2969
+ };
2970
+ }
2971
+ }
2972
+ /**
2973
+ * Pull changes from remote using native git command
2974
+ */
2975
+ async pullChanges() {
2976
+ try {
2977
+ const isGitRepo = await this.isGitRepository();
2978
+ if (!isGitRepo) {
2979
+ return { success: false, message: "Not a git repository" };
2980
+ }
2981
+ const currentBranch2 = await this.getCurrentBranch();
2982
+ if (!currentBranch2) {
2983
+ return { success: false, message: "No current branch found" };
2984
+ }
2985
+ const gitRoot = await git.findRoot({ fs: fs2, filepath: process.cwd() });
2986
+ const remotes = await git.listRemotes({ fs: fs2, dir: gitRoot });
2987
+ if (remotes.length === 0) {
2988
+ return { success: false, message: "No remotes configured" };
2989
+ }
2990
+ const targetRemote = remotes[0].remote;
2991
+ const pullCommand = `git pull ${targetRemote} ${currentBranch2}`;
2992
+ const pullResult = await this.executeGitCommand(pullCommand, gitRoot);
2993
+ if (!pullResult.success) {
2994
+ return {
2995
+ success: false,
2996
+ message: `Failed to pull changes: ${pullResult.error}`
2997
+ };
2998
+ }
2999
+ return {
3000
+ success: true,
3001
+ message: pullResult.output || "Successfully pulled changes"
3002
+ };
3003
+ } catch (error) {
3004
+ console.error("Error pulling changes:", error);
3005
+ return {
3006
+ success: false,
3007
+ message: error instanceof Error ? error.message : "Unknown error occurred"
3008
+ };
3009
+ }
3010
+ }
2771
3011
  };
2772
3012
  }
2773
3013
  });
@@ -3618,6 +3858,7 @@ var init_spreadsheetRoutes = __esm({
3618
3858
  "use strict";
3619
3859
  init_debug();
3620
3860
  init_serverState();
3861
+ init_gitHistory();
3621
3862
  MAX_HEADER_CANDIDATES = 5;
3622
3863
  PREVIEW_COLUMNS = 4;
3623
3864
  router = express.Router();
@@ -3937,6 +4178,32 @@ var init_spreadsheetRoutes = __esm({
3937
4178
  res.status(500).json({ error: "Failed to get sheet previews" });
3938
4179
  }
3939
4180
  });
4181
+ router.get("/git-status", async (req, res) => {
4182
+ try {
4183
+ const state = getServerState();
4184
+ const gitUtil = new GitHistoryUtil(state.CONTROL_SET_DIR);
4185
+ const gitStatus = await gitUtil.getGitStatus();
4186
+ res.json(gitStatus);
4187
+ } catch (error) {
4188
+ console.error("Error getting git status:", error);
4189
+ res.status(500).json({ error: "Failed to get git status" });
4190
+ }
4191
+ });
4192
+ router.post("/git-pull", async (req, res) => {
4193
+ try {
4194
+ const state = getServerState();
4195
+ const gitUtil = new GitHistoryUtil(state.CONTROL_SET_DIR);
4196
+ const result = await gitUtil.pullChanges();
4197
+ if (result.success) {
4198
+ res.json(result);
4199
+ } else {
4200
+ res.status(400).json(result);
4201
+ }
4202
+ } catch (error) {
4203
+ console.error("Error pulling changes:", error);
4204
+ res.status(500).json({ error: "Failed to pull changes" });
4205
+ }
4206
+ });
3940
4207
  spreadsheetRoutes_default = router;
3941
4208
  }
3942
4209
  });
@@ -4818,6 +5085,7 @@ import { readFileSync as readFileSync4 } from "fs";
4818
5085
  init_debug();
4819
5086
  init_controlHelpers();
4820
5087
  init_serverState();
5088
+ init_gitHistory();
4821
5089
  import * as yaml5 from "js-yaml";
4822
5090
  import { join as join5 } from "path";
4823
5091
  import { WebSocket, WebSocketServer } from "ws";
@@ -4981,8 +5249,7 @@ var WebSocketManager = class {
4981
5249
  if (!control.id) {
4982
5250
  control.id = controlId;
4983
5251
  }
4984
- const { GitHistoryUtil: GitHistoryUtil2 } = await Promise.resolve().then(() => (init_gitHistory(), gitHistory_exports));
4985
- const { execSync } = await import("child_process");
5252
+ const { execSync: execSync2 } = await import("child_process");
4986
5253
  let timeline = null;
4987
5254
  try {
4988
5255
  const currentPath2 = getCurrentControlSetPath();
@@ -5022,7 +5289,7 @@ var WebSocketManager = class {
5022
5289
  console.error(`Could not find file for control ${control.id}`);
5023
5290
  timeline = null;
5024
5291
  } else {
5025
- const gitUtil = new GitHistoryUtil2(currentPath2);
5292
+ const gitUtil = new GitHistoryUtil(currentPath2);
5026
5293
  const controlHistory = await gitUtil.getFileHistory(controlPath);
5027
5294
  debug(`Git history for ${control.id}:`, {
5028
5295
  path: controlPath,
@@ -5043,12 +5310,12 @@ var WebSocketManager = class {
5043
5310
  let hasPendingChanges = false;
5044
5311
  try {
5045
5312
  try {
5046
- execSync(`git ls-files --error-unmatch "${controlPath}"`, {
5313
+ execSync2(`git ls-files --error-unmatch "${controlPath}"`, {
5047
5314
  encoding: "utf8",
5048
5315
  cwd: process.cwd(),
5049
5316
  stdio: "pipe"
5050
5317
  });
5051
- const gitStatus = execSync(`git status --porcelain "${controlPath}"`, {
5318
+ const gitStatus = execSync2(`git status --porcelain "${controlPath}"`, {
5052
5319
  encoding: "utf8",
5053
5320
  cwd: process.cwd()
5054
5321
  }).trim();
@@ -5067,12 +5334,12 @@ var WebSocketManager = class {
5067
5334
  if (existsSync6(mappingPath)) {
5068
5335
  try {
5069
5336
  try {
5070
- execSync(`git ls-files --error-unmatch "${mappingPath}"`, {
5337
+ execSync2(`git ls-files --error-unmatch "${mappingPath}"`, {
5071
5338
  encoding: "utf8",
5072
5339
  cwd: process.cwd(),
5073
5340
  stdio: "pipe"
5074
5341
  });
5075
- const gitStatus = execSync(`git status --porcelain "${mappingPath}"`, {
5342
+ const gitStatus = execSync2(`git status --porcelain "${mappingPath}"`, {
5076
5343
  encoding: "utf8",
5077
5344
  cwd: process.cwd()
5078
5345
  }).trim();