@getpaseo/cli 0.8.0-beta.1 → 0.9.0-beta.1

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.
Files changed (135) hide show
  1. package/dist/cli.js +44 -37
  2. package/dist/commands/agent/archive.js +2 -15
  3. package/dist/commands/agent/attach.d.ts +1 -0
  4. package/dist/commands/agent/attach.js +18 -20
  5. package/dist/commands/agent/delete.js +4 -15
  6. package/dist/commands/agent/detach.js +2 -13
  7. package/dist/commands/agent/import.js +2 -16
  8. package/dist/commands/agent/inspect.js +2 -15
  9. package/dist/commands/agent/logs.js +18 -18
  10. package/dist/commands/agent/ls.js +2 -23
  11. package/dist/commands/agent/mode.js +2 -2
  12. package/dist/commands/agent/open.js +2 -8
  13. package/dist/commands/agent/reload.js +2 -15
  14. package/dist/commands/agent/run.js +12 -17
  15. package/dist/commands/agent/send.js +6 -15
  16. package/dist/commands/agent/stop.js +2 -15
  17. package/dist/commands/agent/update.js +2 -15
  18. package/dist/commands/agent/wait.js +4 -15
  19. package/dist/commands/clone.js +2 -8
  20. package/dist/commands/daemon/config.d.ts +3 -0
  21. package/dist/commands/daemon/config.js +103 -0
  22. package/dist/commands/daemon/index.js +20 -52
  23. package/dist/commands/daemon/local-daemon.d.ts +10 -75
  24. package/dist/commands/daemon/local-daemon.js +61 -503
  25. package/dist/commands/daemon/pair.d.ts +3 -8
  26. package/dist/commands/daemon/pair.js +33 -61
  27. package/dist/commands/daemon/reload.d.ts +3 -1
  28. package/dist/commands/daemon/reload.js +10 -2
  29. package/dist/commands/daemon/restart.d.ts +19 -11
  30. package/dist/commands/daemon/restart.js +102 -88
  31. package/dist/commands/daemon/runtime-toolchain.js +1 -1
  32. package/dist/commands/daemon/set-password.js +8 -7
  33. package/dist/commands/daemon/start.d.ts +17 -3
  34. package/dist/commands/daemon/start.js +47 -52
  35. package/dist/commands/daemon/status.d.ts +12 -20
  36. package/dist/commands/daemon/status.js +91 -342
  37. package/dist/commands/daemon/stop.d.ts +19 -14
  38. package/dist/commands/daemon/stop.js +53 -55
  39. package/dist/commands/heartbeat/index.js +3 -3
  40. package/dist/commands/hub/connect.d.ts +1 -0
  41. package/dist/commands/hub/connect.js +1 -1
  42. package/dist/commands/hub/daemon-client.d.ts +3 -2
  43. package/dist/commands/hub/daemon-client.js +3 -3
  44. package/dist/commands/hub/deploy-triggers.d.ts +6 -0
  45. package/dist/commands/hub/deploy-triggers.js +116 -0
  46. package/dist/commands/hub/deploy.d.ts +15 -5
  47. package/dist/commands/hub/deploy.js +73 -4
  48. package/dist/commands/hub/disconnect.d.ts +1 -0
  49. package/dist/commands/hub/disconnect.js +1 -1
  50. package/dist/commands/hub/hub-client/index.d.ts +4 -3
  51. package/dist/commands/hub/hub-client/index.js +23 -10
  52. package/dist/commands/hub/hub-client/internal/contracts.d.ts +15 -15
  53. package/dist/commands/hub/hub-client/internal/contracts.js +13 -14
  54. package/dist/commands/hub/index.js +2 -2
  55. package/dist/commands/hub/init-plan.d.ts +5 -25
  56. package/dist/commands/hub/init-plan.js +39 -85
  57. package/dist/commands/hub/init.d.ts +3 -1
  58. package/dist/commands/hub/init.js +94 -124
  59. package/dist/commands/hub/login.d.ts +4 -4
  60. package/dist/commands/hub/login.js +1 -1
  61. package/dist/commands/hub/logout.d.ts +1 -0
  62. package/dist/commands/hub/logout.js +2 -2
  63. package/dist/commands/hub/permissions.d.ts +1 -0
  64. package/dist/commands/hub/permissions.js +2 -2
  65. package/dist/commands/hub/starter-trigger.d.ts +2 -2
  66. package/dist/commands/hub/starter-trigger.js +11 -9
  67. package/dist/commands/onboard.d.ts +7 -2
  68. package/dist/commands/onboard.js +59 -210
  69. package/dist/commands/open.js +3 -1
  70. package/dist/commands/permit/allow.js +2 -15
  71. package/dist/commands/permit/deny.js +2 -15
  72. package/dist/commands/permit/ls.js +2 -15
  73. package/dist/commands/plugin/index.d.ts +6 -0
  74. package/dist/commands/plugin/index.js +62 -46
  75. package/dist/commands/plugin/scaffold.js +10 -0
  76. package/dist/commands/plugin/shared.d.ts +5 -3
  77. package/dist/commands/plugin/shared.js +13 -9
  78. package/dist/commands/plugin/update.d.ts +37 -0
  79. package/dist/commands/plugin/update.js +58 -0
  80. package/dist/commands/project/create.js +5 -3
  81. package/dist/commands/project/delete.js +4 -2
  82. package/dist/commands/project/ls.js +2 -2
  83. package/dist/commands/project/rename.js +4 -2
  84. package/dist/commands/provider/diagnostic.js +1 -1
  85. package/dist/commands/provider/ls.js +2 -29
  86. package/dist/commands/provider/models.js +1 -1
  87. package/dist/commands/schedule/create.js +2 -2
  88. package/dist/commands/schedule/delete.js +1 -1
  89. package/dist/commands/schedule/inspect.js +1 -1
  90. package/dist/commands/schedule/logs.js +1 -1
  91. package/dist/commands/schedule/ls.js +1 -1
  92. package/dist/commands/schedule/pause.js +1 -1
  93. package/dist/commands/schedule/resume.js +1 -1
  94. package/dist/commands/schedule/run-once.js +1 -1
  95. package/dist/commands/schedule/shared.d.ts +3 -1
  96. package/dist/commands/schedule/shared.js +7 -5
  97. package/dist/commands/schedule/update.js +1 -1
  98. package/dist/commands/script/ls.js +1 -1
  99. package/dist/commands/script/shared.d.ts +2 -1
  100. package/dist/commands/script/shared.js +3 -3
  101. package/dist/commands/script/start.js +1 -1
  102. package/dist/commands/script/stop.js +1 -1
  103. package/dist/commands/terminal/capture.d.ts +1 -1
  104. package/dist/commands/terminal/capture.js +2 -3
  105. package/dist/commands/terminal/create.js +1 -1
  106. package/dist/commands/terminal/kill.js +1 -1
  107. package/dist/commands/terminal/ls.js +1 -1
  108. package/dist/commands/terminal/send-keys.d.ts +1 -1
  109. package/dist/commands/terminal/send-keys.js +2 -3
  110. package/dist/commands/terminal/shared.d.ts +2 -1
  111. package/dist/commands/terminal/shared.js +5 -3
  112. package/dist/commands/workspace/archive.d.ts +1 -0
  113. package/dist/commands/workspace/archive.js +4 -2
  114. package/dist/commands/workspace/create.js +4 -2
  115. package/dist/commands/workspace/ls.d.ts +1 -0
  116. package/dist/commands/workspace/ls.js +2 -2
  117. package/dist/commands/workspace/rename.d.ts +1 -0
  118. package/dist/commands/workspace/rename.js +4 -2
  119. package/dist/commands/workspace/setup.d.ts +1 -0
  120. package/dist/commands/workspace/setup.js +2 -2
  121. package/dist/commands/worktree/archive.js +4 -2
  122. package/dist/commands/worktree/create.js +2 -10
  123. package/dist/commands/worktree/ls.d.ts +0 -2
  124. package/dist/commands/worktree/ls.js +4 -30
  125. package/dist/output/with-output.d.ts +2 -0
  126. package/dist/run.js +11 -1
  127. package/dist/utils/client-id.d.ts +1 -1
  128. package/dist/utils/client-id.js +8 -14
  129. package/dist/utils/client.d.ts +16 -21
  130. package/dist/utils/client.js +57 -109
  131. package/dist/utils/command-options.d.ts +1 -0
  132. package/dist/utils/command-options.js +26 -2
  133. package/dist/utils/daemon-target.d.ts +13 -0
  134. package/dist/utils/daemon-target.js +51 -0
  135. package/package.json +4 -4
