@ozyman42/ozy-cli 0.4.6-linux-x64.0 → 0.4.6

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 (207) hide show
  1. package/bin/ozy +191 -0
  2. package/bin/ozy-signing-agent +191 -0
  3. package/bin/ozy-ssh-keygen +191 -0
  4. package/bin/ozy-virtual-security-key +191 -0
  5. package/dist/commands/git/hosts.js +18 -0
  6. package/dist/commands/git/hosts.js.map +1 -0
  7. package/dist/commands/git/index.js +8 -0
  8. package/dist/commands/git/index.js.map +1 -0
  9. package/dist/commands/git/setup.js +145 -0
  10. package/dist/commands/git/setup.js.map +1 -0
  11. package/dist/commands/index.js +13 -0
  12. package/dist/commands/index.js.map +1 -0
  13. package/dist/commands/npm/index.js +7 -0
  14. package/dist/commands/npm/index.js.map +1 -0
  15. package/dist/commands/npm/setup/git-remote.js +66 -0
  16. package/dist/commands/npm/setup/git-remote.js.map +1 -0
  17. package/dist/commands/npm/setup/index.js +168 -0
  18. package/dist/commands/npm/setup/index.js.map +1 -0
  19. package/dist/commands/npm/setup/npm-auth.js +62 -0
  20. package/dist/commands/npm/setup/npm-auth.js.map +1 -0
  21. package/dist/commands/npm/setup/package-json-validate.js +47 -0
  22. package/dist/commands/npm/setup/package-json-validate.js.map +1 -0
  23. package/dist/commands/npm/setup/package-registry.js +20 -0
  24. package/dist/commands/npm/setup/package-registry.js.map +1 -0
  25. package/dist/commands/npm/setup/setup.test.js +95 -0
  26. package/dist/commands/npm/setup/setup.test.js.map +1 -0
  27. package/dist/commands/npm/setup/trusted-publishing.js +84 -0
  28. package/dist/commands/npm/setup/trusted-publishing.js.map +1 -0
  29. package/dist/commands/npm/setup/workflow.js +19 -0
  30. package/dist/commands/npm/setup/workflow.js.map +1 -0
  31. package/dist/commands/ssh/get-sk-credential.js +104 -0
  32. package/dist/commands/ssh/get-sk-credential.js.map +1 -0
  33. package/dist/commands/ssh/index.js +7 -0
  34. package/dist/commands/ssh/index.js.map +1 -0
  35. package/dist/commands/upgrade.js +81 -0
  36. package/dist/commands/upgrade.js.map +1 -0
  37. package/dist/common/command.js +15 -0
  38. package/dist/common/command.js.map +1 -0
  39. package/dist/common/constants.js +25 -0
  40. package/dist/common/constants.js.map +1 -0
  41. package/dist/common/effective-modules-extensions.js +13 -0
  42. package/dist/common/effective-modules-extensions.js.map +1 -0
  43. package/dist/common/log.js +4 -0
  44. package/dist/common/log.js.map +1 -0
  45. package/dist/common/render-caller-tree.js +20 -0
  46. package/dist/common/render-caller-tree.js.map +1 -0
  47. package/dist/entrypoints/ozy-signing-agent.js +48 -0
  48. package/dist/entrypoints/ozy-signing-agent.js.map +1 -0
  49. package/dist/entrypoints/ozy-ssh-keygen.js +9 -0
  50. package/dist/entrypoints/ozy-ssh-keygen.js.map +1 -0
  51. package/dist/entrypoints/ozy-virtual-security-key.js +18 -0
  52. package/dist/entrypoints/ozy-virtual-security-key.js.map +1 -0
  53. package/dist/entrypoints/ozy.js +3 -0
  54. package/dist/entrypoints/ozy.js.map +1 -0
  55. package/dist/index.js +2 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/internal/thing.js +4 -0
  58. package/dist/internal/thing.js.map +1 -0
  59. package/dist/modules/cli/agent-client/impl.js +109 -0
  60. package/dist/modules/cli/agent-client/impl.js.map +1 -0
  61. package/dist/modules/cli/agent-client/interface.js +11 -0
  62. package/dist/modules/cli/agent-client/interface.js.map +1 -0
  63. package/dist/modules/cli/git/impl.js +124 -0
  64. package/dist/modules/cli/git/impl.js.map +1 -0
  65. package/dist/modules/cli/git/interface.js +3 -0
  66. package/dist/modules/cli/git/interface.js.map +1 -0
  67. package/dist/modules/cli/git/submodule/fix.js +257 -0
  68. package/dist/modules/cli/git/submodule/fix.js.map +1 -0
  69. package/dist/modules/cli/git/submodule/git-state.js +154 -0
  70. package/dist/modules/cli/git/submodule/git-state.js.map +1 -0
  71. package/dist/modules/cli/git/submodule/gitmodules.js +113 -0
  72. package/dist/modules/cli/git/submodule/gitmodules.js.map +1 -0
  73. package/dist/modules/cli/git/submodule/printer.js +232 -0
  74. package/dist/modules/cli/git/submodule/printer.js.map +1 -0
  75. package/dist/modules/cli/git/submodule/resolve-git-dir.js +16 -0
  76. package/dist/modules/cli/git/submodule/resolve-git-dir.js.map +1 -0
  77. package/dist/modules/cli/github/impl.js +137 -0
  78. package/dist/modules/cli/github/impl.js.map +1 -0
  79. package/dist/modules/cli/github/interface.js +2 -0
  80. package/dist/modules/cli/github/interface.js.map +1 -0
  81. package/dist/modules/cli/index.js +9 -0
  82. package/dist/modules/cli/index.js.map +1 -0
  83. package/dist/modules/common/crypto/impl.js +133 -0
  84. package/dist/modules/common/crypto/impl.js.map +1 -0
  85. package/dist/modules/common/crypto/interface.js +2 -0
  86. package/dist/modules/common/crypto/interface.js.map +1 -0
  87. package/dist/modules/common/index.js +10 -0
  88. package/dist/modules/common/index.js.map +1 -0
  89. package/dist/modules/common/kep-map-store/impl.js +42 -0
  90. package/dist/modules/common/kep-map-store/impl.js.map +1 -0
  91. package/dist/modules/common/kep-map-store/interface.js +2 -0
  92. package/dist/modules/common/kep-map-store/interface.js.map +1 -0
  93. package/dist/modules/common/os-platform/caller-info.js +132 -0
  94. package/dist/modules/common/os-platform/caller-info.js.map +1 -0
  95. package/dist/modules/common/os-platform/impl.js +87 -0
  96. package/dist/modules/common/os-platform/impl.js.map +1 -0
  97. package/dist/modules/common/os-platform/interface.js +2 -0
  98. package/dist/modules/common/os-platform/interface.js.map +1 -0
  99. package/dist/modules/common/os-platform/virtual-hid/index.js +12 -0
  100. package/dist/modules/common/os-platform/virtual-hid/index.js.map +1 -0
  101. package/dist/modules/common/os-platform/virtual-hid/linux.js +5 -0
  102. package/dist/modules/common/os-platform/virtual-hid/linux.js.map +1 -0
  103. package/dist/modules/common/os-platform/virtual-hid/mac.js +119 -0
  104. package/dist/modules/common/os-platform/virtual-hid/mac.js.map +1 -0
  105. package/dist/modules/common/os-platform/virtual-hid/windows.js +5 -0
  106. package/dist/modules/common/os-platform/virtual-hid/windows.js.map +1 -0
  107. package/dist/modules/common/ssh-config/impl.js +116 -0
  108. package/dist/modules/common/ssh-config/impl.js.map +1 -0
  109. package/dist/modules/common/ssh-config/interface.js +10 -0
  110. package/dist/modules/common/ssh-config/interface.js.map +1 -0
  111. package/dist/modules/ssh-agent/index.js +8 -0
  112. package/dist/modules/ssh-agent/index.js.map +1 -0
  113. package/dist/modules/ssh-agent/session/impl.js +265 -0
  114. package/dist/modules/ssh-agent/session/impl.js.map +1 -0
  115. package/dist/modules/ssh-agent/session/interface-rpc.js +20 -0
  116. package/dist/modules/ssh-agent/session/interface-rpc.js.map +1 -0
  117. package/dist/modules/ssh-agent/session/interface.js +32 -0
  118. package/dist/modules/ssh-agent/session/interface.js.map +1 -0
  119. package/dist/modules/ssh-agent/session/passkey-prf-page.js +204 -0
  120. package/dist/modules/ssh-agent/session/passkey-prf-page.js.map +1 -0
  121. package/dist/modules/ssh-agent/session/prf-flow.js +103 -0
  122. package/dist/modules/ssh-agent/session/prf-flow.js.map +1 -0
  123. package/dist/modules/ssh-agent/ssh-agent/impl.js +117 -0
  124. package/dist/modules/ssh-agent/ssh-agent/impl.js.map +1 -0
  125. package/dist/modules/ssh-agent/ssh-agent/interface.js +2 -0
  126. package/dist/modules/ssh-agent/ssh-agent/interface.js.map +1 -0
  127. package/dist/scripts/build.js +412 -0
  128. package/dist/scripts/build.js.map +1 -0
  129. package/dist/scripts/check-npm-version.js +8 -0
  130. package/dist/scripts/check-npm-version.js.map +1 -0
  131. package/dist/scripts/kill-existing-agent.js +21 -0
  132. package/dist/scripts/kill-existing-agent.js.map +1 -0
  133. package/dist/scripts/publish.js +46 -0
  134. package/dist/scripts/publish.js.map +1 -0
  135. package/package.json +52 -11
  136. package/src/commands/git/hosts.ts +20 -0
  137. package/src/commands/git/index.ts +9 -0
  138. package/src/commands/git/setup.ts +182 -0
  139. package/src/commands/index.ts +15 -0
  140. package/src/commands/npm/index.ts +8 -0
  141. package/src/commands/npm/setup/git-remote.ts +78 -0
  142. package/src/commands/npm/setup/index.ts +189 -0
  143. package/src/commands/npm/setup/npm-auth.ts +58 -0
  144. package/src/commands/npm/setup/package-json-validate.ts +68 -0
  145. package/src/commands/npm/setup/package-registry.ts +24 -0
  146. package/src/commands/npm/setup/publish-workflow.yml +35 -0
  147. package/src/commands/npm/setup/setup.test.ts +117 -0
  148. package/src/commands/npm/setup/trusted-publishing.ts +106 -0
  149. package/src/commands/npm/setup/workflow.ts +20 -0
  150. package/src/commands/ssh/get-sk-credential.ts +110 -0
  151. package/src/commands/ssh/index.ts +8 -0
  152. package/src/commands/upgrade.ts +90 -0
  153. package/src/common/command.ts +16 -0
  154. package/src/common/constants.ts +26 -0
  155. package/src/common/effective-modules-extensions.ts +24 -0
  156. package/src/common/log.ts +3 -0
  157. package/src/common/render-caller-tree.ts +22 -0
  158. package/src/entrypoints/ozy-signing-agent.ts +48 -0
  159. package/src/entrypoints/ozy-ssh-keygen.ts +10 -0
  160. package/src/entrypoints/ozy-virtual-security-key.ts +21 -0
  161. package/src/entrypoints/ozy.ts +2 -0
  162. package/src/index.ts +1 -0
  163. package/src/internal/thing.ts +3 -0
  164. package/src/modules/cli/agent-client/impl.ts +152 -0
  165. package/src/modules/cli/agent-client/interface.ts +17 -0
  166. package/src/modules/cli/git/impl.ts +133 -0
  167. package/src/modules/cli/git/interface.ts +23 -0
  168. package/src/modules/cli/git/submodule/fix.ts +298 -0
  169. package/src/modules/cli/git/submodule/git-state.ts +217 -0
  170. package/src/modules/cli/git/submodule/gitmodules.ts +126 -0
  171. package/src/modules/cli/git/submodule/printer.ts +256 -0
  172. package/src/modules/cli/git/submodule/resolve-git-dir.ts +14 -0
  173. package/src/modules/cli/github/impl.ts +169 -0
  174. package/src/modules/cli/github/interface.ts +29 -0
  175. package/src/modules/cli/index.ts +16 -0
  176. package/src/modules/common/crypto/impl.ts +173 -0
  177. package/src/modules/common/crypto/interface.ts +20 -0
  178. package/src/modules/common/index.ts +19 -0
  179. package/src/modules/common/kep-map-store/impl.ts +47 -0
  180. package/src/modules/common/kep-map-store/interface.ts +9 -0
  181. package/src/modules/common/os-platform/caller-info.ts +152 -0
  182. package/src/modules/common/os-platform/impl.ts +86 -0
  183. package/src/modules/common/os-platform/interface.ts +16 -0
  184. package/src/modules/common/os-platform/virtual-hid/index.ts +12 -0
  185. package/src/modules/common/os-platform/virtual-hid/linux.ts +7 -0
  186. package/src/modules/common/os-platform/virtual-hid/mac.ts +150 -0
  187. package/src/modules/common/os-platform/virtual-hid/windows.ts +7 -0
  188. package/src/modules/common/ssh-config/impl.ts +130 -0
  189. package/src/modules/common/ssh-config/interface.ts +33 -0
  190. package/src/modules/ssh-agent/index.ts +13 -0
  191. package/src/modules/ssh-agent/session/agent-notes.md +210 -0
  192. package/src/modules/ssh-agent/session/design.md +2 -0
  193. package/src/modules/ssh-agent/session/html-refactor.md +23 -0
  194. package/src/modules/ssh-agent/session/impl.ts +328 -0
  195. package/src/modules/ssh-agent/session/interface-rpc.ts +24 -0
  196. package/src/modules/ssh-agent/session/interface.ts +62 -0
  197. package/src/modules/ssh-agent/session/passkey-prf-page.ts +224 -0
  198. package/src/modules/ssh-agent/session/prf-flow.ts +152 -0
  199. package/src/modules/ssh-agent/ssh-agent/impl.ts +136 -0
  200. package/src/modules/ssh-agent/ssh-agent/interface.ts +9 -0
  201. package/src/scripts/build.ts +506 -0
  202. package/src/scripts/check-npm-version.ts +7 -0
  203. package/src/scripts/command-launcher.js.ejs +168 -0
  204. package/src/scripts/kill-existing-agent.ts +22 -0
  205. package/src/scripts/publish.ts +47 -0
  206. package/src/scripts/windows-bin-shims.md +1104 -0
  207. package/multi-call-binary +0 -0
