@ibgib/vcs-gib 0.0.32 → 0.0.33

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 (132) hide show
  1. package/dist/AUTO-GENERATED-version.d.mts +1 -1
  2. package/dist/AUTO-GENERATED-version.mjs +1 -1
  3. package/dist/bootstrap/node-bootstrap.d.mts.map +1 -1
  4. package/dist/bootstrap/node-bootstrap.mjs +6 -20
  5. package/dist/bootstrap/node-bootstrap.mjs.map +1 -1
  6. package/dist/cli/commands/{add-cmd.d.mts → cli-add-cmd.d.mts} +1 -1
  7. package/dist/cli/commands/cli-add-cmd.d.mts.map +1 -0
  8. package/dist/cli/commands/cli-add-cmd.mjs +45 -0
  9. package/dist/cli/commands/cli-add-cmd.mjs.map +1 -0
  10. package/dist/cli/commands/{branch-cmd.d.mts → cli-branch-cmd.d.mts} +1 -1
  11. package/dist/cli/commands/cli-branch-cmd.d.mts.map +1 -0
  12. package/dist/cli/commands/cli-branch-cmd.mjs +59 -0
  13. package/dist/cli/commands/cli-branch-cmd.mjs.map +1 -0
  14. package/dist/cli/commands/{checkout-cmd.d.mts → cli-checkout-cmd.d.mts} +4 -3
  15. package/dist/cli/commands/cli-checkout-cmd.d.mts.map +1 -0
  16. package/dist/cli/commands/cli-checkout-cmd.mjs +50 -0
  17. package/dist/cli/commands/cli-checkout-cmd.mjs.map +1 -0
  18. package/dist/cli/commands/{commit-cmd.d.mts → cli-commit-cmd.d.mts} +1 -1
  19. package/dist/cli/commands/cli-commit-cmd.d.mts.map +1 -0
  20. package/dist/cli/commands/cli-commit-cmd.mjs +52 -0
  21. package/dist/cli/commands/cli-commit-cmd.mjs.map +1 -0
  22. package/dist/cli/commands/{generate-comment-cmd.d.mts → cli-generate-comment-cmd.d.mts} +1 -1
  23. package/dist/cli/commands/cli-generate-comment-cmd.d.mts.map +1 -0
  24. package/dist/cli/commands/{generate-comment-cmd.mjs → cli-generate-comment-cmd.mjs} +8 -6
  25. package/dist/cli/commands/cli-generate-comment-cmd.mjs.map +1 -0
  26. package/dist/cli/commands/{init-cmd.d.mts → cli-init-cmd.d.mts} +1 -1
  27. package/dist/cli/commands/cli-init-cmd.d.mts.map +1 -0
  28. package/dist/cli/commands/cli-init-cmd.mjs +47 -0
  29. package/dist/cli/commands/cli-init-cmd.mjs.map +1 -0
  30. package/dist/cli/commands/{log-cmd.d.mts → cli-log-cmd.d.mts} +1 -1
  31. package/dist/cli/commands/cli-log-cmd.d.mts.map +1 -0
  32. package/dist/cli/commands/{log-cmd.mjs → cli-log-cmd.mjs} +14 -44
  33. package/dist/cli/commands/cli-log-cmd.mjs.map +1 -0
  34. package/dist/cli/commands/{merge-cmd.d.mts → cli-merge-cmd.d.mts} +1 -1
  35. package/dist/cli/commands/cli-merge-cmd.d.mts.map +1 -0
  36. package/dist/cli/commands/cli-merge-cmd.mjs +66 -0
  37. package/dist/cli/commands/cli-merge-cmd.mjs.map +1 -0
  38. package/dist/cli/commands/{reset-cmd.d.mts → cli-reset-cmd.d.mts} +1 -1
  39. package/dist/cli/commands/cli-reset-cmd.d.mts.map +1 -0
  40. package/dist/cli/commands/cli-reset-cmd.mjs +63 -0
  41. package/dist/cli/commands/cli-reset-cmd.mjs.map +1 -0
  42. package/dist/cli/commands/{restore-cmd.d.mts → cli-restore-cmd.d.mts} +1 -1
  43. package/dist/cli/commands/cli-restore-cmd.d.mts.map +1 -0
  44. package/dist/cli/commands/cli-restore-cmd.mjs +55 -0
  45. package/dist/cli/commands/cli-restore-cmd.mjs.map +1 -0
  46. package/dist/cli/commands/{status-cmd.d.mts → cli-status-cmd.d.mts} +1 -1
  47. package/dist/cli/commands/cli-status-cmd.d.mts.map +1 -0
  48. package/dist/cli/commands/{status-cmd.mjs → cli-status-cmd.mjs} +4 -41
  49. package/dist/cli/commands/cli-status-cmd.mjs.map +1 -0
  50. package/dist/cli/vcs-cli-main.d.mts.map +1 -1
  51. package/dist/cli/vcs-cli-main.mjs +18 -15
  52. package/dist/cli/vcs-cli-main.mjs.map +1 -1
  53. package/dist/cli/vcs-projection-helper.mjs +7 -7
  54. package/dist/cli/vcs-projection-helper.mjs.map +1 -1
  55. package/dist/cli/vcs-repo-helper.d.mts +19 -0
  56. package/dist/cli/vcs-repo-helper.d.mts.map +1 -0
  57. package/dist/cli/vcs-repo-helper.mjs +74 -0
  58. package/dist/cli/vcs-repo-helper.mjs.map +1 -0
  59. package/dist/test/test-helpers.d.mts +9 -0
  60. package/dist/test/test-helpers.d.mts.map +1 -1
  61. package/dist/test/test-helpers.mjs +35 -0
  62. package/dist/test/test-helpers.mjs.map +1 -1
  63. package/package.json +6 -6
  64. package/src/AUTO-GENERATED-version.mts +1 -1
  65. package/src/bootstrap/node-bootstrap.mts +6 -20
  66. package/src/bootstrap/node-bootstrap.respec.mts +2 -2
  67. package/src/cli/cli-arg-parser.respec.mts +2 -2
  68. package/src/cli/cli-e2e.respec.mts +8 -8
  69. package/src/cli/commands/branch-checkout-cmd.respec.mts +426 -412
  70. package/src/cli/commands/cli-add-cmd.mts +65 -0
  71. package/src/cli/commands/cli-branch-cmd.mts +87 -0
  72. package/src/cli/commands/cli-checkout-cmd.mts +72 -0
  73. package/src/cli/commands/cli-commit-cmd.mts +77 -0
  74. package/src/cli/commands/{generate-comment-cmd.mts → cli-generate-comment-cmd.mts} +8 -6
  75. package/src/cli/commands/cli-init-cmd.mts +78 -0
  76. package/src/cli/commands/{log-cmd.mts → cli-log-cmd.mts} +14 -47
  77. package/src/cli/commands/cli-merge-cmd.mts +99 -0
  78. package/src/cli/commands/cli-reset-cmd.mts +94 -0
  79. package/src/cli/commands/cli-restore-cmd.mts +87 -0
  80. package/src/cli/commands/{status-cmd.mts → cli-status-cmd.mts} +3 -45
  81. package/src/cli/commands/commit-log-cmd.respec.mts +82 -29
  82. package/src/cli/commands/init-cmd.respec.mts +3 -3
  83. package/src/cli/commands/reset-restore-cmd.respec.mts +9 -9
  84. package/src/cli/commands/status-add-cmd.respec.mts +20 -16
  85. package/src/cli/vcs-cli-main.mts +18 -15
  86. package/src/cli/vcs-projection-helper.mts +8 -8
  87. package/src/cli/vcs-repo-helper.mts +99 -0
  88. package/src/engine/branch/branch-space.respec.mts +22 -20
  89. package/src/engine/merge/b2tfs-sync-comments.respec.mts +10 -10
  90. package/src/test/test-helpers.mts +49 -1
  91. package/src/vcs-gib.respec.mts +21 -15
  92. package/tsconfig.test.tsbuildinfo +1 -1
  93. package/tsconfig.tsbuildinfo +1 -1
  94. package/vcs-gib_test_output.md +58 -0
  95. package/dist/cli/commands/add-cmd.d.mts.map +0 -1
  96. package/dist/cli/commands/add-cmd.mjs +0 -93
  97. package/dist/cli/commands/add-cmd.mjs.map +0 -1
  98. package/dist/cli/commands/branch-cmd.d.mts.map +0 -1
  99. package/dist/cli/commands/branch-cmd.mjs +0 -107
  100. package/dist/cli/commands/branch-cmd.mjs.map +0 -1
  101. package/dist/cli/commands/checkout-cmd.d.mts.map +0 -1
  102. package/dist/cli/commands/checkout-cmd.mjs +0 -95
  103. package/dist/cli/commands/checkout-cmd.mjs.map +0 -1
  104. package/dist/cli/commands/commit-cmd.d.mts.map +0 -1
  105. package/dist/cli/commands/commit-cmd.mjs +0 -99
  106. package/dist/cli/commands/commit-cmd.mjs.map +0 -1
  107. package/dist/cli/commands/generate-comment-cmd.d.mts.map +0 -1
  108. package/dist/cli/commands/generate-comment-cmd.mjs.map +0 -1
  109. package/dist/cli/commands/init-cmd.d.mts.map +0 -1
  110. package/dist/cli/commands/init-cmd.mjs +0 -69
  111. package/dist/cli/commands/init-cmd.mjs.map +0 -1
  112. package/dist/cli/commands/log-cmd.d.mts.map +0 -1
  113. package/dist/cli/commands/log-cmd.mjs.map +0 -1
  114. package/dist/cli/commands/merge-cmd.d.mts.map +0 -1
  115. package/dist/cli/commands/merge-cmd.mjs +0 -106
  116. package/dist/cli/commands/merge-cmd.mjs.map +0 -1
  117. package/dist/cli/commands/reset-cmd.d.mts.map +0 -1
  118. package/dist/cli/commands/reset-cmd.mjs +0 -91
  119. package/dist/cli/commands/reset-cmd.mjs.map +0 -1
  120. package/dist/cli/commands/restore-cmd.d.mts.map +0 -1
  121. package/dist/cli/commands/restore-cmd.mjs +0 -97
  122. package/dist/cli/commands/restore-cmd.mjs.map +0 -1
  123. package/dist/cli/commands/status-cmd.d.mts.map +0 -1
  124. package/dist/cli/commands/status-cmd.mjs.map +0 -1
  125. package/src/cli/commands/add-cmd.mts +0 -120
  126. package/src/cli/commands/branch-cmd.mts +0 -142
  127. package/src/cli/commands/checkout-cmd.mts +0 -123
  128. package/src/cli/commands/commit-cmd.mts +0 -130
  129. package/src/cli/commands/init-cmd.mts +0 -99
  130. package/src/cli/commands/merge-cmd.mts +0 -143
  131. package/src/cli/commands/reset-cmd.mts +0 -126
  132. package/src/cli/commands/restore-cmd.mts +0 -135
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @module vcs-projection-helper
3
- *
3
+ *
4
4
  * CLI-specific filesystem projection helpers for reading and writing `.vcsgib/vcs_index_projection.json`.
