@kitman-sh/cli 0.7.3 → 0.7.4

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/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
3
  import {
4
- pipeArguments,
5
4
  identity,
6
5
  isUndefined,
7
6
  isNotUndefined,
@@ -20,12 +19,8 @@ import {
20
19
  fromUndefinedOr,
21
20
  getOrUndefined,
22
21
  Service,
23
- add,
24
- get,
25
22
  Reference,
26
23
  of,
27
- fromInputUnsafe,
28
- isFinite,
29
24
  toMillis,
30
25
  TaggedError,
31
26
  squash,
@@ -34,19 +29,12 @@ import {
34
29
  UnknownError,
35
30
  succeed2,
36
31
  fail2,
37
- void_,
38
- isSuccess2,
39
- isFailure2,
40
32
  makeUnsafe,
41
33
  _await,
42
34
  isDone,
43
35
  isDoneUnsafe,
44
36
  doneUnsafe,
45
- Scope,
46
- makeUnsafe2,
47
- addFinalizerExit,
48
37
  addFinalizer,
49
- close,
50
38
  succeed4,
51
39
  effect,
52
40
  mergeAll,
@@ -66,8 +54,7 @@ import {
66
54
  gen,
67
55
  fail4,
68
56
  try_,
69
- withFiber,
70
- flatMap,
57
+ flatMap2,
71
58
  andThen,
72
59
  tap,
73
60
  map3,
@@ -86,31 +73,22 @@ import {
86
73
  provide3,
87
74
  provideContext,
88
75
  provideService,
89
- scope,
90
76
  scoped,
91
77
  acquireRelease,
92
78
  addFinalizer2,
93
79
  ensuring,
94
- onExit,
95
- interrupt2,
96
80
  uninterruptible,
97
- uninterruptibleMask,
98
81
  forever,
99
82
  forkScoped,
100
- runForkWith,
101
83
  fnUntraced,
102
84
  logWarning,
103
85
  logError,
104
86
  runMain,
105
87
  systemError,
106
88
  badArgument,
107
- join,
108
- interrupt3,
109
- getCurrent,
110
- runIn,
111
89
  makeUnsafe3,
112
- make7,
113
90
  make8,
91
+ make9,
114
92
  offerUnsafe,
115
93
  endUnsafe,
116
94
  take,
@@ -120,6 +98,8 @@ import {
120
98
  isSink,
121
99
  fromChannel,
122
100
  drain,
101
+ make10,
102
+ get2,
123
103
  isStream,
124
104
  fromChannel2,
125
105
  empty2,
@@ -135,9 +115,9 @@ import {
135
115
  ExitCode,
136
116
  ProcessId,
137
117
  makeHandle,
138
- make10,
118
+ make12,
139
119
  ChildProcessSpawner,
140
- make11,
120
+ make13,
141
121
  parseFdName,
142
122
  fdName,
143
123
  handleErrnoException,
@@ -203,8 +183,8 @@ import {
203
183
  agentCredentialForApi,
204
184
  storeAgentCredential,
205
185
  raw,
206
- make12,
207
- get2,
186
+ make14,
187
+ get3,
208
188
  put,
209
189
  execute,
210
190
  Fetch,
@@ -227,146 +207,7 @@ import {
227
207
  runCommand2,
228
208
  detectHarnesses2,
229
209
  herdrRunnerCapabilities2
230
- } from "./chunk-8g2twwm8.js";
231
-
232
- // node_modules/.bun/effect@4.0.4/node_modules/effect/dist/internal/rcRef.js
233
- var TypeId = "~effect/RcRef";
234
- var stateEmpty = {
235
- _tag: "Empty"
236
- };
237
- var stateClosed = {
238
- _tag: "Closed"
239
- };
240
- var variance = {
241
- _A: identity,
242
- _E: identity
243
- };
244
-
245
- class RcRefImpl {
246
- [TypeId] = variance;
247
- pipe() {
248
- return pipeArguments(this, arguments);
249
- }
250
- state = stateEmpty;
251
- acquire;
252
- context;
253
- scope;
254
- idleTimeToLive;
255
- constructor(acquire, context, scope, idleTimeToLive) {
256
- this.acquire = acquire;
257
- this.context = context;
258
- this.scope = scope;
259
- this.idleTimeToLive = idleTimeToLive;
260
- }
261
- }
262
- var make = (options) => withFiber((fiber) => {
263
- const context = fiber.context;
264
- const scope = get(context, Scope);
265
- const ref = new RcRefImpl(options.acquire, context, scope, options.idleTimeToLive !== undefined ? fromInputUnsafe(options.idleTimeToLive) : undefined);
266
- return as(addFinalizerExit(scope, () => {
267
- const state = ref.state;
268
- ref.state = stateClosed;
269
- if (state._tag === "Acquired")
270
- return close(state.scope, void_);
271
- if (state._tag === "Acquiring")
272
- return interrupt3(state.fiber);
273
- return void_2;
274
- }), ref);
275
- });
276
- var getState = (self, restore) => {
277
- switch (self.state._tag) {
278
- case "Closed": {
279
- return interrupt2;
280
- }
281
- case "Acquired": {
282
- const state = self.state;
283
- state.refCount++;
284
- return state.fiber ? as(interrupt3(state.fiber), state) : succeed5(state);
285
- }
286
- case "Acquiring": {
287
- const state = self.state;
288
- state.awaiters++;
289
- return awaitAcquiring(self, state, restore);
290
- }
291
- case "Empty": {
292
- const acquiring = {
293
- _tag: "Acquiring",
294
- fiber: undefined,
295
- awaiters: 1,
296
- acquired: undefined
297
- };
298
- self.state = acquiring;
299
- const scope = makeUnsafe2();
300
- const acquire = provideContext(self.acquire, add(self.context, Scope, scope)).pipe(flatMap((value) => {
301
- if (self.state !== acquiring) {
302
- return interrupt2;
303
- }
304
- const state = {
305
- _tag: "Acquired",
306
- value,
307
- scope,
308
- fiber: undefined,
309
- refCount: acquiring.awaiters,
310
- invalidated: false
311
- };
312
- self.state = state;
313
- acquiring.acquired = state;
314
- return succeed5(state);
315
- }), onExit((exit) => {
316
- if (isSuccess2(exit))
317
- return void_2;
318
- if (self.state === acquiring)
319
- self.state = stateEmpty;
320
- return close(scope, exit);
321
- }));
322
- acquiring.fiber = runForkWith(getCurrent().context)(acquire);
323
- return awaitAcquiring(self, acquiring, restore);
324
- }
325
- }
326
- };
327
- var awaitAcquiring = (self, acquiring, restore) => onExit(restore(join(acquiring.fiber)), (exit) => {
328
- const acquired = acquiring.acquired;
329
- if (acquired !== undefined) {
330
- return isFailure2(exit) ? release(self, acquired) : void_2;
331
- }
332
- if (--acquiring.awaiters > 0 || self.state !== acquiring)
333
- return void_2;
334
- self.state = stateEmpty;
335
- return interrupt3(acquiring.fiber);
336
- });
337
- var get3 = (self_) => {
338
- const self = self_;
339
- return uninterruptibleMask((restore) => flatMap(scope, (scope) => flatMap(getState(self, restore), (state) => as(addFinalizerExit(scope, () => release(self, state)), state.value))));
340
- };
341
- var release = (self, state) => {
342
- state.refCount--;
343
- if (state.refCount > 0) {
344
- return void_2;
345
- }
346
- const idleTimeToLive = self.idleTimeToLive;
347
- if (idleTimeToLive === undefined || state.invalidated) {
348
- if (self.state === state) {
349
- self.state = stateEmpty;
350
- }
351
- return close(state.scope, void_);
352
- } else if (!isFinite(idleTimeToLive)) {
353
- return void_2;
354
- }
355
- state.fiber = uninterruptibleMask((restore) => flatMap(restore(sleep(idleTimeToLive)), () => {
356
- if (self.state === state && state.refCount === 0) {
357
- self.state = stateEmpty;
358
- return close(state.scope, void_);
359
- }
360
- return void_2;
361
- })).pipe(ensuring(sync(() => {
362
- state.fiber = undefined;
363
- })), runForkWith(self.context), runIn(self.scope));
364
- return void_2;
365
- };
366
-
367
- // node_modules/.bun/effect@4.0.4/node_modules/effect/dist/RcRef.js
368
- var make2 = make;
369
- var get4 = get3;
210
+ } from "./chunk-jd09xfx0.js";
370
211
 
371
212
  // node_modules/.bun/@effect+platform-node-shared@4.0.4+b8cbb99ebc524863/node_modules/@effect/platform-node-shared/dist/NodeChildProcessSpawner.js
372
213
  import * as NodeChildProcess from "child_process";
@@ -393,7 +234,7 @@ var fromWritableChannel = (options) => fromTransform((pull) => {
393
234
  pull
394
235
  }));
395
236
  });
396
- var pullIntoWritable = (options) => options.pull.pipe(flatMap((chunk) => {
237
+ var pullIntoWritable = (options) => options.pull.pipe(flatMap2((chunk) => {
397
238
  let i = 0;
398
239
  return callback((resume) => {
399
240
  let cancelled = false;
@@ -454,7 +295,7 @@ var fromReadableChannel = (options) => fromTransform((_, scope) => readableToPul
454
295
  var readableToPullUnsafe = (options) => {
455
296
  const readable = options.readable;
456
297
  const closeOnDone = options.closeOnDone ?? true;
457
- const exit = options.exit ?? make7(undefined);
298
+ const exit = options.exit ?? make8(undefined);
458
299
  const latch = options.latch ?? makeUnsafe3(false);
459
300
  function onReadable() {
460
301
  latch.openUnsafe();
@@ -480,7 +321,7 @@ var readableToPullUnsafe = (options) => {
480
321
  return fail4(Done());
481
322
  }
482
323
  latch.closeUnsafe();
483
- return flatMap(latch.await, loop);
324
+ return flatMap2(latch.await, loop);
484
325
  }
485
326
  const chunk = of(item);
486
327
  while (true) {
@@ -544,7 +385,7 @@ var taskkill = (childProcess, onExit = () => {}) => {
544
385
  windowsHide: true
545
386
  }, onExit);
546
387
  };
547
- var make3 = /* @__PURE__ */ gen(function* () {
388
+ var make = /* @__PURE__ */ gen(function* () {
548
389
  const fs = yield* FileSystem;
549
390
  const path = yield* Path;
550
391
  const resolveWorkingDirectory = fnUntraced(function* (options) {
@@ -910,7 +751,7 @@ var make3 = /* @__PURE__ */ gen(function* () {
910
751
  getOutputFd
911
752
  } = yield* setupAdditionalFds(cmd, childProcess, resolvedAdditionalFds);
912
753
  const isRunning = map3(isDone(exitSignal), (done) => !done);
913
- const exitCode = flatMap(_await(exitSignal), ([code, signal]) => {
754
+ const exitCode = flatMap2(_await(exitSignal), ([code, signal]) => {
914
755
  if (isNotNull(code)) {
915
756
  return succeed5(ExitCode(code));
916
757
  }
@@ -946,7 +787,7 @@ var make3 = /* @__PURE__ */ gen(function* () {
946
787
  const sourceStream = unwrap(succeed5(getSourceStream(handles[handles.length - 1], options.from)));
947
788
  const toOption = options.to ?? "stdin";
948
789
  if (toOption === "stdin") {
949
- handles.push(yield* spawnCommand(make11(command.command, command.args, {
790
+ handles.push(yield* spawnCommand(make13(command.command, command.args, {
950
791
  ...command.options,
951
792
  stdin: {
952
793
  ...stdinConfig,
@@ -958,7 +799,7 @@ var make3 = /* @__PURE__ */ gen(function* () {
958
799
  if (isNotUndefined(fd)) {
959
800
  const fdName2 = fdName(fd);
960
801
  const existingFds = command.options.additionalFds ?? {};
961
- handles.push(yield* spawnCommand(make11(command.command, command.args, {
802
+ handles.push(yield* spawnCommand(make13(command.command, command.args, {
962
803
  ...command.options,
963
804
  additionalFds: {
964
805
  ...existingFds,
@@ -969,7 +810,7 @@ var make3 = /* @__PURE__ */ gen(function* () {
969
810
  }
970
811
  })));
971
812
  } else {
972
- handles.push(yield* spawnCommand(make11(command.command, command.args, {
813
+ handles.push(yield* spawnCommand(make13(command.command, command.args, {
973
814
  ...command.options,
974
815
  stdin: {
975
816
  ...stdinConfig,
@@ -1008,9 +849,9 @@ var make3 = /* @__PURE__ */ gen(function* () {
1008
849
  }
1009
850
  }
1010
851
  });
1011
- return make10(spawnCommand);
852
+ return make12(spawnCommand);
1012
853
  });
1013
- var layer5 = /* @__PURE__ */ effect(ChildProcessSpawner, make3);
854
+ var layer5 = /* @__PURE__ */ effect(ChildProcessSpawner, make);
1014
855
  var flattenCommand = (command) => {
1015
856
  const commands = [];
1016
857
  const pipeOptions = [];
@@ -1041,10 +882,10 @@ var flattenCommand = (command) => {
1041
882
  };
1042
883
 
1043
884
  // node_modules/.bun/effect@4.0.4/node_modules/effect/dist/Stdio.js
1044
- var TypeId2 = "~effect/Stdio";
1045
- var Stdio = /* @__PURE__ */ Service(TypeId2);
1046
- var make4 = (options) => ({
1047
- [TypeId2]: TypeId2,
885
+ var TypeId = "~effect/Stdio";
886
+ var Stdio = /* @__PURE__ */ Service(TypeId);
887
+ var make2 = (options) => ({
888
+ [TypeId]: TypeId,
1048
889
  stdinIsTerminal: succeed5(false),
1049
890
  stdoutIsTerminal: succeed5(false),
1050
891
  stderrIsTerminal: succeed5(false),
@@ -1052,7 +893,7 @@ var make4 = (options) => ({
1052
893
  });
1053
894
 
1054
895
  // node_modules/.bun/@effect+platform-node-shared@4.0.4+b8cbb99ebc524863/node_modules/@effect/platform-node-shared/dist/NodeStdio.js
1055
- var layer6 = /* @__PURE__ */ succeed4(Stdio, /* @__PURE__ */ make4({
896
+ var layer6 = /* @__PURE__ */ succeed4(Stdio, /* @__PURE__ */ make2({
1056
897
  args: /* @__PURE__ */ sync(() => process.argv.slice(2)),
1057
898
  stdinIsTerminal: /* @__PURE__ */ sync(() => process.stdin.isTTY === true),
1058
899
  stdoutIsTerminal: /* @__PURE__ */ sync(() => process.stdout.isTTY === true),
@@ -1093,7 +934,7 @@ var layer6 = /* @__PURE__ */ succeed4(Stdio, /* @__PURE__ */ make4({
1093
934
  var layer7 = layer6;
1094
935
 
1095
936
  // node_modules/.bun/effect@4.0.4/node_modules/effect/dist/Terminal.js
1096
- var TypeId3 = "~effect/Terminal";
937
+ var TypeId2 = "~effect/Terminal";
1097
938
  var QuitErrorTypeId = "~effect/Terminal/QuitError";
1098
939
 
1099
940
  class QuitError extends (/* @__PURE__ */ Error2("QuitError")({
@@ -1102,17 +943,17 @@ class QuitError extends (/* @__PURE__ */ Error2("QuitError")({
1102
943
  [QuitErrorTypeId] = QuitErrorTypeId;
1103
944
  }
1104
945
  var Terminal = /* @__PURE__ */ Service("effect/Terminal");
1105
- var make5 = (impl) => Terminal.of({
946
+ var make3 = (impl) => Terminal.of({
1106
947
  ...impl,
1107
- [TypeId3]: TypeId3
948
+ [TypeId2]: TypeId2
1108
949
  });
1109
950
 
1110
951
  // node_modules/.bun/@effect+platform-node-shared@4.0.4+b8cbb99ebc524863/node_modules/@effect/platform-node-shared/dist/NodeTerminal.js
1111
952
  import * as readline from "readline";
1112
- var make6 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit) {
953
+ var make4 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit) {
1113
954
  const stdin = process.stdin;
1114
955
  const stdout = process.stdout;
1115
- const lines = yield* make8();
956
+ const lines = yield* make9();
1116
957
  let inputEnded = stdin.readableEnded;
1117
958
  let readlineActive = false;
1118
959
  const onStdinEnd = () => {
@@ -1123,7 +964,7 @@ var make6 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit
1123
964
  };
1124
965
  stdin.once("end", onStdinEnd);
1125
966
  yield* addFinalizer2(() => sync(() => stdin.off("end", onStdinEnd)));
1126
- const rlRef = yield* make2({
967
+ const rlRef = yield* make10({
1127
968
  acquire: acquireRelease(sync(() => {
1128
969
  const rl = readline.createInterface({
1129
970
  input: stdin,
@@ -1167,7 +1008,7 @@ var make6 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit
1167
1008
  const columns = sync(() => stdout.columns ?? 0);
1168
1009
  const rows = sync(() => stdout.rows ?? 0);
1169
1010
  const readInput = gen(function* () {
1170
- const queue = yield* make8();
1011
+ const queue = yield* make9();
1171
1012
  const handleKeypress = (s, k) => {
1172
1013
  const userInput = {
1173
1014
  input: fromUndefinedOr(s),
@@ -1197,13 +1038,13 @@ var make6 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit
1197
1038
  if (inputEnded) {
1198
1039
  handleEnd();
1199
1040
  } else {
1200
- yield* get4(rlRef);
1041
+ yield* get2(rlRef);
1201
1042
  stdin.once("end", handleEnd);
1202
1043
  }
1203
1044
  return queue;
1204
1045
  });
1205
- const readLine = suspend(() => poll(lines).pipe(flatMap(match({
1206
- onNone: () => scoped(andThen(get4(rlRef), take(lines))),
1046
+ const readLine = suspend(() => poll(lines).pipe(flatMap2(match({
1047
+ onNone: () => scoped(andThen(get2(rlRef), take(lines))),
1207
1048
  onSome: succeed5
1208
1049
  })), mapError(() => new QuitError({}))));
1209
1050
  const display = (prompt2) => uninterruptible(callback((resume) => {
@@ -1214,7 +1055,7 @@ var make6 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit
1214
1055
  cause: err
1215
1056
  }))));
1216
1057
  }));
1217
- return make5({
1058
+ return make3({
1218
1059
  columns,
1219
1060
  rows,
1220
1061
  readInput,
@@ -1222,7 +1063,7 @@ var make6 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit
1222
1063
  display
1223
1064
  });
1224
1065
  });
1225
- var layer8 = /* @__PURE__ */ effect(Terminal, /* @__PURE__ */ make6(defaultShouldQuit));
1066
+ var layer8 = /* @__PURE__ */ effect(Terminal, /* @__PURE__ */ make4(defaultShouldQuit));
1226
1067
  function defaultShouldQuit(input) {
1227
1068
  const key = input.key;
1228
1069
  return key.name === "escape" || key.ctrl && (key.name === "c" || key.name === "d");
@@ -1334,7 +1175,7 @@ function renderMaterializationPlan(plan) {
1334
1175
  harness: plan.harness,
1335
1176
  operations: plan.operations.map((operation) => ({
1336
1177
  kind: operation.kind,
1337
- skillName: operation.skillName,
1178
+ skillName: auditOperationName(operation),
1338
1179
  skillIdentityHash: hashIdentity(auditOperationIdentity(operation)),
1339
1180
  target: operation.kind === "symlink_skill" ? operation.targetPath : operation.path
1340
1181
  })),
@@ -1361,11 +1202,24 @@ function renderConfigPlan(plan) {
1361
1202
  warnings: plan.warnings.map((warning) => warning.message)
1362
1203
  };
1363
1204
  }
1205
+ function auditOperationName(operation) {
1206
+ if (operation.kind === "fetch_git_plugin")
1207
+ return operation.pluginName;
1208
+ if (operation.kind === "write_codex_marketplace" || operation.kind === "unlink_stale_links")
1209
+ return "kitman";
1210
+ return operation.skillName;
1211
+ }
1364
1212
  function auditOperationIdentity(operation) {
1365
1213
  if (operation.kind === "write_skill")
1366
1214
  return `write_skill:${operation.skillName}:content_sha256:${hashIdentity(operation.content)}:${operation.path}`;
1367
1215
  if (operation.kind === "fetch_git_skill")
1368
1216
  return `fetch_git_skill:${operation.skillName}:${operation.url}#${operation.ref}:${operation.repositoryPath ?? ""}:${operation.path}`;
1217
+ if (operation.kind === "fetch_git_plugin")
1218
+ return `fetch_git_plugin:${operation.pluginName}:${operation.url}#${operation.ref}:${operation.path}`;
1219
+ if (operation.kind === "write_codex_marketplace")
1220
+ return `write_codex_marketplace:content_sha256:${hashIdentity(operation.content)}:${operation.path}`;
1221
+ if (operation.kind === "unlink_stale_links")
1222
+ return `unlink_stale_links:${operation.sourceRoot}:${operation.keepPaths.join(",")}:${operation.path}`;
1369
1223
  return `symlink_skill:${operation.skillName}:symlink:${operation.sourcePath}:${operation.targetPath}`;
1370
1224
  }
1371
1225
  function auditMaterializedSkillIdentity(skill) {
@@ -1472,7 +1326,7 @@ function createOperationalCliClient(client) {
1472
1326
  };
1473
1327
  }
1474
1328
  function parseJsonInput(value, label) {
1475
- return decodeJsonString(value).pipe(mapError(() => new CliError({ message: `${label} requires valid JSON` })), flatMap((json) => isJsonObject(json) ? succeed5(json) : fail4(new CliError({ message: `${label} requires a JSON object` }))));
1329
+ return decodeJsonString(value).pipe(mapError(() => new CliError({ message: `${label} requires valid JSON` })), flatMap2((json) => isJsonObject(json) ? succeed5(json) : fail4(new CliError({ message: `${label} requires a JSON object` }))));
1476
1330
  }
1477
1331
  function idempotencyKey(value, operation) {
1478
1332
  const explicit = value?.trim();
@@ -1531,7 +1385,7 @@ import { hostname } from "os";
1531
1385
  var Git = Reference("kitman/cli/Git", {
1532
1386
  defaultValue: () => (args) => runCommand2("git", args).pipe(map3((stdout) => stdout.trim()))
1533
1387
  });
1534
- var repoBindingInputFromCurrentRepo = flatMap(Git, repoBindingInput);
1388
+ var repoBindingInputFromCurrentRepo = flatMap2(Git, repoBindingInput);
1535
1389
  function repoBindingInput(git) {
1536
1390
  return gen(function* () {
1537
1391
  const remoteUrl = yield* git(["remote", "get-url", "origin"]);
@@ -1794,7 +1648,7 @@ var kitmanCommand = () => {
1794
1648
  const [runtime, script] = process.argv;
1795
1649
  return script === undefined || script.startsWith("/$bunfs/") ? [process.execPath] : [runtime ?? process.execPath, script];
1796
1650
  };
1797
- var readText = (path) => flatMap(FileSystem, (fs) => fs.readFileString(path)).pipe(orElseSucceed(() => {
1651
+ var readText = (path) => flatMap2(FileSystem, (fs) => fs.readFileString(path)).pipe(orElseSucceed(() => {
1798
1652
  return;
1799
1653
  }));
1800
1654
  var verificationStep = (client, projectId, binding, confirm, step) => gen(function* () {
@@ -1933,7 +1787,7 @@ var package_default = {
1933
1787
  };
1934
1788
 
1935
1789
  // apps/cli/src/scaffold.ts
1936
- var cliVersion = "0.7.3";
1790
+ var cliVersion = "0.7.4";
1937
1791
  var packageJson = (name, scaffold) => `${JSON.stringify({
1938
1792
  name,
1939
1793
  private: true,
@@ -2053,7 +1907,7 @@ var scaffoldPackage = (directory, scaffold = {}) => gen(function* () {
2053
1907
  const path = yield* Path;
2054
1908
  const root = path.resolve(directory);
2055
1909
  if (scaffold.fork !== undefined) {
2056
- const { shippedLoops } = yield* promise(() => import("./chunk-80g9af03.js"));
1910
+ const { shippedLoops } = yield* promise(() => import("./chunk-jwtkec1w.js"));
2057
1911
  if (!(scaffold.fork in shippedLoops))
2058
1912
  return yield* new CliError({
2059
1913
  message: `Kitman ships no Loop ${scaffold.fork}; fork one of ${Object.keys(shippedLoops).join(", ")}`
@@ -2147,7 +2001,7 @@ var Usage = [
2147
2001
  `);
2148
2002
  var KitCreateValidator = guard(KitCreate);
2149
2003
  var KitUpdateValidator = guard(KitUpdate);
2150
- var agentRuntime = promise(() => import("./chunk-kt08et8q.js"));
2004
+ var agentRuntime = promise(() => import("./chunk-s92k78ef.js"));
2151
2005
  var TuiLauncher = Reference("kitman/cli/TuiLauncher", {
2152
2006
  defaultValue: () => gen(function* () {
2153
2007
  const tui = yield* tryPromise({
@@ -2627,7 +2481,7 @@ function harnessSync(args) {
2627
2481
  };
2628
2482
  });
2629
2483
  const projectRoot = command.flags.projectScope ? yield* resolveProjectWriteRoot : undefined;
2630
- const targetPlans = yield* previewEnvironmentPlans(environments, command, projectRoot, config.mcpCredentialName, syncKits, (yield* readUserConfig())?.approvedSkillSources);
2484
+ const targetPlans = yield* previewEnvironmentPlans(environments, command, projectRoot, config.mcpCredentialName, syncKits, (yield* readUserConfig()) ?? {});
2631
2485
  const environmentPlan = composeAgentEnvironmentSyncPlan(targetPlans);
2632
2486
  const materializationPlans = targetPlans.map((target) => target.skills);
2633
2487
  const userConfigPlans = command.flags.projectScope ? [] : targetPlans.map((target) => target.harnessConfig);
@@ -2644,15 +2498,14 @@ function harnessSync(args) {
2644
2498
  syncKits
2645
2499
  });
2646
2500
  const applied = !command.flags.preview;
2647
- if (applied) {
2501
+ if (applied)
2648
2502
  yield* writeHarnessSyncPlan(outputPath, plan);
2649
- yield* applyAgentEnvironmentPlans(environmentPlan);
2650
- }
2503
+ const resultPlan = applied ? yield* applyAgentEnvironmentPlans(environmentPlan) : environmentPlan;
2651
2504
  return {
2652
2505
  command,
2653
2506
  plan,
2654
- environmentPlan,
2655
- materializationPlans,
2507
+ environmentPlan: resultPlan,
2508
+ materializationPlans: resultPlan.targets.map((target) => target.skills),
2656
2509
  configPlans,
2657
2510
  userConfigPlans,
2658
2511
  projectConfigPlans,
@@ -2799,8 +2652,8 @@ function isInstallDefaultKit(kit) {
2799
2652
  const rollout = isObject(marketplace) && marketplace !== null && "rollout" in marketplace ? marketplace.rollout : undefined;
2800
2653
  return isObject(rollout) && rollout !== null && "installDefault" in rollout && rollout.installDefault === true;
2801
2654
  }
2802
- function previewEnvironmentPlans(environments, command, projectRoot, mcpCredentialName, syncKits = [], approvedSkillSources) {
2803
- return forEach(environments, (environment, index) => gen(function* () {
2655
+ function previewEnvironmentPlans(environments, command, projectRoot, mcpCredentialName, syncKits = [], userConfig = {}) {
2656
+ const previews = forEach(environments, (environment, index) => gen(function* () {
2804
2657
  const rootDir = command.flags.projectScope ? projectRoot : getOrUndefined(yield* option2(String3("HOME")));
2805
2658
  const { previewAgentEnvironmentPlan } = yield* agentRuntime;
2806
2659
  return yield* previewAgentEnvironmentPlan({
@@ -2809,13 +2662,16 @@ function previewEnvironmentPlans(environments, command, projectRoot, mcpCredenti
2809
2662
  scope: command.flags.projectScope ? "project" : "user",
2810
2663
  ...rootDir === undefined ? undefined : { rootDir },
2811
2664
  ...command.flags.noInstall === undefined ? undefined : { noInstall: command.flags.noInstall },
2812
- ...approvedSkillSources === undefined ? undefined : { approvedSkillSources },
2665
+ ...userConfig.approvedSkillSources === undefined ? undefined : { approvedSkillSources: userConfig.approvedSkillSources },
2666
+ ...userConfig.requireReviewedSources === undefined ? undefined : { requireReviewedSources: userConfig.requireReviewedSources },
2667
+ ...userConfig.versions === undefined ? undefined : { versions: userConfig.versions },
2813
2668
  ...mcpCredentialName === undefined ? undefined : { mcpCredentialName }
2814
2669
  });
2815
2670
  }));
2671
+ return flatMap2(agentRuntime, ({ withSourceResolutionCache }) => withSourceResolutionCache(previews));
2816
2672
  }
2817
2673
  var confirmSyncAfterKitToggle = map3(promptLine("Sync enabled kits now? [Y/n] "), (answer) => ["", "y", "yes"].includes(answer.trim().toLowerCase()));
2818
- var readStdin = Stdio.pipe(flatMap((stdio) => mkString(decodeText(stdio.stdin))), map3((text) => text.trim()));
2674
+ var readStdin = Stdio.pipe(flatMap2((stdio) => mkString(decodeText(stdio.stdin))), map3((text) => text.trim()));
2819
2675
  function promptLine(prompt2) {
2820
2676
  return gen(function* () {
2821
2677
  const terminal = yield* Terminal;
@@ -2940,7 +2796,7 @@ function interactiveKitToggle(kits, harnesses, preferences) {
2940
2796
  }
2941
2797
  }
2942
2798
  return { ...preferences, perHarnessKitActivations: [...updates.values()] };
2943
- }).pipe(ensuring(ignore(Terminal.pipe(flatMap((terminal) => terminal.display("\x1B[?25h"))))), scoped);
2799
+ }).pipe(ensuring(ignore(Terminal.pipe(flatMap2((terminal) => terminal.display("\x1B[?25h"))))), scoped);
2944
2800
  }
2945
2801
  function mixedKitState(kit, harnesses, preferences) {
2946
2802
  const states = harnesses.map((harness) => kitEnabledForHarness(preferences, harness, kit.id));
@@ -3046,7 +2902,7 @@ function browserSession(apiUrl) {
3046
2902
  clientId: ClientId,
3047
2903
  onUrl: (url) => andThen(log(`Open this URL to log in:
3048
2904
  ${url}`), openBrowser(url)),
3049
- onTimeout: (state) => promptLine("Paste the full callback URL: ").pipe(mapError(() => new CliError({ message: "No callback URL provided" })), flatMap((line) => parseCallbackUrl(line.trim(), state)))
2905
+ onTimeout: (state) => promptLine("Paste the full callback URL: ").pipe(mapError(() => new CliError({ message: "No callback URL provided" })), flatMap2((line) => parseCallbackUrl(line.trim(), state)))
3050
2906
  });
3051
2907
  const session = toStoredSession(token);
3052
2908
  yield* storeSession(apiUrl, session);
@@ -3398,7 +3254,7 @@ function runnerCommand(args) {
3398
3254
  });
3399
3255
  }
3400
3256
  var SandboxHostProbe = Reference("kitman/cli/SandboxHostProbe", {
3401
- defaultValue: () => flatMap(agentRuntime, (runtime) => runtime.commandHostProbe)
3257
+ defaultValue: () => flatMap2(agentRuntime, (runtime) => runtime.commandHostProbe)
3402
3258
  });
3403
3259
  var runnerSettings = gen(function* () {
3404
3260
  const optional = (name) => String3(name).pipe(option2, map3((value) => getOrUndefined(value)?.trim()));
@@ -3454,7 +3310,7 @@ function startCanonicalHerdrRunnerCommand(input) {
3454
3310
  superviseReplica,
3455
3311
  verificationExecutor
3456
3312
  } = yield* agentRuntime;
3457
- const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-zc0ebz8f.js"));
3313
+ const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-5cc3fb7y.js"));
3458
3314
  const settings = yield* runnerSettings;
3459
3315
  const { concurrency, fullAccess, sshAgentAvailable } = settings;
3460
3316
  const personal = input.runner.ownership.kind === "personal";
@@ -3466,6 +3322,15 @@ function startCanonicalHerdrRunnerCommand(input) {
3466
3322
  });
3467
3323
  const repoBinding = input.projectId === undefined ? undefined : (yield* input.client.listRepoBindings(input.projectId)).items.find((binding) => binding.status === "active");
3468
3324
  const harnesses = yield* detectHarnesses;
3325
+ if (harnesses.harnesses.length > 0)
3326
+ yield* harnessSync([
3327
+ "sync",
3328
+ ...harnesses.harnesses.map((harness) => harness === "claude" ? "claude-code" : harness),
3329
+ "--workspace",
3330
+ input.workspaceId,
3331
+ "--api-url",
3332
+ input.apiUrl
3333
+ ]).pipe(catch_((error2) => error(`Harness sync failed; the Runner starts on the previous one: ${error2.message}`)));
3469
3334
  const advertisedCapabilities = repoBinding === undefined ? herdrRunnerCapabilities({ harnesses, fullAccess, sandbox: host, shared: !personal }) : herdrRunnerCapabilitiesForRepoBinding(repoBinding, {
3470
3335
  harnesses,
3471
3336
  fullAccess,
@@ -3607,7 +3472,7 @@ function startCanonicalHerdrRunnerCommand(input) {
3607
3472
  healthStatus: "healthy",
3608
3473
  capabilities,
3609
3474
  labels: input.runner.labels
3610
- }).pipe(flatMap(() => controlPlane.client.heartbeatRunnerReplica(input.runner.id, replica.id, {
3475
+ }).pipe(flatMap2(() => controlPlane.client.heartbeatRunnerReplica(input.runner.id, replica.id, {
3611
3476
  healthStatus: "healthy",
3612
3477
  drainState: "accepting",
3613
3478
  capacity: { maxConcurrentRuns: concurrency },
@@ -3672,7 +3537,7 @@ function mcpCommand(args) {
3672
3537
  if (command.action === "run") {
3673
3538
  if (command.args.length > 0)
3674
3539
  return yield* new CliError({ message: `Unknown command: ${args.join(" ")}` });
3675
- const { runMcpServerCommand } = yield* promise(() => import("./chunk-nvf0begz.js"));
3540
+ const { runMcpServerCommand } = yield* promise(() => import("./chunk-120n71cv.js"));
3676
3541
  return yield* runMcpServerCommand({ flags: command.flags });
3677
3542
  }
3678
3543
  if (command.action !== "setup")
@@ -4008,7 +3873,7 @@ function taskCommand(args) {
4008
3873
  const sourcePath = command.args[1];
4009
3874
  if (!sourcePath)
4010
3875
  return yield* new CliError({ message: `${command.group} upload-asset requires file path` });
4011
- const bytes = yield* FileSystem.pipe(flatMap((fs) => fs.readFile(sourcePath)));
3876
+ const bytes = yield* FileSystem.pipe(flatMap2((fs) => fs.readFile(sourcePath)));
4012
3877
  const input = {
4013
3878
  filename: command.flags.filename ?? (yield* Path).basename(sourcePath),
4014
3879
  contentType: command.flags.contentType ?? "application/octet-stream",
@@ -4283,7 +4148,7 @@ function loopCatalogCommand(args) {
4283
4148
  return yield* new CliError({ message: `Unknown command: ${args.join(" ")}` });
4284
4149
  });
4285
4150
  }
4286
- var taskTypeNamed = (client, workspaceId, named) => flatMap(client.listTaskTypes(workspaceId), (types) => {
4151
+ var taskTypeNamed = (client, workspaceId, named) => flatMap2(client.listTaskTypes(workspaceId), (types) => {
4287
4152
  const found = types.items.find((type) => type.id === named || type.name.toLowerCase() === named.toLowerCase());
4288
4153
  return found === undefined ? fail4(new CliError({
4289
4154
  message: `No Task Type "${named}"; the Workspace has ${types.items.map((type) => type.name).join(", ")}`
@@ -4658,7 +4523,7 @@ function verifyCommand(args) {
4658
4523
  }
4659
4524
  });
4660
4525
  }
4661
- var secretValueFromStdin = Stdio.pipe(flatMap((stdio) => mkString(decodeText(stdio.stdin))), map3((text) => text.replace(/\r?\n$/, "")));
4526
+ var secretValueFromStdin = Stdio.pipe(flatMap2((stdio) => mkString(decodeText(stdio.stdin))), map3((text) => text.replace(/\r?\n$/, "")));
4662
4527
  function secretCommand(args) {
4663
4528
  return gen(function* () {
4664
4529
  const command = parseCommand(args.length === 1 ? [...args, "list"] : args);
@@ -4692,7 +4557,7 @@ function secretCommand(args) {
4692
4557
  });
4693
4558
  }
4694
4559
  var PackageBuilder = Reference("kitman/cli/PackageBuilder", {
4695
- defaultValue: () => (directory) => flatMap(promise(() => import("./chunk-yysejjz0.js")), (build) => build.buildPackage(directory))
4560
+ defaultValue: () => (directory) => flatMap2(promise(() => import("./chunk-gew1a5p6.js")), (build) => build.buildPackage(directory))
4696
4561
  });
4697
4562
  var optionalEnv = (name) => String3(name).pipe(option2, map3(getOrUndefined));
4698
4563
  var ciIdToken = (apiUrl) => gen(function* () {
@@ -4706,7 +4571,7 @@ var ciIdToken = (apiUrl) => gen(function* () {
4706
4571
  const url = new URL(requestUrl);
4707
4572
  const refused = (reason) => new CliError({ message: `GitHub Actions issued no ID token: ${reason}` });
4708
4573
  url.searchParams.set("audience", apiUrl.replace(/\/+$/, ""));
4709
- const response = yield* send(get2(url, { headers: { authorization: `Bearer ${requestToken}` } }), (cause) => refused(String(cause)));
4574
+ const response = yield* send(get3(url, { headers: { authorization: `Bearer ${requestToken}` } }), (cause) => refused(String(cause)));
4710
4575
  if (response.status < 200 || response.status >= 300)
4711
4576
  return yield* refused(`${response.status}; does the job have id-token: write?`);
4712
4577
  const body = yield* response.text.pipe(mapError((error) => refused(error.message)));
@@ -5591,7 +5456,7 @@ function downloadPresignedAsset(download, outputPath) {
5591
5456
  return gen(function* () {
5592
5457
  const fs = yield* FileSystem;
5593
5458
  const failed = (cause) => new CliError({ message: `Asset download failed: ${String(cause)}` });
5594
- const response = yield* send(make12(download.method)(download.url), failed);
5459
+ const response = yield* send(make14(download.method)(download.url), failed);
5595
5460
  if (response.status < 200 || response.status >= 300)
5596
5461
  return yield* new CliError({ message: `Asset download failed with ${response.status}` });
5597
5462
  const body = yield* response.arrayBuffer.pipe(mapError((error) => failed(error.message)));
@@ -5777,7 +5642,7 @@ function kitCreateInput(command) {
5777
5642
  return yield* new CliError({
5778
5643
  message: "kit create --source cannot be combined with --name, --description, --kind, --content, or --stdin"
5779
5644
  });
5780
- const content = yield* FileSystem.pipe(flatMap((fs) => fs.readFileString(command.flags.source ?? "")));
5645
+ const content = yield* FileSystem.pipe(flatMap2((fs) => fs.readFileString(command.flags.source ?? "")));
5781
5646
  return yield* parseKitCreateSource(content);
5782
5647
  }
5783
5648
  const name = command.flags.name ?? prompt("Kit name: ");
@@ -5804,7 +5669,7 @@ function kitUpdateInput(command) {
5804
5669
  return yield* new CliError({
5805
5670
  message: "kit update --source cannot be combined with --name, --description, --kind, --content, or --stdin"
5806
5671
  });
5807
- const content = yield* FileSystem.pipe(flatMap((fs) => fs.readFileString(command.flags.source ?? "")));
5672
+ const content = yield* FileSystem.pipe(flatMap2((fs) => fs.readFileString(command.flags.source ?? "")));
5808
5673
  return yield* parseKitUpdateSource(content);
5809
5674
  }
5810
5675
  const input = {