@getrefino/onboarding 0.1.0-rc.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.
@@ -0,0 +1,286 @@
1
+ /**
2
+ * Structured results shared by the CLI and any future hosted onboarding.
3
+ * Everything here is plain JSON-serializable data. No secrets, ever.
4
+ */
5
+ export type PackageManager = "pnpm" | "npm" | "yarn" | "bun" | "unknown";
6
+ export type Framework = "next" | "vite-react" | "react" | "unsupported";
7
+ export type Router = "next-app" | "next-pages" | "react-router" | "single-page" | "unknown";
8
+ export type Language = "typescript" | "javascript";
9
+ export interface DetectedPackage {
10
+ readonly name: string;
11
+ readonly version: string;
12
+ /** Where the dependency was declared. */
13
+ readonly kind: "dependencies" | "devDependencies";
14
+ }
15
+ export interface ScriptSet {
16
+ readonly build?: string;
17
+ readonly test?: string;
18
+ readonly typecheck?: string;
19
+ readonly lint?: string;
20
+ readonly dev?: string;
21
+ }
22
+ export interface GitState {
23
+ readonly isRepository: boolean;
24
+ readonly branch: string | null;
25
+ readonly clean: boolean | null;
26
+ readonly remote: string | null;
27
+ readonly github: {
28
+ readonly owner: string;
29
+ readonly repo: string;
30
+ } | null;
31
+ }
32
+ export interface RouteInfo {
33
+ /** URL path, e.g. "/" or "/blog/[slug]". */
34
+ readonly path: string;
35
+ /** Repository-relative file that renders the route. */
36
+ readonly file: string;
37
+ }
38
+ export interface RepositoryInspection {
39
+ readonly root: string;
40
+ /** Repository-relative path of the app being onboarded ("." for single apps). */
41
+ readonly appRoot: string;
42
+ readonly monorepo: {
43
+ readonly detected: boolean;
44
+ readonly tool: "pnpm" | "yarn" | "npm" | "turbo" | "lerna" | "nx" | null;
45
+ readonly apps: readonly string[];
46
+ };
47
+ readonly packageManager: PackageManager;
48
+ readonly packageJson: string | null;
49
+ readonly packageName: string | null;
50
+ readonly framework: Framework;
51
+ readonly router: Router;
52
+ readonly language: Language;
53
+ readonly react: DetectedPackage | null;
54
+ readonly next: DetectedPackage | null;
55
+ /** Facts read from next.config.*; `output: "export"` means a static site without route handlers. */
56
+ readonly nextConfig: {
57
+ readonly file: string | null;
58
+ readonly output: "export" | "standalone" | null;
59
+ };
60
+ readonly vite: DetectedPackage | null;
61
+ readonly typescript: DetectedPackage | null;
62
+ readonly sourceDir: string;
63
+ readonly routesDir: string | null;
64
+ readonly routes: readonly RouteInfo[];
65
+ readonly layouts: readonly string[];
66
+ readonly entry: string | null;
67
+ readonly scripts: ScriptSet;
68
+ readonly contentDirs: readonly string[];
69
+ readonly refino: {
70
+ readonly packages: readonly DetectedPackage[];
71
+ readonly contentFile: string | null;
72
+ readonly configFile: string | null;
73
+ readonly providerFiles: readonly string[];
74
+ readonly endpointFiles: readonly string[];
75
+ readonly editableTextFiles: readonly string[];
76
+ };
77
+ readonly auth: {
78
+ readonly libraries: readonly string[];
79
+ readonly middlewareFile: string | null;
80
+ readonly notes: readonly string[];
81
+ };
82
+ readonly server: {
83
+ readonly capable: boolean;
84
+ readonly kind: "next-route-handlers" | "next-api-routes" | "custom-server" | "static" | "unknown";
85
+ readonly apiDir: string | null;
86
+ /** Runtime facts that hold whoever serves the copy API. Safe in either mode. */
87
+ readonly notes: readonly string[];
88
+ /**
89
+ * What a deployment that runs its own editor endpoints must do about
90
+ * those facts. A Refino-hosted plan never carries these: Refino serves
91
+ * the copy API and the site has no endpoints of its own.
92
+ */
93
+ readonly selfHosted: readonly string[];
94
+ };
95
+ readonly hosting: {
96
+ readonly provider: string | null;
97
+ readonly evidence: readonly string[];
98
+ };
99
+ readonly git: GitState;
100
+ readonly supported: boolean;
101
+ readonly unsupportedReasons: readonly string[];
102
+ }
103
+ export type CopyClassification = "visible-text" | "display-prop" | "data-object" | "mixed-markup" | "dynamic" | "ui-text" | "accessibility" | "metadata" | "developer-text" | "decorative" | "uncertain";
104
+ export type CandidateStatus = "selected" | "needs-review" | "unsupported" | "excluded";
105
+ export interface CopyCandidate {
106
+ /** Proposed content ID, or null when nothing sensible could be derived. */
107
+ readonly id: string | null;
108
+ readonly text: string;
109
+ readonly file: string;
110
+ readonly line: number;
111
+ readonly column: number;
112
+ /** How the string appears in source. */
113
+ readonly source: "jsx-text" | "jsx-child-literal" | "jsx-attribute" | "data-object";
114
+ /** Enclosing JSX element tag or component (for jsx sources). */
115
+ readonly element: string | null;
116
+ /** Attribute or object key name (for attribute and data sources). */
117
+ readonly key: string | null;
118
+ readonly component: string | null;
119
+ /** Route this file belongs to, or "shared". */
120
+ readonly scope: string;
121
+ readonly classification: CopyClassification;
122
+ readonly status: CandidateStatus;
123
+ readonly reason: string;
124
+ }
125
+ export interface ScanResult {
126
+ readonly filesScanned: readonly string[];
127
+ readonly candidates: readonly CopyCandidate[];
128
+ }
129
+ export type HostKind =
130
+ /** Refino-hosted: the customer site has no endpoint files; Refino serves the copy API. */
131
+ "refino-hosted" | "next-route-handlers" | "cloudflare-pages-functions" | "vercel-functions" | "netlify-functions" | "next-api-routes" | "custom-server" | "unknown-serverless";
132
+ export interface HostIntegration {
133
+ readonly kind: HostKind;
134
+ /** Hosting provider the choice was based on, when identified. */
135
+ readonly provider: string | null;
136
+ /** True when the tool writes both endpoint files itself; false when the agent adapts request-handlers. */
137
+ readonly generated: boolean;
138
+ /** Repository-relative file serving /api/copy (in hosted mode: the Refino copy API URL). */
139
+ readonly copyEndpoint: string;
140
+ /** Repository-relative file serving /api/edit-session (in hosted mode: the Refino token exchange URL). */
141
+ readonly sessionEndpoint: string;
142
+ /** Runtime facts the agent and the owner need (filesystem, compatibility flags, variables). */
143
+ readonly notes: readonly string[];
144
+ }
145
+ export interface PlannedFile {
146
+ readonly path: string;
147
+ readonly action: "create" | "merge" | "append" | "modify";
148
+ readonly description: string;
149
+ }
150
+ export interface MigrationPlan {
151
+ readonly version: 1;
152
+ readonly generatedAt: string;
153
+ readonly tool: {
154
+ readonly name: string;
155
+ readonly version: string;
156
+ };
157
+ readonly repository: {
158
+ readonly root: string;
159
+ readonly appRoot: string;
160
+ readonly framework: Framework;
161
+ readonly router: Router;
162
+ readonly language: Language;
163
+ readonly packageManager: PackageManager;
164
+ readonly react: string | null;
165
+ readonly next: string | null;
166
+ readonly scripts: ScriptSet;
167
+ readonly git: GitState;
168
+ readonly hosting: string | null;
169
+ readonly auth: readonly string[];
170
+ readonly server: RepositoryInspection["server"]["kind"];
171
+ /**
172
+ * Why the server capability is what it is (for example "next.config.mjs
173
+ * sets output: 'export'"), plus, in self-hosted mode only, what to do
174
+ * about it. Hosted plans carry the facts alone.
175
+ */
176
+ readonly serverNotes: readonly string[];
177
+ };
178
+ readonly scope: {
179
+ readonly routes: readonly string[];
180
+ readonly includeShared: boolean;
181
+ readonly description: string;
182
+ };
183
+ readonly contentFile: {
184
+ readonly path: string;
185
+ readonly exists: boolean;
186
+ };
187
+ readonly configFile: {
188
+ readonly path: string;
189
+ readonly exists: boolean;
190
+ };
191
+ readonly integration: {
192
+ readonly provider: {
193
+ readonly file: string | null;
194
+ readonly strategy: string;
195
+ readonly notes: readonly string[];
196
+ };
197
+ readonly endpoint: {
198
+ readonly path: string;
199
+ readonly kind: string;
200
+ readonly notes: readonly string[];
201
+ };
202
+ /** Which host path serves /api/copy and /api/edit-session, and whether the tool generates it. */
203
+ readonly host: HostIntegration;
204
+ readonly auth: {
205
+ readonly strategy: string;
206
+ readonly existing: readonly string[];
207
+ readonly notes: readonly string[];
208
+ };
209
+ readonly persistence: {
210
+ readonly local: {
211
+ readonly adapter: string;
212
+ readonly filePath: string;
213
+ };
214
+ readonly github: {
215
+ readonly adapter: string;
216
+ readonly envVars: readonly string[];
217
+ };
218
+ };
219
+ readonly boilerplateDir: string;
220
+ };
221
+ readonly copy: readonly CopyCandidate[];
222
+ readonly summary: {
223
+ readonly selected: number;
224
+ readonly needsReview: number;
225
+ readonly unsupported: number;
226
+ readonly excluded: number;
227
+ readonly byScope: Readonly<Record<string, number>>;
228
+ readonly byFile: Readonly<Record<string, number>>;
229
+ };
230
+ /** Set when the site is connected to Refino: hosted authentication and copy API, no site secrets. */
231
+ readonly refino: RefinoSite | null;
232
+ readonly files: readonly PlannedFile[];
233
+ readonly verification: {
234
+ readonly commands: readonly string[];
235
+ readonly cli: string;
236
+ };
237
+ readonly unresolved: readonly string[];
238
+ }
239
+ /** Public identifiers of a site connected to Refino. Neither is a secret. */
240
+ export interface RefinoSite {
241
+ readonly siteId: string;
242
+ /** Origin of the Refino app, e.g. "https://app.refino.dev". */
243
+ readonly appUrl: string;
244
+ }
245
+ export interface PlanOptions {
246
+ /** Connect to Refino (hosted mode): the site id from the Refino dashboard, and optionally the app origin. */
247
+ readonly refino?: {
248
+ readonly siteId: string;
249
+ readonly appUrl?: string;
250
+ };
251
+ /** Routes to migrate. Defaults to ["/"] when the route exists. */
252
+ readonly routes?: readonly string[];
253
+ /** Migrate every discovered route. */
254
+ readonly all?: boolean;
255
+ /** Include shared chrome (layouts, nav, footer). Default true. */
256
+ readonly includeShared?: boolean;
257
+ readonly contentFile?: string;
258
+ readonly now?: Date;
259
+ }
260
+ export interface ApplyResult {
261
+ readonly dryRun: boolean;
262
+ readonly written: readonly PlannedFile[];
263
+ readonly skipped: readonly {
264
+ readonly path: string;
265
+ readonly reason: string;
266
+ }[];
267
+ readonly installCommand: string | null;
268
+ }
269
+ export type CheckStatus = "pass" | "fail" | "warn" | "skip";
270
+ export interface VerificationCheck {
271
+ readonly id: string;
272
+ readonly status: CheckStatus;
273
+ readonly message: string;
274
+ readonly details?: readonly string[];
275
+ readonly fix?: string;
276
+ }
277
+ export interface VerificationResult {
278
+ readonly ok: boolean;
279
+ readonly checks: readonly VerificationCheck[];
280
+ readonly commands: readonly {
281
+ readonly command: string;
282
+ readonly ran: boolean;
283
+ readonly ok: boolean | null;
284
+ readonly output?: string;
285
+ }[];
286
+ }
package/dist/types.js ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Structured results shared by the CLI and any future hosted onboarding.
3
+ * Everything here is plain JSON-serializable data. No secrets, ever.
4
+ */
5
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { InspectOptions } from "./inspect.js";
2
+ import type { VerificationResult } from "./types.js";
3
+ export interface VerifyOptions extends InspectOptions {
4
+ /** Run the repository's typecheck/lint/test/build scripts. */
5
+ readonly run?: boolean;
6
+ readonly contentFile?: string;
7
+ }
8
+ export declare function verifyIntegration(rootPath: string, options?: VerifyOptions): VerificationResult;