@atlasauth/cli 0.0.0-stage → 0.1.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 (59) hide show
  1. package/README.md +57 -2
  2. package/dist/args.d.ts +69 -0
  3. package/dist/args.js +69 -0
  4. package/dist/args.js.map +1 -0
  5. package/dist/cli.d.ts +2 -0
  6. package/dist/cli.js +19 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/commands/api-keys.d.ts +4 -0
  9. package/dist/commands/api-keys.js +81 -0
  10. package/dist/commands/api-keys.js.map +1 -0
  11. package/dist/commands/auth.d.ts +25 -0
  12. package/dist/commands/auth.js +94 -0
  13. package/dist/commands/auth.js.map +1 -0
  14. package/dist/commands/orgs.d.ts +4 -0
  15. package/dist/commands/orgs.js +72 -0
  16. package/dist/commands/orgs.js.map +1 -0
  17. package/dist/commands/sessions.d.ts +4 -0
  18. package/dist/commands/sessions.js +28 -0
  19. package/dist/commands/sessions.js.map +1 -0
  20. package/dist/commands/shared.d.ts +32 -0
  21. package/dist/commands/shared.js +60 -0
  22. package/dist/commands/shared.js.map +1 -0
  23. package/dist/commands/users.d.ts +4 -0
  24. package/dist/commands/users.js +87 -0
  25. package/dist/commands/users.js.map +1 -0
  26. package/dist/commands/webhooks.d.ts +4 -0
  27. package/dist/commands/webhooks.js +34 -0
  28. package/dist/commands/webhooks.js.map +1 -0
  29. package/dist/config.d.ts +48 -0
  30. package/dist/config.js +69 -0
  31. package/dist/config.js.map +1 -0
  32. package/dist/context.d.ts +35 -0
  33. package/dist/context.js +23 -0
  34. package/dist/context.js.map +1 -0
  35. package/dist/errors.d.ts +15 -0
  36. package/dist/errors.js +25 -0
  37. package/dist/errors.js.map +1 -0
  38. package/dist/help.d.ts +8 -0
  39. package/dist/help.js +79 -0
  40. package/dist/help.js.map +1 -0
  41. package/dist/index.d.ts +19 -0
  42. package/dist/index.js +42 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/io.d.ts +21 -0
  45. package/dist/io.js +28 -0
  46. package/dist/io.js.map +1 -0
  47. package/dist/output.d.ts +41 -0
  48. package/dist/output.js +72 -0
  49. package/dist/output.js.map +1 -0
  50. package/dist/prompt.d.ts +15 -0
  51. package/dist/prompt.js +46 -0
  52. package/dist/prompt.js.map +1 -0
  53. package/dist/run.d.ts +12 -0
  54. package/dist/run.js +90 -0
  55. package/dist/run.js.map +1 -0
  56. package/dist/version.d.ts +7 -0
  57. package/dist/version.js +21 -0
  58. package/dist/version.js.map +1 -0
  59. package/package.json +34 -3
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveAuth = resolveAuth;
4
+ exports.requireClient = requireClient;
5
+ exports.wantsJson = wantsJson;
6
+ exports.requireArg = requireArg;
7
+ exports.maskSecret = maskSecret;
8
+ const backend_1 = require("@atlasauth/backend");
9
+ const args_1 = require("../args");
10
+ const errors_1 = require("../errors");
11
+ /**
12
+ * Resolve which credential to use, with env overrides winning over the stored
13
+ * profile — the same precedence `auth0-cli` and most cloud CLIs use, so a CI
14
+ * job can set `ATLAS_SECRET_KEY` without a `login` step. Throws a clean error
15
+ * (not a stack) when nothing supplies a key.
16
+ */
17
+ function resolveAuth(ctx, values) {
18
+ const file = ctx.config.load();
19
+ const profile = (0, args_1.str)(values, 'profile') || file.active_profile || 'default';
20
+ const stored = file.profiles[profile];
21
+ const envKey = ctx.env.ATLAS_SECRET_KEY?.trim();
22
+ const secretKey = envKey || stored?.secret_key;
23
+ if (!secretKey) {
24
+ throw new errors_1.CliError(`Not logged in (profile '${profile}'). Run 'atlas login'` +
25
+ ((0, args_1.str)(values, 'profile') ? ` --profile ${profile}` : '') +
26
+ ' or set ATLAS_SECRET_KEY.');
27
+ }
28
+ const envUrl = ctx.env.ATLAS_API_URL?.trim();
29
+ const apiUrl = envUrl || stored?.api_url || backend_1.DEFAULT_API_URL;
30
+ return {
31
+ profile,
32
+ apiUrl,
33
+ secretKey,
34
+ keySource: envKey ? 'env' : 'config',
35
+ urlSource: envUrl ? 'env' : stored?.api_url ? 'config' : 'default',
36
+ };
37
+ }
38
+ /** Resolve the credential and build the Backend API client bound to it. */
39
+ function requireClient(ctx, values) {
40
+ const auth = resolveAuth(ctx, values);
41
+ return { client: ctx.makeClient({ secretKey: auth.secretKey, apiUrl: auth.apiUrl }), auth };
42
+ }
43
+ /** True when `--json` was passed. */
44
+ function wantsJson(values) {
45
+ return values.json === true;
46
+ }
47
+ /** The first positional after the resource word — e.g. an id for `users get <id>`. */
48
+ function requireArg(positionals, index, name) {
49
+ const value = positionals[index];
50
+ if (!value)
51
+ throw new errors_1.CliError(`Missing required argument: <${name}>.`);
52
+ return value;
53
+ }
54
+ /** Mask a secret for display: keep the `sk_live_`-style prefix and the last 4. */
55
+ function maskSecret(key) {
56
+ if (key.length <= 12)
57
+ return '****';
58
+ return `${key.slice(0, 8)}…${key.slice(-4)}`;
59
+ }
60
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/commands/shared.ts"],"names":[],"mappings":";;AAwBA,kCAyBC;AAGD,sCAMC;AAGD,8BAEC;AAGD,gCAIC;AAGD,gCAGC;AA5ED,gDAAqD;AACrD,kCAA2C;AAE3C,sCAAqC;AAerC;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,GAAe,EAAE,MAAc;IACzD,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAG,IAAA,UAAG,EAAC,MAAM,EAAE,SAAS,CAAC,IAAI,IAAI,CAAC,cAAc,IAAI,SAAS,CAAC;IAC3E,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAEtC,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,IAAI,EAAE,CAAC;IAChD,MAAM,SAAS,GAAG,MAAM,IA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CAAC;IACjC,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,iBAAQ,CAAC,+BAA+B,IAAI,IAAI,CAAC,CAAC;IACxE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,kFAAkF;AAClF,SAAgB,UAAU,CAAC,GAAW;IACpC,IAAI,GAAG,CAAC,MAAM,IAAI,EAAE;QAAE,OAAO,MAAM,CAAC;IACpC,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type ParsedArgs } from '../args';
2
+ import type { RunContext } from '../context';
3
+ /** `atlas users <list|get|create|delete>` — maps 1:1 onto `client.users.*`. */
4
+ export declare function users(ctx: RunContext, args: ParsedArgs): Promise<number>;
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.users = users;
4
+ const args_1 = require("../args");
5
+ const errors_1 = require("../errors");
6
+ const output_1 = require("../output");
7
+ const shared_1 = require("./shared");
8
+ /** Columns for the human `users list` table — User carries no email inline. */
9
+ const COLUMNS = [
10
+ { header: 'ID', get: (u) => u.id },
11
+ { header: 'USERNAME', get: (u) => u.username },
12
+ { header: 'NAME', get: (u) => [u.first_name, u.last_name].filter(Boolean).join(' ') },
13
+ { header: 'BANNED', get: (u) => u.banned },
14
+ { header: 'CREATED', get: (u) => (0, output_1.fmtTime)(u.created_at) },
15
+ ];
16
+ /** `atlas users <list|get|create|delete>` — maps 1:1 onto `client.users.*`. */
17
+ async function users(ctx, args) {
18
+ const sub = args.positionals[1];
19
+ const json = (0, shared_1.wantsJson)(args.values);
20
+ switch (sub) {
21
+ case 'list': {
22
+ const { client } = (0, shared_1.requireClient)(ctx, args.values);
23
+ // users.list is cursor-paginated: { data, has_more, next_cursor }.
24
+ const page = await client.users.list({
25
+ limit: (0, args_1.limit)(args.values),
26
+ starting_after: (0, args_1.str)(args.values, 'starting-after'),
27
+ });
28
+ (0, output_1.printList)(ctx.io, { json, columns: COLUMNS }, page);
29
+ return 0;
30
+ }
31
+ case 'get': {
32
+ const id = (0, shared_1.requireArg)(args.positionals, 2, 'user-id');
33
+ const { client } = (0, shared_1.requireClient)(ctx, args.values);
34
+ const user = await client.users.get(id);
35
+ if (json)
36
+ (0, output_1.printJson)(ctx.io, user);
37
+ else
38
+ ctx.io.out(renderUser(user));
39
+ return 0;
40
+ }
41
+ case 'create': {
42
+ const email = (0, args_1.str)(args.values, 'email');
43
+ if (!email)
44
+ throw new errors_1.CliError("users create requires --email <address>.");
45
+ const { client } = (0, shared_1.requireClient)(ctx, args.values);
46
+ const user = await client.users.create({
47
+ email_address: email,
48
+ first_name: (0, args_1.str)(args.values, 'first-name'),
49
+ last_name: (0, args_1.str)(args.values, 'last-name'),
50
+ password: (0, args_1.str)(args.values, 'password'),
51
+ });
52
+ if (json)
53
+ (0, output_1.printJson)(ctx.io, user);
54
+ else
55
+ ctx.io.out(`Created user ${user.id}.`);
56
+ return 0;
57
+ }
58
+ case 'delete': {
59
+ const id = (0, shared_1.requireArg)(args.positionals, 2, 'user-id');
60
+ const { client } = (0, shared_1.requireClient)(ctx, args.values);
61
+ const result = await client.users.delete(id);
62
+ if (json)
63
+ (0, output_1.printJson)(ctx.io, result);
64
+ else
65
+ ctx.io.out(`Deleted user ${result.id}.`);
66
+ return 0;
67
+ }
68
+ default:
69
+ throw new errors_1.CliError(sub
70
+ ? `Unknown subcommand 'users ${sub}'. Try: list, get, create, delete.`
71
+ : "users needs a subcommand: list, get, create, delete.");
72
+ }
73
+ }
74
+ /** A single user as a compact key/value block for the non-JSON `get`. */
75
+ function renderUser(u) {
76
+ return [
77
+ `ID: ${u.id}`,
78
+ `Username: ${u.username ?? ''}`,
79
+ `Name: ${[u.first_name, u.last_name].filter(Boolean).join(' ')}`,
80
+ `Banned: ${u.banned}`,
81
+ `Locked: ${u.locked}`,
82
+ `MFA: ${u.mfa_enabled}`,
83
+ `Last sign-in: ${(0, output_1.fmtTime)(u.last_sign_in_at)}`,
84
+ `Created: ${(0, output_1.fmtTime)(u.created_at)}`,
85
+ ].join('\n');
86
+ }
87
+ //# sourceMappingURL=users.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/commands/users.ts"],"names":[],"mappings":";;AAiBA,sBAwDC;AAxED,kCAAsD;AAEtD,sCAAqC;AACrC,sCAAuE;AACvE,qCAAgE;AAEhE,+EAA+E;AAC/E,MAAM,OAAO,GAAmB;IAC9B,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;IAClC,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC9C,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;IACrF,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE;IAC1C,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,gBAAO,EAAC,CAAC,CAAC,UAAU,CAAC,EAAE;CACzD,CAAC;AAEF,+EAA+E;AACxE,KAAK,UAAU,KAAK,CAAC,GAAe,EAAE,IAAgB;IAC3D,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,IAAA,kBAAS,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEpC,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GAAG;gBACD,CAAC,CAAC,6BAA6B,GAAG,oCAAoC;gBACtE,CAAC,CAAC,sDAAsD,CAC3D,CAAC;IACN,CAAC;AACH,CAAC;AAED,yEAAyE;AACzE,SAAS,UAAU,CAAC,CAAO;IACzB,OAAO;QACL,eAAe,CAAC,CAAC,EAAE,EAAE;QACrB,eAAe,CAAC,CAAC,QAAQ,IAAI,EAAE,EAAE;QACjC,eAAe,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACtE,eAAe,CAAC,CAAC,MAAM,EAAE;QACzB,eAAe,CAAC,CAAC,MAAM,EAAE;QACzB,eAAe,CAAC,CAAC,WAAW,EAAE;QAC9B,iBAAiB,IAAA,gBAAO,EAAC,CAAC,CAAC,eAAe,CAAC,EAAE;QAC7C,eAAe,IAAA,gBAAO,EAAC,CAAC,CAAC,UAAU,CAAC,EAAE;KACvC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ParsedArgs } from '../args';
2
+ import type { RunContext } from '../context';
3
+ /** `atlas webhooks list` — the one read `client.webhooks` exposes for endpoints. */
4
+ export declare function webhooks(ctx: RunContext, args: ParsedArgs): Promise<number>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.webhooks = webhooks;
4
+ const errors_1 = require("../errors");
5
+ const output_1 = require("../output");
6
+ const shared_1 = require("./shared");
7
+ const COLUMNS = [
8
+ { header: 'ID', get: (w) => w.id },
9
+ { header: 'URL', get: (w) => w.url },
10
+ { header: 'ACTIVE', get: (w) => w.active },
11
+ { header: 'EVENTS', get: (w) => w.enabled_events },
12
+ { header: 'CREATED', get: (w) => (0, output_1.fmtTime)(w.created_at) },
13
+ ];
14
+ /** `atlas webhooks list` — the one read `client.webhooks` exposes for endpoints. */
15
+ async function webhooks(ctx, args) {
16
+ const sub = args.positionals[1];
17
+ const json = (0, shared_1.wantsJson)(args.values);
18
+ switch (sub) {
19
+ case 'list': {
20
+ const { client } = (0, shared_1.requireClient)(ctx, args.values);
21
+ const page = await client.webhooks.endpoints.list();
22
+ if (json)
23
+ (0, output_1.printJson)(ctx.io, page);
24
+ else
25
+ ctx.io.out((0, output_1.renderTable)(COLUMNS, page.data));
26
+ return 0;
27
+ }
28
+ default:
29
+ throw new errors_1.CliError(sub
30
+ ? `Unknown subcommand 'webhooks ${sub}'. Try: list.`
31
+ : 'webhooks needs a subcommand: list.');
32
+ }
33
+ }
34
+ //# sourceMappingURL=webhooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../src/commands/webhooks.ts"],"names":[],"mappings":";;AAgBA,4BAoBC;AAjCD,sCAAqC;AACrC,sCAAyE;AACzE,qCAAoD;AAEpD,MAAM,OAAO,GAA8B;IACzC,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;IAClC,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE;IACpC,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE;IAC1C,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE;IAClD,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,gBAAO,EAAC,CAAC,CAAC,UAAU,CAAC,EAAE;CACzD,CAAC;AAEF,oFAAoF;AAC7E,KAAK,UAAU,QAAQ,CAAC,GAAe,EAAE,IAAgB;IAC9D,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,IAAA,kBAAS,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEpC,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,sBAAa,EAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACnD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;YACpD,IAAI,IAAI;gBAAE,IAAA,kBAAS,EAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;;gBAC7B,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAA,oBAAW,EAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YACjD,OAAO,CAAC,CAAC;QACX,CAAC;QAED;YACE,MAAM,IAAI,iBAAQ,CAChB,GAAG;gBACD,CAAC,CAAC,gCAAgC,GAAG,eAAe;gBACpD,CAAC,CAAC,oCAAoC,CACzC,CAAC;IACN,CAAC;AACH,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * One stored instance credential. The secret key sits on disk in plaintext —
3
+ * the same trade-off `auth0-cli` and the `gh` CLI make: a long-lived token in a
4
+ * 0600 file under the user's home, not an OS keychain. {@link FileConfigStore}
5
+ * enforces the 0600 so another user on the box cannot read it.
6
+ */
7
+ export interface Profile {
8
+ api_url: string;
9
+ secret_key: string;
10
+ }
11
+ /** The whole config file: named profiles plus which one is active. */
12
+ export interface ConfigFile {
13
+ active_profile?: string;
14
+ profiles: Record<string, Profile>;
15
+ }
16
+ /**
17
+ * The persistence seam. Commands depend on this interface, never on `fs`, so a
18
+ * test injects a store backed by a temp path (or memory) and the real
19
+ * `~/.config/...` file is never touched.
20
+ */
21
+ export interface ConfigStore {
22
+ /** Where this store reads/writes — surfaced for `login`'s success message. */
23
+ readonly path: string;
24
+ load(): ConfigFile;
25
+ save(config: ConfigFile): void;
26
+ }
27
+ /**
28
+ * Resolve the default config path: `$XDG_CONFIG_HOME/atlasauth/config.json`,
29
+ * falling back to `~/.config/atlasauth/config.json`. Honoring XDG keeps the CLI
30
+ * a good citizen on Linux while still working on macOS, where `~/.config` is
31
+ * the de-facto convention CLIs use.
32
+ */
33
+ export declare function defaultConfigPath(env?: NodeJS.ProcessEnv): string;
34
+ /** The real store: a JSON file written with 0600 perms and a 0700 parent dir. */
35
+ export declare class FileConfigStore implements ConfigStore {
36
+ readonly path: string;
37
+ constructor(path: string);
38
+ load(): ConfigFile;
39
+ save(config: ConfigFile): void;
40
+ }
41
+ /** An in-memory store for tests that still want to exercise the resolve logic. */
42
+ export declare class MemoryConfigStore implements ConfigStore {
43
+ readonly path = "<memory>";
44
+ private data;
45
+ constructor(initial?: ConfigFile);
46
+ load(): ConfigFile;
47
+ save(config: ConfigFile): void;
48
+ }
package/dist/config.js ADDED
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MemoryConfigStore = exports.FileConfigStore = void 0;
4
+ exports.defaultConfigPath = defaultConfigPath;
5
+ const node_fs_1 = require("node:fs");
6
+ const node_os_1 = require("node:os");
7
+ const node_path_1 = require("node:path");
8
+ const errors_1 = require("./errors");
9
+ const EMPTY = { profiles: {} };
10
+ /**
11
+ * Resolve the default config path: `$XDG_CONFIG_HOME/atlasauth/config.json`,
12
+ * falling back to `~/.config/atlasauth/config.json`. Honoring XDG keeps the CLI
13
+ * a good citizen on Linux while still working on macOS, where `~/.config` is
14
+ * the de-facto convention CLIs use.
15
+ */
16
+ function defaultConfigPath(env = process.env) {
17
+ const base = env.XDG_CONFIG_HOME?.trim() || (0, node_path_1.join)((0, node_os_1.homedir)(), '.config');
18
+ return (0, node_path_1.join)(base, 'atlasauth', 'config.json');
19
+ }
20
+ /** The real store: a JSON file written with 0600 perms and a 0700 parent dir. */
21
+ class FileConfigStore {
22
+ path;
23
+ constructor(path) {
24
+ this.path = path;
25
+ }
26
+ load() {
27
+ let text;
28
+ try {
29
+ text = (0, node_fs_1.readFileSync)(this.path, 'utf8');
30
+ }
31
+ catch {
32
+ // Missing file is the first-run state, not an error.
33
+ return { profiles: {} };
34
+ }
35
+ try {
36
+ const parsed = JSON.parse(text);
37
+ // Guard against a hand-corrupted file so every later `.profiles[...]` is safe.
38
+ return { active_profile: parsed.active_profile, profiles: parsed.profiles ?? {} };
39
+ }
40
+ catch {
41
+ throw new errors_1.CliError(`Config file at ${this.path} is not valid JSON. Fix or remove it, then run 'atlas login' again.`);
42
+ }
43
+ }
44
+ save(config) {
45
+ (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(this.path), { recursive: true, mode: 0o700 });
46
+ // Write THEN chmod: `mode` on writeFile is masked by umask and skipped
47
+ // entirely if the file already exists, so an explicit chmod is the only
48
+ // way to guarantee 0600 on every save.
49
+ (0, node_fs_1.writeFileSync)(this.path, JSON.stringify(config, null, 2) + '\n', { mode: 0o600 });
50
+ (0, node_fs_1.chmodSync)(this.path, 0o600);
51
+ }
52
+ }
53
+ exports.FileConfigStore = FileConfigStore;
54
+ /** An in-memory store for tests that still want to exercise the resolve logic. */
55
+ class MemoryConfigStore {
56
+ path = '<memory>';
57
+ data;
58
+ constructor(initial = EMPTY) {
59
+ this.data = structuredClone(initial);
60
+ }
61
+ load() {
62
+ return structuredClone(this.data);
63
+ }
64
+ save(config) {
65
+ this.data = structuredClone(config);
66
+ }
67
+ }
68
+ exports.MemoryConfigStore = MemoryConfigStore;
69
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AA0CA,8CAGC;AA7CD,qCAA4E;AAC5E,qCAAkC;AAClC,yCAA0C;AAC1C,qCAAoC;AA+BpC,MAAM,KAAK,GAAe,EAAE,QA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AAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAClF,IAAA,mBAAS,EAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;CACF;AA9BD,0CA8BC;AAED,kFAAkF;AAClF,MAAa,iBAAiB;IACnB,IAAI,GAAG,UAAU,CAAC;IACnB,IAAI,CAAa;IACzB,YAAY,UAAsB,KAAK;QACrC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IACD,IAAI;QACF,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IACD,IAAI,CAAC,MAAkB;QACrB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;CACF;AAZD,8CAYC"}
@@ -0,0 +1,35 @@
1
+ import { type AtlasClient } from '@atlasauth/backend';
2
+ import { type ConfigStore } from './config';
3
+ import { type IO } from './io';
4
+ import { type Prompter } from './prompt';
5
+ /**
6
+ * The exact slice of the Backend API client this CLI drives. Narrowed from the
7
+ * full {@link AtlasClient} on purpose: it documents — and the typechecker
8
+ * enforces — that the command set maps only onto namespaces that really exist,
9
+ * and it keeps the fake a test injects small (five namespaces, not forty).
10
+ */
11
+ export type ManagementClient = Pick<AtlasClient, 'users' | 'organizations' | 'apiKeys' | 'webhooks' | 'sessions'>;
12
+ /**
13
+ * Everything a command touches the outside world through, in one injectable
14
+ * bag. Production wires the real IO/config/prompt/client; every test builds
15
+ * this with fakes so a handler runs with no network, no TTY and no real
16
+ * `~/.config` file.
17
+ */
18
+ export interface RunContext {
19
+ io: IO;
20
+ /** Process environment — read for `ATLAS_SECRET_KEY` / `ATLAS_API_URL`. */
21
+ env: NodeJS.ProcessEnv;
22
+ config: ConfigStore;
23
+ prompt: Prompter;
24
+ /** Builds the Backend API client from a resolved credential. */
25
+ makeClient: (opts: {
26
+ secretKey: string;
27
+ apiUrl: string;
28
+ }) => ManagementClient;
29
+ }
30
+ /**
31
+ * The production context, with any piece overridable. Tests call this with a
32
+ * `config` pointed at a temp path and a `makeClient` returning a stub, so the
33
+ * same `run()` path is exercised end to end without side effects.
34
+ */
35
+ export declare function defaultContext(overrides?: Partial<RunContext>): RunContext;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultContext = defaultContext;
4
+ const backend_1 = require("@atlasauth/backend");
5
+ const config_1 = require("./config");
6
+ const io_1 = require("./io");
7
+ const prompt_1 = require("./prompt");
8
+ /**
9
+ * The production context, with any piece overridable. Tests call this with a
10
+ * `config` pointed at a temp path and a `makeClient` returning a stub, so the
11
+ * same `run()` path is exercised end to end without side effects.
12
+ */
13
+ function defaultContext(overrides = {}) {
14
+ return {
15
+ io: (0, io_1.defaultIO)(),
16
+ env: process.env,
17
+ config: new config_1.FileConfigStore((0, config_1.defaultConfigPath)()),
18
+ prompt: (0, prompt_1.defaultPrompter)(),
19
+ makeClient: ({ secretKey, apiUrl }) => (0, backend_1.createAtlasClient)({ secretKey, apiUrl }),
20
+ ...overrides,
21
+ };
22
+ }
23
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;AAqCA,wCASC;AA9CD,gDAAyE;AACzE,qCAAgF;AAChF,6BAA0C;AAC1C,qCAA0D;AA6B1D;;;;GAIG;AACH,SAAgB,cAAc,CAAC,YAAiC,EAAE;IAChE,OAAO;QACL,EAAE,EAAE,IAAA,cAAS,GAAE;QACf,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,MAAM,EAAE,IAAI,wBAAe,CAAC,IAAA,0BAAiB,GAAE,CAAC;QAChD,MAAM,EAAE,IAAA,wBAAe,GAAE;QACzB,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,IAAA,2BAAiB,EAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;QAC/E,GAAG,SAAS;KACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The one error a command handler throws to abort with a clean, user-facing
3
+ * message and a chosen exit code. {@link run} catches it, prints `message` to
4
+ * stderr (no stack), and returns `exitCode` — so a bad flag or a missing key
5
+ * never dumps a stack trace at the terminal the way an uncaught throw would.
6
+ *
7
+ * API failures are NOT CliErrors: they arrive as `AtlasApiError` from
8
+ * `@atlasauth/backend` and {@link run} formats those separately so the stable
9
+ * error `code` and HTTP status survive to the user.
10
+ */
11
+ export declare class CliError extends Error {
12
+ readonly name = "CliError";
13
+ readonly exitCode: number;
14
+ constructor(message: string, exitCode?: number);
15
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CliError = void 0;
4
+ /**
5
+ * The one error a command handler throws to abort with a clean, user-facing
6
+ * message and a chosen exit code. {@link run} catches it, prints `message` to
7
+ * stderr (no stack), and returns `exitCode` — so a bad flag or a missing key
8
+ * never dumps a stack trace at the terminal the way an uncaught throw would.
9
+ *
10
+ * API failures are NOT CliErrors: they arrive as `AtlasApiError` from
11
+ * `@atlasauth/backend` and {@link run} formats those separately so the stable
12
+ * error `code` and HTTP status survive to the user.
13
+ */
14
+ class CliError extends Error {
15
+ name = 'CliError';
16
+ exitCode;
17
+ constructor(message, exitCode = 1) {
18
+ super(message);
19
+ this.exitCode = exitCode;
20
+ // Keep `instanceof CliError` working under down-level compile targets.
21
+ Object.setPrototypeOf(this, CliError.prototype);
22
+ }
23
+ }
24
+ exports.CliError = CliError;
25
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACH,MAAa,QAAS,SAAQ,KAAK;IACf,IAAI,GAAG,UAAU,CAAC;IAC3B,QAAQ,CAAS;IAE1B,YAAY,OAAe,EAAE,QAAQ,GAAG,CAAC;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,uEAAuE;QACvE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAClD,CAAC;CACF;AAVD,4BAUC"}
package/dist/help.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * All help text lives here as plain strings — the CLI's "docs" surface. Kept
3
+ * out of the handlers so the dispatch code stays about control flow and the
4
+ * copy can be read (and kept consistent) in one place.
5
+ */
6
+ export declare const TOP_HELP = "atlas \u2014 manage an Atlas instance from the terminal\n\nUsage: atlas <command> [subcommand] [arguments] [options]\n\nCommands:\n login Authenticate and store a profile credential\n logout Remove a stored profile credential\n whoami Show the active profile and instance\n users list|get|create|delete\n orgs list|get|members\n api-keys list|create|revoke\n webhooks list\n sessions revoke\n\nGlobal options:\n --profile <name> Use a named profile (default: active, else \"default\")\n --json Emit raw JSON instead of a human table\n --limit <n> Page size for list commands that paginate\n --starting-after <cursor> Pagination cursor (from a prior page's hint)\n -h, --help Show this help, or help for a command\n -v, --version Print the version\n\nEnvironment overrides:\n ATLAS_SECRET_KEY Secret key to use instead of the stored one\n ATLAS_API_URL API URL to use instead of the stored one\n\nRun 'atlas <command> --help' for command-specific help.";
7
+ /** Per-command help, keyed by the resource word. */
8
+ export declare const COMMAND_HELP: Record<string, string>;
package/dist/help.js ADDED
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ /**
3
+ * All help text lives here as plain strings — the CLI's "docs" surface. Kept
4
+ * out of the handlers so the dispatch code stays about control flow and the
5
+ * copy can be read (and kept consistent) in one place.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.COMMAND_HELP = exports.TOP_HELP = void 0;
9
+ exports.TOP_HELP = `atlas — manage an Atlas instance from the terminal
10
+
11
+ Usage: atlas <command> [subcommand] [arguments] [options]
12
+
13
+ Commands:
14
+ login Authenticate and store a profile credential
15
+ logout Remove a stored profile credential
16
+ whoami Show the active profile and instance
17
+ users list|get|create|delete
18
+ orgs list|get|members
19
+ api-keys list|create|revoke
20
+ webhooks list
21
+ sessions revoke
22
+
23
+ Global options:
24
+ --profile <name> Use a named profile (default: active, else "default")
25
+ --json Emit raw JSON instead of a human table
26
+ --limit <n> Page size for list commands that paginate
27
+ --starting-after <cursor> Pagination cursor (from a prior page's hint)
28
+ -h, --help Show this help, or help for a command
29
+ -v, --version Print the version
30
+
31
+ Environment overrides:
32
+ ATLAS_SECRET_KEY Secret key to use instead of the stored one
33
+ ATLAS_API_URL API URL to use instead of the stored one
34
+
35
+ Run 'atlas <command> --help' for command-specific help.`;
36
+ /** Per-command help, keyed by the resource word. */
37
+ exports.COMMAND_HELP = {
38
+ login: `atlas login — authenticate and store a profile credential
39
+
40
+ Usage: atlas login [--profile <name>] [--url <api-url>] [--secret-key <sk_...>]
41
+
42
+ Prompts for an API URL and a secret key, validates the key with one Backend
43
+ call, then stores it (0600) under the profile. --url / --secret-key skip the
44
+ prompts for non-interactive setup.`,
45
+ logout: `atlas logout — remove a stored profile credential
46
+
47
+ Usage: atlas logout [--profile <name>]`,
48
+ whoami: `atlas whoami — show the active profile and instance
49
+
50
+ Usage: atlas whoami [--profile <name>] [--json]`,
51
+ users: `atlas users — manage users
52
+
53
+ Usage:
54
+ atlas users list [--limit <n>] [--starting-after <cursor>] [--json]
55
+ atlas users get <user-id> [--json]
56
+ atlas users create --email <address> [--first-name <n>] [--last-name <n>] [--password <p>] [--json]
57
+ atlas users delete <user-id> [--json]`,
58
+ orgs: `atlas orgs — manage organizations
59
+
60
+ Usage:
61
+ atlas orgs list [--limit <n>] [--starting-after <cursor>] [--json]
62
+ atlas orgs get <org-id> [--json]
63
+ atlas orgs members <org-id> [--json]`,
64
+ 'api-keys': `atlas api-keys — manage end-user API keys
65
+
66
+ Usage:
67
+ atlas api-keys list [--subject-type <user|organization>] [--subject-id <id>] [--json]
68
+ atlas api-keys create --subject-type <user|organization> --subject-id <id> [--name <n>] [--json]
69
+ atlas api-keys revoke <api-key-id> [--json]`,
70
+ webhooks: `atlas webhooks — inspect webhook endpoints
71
+
72
+ Usage:
73
+ atlas webhooks list [--json]`,
74
+ sessions: `atlas sessions — manage sessions
75
+
76
+ Usage:
77
+ atlas sessions revoke <session-id> [--json]`,
78
+ };
79
+ //# sourceMappingURL=help.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEU,QAAA,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;wDA0BgC,CAAC;AAEzD,oDAAoD;AACvC,QAAA,YAAY,GAA2B;IAClD,KAAK,EAAE;;;;;;mCAM0B;IAEjC,MAAM,EAAE;;uCAE6B;IAErC,MAAM,EAAE;;gDAEsC;IAE9C,KAAK,EAAE;;;;;;wCAM+B;IAEtC,IAAI,EAAE;;;;;uCAK+B;IAErC,UAAU,EAAE;;;;;8CAKgC;IAE5C,QAAQ,EAAE;;;+BAGmB;IAE7B,QAAQ,EAAE;;;8CAGkC;CAC7C,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Library surface of `@atlasauth/cli`. The package ships a bin (`atlas`), but
3
+ * exporting the pieces lets the handlers be unit-tested with injected deps and
4
+ * lets another tool embed the CLI (e.g. `create-atlas-app`) without spawning a
5
+ * child process.
6
+ */
7
+ export { run, type Handler } from './run';
8
+ export { defaultContext, type RunContext, type ManagementClient } from './context';
9
+ export { CliError } from './errors';
10
+ export { defaultIO, captureIO, type IO, type CaptureIO } from './io';
11
+ export { FileConfigStore, MemoryConfigStore, defaultConfigPath, type ConfigStore, type ConfigFile, type Profile, } from './config';
12
+ export { defaultPrompter, type Prompter } from './prompt';
13
+ export { getVersion } from './version';
14
+ export { login, logout, whoami } from './commands/auth';
15
+ export { users } from './commands/users';
16
+ export { orgs } from './commands/orgs';
17
+ export { apiKeys } from './commands/api-keys';
18
+ export { webhooks } from './commands/webhooks';
19
+ export { sessions } from './commands/sessions';
package/dist/index.js ADDED
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sessions = exports.webhooks = exports.apiKeys = exports.orgs = exports.users = exports.whoami = exports.logout = exports.login = exports.getVersion = exports.defaultPrompter = exports.defaultConfigPath = exports.MemoryConfigStore = exports.FileConfigStore = exports.captureIO = exports.defaultIO = exports.CliError = exports.defaultContext = exports.run = void 0;
4
+ /**
5
+ * Library surface of `@atlasauth/cli`. The package ships a bin (`atlas`), but
6
+ * exporting the pieces lets the handlers be unit-tested with injected deps and
7
+ * lets another tool embed the CLI (e.g. `create-atlas-app`) without spawning a
8
+ * child process.
9
+ */
10
+ var run_1 = require("./run");
11
+ Object.defineProperty(exports, "run", { enumerable: true, get: function () { return run_1.run; } });
12
+ var context_1 = require("./context");
13
+ Object.defineProperty(exports, "defaultContext", { enumerable: true, get: function () { return context_1.defaultContext; } });
14
+ var errors_1 = require("./errors");
15
+ Object.defineProperty(exports, "CliError", { enumerable: true, get: function () { return errors_1.CliError; } });
16
+ var io_1 = require("./io");
17
+ Object.defineProperty(exports, "defaultIO", { enumerable: true, get: function () { return io_1.defaultIO; } });
18
+ Object.defineProperty(exports, "captureIO", { enumerable: true, get: function () { return io_1.captureIO; } });
19
+ var config_1 = require("./config");
20
+ Object.defineProperty(exports, "FileConfigStore", { enumerable: true, get: function () { return config_1.FileConfigStore; } });
21
+ Object.defineProperty(exports, "MemoryConfigStore", { enumerable: true, get: function () { return config_1.MemoryConfigStore; } });
22
+ Object.defineProperty(exports, "defaultConfigPath", { enumerable: true, get: function () { return config_1.defaultConfigPath; } });
23
+ var prompt_1 = require("./prompt");
24
+ Object.defineProperty(exports, "defaultPrompter", { enumerable: true, get: function () { return prompt_1.defaultPrompter; } });
25
+ var version_1 = require("./version");
26
+ Object.defineProperty(exports, "getVersion", { enumerable: true, get: function () { return version_1.getVersion; } });
27
+ // The individual command handlers, exported for direct testing/embedding.
28
+ var auth_1 = require("./commands/auth");
29
+ Object.defineProperty(exports, "login", { enumerable: true, get: function () { return auth_1.login; } });
30
+ Object.defineProperty(exports, "logout", { enumerable: true, get: function () { return auth_1.logout; } });
31
+ Object.defineProperty(exports, "whoami", { enumerable: true, get: function () { return auth_1.whoami; } });
32
+ var users_1 = require("./commands/users");
33
+ Object.defineProperty(exports, "users", { enumerable: true, get: function () { return users_1.users; } });
34
+ var orgs_1 = require("./commands/orgs");
35
+ Object.defineProperty(exports, "orgs", { enumerable: true, get: function () { return orgs_1.orgs; } });
36
+ var api_keys_1 = require("./commands/api-keys");
37
+ Object.defineProperty(exports, "apiKeys", { enumerable: true, get: function () { return api_keys_1.apiKeys; } });
38
+ var webhooks_1 = require("./commands/webhooks");
39
+ Object.defineProperty(exports, "webhooks", { enumerable: true, get: function () { return webhooks_1.webhooks; } });
40
+ var sessions_1 = require("./commands/sessions");
41
+ Object.defineProperty(exports, "sessions", { enumerable: true, get: function () { return sessions_1.sessions; } });
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,6BAA0C;AAAjC,0FAAA,GAAG,OAAA;AACZ,qCAAmF;AAA1E,yGAAA,cAAc,OAAA;AACvB,mCAAoC;AAA3B,kGAAA,QAAQ,OAAA;AACjB,2BAAqE;AAA5D,+FAAA,SAAS,OAAA;AAAE,+FAAA,SAAS,OAAA;AAC7B,mCAOkB;AANhB,yGAAA,eAAe,OAAA;AACf,2GAAA,iBAAiB,OAAA;AACjB,2GAAA,iBAAiB,OAAA;AAKnB,mCAA0D;AAAjD,yGAAA,eAAe,OAAA;AACxB,qCAAuC;AAA9B,qGAAA,UAAU,OAAA;AAEnB,0EAA0E;AAC1E,wCAAwD;AAA/C,6FAAA,KAAK,OAAA;AAAE,8FAAA,MAAM,OAAA;AAAE,8FAAA,MAAM,OAAA;AAC9B,0CAAyC;AAAhC,8FAAA,KAAK,OAAA;AACd,wCAAuC;AAA9B,4FAAA,IAAI,OAAA;AACb,gDAA8C;AAArC,mGAAA,OAAO,OAAA;AAChB,gDAA+C;AAAtC,oGAAA,QAAQ,OAAA;AACjB,gDAA+C;AAAtC,oGAAA,QAAQ,OAAA"}
package/dist/io.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The two sinks every command writes through, named so tests can capture
3
+ * output instead of spying on `console`. `out` is the data channel (tables,
4
+ * JSON, the answer a script would pipe); `err` is for diagnostics, prompts'
5
+ * echoes and error messages — exactly the stdout/stderr split a `--json`
6
+ * consumer relies on to parse stdout cleanly.
7
+ */
8
+ export interface IO {
9
+ out(text: string): void;
10
+ err(text: string): void;
11
+ }
12
+ /** The real IO: a trailing newline is added so callers pass bare lines. */
13
+ export declare function defaultIO(stdout?: NodeJS.WriteStream, stderr?: NodeJS.WriteStream): IO;
14
+ /** An in-memory IO for tests, exposing the captured lines plus joined views. */
15
+ export interface CaptureIO extends IO {
16
+ readonly outLines: string[];
17
+ readonly errLines: string[];
18
+ stdout(): string;
19
+ stderr(): string;
20
+ }
21
+ export declare function captureIO(): CaptureIO;