@@ -0,0 +1,124 @@
1
+ import { implementing } from "effective-modules";
2
+ import { cliModules } from "..";
3
+ import { commonModules } from "@/modules/common";
4
+ import { $ } from 'bun';
5
+ import { Effect, Option, pipe } from "effect";
6
+ import { existsSync } from "node:fs";
7
+ import { resolve } from "node:path";
8
+ import { SSH_KEYGEN_CMD_PATH, STANDARD_REMOTE_PREFIX } from "@/common/constants";
9
+ import { Gitmodules } from "./submodule/gitmodules";
10
+ import { readGitState } from "./submodule/git-state";
11
+ import { fixGitConfig, fixModuleDirs, fixIndexGitlinks } from "./submodule/fix";
12
+ import { printSyncState, printFixes } from "./submodule/printer";
13
+ export class GitImpl extends implementing(cliModules.Git).uses(commonModules.OSPlatform, commonModules.SSHConfig) {
14
+ parseOwnerRepo(remote) {
15
+ const sshMatch = remote.match(/^git@[^:]+:([^/]+)\/(.+?)(?:\.git)?$/);
16
+ if (sshMatch)
17
+ return Effect.succeed({ owner: sshMatch[1], repo: sshMatch[2] });
18
+ const httpsMatch = remote.match(/^https?:\/\/[^/]+\/([^/]+)\/(.+?)(?:\.git)?$/);
19
+ if (httpsMatch)
20
+ return Effect.succeed({ owner: httpsMatch[1], repo: httpsMatch[2] });
21
+ return Effect.fail(`Cannot parse owner/repo from remote: ${remote}`);
22
+ }
23
+ *resolveOwnerAndRepo(maybeOwnerAndRepo) {
24
+ if (Option.isSome(maybeOwnerAndRepo)) {
25
+ const parts = maybeOwnerAndRepo.value.split('/');
26
+ const [owner, repo] = parts;
27
+ if (parts.length !== 2 || !owner || !repo)
28
+ return yield* Effect.fail(`Cannot parse remote error: Expected "owner/repo", got "${maybeOwnerAndRepo.value}"`);
29
+ return { owner, repo };
30
+ }
31
+ if (!(yield* this.isGitRepository())) {
32
+ yield* Effect.fail(`not in git repo: Current directory is not a git repository`);
33
+ }
34
+ const remoteOption = yield* this.getRemoteOrigin();
35
+ if (Option.isNone(remoteOption)) {
36
+ return yield* Effect.fail(`no remote origin: No remote.origin.url — pass owner/repo as argument to clone instead`);
37
+ }
38
+ return yield* this.parseOwnerRepo(remoteOption.value);
39
+ }
40
+ *isGitRepository() {
41
+ return yield* pipe(Effect.tryPromise(async () => {
42
+ await $ `git rev-parse --is-inside-work-tree`.quiet();
43
+ return true;
44
+ }), Effect.catchTag("UnknownError", () => Effect.succeed(false)));
45
+ }
46
+ *getRemoteOrigin() {
47
+ return yield* pipe(Effect.tryPromise(async () => {
48
+ return Option.some((await $ `git config --get remote.origin.url`.quiet()).text().trim());
49
+ }), Effect.catchTag("UnknownError", () => Effect.succeed(Option.none())));
50
+ }
51
+ *clone(owner, repo) {
52
+ const result = Bun.spawnSync(['git', 'clone', '--recurse-submodules', `${STANDARD_REMOTE_PREFIX}${owner}/${repo}.git`], { stdout: 'inherit', stderr: 'inherit' });
53
+ if (result.exitCode !== 0)
54
+ return yield* Effect.fail(`git clone failed with exit code ${result.exitCode}`);
55
+ process.chdir(`./${repo}`);
56
+ }
57
+ *setLocalConfig(key, value) {
58
+ yield* Effect.tryPromise({
59
+ try: async () => { await $ `git config --local ${key} ${value}`.quiet(); },
60
+ catch: (e) => `git config ${key}: ${e instanceof Error ? e.message : String(e)}`,
61
+ });
62
+ }
63
+ *configureRepo({ dir, remoteURL, user, pubkeyPath }) {
64
+ yield* Effect.log(`Configuring ${dir}`);
65
+ yield* Effect.tryPromise({
66
+ try: async () => {
67
+ const configs = [
68
+ ['remote.origin.url', remoteURL],
69
+ ['user.name', user.name],
70
+ ['user.email', user.email],
71
+ ['user.signingkey', pubkeyPath],
72
+ ['gpg.format', 'ssh'],
73
+ ['gpg.ssh.program', SSH_KEYGEN_CMD_PATH],
74
+ ['commit.gpgsign', 'true'],
75
+ ['tag.gpgsign', 'true'],
76
+ ];
77
+ for (const [k, v] of configs) {
78
+ const r = Bun.spawnSync(['git', 'config', '--local', k, v], { cwd: dir, stdout: 'pipe', stderr: 'pipe' });
79
+ if (r.exitCode !== 0) {
80
+ const err = new TextDecoder().decode(r.stderr);
81
+ throw new Error(`git config ${k} failed: ${err.trim()}`);
82
+ }
83
+ }
84
+ },
85
+ catch: (e) => e instanceof Error ? e.message : String(e),
86
+ });
87
+ }
88
+ *syncSubmoduleState(repoRoot, topLevelRoot) {
89
+ const gitmodules = yield* Gitmodules.fromRepoRoot(repoRoot);
90
+ if (gitmodules.list.length === 0)
91
+ return gitmodules;
92
+ const submodulePaths = gitmodules.list.map(m => m.path);
93
+ const state = yield* readGitState(repoRoot, submodulePaths);
94
+ printSyncState(gitmodules, state);
95
+ const fixResults = yield* Effect.all([
96
+ fixGitConfig(repoRoot, gitmodules),
97
+ fixModuleDirs(repoRoot, gitmodules, state.moduleDirs, state.orphanModuleDirs, topLevelRoot),
98
+ fixIndexGitlinks(repoRoot, gitmodules, state.index),
99
+ ], { concurrency: "unbounded" });
100
+ printFixes(fixResults.flat());
101
+ return gitmodules;
102
+ }
103
+ *setupRepo(input) {
104
+ yield* this.setupRepoAt(input, input.dir);
105
+ }
106
+ *setupRepoAt(input, topLevelRoot) {
107
+ yield* this.configureRepo(input);
108
+ if (!existsSync(resolve(input.dir, '.gitmodules')))
109
+ return;
110
+ const gitmodules = yield* this.syncSubmoduleState(input.dir, topLevelRoot);
111
+ for (const m of gitmodules.list) {
112
+ const subDir = resolve(input.dir, m.path);
113
+ if (!existsSync(subDir))
114
+ continue;
115
+ yield* this.setupRepoAt({
116
+ dir: subDir,
117
+ remoteURL: m.url,
118
+ user: input.user,
119
+ pubkeyPath: input.pubkeyPath
120
+ }, topLevelRoot);
121
+ }
122
+ }
123
+ }
124
+ //# sourceMappingURL=impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impl.js","sourceRoot":"","sources":["../../../../../../../src/modules/cli/git/impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAA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YAAE,OAAO;QAC3D,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAC3E,KAAK,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC;YAChC,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;YAC1C,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;gBAAE,SAAS;YAClC,KAAK,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC;gBACtB,GAAG,EAAE,MAAM;gBACX,SAAS,EAAE,CAAC,CAAC,GAAG;gBAChB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,UAAU,EAAE,KAAK,CAAC,UAAU;aAC7B,EAAE,YAAY,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ import {} from "effective-modules";
2
+ import { Option } from "effect";
3
+ //# sourceMappingURL=interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../../../../src/modules/cli/git/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,257 @@
1
+ import { existsSync, statSync } from "node:fs";
2
+ import { readFile, writeFile, rename, mkdir, rm } from "node:fs/promises";
3
+ import { resolve, join, dirname, relative } from "node:path";
4
+ import { Effect } from "effect";
5
+ import { resolveGitDir } from "./resolve-git-dir";
6
+ function parseConfigSubmoduleValues(content) {
7
+ const entries = new Map();
8
+ let current = null;
9
+ for (const line of content.split("\n")) {
10
+ const headerMatch = line.match(/^\[submodule "(.+)"\]$/);
11
+ if (headerMatch) {
12
+ current = {};
13
+ entries.set(headerMatch[1], current);
14
+ continue;
15
+ }
16
+ if (!current)
17
+ continue;
18
+ const kvMatch = line.match(/^\s+(\w+)\s*=\s*(.+)$/);
19
+ if (!kvMatch)
20
+ continue;
21
+ const [, key, value] = kvMatch;
22
+ if (key === "url" || key === "path")
23
+ current[key] = value.trim();
24
+ }
25
+ return entries;
26
+ }
27
+ // Drops any stanza whose name isn't a valid submodule, is a stale duplicate, or
28
+ // has url/path values that no longer match .gitmodules — so it can be re-added fresh.
29
+ function removeExtraConfigSubmodules(content, modules) {
30
+ const byName = new Map(modules.list.map((m) => [m.name, m]));
31
+ const existingValues = parseConfigSubmoduleValues(content);
32
+ const staleNames = new Set();
33
+ for (const [name, values] of existingValues) {
34
+ const m = byName.get(name);
35
+ if (!m || values.url !== m.url || values.path !== m.path)
36
+ staleNames.add(name);
37
+ }
38
+ const removed = [];
39
+ const seen = new Set();
40
+ const output = [];
41
+ let dropping = false;
42
+ for (const line of content.split("\n")) {
43
+ const submoduleMatch = line.match(/^\[submodule "(.+)"\]$/);
44
+ if (submoduleMatch) {
45
+ const name = submoduleMatch[1];
46
+ if (!staleNames.has(name) && !seen.has(name)) {
47
+ seen.add(name);
48
+ dropping = false;
49
+ }
50
+ else {
51
+ removed.push(name);
52
+ dropping = true;
53
+ }
54
+ }
55
+ else if (/^\[/.test(line)) {
56
+ dropping = false;
57
+ }
58
+ if (!dropping)
59
+ output.push(line);
60
+ }
61
+ return { result: output.join("\n"), removed };
62
+ }
63
+ async function spawnGit(args, cwd) {
64
+ const proc = Bun.spawn(["git", ...args], { cwd, stdout: "pipe", stderr: "pipe" });
65
+ const code = await proc.exited;
66
+ if (code !== 0) {
67
+ const err = await new Response(proc.stderr).text();
68
+ throw new Error(`git ${args.join(" ")} exited with code ${code}\n${err.trim()}`);
69
+ }
70
+ }
71
+ export function fixGitConfig(repoRoot, modules) {
72
+ return Effect.tryPromise({
73
+ try: async () => {
74
+ const gitDir = await resolveGitDir(repoRoot);
75
+ const configPath = resolve(gitDir, "config");
76
+ const content = await readFile(configPath, "utf8");
77
+ const { result: afterRemoval, removed } = removeExtraConfigSubmodules(content, modules);
78
+ const existingNames = new Set([...afterRemoval.matchAll(/^\[submodule "(.+)"\]$/gm)].map((m) => m[1]));
79
+ const missing = modules.list.filter((m) => !existingNames.has(m.name));
80
+ let result = afterRemoval;
81
+ for (const m of missing) {
82
+ if (!result.endsWith("\n"))
83
+ result += "\n";
84
+ result += `[submodule "${m.name}"]\n\tactive = true\n\turl = ${m.url}\n\tpath = ${m.path}\n`;
85
+ }
86
+ if (removed.length === 0 && missing.length === 0)
87
+ return [];
88
+ await writeFile(configPath, result, "utf8");
89
+ return [
90
+ ...removed.map((name) => ({ location: [".git", "config", name], action: "deleted" })),
91
+ ...missing.map((m) => ({ location: [".git", "config", m.name], action: "synced" })),
92
+ ];
93
+ },
94
+ catch: (e) => e instanceof Error ? e.message : String(e),
95
+ });
96
+ }
97
+ const GIT_MODULES_MARKER = ".git/modules/";
98
+ // A stale redirect's leading "../" prefix can be wrong after a path rename, but the
99
+ // suffix starting at ".git/modules/" always describes a location under the single
100
+ // top-level .git, at any nesting depth — so anchor on that marker instead of trusting
101
+ // the relative resolution.
102
+ function recoverStaleGitDirTarget(redirectContent, topLevelRoot) {
103
+ const match = redirectContent.match(/^gitdir:\s*(.+)$/m);
104
+ if (!match)
105
+ return undefined;
106
+ const idx = match[1].indexOf(GIT_MODULES_MARKER);
107
+ if (idx === -1)
108
+ return undefined;
109
+ return resolve(topLevelRoot, match[1].slice(idx).trim());
110
+ }
111
+ // Moves existing git data into moduleGitDir instead of abandoning it, whether it's a
112
+ // standalone clone's literal .git directory, or a redirect file (even a stale one
113
+ // left over from a path rename) pointing at git data that still exists.
114
+ async function migrateExistingGitDir(workingTreeDir, moduleGitDir, topLevelRoot) {
115
+ const dotGit = join(workingTreeDir, ".git");
116
+ if (!existsSync(dotGit))
117
+ return false;
118
+ if (statSync(dotGit).isDirectory()) {
119
+ await mkdir(dirname(moduleGitDir), { recursive: true });
120
+ await rename(dotGit, moduleGitDir);
121
+ return true;
122
+ }
123
+ const content = await readFile(dotGit, "utf8");
124
+ const target = recoverStaleGitDirTarget(content, topLevelRoot);
125
+ if (!target || target === moduleGitDir || !existsSync(target))
126
+ return false;
127
+ await mkdir(dirname(moduleGitDir), { recursive: true });
128
+ await rename(target, moduleGitDir);
129
+ return true;
130
+ }
131
+ export function fixModuleDirs(repoRoot, modules, moduleDirs, orphanModuleDirs, topLevelRoot) {
132
+ return Effect.tryPromise({
133
+ try: async () => {
134
+ const fixes = [];
135
+ const modulesRoot = resolve(await resolveGitDir(repoRoot), "modules");
136
+ // Establish each module's git dir (migrating existing data if any exists
137
+ // anywhere) before the orphan cleanup below runs, so nothing real gets deleted
138
+ // out from under a path rename.
139
+ for (const m of modules.list) {
140
+ const workingTreeDir = resolve(repoRoot, m.path);
141
+ const moduleGitDir = join(modulesRoot, m.path);
142
+ if (!existsSync(workingTreeDir))
143
+ continue;
144
+ const alreadyEstablished = existsSync(moduleGitDir);
145
+ let freshlyCloned = false;
146
+ if (!alreadyEstablished) {
147
+ const migrated = await migrateExistingGitDir(workingTreeDir, moduleGitDir, topLevelRoot);
148
+ if (migrated) {
149
+ fixes.push({ location: [".git", "modules", ...m.path.split("/")], action: "synced", detail: "migrated" });
150
+ }
151
+ else {
152
+ await mkdir(dirname(moduleGitDir), { recursive: true });
153
+ await spawnGit(["clone", "--bare", m.url, moduleGitDir], repoRoot);
154
+ fixes.push({ location: [".git", "modules", ...m.path.split("/")], action: "synced", detail: "initialized" });
155
+ freshlyCloned = true;
156
+ }
157
+ }
158
+ if (freshlyCloned) {
159
+ const configFile = join(moduleGitDir, "config");
160
+ const worktree = relative(moduleGitDir, workingTreeDir);
161
+ await spawnGit(["config", "-f", configFile, "core.bare", "false"], repoRoot);
162
+ await spawnGit(["config", "-f", configFile, "core.worktree", worktree], repoRoot);
163
+ }
164
+ // A bare clone (whether just made above, or left over from a prior buggy
165
+ // run) never gets an index — populate it from HEAD whenever it's missing,
166
+ // not only right after we ourselves created it.
167
+ if (!existsSync(join(moduleGitDir, "index"))) {
168
+ const headCheck = Bun.spawn(["git", "--git-dir", moduleGitDir, "rev-parse", "--verify", "HEAD"], { stdout: "ignore", stderr: "ignore" });
169
+ if ((await headCheck.exited) !== 0)
170
+ await spawnGit(["--git-dir", moduleGitDir, "fetch", "origin"], repoRoot);
171
+ await spawnGit(["--git-dir", moduleGitDir, "read-tree", "HEAD"], repoRoot);
172
+ fixes.push({ location: [".git", "modules", ...m.path.split("/")], action: "synced", detail: "populated index" });
173
+ }
174
+ // Always re-point the working tree's .git redirect — never assume an
175
+ // existing file is already correct.
176
+ const dotGit = join(workingTreeDir, ".git");
177
+ const rel = relative(workingTreeDir, moduleGitDir);
178
+ const desired = `gitdir: ${rel}\n`;
179
+ const current = existsSync(dotGit) && !statSync(dotGit).isDirectory()
180
+ ? await readFile(dotGit, "utf8")
181
+ : undefined;
182
+ if (current !== desired) {
183
+ await writeFile(dotGit, desired, "utf8");
184
+ fixes.push({ location: [...m.path.split("/"), ".git"], action: "synced" });
185
+ }
186
+ }
187
+ const gmByPath = new Map(modules.list.map((m) => [m.path, m]));
188
+ for (const d of moduleDirs) {
189
+ const gm = gmByPath.get(d.relativePath);
190
+ if (!gm && existsSync(join(modulesRoot, d.relativePath))) {
191
+ await rm(join(modulesRoot, d.relativePath), { recursive: true, force: true });
192
+ fixes.push({ location: [".git", "modules", ...d.relativePath.split("/")], action: "deleted" });
193
+ }
194
+ }
195
+ for (const rel of orphanModuleDirs) {
196
+ if (existsSync(join(modulesRoot, rel))) {
197
+ await rm(join(modulesRoot, rel), { recursive: true, force: true });
198
+ fixes.push({ location: [".git", "modules", ...rel.split("/")], action: "deleted" });
199
+ }
200
+ }
201
+ for (const m of modules.list) {
202
+ const moduleGitDir = join(modulesRoot, m.path);
203
+ if (!existsSync(moduleGitDir))
204
+ continue;
205
+ const configFile = join(moduleGitDir, "config");
206
+ const readConfig = (key) => Bun.spawn(["git", "config", "-f", configFile, key], { cwd: repoRoot, stdout: "pipe", stderr: "pipe" });
207
+ const [currentUrl, currentWorktree] = await Promise.all([
208
+ new Response(readConfig("remote.origin.url").stdout).text().then(t => t.trim()),
209
+ new Response(readConfig("core.worktree").stdout).text().then(t => t.trim()),
210
+ ]);
211
+ const worktree = relative(moduleGitDir, resolve(repoRoot, m.path));
212
+ if (currentUrl !== m.url) {
213
+ await spawnGit(["config", "-f", configFile, "remote.origin.url", m.url], repoRoot);
214
+ fixes.push({ location: [".git", "modules", ...m.path.split("/"), "config"], action: "synced", detail: "remote.origin.url" });
215
+ }
216
+ if (currentWorktree !== worktree) {
217
+ await spawnGit(["config", "-f", configFile, "core.worktree", worktree], repoRoot);
218
+ fixes.push({ location: [".git", "modules", ...m.path.split("/"), "config"], action: "synced", detail: "core.worktree" });
219
+ }
220
+ }
221
+ return fixes;
222
+ },
223
+ catch: (e) => e instanceof Error ? e.message : String(e),
224
+ });
225
+ }
226
+ export function fixIndexGitlinks(repoRoot, modules, currentIndex) {
227
+ return Effect.tryPromise({
228
+ try: async () => {
229
+ const currentShas = new Map(currentIndex.map((e) => [e.path, e.commit]));
230
+ const validPaths = new Set(modules.list.map((m) => m.path));
231
+ const fixes = [];
232
+ for (const entry of currentIndex) {
233
+ if (!validPaths.has(entry.path)) {
234
+ await spawnGit(["update-index", "--force-remove", entry.path], repoRoot);
235
+ fixes.push({ location: [".git", "index"], action: "deleted", detail: entry.path });
236
+ }
237
+ }
238
+ for (const m of modules.list) {
239
+ const workingTree = resolve(repoRoot, m.path);
240
+ if (!existsSync(workingTree))
241
+ continue;
242
+ const shaProc = Bun.spawn(["git", "rev-parse", "HEAD"], { cwd: workingTree, stdout: "pipe", stderr: "pipe" });
243
+ const sha = (await new Response(shaProc.stdout).text()).trim();
244
+ if (!/^[0-9a-f]{40}$/.test(sha))
245
+ continue;
246
+ const current = currentShas.get(m.path);
247
+ await spawnGit(["update-index", "--add", "--cacheinfo", `160000,${sha},${m.path}`], repoRoot);
248
+ if (current !== sha) {
249
+ fixes.push({ location: [".git", "index"], action: "synced", detail: `${m.path}: ${sha.slice(0, 8)}` });
250
+ }
251
+ }
252
+ return fixes;
253
+ },
254
+ catch: (e) => e instanceof Error ? e.message : String(e),
255
+ });
256
+ }
257
+ //# sourceMappingURL=fix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix.js","sourceRoot":"","sources":["../../../../../../../../src/modules/cli/git/submodule/fix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAQlD,SAAS,0BAA0B,CAAC,OAAe;IACjD,MAAM,OAAO,GAAG,IAAI,GAAG,EAA2C,CAAC;IACnE,IAAI,OAAO,GAA2C,IAAI,CAAC;IAE3D,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACvC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;QACzD,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAE,EAAE,OAAO,CAAC,CAAC;YACtC,SAAS;QACX,CAAC;QACD,IAAI,CAAC,OAAO;YAAE,SAAS;QACvB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;QACpD,IAAI,CAAC,OAAO;YAAE,SAAS;QACvB,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC;QAC/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ACzD,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,154 @@
1
+ import { existsSync, readdirSync, statSync } from "node:fs";
2
+ import { readFile } from "node:fs/promises";
3
+ import { resolve, join } from "node:path";
4
+ import { Effect, Option } from "effect";
5
+ import { resolveGitDir } from "./resolve-git-dir";
6
+ // --- parsers ---
7
+ function parseGitConfig(content) {
8
+ const entries = [];
9
+ let current = null;
10
+ for (const line of content.split("\n")) {
11
+ const headerMatch = line.match(/^\[submodule "(.+)"\]$/);
12
+ if (headerMatch) {
13
+ if (current?.name)
14
+ entries.push(current);
15
+ current = { name: headerMatch[1] };
16
+ continue;
17
+ }
18
+ if (!current)
19
+ continue;
20
+ const kvMatch = line.match(/^\s+(\w+)\s*=\s*(.+)$/);
21
+ if (!kvMatch)
22
+ continue;
23
+ const [, key, value] = kvMatch;
24
+ if (key === "url")
25
+ current.url = value.trim();
26
+ else if (key === "path")
27
+ current.path = value.trim();
28
+ else if (key === "active")
29
+ current.active = value.trim() === "true";
30
+ }
31
+ if (current?.name)
32
+ entries.push(current);
33
+ return entries;
34
+ }
35
+ function parseIndexGitlinks(output) {
36
+ return output
37
+ .split("\n")
38
+ .filter((l) => l.startsWith("160000 "))
39
+ .map((line) => {
40
+ const match = line.match(/^160000 ([0-9a-f]{40}) \d\t(.+)$/);
41
+ if (!match)
42
+ throw new Error(`Unexpected ls-files line: ${line}`);
43
+ return { commit: match[1], path: match[2] };
44
+ });
45
+ }
46
+ /**
47
+ * Recursively scans .git/modules/, returning:
48
+ * - gitDirs: paths of real git dirs (contain a HEAD file)
49
+ * - orphanDirs: paths that are neither a git dir nor a prefix of any known module path
50
+ */
51
+ function scanModuleDirs(root, modulePaths, rel = "") {
52
+ const gitDirs = [];
53
+ const orphanDirs = [];
54
+ if (!existsSync(root))
55
+ return { gitDirs, orphanDirs };
56
+ for (const entry of readdirSync(root)) {
57
+ const abs = join(root, entry);
58
+ if (!statSync(abs).isDirectory())
59
+ continue;
60
+ const relPath = rel ? `${rel}/${entry}` : entry;
61
+ if (existsSync(join(abs, "HEAD"))) {
62
+ gitDirs.push(relPath);
63
+ }
64
+ else {
65
+ const isPrefix = [...modulePaths].some((p) => p.startsWith(relPath + "/"));
66
+ if (isPrefix) {
67
+ const sub = scanModuleDirs(abs, modulePaths, relPath);
68
+ gitDirs.push(...sub.gitDirs);
69
+ orphanDirs.push(...sub.orphanDirs);
70
+ }
71
+ else {
72
+ orphanDirs.push(relPath);
73
+ }
74
+ }
75
+ }
76
+ return { gitDirs, orphanDirs };
77
+ }
78
+ async function readModuleDirRemoteUrl(abs) {
79
+ const configPath = join(abs, "config");
80
+ if (!existsSync(configPath))
81
+ return Option.none();
82
+ const content = await readFile(configPath, "utf8");
83
+ const match = content.match(/\[remote "origin"\][^\[]*\n\s+url\s*=\s*(.+)/);
84
+ return match?.[1] ? Option.some(match[1].trim()) : Option.none();
85
+ }
86
+ async function spawnGitInDir(args, cwd) {
87
+ const proc = Bun.spawn(["git", ...args], { cwd, stdout: "pipe", stderr: "pipe" });
88
+ const [code, out, err] = await Promise.all([
89
+ proc.exited,
90
+ new Response(proc.stdout).text(),
91
+ new Response(proc.stderr).text(),
92
+ ]);
93
+ return code === 0 ? out.trim() : { error: err.trim().split("\n")[0] };
94
+ }
95
+ async function readWorkingTreeEntry(repoRoot, subPath) {
96
+ const workingTreeAbs = join(repoRoot, subPath);
97
+ const dotGit = join(workingTreeAbs, ".git");
98
+ let type;
99
+ let gitdirTarget;
100
+ if (!existsSync(dotGit)) {
101
+ type = "missing";
102
+ }
103
+ else if (statSync(dotGit).isDirectory()) {
104
+ type = "dir";
105
+ }
106
+ else {
107
+ type = "file";
108
+ const content = await readFile(dotGit, "utf8");
109
+ const match = content.match(/^gitdir:\s*(.+)$/m);
110
+ gitdirTarget = match?.[1].trim();
111
+ }
112
+ if (!existsSync(workingTreeAbs))
113
+ return { path: subPath, type, gitdirTarget };
114
+ const [remote, headCommit] = await Promise.all([
115
+ spawnGitInDir(["remote", "get-url", "origin"], workingTreeAbs),
116
+ spawnGitInDir(["rev-parse", "HEAD"], workingTreeAbs),
117
+ ]);
118
+ return { path: subPath, type, gitdirTarget, remote, headCommit };
119
+ }
120
+ // --- main reader ---
121
+ export function readGitState(repoRoot, extraPaths = []) {
122
+ return Effect.tryPromise({
123
+ try: async () => {
124
+ const gitDir = await resolveGitDir(repoRoot);
125
+ const [configContent, lsOutput] = await Promise.all([
126
+ readFile(resolve(gitDir, "config"), "utf8"),
127
+ new Response(Bun.spawn(["git", "ls-files", "--stage"], { cwd: repoRoot, stdout: "pipe" }).stdout).text(),
128
+ ]);
129
+ const config = parseGitConfig(configContent);
130
+ const index = parseIndexGitlinks(lsOutput);
131
+ const modulePaths = new Set(extraPaths);
132
+ const modulesRoot = resolve(gitDir, "modules");
133
+ const { gitDirs: moduleDirPaths, orphanDirs: orphanModuleDirs } = scanModuleDirs(modulesRoot, modulePaths);
134
+ const moduleDirs = await Promise.all(moduleDirPaths.map(async (rel) => {
135
+ const remoteUrlOption = await readModuleDirRemoteUrl(join(modulesRoot, rel));
136
+ return {
137
+ relativePath: rel,
138
+ remoteUrl: Option.isSome(remoteUrlOption) ? remoteUrlOption.value : undefined,
139
+ };
140
+ }));
141
+ const allPaths = [
142
+ ...new Set([
143
+ ...index.map((e) => e.path),
144
+ ...config.flatMap((e) => (e.path ? [e.path] : [])),
145
+ ...extraPaths,
146
+ ]),
147
+ ];
148
+ const workingTree = await Promise.all(allPaths.map((p) => readWorkingTreeEntry(repoRoot, p)));
149
+ return { config, moduleDirs, orphanModuleDirs, index, workingTree };
150
+ },
151
+ catch: (e) => e instanceof Error ? e.message : String(e),
152
+ });
153
+ }
154
+ //# sourceMappingURL=git-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-state.js","sourceRoot":"","sources":["../../../../../../../../src/modules/cli/git/submodule/git-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5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