@project-ajax/sdk 0.0.60 → 0.0.61

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 (142) hide show
  1. package/package.json +3 -11
  2. package/dist/cli/api/client.d.ts +0 -212
  3. package/dist/cli/api/client.d.ts.map +0 -1
  4. package/dist/cli/api/client.js +0 -330
  5. package/dist/cli/api/result.d.ts +0 -43
  6. package/dist/cli/api/result.d.ts.map +0 -1
  7. package/dist/cli/api/result.js +0 -43
  8. package/dist/cli/bin/cli.d.ts +0 -3
  9. package/dist/cli/bin/cli.d.ts.map +0 -1
  10. package/dist/cli/bin/cli.js +0 -5
  11. package/dist/cli/commands/auth.d.ts +0 -2
  12. package/dist/cli/commands/auth.d.ts.map +0 -1
  13. package/dist/cli/commands/auth.impl.d.ts +0 -5
  14. package/dist/cli/commands/auth.impl.d.ts.map +0 -1
  15. package/dist/cli/commands/auth.impl.js +0 -45
  16. package/dist/cli/commands/auth.impl.test.d.ts +0 -2
  17. package/dist/cli/commands/auth.impl.test.d.ts.map +0 -1
  18. package/dist/cli/commands/auth.js +0 -56
  19. package/dist/cli/commands/bundle.d.ts +0 -2
  20. package/dist/cli/commands/bundle.d.ts.map +0 -1
  21. package/dist/cli/commands/bundle.impl.d.ts +0 -2
  22. package/dist/cli/commands/bundle.impl.d.ts.map +0 -1
  23. package/dist/cli/commands/bundle.impl.js +0 -21
  24. package/dist/cli/commands/bundle.impl.test.d.ts +0 -2
  25. package/dist/cli/commands/bundle.impl.test.d.ts.map +0 -1
  26. package/dist/cli/commands/bundle.js +0 -23
  27. package/dist/cli/commands/capabilities.d.ts +0 -2
  28. package/dist/cli/commands/capabilities.d.ts.map +0 -1
  29. package/dist/cli/commands/capabilities.impl.d.ts +0 -3
  30. package/dist/cli/commands/capabilities.impl.d.ts.map +0 -1
  31. package/dist/cli/commands/capabilities.impl.js +0 -40
  32. package/dist/cli/commands/capabilities.js +0 -24
  33. package/dist/cli/commands/connect.d.ts +0 -2
  34. package/dist/cli/commands/connect.d.ts.map +0 -1
  35. package/dist/cli/commands/connect.impl.d.ts +0 -6
  36. package/dist/cli/commands/connect.impl.d.ts.map +0 -1
  37. package/dist/cli/commands/connect.impl.js +0 -116
  38. package/dist/cli/commands/connect.js +0 -78
  39. package/dist/cli/commands/deploy.d.ts +0 -3
  40. package/dist/cli/commands/deploy.d.ts.map +0 -1
  41. package/dist/cli/commands/deploy.impl.d.ts +0 -6
  42. package/dist/cli/commands/deploy.impl.d.ts.map +0 -1
  43. package/dist/cli/commands/deploy.impl.js +0 -60
  44. package/dist/cli/commands/deploy.impl.test.d.ts +0 -2
  45. package/dist/cli/commands/deploy.impl.test.d.ts.map +0 -1
  46. package/dist/cli/commands/deploy.js +0 -22
  47. package/dist/cli/commands/env.d.ts +0 -2
  48. package/dist/cli/commands/env.d.ts.map +0 -1
  49. package/dist/cli/commands/env.impl.d.ts +0 -11
  50. package/dist/cli/commands/env.impl.d.ts.map +0 -1
  51. package/dist/cli/commands/env.impl.js +0 -62
  52. package/dist/cli/commands/env.js +0 -39
  53. package/dist/cli/commands/exec.d.ts +0 -3
  54. package/dist/cli/commands/exec.d.ts.map +0 -1
  55. package/dist/cli/commands/exec.impl.d.ts +0 -7
  56. package/dist/cli/commands/exec.impl.d.ts.map +0 -1
  57. package/dist/cli/commands/exec.impl.js +0 -123
  58. package/dist/cli/commands/exec.js +0 -30
  59. package/dist/cli/commands/runs.d.ts +0 -2
  60. package/dist/cli/commands/runs.d.ts.map +0 -1
  61. package/dist/cli/commands/runs.impl.d.ts +0 -4
  62. package/dist/cli/commands/runs.impl.d.ts.map +0 -1
  63. package/dist/cli/commands/runs.impl.js +0 -71
  64. package/dist/cli/commands/runs.js +0 -45
  65. package/dist/cli/commands/secrets.d.ts +0 -2
  66. package/dist/cli/commands/secrets.d.ts.map +0 -1
  67. package/dist/cli/commands/secrets.impl.d.ts +0 -5
  68. package/dist/cli/commands/secrets.impl.d.ts.map +0 -1
  69. package/dist/cli/commands/secrets.impl.js +0 -99
  70. package/dist/cli/commands/secrets.js +0 -64
  71. package/dist/cli/commands/utils/testing.d.ts +0 -13
  72. package/dist/cli/commands/utils/testing.d.ts.map +0 -1
  73. package/dist/cli/commands/utils/testing.js +0 -58
  74. package/dist/cli/config.d.ts +0 -63
  75. package/dist/cli/config.d.ts.map +0 -1
  76. package/dist/cli/config.js +0 -194
  77. package/dist/cli/config.test.d.ts +0 -2
  78. package/dist/cli/config.test.d.ts.map +0 -1
  79. package/dist/cli/context.d.ts +0 -15
  80. package/dist/cli/context.d.ts.map +0 -1
  81. package/dist/cli/context.js +0 -16
  82. package/dist/cli/deploy.d.ts +0 -37
  83. package/dist/cli/deploy.d.ts.map +0 -1
  84. package/dist/cli/deploy.js +0 -100
  85. package/dist/cli/flags.d.ts +0 -21
  86. package/dist/cli/flags.d.ts.map +0 -1
  87. package/dist/cli/flags.js +0 -49
  88. package/dist/cli/handler.d.ts +0 -14
  89. package/dist/cli/handler.d.ts.map +0 -1
  90. package/dist/cli/handler.js +0 -32
  91. package/dist/cli/io.d.ts +0 -55
  92. package/dist/cli/io.d.ts.map +0 -1
  93. package/dist/cli/io.js +0 -96
  94. package/dist/cli/routes.d.ts +0 -2
  95. package/dist/cli/routes.d.ts.map +0 -1
  96. package/dist/cli/routes.js +0 -62
  97. package/dist/cli/utils/array.d.ts +0 -2
  98. package/dist/cli/utils/array.d.ts.map +0 -1
  99. package/dist/cli/utils/array.js +0 -10
  100. package/dist/cli/utils/openUrl.d.ts +0 -4
  101. package/dist/cli/utils/openUrl.d.ts.map +0 -1
  102. package/dist/cli/utils/openUrl.js +0 -43
  103. package/dist/cli/utils/string.d.ts +0 -2
  104. package/dist/cli/utils/string.d.ts.map +0 -1
  105. package/dist/cli/utils/string.js +0 -12
  106. package/src/cli/api/client.ts +0 -628
  107. package/src/cli/api/result.ts +0 -71
  108. package/src/cli/bin/cli.ts +0 -7
  109. package/src/cli/commands/.cursor/rules/testing-commands.mdc +0 -212
  110. package/src/cli/commands/auth.impl.test.ts +0 -228
  111. package/src/cli/commands/auth.impl.ts +0 -56
  112. package/src/cli/commands/auth.ts +0 -63
  113. package/src/cli/commands/bundle.impl.test.ts +0 -143
  114. package/src/cli/commands/bundle.impl.ts +0 -21
  115. package/src/cli/commands/bundle.ts +0 -23
  116. package/src/cli/commands/capabilities.impl.ts +0 -47
  117. package/src/cli/commands/capabilities.ts +0 -25
  118. package/src/cli/commands/connect.impl.ts +0 -149
  119. package/src/cli/commands/connect.ts +0 -80
  120. package/src/cli/commands/deploy.impl.test.ts +0 -254
  121. package/src/cli/commands/deploy.impl.ts +0 -73
  122. package/src/cli/commands/deploy.ts +0 -22
  123. package/src/cli/commands/env.impl.ts +0 -88
  124. package/src/cli/commands/env.ts +0 -38
  125. package/src/cli/commands/exec.impl.ts +0 -171
  126. package/src/cli/commands/exec.ts +0 -32
  127. package/src/cli/commands/runs.impl.ts +0 -87
  128. package/src/cli/commands/runs.ts +0 -49
  129. package/src/cli/commands/secrets.impl.ts +0 -130
  130. package/src/cli/commands/secrets.ts +0 -73
  131. package/src/cli/commands/utils/testing.ts +0 -66
  132. package/src/cli/config.test.ts +0 -108
  133. package/src/cli/config.ts +0 -265
  134. package/src/cli/context.ts +0 -26
  135. package/src/cli/deploy.ts +0 -190
  136. package/src/cli/flags.ts +0 -72
  137. package/src/cli/handler.ts +0 -68
  138. package/src/cli/io.ts +0 -132
  139. package/src/cli/routes.ts +0 -61
  140. package/src/cli/utils/array.ts +0 -7
  141. package/src/cli/utils/openUrl.ts +0 -53
  142. package/src/cli/utils/string.ts +0 -9
