@atlasauth/cli 0.6.0 → 0.8.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 (48) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +5 -0
  3. package/dist/args.d.ts +34 -0
  4. package/dist/args.js +14 -0
  5. package/dist/args.js.map +1 -1
  6. package/dist/commands/actions-gallery.d.ts +8 -0
  7. package/dist/commands/actions-gallery.js +197 -0
  8. package/dist/commands/actions-gallery.js.map +1 -0
  9. package/dist/commands/actions.d.ts +2 -0
  10. package/dist/commands/actions.js +17 -2
  11. package/dist/commands/actions.js.map +1 -1
  12. package/dist/commands/config.d.ts +41 -1
  13. package/dist/commands/config.js +115 -26
  14. package/dist/commands/config.js.map +1 -1
  15. package/dist/commands/import-better-auth.d.ts +3 -0
  16. package/dist/commands/import-better-auth.js +164 -0
  17. package/dist/commands/import-better-auth.js.map +1 -0
  18. package/dist/commands/import.js +7 -0
  19. package/dist/commands/import.js.map +1 -1
  20. package/dist/commands/info.d.ts +75 -0
  21. package/dist/commands/info.js +362 -0
  22. package/dist/commands/info.js.map +1 -0
  23. package/dist/commands/migrate.d.ts +12 -0
  24. package/dist/commands/migrate.js +104 -0
  25. package/dist/commands/migrate.js.map +1 -0
  26. package/dist/context.d.ts +9 -1
  27. package/dist/context.js.map +1 -1
  28. package/dist/help.d.ts +1 -1
  29. package/dist/help.js +102 -2
  30. package/dist/help.js.map +1 -1
  31. package/dist/index.d.ts +4 -0
  32. package/dist/index.js +10 -1
  33. package/dist/index.js.map +1 -1
  34. package/dist/migrate/better-auth/integration.d.ts +59 -0
  35. package/dist/migrate/better-auth/integration.js +81 -0
  36. package/dist/migrate/better-auth/integration.js.map +1 -0
  37. package/dist/migrate/better-auth/orchestrator.d.ts +43 -0
  38. package/dist/migrate/better-auth/orchestrator.js +525 -0
  39. package/dist/migrate/better-auth/orchestrator.js.map +1 -0
  40. package/dist/migrate/better-auth/output.d.ts +20 -0
  41. package/dist/migrate/better-auth/output.js +146 -0
  42. package/dist/migrate/better-auth/output.js.map +1 -0
  43. package/dist/migrate/better-auth/translate.d.ts +77 -0
  44. package/dist/migrate/better-auth/translate.js +1989 -0
  45. package/dist/migrate/better-auth/translate.js.map +1 -0
  46. package/dist/run.js +4 -0
  47. package/dist/run.js.map +1 -1
  48. package/package.json +4 -3
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REPORT_JSON = exports.REPORT_MD = void 0;
4
+ exports.reportCounts = reportCounts;
5
+ exports.documentFiles = documentFiles;
6
+ exports.writeTranslation = writeTranslation;
7
+ exports.reportJson = reportJson;
8
+ exports.renderReport = renderReport;
9
+ exports.summaryLines = summaryLines;
10
+ const node_fs_1 = require("node:fs");
11
+ const node_path_1 = require("node:path");
12
+ const serialize_1 = require("../../serialize");
13
+ /** The report files written next to the config documents (ignored by `atlas config import`). */
14
+ exports.REPORT_MD = 'better-auth-report.md';
15
+ exports.REPORT_JSON = 'better-auth-report.json';
16
+ const ORDER = ['manual', 'differs', 'mapped'];
17
+ const HEADINGS = {
18
+ manual: 'Needs a manual step',
19
+ differs: 'Maps with a difference',
20
+ mapped: 'Maps 1:1',
21
+ };
22
+ /** Counts per status. */
23
+ function reportCounts(report) {
24
+ const out = { mapped: 0, differs: 0, manual: 0 };
25
+ for (const e of report)
26
+ out[e.status] += 1;
27
+ return out;
28
+ }
29
+ /** The resource files a translation produces: only the non-empty ones, plus the instance. */
30
+ function documentFiles(t) {
31
+ const d = t.document;
32
+ const files = [{ type: 'instance', value: d.instance }];
33
+ const collections = [
34
+ ['oauth_providers', d.oauth_providers],
35
+ ['custom_oauth_providers', d.custom_oauth_providers],
36
+ ['permissions', d.permissions],
37
+ ['roles', d.roles],
38
+ ['oauth_clients', d.oauth_clients],
39
+ ['resource_servers', d.resource_servers],
40
+ ['billing_plans', d.billing_plans],
41
+ ['redirect_urls', d.redirect_urls],
42
+ ['jwt_templates', d.jwt_templates],
43
+ ];
44
+ for (const [type, value] of collections)
45
+ if (value.length)
46
+ files.push({ type, value });
47
+ return files;
48
+ }
49
+ /** Write the config documents and both reports into `dir`. Returns the file names written. */
50
+ function writeTranslation(t, dir, format) {
51
+ (0, node_fs_1.mkdirSync)(dir, { recursive: true });
52
+ const ext = format === 'json' ? 'json' : 'yaml';
53
+ const written = [];
54
+ for (const f of documentFiles(t)) {
55
+ const name = `${f.type}.${ext}`;
56
+ (0, node_fs_1.writeFileSync)((0, node_path_1.join)(dir, name), (0, serialize_1.serialize)(f.value, format));
57
+ written.push(name);
58
+ }
59
+ (0, node_fs_1.writeFileSync)((0, node_path_1.join)(dir, exports.REPORT_MD), renderReport(t));
60
+ (0, node_fs_1.writeFileSync)((0, node_path_1.join)(dir, exports.REPORT_JSON), JSON.stringify(reportJson(t), null, 2) + '\n');
61
+ written.push(exports.REPORT_MD, exports.REPORT_JSON);
62
+ return written;
63
+ }
64
+ /** The machine-readable report (no values of secrets: only env var names). */
65
+ function reportJson(t) {
66
+ return {
67
+ object: 'better_auth_config_translation',
68
+ source: t.source,
69
+ other_instances: t.otherInstances,
70
+ plugins: t.plugins,
71
+ counts: reportCounts(t.report),
72
+ report: t.report,
73
+ env: t.env,
74
+ secrets: t.secrets,
75
+ mappings: t.mappings,
76
+ bridge: t.bridge,
77
+ document: t.document,
78
+ };
79
+ }
80
+ /** The human report, as Markdown. */
81
+ function renderReport(t) {
82
+ const counts = reportCounts(t.report);
83
+ const lines = [];
84
+ lines.push('# Better Auth → Atlas: configuration report', '');
85
+ lines.push(t.source ? `Translated \`betterAuth()\` at \`${t.source.file}:${t.source.line}\`.` : 'No `betterAuth()` call was found.', '');
86
+ if (t.plugins.length)
87
+ lines.push(`Plugins: ${t.plugins.map((p) => `\`${p}\``).join(', ')}.`, '');
88
+ lines.push(`${counts.mapped} map 1:1, ${counts.differs} map with a difference, ${counts.manual} need a manual step.`, '');
89
+ if (t.env.length) {
90
+ lines.push('## Environment variables to set before applying', '');
91
+ lines.push('The config files hold `${NAME}` placeholders, never secret values. Set these (from your app\'s environment) when you run `atlas config import` or `atlas migrate better-auth`:', '');
92
+ for (const e of t.env)
93
+ lines.push(`- \`${e.name}\`: ${e.for}`);
94
+ lines.push('');
95
+ }
96
+ if (t.secrets.length) {
97
+ lines.push('## Secrets stored before the config', '');
98
+ for (const s of t.secrets)
99
+ lines.push(`- captcha secret for \`${s.provider}\` from \`${s.env}\` (write-only)`);
100
+ lines.push('');
101
+ }
102
+ for (const status of ORDER) {
103
+ const entries = t.report.filter((e) => e.status === status);
104
+ if (!entries.length)
105
+ continue;
106
+ lines.push(`## ${HEADINGS[status]} (${entries.length})`, '');
107
+ lines.push('| Better Auth | Atlas | Note | Where |', '|---|---|---|---|');
108
+ for (const e of entries) {
109
+ lines.push(`| \`${cell(e.option)}\` | ${e.atlas ? `\`${cell(e.atlas)}\`` : ''} | ${cell(e.note)} | \`${e.file}:${e.line}\` |`);
110
+ }
111
+ lines.push('');
112
+ }
113
+ const providers = Object.entries(t.mappings.providers);
114
+ if (providers.length) {
115
+ lines.push('## Provider ids', '', '| Better Auth providerId | Atlas provider |', '|---|---|');
116
+ for (const [from, to] of providers)
117
+ lines.push(`| \`${from}\` | \`${to}\` |`);
118
+ lines.push('');
119
+ }
120
+ const roles = Object.entries(t.mappings.roles);
121
+ if (roles.length) {
122
+ lines.push('## Organization roles', '', '| Better Auth role | Atlas role |', '|---|---|');
123
+ for (const [from, to] of roles)
124
+ lines.push(`| \`${from}\` | \`${to}\` |`);
125
+ lines.push('');
126
+ }
127
+ return lines.join('\n');
128
+ }
129
+ function cell(text) {
130
+ return text.replace(/\|/g, '\\|').replace(/\n/g, ' ');
131
+ }
132
+ /** Short terminal summary lines. */
133
+ function summaryLines(t, dir, written) {
134
+ const c = reportCounts(t.report);
135
+ const out = [
136
+ t.source ? `Read betterAuth() at ${t.source.file}:${t.source.line}${t.plugins.length ? ` with ${t.plugins.length} plugin(s): ${t.plugins.join(', ')}` : ''}.` : 'No betterAuth() call found.',
137
+ `Wrote ${written.length - 2} config file(s) and the report to ${dir}: ${written.join(', ')}`,
138
+ `${c.mapped} map 1:1, ${c.differs} map with a difference, ${c.manual} need a manual step (see ${(0, node_path_1.join)(dir, exports.REPORT_MD)}).`,
139
+ ];
140
+ if (t.env.length)
141
+ out.push(`Set before applying: ${t.env.map((e) => e.name).join(', ')}`);
142
+ for (const e of t.report.filter((x) => x.status === 'manual'))
143
+ out.push(` manual ${e.file}:${e.line} ${e.option}: ${e.note}`);
144
+ return out;
145
+ }
146
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../../src/migrate/better-auth/output.ts"],"names":[],"mappings":";;;AAiBA,oCAIC;AAGD,sCAgBC;AAGD,4CAaC;AAGD,gCAcC;AAGD,oCAyCC;AAOD,oCAUC;AAtID,qCAAmD;AACnD,yCAAiC;AACjC,+CAAoE;AAGpE,gGAAgG;AACnF,QAAA,SAAS,GAAG,uBAAuB,CAAC;AACpC,QAAA,WAAW,GAAG,yBAAyB,CAAC;AAErD,MAAM,KAAK,GAAmB,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAC9D,MAAM,QAAQ,GAAiC;IAC7C,MAAM,EAAE,qBAAqB;IAC7B,OAAO,EAAE,wBAAwB;IACjC,MAAM,EAAE,UAAU;CACnB,CAAC;AAEF,yBAAyB;AACzB,SAAgB,YAAY,CAAC,MAAqB;IAChD,MAAM,GAAG,GAAiC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAC/E,KAAK,MAAM,CAAC,IAAI,MAAM;QAAE,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3C,OAAO,GAAG,CAAC;AACb,CAAC;AAED,6FAA6F;AAC7F,SAAgB,aAAa,CAAC,CAAc;IAC1C,MAAM,CAAC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CAAC,CAAC,6BAA6B;QAC7L,SAAS,OAAO,CAAC,MAAM,GAAG,CAAC,qCAAqC,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAC5F,GAAG,CAAC,CAAC,MAAM,aAAa,CAAC,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,4BAA4B,IAAA,gBAAI,EAAC,GAAG,EAAE,iBAAS,CAAC,IAAI;KACzH,CAAC;IACF,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM;QAAE,GAAG,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1F,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACjI,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,77 @@
1
+ import { type BetterAuthAnalysis, type SourceLoc } from '@atlasauth/upgrade';
2
+ import type { Json } from '../../serialize';
3
+ /**
4
+ * Better Auth options → an Atlas config-as-code document (the same per-resource
5
+ * files `atlas config export` writes and `atlas config import` applies) plus a
6
+ * line-by-line report of what mapped 1:1, what maps with a difference and what
7
+ * needs a manual step, each with the file and line of the option.
8
+ *
9
+ * Pure: it works on the static analysis only. Secrets are NEVER read: a value
10
+ * that comes from an environment variable is written as a `${NAME}` placeholder
11
+ * (the import interpolates it from the environment), and a secret hard-coded in
12
+ * source is replaced by a placeholder and flagged.
13
+ */
14
+ export type ReportStatus = 'mapped' | 'differs' | 'manual';
15
+ export interface ReportEntry {
16
+ status: ReportStatus;
17
+ /** The Better Auth area: `emailAndPassword`, `plugin:organization`, … */
18
+ area: string;
19
+ /** The Better Auth option path (`session.expiresIn`). */
20
+ option: string;
21
+ /** Where it lands in Atlas (`auth_config.session.idleMs`, `oauth_providers google`). */
22
+ atlas?: string;
23
+ note: string;
24
+ file: string;
25
+ line: number;
26
+ }
27
+ export interface ConfigDocument {
28
+ instance: {
29
+ allowed_origins?: string[];
30
+ auth_config: Record<string, Json>;
31
+ };
32
+ oauth_providers: Json[];
33
+ custom_oauth_providers: Json[];
34
+ permissions: Json[];
35
+ roles: Json[];
36
+ oauth_clients: Json[];
37
+ resource_servers: Json[];
38
+ billing_plans: Json[];
39
+ redirect_urls: Json[];
40
+ jwt_templates: Json[];
41
+ }
42
+ export interface Translation {
43
+ /** The `betterAuth()` call that was translated. */
44
+ source: SourceLoc | null;
45
+ /** Every other `betterAuth()` call found (not translated). */
46
+ otherInstances: SourceLoc[];
47
+ document: ConfigDocument;
48
+ report: ReportEntry[];
49
+ /** Environment variables the document's `${NAME}` placeholders need at import time. */
50
+ env: Array<{
51
+ name: string;
52
+ for: string;
53
+ }>;
54
+ /** Secrets that are stored through their own write-only endpoint before the config is applied. */
55
+ secrets: Array<{
56
+ kind: 'captcha_secret';
57
+ provider: string;
58
+ env: string;
59
+ }>;
60
+ /** Better Auth ids → Atlas ids, for the data import and the code rewrite. */
61
+ mappings: {
62
+ providers: Record<string, string>;
63
+ roles: Record<string, string>;
64
+ };
65
+ /** What the session bridge needs to recognise a Better Auth session. */
66
+ bridge: {
67
+ cookiePrefix: string;
68
+ sessionCookie: string;
69
+ secretEnv: string | null;
70
+ expiresInSeconds: number;
71
+ };
72
+ /** Plugin ids found, in order. */
73
+ plugins: string[];
74
+ }
75
+ /** Better Auth social provider id → Atlas catalog provider key. */
76
+ export declare const SOCIAL_PROVIDER_MAP: Record<string, string>;
77
+ export declare function translateBetterAuth(analysis: BetterAuthAnalysis): Translation;