@cardelli/ambit 0.1.4 → 0.2.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.
Files changed (141) hide show
  1. package/esm/cli/commands/create/index.d.ts +2 -0
  2. package/esm/cli/commands/create/index.d.ts.map +1 -0
  3. package/esm/cli/commands/create/index.js +292 -0
  4. package/esm/cli/commands/create/machine.d.ts +33 -0
  5. package/esm/cli/commands/create/machine.d.ts.map +1 -0
  6. package/esm/cli/commands/create/machine.js +162 -0
  7. package/esm/cli/commands/deploy/index.d.ts +2 -0
  8. package/esm/cli/commands/deploy/index.d.ts.map +1 -0
  9. package/esm/cli/commands/deploy/index.js +290 -0
  10. package/esm/cli/commands/deploy/machine.d.ts +52 -0
  11. package/esm/cli/commands/deploy/machine.d.ts.map +1 -0
  12. package/esm/cli/commands/deploy/machine.js +116 -0
  13. package/esm/cli/commands/deploy/modes.d.ts +18 -0
  14. package/esm/cli/commands/deploy/modes.d.ts.map +1 -0
  15. package/esm/cli/commands/deploy/modes.js +152 -0
  16. package/esm/cli/commands/destroy/app.d.ts +2 -0
  17. package/esm/cli/commands/destroy/app.d.ts.map +1 -0
  18. package/esm/cli/commands/destroy/app.js +173 -0
  19. package/esm/cli/commands/destroy/index.d.ts +2 -0
  20. package/esm/cli/commands/destroy/index.d.ts.map +1 -0
  21. package/esm/cli/commands/destroy/index.js +63 -0
  22. package/esm/cli/commands/destroy/network.d.ts +2 -0
  23. package/esm/cli/commands/destroy/network.d.ts.map +1 -0
  24. package/esm/cli/commands/destroy/network.js +210 -0
  25. package/esm/cli/commands/doctor.d.ts.map +1 -0
  26. package/esm/cli/commands/doctor.js +295 -0
  27. package/esm/{src/cli → cli}/commands/list.d.ts.map +1 -1
  28. package/esm/{src/cli → cli}/commands/list.js +39 -54
  29. package/esm/cli/commands/status.d.ts.map +1 -0
  30. package/esm/cli/commands/status.js +331 -0
  31. package/esm/cli/mod.d.ts.map +1 -0
  32. package/esm/{src/cli → cli}/mod.js +4 -4
  33. package/esm/deno.d.ts +4 -18
  34. package/esm/deno.js +5 -19
  35. package/esm/deps/jsr.io/@std/path/1.1.4/constants.d.ts +1 -1
  36. package/esm/deps/jsr.io/@zod/zod/4.3.6/src/v4/core/json-schema-generator.d.ts +1 -1
  37. package/esm/lib/args.d.ts +11 -0
  38. package/esm/lib/args.d.ts.map +1 -0
  39. package/esm/lib/args.js +28 -0
  40. package/esm/lib/cli.d.ts +0 -2
  41. package/esm/lib/cli.d.ts.map +1 -1
  42. package/esm/lib/cli.js +41 -27
  43. package/esm/lib/command.d.ts +21 -49
  44. package/esm/lib/command.d.ts.map +1 -1
  45. package/esm/lib/command.js +55 -95
  46. package/esm/lib/machine.d.ts +11 -0
  47. package/esm/lib/machine.d.ts.map +1 -0
  48. package/esm/lib/machine.js +15 -0
  49. package/esm/lib/output.d.ts +3 -2
  50. package/esm/lib/output.d.ts.map +1 -1
  51. package/esm/lib/output.js +25 -11
  52. package/esm/lib/result.d.ts +18 -7
  53. package/esm/lib/result.d.ts.map +1 -1
  54. package/esm/lib/result.js +46 -1
  55. package/esm/main.d.ts +6 -6
  56. package/esm/main.d.ts.map +1 -1
  57. package/esm/main.js +7 -9
  58. package/esm/providers/fly.d.ts +81 -0
  59. package/esm/providers/fly.d.ts.map +1 -0
  60. package/esm/providers/fly.js +372 -0
  61. package/esm/providers/tailscale.d.ts +31 -0
  62. package/esm/providers/tailscale.d.ts.map +1 -0
  63. package/esm/providers/tailscale.js +150 -0
  64. package/esm/{src/schemas → schemas}/fly.d.ts +1 -11
  65. package/esm/schemas/fly.d.ts.map +1 -0
  66. package/esm/{src/schemas → schemas}/fly.js +14 -56
  67. package/esm/{src/schemas → schemas}/tailscale.d.ts +1 -2
  68. package/esm/schemas/tailscale.d.ts.map +1 -0
  69. package/esm/{src/schemas → schemas}/tailscale.js +2 -3
  70. package/esm/src/{docker/router → router}/Dockerfile +0 -11
  71. package/esm/src/router/start.sh +101 -0
  72. package/esm/util/constants.d.ts +13 -0
  73. package/esm/util/constants.d.ts.map +1 -0
  74. package/esm/util/constants.js +34 -0
  75. package/esm/{src → util}/credentials.d.ts +0 -1
  76. package/esm/util/credentials.d.ts.map +1 -0
  77. package/esm/{src → util}/credentials.js +3 -5
  78. package/esm/{src → util}/discovery.d.ts +20 -4
  79. package/esm/util/discovery.d.ts.map +1 -0
  80. package/esm/{src → util}/discovery.js +38 -15
  81. package/esm/util/fly-transforms.d.ts +27 -0
  82. package/esm/util/fly-transforms.d.ts.map +1 -0
  83. package/esm/util/fly-transforms.js +87 -0
  84. package/esm/{src → util}/guard.d.ts +1 -2
  85. package/esm/util/guard.d.ts.map +1 -0
  86. package/esm/{src → util}/guard.js +27 -27
  87. package/esm/util/naming.d.ts +5 -0
  88. package/esm/util/naming.d.ts.map +1 -0
  89. package/esm/util/naming.js +12 -0
  90. package/esm/{src → util}/resolve.d.ts +2 -3
  91. package/esm/util/resolve.d.ts.map +1 -0
  92. package/esm/{src → util}/resolve.js +1 -2
  93. package/esm/util/session.d.ts +16 -0
  94. package/esm/util/session.d.ts.map +1 -0
  95. package/esm/util/session.js +19 -0
  96. package/esm/util/tailscale-local.d.ts +13 -0
  97. package/esm/util/tailscale-local.d.ts.map +1 -0
  98. package/esm/util/tailscale-local.js +63 -0
  99. package/esm/{src → util}/template.d.ts +2 -4
  100. package/esm/util/template.d.ts.map +1 -0
  101. package/esm/{src → util}/template.js +14 -17
  102. package/package.json +1 -43
  103. package/esm/lib/paths.d.ts +0 -3
  104. package/esm/lib/paths.d.ts.map +0 -1
  105. package/esm/lib/paths.js +0 -5
  106. package/esm/src/cli/commands/create.d.ts +0 -2
  107. package/esm/src/cli/commands/create.d.ts.map +0 -1
  108. package/esm/src/cli/commands/create.js +0 -294
  109. package/esm/src/cli/commands/deploy.d.ts +0 -2
  110. package/esm/src/cli/commands/deploy.d.ts.map +0 -1
  111. package/esm/src/cli/commands/deploy.js +0 -426
  112. package/esm/src/cli/commands/destroy.d.ts +0 -2
  113. package/esm/src/cli/commands/destroy.d.ts.map +0 -1
  114. package/esm/src/cli/commands/destroy.js +0 -340
  115. package/esm/src/cli/commands/doctor.d.ts.map +0 -1
  116. package/esm/src/cli/commands/doctor.js +0 -141
  117. package/esm/src/cli/commands/status.d.ts.map +0 -1
  118. package/esm/src/cli/commands/status.js +0 -152
  119. package/esm/src/cli/mod.d.ts.map +0 -1
  120. package/esm/src/credentials.d.ts.map +0 -1
  121. package/esm/src/discovery.d.ts.map +0 -1
  122. package/esm/src/docker/router/start.sh +0 -146
  123. package/esm/src/guard.d.ts.map +0 -1
  124. package/esm/src/providers/fly.d.ts +0 -70
  125. package/esm/src/providers/fly.d.ts.map +0 -1
  126. package/esm/src/providers/fly.js +0 -411
  127. package/esm/src/providers/tailscale.d.ts +0 -31
  128. package/esm/src/providers/tailscale.d.ts.map +0 -1
  129. package/esm/src/providers/tailscale.js +0 -195
  130. package/esm/src/resolve.d.ts.map +0 -1
  131. package/esm/src/schemas/config.d.ts +0 -5
  132. package/esm/src/schemas/config.d.ts.map +0 -1
  133. package/esm/src/schemas/config.js +0 -22
  134. package/esm/src/schemas/fly.d.ts.map +0 -1
  135. package/esm/src/schemas/tailscale.d.ts.map +0 -1
  136. package/esm/src/template.d.ts.map +0 -1
  137. /package/esm/{src/cli → cli}/commands/doctor.d.ts +0 -0
  138. /package/esm/{src/cli → cli}/commands/list.d.ts +0 -0
  139. /package/esm/{src/cli → cli}/commands/status.d.ts +0 -0
  140. /package/esm/{src/cli → cli}/mod.d.ts +0 -0
  141. /package/esm/src/{docker/router → router}/fly.toml +0 -0
