adhdev 0.9.81-rc.1 → 0.9.81

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/index.js CHANGED
@@ -54,6 +54,14 @@ var init_repo_mesh_types = __esm({
54
54
  });
55
55
 
56
56
  // ../../oss/packages/daemon-core/src/git/git-executor.ts
57
+ var git_executor_exports = {};
58
+ __export(git_executor_exports, {
59
+ GitCommandError: () => GitCommandError,
60
+ isPathInside: () => isPathInside,
61
+ normalizeGitOutput: () => normalizeGitOutput,
62
+ resolveGitRepository: () => resolveGitRepository,
63
+ runGit: () => runGit
64
+ });
57
65
  async function resolveGitRepository(workspace, options = {}) {
58
66
  const normalizedWorkspace = await validateWorkspace(workspace);
59
67
  const result = await execGitRaw(normalizedWorkspace, ["rev-parse", "--show-toplevel"], options, {
@@ -253,12 +261,17 @@ var init_git_executor = __esm({
253
261
  // ../../oss/packages/daemon-core/src/git/git-status.ts
254
262
  async function getGitRepoStatus(workspace, options = {}) {
255
263
  const lastCheckedAt = Date.now();
264
+ const includeSubmodules = options.includeSubmodules !== false;
256
265
  try {
257
266
  const repo = await resolveGitRepository(workspace, options);
258
267
  const statusOutput = await runGit(repo, ["status", "--porcelain=v2", "--branch"], options);
259
268
  const parsed = parsePorcelainV2Status(statusOutput.stdout);
260
269
  const head = await readHead(repo, options);
261
270
  const stashCount = await readStashCount(repo, options);
271
+ let submodules;
272
+ if (includeSubmodules) {
273
+ submodules = await getSubmoduleStatuses(repo, options);
274
+ }
262
275
  return {
263
276
  workspace: repo.workspace,
264
277
  repoRoot: repo.repoRoot,
@@ -277,7 +290,8 @@ async function getGitRepoStatus(workspace, options = {}) {
277
290
  hasConflicts: parsed.conflictFiles.length > 0,
278
291
  conflictFiles: parsed.conflictFiles,
279
292
  stashCount,
280
- lastCheckedAt
293
+ lastCheckedAt,
294
+ submodules
281
295
  };
282
296
  } catch (error48) {
283
297
  if (error48 instanceof GitCommandError) {
@@ -399,6 +413,37 @@ function emptyStatus(workspace, lastCheckedAt, error48) {
399
413
  reason: error48.reason
400
414
  };
401
415
  }
416
+ async function getSubmoduleStatuses(repo, options) {
417
+ if (!repo.repoRoot) return [];
418
+ try {
419
+ const result = await runGit(repo, ["submodule", "status", "--recursive"], options);
420
+ return parseSubmoduleStatusOutput(result.stdout, repo.repoRoot, options.submoduleIgnorePaths);
421
+ } catch {
422
+ return [];
423
+ }
424
+ }
425
+ function parseSubmoduleStatusOutput(output, repoRoot, ignorePaths) {
426
+ const submodules = [];
427
+ const ignoreSet = new Set(ignorePaths || []);
428
+ for (const line of output.split("\n")) {
429
+ if (!line.trim()) continue;
430
+ const match = line.match(/^([\-+\s])([0-9a-f]{40})\s+(\S+)(?:\s+\(([^)]+)\))?/);
431
+ if (!match) continue;
432
+ const prefix = match[1];
433
+ const commit = match[2];
434
+ const path35 = match[3];
435
+ if (ignoreSet.has(path35)) continue;
436
+ submodules.push({
437
+ path: path35,
438
+ commit,
439
+ repoPath: repoRoot + "/" + path35,
440
+ dirty: prefix === "+",
441
+ outOfSync: prefix === "-",
442
+ lastCheckedAt: Date.now()
443
+ });
444
+ }
445
+ return submodules;
446
+ }
402
447
  var init_git_status = __esm({
403
448
  "../../oss/packages/daemon-core/src/git/git-status.ts"() {
404
449
  "use strict";
@@ -47235,12 +47280,25 @@ var init_router = __esm({
47235
47280
  });
47236
47281
  if (!node) return { success: false, error: "Failed to register worktree node" };
47237
47282
  }
47283
+ const initSubmodules = sourceNode.policy?.initSubmodulesOnClone !== false;
47284
+ if (initSubmodules) {
47285
+ try {
47286
+ const { runGit: runGit2 } = await Promise.resolve().then(() => (init_git_executor(), git_executor_exports));
47287
+ await runGit2(
47288
+ { workspace: result.worktreePath, repoRoot: result.worktreePath, isGitRepo: true },
47289
+ ["submodule", "update", "--init", "--recursive"],
47290
+ { timeoutMs: 12e4 }
47291
+ );
47292
+ } catch (subErr) {
47293
+ console.warn("[mesh] Submodule init failed for worktree:", subErr.message);
47294
+ }
47295
+ }
47238
47296
  try {
47239
47297
  const { appendLedgerEntry: appendLedgerEntry2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
47240
47298
  appendLedgerEntry2(meshId, {
47241
47299
  kind: "node_cloned",
47242
47300
  nodeId: node.id,
47243
- payload: { sourceNodeId, branch: result.branch, worktreePath: result.worktreePath }
47301
+ payload: { sourceNodeId, branch: result.branch, worktreePath: result.worktreePath, submodulesInitialized: initSubmodules }
47244
47302
  });
47245
47303
  } catch {
47246
47304
  }
@@ -66464,7 +66522,7 @@ var init_adhdev_daemon = __esm({
66464
66522
  init_version();
66465
66523
  init_src();
66466
66524
  init_runtime_defaults();
66467
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.81-rc.1" });
66525
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.81" });
66468
66526
  AdhdevDaemon = class _AdhdevDaemon {
66469
66527
  localHttpServer = null;
66470
66528
  localWss = null;