@@ -1,3 +1,4 @@
1
+ import type { DaemonTarget } from "../../utils/daemon-target.js";
1
2
  import type { ProviderSnapshotEntry } from "@getpaseo/protocol/agent-types";
2
3
  export interface HubStatus {
3
4
  state: string;
@@ -33,8 +34,8 @@ export interface HubDaemonClient {
33
34
  close(): Promise<void>;
34
35
  }
35
36
  export interface HubDaemonConnection {
36
- connect(host: string | undefined): Promise<HubDaemonClient>;
37
+ connect(target: DaemonTarget): Promise<HubDaemonClient>;
37
38
  }
38
39
  export declare const productionHubDaemonConnection: HubDaemonConnection;
39
- export declare function withHubDaemon<T>(connection: HubDaemonConnection, host: string | undefined, action: (client: HubDaemonClient) => Promise<T>): Promise<T>;
40
+ export declare function withHubDaemon<T>(connection: HubDaemonConnection, target: DaemonTarget, action: (client: HubDaemonClient) => Promise<T>): Promise<T>;
40
41
  //# sourceMappingURL=daemon-client.d.ts.map
@@ -1,9 +1,9 @@
1
1
  import { connectToDaemon } from "../../utils/client.js";
2
2
  export const productionHubDaemonConnection = {
3
- connect: (host) => connectToDaemon({ host }),
3
+ connect: (target) => connectToDaemon({ target }),
4
4
  };
5
- export async function withHubDaemon(connection, host, action) {
6
- const client = await connection.connect(host);
5
+ export async function withHubDaemon(connection, target, action) {
6
+ const client = await connection.connect(target);
7
7
  try {
8
8
  return await action(client);
9
9
  }
@@ -0,0 +1,6 @@
1
+ export interface HubDeployTrigger {
2
+ path: string;
3
+ yaml: string;
4
+ }
5
+ export declare function discoverHubTriggers(cwd: string): Promise<HubDeployTrigger[]>;
6
+ //# sourceMappingURL=deploy-triggers.d.ts.map
@@ -0,0 +1,116 @@
1
+ import { lstat, readFile, readdir } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { HubCommandError } from "./error.js";
4
+ const TRIGGER_DIRECTORY = ".paseo/triggers";
5
+ export async function discoverHubTriggers(cwd) {
6
+ const root = path.resolve(cwd);
7
+ const directory = path.join(root, TRIGGER_DIRECTORY);
8
+ const paseoDirectory = await readStats(path.join(root, ".paseo"), {
9
+ code: "HUB_TRIGGER_DIRECTORY_MISSING",
10
+ message: `${TRIGGER_DIRECTORY} does not exist. Run this command from the project root.`,
11
+ });
12
+ if (paseoDirectory.isSymbolicLink())
13
+ throw unsafeTriggerPath(TRIGGER_DIRECTORY);
14
+ const directoryStats = await readTriggerDirectoryStats(root, directory);
15
+ if (directoryStats.isSymbolicLink())
16
+ throw unsafeTriggerPath(TRIGGER_DIRECTORY);
17
+ if (!directoryStats.isDirectory()) {
18
+ throw new HubCommandError("HUB_TRIGGER_DIRECTORY_INVALID", `${TRIGGER_DIRECTORY} must be a directory.`);
19
+ }
20
+ let entries;
21
+ try {
22
+ entries = await readdir(directory, { withFileTypes: true });
23
+ }
24
+ catch (error) {
25
+ if (!isExpectedReadError(error))
26
+ throw error;
27
+ throw unreadableTriggerPath(TRIGGER_DIRECTORY);
28
+ }
29
+ const triggers = [];
30
+ for (const entry of entries.toSorted((left, right) => left.name.localeCompare(right.name))) {
31
+ const triggerPath = `${TRIGGER_DIRECTORY}/${entry.name}`;
32
+ if (entry.isSymbolicLink())
33
+ throw unsafeTriggerPath(triggerPath);
34
+ if (!entry.isFile() || !entry.name.endsWith(".yml")) {
35
+ throw new HubCommandError("HUB_TRIGGER_PATH_UNSUPPORTED", `${triggerPath} must be a direct-child .yml trigger.`);
36
+ }
37
+ try {
38
+ triggers.push({
39
+ path: triggerPath,
40
+ yaml: await readFile(path.join(root, triggerPath), "utf8"),
41
+ });
42
+ }
43
+ catch (error) {
44
+ if (!isExpectedReadError(error))
45
+ throw error;
46
+ throw unreadableTriggerPath(triggerPath);
47
+ }
48
+ }
49
+ if (triggers.length === 0) {
50
+ throw new HubCommandError("HUB_TRIGGER_MISSING", `${TRIGGER_DIRECTORY} must contain at least one direct-child .yml trigger.`);
51
+ }
52
+ return triggers;
53
+ }
54
+ async function readTriggerDirectoryStats(root, directory) {
55
+ try {
56
+ return await lstat(directory);
57
+ }
58
+ catch (error) {
59
+ if (errorCode(error) !== "ENOENT") {
60
+ if (!isExpectedReadError(error))
61
+ throw error;
62
+ throw unreadableTriggerPath(TRIGGER_DIRECTORY);
63
+ }
64
+ if (await legacyBundleExists(root)) {
65
+ throw new HubCommandError("HUB_PROJECT_REQUIRED", "This directory contains a legacy .paseo/hub.yml bundle. Pass --project <slug> to deploy it.");
66
+ }
67
+ throw new HubCommandError("HUB_TRIGGER_DIRECTORY_MISSING", `${TRIGGER_DIRECTORY} does not exist. Run this command from the project root.`);
68
+ }
69
+ }
70
+ async function legacyBundleExists(root) {
71
+ try {
72
+ await lstat(path.join(root, ".paseo/hub.yml"));
73
+ return true;
74
+ }
75
+ catch (error) {
76
+ if (errorCode(error) === "ENOENT")
77
+ return false;
78
+ if (!isExpectedReadError(error))
79
+ throw error;
80
+ throw unreadableTriggerPath(".paseo/hub.yml");
81
+ }
82
+ }
83
+ async function readStats(target, missing) {
84
+ try {
85
+ return await lstat(target);
86
+ }
87
+ catch (error) {
88
+ if (errorCode(error) === "ENOENT")
89
+ throw new HubCommandError(missing.code, missing.message);
90
+ if (!isExpectedReadError(error))
91
+ throw error;
92
+ throw unreadableTriggerPath(TRIGGER_DIRECTORY);
93
+ }
94
+ }
95
+ function unsafeTriggerPath(triggerPath) {
96
+ return new HubCommandError("HUB_TRIGGER_UNSAFE_PATH", `${triggerPath} must not use a symlink.`);
97
+ }
98
+ function unreadableTriggerPath(triggerPath) {
99
+ return new HubCommandError("HUB_TRIGGER_UNREADABLE", `Could not read ${triggerPath}. Check the file and permissions.`);
100
+ }
101
+ function errorCode(error) {
102
+ if (typeof error !== "object" || error === null)
103
+ return undefined;
104
+ const code = Reflect.get(error, "code");
105
+ return typeof code === "string" ? code : undefined;
106
+ }
107
+ function isExpectedReadError(error) {
108
+ const code = errorCode(error);
109
+ return (code === "EACCES" ||
110
+ code === "EPERM" ||
111
+ code === "ENOENT" ||
112
+ code === "ENOTDIR" ||
113
+ code === "ELOOP" ||
114
+ code === "EISDIR");
115
+ }
116
+ //# sourceMappingURL=deploy-triggers.js.map
@@ -1,8 +1,9 @@
1
1
  import type { Command } from "commander";
2
- import { type SingleResult } from "../../output/index.js";
3
- import { HubHttpClient, type HubInstallResult, type HubValidationResult } from "./hub-client/index.js";
2
+ import { type ListResult, type SingleResult } from "../../output/index.js";
3
+ import { HubHttpClient, type HubInstallResult, type HubTriggerInstallationResult, type HubTriggerValidationResult, type HubValidationResult } from "./hub-client/index.js";
4
4
  import { type HubCredentialStore } from "./credentials.js";
5
5
  import { type HubDeployBundle } from "./deploy-bundle.js";
6
+ import { type HubDeployTrigger } from "./deploy-triggers.js";
6
7
  import { type HubReporter } from "./reporter.js";
7
8
  export interface HubDeployOptions {
8
9
  project?: string;
@@ -15,13 +16,13 @@ export interface HubDeployEnvironment {
15
16
  cwd: string;
16
17
  env: Readonly<Record<string, string | undefined>>;
17
18
  credentials?: HubCredentialStore;
18
- hub?: Pick<HubHttpClient, "installConfiguration" | "validateConfiguration">;
19
+ hub?: Pick<HubHttpClient, "installConfiguration" | "validateConfiguration" | "installTrigger" | "validateTrigger">;
19
20
  reporter?: HubReporter;
20
21
  }
21
22
  export interface HubDeployCommandDependencies {
22
23
  env: Readonly<Record<string, string | undefined>>;
23
24
  credentials: HubCredentialStore;
24
- hub: Pick<HubHttpClient, "installConfiguration" | "validateConfiguration">;
25
+ hub: Pick<HubHttpClient, "installConfiguration" | "validateConfiguration" | "installTrigger" | "validateTrigger">;
25
26
  reporter: HubReporter;
26
27
  cwd(): string;
27
28
  }
@@ -33,7 +34,16 @@ interface HubDryRunResult extends HubValidationResult {
33
34
  origin: string;
34
35
  workflows: number;
35
36
  }
36
- export declare function runHubDeploy(options: HubDeployOptions, environment?: HubDeployEnvironment): Promise<SingleResult<HubDeployResult> | SingleResult<HubDryRunResult>>;
37
+ interface HubTriggerDeployResult extends HubTriggerInstallationResult {
38
+ origin: string;
39
+ path: string;
40
+ }
41
+ interface HubTriggerDryRunResult extends HubTriggerValidationResult {
42
+ origin: string;
43
+ path: string;
44
+ }
45
+ export declare function runHubDeploy(options: HubDeployOptions, environment?: HubDeployEnvironment): Promise<SingleResult<HubDeployResult> | SingleResult<HubDryRunResult> | ListResult<HubTriggerDeployResult> | ListResult<HubTriggerDryRunResult>>;
46
+ export declare function runHubDeployTriggers(options: HubDeployOptions, triggers: readonly HubDeployTrigger[], environment: HubDeployEnvironment): Promise<ListResult<HubTriggerDeployResult> | ListResult<HubTriggerDryRunResult>>;
37
47
  export declare function runHubDeployBundle(options: HubDeployOptions, deployInput: HubDeployBundle, environment: HubDeployEnvironment): Promise<SingleResult<HubDeployResult> | SingleResult<HubDryRunResult>>;
38
48
  export declare function addHubDeployCommand(hub: Command, dependencies: HubDeployCommandDependencies): void;
39
49
  export {};
@@ -1,9 +1,11 @@
1
- import { withOutput } from "../../output/index.js";
1
+ import { withOutput, } from "../../output/index.js";
2
2
  import { addJsonOption } from "../../utils/command-options.js";
3
3
  import { resolveHubCredential, resolveHubOrigin } from "./authority.js";
4
4
  import { HubHttpClient, } from "./hub-client/index.js";
5
5
  import { PrivateHubCredentialStore } from "./credentials.js";
6
6
  import { discoverHubBundle } from "./deploy-bundle.js";
7
+ import { discoverHubTriggers } from "./deploy-triggers.js";
8
+ import { HubCommandError } from "./error.js";
7
9
  import { processHubReporter, reportHubProgress } from "./reporter.js";
8
10
  import { addHubResolutionHelp } from "./help.js";
9
11
  const resultSchema = {
@@ -26,18 +28,85 @@ const validationSchema = {
26
28
  { header: "HUB", field: "origin" },
27
29
  ],
28
30
  };
31
+ const triggerResultSchema = {
32
+ idField: "triggerId",
33
+ columns: [
34
+ { header: "TRIGGER", field: "name" },
35
+ { header: "VERSION", field: "version" },
36
+ { header: "REVISION ID", field: "revisionId" },
37
+ { header: "ACTIVE", field: "active" },
38
+ { header: "PATH", field: "path" },
39
+ { header: "HUB", field: "origin" },
40
+ ],
41
+ };
42
+ const triggerValidationSchema = {
43
+ idField: "name",
44
+ columns: [
45
+ { header: "TRIGGER", field: "name" },
46
+ { header: "VALID", field: "valid" },
47
+ { header: "PATH", field: "path" },
48
+ { header: "HUB", field: "origin" },
49
+ ],
50
+ };
29
51
  export async function runHubDeploy(options, environment = {
30
52
  cwd: process.cwd(),
31
53
  env: process.env,
32
54
  credentials: new PrivateHubCredentialStore(),
33
55
  hub: new HubHttpClient(),
34
56
  }) {
57
+ if (options.project === undefined) {
58
+ return runHubDeployTriggers(options, await discoverHubTriggers(environment.cwd), environment);
59
+ }
35
60
  const deployInput = await discoverHubBundle({
36
61
  cwd: environment.cwd,
37
- ...(options.project === undefined ? {} : { project: options.project }),
62
+ project: options.project,
38
63
  });
39
64
  return runHubDeployBundle(options, deployInput, environment);
40
65
  }
66
+ export async function runHubDeployTriggers(options, triggers, environment) {
67
+ const credentials = environment.credentials ?? new PrivateHubCredentialStore(environment.env);
68
+ const resolution = {
69
+ options: { origin: options.hub, apiKey: options.apiKey },
70
+ env: environment.env,
71
+ credentials,
72
+ };
73
+ const origin = resolveHubOrigin(resolution);
74
+ const credential = resolveHubCredential({ ...resolution, origin });
75
+ const action = options.dryRun === true ? "Validating" : "Deploying";
76
+ reportHubProgress(environment.reporter ?? processHubReporter, options, `${action} ${String(triggers.length)} trigger${triggers.length === 1 ? "" : "s"} ${options.dryRun === true ? "against" : "to"} ${origin}`);
77
+ const hub = environment.hub ?? new HubHttpClient();
78
+ if (options.dryRun === true) {
79
+ const data = await Promise.all(triggers.map(async (trigger) => ({
80
+ ...(await hub.validateTrigger(origin, credential, trigger.yaml)),
81
+ origin,
82
+ path: trigger.path,
83
+ })));
84
+ return { type: "list", data, schema: triggerValidationSchema };
85
+ }
86
+ await Promise.all(triggers.map((trigger) => hub.validateTrigger(origin, credential, trigger.yaml)));
87
+ const data = [];
88
+ for (const trigger of triggers) {
89
+ try {
90
+ data.push({
91
+ ...(await hub.installTrigger(origin, credential, trigger.yaml)),
92
+ origin,
93
+ path: trigger.path,
94
+ });
95
+ }
96
+ catch (error) {
97
+ if (data.length === 0)
98
+ throw error;
99
+ throw new HubCommandError("HUB_TRIGGER_DEPLOY_PARTIAL", `Could not deploy ${trigger.path} after ${String(data.length)} trigger${data.length === 1 ? "" : "s"} had been installed.`, `${errorMessage(error)}\nInstalled before the failure:\n${data.map(({ path: installedPath }) => `- ${installedPath}`).join("\n")}`);
100
+ }
101
+ }
102
+ return { type: "list", data, schema: triggerResultSchema };
103
+ }
104
+ function errorMessage(error) {
105
+ if (error instanceof HubCommandError) {
106
+ return error.details === undefined ? error.message : `${error.message}\n${error.details}`;
107
+ }
108
+ return error instanceof Error ? error.message : String(error);
109
+ }
41
110
  export async function runHubDeployBundle(options, deployInput, environment) {
42
111
  const credentials = environment.credentials ?? new PrivateHubCredentialStore(environment.env);
43
112
  const resolution = {
@@ -72,8 +141,8 @@ export async function runHubDeployBundle(options, deployInput, environment) {
72
141
  export function addHubDeployCommand(hub, dependencies) {
73
142
  addJsonOption(addHubResolutionHelp(hub
74
143
  .command("deploy")
75
- .description("Discover, validate, and activate the canonical .paseo Hub bundle")
76
- .option("-p, --project <slug>", "Target project slug")
144
+ .description("Deploy .paseo organization triggers or a legacy project bundle")
145
+ .option("-p, --project <slug>", "Deploy a legacy bundle to this project slug")
77
146
  .option("--hub <origin>", "Paseo Hub origin")
78
147
  .option("--api-key <secret>", "Organization API key")
79
148
  .option("--dry-run", "Validate without installing or activating"))).action(withOutput(async (...args) => {
@@ -4,6 +4,7 @@ import { type HubReporter } from "./reporter.js";
4
4
  interface HubDisconnectOptions {
5
5
  force?: boolean;
6
6
  host?: string;
7
+ daemonTarget: import("../../utils/daemon-target.js").DaemonTarget;
7
8
  json?: boolean;
8
9
  }
9
10
  interface HubDisconnectDependencies {
@@ -4,7 +4,7 @@ import { withHubDaemon } from "./daemon-client.js";
4
4
  import { reportHubProgress } from "./reporter.js";
5
5
  import { hubStatusResult } from "./status-output.js";
6
6
  export function runHubDisconnect(options, dependencies) {
7
- return withHubDaemon(dependencies.daemon, options.host, async (client) => {
7
+ return withHubDaemon(dependencies.daemon, options.daemonTarget, async (client) => {
8
8
  const current = (await client.getHubStatus()).status;
9
9
  if (current.hubOrigin !== null) {
10
10
  reportHubProgress(dependencies.reporter, options, `Disconnecting this daemon from ${current.hubOrigin}`);
@@ -1,6 +1,6 @@
1
1
  import type { HubBundleFile } from "../deploy-bundle.js";
2
- import { type CliAuthorization, type CliAuthorizationPoll, type HubInstallResult, type HubConfigurationResources, type HubSetupResources, type HubProject, type HubTrigger, type HubValidationResult } from "./internal/contracts.js";
3
- export type { CliAuthorization, CliAuthorizationPoll, HubInstallResult, HubConfigurationResources, HubSetupResources, HubProject, HubTrigger, HubValidationResult, } from "./internal/contracts.js";
2
+ import { type CliAuthorization, type CliAuthorizationPoll, type HubInstallResult, type HubConfigurationResources, type HubProject, type HubTrigger, type HubTriggerInstallationResult, type HubTriggerValidationResult, type HubValidationResult } from "./internal/contracts.js";
3
+ export type { CliAuthorization, CliAuthorizationPoll, HubInstallResult, HubConfigurationResources, HubProject, HubTrigger, HubTriggerInstallationResult, HubTriggerValidationResult, HubValidationResult, } from "./internal/contracts.js";
4
4
  interface HubConfigurationInput {
5
5
  origin: string;
6
6
  apiKey: string;
@@ -12,8 +12,9 @@ export declare class HubHttpClient {
12
12
  pollCliAuthorization(origin: string, deviceCode: string, timeoutMilliseconds: number): Promise<CliAuthorizationPoll>;
13
13
  listProjects(origin: string, apiKey: string): Promise<HubProject[]>;
14
14
  listTriggers(origin: string, apiKey: string): Promise<HubTrigger[]>;
15
+ validateTrigger(origin: string, apiKey: string, yaml: string): Promise<HubTriggerValidationResult>;
16
+ installTrigger(origin: string, apiKey: string, yaml: string): Promise<HubTriggerInstallationResult>;
15
17
  listConfigurationResources(origin: string, apiKey: string): Promise<HubConfigurationResources>;
16
- listSetupResources(origin: string, apiKey: string): Promise<HubSetupResources>;
17
18
  installConfiguration(input: HubConfigurationInput): Promise<HubInstallResult>;
18
19
  validateConfiguration(input: HubConfigurationInput): Promise<HubValidationResult>;
19
20
  issueEnrollmentToken(origin: string, apiKey: string): Promise<string>;
@@ -1,5 +1,5 @@
1
1
  import { HubCommandError } from "../error.js";
2
- import { authorizationPollSchema, authorizationSchema, configurationResourcesSchema, enrollmentTokenSchema, installResponseSchema, projectsResponseSchema, triggersResponseSchema, validationResponseSchema, setupResourcesSchema, } from "./internal/contracts.js";
2
+ import { authorizationPollSchema, authorizationSchema, configurationResourcesSchema, enrollmentTokenSchema, installResponseSchema, projectsResponseSchema, triggersResponseSchema, triggerInstallationResponseSchema, triggerValidationResponseSchema, validationResponseSchema, } from "./internal/contracts.js";
3
3
  import { requestHub } from "./internal/transport.js";
4
4
  export class HubHttpClient {
5
5
  startCliAuthorization(origin) {
@@ -57,26 +57,39 @@ export class HubHttpClient {
57
57
  });
58
58
  return response.triggers;
59
59
  }
60
- listConfigurationResources(origin, apiKey) {
60
+ validateTrigger(origin, apiKey, yaml) {
61
61
  return requestHub({
62
62
  origin,
63
- path: "/api/v1/configuration-resources",
64
- method: "GET",
63
+ path: "/api/v1/triggers/validate",
64
+ method: "POST",
65
65
  apiKey,
66
+ body: { yaml },
66
67
  successStatus: 200,
67
- schema: configurationResourcesSchema,
68
- failureMessage: "Hub configuration resource listing failed",
68
+ schema: triggerValidationResponseSchema,
69
+ failureMessage: "Hub trigger validation failed",
69
70
  });
70
71
  }
71
- listSetupResources(origin, apiKey) {
72
+ installTrigger(origin, apiKey, yaml) {
72
73
  return requestHub({
73
74
  origin,
74
- path: "/api/v1/setup-resources",
75
+ path: "/api/v1/triggers/install",
76
+ method: "POST",
77
+ apiKey,
78
+ body: { yaml },
79
+ successStatus: 201,
80
+ schema: triggerInstallationResponseSchema,
81
+ failureMessage: "Hub trigger deployment failed",
82
+ });
83
+ }
84
+ listConfigurationResources(origin, apiKey) {
85
+ return requestHub({
86
+ origin,
87
+ path: "/api/v1/configuration-resources",
75
88
  method: "GET",
76
89
  apiKey,
77
90
  successStatus: 200,
78
- schema: setupResourcesSchema,
79
- failureMessage: "Hub guided setup resource listing failed",
91
+ schema: configurationResourcesSchema,
92
+ failureMessage: "Hub configuration resource listing failed",
80
93
  });
81
94
  }
82
95
  installConfiguration(input) {
@@ -64,6 +64,17 @@ export declare const triggersResponseSchema: z.ZodObject<{
64
64
  yaml: z.ZodString;
65
65
  }, z.core.$strict>>;
66
66
  }, z.core.$strict>;
67
+ export declare const triggerValidationResponseSchema: z.ZodObject<{
68
+ name: z.ZodString;
69
+ valid: z.ZodLiteral<true>;
70
+ }, z.core.$strict>;
71
+ export declare const triggerInstallationResponseSchema: z.ZodObject<{
72
+ triggerId: z.ZodString;
73
+ name: z.ZodString;
74
+ revisionId: z.ZodString;
75
+ version: z.ZodNumber;
76
+ active: z.ZodLiteral<true>;
77
+ }, z.core.$strict>;
67
78
  export declare const configurationResourcesSchema: z.ZodObject<{
68
79
  daemons: z.ZodArray<z.ZodObject<{
69
80
  id: z.ZodString;
@@ -83,21 +94,9 @@ export declare const configurationResourcesSchema: z.ZodObject<{
83
94
  slug: z.ZodString;
84
95
  teamName: z.ZodString;
85
96
  }, z.core.$strict>>;
86
- }, z.core.$strict>;
87
- export declare const setupResourcesSchema: z.ZodObject<{
88
- github: z.ZodArray<z.ZodObject<{
97
+ linear: z.ZodArray<z.ZodObject<{
89
98
  slug: z.ZodString;
90
- accountLogin: z.ZodString;
91
- accountType: z.ZodString;
92
- repositories: z.ZodArray<z.ZodString>;
93
- }, z.core.$strict>>;
94
- discord: z.ZodArray<z.ZodObject<{
95
- guildId: z.ZodString;
96
- guildName: z.ZodString;
97
- }, z.core.$strict>>;
98
- slack: z.ZodArray<z.ZodObject<{
99
- teamId: z.ZodString;
100
- teamName: z.ZodString;
99
+ organizationName: z.ZodString;
101
100
  }, z.core.$strict>>;
102
101
  }, z.core.$strict>;
103
102
  export declare const installResponseSchema: z.ZodObject<{
@@ -118,8 +117,9 @@ export type CliAuthorization = z.infer<typeof authorizationSchema>;
118
117
  export type CliAuthorizationPoll = z.infer<typeof authorizationPollSchema>;
119
118
  export type HubProject = z.infer<typeof projectSchema>;
120
119
  export type HubTrigger = z.infer<typeof triggerSchema>;
120
+ export type HubTriggerValidationResult = z.infer<typeof triggerValidationResponseSchema>;
121
+ export type HubTriggerInstallationResult = z.infer<typeof triggerInstallationResponseSchema>;
121
122
  export type HubConfigurationResources = z.infer<typeof configurationResourcesSchema>;
122
- export type HubSetupResources = z.infer<typeof setupResourcesSchema>;
123
123
  export type HubInstallResult = z.infer<typeof installResponseSchema>;
124
124
  export type HubValidationResult = z.infer<typeof validationResponseSchema>;
125
125
  export {};
@@ -40,6 +40,18 @@ const triggerSchema = z
40
40
  })
41
41
  .strict();
42
42
  export const triggersResponseSchema = z.object({ triggers: z.array(triggerSchema) }).strict();
43
+ export const triggerValidationResponseSchema = z
44
+ .object({ name: z.string().regex(/^[a-z][a-z0-9_-]*$/u), valid: z.literal(true) })
45
+ .strict();
46
+ export const triggerInstallationResponseSchema = z
47
+ .object({
48
+ triggerId: z.string().uuid(),
49
+ name: z.string().regex(/^[a-z][a-z0-9_-]*$/u),
50
+ revisionId: z.string().uuid(),
51
+ version: z.number().int().positive(),
52
+ active: z.literal(true),
53
+ })
54
+ .strict();
43
55
  export const configurationResourcesSchema = z
44
56
  .object({
45
57
  daemons: z.array(z.object({ id: z.string().uuid(), slug: z.string().min(1) }).strict()),
@@ -53,20 +65,7 @@ export const configurationResourcesSchema = z
53
65
  .strict()),
54
66
  discord: z.array(z.object({ slug: z.string().min(1), guildName: z.string().min(1) }).strict()),
55
67
  slack: z.array(z.object({ slug: z.string().min(1), teamName: z.string().min(1) }).strict()),
56
- })
57
- .strict();
58
- export const setupResourcesSchema = z
59
- .object({
60
- github: z.array(z
61
- .object({
62
- slug: z.string().min(1),
63
- accountLogin: z.string().min(1),
64
- accountType: z.string().min(1),
65
- repositories: z.array(z.string().min(1)),
66
- })
67
- .strict()),
68
- discord: z.array(z.object({ guildId: z.string().min(1), guildName: z.string().min(1) }).strict()),
69
- slack: z.array(z.object({ teamId: z.string().min(1), teamName: z.string().min(1) }).strict()),
68
+ linear: z.array(z.object({ slug: z.string().min(1), organizationName: z.string().min(1) }).strict()),
70
69
  })
71
70
  .strict();
72
71
  export const installResponseSchema = z
@@ -40,7 +40,7 @@ export function createHubCommand(overrides = {}) {
40
40
  flow: environment.login,
41
41
  reporter: environment.reporter,
42
42
  isInteractive: environment.isInteractive,
43
- continueGuidedSetup: (origin) => continueHubGuidedSetup(origin, environment),
43
+ continueGuidedSetup: (origin, daemonTarget) => continueHubGuidedSetup(origin, { ...environment, daemonTarget }),
44
44
  });
45
45
  addHubInitCommand(hub, environment);
46
46
  addHubConnectCommand(hub, {
@@ -52,7 +52,7 @@ export function createHubCommand(overrides = {}) {
52
52
  });
53
53
  addJsonAndDaemonHostOptions(hub.command("status")).action(withOutput(async (...args) => {
54
54
  const options = args.at(-2);
55
- return withHubDaemon(environment.daemon, options.host, async (client) => hubStatusResult((await client.getHubStatus()).status));
55
+ return withHubDaemon(environment.daemon, options.daemonTarget, async (client) => hubStatusResult((await client.getHubStatus()).status));
56
56
  }));
57
57
  addHubDisconnectCommand(hub, {
58
58
  daemon: environment.daemon,
@@ -1,17 +1,6 @@
1
- import type { HubDeployBundle } from "./deploy-bundle.js";
2
- import type { HubProject } from "./hub-client/index.js";
3
1
  import type { HubStatus } from "./daemon-client.js";
4
2
  import type { HubStarterAgentRuntime } from "./starter-agent-runtime.js";
5
3
  export type HubInitProvider = "github" | "slack" | "discord";
6
- export type HubInitProjectResolution = {
7
- kind: "none";
8
- } | {
9
- kind: "selected";
10
- project: HubProject;
11
- } | {
12
- kind: "choose";
13
- projects: readonly HubProject[];
14
- };
15
4
  export type HubInitConnectionResolution = {
16
5
  kind: "connected";
17
6
  daemonId: string;
@@ -24,30 +13,21 @@ export type HubInitConnectionResolution = {
24
13
  kind: "conflict";
25
14
  origin: string;
26
15
  };
27
- export interface HubInitOpeningPlan {
28
- replaceExisting: boolean;
29
- steps: readonly ("login" | "connect" | "project" | "scaffold")[];
30
- }
31
16
  export interface HubInitScaffoldInput {
32
17
  cwd: string;
33
18
  daemonSlug: string;
34
- agent: HubStarterAgentRuntime;
19
+ agent: HubStarterAgentRuntime & {
20
+ mode: string;
21
+ };
35
22
  provider: HubInitProvider;
36
23
  providerFilters: Readonly<Record<string, string>>;
37
24
  }
38
25
  export interface HubInitScaffold {
39
- hub: string;
40
- workflowPath: string;
41
- workflow: string;
26
+ triggerPath: string;
27
+ trigger: string;
42
28
  testAction: string;
43
29
  }
44
30
  export declare function hubLoginResumeCommand(step: "connect" | "init", origin: string): string;
45
- export declare function planHubInitOpening(input: {
46
- loggedIn: boolean;
47
- paseoDirectoryExists: boolean;
48
- }): HubInitOpeningPlan;
49
- export declare function createHubInitBundle(projectSlug: string, scaffold: HubInitScaffold): HubDeployBundle;
50
- export declare function resolveHubInitProjects(projects: readonly HubProject[]): HubInitProjectResolution;
51
31
  export declare function resolveHubInitConnection(status: HubStatus, origin: string): HubInitConnectionResolution;
52
32
  export declare function createHubInitScaffold(input: HubInitScaffoldInput): HubInitScaffold;
53
33
  //# sourceMappingURL=init-plan.d.ts.map