workos 0.6.0 → 0.7.1
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/README.md +51 -15
- package/dist/bin.js +151 -0
- package/dist/bin.js.map +1 -1
- package/dist/cli.config.d.ts +1 -0
- package/dist/cli.config.js +1 -0
- package/dist/cli.config.js.map +1 -1
- package/dist/commands/doctor.d.ts +1 -0
- package/dist/commands/doctor.js +1 -0
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/env.d.ts +9 -0
- package/dist/commands/env.js +188 -0
- package/dist/commands/env.js.map +1 -0
- package/dist/commands/organization.d.ts +18 -0
- package/dist/commands/organization.js +142 -0
- package/dist/commands/organization.js.map +1 -0
- package/dist/commands/user.d.ts +19 -0
- package/dist/commands/user.js +128 -0
- package/dist/commands/user.js.map +1 -0
- package/dist/dashboard/components/CompletionView.js +5 -1
- package/dist/dashboard/components/CompletionView.js.map +1 -1
- package/dist/doctor/agent-prompt.d.ts +10 -0
- package/dist/doctor/agent-prompt.js +190 -0
- package/dist/doctor/agent-prompt.js.map +1 -0
- package/dist/doctor/checks/ai-analysis.d.ts +9 -0
- package/dist/doctor/checks/ai-analysis.js +122 -0
- package/dist/doctor/checks/ai-analysis.js.map +1 -0
- package/dist/doctor/checks/auth-patterns.d.ts +2 -0
- package/dist/doctor/checks/auth-patterns.js +530 -0
- package/dist/doctor/checks/auth-patterns.js.map +1 -0
- package/dist/doctor/checks/environment.js +22 -4
- package/dist/doctor/checks/environment.js.map +1 -1
- package/dist/doctor/checks/framework.js +27 -8
- package/dist/doctor/checks/framework.js.map +1 -1
- package/dist/doctor/checks/language.d.ts +6 -0
- package/dist/doctor/checks/language.js +104 -0
- package/dist/doctor/checks/language.js.map +1 -0
- package/dist/doctor/checks/sdk.js +113 -22
- package/dist/doctor/checks/sdk.js.map +1 -1
- package/dist/doctor/index.js +26 -3
- package/dist/doctor/index.js.map +1 -1
- package/dist/doctor/issues.js +22 -1
- package/dist/doctor/issues.js.map +1 -1
- package/dist/doctor/output.js +85 -18
- package/dist/doctor/output.js.map +1 -1
- package/dist/doctor/types.d.ts +38 -0
- package/dist/doctor/types.js.map +1 -1
- package/dist/lib/adapters/cli-adapter.js +4 -14
- package/dist/lib/adapters/cli-adapter.js.map +1 -1
- package/dist/lib/adapters/dashboard-adapter.js +3 -16
- package/dist/lib/adapters/dashboard-adapter.js.map +1 -1
- package/dist/lib/api-key.d.ts +13 -0
- package/dist/lib/api-key.js +26 -0
- package/dist/lib/api-key.js.map +1 -0
- package/dist/lib/config-store.d.ts +27 -0
- package/dist/lib/config-store.js +142 -0
- package/dist/lib/config-store.js.map +1 -0
- package/dist/lib/credential-store.d.ts +4 -0
- package/dist/lib/credential-store.js +47 -11
- package/dist/lib/credential-store.js.map +1 -1
- package/dist/lib/credentials.d.ts +1 -1
- package/dist/lib/credentials.js +1 -1
- package/dist/lib/credentials.js.map +1 -1
- package/dist/lib/run-with-core.js +23 -2
- package/dist/lib/run-with-core.js.map +1 -1
- package/dist/lib/settings.d.ts +1 -0
- package/dist/lib/settings.js.map +1 -1
- package/dist/lib/validation/build-validator.js +0 -1
- package/dist/lib/validation/build-validator.js.map +1 -1
- package/dist/lib/validation/quick-checks.js +0 -1
- package/dist/lib/validation/quick-checks.js.map +1 -1
- package/dist/lib/workos-api.d.ts +30 -0
- package/dist/lib/workos-api.js +69 -0
- package/dist/lib/workos-api.js.map +1 -0
- package/dist/utils/cli-symbols.d.ts +1 -1
- package/dist/utils/lock-art.d.ts +4 -0
- package/dist/utils/lock-art.js +73 -0
- package/dist/utils/lock-art.js.map +1 -0
- package/dist/utils/package-json.d.ts +1 -0
- package/dist/utils/package-json.js +11 -0
- package/dist/utils/package-json.js.map +1 -1
- package/dist/utils/summary-box.d.ts +18 -0
- package/dist/utils/summary-box.js +148 -0
- package/dist/utils/summary-box.js.map +1 -0
- package/dist/utils/table.d.ts +5 -0
- package/dist/utils/table.js +18 -0
- package/dist/utils/table.js.map +1 -0
- package/package.json +1 -1
- package/skills/workos-authkit-nextjs/SKILL.md +5 -5
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { isUnicodeSupported } from './vendor/is-unicorn-supported.js';
|
|
3
|
+
import { getLockArt, LOCK_WIDTH } from './lock-art.js';
|
|
4
|
+
import { symbols } from './cli-symbols.js';
|
|
5
|
+
/** Pre-built completion summaries shared by CLI and Dashboard adapters. */
|
|
6
|
+
export function renderCompletionSummary(success, summary) {
|
|
7
|
+
if (success) {
|
|
8
|
+
return renderSummaryBox({
|
|
9
|
+
expression: 'success',
|
|
10
|
+
title: 'WorkOS AuthKit Installed',
|
|
11
|
+
items: [
|
|
12
|
+
{ type: 'pending', text: 'Start dev server to test authentication' },
|
|
13
|
+
{ type: 'pending', text: 'Visit WorkOS Dashboard to manage users' },
|
|
14
|
+
],
|
|
15
|
+
footer: 'https://workos.com/docs/authkit',
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return renderSummaryBox({
|
|
19
|
+
expression: 'error',
|
|
20
|
+
title: 'Installation Failed',
|
|
21
|
+
items: summary ? [{ type: 'error', text: summary }] : [],
|
|
22
|
+
footer: 'https://github.com/workos/installer/issues',
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const unicode = isUnicodeSupported();
|
|
26
|
+
const BOX = unicode
|
|
27
|
+
? { tl: '┌', tr: '┐', bl: '└', br: '┘', h: '─', v: '│', ml: '├', mr: '┤' }
|
|
28
|
+
: { tl: '+', tr: '+', bl: '+', br: '+', h: '-', v: '|', ml: '+', mr: '+' };
|
|
29
|
+
const ITEM_ICONS = {
|
|
30
|
+
done: chalk.green(symbols.success),
|
|
31
|
+
pending: chalk.cyan(symbols.arrow),
|
|
32
|
+
error: chalk.red(symbols.error),
|
|
33
|
+
};
|
|
34
|
+
const MIN_WIDTH = 42;
|
|
35
|
+
// Item prefix " X " = 4 visible chars before text
|
|
36
|
+
const ITEM_PREFIX_LEN = 4;
|
|
37
|
+
// Footer prefix " " = 2 visible chars before text
|
|
38
|
+
const FOOTER_PREFIX_LEN = 2;
|
|
39
|
+
function hLine(left, right, width) {
|
|
40
|
+
return `${left}${BOX.h.repeat(width - 2)}${right}`;
|
|
41
|
+
}
|
|
42
|
+
function padRight(text, visibleLen, targetLen) {
|
|
43
|
+
const padding = Math.max(0, targetLen - visibleLen);
|
|
44
|
+
return text + ' '.repeat(padding);
|
|
45
|
+
}
|
|
46
|
+
/** Word-wrap text to fit within maxLen, returning multiple lines. */
|
|
47
|
+
function wrapText(text, maxLen) {
|
|
48
|
+
if (text.length <= maxLen)
|
|
49
|
+
return [text];
|
|
50
|
+
const words = text.split(' ');
|
|
51
|
+
const wrapped = [];
|
|
52
|
+
let current = '';
|
|
53
|
+
for (const word of words) {
|
|
54
|
+
const candidate = current ? `${current} ${word}` : word;
|
|
55
|
+
if (candidate.length > maxLen && current) {
|
|
56
|
+
wrapped.push(current);
|
|
57
|
+
current = word;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
current = candidate;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (current)
|
|
64
|
+
wrapped.push(current);
|
|
65
|
+
return wrapped;
|
|
66
|
+
}
|
|
67
|
+
function getTerminalWidth() {
|
|
68
|
+
return process.stdout.columns || 80;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Render a branded summary box with the WorkOS lock character,
|
|
72
|
+
* a title, optional checklist items, and an optional footer.
|
|
73
|
+
*/
|
|
74
|
+
export function renderSummaryBox(options) {
|
|
75
|
+
const { expression, title, items = [], footer } = options;
|
|
76
|
+
const lockColored = getLockArt(expression, true);
|
|
77
|
+
const lockRaw = getLockArt(expression, false);
|
|
78
|
+
const lockLines = lockColored.length;
|
|
79
|
+
// " " + lock + " " = lock column width
|
|
80
|
+
const lockColWidth = LOCK_WIDTH + 3;
|
|
81
|
+
// Cap box width to terminal width
|
|
82
|
+
const termWidth = getTerminalWidth();
|
|
83
|
+
// innerWidth must fit: lock+title, items, footer — but capped to terminal
|
|
84
|
+
const maxInner = Math.max(MIN_WIDTH - 2, termWidth - 2);
|
|
85
|
+
// Compute ideal inner width from content
|
|
86
|
+
const titleRowWidth = lockColWidth + title.length;
|
|
87
|
+
const itemWidths = items.map((item) => ITEM_PREFIX_LEN + item.text.length);
|
|
88
|
+
const footerWidth = footer ? FOOTER_PREFIX_LEN + footer.length : 0;
|
|
89
|
+
const idealInner = Math.max(titleRowWidth, ...itemWidths, footerWidth) + 1;
|
|
90
|
+
const innerWidth = Math.min(Math.max(MIN_WIDTH - 2, idealInner), maxInner);
|
|
91
|
+
const boxWidth = innerWidth + 2;
|
|
92
|
+
// Available text width for items and footer (after prefix, before right padding + border)
|
|
93
|
+
const itemTextMax = innerWidth - ITEM_PREFIX_LEN - 1;
|
|
94
|
+
const footerTextMax = innerWidth - FOOTER_PREFIX_LEN - 1;
|
|
95
|
+
const lines = [];
|
|
96
|
+
// Top border
|
|
97
|
+
lines.push(hLine(BOX.tl, BOX.tr, boxWidth));
|
|
98
|
+
// Lock + title rows
|
|
99
|
+
const titleLineIndex = 3;
|
|
100
|
+
for (let i = 0; i < lockLines; i++) {
|
|
101
|
+
const lockPart = ` ${lockColored[i]} `;
|
|
102
|
+
const lockPartRaw = ` ${lockRaw[i]} `;
|
|
103
|
+
let rightPart;
|
|
104
|
+
let rightPartLen;
|
|
105
|
+
if (i === titleLineIndex) {
|
|
106
|
+
rightPart = chalk.bold(title);
|
|
107
|
+
rightPartLen = title.length;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
rightPart = '';
|
|
111
|
+
rightPartLen = 0;
|
|
112
|
+
}
|
|
113
|
+
const row = BOX.v + padRight(lockPart + rightPart, lockPartRaw.length + rightPartLen, innerWidth) + BOX.v;
|
|
114
|
+
lines.push(row);
|
|
115
|
+
}
|
|
116
|
+
// Items
|
|
117
|
+
if (items.length > 0) {
|
|
118
|
+
lines.push(`${BOX.v}${' '.repeat(innerWidth)}${BOX.v}`);
|
|
119
|
+
for (const item of items) {
|
|
120
|
+
const icon = ITEM_ICONS[item.type];
|
|
121
|
+
const wrappedLines = wrapText(item.text, itemTextMax);
|
|
122
|
+
// First line gets the icon
|
|
123
|
+
const first = ` ${icon} ${wrappedLines[0]}`;
|
|
124
|
+
const firstLen = ITEM_PREFIX_LEN + wrappedLines[0].length;
|
|
125
|
+
lines.push(`${BOX.v}${padRight(first, firstLen, innerWidth)}${BOX.v}`);
|
|
126
|
+
// Continuation lines are indented to align with text after icon
|
|
127
|
+
for (let j = 1; j < wrappedLines.length; j++) {
|
|
128
|
+
const cont = ` ${wrappedLines[j]}`;
|
|
129
|
+
const contLen = 4 + wrappedLines[j].length;
|
|
130
|
+
lines.push(`${BOX.v}${padRight(cont, contLen, innerWidth)}${BOX.v}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// Footer
|
|
135
|
+
if (footer) {
|
|
136
|
+
lines.push(hLine(BOX.ml, BOX.mr, boxWidth));
|
|
137
|
+
const wrappedFooter = wrapText(footer, footerTextMax);
|
|
138
|
+
for (const fLine of wrappedFooter) {
|
|
139
|
+
const content = ` ${chalk.dim(fLine)}`;
|
|
140
|
+
const visibleLen = FOOTER_PREFIX_LEN + fLine.length;
|
|
141
|
+
lines.push(`${BOX.v}${padRight(content, visibleLen, innerWidth)}${BOX.v}`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// Bottom border
|
|
145
|
+
lines.push(hLine(BOX.bl, BOX.br, boxWidth));
|
|
146
|
+
return lines.join('\n');
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=summary-box.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary-box.js","sourceRoot":"","sources":["../../src/utils/summary-box.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO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CAAC;gBAC3C,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;IACH,CAAC;IAED,SAAS;IACT,IAAI,MAAM,EAAE,CAAC;QACX,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC5C,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QACtD,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;YAClC,MAAM,OAAO,GAAG,KAAK,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACxC,MAAM,UAAU,GAAG,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAC;YACpD,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;IAED,gBAAgB;IAChB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["import chalk from 'chalk';\nimport { isUnicodeSupported } from './vendor/is-unicorn-supported.js';\nimport { type LockExpression, getLockArt, LOCK_WIDTH } from './lock-art.js';\nimport { symbols } from './cli-symbols.js';\n\n/** Pre-built completion summaries shared by CLI and Dashboard adapters. */\nexport function renderCompletionSummary(success: boolean, summary?: string): string {\n if (success) {\n return renderSummaryBox({\n expression: 'success',\n title: 'WorkOS AuthKit Installed',\n items: [\n { type: 'pending', text: 'Start dev server to test authentication' },\n { type: 'pending', text: 'Visit WorkOS Dashboard to manage users' },\n ],\n footer: 'https://workos.com/docs/authkit',\n });\n }\n return renderSummaryBox({\n expression: 'error',\n title: 'Installation Failed',\n items: summary ? [{ type: 'error', text: summary }] : [],\n footer: 'https://github.com/workos/installer/issues',\n });\n}\n\nexport interface SummaryBoxItem {\n type: 'done' | 'pending' | 'error';\n text: string;\n}\n\nexport interface SummaryBoxOptions {\n expression: LockExpression;\n title: string;\n items?: SummaryBoxItem[];\n footer?: string;\n}\n\nconst unicode = isUnicodeSupported();\n\nconst BOX = unicode\n ? { tl: '┌', tr: '┐', bl: '└', br: '┘', h: '─', v: '│', ml: '├', mr: '┤' }\n : { tl: '+', tr: '+', bl: '+', br: '+', h: '-', v: '|', ml: '+', mr: '+' };\n\nconst ITEM_ICONS: Record<SummaryBoxItem['type'], string> = {\n done: chalk.green(symbols.success),\n pending: chalk.cyan(symbols.arrow),\n error: chalk.red(symbols.error),\n};\n\nconst MIN_WIDTH = 42;\n// Item prefix \" X \" = 4 visible chars before text\nconst ITEM_PREFIX_LEN = 4;\n// Footer prefix \" \" = 2 visible chars before text\nconst FOOTER_PREFIX_LEN = 2;\n\nfunction hLine(left: string, right: string, width: number): string {\n return `${left}${BOX.h.repeat(width - 2)}${right}`;\n}\n\nfunction padRight(text: string, visibleLen: number, targetLen: number): string {\n const padding = Math.max(0, targetLen - visibleLen);\n return text + ' '.repeat(padding);\n}\n\n/** Word-wrap text to fit within maxLen, returning multiple lines. */\nfunction wrapText(text: string, maxLen: number): string[] {\n if (text.length <= maxLen) return [text];\n const words = text.split(' ');\n const wrapped: string[] = [];\n let current = '';\n for (const word of words) {\n const candidate = current ? `${current} ${word}` : word;\n if (candidate.length > maxLen && current) {\n wrapped.push(current);\n current = word;\n } else {\n current = candidate;\n }\n }\n if (current) wrapped.push(current);\n return wrapped;\n}\n\nfunction getTerminalWidth(): number {\n return process.stdout.columns || 80;\n}\n\n/**\n * Render a branded summary box with the WorkOS lock character,\n * a title, optional checklist items, and an optional footer.\n */\nexport function renderSummaryBox(options: SummaryBoxOptions): string {\n const { expression, title, items = [], footer } = options;\n\n const lockColored = getLockArt(expression, true);\n const lockRaw = getLockArt(expression, false);\n const lockLines = lockColored.length;\n\n // \" \" + lock + \" \" = lock column width\n const lockColWidth = LOCK_WIDTH + 3;\n\n // Cap box width to terminal width\n const termWidth = getTerminalWidth();\n // innerWidth must fit: lock+title, items, footer — but capped to terminal\n const maxInner = Math.max(MIN_WIDTH - 2, termWidth - 2);\n\n // Compute ideal inner width from content\n const titleRowWidth = lockColWidth + title.length;\n const itemWidths = items.map((item) => ITEM_PREFIX_LEN + item.text.length);\n const footerWidth = footer ? FOOTER_PREFIX_LEN + footer.length : 0;\n const idealInner = Math.max(titleRowWidth, ...itemWidths, footerWidth) + 1;\n\n const innerWidth = Math.min(Math.max(MIN_WIDTH - 2, idealInner), maxInner);\n const boxWidth = innerWidth + 2;\n\n // Available text width for items and footer (after prefix, before right padding + border)\n const itemTextMax = innerWidth - ITEM_PREFIX_LEN - 1;\n const footerTextMax = innerWidth - FOOTER_PREFIX_LEN - 1;\n\n const lines: string[] = [];\n\n // Top border\n lines.push(hLine(BOX.tl, BOX.tr, boxWidth));\n\n // Lock + title rows\n const titleLineIndex = 3;\n for (let i = 0; i < lockLines; i++) {\n const lockPart = ` ${lockColored[i]} `;\n const lockPartRaw = ` ${lockRaw[i]} `;\n let rightPart: string;\n let rightPartLen: number;\n if (i === titleLineIndex) {\n rightPart = chalk.bold(title);\n rightPartLen = title.length;\n } else {\n rightPart = '';\n rightPartLen = 0;\n }\n const row = BOX.v + padRight(lockPart + rightPart, lockPartRaw.length + rightPartLen, innerWidth) + BOX.v;\n lines.push(row);\n }\n\n // Items\n if (items.length > 0) {\n lines.push(`${BOX.v}${' '.repeat(innerWidth)}${BOX.v}`);\n\n for (const item of items) {\n const icon = ITEM_ICONS[item.type];\n const wrappedLines = wrapText(item.text, itemTextMax);\n // First line gets the icon\n const first = ` ${icon} ${wrappedLines[0]}`;\n const firstLen = ITEM_PREFIX_LEN + wrappedLines[0].length;\n lines.push(`${BOX.v}${padRight(first, firstLen, innerWidth)}${BOX.v}`);\n // Continuation lines are indented to align with text after icon\n for (let j = 1; j < wrappedLines.length; j++) {\n const cont = ` ${wrappedLines[j]}`;\n const contLen = 4 + wrappedLines[j].length;\n lines.push(`${BOX.v}${padRight(cont, contLen, innerWidth)}${BOX.v}`);\n }\n }\n }\n\n // Footer\n if (footer) {\n lines.push(hLine(BOX.ml, BOX.mr, boxWidth));\n const wrappedFooter = wrapText(footer, footerTextMax);\n for (const fLine of wrappedFooter) {\n const content = ` ${chalk.dim(fLine)}`;\n const visibleLen = FOOTER_PREFIX_LEN + fLine.length;\n lines.push(`${BOX.v}${padRight(content, visibleLen, innerWidth)}${BOX.v}`);\n }\n }\n\n // Bottom border\n lines.push(hLine(BOX.bl, BOX.br, boxWidth));\n\n return lines.join('\\n');\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
export function formatTable(columns, rows) {
|
|
3
|
+
const widths = columns.map((col, i) => {
|
|
4
|
+
const contentMax = rows.reduce((max, row) => Math.max(max, (row[i] || '').length), 0);
|
|
5
|
+
return col.width ?? Math.max(col.header.length, contentMax);
|
|
6
|
+
});
|
|
7
|
+
const lines = [];
|
|
8
|
+
const header = columns.map((col, i) => chalk.yellow(col.header.padEnd(widths[i]))).join(' ');
|
|
9
|
+
lines.push(header);
|
|
10
|
+
const totalWidth = widths.reduce((sum, w) => sum + w, 0) + (widths.length - 1) * 2;
|
|
11
|
+
lines.push(chalk.dim('─'.repeat(totalWidth)));
|
|
12
|
+
for (const row of rows) {
|
|
13
|
+
const line = row.map((cell, i) => (cell || '').padEnd(widths[i])).join(' ');
|
|
14
|
+
lines.push(line);
|
|
15
|
+
}
|
|
16
|
+
return lines.join('\n');
|
|
17
|
+
}
|
|
18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,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE9C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7E,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["import chalk from 'chalk';\n\nexport interface TableColumn {\n header: string;\n width?: number;\n}\n\nexport function formatTable(columns: TableColumn[], rows: string[][]): string {\n const widths = columns.map((col, i) => {\n const contentMax = rows.reduce((max, row) => Math.max(max, (row[i] || '').length), 0);\n return col.width ?? Math.max(col.header.length, contentMax);\n });\n\n const lines: string[] = [];\n\n const header = columns.map((col, i) => chalk.yellow(col.header.padEnd(widths[i]))).join(' ');\n lines.push(header);\n\n const totalWidth = widths.reduce((sum, w) => sum + w, 0) + (widths.length - 1) * 2;\n lines.push(chalk.dim('─'.repeat(totalWidth)));\n\n for (const row of rows) {\n const line = row.map((cell, i) => (cell || '').padEnd(widths[i])).join(' ');\n lines.push(line);\n }\n\n return lines.join('\\n');\n}\n"]}
|
package/package.json
CHANGED
|
@@ -148,7 +148,7 @@ This is required for:
|
|
|
148
148
|
|
|
149
149
|
```tsx
|
|
150
150
|
// app/layout.tsx
|
|
151
|
-
import { AuthKitProvider } from '@workos-inc/authkit-nextjs';
|
|
151
|
+
import { AuthKitProvider } from '@workos-inc/authkit-nextjs/components';
|
|
152
152
|
|
|
153
153
|
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
154
154
|
return (
|
|
@@ -161,13 +161,13 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
|
|
161
161
|
}
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
-
Check README for exact import path - it may be a subpath export like `@workos-inc/authkit-nextjs/components`.
|
|
165
|
-
|
|
166
164
|
**Do NOT skip this step** even if using server-side auth patterns elsewhere.
|
|
167
165
|
|
|
168
166
|
## Step 8: UI Integration
|
|
169
167
|
|
|
170
|
-
Add auth UI to `app/page.tsx` using SDK functions. See README for `getUser`, `getSignInUrl`, `signOut`
|
|
168
|
+
Add auth UI to `app/page.tsx` using SDK functions. See README for auth helper usage (`withAuth`/`getUser`, `getSignInUrl`, `signOut`).
|
|
169
|
+
|
|
170
|
+
**Note:** The SDK renamed `getUser` to `withAuth` in newer versions. Use whichever function the installed SDK version exports — do NOT rename existing working imports.
|
|
171
171
|
|
|
172
172
|
## Verification Checklist (ALL MUST PASS)
|
|
173
173
|
|
|
@@ -238,7 +238,7 @@ This error causes OAuth codes to expire ("invalid_grant"), so fix the handler fi
|
|
|
238
238
|
|
|
239
239
|
### Build fails after AuthKitProvider
|
|
240
240
|
|
|
241
|
-
- Check:
|
|
241
|
+
- Check: Import path matches what README specifies (root export vs `/components` subpath)
|
|
242
242
|
- Check: No client/server boundary violations
|
|
243
243
|
|
|
244
244
|
### NEXT*PUBLIC* prefix issues
|