@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.
- package/package.json +3 -11
- package/dist/cli/api/client.d.ts +0 -212
- package/dist/cli/api/client.d.ts.map +0 -1
- package/dist/cli/api/client.js +0 -330
- package/dist/cli/api/result.d.ts +0 -43
- package/dist/cli/api/result.d.ts.map +0 -1
- package/dist/cli/api/result.js +0 -43
- package/dist/cli/bin/cli.d.ts +0 -3
- package/dist/cli/bin/cli.d.ts.map +0 -1
- package/dist/cli/bin/cli.js +0 -5
- package/dist/cli/commands/auth.d.ts +0 -2
- package/dist/cli/commands/auth.d.ts.map +0 -1
- package/dist/cli/commands/auth.impl.d.ts +0 -5
- package/dist/cli/commands/auth.impl.d.ts.map +0 -1
- package/dist/cli/commands/auth.impl.js +0 -45
- package/dist/cli/commands/auth.impl.test.d.ts +0 -2
- package/dist/cli/commands/auth.impl.test.d.ts.map +0 -1
- package/dist/cli/commands/auth.js +0 -56
- package/dist/cli/commands/bundle.d.ts +0 -2
- package/dist/cli/commands/bundle.d.ts.map +0 -1
- package/dist/cli/commands/bundle.impl.d.ts +0 -2
- package/dist/cli/commands/bundle.impl.d.ts.map +0 -1
- package/dist/cli/commands/bundle.impl.js +0 -21
- package/dist/cli/commands/bundle.impl.test.d.ts +0 -2
- package/dist/cli/commands/bundle.impl.test.d.ts.map +0 -1
- package/dist/cli/commands/bundle.js +0 -23
- package/dist/cli/commands/capabilities.d.ts +0 -2
- package/dist/cli/commands/capabilities.d.ts.map +0 -1
- package/dist/cli/commands/capabilities.impl.d.ts +0 -3
- package/dist/cli/commands/capabilities.impl.d.ts.map +0 -1
- package/dist/cli/commands/capabilities.impl.js +0 -40
- package/dist/cli/commands/capabilities.js +0 -24
- package/dist/cli/commands/connect.d.ts +0 -2
- package/dist/cli/commands/connect.d.ts.map +0 -1
- package/dist/cli/commands/connect.impl.d.ts +0 -6
- package/dist/cli/commands/connect.impl.d.ts.map +0 -1
- package/dist/cli/commands/connect.impl.js +0 -116
- package/dist/cli/commands/connect.js +0 -78
- package/dist/cli/commands/deploy.d.ts +0 -3
- package/dist/cli/commands/deploy.d.ts.map +0 -1
- package/dist/cli/commands/deploy.impl.d.ts +0 -6
- package/dist/cli/commands/deploy.impl.d.ts.map +0 -1
- package/dist/cli/commands/deploy.impl.js +0 -60
- package/dist/cli/commands/deploy.impl.test.d.ts +0 -2
- package/dist/cli/commands/deploy.impl.test.d.ts.map +0 -1
- package/dist/cli/commands/deploy.js +0 -22
- package/dist/cli/commands/env.d.ts +0 -2
- package/dist/cli/commands/env.d.ts.map +0 -1
- package/dist/cli/commands/env.impl.d.ts +0 -11
- package/dist/cli/commands/env.impl.d.ts.map +0 -1
- package/dist/cli/commands/env.impl.js +0 -62
- package/dist/cli/commands/env.js +0 -39
- package/dist/cli/commands/exec.d.ts +0 -3
- package/dist/cli/commands/exec.d.ts.map +0 -1
- package/dist/cli/commands/exec.impl.d.ts +0 -7
- package/dist/cli/commands/exec.impl.d.ts.map +0 -1
- package/dist/cli/commands/exec.impl.js +0 -123
- package/dist/cli/commands/exec.js +0 -30
- package/dist/cli/commands/runs.d.ts +0 -2
- package/dist/cli/commands/runs.d.ts.map +0 -1
- package/dist/cli/commands/runs.impl.d.ts +0 -4
- package/dist/cli/commands/runs.impl.d.ts.map +0 -1
- package/dist/cli/commands/runs.impl.js +0 -71
- package/dist/cli/commands/runs.js +0 -45
- package/dist/cli/commands/secrets.d.ts +0 -2
- package/dist/cli/commands/secrets.d.ts.map +0 -1
- package/dist/cli/commands/secrets.impl.d.ts +0 -5
- package/dist/cli/commands/secrets.impl.d.ts.map +0 -1
- package/dist/cli/commands/secrets.impl.js +0 -99
- package/dist/cli/commands/secrets.js +0 -64
- package/dist/cli/commands/utils/testing.d.ts +0 -13
- package/dist/cli/commands/utils/testing.d.ts.map +0 -1
- package/dist/cli/commands/utils/testing.js +0 -58
- package/dist/cli/config.d.ts +0 -63
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js +0 -194
- package/dist/cli/config.test.d.ts +0 -2
- package/dist/cli/config.test.d.ts.map +0 -1
- package/dist/cli/context.d.ts +0 -15
- package/dist/cli/context.d.ts.map +0 -1
- package/dist/cli/context.js +0 -16
- package/dist/cli/deploy.d.ts +0 -37
- package/dist/cli/deploy.d.ts.map +0 -1
- package/dist/cli/deploy.js +0 -100
- package/dist/cli/flags.d.ts +0 -21
- package/dist/cli/flags.d.ts.map +0 -1
- package/dist/cli/flags.js +0 -49
- package/dist/cli/handler.d.ts +0 -14
- package/dist/cli/handler.d.ts.map +0 -1
- package/dist/cli/handler.js +0 -32
- package/dist/cli/io.d.ts +0 -55
- package/dist/cli/io.d.ts.map +0 -1
- package/dist/cli/io.js +0 -96
- package/dist/cli/routes.d.ts +0 -2
- package/dist/cli/routes.d.ts.map +0 -1
- package/dist/cli/routes.js +0 -62
- package/dist/cli/utils/array.d.ts +0 -2
- package/dist/cli/utils/array.d.ts.map +0 -1
- package/dist/cli/utils/array.js +0 -10
- package/dist/cli/utils/openUrl.d.ts +0 -4
- package/dist/cli/utils/openUrl.d.ts.map +0 -1
- package/dist/cli/utils/openUrl.js +0 -43
- package/dist/cli/utils/string.d.ts +0 -2
- package/dist/cli/utils/string.d.ts.map +0 -1
- package/dist/cli/utils/string.js +0 -12
- package/src/cli/api/client.ts +0 -628
- package/src/cli/api/result.ts +0 -71
- package/src/cli/bin/cli.ts +0 -7
- package/src/cli/commands/.cursor/rules/testing-commands.mdc +0 -212
- package/src/cli/commands/auth.impl.test.ts +0 -228
- package/src/cli/commands/auth.impl.ts +0 -56
- package/src/cli/commands/auth.ts +0 -63
- package/src/cli/commands/bundle.impl.test.ts +0 -143
- package/src/cli/commands/bundle.impl.ts +0 -21
- package/src/cli/commands/bundle.ts +0 -23
- package/src/cli/commands/capabilities.impl.ts +0 -47
- package/src/cli/commands/capabilities.ts +0 -25
- package/src/cli/commands/connect.impl.ts +0 -149
- package/src/cli/commands/connect.ts +0 -80
- package/src/cli/commands/deploy.impl.test.ts +0 -254
- package/src/cli/commands/deploy.impl.ts +0 -73
- package/src/cli/commands/deploy.ts +0 -22
- package/src/cli/commands/env.impl.ts +0 -88
- package/src/cli/commands/env.ts +0 -38
- package/src/cli/commands/exec.impl.ts +0 -171
- package/src/cli/commands/exec.ts +0 -32
- package/src/cli/commands/runs.impl.ts +0 -87
- package/src/cli/commands/runs.ts +0 -49
- package/src/cli/commands/secrets.impl.ts +0 -130
- package/src/cli/commands/secrets.ts +0 -73
- package/src/cli/commands/utils/testing.ts +0 -66
- package/src/cli/config.test.ts +0 -108
- package/src/cli/config.ts +0 -265
- package/src/cli/context.ts +0 -26
- package/src/cli/deploy.ts +0 -190
- package/src/cli/flags.ts +0 -72
- package/src/cli/handler.ts +0 -68
- package/src/cli/io.ts +0 -132
- package/src/cli/routes.ts +0 -61
- package/src/cli/utils/array.ts +0 -7
- package/src/cli/utils/openUrl.ts +0 -53
- 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
|
-
};
|
package/dist/cli/routes.d.ts
DELETED
package/dist/cli/routes.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/cli/routes.ts"],"names":[],"mappings":"AA4CA,eAAO,MAAM,GAAG,0EAgBd,CAAC"}
|
package/dist/cli/routes.js
DELETED
|
@@ -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 +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"}
|
package/dist/cli/utils/array.js
DELETED
|
@@ -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 +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"}
|
package/dist/cli/utils/string.js
DELETED