@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,135 +0,0 @@
1
- /**
2
- * @module restore-cmd
3
- *
4
- * CLI command handler for `vcs restore [path...]`.
5
- * Delegates to executeVcsRestore and formats terminal output.
6
- */
7
-
8
- import path from 'node:path';
9
- import fs from 'node:fs/promises';
10
-
11
- import { extractErrorMsg } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
12
- import { executeVcsRestore } from '@ibgib/core-gib/dist/vcs/commands/restore-cmd.mjs';
13
- import { resolveContextualBranchName } from '@ibgib/core-gib/dist/vcs/branch/branch-helper.mjs';
14
-
15
- import { bootstrapVcsMetaspace } from '../../bootstrap/node-bootstrap.mjs';
16
- import { getOrCreateBranchSpace } from '@ibgib/node-gib/dist/vcs/branch-space-helper.mjs';
17
- import { getOrCreateWorkspaceProjectionSpace } from '@ibgib/node-gib/dist/vcs/workspace-space-helper.mjs';
18
- import { readVcsIndexProjectionFromDisk, writeVcsIndexProjectionToDisk } from '../vcs-projection-helper.mjs';
19
- import { GLOBAL_LOG_A_LOT } from '../../vcs-gib-constants.mjs';
20
-
21
- const lcFile = `[restore-cmd]`;
22
- const logalot = GLOBAL_LOG_A_LOT;
23
-
24
- export interface RestoreCmdOpts {
25
- paths?: string[];
26
- staged?: boolean;
27
- worktree?: boolean;
28
- all?: boolean;
29
- yes?: boolean;
30
- force?: boolean;
31
- targetDir?: string;
32
- vcsFolderName?: string;
33
- quiet?: boolean;
34
- }
35
-
36
- export interface RestoreCmdResult {
37
- restoredPaths: string[];
38
- unstagedPaths: string[];
39
- }
40
-
41
- export async function executeRestoreCmd({
42
- paths = [],
43
- staged = false,
44
- worktree = false,
45
- all = false,
46
- yes = false,
47
- force = false,
48
- targetDir = process.cwd(),
49
- vcsFolderName = '.vcsgib',
50
- quiet = false,
51
- }: RestoreCmdOpts = {}): Promise<RestoreCmdResult> {
52
- const lc = `${lcFile}[${executeRestoreCmd.name}]`;
53
- try {
54
- if (logalot) {
55
- console.log(`${lc} starting... (I: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d)`);
56
- }
57
-
58
- const absTargetDir = path.resolve(targetDir);
59
-
60
- const { metaspace, localSpace, vcsPath, repoRoot } = await bootstrapVcsMetaspace({
61
- repoPath: absTargetDir,
62
- vcsFolderName,
63
- });
64
-
65
- // Verify repo exists
66
- try {
67
- await fs.access(vcsPath);
68
- } catch {
69
- throw new Error(`Not an ibgib repository (directory ${vcsPath} does not exist) (E: 2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d)`);
70
- }
71
-
72
- // Retrieve authoritative B2tFSIndexIbGib_V1 from space
73
- const indexIbGib = await readVcsIndexProjectionFromDisk({ vcsPath, space: localSpace });
74
- if (!indexIbGib) {
75
- throw new Error(`Repository not initialized. Run 'vcs init' first. (E: 3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d)`);
76
- }
77
-
78
- const activeBranch = resolveContextualBranchName({ targetDir: absTargetDir, repoRoot, indexIbGib });
79
- const activeWorktreeDir = activeBranch === 'main' ? repoRoot : path.join(repoRoot, 'b', activeBranch);
80
-
81
- const { space: activeBranchSpace } = await getOrCreateBranchSpace({
82
- metaspace,
83
- vcsPath,
84
- branchName: activeBranch,
85
- });
86
-
87
- const { space: workspaceSpace } = await getOrCreateWorkspaceProjectionSpace({
88
- metaspace,
89
- workspaceRoot: activeWorktreeDir,
90
- vcsFolderName,
91
- backingSpace: activeBranchSpace,
92
- });
93
-
94
- const restoreRes = await executeVcsRestore({
95
- metaspace,
96
- localSpace,
97
- activeBranchSpace,
98
- workspaceSpace,
99
- indexIbGib,
100
- paths,
101
- staged,
102
- all,
103
- targetDir: absTargetDir,
104
- activeWorktreeDir,
105
- });
106
-
107
- if (staged && restoreRes.updatedIndex) {
108
- await writeVcsIndexProjectionToDisk({ vcsPath, indexIbGib: restoreRes.updatedIndex });
109
- }
110
-
111
- if (!quiet) {
112
- if (staged) {
113
- for (const unstagedPath of restoreRes.unstagedPaths) {
114
- console.log(`unstaged: ${unstagedPath}`);
115
- }
116
- } else {
117
- for (const restoredPath of restoreRes.restoredPaths) {
118
- console.log(`restored: ${restoredPath}`);
119
- }
120
- }
121
- }
122
-
123
- return {
124
- restoredPaths: restoreRes.restoredPaths,
125
- unstagedPaths: restoreRes.unstagedPaths,
126
- };
127
- } catch (error) {
128
- console.error(`${lc} ${extractErrorMsg(error)} (E: 9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4e)`);
129
- throw error;
130
- } finally {
131
- if (logalot) {
132
- console.log(`${lc} complete. (I: 0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5f)`);
133
- }
134
- }
135
- }