5
5
  * Strictly housed in `apps/vcs-gib` CLI layer to maintain pure isolation from `core-gib`.
6
6
  */
@@ -31,7 +31,7 @@ export async function readVcsIndexProjectionFromDisk({
31
31
  const lc = `${lcFile}[${readVcsIndexProjectionFromDisk.name}]`;
32
32
  try {
33
33
  if (logalot) {
34
- console.log(`${lc} starting... (I: 7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b)`);
34
+ console.log(`${lc} starting... (I: genuuid)`);
35
35
  }
36
36
 
37
37
  if (!vcsPath) {
@@ -60,11 +60,11 @@ export async function readVcsIndexProjectionFromDisk({
60
60
  const indexIbGib = ibgibs?.at(0) as B2tFSIndexIbGib_V1;
61
61
  return indexIbGib;
62
62
  } catch (error) {
63
- console.error(`${lc} ${extractErrorMsg(error)} (E: 8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c)`);
63
+ console.error(`${lc} ${extractErrorMsg(error)} (E: genuuid)`);
64
64
  throw error;
65
65
  } finally {
66
66
  if (logalot) {
67
- console.log(`${lc} complete. (I: 9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d)`);
67
+ console.log(`${lc} complete. (I: genuuid)`);
68
68
  }
69
69
  }
70
70
  }
@@ -82,7 +82,7 @@ export async function writeVcsIndexProjectionToDisk({
82
82
  const lc = `${lcFile}[${writeVcsIndexProjectionToDisk.name}]`;
83
83
  try {
84
84
  if (logalot) {
85
- console.log(`${lc} starting... (I: 3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b)`);
85
+ console.log(`${lc} starting... (I: 06da189dd09843652865d2c82e415826)`);
86
86
  }
87
87
 
88
88
  await fs.mkdir(vcsPath, { recursive: true });
@@ -93,7 +93,7 @@ export async function writeVcsIndexProjectionToDisk({
93
93
  _comment: 'STRICTLY READ-ONLY PROJECTION GENERATED FROM B2TFSINDEXIBGIB_V1 IN LOCALSPACE',
94
94
  indexAddr,
95
95
  spaceId: indexIbGib.data?.mySpaceId,
96
- activeBranch: indexIbGib.data?.activeBranch || 'main',
96
+ activeBranchName: indexIbGib.data?.activeBranchName || 'main',
97
97
  stagedCount: (indexIbGib.data?.staged_item || []).length,
98
98
  stagedPaths: indexIbGib.data?.stagedPaths || {},
99
99
  updatedAt: new Date().toISOString(),
@@ -102,11 +102,11 @@ export async function writeVcsIndexProjectionToDisk({
102
102
  const projFile = path.join(vcsPath, 'vcs_index_projection.json');
103
103
  await fs.writeFile(projFile, JSON.stringify(projectionObj, null, 2), 'utf8');
104
104
  } catch (error) {
105
- console.error(`${lc} ${extractErrorMsg(error)} (E: 4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c)`);
105
+ console.error(`${lc} ${extractErrorMsg(error)} (E: genuuid)`);
106
106
  throw error;
107
107
  } finally {
108
108
  if (logalot) {
109
- console.log(`${lc} complete. (I: 5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d)`);
109
+ console.log(`${lc} complete. (I: genuuid)`);
110
110
  }
111
111
  }
112
112
  }
@@ -0,0 +1,99 @@
1
+ /**
2
+ * @module vcs-repo-helper
3
+ *
4
+ * Helper to bootstrap Node environment and open a VcsRepository session.
5
+ */
6
+
7
+ import path from 'node:path';
8
+ import fs from 'node:fs/promises';
9
+
10
+ import { extractErrorMsg } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
11
+ import { VcsRepository } from '@ibgib/core-gib/dist/vcs/vcs-repository.mjs';
12
+ import { resolveContextualBranchName } from '@ibgib/core-gib/dist/vcs/branch/branch-helper.mjs';
13
+ import { getB2tFSIndexIbGib } from '@ibgib/core-gib/dist/vcs/index/index-helper.mjs';
14
+ import { getOrCreateBranchSpace } from '@ibgib/core-gib/dist/vcs/branch/branch-helper.mjs';
15
+ import { getOrCreateWorkspaceProjectionSpace } from '@ibgib/node-gib/dist/vcs/workspace-space-helper.mjs';
16
+
17
+ import { GLOBAL_LOG_A_LOT } from '../vcs-gib-constants.mjs';
18
+ import { bootstrapVcsMetaspace } from '../bootstrap/node-bootstrap.mjs';
19
+ import { B2TFS_BRANCH_DEFAULT_NAME } from '@ibgib/core-gib/dist/vcs/branch/branch-constants.mjs';
20
+
21
+ const logalot = GLOBAL_LOG_A_LOT;
22
+
23
+ export interface OpenVcsRepositoryOpts {
24
+ targetDir?: string;
25
+ vcsFolderName?: string;
26
+ branchName?: string;
27
+ }
28
+
29
+ export interface OpenVcsRepositoryResult {
30
+ repo: VcsRepository;
31
+ repoRoot: string;
32
+ vcsPath: string;
33
+ activeWorktreeDir: string;
34
+ }
35
+
36
+ export async function openVcsRepository({
37
+ targetDir = process.cwd(),
38
+ vcsFolderName = '.vcsgib',
39
+ branchName,
40
+ }: OpenVcsRepositoryOpts = {}): Promise<OpenVcsRepositoryResult> {
41
+ const lc = `[${openVcsRepository.name}]`;
42
+ try {
43
+ if (logalot) { console.log(`${lc} starting... (I: 4a621eb5576a3064f85177c6de80a826)`); }
44
+
45
+ const absTargetDir = path.resolve(targetDir);
46
+
47
+ // 1. Locate repository root and bootstrap Node localSpace
48
+ const { metaspace, localSpace, vcsPath, repoRoot } = await bootstrapVcsMetaspace({
49
+ repoPath: absTargetDir,
50
+ vcsFolderName,
51
+ });
52
+
53
+ // 2. Fetch authoritative in-band index from localSpace
54
+ const indexIbGib = await getB2tFSIndexIbGib({ space: localSpace, metaspace });
55
+ if (!indexIbGib) {
56
+ throw new Error(`Not an ibgib repository (index not found in ${vcsPath})`);
57
+ }
58
+
59
+ // 3. Determine active branch and worktree directory
60
+ const activeBranchName = branchName || resolveContextualBranchName({
61
+ targetDir: absTargetDir,
62
+ repoRoot,
63
+ indexIbGib,
64
+ });
65
+
66
+ const activeWorktreeDir = activeBranchName === B2TFS_BRANCH_DEFAULT_NAME
67
+ ? repoRoot
68
+ : path.join(repoRoot, 'b', activeBranchName);
69
+
70
+ // 4. Resolve branch space & create Node workspace projection space
71
+ const { space: activeSpace } = await getOrCreateBranchSpace({
72
+ metaspace,
73
+ branchName: activeBranchName,
74
+ });
75
+
76
+ const { space: workspaceSpace } = await getOrCreateWorkspaceProjectionSpace({
77
+ metaspace,
78
+ workspaceRoot: activeWorktreeDir,
79
+ vcsFolderName,
80
+ backingSpace: activeSpace,
81
+ });
82
+
83
+ // 5. Construct domain facade
84
+ const repo = new VcsRepository({
85
+ metaspace,
86
+ localSpace,
87
+ workspaceSpace,
88
+ repoRoot,
89
+ vcsFolderName,
90
+ });
91
+
92
+ return { repo, repoRoot, activeWorktreeDir, vcsPath };
93
+ } catch (error) {
94
+ console.error(`${lc} ${extractErrorMsg(error)}`);
95
+ throw error;
96
+ } finally {
97
+ if (logalot) { console.log(`${lc} complete.`); }
98
+ }
99
+ }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @module branch-space.respec.node
3
- *
3
+ *
4
4
  * Unit tests for branch space helper, space-qualified address formatting/parsing,
5
5
  * and graph population into branch spaces.
6
6
  */
@@ -8,44 +8,49 @@
8
8
  import path from 'node:path';
9
9
  import fs from 'node:fs/promises';
10
10
 
11
- import {
12
- respecfully, ifWe, iReckon
13
- } from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
11
+ import { respecfully, ifWe, iReckon } from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
12
+
14
13
  import { ROOT } from '@ibgib/ts-gib/dist/V1/constants.mjs';
15
14
  import { Factory_V1 } from '@ibgib/ts-gib/dist/V1/factory.mjs';
16
15
  import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
17
16
  import { getFromSpace, persistTransformResult } from '@ibgib/core-gib/dist/witness/space/space-helper.mjs';
18
-
19
- import { bootstrapVcsMetaspace } from '../../bootstrap/node-bootstrap.mjs';
20
17
  import { getB2tFSItemIb } from '@ibgib/core-gib/dist/vcs/item/item-atom-helper.mjs';
21
- import { getOrCreateBranchSpace } from '@ibgib/node-gib/dist/vcs/branch-space-helper.mjs';
22
18
  import { populateBranchSpaceFromGraph } from '@ibgib/core-gib/dist/vcs/branch/branch-graph-helper.mjs';
23
- import { getSpaceQualifiedIbGibAddr, parseSpaceQualifiedIbGibAddr } from '@ibgib/core-gib/dist/vcs/index/index-helper.mjs';
24
19
  import { B2tFSItemIbGib_V1 } from '@ibgib/core-gib/dist/vcs/item/item-types.mjs';
20
+ import { getOrCreateBranchSpace } from '@ibgib/core-gib/dist/vcs/branch/branch-helper.mjs';
21
+ import { getSpaceQualifiedIbGibAddr, parseSpaceQualifiedIbGibAddr, isSpaceQualifiedAddr } from '@ibgib/core-gib/dist/common/other/ibgib-helper.mjs';
25
22
 
26
- const lc = `[apps/vcs-gib/src/engine/branch/branch-space.respec.node.mts]`;
23
+ import { bootstrapVcsMetaspace } from '../../bootstrap/node-bootstrap.mjs';
24
+
25
+ const lc = `[apps/vcs-gib/src/engine/branch/branch-space.respec.mts]`;
27
26
 
28
27
  await respecfully(lc, `Branch Space & Graph Helper Respecs`, async () => {
29
28
 
30
29
  await respecfully(lc, `Space-Qualified Address Parsing & Formatting`, async () => {
31
30
  await ifWe(lc, `formats space-qualified address using options object`, async () => {
32
- const sq = getSpaceQualifiedIbGibAddr({ spaceId: 'sp_alpha', ibGibAddr: 'item_a^gib123' });
33
- iReckon(lc, sq).willEqual('v:1^spaceId:sp_alpha^item_a^gib123');
31
+ const sq = getSpaceQualifiedIbGibAddr({ spaceId: 'sp_alpha', ibGibAddr: 'item_a^gib' });
32
+ iReckon(lc, sq).willEqual('v:1^spaceId:sp_alpha^item_a^gib');
34
33
  });
35
34
 
36
35
  await ifWe(lc, `parses space-qualified address using options object`, async () => {
37
- const parsed = parseSpaceQualifiedIbGibAddr({ spaceQualifiedAddr: 'v:1^spaceId:sp_alpha^item_a^gib123' });
36
+ const parsed = parseSpaceQualifiedIbGibAddr({ sqAddr: 'v:1^spaceId:sp_alpha^item_a^gib' });
38
37
  iReckon(lc, parsed).isGonnaBeTruthy();
39
38
  iReckon(lc, parsed!.version).willEqual(1);
40
39
  iReckon(lc, parsed!.spaceId).willEqual('sp_alpha');
41
- iReckon(lc, parsed!.ibGibAddr).willEqual('item_a^gib123');
40
+ iReckon(lc, parsed!.ibGibAddr).willEqual('item_a^gib');
42
41
  iReckon(lc, parsed!.ib).willEqual('item_a');
43
- iReckon(lc, parsed!.gib).willEqual('gib123');
42
+ iReckon(lc, parsed!.gib).willEqual('gib');
44
43
  });
45
44
 
46
- await ifWe(lc, `returns null for invalid space-qualified address string`, async () => {
47
- const parsed = parseSpaceQualifiedIbGibAddr({ spaceQualifiedAddr: 'invalid_address_string' });
48
- iReckon(lc, parsed).isGonnaBeFalsy();
45
+ await ifWe(lc, `throws for invalid space-qualified address string`, async () => {
46
+ let threw = false;
47
+ try {
48
+ parseSpaceQualifiedIbGibAddr({ sqAddr: 'invalid_address_string' });
49
+ } catch {
50
+ threw = true;
51
+ }
52
+ iReckon(lc, threw).isGonnaBeTrue();
53
+ iReckon(lc, isSpaceQualifiedAddr('invalid_address_string')).isGonnaBeFalse();
49
54
  });
50
55
  });
51
56
 
@@ -62,7 +67,6 @@ await respecfully(lc, `Branch Space & Graph Helper Respecs`, async () => {
62
67
  const branchName = 'feature_alpha';
63
68
  const result1 = await getOrCreateBranchSpace({
64
69
  metaspace,
65
- vcsPath,
66
70
  branchName,
67
71
  });
68
72
 
@@ -72,7 +76,6 @@ await respecfully(lc, `Branch Space & Graph Helper Respecs`, async () => {
72
76
 
73
77
  const result2 = await getOrCreateBranchSpace({
74
78
  metaspace,
75
- vcsPath,
76
79
  branchName,
77
80
  });
78
81
 
@@ -132,7 +135,6 @@ await respecfully(lc, `Branch Space & Graph Helper Respecs`, async () => {
132
135
  // Create target branch space
133
136
  const { space: targetBranchSpace } = await getOrCreateBranchSpace({
134
137
  metaspace,
135
- vcsPath,
136
138
  branchName: 'main',
137
139
  });
138
140
 
@@ -25,14 +25,14 @@ import { createCommentIbGib } from '@ibgib/core-gib/dist/common/comment/comment-
25
25
  import { getBinIb } from '@ibgib/core-gib/dist/common/other/ibgib-helper.mjs';
26
26
  import { BinIbGib_V1 } from '@ibgib/core-gib/dist/common/bin/bin-types.mjs';
27
27
  import { putInSpace, persistTransformResult, registerNewIbGib, getFromSpace, getLatestAddrs } from '@ibgib/core-gib/dist/witness/space/space-helper.mjs';
28
-
29
- import { bootstrapVcsMetaspace } from '../../bootstrap/node-bootstrap.mjs';
30
- import { getOrCreateBranchSpace } from '@ibgib/node-gib/dist/vcs/branch-space-helper.mjs';
31
28
  import { createB2tFSItemIbGib, evolveB2tFSItemIbGib } from '@ibgib/core-gib/dist/vcs/item/item-helper.mjs';
32
29
  import { B2tFSItemIbGib_V1, BINARY_REL8N_NAME } from '@ibgib/core-gib/dist/vcs/item/item-types.mjs';
33
30
  import { B2tFS3WayGraftStrategy } from '@ibgib/core-gib/dist/vcs/merge/b2tfs-3way-graft-strategy.mjs';
31
+ import { getOrCreateBranchSpace } from '@ibgib/core-gib/dist/vcs/branch/branch-helper.mjs';
32
+
33
+ import { bootstrapVcsMetaspace } from '../../bootstrap/node-bootstrap.mjs';
34
34
 
35
- const lc = `[apps/vcs-gib/src/engine/merge/b2tfs-sync-comments.respec.node.mts]`;
35
+ const lc = `[apps/vcs-gib/src/engine/merge/b2tfs-sync-comments.respec.mts]`;
36
36
  const graftStrategySvc = GraftStrategyService.instance;
37
37
 
38
38
  async function createFileWithBinAndComment({
@@ -149,8 +149,8 @@ await respecfully(lc, `B2tFS Item & Comment Sync Graph Integrity`, async () => {
149
149
  repoPath: testDir,
150
150
  vcsFolderName,
151
151
  });
152
- const { space: spaceA } = await getOrCreateBranchSpace({ metaspace, vcsPath, branchName: 'branch_a' });
153
- const { space: spaceB } = await getOrCreateBranchSpace({ metaspace, vcsPath, branchName: 'branch_b' });
152
+ const { space: spaceA } = await getOrCreateBranchSpace({ metaspace, branchName: 'branch_a' });
153
+ const { space: spaceB } = await getOrCreateBranchSpace({ metaspace, branchName: 'branch_b' });
154
154
 
155
155
  // 1. Create file item with comment in Space A
156
156
  const { fileItem } = await createFileWithBinAndComment({
@@ -208,8 +208,8 @@ await respecfully(lc, `B2tFS Item & Comment Sync Graph Integrity`, async () => {
208
208
  repoPath: testDir,
209
209
  vcsFolderName,
210
210
  });
211
- const { space: spaceA } = await getOrCreateBranchSpace({ metaspace, vcsPath, branchName: 'branch_a' });
212
- const { space: spaceB } = await getOrCreateBranchSpace({ metaspace, vcsPath, branchName: 'branch_b' });
211
+ const { space: spaceA } = await getOrCreateBranchSpace({ metaspace, branchName: 'branch_a' });
212
+ const { space: spaceB } = await getOrCreateBranchSpace({ metaspace, branchName: 'branch_b' });
213
213
 
214
214
  // 1. Create file with comment 1 in Space A
215
215
  const { fileItem: fileItemA1 } = await createFileWithBinAndComment({
@@ -299,8 +299,8 @@ await respecfully(lc, `B2tFS Item & Comment Sync Graph Integrity`, async () => {
299
299
  repoPath: testDir,
300
300
  vcsFolderName,
301
301
  });
302
- const { space: spaceA } = await getOrCreateBranchSpace({ metaspace, vcsPath, branchName: 'branch_a' });
303
- const { space: spaceB } = await getOrCreateBranchSpace({ metaspace, vcsPath, branchName: 'branch_b' });
302
+ const { space: spaceA } = await getOrCreateBranchSpace({ metaspace, branchName: 'branch_a' });
303
+ const { space: spaceB } = await getOrCreateBranchSpace({ metaspace, branchName: 'branch_b' });
304
304
 
305
305
  // 1. Initial base file in Space A
306
306
  const { fileItem: lcaFile } = await createFileWithBinAndComment({
@@ -21,7 +21,8 @@ import { getLatestAddrs } from '@ibgib/core-gib/dist/witness/space/space-helper.
21
21
  import { IbGibSpaceAny } from '@ibgib/core-gib/dist/witness/space/space-base-v1.mjs';
22
22
 
23
23
  import { B2tFSBranchIbGib_V1 } from '@ibgib/core-gib/dist/vcs/branch/branch-types.mjs';
24
- import { B2tFSItemIbGib_V1 } from '@ibgib/core-gib/dist/vcs/item/item-types.mjs';
24
+ import { B2tFSItemIbGib_V1, B2TFS_CHILD_ITEM_REL8N_NAME } from '@ibgib/core-gib/dist/vcs/item/item-types.mjs';
25
+ import { getIbGibFromSpace } from '@ibgib/core-gib/dist/common/other/ibgib-helper.mjs';
25
26
 
26
27
 
27
28
  // ─────────────────────────────────────────────────────────────────────────────
@@ -166,3 +167,50 @@ export function logAddr(label: string, addr: IbGibAddr | undefined): void {
166
167
  export function logAddrs(label: string, addrs: IbGibAddr[] | undefined): void {
167
168
  console.log(`[ADDRS][${label}]: ${shortAddrs(addrs)}`);
168
169
  }
170
+
171
+ /**
172
+ * Recursively logs the b2tfs item hierarchy from a rootItemAddr within a space.
173
+ */
174
+ export async function logTreeHierarchy({
175
+ label,
176
+ rootItemAddr,
177
+ space,
178
+ metaspace,
179
+ }: {
180
+ label: string;
181
+ rootItemAddr?: string;
182
+ space: any;
183
+ metaspace?: any;
184
+ }): Promise<void> {
185
+ const lc = `[TRACE_B2TFS][${label}]`;
186
+ const spaceName = space?.data?.name || space?.data?.spaceSubPath || space?.ib || 'unknown';
187
+ console.log(`${lc} === Hierarchy for root: ${shortAddr(rootItemAddr)} in space: ${spaceName} ===`);
188
+ if (!rootItemAddr) {
189
+ console.log(`${lc} rootItemAddr is falsy`);
190
+ return;
191
+ }
192
+
193
+ async function walk(addr: string, depth: number, currentPath: string): Promise<void> {
194
+ const indent = ' '.repeat(depth);
195
+ const item = await getIbGibFromSpace({ addr, space, metaspace }) as B2tFSItemIbGib_V1;
196
+ if (!item) {
197
+ console.log(`${lc}${indent} ❌ MISSING item at ${shortAddr(addr)} (path: ${currentPath})`);
198
+ return;
199
+ }
200
+ const name = item.data?.name || '(root)';
201
+ const fsType = item.data?.fsType || 'unknown';
202
+ const comments = item.rel8ns?.comment || [];
203
+ const children = item.rel8ns?.[B2TFS_CHILD_ITEM_REL8N_NAME] || [];
204
+ console.log(`${lc}${indent} 📁 ${name} (${fsType}) addr: ${shortAddr(addr)} comments: ${comments.length} children: ${children.length}`);
205
+ for (const cAddr of comments) {
206
+ const comment = await getIbGibFromSpace({ addr: cAddr, space, metaspace });
207
+ console.log(`${lc}${indent} 💬 comment: "${(comment?.data as any)?.text?.slice(0, 50)}"`);
208
+ }
209
+ for (const childAddr of children) {
210
+ await walk(childAddr, depth + 1, currentPath ? `${currentPath}/${name}` : name);
211
+ }
212
+ }
213
+
214
+ await walk(rootItemAddr, 1, '');
215
+ }
216
+
@@ -11,19 +11,17 @@ import fs from 'node:fs/promises';
11
11
  import { respecfully, ifWe, iReckon } from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
12
12
  import { ROOT } from '@ibgib/ts-gib/dist/V1/constants.mjs';
13
13
  import { Factory_V1 } from '@ibgib/ts-gib/dist/V1/factory.mjs';
14
+ import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
14
15
  import { getB2tFSItemIb } from '@ibgib/core-gib/dist/vcs/item/item-atom-helper.mjs';
15
- import {
16
- createB2tFSBranchIbGib, getB2tFSBranchSpaceName
17
- } from '@ibgib/core-gib/dist/vcs/branch/branch-helper.mjs';
18
- import {
19
- createB2tFSIndexIbGib, getSpaceQualifiedIbGibAddr,
20
- parseSpaceQualifiedIbGibAddr
21
- } from '@ibgib/core-gib/dist/vcs/index/index-helper.mjs';
16
+ import { createB2tFSBranchIbGib, getB2tFSBranchSpaceName } from '@ibgib/core-gib/dist/vcs/branch/branch-helper.mjs';
17
+ import { createB2tFSIndexIbGib, } from '@ibgib/core-gib/dist/vcs/index/index-helper.mjs';
22
18
  import { B2tFSItemIbGib_V1 } from '@ibgib/core-gib/dist/vcs/item/item-types.mjs';
19
+ import { getSpaceQualifiedIbGibAddr, parseSpaceQualifiedIbGibAddr } from '@ibgib/core-gib/dist/common/other/ibgib-helper.mjs';
20
+ import { getSpaceIdFromIb } from '@ibgib/core-gib/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.mjs';
23
21
 
24
22
  import { bootstrapVcsMetaspace } from './bootstrap/node-bootstrap.mjs';
25
23
 
26
- const lc = `[apps/vcs-gib/src/vcs-gib.respec.node.mts]`;
24
+ const lc = `[apps/vcs-gib/src/vcs-gib.respec.mts]`;
27
25
 
28
26
  await respecfully(lc, `vcs-gib Full Engine Cycle`, async () => {
29
27
 
@@ -36,12 +34,12 @@ await respecfully(lc, `vcs-gib Full Engine Cycle`, async () => {
36
34
 
37
35
  await respecfully(lc, `Space-Qualified Addresses`, async () => {
38
36
  await ifWe(lc, `formats and parses space-qualified addresses`, async () => {
39
- const sq = getSpaceQualifiedIbGibAddr('space_a', 'item^gib123');
40
- iReckon(lc, sq).willEqual('v:1^spaceId:space_a^item^gib123');
37
+ const sqAddr = getSpaceQualifiedIbGibAddr({ spaceId: 'space_a', ibGibAddr: 'item^gib' });
38
+ iReckon(lc, sqAddr).willEqual('v:1^spaceId:space_a^item^gib');
41
39
 
42
- const parsed = parseSpaceQualifiedIbGibAddr(sq);
40
+ const parsed = parseSpaceQualifiedIbGibAddr({ sqAddr });
43
41
  iReckon(lc, parsed?.spaceId).willEqual('space_a');
44
- iReckon(lc, parsed?.ibGibAddr).willEqual('item^gib123');
42
+ iReckon(lc, parsed?.ibGibAddr).willEqual('item^gib');
45
43
  });
46
44
  });
47
45
 
@@ -80,15 +78,23 @@ await respecfully(lc, `vcs-gib Full Engine Cycle`, async () => {
80
78
  metaspace,
81
79
  });
82
80
  iReckon(lc, branchIbGib.data?.name).willEqual('main');
81
+ const branchAddr = getIbGibAddr({ ibGib: branchIbGib });
82
+
83
+ const localSpaceId = getSpaceIdFromIb(localSpace.ib);
84
+ const sqBranchAddr = getSpaceQualifiedIbGibAddr({
85
+ ibGibAddr: branchAddr,
86
+ spaceId: localSpaceId,
87
+ });
83
88
 
84
89
  // Create Index IbGib
85
90
  const indexIbGib = await createB2tFSIndexIbGib({
86
- spaceId: 'local_space_uuid',
87
- activeSpaceId: 'local_space_uuid',
91
+ activeSpaceId: localSpaceId,
88
92
  space: localSpace,
93
+ activeBranchName: branchName,
94
+ sqBranchAddr,
89
95
  metaspace,
90
96
  });
91
- iReckon(lc, indexIbGib.data?.mySpaceId).willEqual('local_space_uuid');
97
+ iReckon(lc, indexIbGib.data?.mySpaceId).willEqual(localSpaceId);
92
98
  iReckon(lc, indexIbGib.data?.staged_item).willEqual([]);
93
99
  iReckon(lc, indexIbGib.rel8ns?.staged_item).isGonnaBeFalsy();
94
100
  } finally {