@kitman-sh/cli 0.10.68 → 0.10.69
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.
- package/dist/{chunk-rm83dbpv.js → chunk-0271bhj2.js} +2 -2
- package/dist/{chunk-60333x3q.js → chunk-0ahahh0f.js} +5 -5
- package/dist/{chunk-8mj0z3hb.js → chunk-20qadzgw.js} +23 -23
- package/dist/{chunk-d3ksv8y1.js → chunk-677etczq.js} +70 -28
- package/dist/{chunk-t6w469gd.js → chunk-9m14d9d8.js} +7 -7
- package/dist/{chunk-wtpwkjws.js → chunk-9p6v3jd2.js} +4 -4
- package/dist/{chunk-n0h0z7yh.js → chunk-drsawp1s.js} +8 -8
- package/dist/{chunk-fsbpm71s.js → chunk-gswz7ngm.js} +5 -5
- package/dist/{chunk-v01c0k6j.js → chunk-h6360r1c.js} +1 -1
- package/dist/{chunk-qp5cdtsr.js → chunk-j4pmjnyd.js} +19 -19
- package/dist/{chunk-fdy3jce3.js → chunk-jjeawksh.js} +21 -21
- package/dist/{chunk-cctfnp4r.js → chunk-k7mn104k.js} +3 -3
- package/dist/{chunk-b90vtscf.js → chunk-kqcrxea1.js} +126 -26
- package/dist/{chunk-fc0y8kn7.js → chunk-n0pm4rtm.js} +107 -106
- package/dist/{chunk-q3c7vmby.js → chunk-p23kedha.js} +1 -1
- package/dist/{chunk-2z450w92.js → chunk-q26gt71y.js} +5 -5
- package/dist/{chunk-gfr11y10.js → chunk-q9n4jkcp.js} +4 -4
- package/dist/{chunk-dk0ftqwg.js → chunk-qdyqc4nz.js} +17 -17
- package/dist/{chunk-p8akhcme.js → chunk-qpg9t7he.js} +7 -7
- package/dist/{chunk-1w81w56v.js → chunk-rzr11xyn.js} +2 -2
- package/dist/{chunk-9pp1w29g.js → chunk-t0rnf6ch.js} +4 -4
- package/dist/{chunk-1rry0tsn.js → chunk-tf5yxkpy.js} +14 -60
- package/dist/{chunk-rrnee9mk.js → chunk-wnwyp9qn.js} +1 -1
- package/dist/{chunk-csbf77zs.js → chunk-zdctyf0w.js} +8 -8
- package/dist/index.js +4 -4
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getOrUndefined,
|
|
7
7
|
Reference,
|
|
8
8
|
TaggedError,
|
|
9
|
-
|
|
9
|
+
make15,
|
|
10
10
|
_await,
|
|
11
11
|
fail5,
|
|
12
12
|
succeed5,
|
|
@@ -85,7 +85,7 @@ import {
|
|
|
85
85
|
decodeJsonString,
|
|
86
86
|
encodeJsonStringSync,
|
|
87
87
|
encodePrettyJsonString
|
|
88
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-677etczq.js";
|
|
89
89
|
import {
|
|
90
90
|
tap,
|
|
91
91
|
mapError,
|
|
@@ -97,7 +97,7 @@ import {
|
|
|
97
97
|
withDefault,
|
|
98
98
|
option,
|
|
99
99
|
String2
|
|
100
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-qdyqc4nz.js";
|
|
101
101
|
import {
|
|
102
102
|
currentTimeMillis,
|
|
103
103
|
SecureRandom,
|
|
@@ -135,7 +135,7 @@ import {
|
|
|
135
135
|
digestSha256,
|
|
136
136
|
sha256Hasher,
|
|
137
137
|
raw,
|
|
138
|
-
|
|
138
|
+
make4,
|
|
139
139
|
get,
|
|
140
140
|
put,
|
|
141
141
|
HttpClient,
|
|
@@ -197,10 +197,10 @@ import {
|
|
|
197
197
|
harnessNames,
|
|
198
198
|
herdrRunnerCapabilities2,
|
|
199
199
|
declaredChecks
|
|
200
|
-
} from "./chunk-
|
|
200
|
+
} from "./chunk-n0pm4rtm.js";
|
|
201
201
|
import {
|
|
202
202
|
Id
|
|
203
|
-
} from "./chunk-
|
|
203
|
+
} from "./chunk-wnwyp9qn.js";
|
|
204
204
|
import {
|
|
205
205
|
toJsonValue,
|
|
206
206
|
isOneOf,
|
|
@@ -210,11 +210,11 @@ import {
|
|
|
210
210
|
isObject,
|
|
211
211
|
isJsonObject,
|
|
212
212
|
isString
|
|
213
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-h6360r1c.js";
|
|
214
214
|
import {
|
|
215
215
|
ChildProcessSpawner,
|
|
216
|
-
|
|
217
|
-
} from "./chunk-
|
|
216
|
+
make2
|
|
217
|
+
} from "./chunk-tf5yxkpy.js";
|
|
218
218
|
|
|
219
219
|
// apps/cli/src/cli-error.ts
|
|
220
220
|
function cliErrorCode(error, status) {
|
|
@@ -504,10 +504,10 @@ var checkDockerImageSetting = pinnedImage;
|
|
|
504
504
|
var checkRegistryImageSetting = pinnedImage;
|
|
505
505
|
var herdrCoreSession = (runnerId, personal) => personal ? undefined : `kitman-${sha2562(runnerId).slice(0, 16)}`;
|
|
506
506
|
var OpenHerdrCore = Reference("kitman/cli/OpenHerdrCore", {
|
|
507
|
-
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-
|
|
507
|
+
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-t0rnf6ch.js")), ({ HerdrCore, herdrCoreLayer }) => provide3(service(HerdrCore), herdrCoreLayer(options)))
|
|
508
508
|
});
|
|
509
509
|
var UpdateHerdrCore = Reference("kitman/cli/UpdateHerdrCore", {
|
|
510
|
-
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-
|
|
510
|
+
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-t0rnf6ch.js")), (module) => module.updateHerdrCore(options))
|
|
511
511
|
});
|
|
512
512
|
var herdrCoreMissing = (error) => {
|
|
513
513
|
if (isTagged(error, "HerdrCoreMissing"))
|
|
@@ -733,7 +733,7 @@ var syncTargets = (harness) => gen(function* () {
|
|
|
733
733
|
});
|
|
734
734
|
var syncKits = (input) => gen(function* () {
|
|
735
735
|
const fs = yield* FileSystem;
|
|
736
|
-
const { syncKitSetup } = yield* promise(() => import("./chunk-
|
|
736
|
+
const { syncKitSetup } = yield* promise(() => import("./chunk-drsawp1s.js"));
|
|
737
737
|
const harnesses = yield* syncTargets(input.harness);
|
|
738
738
|
const chain = yield* input.client.getKitChain(input.workspaceId);
|
|
739
739
|
for (const { name, problem } of chain.skipped)
|
|
@@ -1249,7 +1249,7 @@ var ServiceManager = Reference("kitman/cli/ServiceManager", {
|
|
|
1249
1249
|
run: (command, args) => runCommand2(command, args),
|
|
1250
1250
|
attach: (command, args) => gen(function* () {
|
|
1251
1251
|
const spawner = yield* ChildProcessSpawner;
|
|
1252
|
-
const handle = yield* spawner.spawn(
|
|
1252
|
+
const handle = yield* spawner.spawn(make2(command, args, { stdin: "inherit", stdout: "inherit", stderr: "inherit" }));
|
|
1253
1253
|
const exitCode = yield* handle.exitCode;
|
|
1254
1254
|
if (exitCode !== 0)
|
|
1255
1255
|
return yield* new CommandFailed2({ command, reason: `exit code ${exitCode}` });
|
|
@@ -1651,7 +1651,7 @@ var package_default = {
|
|
|
1651
1651
|
};
|
|
1652
1652
|
|
|
1653
1653
|
// apps/cli/src/scaffold.ts
|
|
1654
|
-
var cliVersion = "0.10.
|
|
1654
|
+
var cliVersion = "0.10.69";
|
|
1655
1655
|
var packageJson = (name, scaffold) => `${JSON.stringify({
|
|
1656
1656
|
name,
|
|
1657
1657
|
private: true,
|
|
@@ -1901,7 +1901,7 @@ var Usage = [
|
|
|
1901
1901
|
"Every run, loop, agent, verify, constraint, secret, claim, deploy, dev and kit command takes --json."
|
|
1902
1902
|
].join(`
|
|
1903
1903
|
`);
|
|
1904
|
-
var agentRuntime = promise(() => import("./chunk-
|
|
1904
|
+
var agentRuntime = promise(() => import("./chunk-kqcrxea1.js"));
|
|
1905
1905
|
var TuiLauncher = Reference("kitman/cli/TuiLauncher", {
|
|
1906
1906
|
defaultValue: () => gen(function* () {
|
|
1907
1907
|
const tui = yield* tryPromise({
|
|
@@ -2756,7 +2756,7 @@ var SandboxHostProbe = Reference("kitman/cli/SandboxHostProbe", {
|
|
|
2756
2756
|
});
|
|
2757
2757
|
var OpenRunnerRpc = Reference("kitman/cli/OpenRunnerRpc", {
|
|
2758
2758
|
defaultValue: () => (options) => gen(function* () {
|
|
2759
|
-
const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-
|
|
2759
|
+
const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-9m14d9d8.js"));
|
|
2760
2760
|
return yield* makeRunnerRpcClient({
|
|
2761
2761
|
runnerId: options.runnerId,
|
|
2762
2762
|
bearer: options.bearer,
|
|
@@ -2951,7 +2951,7 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
2951
2951
|
});
|
|
2952
2952
|
const checkouts = runCheckouts(path.join(runnerRootDir, ".kitman"), rpc.gitCredential);
|
|
2953
2953
|
const platform = yield* context();
|
|
2954
|
-
const updated = yield*
|
|
2954
|
+
const updated = yield* make15();
|
|
2955
2955
|
const scope = yield* scope2;
|
|
2956
2956
|
yield* listenForSignals({
|
|
2957
2957
|
rpc,
|
|
@@ -3140,7 +3140,7 @@ function mcpCommand(args) {
|
|
|
3140
3140
|
if (command.action === "run") {
|
|
3141
3141
|
if (command.args.length > 0)
|
|
3142
3142
|
return yield* new CliError({ message: `Unknown command: ${args.join(" ")}` });
|
|
3143
|
-
const { runMcpServerCommand } = yield* promise(() => import("./chunk-
|
|
3143
|
+
const { runMcpServerCommand } = yield* promise(() => import("./chunk-20qadzgw.js"));
|
|
3144
3144
|
return yield* runMcpServerCommand({ flags: command.flags });
|
|
3145
3145
|
}
|
|
3146
3146
|
if (command.action !== "setup")
|
|
@@ -4342,9 +4342,9 @@ function claimCommand(args) {
|
|
|
4342
4342
|
}
|
|
4343
4343
|
});
|
|
4344
4344
|
}
|
|
4345
|
-
var KitWriter = map8(promise(() => import("./chunk-
|
|
4345
|
+
var KitWriter = map8(promise(() => import("./chunk-j4pmjnyd.js")), (build) => build.writeKit);
|
|
4346
4346
|
var KitBuilder = Reference("kitman/cli/KitBuilder", {
|
|
4347
|
-
defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-
|
|
4347
|
+
defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-j4pmjnyd.js")), (build) => build.buildKit(directory))
|
|
4348
4348
|
});
|
|
4349
4349
|
var uploadKit = (client, workspaceId, built) => gen(function* () {
|
|
4350
4350
|
yield* client.uploadKitBundle(workspaceId, built.digest, { bundle: encode2(built.bundle) });
|
|
@@ -5102,7 +5102,7 @@ function downloadPresignedAsset(download, outputPath) {
|
|
|
5102
5102
|
return gen(function* () {
|
|
5103
5103
|
const fs = yield* FileSystem;
|
|
5104
5104
|
const failed = (cause) => new CliError({ message: `Asset download failed: ${String(cause)}` });
|
|
5105
|
-
const response = yield* send(
|
|
5105
|
+
const response = yield* send(make4(download.method)(download.url), failed);
|
|
5106
5106
|
if (response.status < 200 || response.status >= 300)
|
|
5107
5107
|
return yield* new CliError({ message: `Asset download failed with ${response.status}` });
|
|
5108
5108
|
const body = yield* response.arrayBuffer.pipe(mapError2((error) => failed(error.message)));
|
|
@@ -24,11 +24,11 @@ import {
|
|
|
24
24
|
Record,
|
|
25
25
|
Int,
|
|
26
26
|
fromJsonString
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-677etczq.js";
|
|
28
28
|
import {
|
|
29
29
|
withDefault,
|
|
30
30
|
String2
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-qdyqc4nz.js";
|
|
32
32
|
import {
|
|
33
33
|
digestSha256,
|
|
34
34
|
digestSha512,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
get2,
|
|
39
39
|
layer4,
|
|
40
40
|
KitDigest
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-n0pm4rtm.js";
|
|
42
42
|
|
|
43
43
|
// packages/core/src/npm-registry.ts
|
|
44
44
|
var KitManifest = Struct({
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
isObject,
|
|
6
6
|
isJsonObject,
|
|
7
7
|
isString
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-h6360r1c.js";
|
|
9
9
|
import {
|
|
10
10
|
pipeArguments,
|
|
11
11
|
dual,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
isFailure2,
|
|
43
43
|
hasInterrupts,
|
|
44
44
|
makeUnsafe5,
|
|
45
|
-
|
|
45
|
+
make15,
|
|
46
46
|
_await,
|
|
47
47
|
fail5,
|
|
48
48
|
isDoneUnsafe,
|
|
@@ -156,11 +156,11 @@ import {
|
|
|
156
156
|
encodePrettyJsonString,
|
|
157
157
|
decodeJsonStringSync,
|
|
158
158
|
encodeUnknownJsonStringSync
|
|
159
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-677etczq.js";
|
|
160
160
|
import {
|
|
161
161
|
Id,
|
|
162
162
|
secretReference
|
|
163
|
-
} from "./chunk-
|
|
163
|
+
} from "./chunk-wnwyp9qn.js";
|
|
164
164
|
import {
|
|
165
165
|
currentTimeMillis,
|
|
166
166
|
SecureRandom,
|
|
@@ -225,7 +225,7 @@ import {
|
|
|
225
225
|
installCommand,
|
|
226
226
|
checkServicesFile,
|
|
227
227
|
checkServices
|
|
228
|
-
} from "./chunk-
|
|
228
|
+
} from "./chunk-n0pm4rtm.js";
|
|
229
229
|
import {
|
|
230
230
|
join,
|
|
231
231
|
interrupt,
|
|
@@ -234,7 +234,7 @@ import {
|
|
|
234
234
|
unbounded2,
|
|
235
235
|
offer,
|
|
236
236
|
makeUnsafe3,
|
|
237
|
-
|
|
237
|
+
make10,
|
|
238
238
|
fromQueue,
|
|
239
239
|
fromPubSub,
|
|
240
240
|
map2,
|
|
@@ -265,7 +265,7 @@ import {
|
|
|
265
265
|
writeSrtSettings2,
|
|
266
266
|
srtStepArgv2,
|
|
267
267
|
srtArgv2
|
|
268
|
-
} from "./chunk-
|
|
268
|
+
} from "./chunk-qdyqc4nz.js";
|
|
269
269
|
import {
|
|
270
270
|
writeAgentEnvironmentConfigFile2,
|
|
271
271
|
readManifestSkillPaths2,
|
|
@@ -281,8 +281,8 @@ import {
|
|
|
281
281
|
applyAgentEnvironmentMaterialization2,
|
|
282
282
|
isPathWithin2,
|
|
283
283
|
skillIdentity2
|
|
284
|
-
} from "./chunk-
|
|
285
|
-
import"./chunk-
|
|
284
|
+
} from "./chunk-gswz7ngm.js";
|
|
285
|
+
import"./chunk-k7mn104k.js";
|
|
286
286
|
import {
|
|
287
287
|
sliceBytes2,
|
|
288
288
|
maxLineBytes2,
|
|
@@ -290,28 +290,28 @@ import {
|
|
|
290
290
|
decodedOption2,
|
|
291
291
|
decoded2,
|
|
292
292
|
readOpencode2
|
|
293
|
-
} from "./chunk-
|
|
293
|
+
} from "./chunk-zdctyf0w.js";
|
|
294
294
|
import {
|
|
295
295
|
writeSecretRegistry,
|
|
296
296
|
secretRefusalLog,
|
|
297
297
|
parseSecretRefusals
|
|
298
|
-
} from "./chunk-
|
|
298
|
+
} from "./chunk-rzr11xyn.js";
|
|
299
299
|
import {
|
|
300
300
|
uploadRunFile,
|
|
301
301
|
programLease,
|
|
302
302
|
rpcRunFiles,
|
|
303
303
|
programHostsEnv,
|
|
304
304
|
undeclaredHostsEnv
|
|
305
|
-
} from "./chunk-
|
|
306
|
-
import"./chunk-
|
|
305
|
+
} from "./chunk-q9n4jkcp.js";
|
|
306
|
+
import"./chunk-qpg9t7he.js";
|
|
307
307
|
import {
|
|
308
308
|
nextInt
|
|
309
|
-
} from "./chunk-
|
|
309
|
+
} from "./chunk-p23kedha.js";
|
|
310
310
|
import {
|
|
311
311
|
ChildProcessSpawner,
|
|
312
|
-
|
|
313
|
-
} from "./chunk-
|
|
314
|
-
import"./chunk-
|
|
312
|
+
make2
|
|
313
|
+
} from "./chunk-tf5yxkpy.js";
|
|
314
|
+
import"./chunk-q26gt71y.js";
|
|
315
315
|
|
|
316
316
|
// packages/core/src/sync-kit.ts
|
|
317
317
|
import { createHash } from "crypto";
|
|
@@ -5836,7 +5836,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
|
|
|
5836
5836
|
const input = yield* unbounded2();
|
|
5837
5837
|
const pending = new Map;
|
|
5838
5838
|
let lastId = 0;
|
|
5839
|
-
const handle = yield* spawner.spawn(
|
|
5839
|
+
const handle = yield* spawner.spawn(make2(binary, ["app-server"], {
|
|
5840
5840
|
cwd: env.home,
|
|
5841
5841
|
extendEnv: true,
|
|
5842
5842
|
env: { HOME: env.home, CODEX_HOME: env.codexHome },
|
|
@@ -5859,7 +5859,7 @@ var codexAppServer = (binary = "codex") => (env) => gen(function* () {
|
|
|
5859
5859
|
return {
|
|
5860
5860
|
request: (method, params) => gen(function* () {
|
|
5861
5861
|
const id = ++lastId;
|
|
5862
|
-
const deferred = yield*
|
|
5862
|
+
const deferred = yield* make15();
|
|
5863
5863
|
pending.set(id, deferred);
|
|
5864
5864
|
yield* send({ id, method, params });
|
|
5865
5865
|
return yield* _await(deferred).pipe(mapError2((error) => new CodexAppServerFailed({ reason: `${method}: ${error.message}` })));
|
|
@@ -5999,10 +5999,10 @@ var handshake = [
|
|
|
5999
5999
|
`).join("");
|
|
6000
6000
|
var kitmanMcpPreflight = (mcp) => gen(function* () {
|
|
6001
6001
|
const spawner = yield* ChildProcessSpawner;
|
|
6002
|
-
const server = yield* spawner.spawn(
|
|
6002
|
+
const server = yield* spawner.spawn(make2(mcp.command, [...mcp.args], {
|
|
6003
6003
|
extendEnv: true,
|
|
6004
6004
|
env: mcp.env,
|
|
6005
|
-
stdin: { stream:
|
|
6005
|
+
stdin: { stream: make10(new TextEncoder().encode(handshake)), endOnDone: false },
|
|
6006
6006
|
stderr: "ignore"
|
|
6007
6007
|
}));
|
|
6008
6008
|
const reply = yield* server.stdout.pipe(decodeText, splitLines, map2((line) => getOrUndefined(decodeJsonStringOption(line))), filter((message) => isJsonObject(message) && message.id === 2), runHead);
|
|
@@ -6075,8 +6075,8 @@ var programProcessExecutor = (input) => (work) => gen(function* () {
|
|
|
6075
6075
|
};
|
|
6076
6076
|
const exitCode = sandbox === undefined ? yield* gen(function* () {
|
|
6077
6077
|
const spawner = yield* ChildProcessSpawner;
|
|
6078
|
-
const handle = yield* spawner.spawn(
|
|
6079
|
-
stdin:
|
|
6078
|
+
const handle = yield* spawner.spawn(make2(input.bun ?? process.execPath, [file], {
|
|
6079
|
+
stdin: make10(new TextEncoder().encode(stdin)),
|
|
6080
6080
|
stdout: "inherit",
|
|
6081
6081
|
stderr: "inherit",
|
|
6082
6082
|
extendEnv: false,
|
|
@@ -6443,15 +6443,115 @@ class InstallFailed extends TaggedError("InstallFailed") {
|
|
|
6443
6443
|
return `\`${this.command}\` failed, so nothing could run in the checkout: ${this.output}`;
|
|
6444
6444
|
}
|
|
6445
6445
|
}
|
|
6446
|
+
var closing = /(?:\s|\/\/[^\n]*|\/\*[\s\S]*?\*\/)*[}\]]/y;
|
|
6447
|
+
var closesNext = (text, at) => {
|
|
6448
|
+
closing.lastIndex = at;
|
|
6449
|
+
return closing.test(text);
|
|
6450
|
+
};
|
|
6451
|
+
var jsonFromJsonc = (text) => {
|
|
6452
|
+
let json = "";
|
|
6453
|
+
for (let at = 0;at < text.length; at++) {
|
|
6454
|
+
const char = text[at];
|
|
6455
|
+
if (char === '"') {
|
|
6456
|
+
const from = at;
|
|
6457
|
+
for (at++;at < text.length && text[at] !== '"'; at++)
|
|
6458
|
+
if (text[at] === "\\")
|
|
6459
|
+
at++;
|
|
6460
|
+
json += text.slice(from, at + 1);
|
|
6461
|
+
} else if (char === "/" && text[at + 1] === "/") {
|
|
6462
|
+
while (at < text.length && text[at] !== `
|
|
6463
|
+
`)
|
|
6464
|
+
at++;
|
|
6465
|
+
} else if (char === "/" && text[at + 1] === "*") {
|
|
6466
|
+
at = text.indexOf("*/", at + 2);
|
|
6467
|
+
if (at === -1)
|
|
6468
|
+
return json;
|
|
6469
|
+
at++;
|
|
6470
|
+
} else if (char !== "," || !closesNext(text, at + 1))
|
|
6471
|
+
json += char;
|
|
6472
|
+
}
|
|
6473
|
+
return json;
|
|
6474
|
+
};
|
|
6475
|
+
var declaredNames = (manifest, fields) => {
|
|
6476
|
+
if (!isJsonObject(manifest))
|
|
6477
|
+
return [];
|
|
6478
|
+
const optional = isJsonObject(manifest.optionalDependencies) ? Object.keys(manifest.optionalDependencies) : [];
|
|
6479
|
+
return fields.flatMap((field) => {
|
|
6480
|
+
const declared = manifest[field];
|
|
6481
|
+
return isJsonObject(declared) ? Object.keys(declared).filter((name) => !optional.includes(name)) : [];
|
|
6482
|
+
});
|
|
6483
|
+
};
|
|
6484
|
+
var unresolvedDependencies = (worktree) => gen(function* () {
|
|
6485
|
+
const fs = yield* FileSystem;
|
|
6486
|
+
const path = yield* Path;
|
|
6487
|
+
const lockfile = path.join(worktree, "bun.lock");
|
|
6488
|
+
if (!(yield* fs.exists(lockfile)))
|
|
6489
|
+
return [];
|
|
6490
|
+
const parsed = getOrUndefined(decodeJsonStringOption(jsonFromJsonc(yield* fs.readFileString(lockfile))));
|
|
6491
|
+
if (!isJsonObject(parsed))
|
|
6492
|
+
return yield* new InstallFailed({ command: "reading bun.lock", output: "bun.lock is not valid JSONC" });
|
|
6493
|
+
const workspaces = isJsonObject(parsed.workspaces) ? parsed.workspaces : {};
|
|
6494
|
+
const store = path.join(worktree, "node_modules", ".bun");
|
|
6495
|
+
const within = (root, dir) => !path.relative(root, dir).startsWith("..");
|
|
6496
|
+
const linkedWithin = (dir) => within(store, dir) ? path.join(store, path.relative(store, dir).split(path.sep)[0] ?? "") : worktree;
|
|
6497
|
+
const located = (dir, name, root) => gen(function* () {
|
|
6498
|
+
const candidate = path.join(dir, "node_modules", name);
|
|
6499
|
+
if (yield* fs.exists(path.join(candidate, "package.json")))
|
|
6500
|
+
return yield* fs.realPath(candidate);
|
|
6501
|
+
const parent = path.dirname(dir);
|
|
6502
|
+
return dir === root || parent === dir || !within(root, parent) ? undefined : yield* located(parent, name, root);
|
|
6503
|
+
}).pipe(orElseSucceed(() => {
|
|
6504
|
+
return;
|
|
6505
|
+
}));
|
|
6506
|
+
const manifestAt = (dir) => fs.readFileString(path.join(dir, "package.json")).pipe(map8((text) => getOrUndefined(decodeJsonStringOption(text))), orElseSucceed(() => {
|
|
6507
|
+
return;
|
|
6508
|
+
}));
|
|
6509
|
+
const unresolved = [];
|
|
6510
|
+
const visited = new Set;
|
|
6511
|
+
let due = [];
|
|
6512
|
+
for (const [dir, workspace] of Object.entries(workspaces))
|
|
6513
|
+
due.push({
|
|
6514
|
+
from: path.join(worktree, dir),
|
|
6515
|
+
label: dir === "" ? "." : dir,
|
|
6516
|
+
names: declaredNames(workspace, ["dependencies", "devDependencies"])
|
|
6517
|
+
});
|
|
6518
|
+
while (due.length > 0) {
|
|
6519
|
+
const next = [];
|
|
6520
|
+
yield* forEach(due, ({ from, label, names }) => forEach(names, (name) => gen(function* () {
|
|
6521
|
+
const found = yield* located(from, name, linkedWithin(from));
|
|
6522
|
+
if (found === undefined)
|
|
6523
|
+
return unresolved.push(`${label} cannot resolve ${name}`);
|
|
6524
|
+
if (visited.has(found))
|
|
6525
|
+
return;
|
|
6526
|
+
visited.add(found);
|
|
6527
|
+
next.push({
|
|
6528
|
+
from: found,
|
|
6529
|
+
label: name,
|
|
6530
|
+
names: declaredNames(yield* manifestAt(found), ["dependencies"])
|
|
6531
|
+
});
|
|
6532
|
+
}), { discard: true }), { concurrency: 16, discard: true });
|
|
6533
|
+
due = next;
|
|
6534
|
+
}
|
|
6535
|
+
return unresolved.toSorted();
|
|
6536
|
+
});
|
|
6446
6537
|
var installIn = (worktree, run) => gen(function* () {
|
|
6447
6538
|
const files = yield* FileSystem;
|
|
6448
6539
|
const install = installCommand(yield* files.readDirectory(worktree));
|
|
6449
6540
|
if (install === undefined)
|
|
6450
6541
|
return;
|
|
6451
6542
|
const filesDir = yield* files.makeTempDirectoryScoped({ prefix: "kitman-check-files-" });
|
|
6452
|
-
const
|
|
6453
|
-
|
|
6454
|
-
|
|
6543
|
+
const installWith = (command) => gen(function* () {
|
|
6544
|
+
const installed = yield* run({ command, cwd: worktree, filesDir });
|
|
6545
|
+
if (installed.exitCode !== 0)
|
|
6546
|
+
return yield* new InstallFailed({ command, output: redactedOutputTail(installed.output, 2000) });
|
|
6547
|
+
return yield* unresolvedDependencies(worktree);
|
|
6548
|
+
});
|
|
6549
|
+
if ((yield* installWith(install)).length === 0 || !install.startsWith("bun install"))
|
|
6550
|
+
return;
|
|
6551
|
+
const forced = `${install} --force`;
|
|
6552
|
+
const unresolved = yield* installWith(forced);
|
|
6553
|
+
if (unresolved.length > 0)
|
|
6554
|
+
return yield* new InstallFailed({ command: forced, output: unresolved.join("; ") });
|
|
6455
6555
|
});
|
|
6456
6556
|
var runChecks = (worktree, checks, tree, known, run, keeper, services) => gen(function* () {
|
|
6457
6557
|
const path = yield* Path;
|