@prover-coder-ai/docker-git 1.0.50 → 1.0.52
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.
|
@@ -286,7 +286,13 @@ var runCommandWithExitCodes = (spec, okExitCodes, onFailure) => Effect.gen(funct
|
|
|
286
286
|
const exitCode = yield* _(Command.exitCode(buildCommand(spec, "inherit", "inherit", "inherit")));
|
|
287
287
|
yield* _(ensureExitCode(Number(exitCode), okExitCodes, onFailure));
|
|
288
288
|
});
|
|
289
|
-
var runCommandExitCode = (spec) => Effect.
|
|
289
|
+
var runCommandExitCode = (spec) => Effect.scoped(Effect.gen(function* (_) {
|
|
290
|
+
const process = yield* _((yield* _(CommandExecutor.CommandExecutor)).start(buildCommand(spec, "pipe", "pipe", "pipe")));
|
|
291
|
+
yield* _(Effect.forkDaemon(Stream.runDrain(process.stdout)));
|
|
292
|
+
yield* _(Effect.forkDaemon(Stream.runDrain(process.stderr)));
|
|
293
|
+
const exitCode = yield* _(process.exitCode);
|
|
294
|
+
return Number(exitCode);
|
|
295
|
+
}));
|
|
290
296
|
var collectUint8Array$1 = (chunks) => Chunk.reduce(chunks, new Uint8Array(), (acc, curr) => {
|
|
291
297
|
const next = new Uint8Array(acc.length + curr.length);
|
|
292
298
|
next.set(acc);
|
|
@@ -295,6 +301,7 @@ var collectUint8Array$1 = (chunks) => Chunk.reduce(chunks, new Uint8Array(), (ac
|
|
|
295
301
|
});
|
|
296
302
|
var runCommandCapture = (spec, okExitCodes, onFailure) => Effect.scoped(Effect.gen(function* (_) {
|
|
297
303
|
const process = yield* _((yield* _(CommandExecutor.CommandExecutor)).start(buildCommand(spec, "pipe", "pipe", "pipe")));
|
|
304
|
+
yield* _(Effect.forkDaemon(Stream.runDrain(process.stderr)));
|
|
298
305
|
const bytes = yield* _(pipe(process.stdout, Stream.runCollect, Effect.map((chunks) => collectUint8Array$1(chunks))));
|
|
299
306
|
const exitCode = yield* _(process.exitCode);
|
|
300
307
|
yield* _(ensureExitCode(Number(exitCode), okExitCodes, onFailure));
|
|
@@ -5818,14 +5825,37 @@ var ensureFileReady = (fs, resolved, onDirectoryMessage) => Effect.gen(function*
|
|
|
5818
5825
|
}
|
|
5819
5826
|
return "exists";
|
|
5820
5827
|
});
|
|
5828
|
+
var appendKeyIfMissing = (fs, resolved, source, desiredContents) => Effect.gen(function* (_) {
|
|
5829
|
+
const currentContents = yield* _(fs.readFileString(resolved));
|
|
5830
|
+
if (currentContents.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0).includes(desiredContents)) return;
|
|
5831
|
+
const normalizedCurrent = currentContents.trimEnd();
|
|
5832
|
+
const nextContents = normalizedCurrent.length === 0 ? `${desiredContents}\n` : `${normalizedCurrent}\n${desiredContents}\n`;
|
|
5833
|
+
yield* _(fs.writeFileString(resolved, nextContents));
|
|
5834
|
+
yield* _(Effect.log(`Authorized keys appended from ${source} to ${resolved}`));
|
|
5835
|
+
});
|
|
5836
|
+
var resolveAuthorizedKeysSource = (fs, path, cwd) => Effect.gen(function* (_) {
|
|
5837
|
+
const sshPrivateKey = yield* _(findSshPrivateKey(fs, path, cwd));
|
|
5838
|
+
const matchingPublicKey = sshPrivateKey === null ? null : yield* _(findExistingPath(fs, `${sshPrivateKey}.pub`));
|
|
5839
|
+
return matchingPublicKey === null ? yield* _(findAuthorizedKeysSource(fs, path, cwd)) : matchingPublicKey;
|
|
5840
|
+
});
|
|
5821
5841
|
var ensureAuthorizedKeys = (baseDir, authorizedKeysPath) => withFsPathContext(({ fs, path }) => Effect.gen(function* (_) {
|
|
5822
5842
|
const resolved = resolveAuthorizedKeysPath(path, baseDir, authorizedKeysPath);
|
|
5823
|
-
|
|
5824
|
-
const
|
|
5843
|
+
const managedDefaultAuthorizedKeys = path.join(defaultProjectsRoot(process.cwd()), "authorized_keys");
|
|
5844
|
+
const state = yield* _(ensureFileReady(fs, resolved, (resolvedPath, backupPath) => `Authorized keys was a directory, moved to ${backupPath}. Creating a file at ${resolvedPath}.`));
|
|
5845
|
+
const source = yield* _(resolveAuthorizedKeysSource(fs, path, process.cwd()));
|
|
5825
5846
|
if (source === null) {
|
|
5826
5847
|
yield* _(Effect.logError(`Authorized keys not found. Create ${resolved} with your public key to enable SSH.`));
|
|
5827
5848
|
return;
|
|
5828
5849
|
}
|
|
5850
|
+
const desiredContents = (yield* _(fs.readFileString(source))).trim();
|
|
5851
|
+
if (desiredContents.length === 0) {
|
|
5852
|
+
yield* _(Effect.logWarning(`Authorized keys source ${source} is empty. Skipping SSH key sync.`));
|
|
5853
|
+
return;
|
|
5854
|
+
}
|
|
5855
|
+
if (state === "exists") {
|
|
5856
|
+
if (resolved === managedDefaultAuthorizedKeys) yield* _(appendKeyIfMissing(fs, resolved, source, desiredContents));
|
|
5857
|
+
return;
|
|
5858
|
+
}
|
|
5829
5859
|
yield* _(fs.makeDirectory(path.dirname(resolved), { recursive: true }));
|
|
5830
5860
|
yield* _(fs.copyFile(source, resolved));
|
|
5831
5861
|
yield* _(Effect.log(`Authorized keys copied from ${source} to ${resolved}`));
|