MCPcopy
hub / github.com/coder/mux / runSubmoduleMaterialization

Function runSubmoduleMaterialization

src/node/runtime/submoduleSync.ts:75–107  ·  view source on GitHub ↗
(args: RuntimeSubmoduleSyncArgs)

Source from the content-addressed store, hash-verified

73}
74
75async function runSubmoduleMaterialization(args: RuntimeSubmoduleSyncArgs): Promise<void> {
76 const env = buildGitExecutionEnv({ env: args.env, trusted: args.trusted });
77
78 // Skills, docs, and other workspace-managed files can live inside submodules.
79 // Materialize them before init hooks or downstream runtime setup so later discovery
80 // doesn't misdiagnose missing files as invalid workspace state.
81 args.initLogger.logStep("Initializing git submodules...");
82
83 try {
84 await runSubmoduleCommand({
85 runtime: args.runtime,
86 workspacePath: args.workspacePath,
87 abortSignal: args.abortSignal,
88 env,
89 command: SUBMODULE_SYNC_COMMAND,
90 timeout: SUBMODULE_SYNC_TIMEOUT_SECS,
91 fallbackError: "git submodule sync failed",
92 });
93 await runSubmoduleCommand({
94 runtime: args.runtime,
95 workspacePath: args.workspacePath,
96 abortSignal: args.abortSignal,
97 env,
98 command: SUBMODULE_UPDATE_COMMAND,
99 timeout: SUBMODULE_UPDATE_TIMEOUT_SECS,
100 fallbackError: "git submodule update failed",
101 });
102 } catch (error) {
103 throw formatSubmoduleSyncError(error);
104 }
105
106 args.initLogger.logStep("Git submodules ready");
107}
108
109async function hasLocalGitmodules(workspacePath: string): Promise<boolean> {
110 const gitmodulesPath = path.join(workspacePath, ".gitmodules");

Callers 2

syncLocalGitSubmodulesFunction · 0.85
syncRuntimeGitSubmodulesFunction · 0.85

Calls 4

buildGitExecutionEnvFunction · 0.85
runSubmoduleCommandFunction · 0.85
formatSubmoduleSyncErrorFunction · 0.85
logStepMethod · 0.80

Tested by

no test coverage detected