@project-ajax/cli 0.0.17 → 0.0.18
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/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.impl.d.ts +8 -2
- package/dist/commands/auth.impl.d.ts.map +1 -1
- package/dist/commands/auth.impl.js +31 -5
- package/dist/commands/auth.js +7 -2
- package/dist/commands/capabilities.impl.d.ts +1 -1
- package/dist/commands/capabilities.impl.d.ts.map +1 -1
- package/dist/commands/capabilities.impl.js +7 -1
- package/dist/commands/delete.d.ts +3 -0
- package/dist/commands/delete.d.ts.map +1 -0
- package/dist/commands/delete.impl.d.ts +7 -0
- package/dist/commands/delete.impl.d.ts.map +1 -0
- package/dist/commands/delete.impl.js +26 -0
- package/dist/commands/delete.impl.test.d.ts +2 -0
- package/dist/commands/delete.impl.test.d.ts.map +1 -0
- package/dist/commands/delete.js +31 -0
- package/dist/commands/deploy.js +1 -1
- package/dist/commands/list.d.ts +3 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.impl.d.ts +3 -0
- package/dist/commands/list.impl.d.ts.map +1 -0
- package/dist/commands/list.impl.js +41 -0
- package/dist/commands/list.impl.test.d.ts +2 -0
- package/dist/commands/list.impl.test.d.ts.map +1 -0
- package/dist/commands/list.js +17 -0
- package/dist/commands/oauth.impl.d.ts +1 -1
- package/dist/commands/oauth.impl.d.ts.map +1 -1
- package/dist/commands/oauth.impl.js +11 -3
- package/dist/commands/runs.impl.d.ts +1 -1
- package/dist/commands/runs.impl.d.ts.map +1 -1
- package/dist/commands/runs.impl.js +7 -1
- package/dist/commands/secrets.impl.d.ts +1 -1
- package/dist/commands/secrets.impl.d.ts.map +1 -1
- package/dist/commands/secrets.impl.js +7 -1
- package/dist/commands/utils/testing.d.ts +4 -2
- package/dist/commands/utils/testing.d.ts.map +1 -1
- package/dist/commands/utils/testing.js +23 -10
- package/dist/config.d.ts +121 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +194 -37
- package/dist/flags.d.ts +5 -0
- package/dist/flags.d.ts.map +1 -1
- package/dist/flags.js +34 -1
- package/dist/handler.d.ts.map +1 -1
- package/dist/handler.js +9 -3
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +39 -5
- package/package.json +2 -2
package/dist/handler.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,cAAe,SAAQ,YAAY;IACnD,MAAM,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc;IACpD,SAAS,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,SAAS,QAAQ,GAAG,EAAE,EACzE,OAAO,EAAE,CACR,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,KAAK,EACZ,GAAG,IAAI,EAAE,IAAI,KACT,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,IAGxB,MAAM,YAAY,EAClB,OAAO,WAAW,GAAG,KAAK,EAC1B,GAAG,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,cAAe,SAAQ,YAAY;IACnD,MAAM,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc;IACpD,SAAS,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,SAAS,QAAQ,GAAG,EAAE,EACzE,OAAO,EAAE,CACR,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,KAAK,EACZ,GAAG,IAAI,EAAE,IAAI,KACT,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,IAGxB,MAAM,YAAY,EAClB,OAAO,WAAW,GAAG,KAAK,EAC1B,GAAG,MAAM,IAAI,mBA6Bd;AAED,wBAAgB,kBAAkB,CACjC,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,IAAI,SAAS,QAAQ,GAAG,EAAE,EAEhC,OAAO,EAAE,CACR,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,KAAK,EACZ,GAAG,IAAI,EAAE,IAAI,KACT,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,UAzClB,YAAY,8DAwDnB"}
|
package/dist/handler.js
CHANGED
|
@@ -2,14 +2,20 @@ import { ApiClient } from "./api/client.js";
|
|
|
2
2
|
import { Config } from "./config.js";
|
|
3
3
|
function buildHandler(handler) {
|
|
4
4
|
return async function(flags, ...args) {
|
|
5
|
-
const globalConfigPath = Config.
|
|
6
|
-
env: this.process.env
|
|
5
|
+
const globalConfigPath = Config.resolveGlobalConfigPath({
|
|
6
|
+
env: this.process.env,
|
|
7
|
+
create: true
|
|
8
|
+
});
|
|
9
|
+
const spaceCachePath = Config.resolveSpaceCachePath({
|
|
10
|
+
env: this.process.env,
|
|
11
|
+
create: true
|
|
7
12
|
});
|
|
8
13
|
const localConfigPath = Config.resolveLocalConfigPath({
|
|
9
14
|
filePath: flags.config ?? this.process.env.WORKERS_CONFIG ?? "./workers.json"
|
|
10
15
|
});
|
|
11
16
|
const config = Config.load({
|
|
12
|
-
|
|
17
|
+
globalConfigPath,
|
|
18
|
+
spaceCachePath,
|
|
13
19
|
localPath: localConfigPath,
|
|
14
20
|
env: process.env,
|
|
15
21
|
flags
|
package/dist/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAmFA,eAAO,MAAM,GAAG,0EAgBd,CAAC"}
|
package/dist/routes.js
CHANGED
|
@@ -3,27 +3,59 @@ import packageJson from "../package.json" with { type: "json" };
|
|
|
3
3
|
import { authCommands } from "./commands/auth.js";
|
|
4
4
|
import { bundleCommands } from "./commands/bundle.js";
|
|
5
5
|
import { capabilitiesCommands } from "./commands/capabilities.js";
|
|
6
|
+
import deleteWorker from "./commands/delete.js";
|
|
6
7
|
import deploy from "./commands/deploy.js";
|
|
7
8
|
import { envCommands } from "./commands/env.js";
|
|
8
9
|
import exec from "./commands/exec.js";
|
|
10
|
+
import list from "./commands/list.js";
|
|
9
11
|
import { oauthCommands } from "./commands/oauth.js";
|
|
10
12
|
import pack from "./commands/pack.js";
|
|
11
13
|
import { runsCommands } from "./commands/runs.js";
|
|
12
14
|
import { secretsCommands } from "./commands/secrets.js";
|
|
13
15
|
import { TokenNotSetError } from "./token.js";
|
|
16
|
+
const workersBanner = [
|
|
17
|
+
"\u2566 \u2566\u2554\u2550\u2557\u2566\u2550\u2557\u2566\u2554\u2550\u2554\u2550\u2557\u2566\u2550\u2557\u2554\u2550\u2557",
|
|
18
|
+
"\u2551\u2551\u2551\u2551 \u2551\u2560\u2566\u255D\u2560\u2569\u2557\u2551\u2563 \u2560\u2566\u255D\u255A\u2550\u2557",
|
|
19
|
+
"\u255A\u2569\u255D\u255A\u2550\u255D\u2569\u255A\u2550\u2569 \u2569\u255A\u2550\u255D\u2569\u255A\u2550\u255A\u2550\u255D"
|
|
20
|
+
].join("\n");
|
|
14
21
|
const routes = buildRouteMap({
|
|
15
22
|
docs: {
|
|
16
|
-
brief: "A CLI for the
|
|
17
|
-
fullDescription:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
brief: "A CLI for the Notion Workers platform",
|
|
24
|
+
fullDescription: `${workersBanner}
|
|
25
|
+
|
|
26
|
+
The Notion Workers CLI is a tool for managing workers, which run code written by
|
|
27
|
+
you, other developers, or AI agents to perform tasks such as syncing data,
|
|
28
|
+
providing tools to Custom Agents, or running scheduled jobs.
|
|
29
|
+
|
|
30
|
+
\x1B[1mAUTHENTICATION\x1B[0m
|
|
31
|
+
|
|
32
|
+
Authentication is handled via \`workers auth login\`, which opens a browser flow.
|
|
33
|
+
Tokens are stored in the system keychain per space, so you can be logged into
|
|
34
|
+
multiple spaces at once. Authenticated spaces are cached in \`spaces.json\`, and
|
|
35
|
+
the global default space is stored in \`config.json\`.
|
|
36
|
+
Commands resolve the active space in this order: \`--space\`, \`WORKERS_SPACE_ID\`,
|
|
37
|
+
local \`workers.json\`, then \`config.json\`'s defaultSpaceId. Passing \`--space\`
|
|
38
|
+
will prompt a login if that space isn't authenticated yet.
|
|
39
|
+
|
|
40
|
+
\x1B[1mCONFIGURATION\x1B[0m
|
|
41
|
+
|
|
42
|
+
Configuration lives in two places:
|
|
43
|
+
- \`workers.json\` is the local project config (environment, base URL, spaceId,
|
|
44
|
+
workerId). By default it lives in the current directory and is only created
|
|
45
|
+
when the CLI detects a worker project. You can override the path with
|
|
46
|
+
\`--config\` or \`WORKERS_CONFIG\`.
|
|
47
|
+
- Global config files (\`config.json\` and \`spaces.json\`) live under
|
|
48
|
+
\`$NOTION_HOME\`, \`$XDG_CONFIG_HOME/notion\`, \`$HOME/.config/notion\`, or
|
|
49
|
+
\`$HOME/.notion\`.
|
|
50
|
+
|
|
51
|
+
\x1B[1mENVIRONMENT VARIABLES\x1B[0m
|
|
21
52
|
|
|
22
53
|
Most flags are configured either with a config file or flags, but environment
|
|
23
54
|
variables can also be provided:
|
|
24
55
|
|
|
25
56
|
- WORKERS_CONFIG: The path to the config file to use (e.g. ./workers.dev.json)
|
|
26
57
|
- WORKERS_TOKEN: The token to use for authentication
|
|
58
|
+
- WORKERS_SPACE_ID: The space ID to use (overrides local config and default space)
|
|
27
59
|
- WORKERS_ENVIRONMENT: The environment to use
|
|
28
60
|
- WORKERS_BASE_URL: The base API URL to use
|
|
29
61
|
`.trim(),
|
|
@@ -34,8 +66,10 @@ variables can also be provided:
|
|
|
34
66
|
routes: {
|
|
35
67
|
auth: authCommands,
|
|
36
68
|
capabilities: capabilitiesCommands,
|
|
69
|
+
delete: deleteWorker,
|
|
37
70
|
deploy,
|
|
38
71
|
exec,
|
|
72
|
+
list,
|
|
39
73
|
oauth: oauthCommands,
|
|
40
74
|
env: envCommands,
|
|
41
75
|
runs: runsCommands,
|
package/package.json
CHANGED