@@ -1,54 +1,26 @@
1
- import "../_dnt.polyfills.js";
2
- export interface CommandResult {
3
- success: boolean;
4
- code: number;
5
- stdout: string;
6
- stderr: string;
7
- }
8
- /**
9
- * Run a command and capture output.
10
- */
11
- export declare const runCommand: (args: string[], options?: {
1
+ import { Result } from "./result.js";
2
+ export interface RunOptions {
3
+ interactive?: boolean;
12
4
  cwd?: string;
13
5
  env?: Record<string, string>;
14
- stdin?: "inherit" | "null" | "piped";
15
- }) => Promise<CommandResult>;
16
- /**
17
- * Run a command that outputs JSON and parse it.
18
- */
19
- export declare const runCommandJson: <T>(args: string[], options?: {
20
- cwd?: string;
21
- env?: Record<string, string>;
22
- }) => Promise<{
23
- success: boolean;
24
- data?: T;
25
- error?: string;
26
- }>;
27
- /**
28
- * Run a command while showing a spinner.
29
- */
30
- export declare const runWithSpinner: (label: string, args: string[], options?: {
31
- cwd?: string;
32
- env?: Record<string, string>;
33
- }) => Promise<CommandResult>;
34
- /**
35
- * Run a command with spinner and return simplified result.
36
- */
37
- export declare const runQuiet: (label: string, args: string[], options?: {
38
- cwd?: string;
39
- env?: Record<string, string>;
40
- }) => Promise<{
41
- success: boolean;
42
- output: string;
43
- }>;
6
+ stdin?: "inherit" | "null";
7
+ }
8
+ export declare class CmdResult {
9
+ readonly code: number;
10
+ readonly stdout: string;
11
+ readonly stderr: string;
12
+ readonly ok: boolean;
13
+ constructor(code: number, stdout: string, stderr: string);
14
+ /** Parse stdout as JSON, returning Result<T>. */
15
+ json<T>(): Result<T>;
16
+ /** Merged stdout + stderr. */
17
+ get output(): string;
18
+ }
44
19
  /**
45
- * Run a command interactively (inherits stdio).
20
+ * Run a command and capture output.
21
+ * When `interactive: true`, inherits all stdio (no capture).
46
22
  */
