@project-ajax/sdk 0.0.36 → 0.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder.d.ts +13 -1
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +15 -0
- package/dist/capabilities/sync.d.ts +6 -1
- package/dist/capabilities/sync.d.ts.map +1 -1
- package/dist/capabilities/tool.d.ts +3 -0
- package/dist/capabilities/tool.d.ts.map +1 -1
- package/dist/capabilities/tool.js +1 -0
- package/dist/cli/commands/auth.d.ts.map +1 -1
- package/dist/cli/commands/auth.impl.js +1 -1
- package/dist/cli/commands/auth.js +1 -2
- package/dist/cli/commands/connect.impl.js +2 -2
- package/dist/cli/handler.d.ts.map +1 -1
- package/dist/cli/handler.js +2 -1
- package/dist/cli/routes.d.ts.map +1 -1
- package/dist/cli/routes.js +15 -1
- package/dist/cli/utils/{openNotionUrl.d.ts → openUrl.d.ts} +2 -1
- package/dist/cli/utils/openUrl.d.ts.map +1 -0
- package/dist/cli/utils/{openNotionUrl.js → openUrl.js} +17 -7
- package/dist/icon-names.d.ts +6 -0
- package/dist/icon-names.d.ts.map +1 -0
- package/dist/icon-names.js +0 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/schema.d.ts +7 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/types.d.ts +31 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/builder.ts +29 -1
- package/src/capabilities/sync.ts +6 -1
- package/src/capabilities/tool.test.ts +6 -2
- package/src/capabilities/tool.ts +3 -0
- package/src/cli/commands/auth.impl.ts +1 -1
- package/src/cli/commands/auth.ts +0 -1
- package/src/cli/commands/connect.impl.ts +2 -2
- package/src/cli/handler.ts +6 -1
- package/src/cli/routes.ts +14 -0
- package/src/cli/utils/{openNotionUrl.ts → openUrl.ts} +23 -10
- package/src/icon-names.ts +890 -0
- package/src/index.ts +2 -0
- package/src/schema.ts +7 -0
- package/src/types.ts +47 -0
- package/dist/cli/utils/openNotionUrl.d.ts.map +0 -1
package/src/cli/commands/auth.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ApiError } from "../api/client.js";
|
|
|
2
2
|
import { Result } from "../api/result.js";
|
|
3
3
|
import type { FormatFlags, GlobalFlags } from "../flags.js";
|
|
4
4
|
import { type AuthedContext, buildAuthedHandler } from "../handler.js";
|
|
5
|
-
import {
|
|
5
|
+
import { openBrowserUrl } from "../utils/openUrl.js";
|
|
6
6
|
|
|
7
7
|
export const listProviders = buildAuthedHandler(async function (
|
|
8
8
|
flags: FormatFlags,
|
|
@@ -52,7 +52,7 @@ export const addConnection = buildAuthedHandler(async function (
|
|
|
52
52
|
|
|
53
53
|
this.writer.writeErr("Opening your browser to continue the OAuth flow...");
|
|
54
54
|
try {
|
|
55
|
-
await
|
|
55
|
+
await openBrowserUrl(authorizationUrl);
|
|
56
56
|
} catch (error) {
|
|
57
57
|
this.writer.writeErr(
|
|
58
58
|
`Unable to open the browser automatically (${String(
|
package/src/cli/handler.ts
CHANGED
|
@@ -24,8 +24,13 @@ export function buildHandler<const FLAGS, const ARGS extends BaseArgs = []>(
|
|
|
24
24
|
flags: GlobalFlags & FLAGS,
|
|
25
25
|
...args: ARGS
|
|
26
26
|
) {
|
|
27
|
+
const configFilePath =
|
|
28
|
+
this.process.env.WORKERS_CONFIG_FILE_PATH ??
|
|
29
|
+
flags.config ??
|
|
30
|
+
"./workers.json";
|
|
31
|
+
|
|
27
32
|
const config = await Config.load({
|
|
28
|
-
configFilePath
|
|
33
|
+
configFilePath,
|
|
29
34
|
processEnv: process.env,
|
|
30
35
|
});
|
|
31
36
|
|
package/src/cli/routes.ts
CHANGED
|
@@ -13,6 +13,20 @@ import { TokenNotSetError } from "./config.js";
|
|
|
13
13
|
const routes = buildRouteMap({
|
|
14
14
|
docs: {
|
|
15
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(),
|
|
16
30
|
},
|
|
17
31
|
routes: {
|
|
18
32
|
auth: authCommands,
|
|
@@ -3,20 +3,12 @@ import { existsSync } from "node:fs";
|
|
|
3
3
|
|
|
4
4
|
import type { Environment } from "../config.js";
|
|
5
5
|
|
|
6
|
-
export async function
|
|
7
|
-
env: Environment,
|
|
8
|
-
url: string,
|
|
9
|
-
): Promise<void> {
|
|
6
|
+
export async function openBrowserUrl(url: string): Promise<void> {
|
|
10
7
|
const platform = process.platform;
|
|
11
8
|
|
|
12
9
|
try {
|
|
13
10
|
if (platform === "darwin") {
|
|
14
|
-
|
|
15
|
-
if (appName) {
|
|
16
|
-
exec(`open -a "${appName}" "${url}"`);
|
|
17
|
-
} else {
|
|
18
|
-
exec(`open "${url}"`);
|
|
19
|
-
}
|
|
11
|
+
exec(`open "${url}"`);
|
|
20
12
|
} else if (platform === "win32") {
|
|
21
13
|
exec(`start "" "${url}"`);
|
|
22
14
|
} else {
|
|
@@ -27,6 +19,27 @@ export async function openNotionUrl(
|
|
|
27
19
|
}
|
|
28
20
|
}
|
|
29
21
|
|
|
22
|
+
export async function openNotionUrl(
|
|
23
|
+
env: Environment,
|
|
24
|
+
url: string,
|
|
25
|
+
): Promise<void> {
|
|
26
|
+
const platform = process.platform;
|
|
27
|
+
|
|
28
|
+
if (platform === "darwin") {
|
|
29
|
+
const appName = preferredNotionApp(env);
|
|
30
|
+
if (appName) {
|
|
31
|
+
try {
|
|
32
|
+
exec(`open -a "${appName}" "${url}"`);
|
|
33
|
+
return;
|
|
34
|
+
} catch {
|
|
35
|
+
// Fall back to the default browser below.
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
await openBrowserUrl(url);
|
|
41
|
+
}
|
|
42
|
+
|
|
30
43
|
function preferredNotionApp(env: Environment): string | null {
|
|
31
44
|
if (env === "prod" && existsSync("/Applications/Notion.app")) {
|
|
32
45
|
return "Notion";
|