@atlasauth/cli 0.5.0 → 0.6.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.
- package/CHANGELOG.md +7 -0
- package/dist/args.d.ts +33 -0
- package/dist/args.js +13 -0
- package/dist/args.js.map +1 -1
- package/dist/commands/import.d.ts +3 -0
- package/dist/commands/import.js +116 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/mcp.d.ts +38 -0
- package/dist/commands/mcp.js +108 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/referrals.d.ts +6 -6
- package/dist/commands/referrals.js +28 -28
- package/dist/help.d.ts +1 -1
- package/dist/help.js +52 -5
- package/dist/help.js.map +1 -1
- package/dist/import/csv.d.ts +6 -0
- package/dist/import/csv.js +63 -0
- package/dist/import/csv.js.map +1 -0
- package/dist/import/vendors.d.ts +57 -0
- package/dist/import/vendors.js +568 -0
- package/dist/import/vendors.js.map +1 -0
- package/dist/run.js +4 -0
- package/dist/run.js.map +1 -1
- package/package.json +3 -3
package/dist/help.js
CHANGED
|
@@ -27,6 +27,11 @@ Commands:
|
|
|
27
27
|
client rotate Rotate an OAuth client secret straight into its file
|
|
28
28
|
referrals connect|backfill|status
|
|
29
29
|
Connect a referral platform, backfill, check the connection
|
|
30
|
+
import --from <vendor> <file>
|
|
31
|
+
Move users from Auth0, Clerk, Supabase, Firebase, Cognito,
|
|
32
|
+
Auth.js, WorkOS or Better Auth (resumable; --dry-run first)
|
|
33
|
+
mcp install Add the Atlas MCP server (docs search) to Cursor, Claude Code,
|
|
34
|
+
Codex or VS Code
|
|
30
35
|
|
|
31
36
|
Global options:
|
|
32
37
|
--profile <name> Use a named profile (default: active, else "default")
|
|
@@ -40,8 +45,8 @@ Environment overrides:
|
|
|
40
45
|
ATLAS_SECRET_KEY Secret key to use instead of the stored one
|
|
41
46
|
ATLAS_API_URL API URL to use instead of the stored one
|
|
42
47
|
ATLAS_PLATFORM_KEY Platform key (psk_) for atlas init
|
|
43
|
-
REFERALLY_BASE_URL
|
|
44
|
-
REFERALLY_API_KEY
|
|
48
|
+
REFERALLY_BASE_URL Referalli base URL for atlas referrals connect
|
|
49
|
+
REFERALLY_API_KEY Referalli merchant key for atlas referrals connect (never stored)
|
|
45
50
|
|
|
46
51
|
Secrets: a command that receives a secret writes it to a 0600 file under
|
|
47
52
|
~/.config/<product>/ and prints only the path. --print-secret prints it instead.
|
|
@@ -49,6 +54,48 @@ Secrets: a command that receives a secret writes it to a 0600 file under
|
|
|
49
54
|
Run 'atlas <command> --help' for command-specific help.`;
|
|
50
55
|
/** Per-command help, keyed by the resource word. */
|
|
51
56
|
exports.COMMAND_HELP = {
|
|
57
|
+
import: `atlas import — move users from another auth provider
|
|
58
|
+
|
|
59
|
+
Usage:
|
|
60
|
+
atlas import --from <vendor> <export-file> [--dry-run]
|
|
61
|
+
|
|
62
|
+
Vendors and the file each one reads:
|
|
63
|
+
auth0 the user export job (NDJSON/JSON); --hashes <file> merges the password export
|
|
64
|
+
clerk the dashboard CSV export, or users JSON from the Backend API
|
|
65
|
+
supabase auth.users rows as CSV or JSON (with an identities array for social links)
|
|
66
|
+
firebase firebase auth:export --format=json; needs --hash-config <file>
|
|
67
|
+
cognito aws cognito-idp list-users JSON, or the user-pool CSV
|
|
68
|
+
authjs the adapter's users + accounts tables as JSON
|
|
69
|
+
workos User Management users JSON (+ organization_memberships)
|
|
70
|
+
better-auth JSON of the user, account, member and organization tables
|
|
71
|
+
|
|
72
|
+
Options:
|
|
73
|
+
--dry-run Map and summarise only; nothing is sent
|
|
74
|
+
--batch-size <n> Users per request, 1-100 (default 100)
|
|
75
|
+
--state-file <file> Progress file (default <export-file>.atlas-import.json); re-running resumes
|
|
76
|
+
--hash-config <file> Firebase hash parameters: {signer_key, salt_separator, rounds, mem_cost}
|
|
77
|
+
--hashes <file> Password hashes keyed by email, merged onto the users
|
|
78
|
+
--create-orgs Create organizations that memberships name but that do not exist yet
|
|
79
|
+
--json Machine-readable summary
|
|
80
|
+
|
|
81
|
+
Batches are sent with upsert, so a resumed or repeated run never duplicates a
|
|
82
|
+
user or a membership. Exit code 2 means some rows were reported as issues.`,
|
|
83
|
+
mcp: `atlas mcp — connect AI coding agents to Atlas
|
|
84
|
+
|
|
85
|
+
Usage:
|
|
86
|
+
atlas mcp install --cursor | --claude-code | --codex | --vscode [--dir <project>] [--global]
|
|
87
|
+
|
|
88
|
+
Adds the Atlas MCP server (npx -y @atlasauth/mcp) to the client's config so the
|
|
89
|
+
agent can search and read the Atlas docs. Servers already in the file are kept.
|
|
90
|
+
|
|
91
|
+
--cursor .cursor/mcp.json in the project (~/.cursor/mcp.json with --global)
|
|
92
|
+
--claude-code .mcp.json in the project
|
|
93
|
+
--codex ~/.codex/config.toml (or $CODEX_HOME/config.toml)
|
|
94
|
+
--vscode .vscode/mcp.json in the project
|
|
95
|
+
--dir <path> The project directory (default: the current directory)
|
|
96
|
+
|
|
97
|
+
No key is written. To also manage your instance from the agent, add
|
|
98
|
+
ATLAS_SECRET_KEY to the server's env yourself.`,
|
|
52
99
|
referrals: `atlas referrals — referral attribution
|
|
53
100
|
|
|
54
101
|
Usage:
|
|
@@ -62,15 +109,15 @@ Usage:
|
|
|
62
109
|
[--metadata-path public_metadata.referral_code] [--wait]
|
|
63
110
|
atlas referrals status
|
|
64
111
|
|
|
65
|
-
connect --provider referally creates the Atlas connection on
|
|
112
|
+
connect --provider referally creates the Atlas connection on Referalli with
|
|
66
113
|
your merchant key (bring your own key: used for this one call, never stored or
|
|
67
114
|
printed), saves the connection id and secret on the instance, and runs a ping.
|
|
68
115
|
It requires v2 signatures on the connection from the start and registers a
|
|
69
|
-
|
|
116
|
+
Referalli webhook that sends referral changes (voided, approved, reassigned…)
|
|
70
117
|
back to Atlas; --no-sync skips the webhook. A test key (rk_test_) belongs with a
|
|
71
118
|
development instance and a live key with production: a mismatch is refused
|
|
72
119
|
unless --allow-mode-mismatch. --auto-enroll and --destination are passed to
|
|
73
|
-
|
|
120
|
+
Referalli. --enable turns referrals on when the ping passes. Prefer --referally-key-file (or
|
|
74
121
|
REFERALLY_API_KEY) to --referally-key: a key on the command line can end up in
|
|
75
122
|
your shell history.
|
|
76
123
|
|
package/dist/help.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEU,QAAA,QAAQ,GAAG
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEU,QAAA,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wDA6CgC,CAAC;AAEzD,oDAAoD;AACvC,QAAA,YAAY,GAA2B;IAClD,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;2EAyBiE;IACzE,GAAG,EAAE;;;;;;;;;;;;;;;+CAewC;IAC7C,SAAS,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yEAmC4D;IAEvE,KAAK,EAAE;;;;;;mCAM0B;IAEjC,MAAM,EAAE;;uCAE6B;IAErC,MAAM,EAAE;;gDAEsC;IAE9C,KAAK,EAAE;;;;;;wCAM+B;IAEtC,IAAI,EAAE;;;;;uCAK+B;IAErC,UAAU,EAAE;;;;;;8CAMgC;IAE5C,QAAQ,EAAE;;;;;;0EAM8D;IAExE,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;yEA4BiE;IAEvE,SAAS,EAAE;;;;;;oDAMuC;IAElD,GAAG,EAAE;;;;;;;qDAO8C;IAEnD,MAAM,EAAE;;;;;;;;wDAQ8C;IAEtD,QAAQ,EAAE;;;8CAGkC;IAE5C,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;8EAoBoE;IAC5E,OAAO,EAAE;;;;;;;;;;;gFAWqE;CAC/E,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A small RFC 4180 CSV reader for vendor exports: quoted fields, doubled quotes,
|
|
3
|
+
* embedded commas and newlines, CRLF. Returns one object per data row keyed by
|
|
4
|
+
* the header row. No dependency, because the CLI ships none it does not need.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseCsv(text: string): Array<Record<string, string>>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseCsv = parseCsv;
|
|
4
|
+
/**
|
|
5
|
+
* A small RFC 4180 CSV reader for vendor exports: quoted fields, doubled quotes,
|
|
6
|
+
* embedded commas and newlines, CRLF. Returns one object per data row keyed by
|
|
7
|
+
* the header row. No dependency, because the CLI ships none it does not need.
|
|
8
|
+
*/
|
|
9
|
+
function parseCsv(text) {
|
|
10
|
+
const rows = [];
|
|
11
|
+
let row = [];
|
|
12
|
+
let field = '';
|
|
13
|
+
let quoted = false;
|
|
14
|
+
const src = text.charCodeAt(0) === 0xfeff ? text.slice(1) : text;
|
|
15
|
+
for (let i = 0; i < src.length; i++) {
|
|
16
|
+
const c = src[i];
|
|
17
|
+
if (quoted) {
|
|
18
|
+
if (c === '"') {
|
|
19
|
+
if (src[i + 1] === '"') {
|
|
20
|
+
field += '"';
|
|
21
|
+
i++;
|
|
22
|
+
}
|
|
23
|
+
else
|
|
24
|
+
quoted = false;
|
|
25
|
+
}
|
|
26
|
+
else
|
|
27
|
+
field += c;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (c === '"')
|
|
31
|
+
quoted = true;
|
|
32
|
+
else if (c === ',') {
|
|
33
|
+
row.push(field);
|
|
34
|
+
field = '';
|
|
35
|
+
}
|
|
36
|
+
else if (c === '\n' || c === '\r') {
|
|
37
|
+
if (c === '\r' && src[i + 1] === '\n')
|
|
38
|
+
i++;
|
|
39
|
+
row.push(field);
|
|
40
|
+
field = '';
|
|
41
|
+
if (row.some((v) => v !== ''))
|
|
42
|
+
rows.push(row);
|
|
43
|
+
row = [];
|
|
44
|
+
}
|
|
45
|
+
else
|
|
46
|
+
field += c;
|
|
47
|
+
}
|
|
48
|
+
row.push(field);
|
|
49
|
+
if (row.some((v) => v !== ''))
|
|
50
|
+
rows.push(row);
|
|
51
|
+
const [header, ...data] = rows;
|
|
52
|
+
if (!header)
|
|
53
|
+
return [];
|
|
54
|
+
const keys = header.map((h) => h.trim());
|
|
55
|
+
return data.map((cells) => {
|
|
56
|
+
const out = {};
|
|
57
|
+
keys.forEach((k, idx) => {
|
|
58
|
+
out[k] = cells[idx] ?? '';
|
|
59
|
+
});
|
|
60
|
+
return out;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=csv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csv.js","sourceRoot":"","sources":["../../src/import/csv.ts"],"names":[],"mappings":";;AAKA,4BA2CC;AAhDD;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,MAAM,IAAI,GAAe,EAAE,CAAC;IAC5B,IAAI,GAAG,GAAa,EAAE,CAAC;IACvB,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAEjE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAE,CAAC;QAClB,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;gBACd,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,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C,IAAI,EAAE,CAAC,CAAC;IACzC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACxB,MAAM,GAAG,GAA2B,EAAE,CAAC;QACvC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;YACtB,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAC5B,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vendor export → Atlas bulk-import rows. Each mapper reads the file format the
|
|
3
|
+
* vendor's own export produces and returns the rows `POST /v1/user_imports`
|
|
4
|
+
* accepts, plus warnings for what could not be carried over. Pure functions of
|
|
5
|
+
* the parsed file, so every mapping is tested from a fixture with no network.
|
|
6
|
+
*/
|
|
7
|
+
export declare const VENDORS: readonly ["auth0", "clerk", "supabase", "firebase", "cognito", "authjs", "workos", "better-auth"];
|
|
8
|
+
export type Vendor = (typeof VENDORS)[number];
|
|
9
|
+
export interface ImportMembershipRow {
|
|
10
|
+
organization_id?: string;
|
|
11
|
+
organization_external_id?: string;
|
|
12
|
+
organization_slug?: string;
|
|
13
|
+
organization_name?: string;
|
|
14
|
+
role?: string;
|
|
15
|
+
}
|
|
16
|
+
/** One row of the Atlas import body. Only fields with a value are set. */
|
|
17
|
+
export interface ImportRow {
|
|
18
|
+
email_address: string;
|
|
19
|
+
email_verified?: boolean;
|
|
20
|
+
first_name?: string;
|
|
21
|
+
last_name?: string;
|
|
22
|
+
username?: string;
|
|
23
|
+
external_id?: string;
|
|
24
|
+
created_at?: string | number;
|
|
25
|
+
password_hash?: string;
|
|
26
|
+
password_salt?: string;
|
|
27
|
+
password_hasher?: string;
|
|
28
|
+
phone_numbers?: Array<{
|
|
29
|
+
phone_number: string;
|
|
30
|
+
verified?: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
external_accounts?: Array<{
|
|
33
|
+
provider: string;
|
|
34
|
+
provider_user_id: string;
|
|
35
|
+
email?: string;
|
|
36
|
+
}>;
|
|
37
|
+
organization_memberships?: ImportMembershipRow[];
|
|
38
|
+
public_metadata?: Record<string, unknown>;
|
|
39
|
+
private_metadata?: Record<string, unknown>;
|
|
40
|
+
unsafe_metadata?: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
export interface MappedExport {
|
|
43
|
+
rows: ImportRow[];
|
|
44
|
+
/** Human-readable notes: records skipped, data that cannot move, follow-ups. */
|
|
45
|
+
warnings: string[];
|
|
46
|
+
}
|
|
47
|
+
/** Parse the file text: a JSON document, newline-delimited JSON, or CSV. */
|
|
48
|
+
export declare function parseExport(text: string, fileName?: string): unknown;
|
|
49
|
+
export declare function atlasProvider(raw: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Map a parsed vendor export. `hashes` is an optional second file of password
|
|
52
|
+
* hashes keyed by email (Auth0's support export, WorkOS's, or any `{email,
|
|
53
|
+
* password_hash}` list), merged onto the rows.
|
|
54
|
+
*/
|
|
55
|
+
export declare function mapExport(vendor: Vendor, doc: unknown, hashes?: unknown): MappedExport;
|
|
56
|
+
/** A one-screen summary of what an import would do (the dry run). */
|
|
57
|
+
export declare function summarize(rows: ImportRow[]): Record<string, number>;
|