47
- export declare const runInteractive: (args: string[], options?: {
48
- cwd?: string;
49
- env?: Record<string, string>;
50
- }) => Promise<{
51
- success: boolean;
52
- code: number;
53
- }>;
23
+ export declare const runCommand: (args: string[], options?: RunOptions) => Promise<CmdResult>;
24
+ /** Run and parse stdout as JSON. */
25
+ export declare const runJson: <T>(args: string[], options?: RunOptions) => Promise<Result<T>>;
54
26
  //# sourceMappingURL=command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/lib/command.ts"],"names":[],"mappings":"AAGA,OAAO,sBAAsB,CAAC;AAU9B,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OA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,CAAC,CAAuD,CAAC"}
@@ -1,27 +1,70 @@
1
1
  // =============================================================================
2
2
  // Shell Command Helpers
3
3
  // =============================================================================
4
- import "../_dnt.polyfills.js";
5
4
  import { spawn } from "node:child_process";
6
- import { Spinner } from "./cli.js";
5
+ import { Result } from "./result.js";
6
+ // =============================================================================
7
+ // Command Result
8
+ // =============================================================================
9
+ export class CmdResult {
10
+ code;
11
+ stdout;
12
+ stderr;
13
+ ok;
14
+ constructor(code, stdout, stderr) {
15
+ this.code = code;
16
+ this.stdout = stdout;
17
+ this.stderr = stderr;
18
+ this.ok = code === 0;
19
+ }
20
+ /** Parse stdout as JSON, returning Result<T>. */
21
+ json() {
22
+ if (!this.ok) {
23
+ return Result.err(this.stderr || `Command Failed With Code ${this.code}`);
24
+ }
25
+ try {
26
+ return Result.ok(JSON.parse(this.stdout));
27
+ }
28
+ catch {
29
+ return Result.err(`Failed To Parse JSON: ${this.stdout.slice(0, 100)}`);
30
+ }
31
+ }
32
+ /** Merged stdout + stderr. */
33
+ get output() {
34
+ return (this.stdout + this.stderr).trimEnd();
35
+ }
36
+ }
7
37
  // =============================================================================