package/dist/cli/io.js DELETED
@@ -1,96 +0,0 @@
1
- import * as prompts from "@inquirer/prompts";
2
- import { createTable } from "@visulima/tabular";
3
- class IO {
4
- debugEnabled;
5
- constructor(options) {
6
- this.debugEnabled = options.debugEnabled;
7
- }
8
- /**
9
- * Writes a debug message to standard error.
10
- *
11
- * @param args The arguments to write.
12
- */
13
- debug(...args) {
14
- if (this.debugEnabled) {
15
- args.join(" ").split("\n").forEach((line) => {
16
- this.writeErr(`[debug] ${line}`);
17
- });
18
- }
19
- }
20
- /**
21
- * Writes a message to standard out.
22
- *
23
- * @param args The arguments to write.
24
- */
25
- writeOut(...args) {
26
- process.stdout.write(`${args.join(" ")}
27
- `);
28
- }
29
- /**
30
- * Writes a message to standard error.
31
- *
32
- * @param args The arguments to write.
33
- */
34
- writeErr(...args) {
35
- process.stderr.write(`${args.join(" ")}
36
- `);
37
- }
38
- /**
39
- * Writes a table to standard out.
40
- *
41
- * @param tableConfig The table configuration.
42
- */
43
- writeTableOut(tableConfig) {
44
- const content = this.#buildTable(tableConfig);
45
- this.writeOut(content);
46
- }
47
- /**
48
- * Writes a table to standard error.
49
- *
50
- * @param tableConfig The table configuration.
51
- */
52
- writeTableErr(tableConfig) {
53
- const content = this.#buildTable(tableConfig);
54
- this.writeErr(content);
55
- }
56
- confirm(config) {
57
- this.#ensureTTY(config.noTTY);
58
- return prompts.confirm(config).catch(this.#handlePromptExit.bind(this));
59
- }
60
- input(config) {
61
- this.#ensureTTY(config.noTTY);
62
- return prompts.input(config).catch(this.#handlePromptExit.bind(this));
63
- }
64
- #ensureTTY(noTTY) {
65
- if (!process.stdin.isTTY) {
66
- this.writeErr(noTTY);
67
- process.exit(1);
68
- }
69
- return true;
70
- }
71
- #handlePromptExit(err) {
72
- if (err instanceof Error && err.name === "ExitPromptError") {
73
- this.writeErr("\u{1F44B} Prompt cancelled. Goodbye!");
74
- process.exit(1);
75
- }
76
- throw err;
77
- }
78
- #buildTable(tableConfig) {
79
- if (tableConfig.plain) {
80
- return tableConfig.rows.map((row) => {
81
- return row.map((cell) => isTableItem(cell) ? cell.content : cell).join(" ");
82
- }).join("\n");
83
- } else {
84
- const table = createTable();
85
- table.setHeaders(tableConfig.headers);
86
- table.addRows(...tableConfig.rows);
87
- return table.toString();
88
- }
89
- }
90
- }
91
- function isTableItem(cell) {
92
- return typeof cell === "object";
93
- }
94
- export {
95
- IO
96
- };
@@ -1,2 +0,0 @@
1
- export declare const app: import("@stricli/core").Application<import("./context.js").LocalContext>;
2
- //# sourceMappingURL=routes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/cli/routes.ts"],"names":[],"mappings":"AA4CA,eAAO,MAAM,GAAG,0EAgBd,CAAC"}
@@ -1,62 +0,0 @@
1
- import { buildApplication, buildRouteMap, text_en } from "@stricli/core";
2
- import packageJson from "../../package.json" with { type: "json" };
3
- import { authCommands } from "./commands/auth.js";
4
- import { bundleCommands } from "./commands/bundle.js";
5
- import { capabilitiesCommands } from "./commands/capabilities.js";
6
- import { connectCommands } from "./commands/connect.js";
7
- import deploy from "./commands/deploy.js";
8
- import { envCommands } from "./commands/env.js";
9
- import exec from "./commands/exec.js";
10
- import { runsCommands } from "./commands/runs.js";
11
- import { secretsCommands } from "./commands/secrets.js";
12
- import { TokenNotSetError } from "./config.js";
13
- const routes = buildRouteMap({
14
- docs: {
15
- brief: "A CLI for the Project Ajax platform",
16
- fullDescription: `
17
- The Project Ajax CLI is a tool for managing workers, which run code written by
18
- you, other developers, or AI agents to perform automation tasks, such as syncing
19
- data, adding slash commands, or performing other actions.
20
-
21
- Most flags are configured either with a config file or flags, but environment
22
- variables can also be provided:
23
-
24
- - WORKERS_CONFIG_FILE_PATH: The path to the config file to use (e.g. ./workers.dev.json)
25
- - WORKERS_TOKEN: The token to use for authentication
26
- - WORKERS_ENVIRONMENT: The environment to use
27
- - WORKERS_WORKER_ID: The worker ID to use
28
- - WORKERS_BASE_URL: The base API URL to use
29
- `.trim()
30
- },
31
- routes: {
32
- auth: authCommands,
33
- capabilities: capabilitiesCommands,
34
- deploy,
35
- exec,
36
- connect: connectCommands,
37
- env: envCommands,
38
- runs: runsCommands,
39
- secrets: secretsCommands,
40
- bundle: bundleCommands
41
- }
42
- });
43
- const app = buildApplication(routes, {
44
- name: "workers",
45
- versionInfo: {
46
- currentVersion: packageJson.version
47
- },
48
- localization: {
49
- loadText: () => ({
50
- ...text_en,
51
- exceptionWhileRunningCommand(exc, ansiColor) {
52
- if (exc instanceof TokenNotSetError) {
53
- return exc.message;
54
- }
55
- return text_en.exceptionWhileRunningCommand(exc, ansiColor);
56
- }
57
- })
58
- }
59
- });
60
- export {
61
- app
62
- };
@@ -1,2 +0,0 @@
1
- export declare function chunkEvery<T>(array: readonly T[], size: number): T[][];
2
- //# sourceMappingURL=array.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/array.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAMtE"}
@@ -1,10 +0,0 @@
1
- function chunkEvery(array, size) {
2
- const result = [];
3
- for (let i = 0; i < array.length; i += size) {
4
- result.push(array.slice(i, i + size));
5
- }
6
- return result;
7
- }
8
- export {
9
- chunkEvery
10
- };
@@ -1,4 +0,0 @@
1
- import type { Environment } from "../config.js";
2
- export declare function openBrowserUrl(url: string): Promise<void>;
3
- export declare function openNotionUrl(env: Environment, url: string): Promise<void>;
4
- //# sourceMappingURL=openUrl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openUrl.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/openUrl.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAc/D;AAED,wBAAsB,aAAa,CAClC,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC,CAgBf"}
@@ -1,43 +0,0 @@
1
- import { exec } from "node:child_process";
2
- import { existsSync } from "node:fs";
3
- async function openBrowserUrl(url) {
4
- const platform = process.platform;
5
- try {
6
- if (platform === "darwin") {
7
- exec(`open "${url}"`);
8
- } else if (platform === "win32") {
9
- exec(`start "" "${url}"`);
10
- } else {
11
- exec(`xdg-open "${url}"`);
12
- }
13
- } catch (error) {
14
- throw new Error(`Failed to open browser: ${error}`);
15
- }
16
- }
17
- async function openNotionUrl(env, url) {
18
- const platform = process.platform;
19
- if (platform === "darwin") {
20
- const appName = preferredNotionApp(env);
21
- if (appName) {
22
- try {
23
- exec(`open -a "${appName}" "${url}"`);
24
- return;
25
- } catch {
26
- }
27
- }
28
- }
29
- await openBrowserUrl(url);
30
- }
31
- function preferredNotionApp(env) {
32
- if (env === "prod" && existsSync("/Applications/Notion.app")) {
33
- return "Notion";
34
- }
35
- if (env === "dev" && existsSync("/Applications/Notion Dev.app")) {
36
- return "Notion Dev";
37
- }
38
- return null;
39
- }
40
- export {
41
- openBrowserUrl,
42
- openNotionUrl
43
- };
@@ -1,2 +0,0 @@
1
- export declare function pluralize(count: number, word: string, pluralWord?: string): string;
2
- //# sourceMappingURL=string.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/string.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,UAQzE"}
@@ -1,12 +0,0 @@
1
- function pluralize(count, word, pluralWord) {
2
- if (count === 1) {
3
- return `${count} ${word}`;
4
- }
5
- if (!pluralWord) {
6
- return `${count} ${word}s`;
7
- }
8
- return `${count} ${pluralWord}`;
9
- }
10
- export {
11
- pluralize
12
- };