@craftspace/cli 0.4.1 → 0.4.2

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
@@ -19259,7 +19259,8 @@ var ConnectionToolSchema = external_exports.object({
19259
19259
  });
19260
19260
  var ListConnectionToolsResponseSchema = external_exports.object({
19261
19261
  tools: external_exports.array(ConnectionToolSchema),
19262
- reachable: external_exports.boolean()
19262
+ reachable: external_exports.boolean(),
19263
+ error: external_exports.string().optional()
19263
19264
  });
19264
19265
  var CreateConnectionBodySchema = external_exports.object({
19265
19266
  kind: external_exports.enum(ConnectionKind),
@@ -19782,7 +19783,7 @@ var SaveWorkstationBodySchema = external_exports.object({
19782
19783
  var WorkstationResponseSchema = external_exports.object({ workstation: WorkstationSchema });
19783
19784
 
19784
19785
  // ../../shared/dist/machines/machine.js
19785
- var CLI_VERSION = "0.4.1";
19786
+ var CLI_VERSION = "0.4.2";
19786
19787
  var CLI_PACKAGE = "@craftspace/cli";
19787
19788
  var CLI_INSTALL = `npm i -g ${CLI_PACKAGE}`;
19788
19789
  var MACHINE_BEAT_INTERVAL_MS = 15e3;
@@ -23112,8 +23113,9 @@ var machine = {
23112
23113
  };
23113
23114
  return answer.machine;
23114
23115
  },
23115
- async url() {
23116
- return (await readConfig())?.url ?? null;
23116
+ async controlPlane(override) {
23117
+ const where = override ?? process.env.CRAFTSPACE_URL ?? (await readConfig())?.url ?? DEFAULT_URL;
23118
+ return where.replace(/\/$/, "");
23117
23119
  },
23118
23120
  async signIn({ url: url2, why, install = false }) {
23119
23121
  const where = url2 ?? (await readConfig())?.url ?? DEFAULT_URL;
@@ -23615,7 +23617,7 @@ setup.widenPath();
23615
23617
  var program2 = new Command();
23616
23618
  program2.enablePositionalOptions().name("cs").description("Sign this machine in to your team, so every agent on it reads the same brain.").version(CLI_VERSION).showHelpAfterError();
23617
23619
  program2.command("login").description("sign this machine in").option("--token <token>", "the login token from your team", process.env.CRAFTSPACE_TOKEN).option("--url <url>", "your control plane, remembered after the first login").option("--no-install", "do not install anything this machine is missing").action(async ({ token, url: url2, install }) => {
23618
- const where = (url2 ?? process.env.CRAFTSPACE_URL ?? await machine.url() ?? DEFAULT_URL2).replace(/\/$/, "");
23620
+ const where = await machine.controlPlane(url2);
23619
23621
  const signed = token === void 0 ? (await machine.signIn({ url: where, why: "Signing this machine in.", install })).machine : await machine.login({ token, url: where, install });
23620
23622
  const daemon = await machine.daemon();
23621
23623
  ui.say(ui.heading(`Signed in as ${signed.ownerName}`));
@@ -23654,7 +23656,6 @@ try {
23654
23656
  function machineSpecs({ platform, cores, memoryGb }) {
23655
23657
  return [platform, cores === null ? null : `${cores} vCPU`, memoryGb == null ? null : `${memoryGb} GB`].filter((part) => part !== null).join(" \xB7 ");
23656
23658
  }
23657
- var DEFAULT_URL2 = "https://craftspace.app";
23658
23659
  function secondsSince(at) {
23659
23660
  return Math.round((Date.now() - new Date(at).getTime()) / 1e3);
23660
23661
  }
package/dist/machine.d.ts CHANGED
@@ -6,7 +6,7 @@ export declare const machine: {
6
6
  url: string;
7
7
  install: boolean;
8
8
  }): Promise<Machine>;
9
- url(): Promise<string | null>;
9
+ controlPlane(override?: string): Promise<string>;
10
10
  signIn({ url, why, install }: {
11
11
  url?: string;
12
12
  why: string;
package/dist/machine.js CHANGED
@@ -43,8 +43,9 @@ export const machine = {
43
43
  };
44
44
  return answer.machine;
45
45
  },
46
- async url() {
47
- return (await readConfig())?.url ?? null;
46
+ async controlPlane(override) {
47
+ const where = override ?? process.env.CRAFTSPACE_URL ?? (await readConfig())?.url ?? DEFAULT_URL;
48
+ return where.replace(/\/$/, '');
48
49
  },
49
50
  async signIn({ url, why, install = false }) {
50
51
  const where = url ?? (await readConfig())?.url ?? DEFAULT_URL;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@craftspace/cli",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "description": "Sign a Mac or Linux machine into Craftspace and keep its agent setup in step.",
6
6
  "license": "MIT",