8
38
  // Run Command
9
39
  // =============================================================================
10
40
  /**
11
41
  * Run a command and capture output.
42
+ * When `interactive: true`, inherits all stdio (no capture).
12
43
  */
13
44
  export const runCommand = (args, options) => {
14
45
  const [cmd, ...cmdArgs] = args;
46
+ const interactive = options?.interactive ?? false;
15
47
  return new Promise((resolve) => {
16
48
  const child = spawn(cmd, cmdArgs, {
17
49
  cwd: options?.cwd,
18
50
  env: options?.env ? { ...process.env, ...options.env } : undefined,
19
- stdio: [
20
- options?.stdin === "inherit" ? "inherit" : "ignore",
21
- "pipe",
22
- "pipe",
23
- ],
51
+ stdio: interactive
52
+ ? "inherit"
53
+ : [
54
+ options?.stdin === "inherit" ? "inherit" : "ignore",
55
+ "pipe",
56
+ "pipe",
57
+ ],
24
58
  });
59
+ if (interactive) {
60
+ child.on("error", () => {
61
+ resolve(new CmdResult(-1, "", ""));
62
+ });
63
+ child.on("close", (code) => {
64
+ resolve(new CmdResult(code ?? 1, "", ""));
65
+ });
66
+ return;
67
+ }
25
68
  const stdout = [];
26
69
  const stderr = [];
27
70
  child.stdout.setEncoding("utf8");
@@ -29,98 +72,15 @@ export const runCommand = (args, options) => {
29
72
  child.stdout.on("data", (chunk) => stdout.push(chunk));
30
73
  child.stderr.on("data", (chunk) => stderr.push(chunk));
31
74
  child.on("error", (error) => {
32
- resolve({
33
- success: false,
34
- code: -1,
35
- stdout: "",
36
- stderr: error.message,
37
- });
75
+ resolve(new CmdResult(-1, "", error.message));
38
76
  });
39
77
  child.on("close", (code) => {
40
- resolve({
41
- success: code === 0,
42
- code: code ?? 1,
43
- stdout: stdout.join(""),
44
- stderr: stderr.join(""),
45
- });
78
+ resolve(new CmdResult(code ?? 1, stdout.join(""), stderr.join("")));
46
79
  });
47
80
  });
48
81
  };
49
82
  // =============================================================================
50
- // Run Command with JSON Output
51
- // =============================================================================
52
- /**
53
- * Run a command that outputs JSON and parse it.
54
- */
55
- export const runCommandJson = async (args, options) => {
56
- const result = await runCommand(args, options);
57
- if (!result.success) {
58
- return {
59
- success: false,
60
- error: result.stderr || `Command failed with code ${result.code}`,
61
- };
62
- }
63
- try {
64
- const data = JSON.parse(result.stdout);
65
- return { success: true, data };
66
- }
67
- catch {
68
- return {
69
- success: false,
70
- error: `Failed to parse JSON output: ${result.stdout.slice(0, 100)}`,
71
- };
72
- }
73
- };
74
- // =============================================================================
75
- // Run with Spinner
76
- // =============================================================================
77
- /**
78
- * Run a command while showing a spinner.
79
- */
80
- export const runWithSpinner = async (label, args, options) => {
81
- const spinner = new Spinner();
82
- spinner.start(label);
83
- const result = await runCommand(args, options);
84
- if (result.success) {
85
- spinner.success(label);
86
- }
87
- else {
88
- spinner.fail(label);
89
- }
90
- return result;
91
- };
92
- // =============================================================================
93
- // Run Quiet
83
+ // Wrappers
94
84
  // =============================================================================
95
- /**
96
- * Run a command with spinner and return simplified result.
97
- */
98
- export const runQuiet = async (label, args, options) => {
99
- const result = await runWithSpinner(label, args, options);
100
- return {
101
- success: result.success,
102
- output: result.stdout + result.stderr,
103
- };
104
- };
105
- // =============================================================================
106
- // Run Interactive
107
- // =============================================================================
108
- /**
109
- * Run a command interactively (inherits stdio).
110
- */
111
- export const runInteractive = (args, options) => {
112
- const [cmd, ...cmdArgs] = args;
113
- return new Promise((resolve) => {
114
- const child = spawn(cmd, cmdArgs, {
115
- cwd: options?.cwd,
116
- env: options?.env ? { ...process.env, ...options.env } : undefined,
117
- stdio: "inherit",
118
- });
119
- child.on("error", () => {
120
- resolve({ success: false, code: -1 });
121
- });
122
- child.on("close", (code) => {
123
- resolve({ success: (code ?? 1) === 0, code: code ?? 1 });
124
- });
125
- });
126
- };
85
+ /** Run and parse stdout as JSON. */
86
+ export const runJson = (args, options) => runCommand(args, options).then((r) => r.json());
@@ -0,0 +1,11 @@
1
+ import { Result } from "./result.js";
2
+ /** A state machine phase with a transition function. */
3
+ export interface Machine<Phase extends string, Ctx> {
4
+ /** The terminal phase — when reached, the machine stops. */
5
+ terminal: Phase;
6
+ /** Execute the transition for the given phase. Returns the next phase. */
7
+ transition: (phase: Phase, ctx: Ctx) => Promise<Result<Phase>>;
8
+ }
9
+ /** Run a state machine from an initial phase to its terminal phase. */
10
+ export declare const runMachine: <Phase extends string, Ctx>(machine: Machine<Phase, Ctx>, initial: Phase, ctx: Ctx) => Promise<Result<Phase>>;
11
+ //# sourceMappingURL=machine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../../src/lib/machine.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,wDAAwD;AACxD,MAAM,WAAW,OAAO,CAAC,KAAK,SAAS,MAAM,EAAE,GAAG;IAChD,4DAA4D;IAC5D,QAAQ,EAAE,KAAK,CAAC;IAChB,0EAA0E;IAC1E,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;CAChE;AAED,uEAAuE;AACvE,eAAO,MAAM,UAAU,GAAU,KAAK,SAAS,MAAM,EAAE,GAAG,EACxD,SAAS,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,EAC5B,SAAS,KAAK,EACd,KAAK,GAAG,KACP,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAQvB,CAAC"}
@@ -0,0 +1,15 @@
1
+ // =============================================================================
2
+ // State Machine - Hydrate → Interpret → Run Pattern
3
+ // =============================================================================
4
+ import { Result } from "./result.js";
5
+ /** Run a state machine from an initial phase to its terminal phase. */
6
+ export const runMachine = async (machine, initial, ctx) => {
7
+ let phase = initial;
8
+ while (phase !== machine.terminal) {
9
+ const result = await machine.transition(phase, ctx);
10
+ if (!result.ok)
11
+ return result;
12
+ phase = result.value;
13
+ }
14
+ return Result.ok(phase);
15
+ };
@@ -1,4 +1,3 @@
1
- import "../_dnt.polyfills.js";
2
1
  export type SuccessResult<T> = {
3
2
  ok: true;
4
3
  } & T;
@@ -12,6 +11,8 @@ export declare class Output<T extends Record<string, unknown>> {
12
11
  constructor(jsonMode: boolean);
13
12
  done(data: T): this;
14
13
  fail(error: string, data?: Record<string, unknown>): this;
14
+ print(): void;
15
+ skip(text: string): this;
15
16
  ok(text: string): this;
16
17
  err(text: string): this;
17
18
  info(text: string): this;
@@ -25,7 +26,7 @@ export declare class Output<T extends Record<string, unknown>> {
25
26
  fail(msg: string): void;
26
27
  stop(): void;
27
28
  };
28
- print(): void;
29
+ spin<R>(label: string, fn: () => Promise<R>): Promise<R>;
29
30
  die(message: string): never;
30
31
  isJson(): boolean;
31
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAGA,OAAO,sBAAsB,CAAC;AAmB9B,MAAM,MAAM,aAAa,CAAC,CAAC,IAA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AAC,IAAI,IAAI,IAAI,CAAA;KAAE;IAiBlE,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAgB9D,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK;IAS3B,MAAM,IAAI,OAAO;CAGlB;AAMD,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5D,QAAQ,EAAE,OAAO,GAChB,MAAM,CAAC,CAAC,CAAC,CAEX"}
package/esm/lib/output.js CHANGED
@@ -1,8 +1,6 @@
1
1
  // =============================================================================
2
2
  // Output - Unified Output Handling for CLI Commands
3
3
  // =============================================================================
4
- import "../_dnt.polyfills.js";
5
- import * as dntShim from "../_dnt.shims.js";
6
4
  import { bold, dim, Spinner, statusErr, statusInfo, statusOk, statusWarn, } from "./cli.js";
7
5
  // =============================================================================
8
6
  // Output Class
@@ -26,9 +24,19 @@ export class Output {
26
24
  this.result = { ok: false, error, ...data };
27
25
  return this;
28
26
  }
27
+ print() {
28
+ if (this.jsonMode && this.result) {
29
+ console.log(JSON.stringify(this.result, null, 2));
30
+ }
31
+ }
29
32
  // ===========================================================================
30
33
  // Human-Mode Output (no-op in JSON mode)
31
34
  // ===========================================================================
35
+ skip(text) {
36
+ if (!this.jsonMode)
37
+ console.log(dim(`~ ${text}`));
38
+ return this;
39
+ }
32
40
  ok(text) {
33
41
  if (!this.jsonMode)
34
42
  statusOk(text);
@@ -69,7 +77,6 @@ export class Output {
69
77
  console.log();
70
78
  return this;
71
79
  }
72
- // JSON-aware spinner — no-op in JSON mode
73
80
  spinner(message) {
74
81
  if (this.jsonMode) {
75
82
  return { success: () => { }, fail: () => { }, stop: () => { } };
@@ -83,15 +90,23 @@ export class Output {
83
90
  };
84
91
  }
85
92
  // ===========================================================================
86
- // Terminal Output
93
+ // Async Spinner Wrapper
87
94
  // ===========================================================================
88
- // Print result as JSON (no-op in human mode)
89
- print() {
90
- if (this.jsonMode && this.result) {
91
- console.log(JSON.stringify(this.result, null, 2));
95
+ async spin(label, fn) {
96
+ const s = this.spinner(label);
97
+ try {
98
+ const result = await fn();
99
+ s.success(label);
100
+ return result;
101
+ }
102
+ catch (e) {
103
+ s.fail(label);
104
+ throw e;
92
105
  }
93
106
  }
94
- // Fatal error — outputs { ok: false, error } and exits
107
+ // ===========================================================================
108
+ // Terminal Output
109
+ // ===========================================================================
95
110
  die(message) {
96
111
  if (this.jsonMode) {
97
112
  console.log(JSON.stringify({ ok: false, error: message }, null, 2));
@@ -99,9 +114,8 @@ export class Output {
99
114
  else {
100
115
  statusErr(message);
101
116
  }
102
- dntShim.Deno.exit(1);
117
+ throw new Error("exit");
103
118
  }
104
- // Check if in JSON mode
105
119
  isJson() {
106
120
  return this.jsonMode;
107
121
  }
@@ -1,8 +1,19 @@
1
- export type Result<T, K extends string = string> = ({
2
- ok: true;
3
- } & T) | {
4
- ok: false;
5
- kind: K;
6
- message: string;
7
- };
1
+ export declare class Result<T> {
2
+ readonly ok: boolean;
3
+ private readonly _value;
4
+ private readonly _error;
5
+ private constructor();
6
+ static ok<T>(value: T): Result<T>;
7
+ static err<T = never>(error: string): Result<T>;
8
+ get value(): T | undefined;
9
+ get error(): string | undefined;
10
+ map<U>(fn: (value: T) => U): Result<U>;
11
+ flatMap<U>(fn: (value: T) => Result<U>): Result<U>;
12
+ unwrap(): T;
13
+ unwrapOr(fallback: T): T;
14
+ match<U>(cases: {
15
+ ok: (value: T) => U;
16
+ err: (error: string) => U;
17
+ }): U;
18
+ }
8
19
  //# sourceMappingURL=result.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/lib/result.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,IAC3C,CAAC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG,CAAC,CAAC,GAClB;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/lib/result.ts"],"names":[],"mappings":"AAIA,qBAAa,MAAM,CAAC,CAAC;IAEjB,QAAQ,CAAC,EAAE,EAAE,OAAO;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAHzB,OAAO;IAMP,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IAIjC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;IAI/C,IAAI,KAAK,IAAI,CAAC,GAAG,SAAS,CAEzB;IAED,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAED,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IAKtC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IAKlD,MAAM,IAAI,CAAC;IAKX,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC;IAIxB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE;QAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;QAAC,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC,CAAA;KAAE,GAAG,CAAC;CAGvE"}
package/esm/lib/result.js CHANGED
@@ -1 +1,46 @@
1
- export {};
1
+ // =============================================================================
2
+ // Result<T> — Shared Success/Failure Type
3
+ // =============================================================================
4
+ export class Result {
5
+ ok;
6
+ _value;
7
+ _error;
8
+ constructor(ok, _value, _error) {
9
+ this.ok = ok;
10
+ this._value = _value;
11
+ this._error = _error;
12
+ }
13
+ static ok(value) {
14
+ return new Result(true, value, undefined);
15
+ }
16
+ static err(error) {
17
+ return new Result(false, undefined, error);
18
+ }
19
+ get value() {
20
+ return this._value;
21
+ }
22
+ get error() {
23
+ return this._error;
24
+ }
25
+ map(fn) {
26
+ if (this.ok)
27
+ return Result.ok(fn(this._value));
28
+ return Result.err(this._error);
29
+ }
30
+ flatMap(fn) {
31
+ if (this.ok)
32
+ return fn(this._value);
33
+ return Result.err(this._error);
34
+ }
35
+ unwrap() {
36
+ if (this.ok)
37
+ return this._value;
38
+ throw new Error(this._error);
39
+ }
40
+ unwrapOr(fallback) {
41
+ return this.ok ? this._value : fallback;
42
+ }
43
+ match(cases) {
44
+ return this.ok ? cases.ok(this._value) : cases.err(this._error);
45
+ }
46
+ }
package/esm/main.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import "./_dnt.polyfills.js";
3
- import "./src/cli/commands/create.js";
4
- import "./src/cli/commands/deploy.js";
5
- import "./src/cli/commands/list.js";
6
- import "./src/cli/commands/status.js";
7
- import "./src/cli/commands/destroy.js";
8
- import "./src/cli/commands/doctor.js";
3
+ import "./cli/commands/create/index.js";
4
+ import "./cli/commands/deploy/index.js";
5
+ import "./cli/commands/list.js";
6
+ import "./cli/commands/status.js";
7
+ import "./cli/commands/destroy/index.js";
8
+ import "./cli/commands/doctor.js";
9
9
  //# sourceMappingURL=main.d.ts.map
package/esm/main.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,qBAAqB,CAAC;AA+B7B,OAAO,8BAA8B,CAAC;AACtC,OAAO,8BAA8B,CAAC;AACtC,OAAO,4BAA4B,CAAC;AACpC,OAAO,8BAA8B,CAAC;AACtC,OAAO,+BAA+B,CAAC;AACvC,OAAO,8BAA8B,CAAC"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,qBAAqB,CAAC;AA8B7B,OAAO,gCAAgC,CAAC;AACxC,OAAO,gCAAgC,CAAC;AACxC,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;AAClC,OAAO,iCAAiC,CAAC;AACzC,OAAO,0BAA0B,CAAC"}
package/esm/main.js CHANGED
@@ -24,21 +24,19 @@ import * as dntShim from "./_dnt.shims.js";
24
24
  // ambit doctor
25
25
  //
26
26
  // =============================================================================
27
- import { runCli } from "./src/cli/mod.js";
27
+ import { runCli } from "./cli/mod.js";
28
28
  import { Spinner, statusErr } from "./lib/cli.js";
29
- // Import commands to register them
30
- import "./src/cli/commands/create.js";
31
- import "./src/cli/commands/deploy.js";
32
- import "./src/cli/commands/list.js";
33
- import "./src/cli/commands/status.js";
34
- import "./src/cli/commands/destroy.js";
35
- import "./src/cli/commands/doctor.js";
29
+ import "./cli/commands/create/index.js";
30
+ import "./cli/commands/deploy/index.js";
31
+ import "./cli/commands/list.js";
32
+ import "./cli/commands/status.js";
33
+ import "./cli/commands/destroy/index.js";
34
+ import "./cli/commands/doctor.js";
36
35
  // =============================================================================
37
36
  // Main
38
37
  // =============================================================================
39
38
  const main = async () => {
40
39
  const spinner = new Spinner();
41
- // Handle signals
42
40
  try {
43
41
  dntShim.Deno.addSignalListener("SIGINT", () => {
44
42
  spinner.stop();
@@ -0,0 +1,81 @@
1
+ import { type FlyApp, type FlyAppInfo, type FlyIp, type FlyMachine } from "../schemas/fly.js";
2
+ /**
3
+ * Thrown when a `fly deploy` command fails. Carries the raw stderr so callers
4
+ * can surface it through `out` (respecting JSON mode) instead of printing
5
+ * directly.
6
+ */
7
+ export declare class FlyDeployError extends Error {
8
+ /** Last meaningful line from flyctl stderr. */
9
+ readonly detail: string;
10
+ constructor(app: string, stderr: string);
11
+ }
12
+ export type MachineSize = "shared-cpu-1x" | "shared-cpu-2x" | "shared-cpu-4x";
13
+ export interface MachineConfig {
14
+ size: MachineSize;
15
+ memoryMb?: number;
16
+ region?: string;
17
+ autoStopSeconds?: number;
18
+ }
19
+ export interface MachineResult {
20
+ id: string;
21
+ state: string;
22
+ size: string;
23
+ region: string;
24
+ privateIp?: string;
25
+ }
26
+ export interface SafeDeployOptions {
27
+ image?: string;
28
+ config?: string;
29
+ region?: string;
30
+ routerId?: string;
31
+ }
32
+ export interface FlyProvider {
33
+ auth: {
34
+ ensureInstalled(): Promise<void>;
35
+ login(opts?: {
36
+ interactive?: boolean;
37
+ }): Promise<string>;
38
+ getToken(): Promise<string>;
39
+ };
40
+ orgs: {
41
+ list(): Promise<Record<string, string>>;
42
+ };
43
+ apps: {
44
+ list(org?: string): Promise<FlyApp[]>;
45
+ listWithNetwork(org: string): Promise<FlyAppInfo[]>;
46
+ create(name: string, org: string, opts?: {
47
+ network?: string;
48
+ routerId?: string;
49
+ }): Promise<void>;
50
+ delete(name: string): Promise<void>;
51
+ exists(name: string): Promise<boolean>;
52
+ getConfig(name: string): Promise<Record<string, unknown> | null>;
53
+ };
54
+ machines: {
55
+ list(app: string): Promise<FlyMachine[]>;
56
+ clone(app: string, config: MachineConfig): Promise<MachineResult>;
57
+ destroy(app: string, machineId: string): Promise<void>;
58
+ };
59
+ secrets: {
60
+ set(app: string, secrets: Record<string, string>, opts?: {
61
+ stage?: boolean;
62
+ }): Promise<void>;
63
+ };
64
+ ips: {
65
+ list(app: string): Promise<FlyIp[]>;
66
+ release(app: string, address: string): Promise<void>;
67
+ allocateFlycast(app: string, network: string): Promise<void>;
68
+ };
69
+ certs: {
70
+ list(app: string): Promise<string[]>;
71
+ remove(app: string, hostname: string): Promise<void>;
72
+ };
73
+ deploy: {
74
+ router(app: string, dir: string, config?: {
75
+ region?: string;
76
+ }): Promise<void>;
77
+ app(app: string, options: SafeDeployOptions): Promise<void>;
78
+ };
79
+ }
80
+ export declare const createFlyProvider: () => FlyProvider;
81
+ //# sourceMappingURL=fly.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fly.d.ts","sourceRoot":"","sources":["../../src/providers/fly.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,UAAU,EAIf,KAAK,KAAK,EAEV,KAAK,UAAU,EAIhB,MAAM,mBAAmB,CAAC;AAS3B;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAMxC;AAMD,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,eAAe,GAAG,eAAe,CAAC;AAE9E,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAMD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE;QACJ,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;QACjC,KAAK,CAAC,IAAI,CAAC,EAAE;YAAE,WAAW,CAAC,EAAE,OAAO,CAAA;SAAE,GAAG,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