@kybernesis/create 0.23.3 → 0.24.0

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/README.md CHANGED
@@ -116,6 +116,12 @@ run and upgrade exits with status 2, prints that the gate can only run on the
116
116
  host, and gives the exact ssh command. It does not print "Do NOT deploy" because
117
117
  no eval exercised the code.
118
118
 
119
+ `kyb upgrade --check` plans only: it prints what would change as one
120
+ `KYB_UPGRADE_PLAN {"ok":true,"changes":[{"name","from","to"}],"resetsConversations":false}`
121
+ line and installs, repairs and renews nothing. `@kybernesis/manage` reads it for
122
+ the owner's Update card, and runs the real upgrade (with its eval gate, then a
123
+ rebuild and a safe restart, or everything put back) from that card.
124
+
119
125
  Use `kyb upgrade --host` to run the gate over ssh after the upgrade. The target
120
126
  uses the same defaults as `kyb deploy`: `EVE_SSH_HOST`, then
121
127
  `$EXE_VM_NAME.exe.xyz`; `--host=<ssh-target>` overrides them. The remote project
package/dist/cli.js CHANGED
@@ -84,7 +84,7 @@ const COMMANDS = {
84
84
  credential: "Write the agent credential onto a host (--local to stay here).",
85
85
  register: "Register this agent with the control plane (--name, --url).",
86
86
  deploy: "Deploy this agent to its host (--no-env to leave the env file alone).",
87
- upgrade: "Bring @kybernesis packages and eve to certified versions (--host, --skip-eval, --allow-stale, --yes).",
87
+ upgrade: "Bring @kybernesis packages and eve to certified versions (--check, --host, --skip-eval, --allow-stale, --yes).",
88
88
  tui: "Talk to your agents in the terminal.",
89
89
  version: "Print the version of this tool.",
90
90
  };
@@ -116,6 +116,7 @@ function usage(command) {
116
116
  --host[=<target>] ${dim("run the eval gate over ssh; defaults like kyb deploy")}
117
117
  --skip-eval ${dim("skip the eval gate")}
118
118
  --allow-stale ${dim("continue even when this kyb is behind the published version")}
119
+ --check ${dim("print what would change (one KYB_UPGRADE_PLAN json line) and change nothing")}
119
120
  --yes, -y ${dim("confirm an eve version change noninteractively")}
120
121
  `);
121
122
  }
@@ -179,6 +180,7 @@ switch (command) {
179
180
  case "upgrade":
180
181
  await upgrade({
181
182
  allowStale: rest.includes("--allow-stale"),
183
+ check: rest.includes("--check"),
182
184
  host: optionalValueFlag(rest, "host"),
183
185
  skipEval: rest.includes("--skip-eval"),
184
186
  yes: rest.includes("--yes") || rest.includes("-y"),
package/dist/upgrade.d.ts CHANGED
@@ -29,6 +29,12 @@ export type GithubToolsMountRepair = {
29
29
  export declare function repairGithubToolsMount(cwd: string): GithubToolsMountRepair;
30
30
  export interface UpgradeOptions {
31
31
  allowStale?: boolean;
32
+ /**
33
+ * Plan only: print what an upgrade would change as one `KYB_UPGRADE_PLAN <json>`
34
+ * line and touch nothing (no install, no repair, no renewal of kyb itself).
35
+ * The owner's Update card reads it through @kybernesis/manage.
36
+ */
37
+ check?: boolean;
32
38
  host?: true | string;
33
39
  skipEval?: boolean;
34
40
  yes?: boolean;
@@ -40,5 +46,7 @@ type EvalGatePreflight = {
40
46
  reasons: string[];
41
47
  };
42
48
  export declare function preflightEvalGate(cwd: string): Promise<EvalGatePreflight>;
49
+ /** The one line `kyb upgrade --check` prints for a program to read; everything else it prints is for people. */
50
+ export declare const UPGRADE_PLAN_PREFIX = "KYB_UPGRADE_PLAN ";
43
51
  export declare function upgrade(options?: UpgradeOptions): Promise<void>;
44
52
  export {};
package/dist/upgrade.js CHANGED
@@ -861,6 +861,11 @@ function startStoppedBridge(cwd, unit) {
861
861
  ` systemctl status ${unit}`);
862
862
  return false;
863
863
  }
864
+ /** The one line `kyb upgrade --check` prints for a program to read; everything else it prints is for people. */
865
+ export const UPGRADE_PLAN_PREFIX = "KYB_UPGRADE_PLAN ";
866
+ function printPlan(plan) {
867
+ console.log(`${UPGRADE_PLAN_PREFIX}${JSON.stringify(plan)}`);
868
+ }
864
869
  export async function upgrade(options = {}) {
865
870
  console.log(bold("\nkyb upgrade — checking @kybernesis/* and eve against npm\n"));
866
871
  const cwd = process.cwd();
@@ -871,7 +876,7 @@ export async function upgrade(options = {}) {
871
876
  ...(pkg.devDependencies ?? {}),
872
877
  };
873
878
  const selfVersion = checkSelfVersion();
874
- if (selfVersion.kind === "stale" && !options.allowStale) {
879
+ if (selfVersion.kind === "stale" && !options.allowStale && !options.check) {
875
880
  /**
876
881
  * A stale kyb that is the PROJECT's own dependency renews itself.
877
882
  *
@@ -957,6 +962,8 @@ export async function upgrade(options = {}) {
957
962
  console.log(dim(` note: eve@${eveLatest} exists upstream; ${EVE_VERSION} is the newest Kybernesis-certified version.`));
958
963
  }
959
964
  if (unresolved.size > 0) {
965
+ if (options.check)
966
+ printPlan({ ok: false, unresolved: [...unresolved].sort(), changes: [], resetsConversations: false });
960
967
  fail(`\nUpgrade planning failed for ${[...unresolved].sort().join(", ")}. ` +
961
968
  `No manifest, dependency tree, or service state was changed.`);
962
969
  return;
@@ -985,6 +992,17 @@ export async function upgrade(options = {}) {
985
992
  const changed = [...new Set(targets
986
993
  .filter((target) => target.installedVersion !== target.targetVersion && !(target.name === "eve" && versionLt(target.targetVersion, target.installedVersion)))
987
994
  .map((target) => `${target.name}@${target.targetVersion}`))];
995
+ if (options.check) {
996
+ printPlan({
997
+ ok: true,
998
+ eve: { installed: eveInstalled ?? null, certified: EVE_VERSION },
999
+ changes: [...new Map(targets
1000
+ .filter((target) => changed.includes(`${target.name}@${target.targetVersion}`))
1001
+ .map((target) => [target.name, { name: target.name, from: target.installedVersion, to: target.targetVersion }])).values()],
1002
+ resetsConversations: eveChanged,
1003
+ });
1004
+ return;
1005
+ }
988
1006
  if (eveChanged && !(await approveEveChange(cwd, options.yes === true, Boolean(deps["@kybernesis/buzz"])))) {
989
1007
  process.exitCode = 1;
990
1008
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kybernesis/create",
3
- "version": "0.23.3",
3
+ "version": "0.24.0",
4
4
  "description": "The Kybernesis agent scaffolder and FDE toolkit: one command to a governed, remembering, multiplayer, self-testing eve agent \u2014 plus doctor and upgrade.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",