sitevision-cli 1.0.0-beta.32 → 1.0.0-beta.33

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 (108) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/LICENSE +21 -0
  3. package/dist/cli.js +56 -35
  4. package/dist/commands/TaskScreen.js +32 -0
  5. package/dist/commands/build.js +6 -185
  6. package/dist/commands/deploy.js +85 -238
  7. package/dist/commands/dev.js +34 -37
  8. package/dist/commands/info.js +1 -1
  9. package/dist/commands/setup-signing.js +43 -28
  10. package/dist/commands/sign.js +9 -86
  11. package/dist/commands/use-finish.js +17 -0
  12. package/dist/commands/watch.js +0 -8
  13. package/dist/components/AuthLoginScreen.js +27 -12
  14. package/dist/shell/ConfigForm.js +90 -29
  15. package/dist/shell/Frame.js +4 -1
  16. package/dist/shell/Help.js +2 -1
  17. package/dist/shell/Settings.js +59 -6
  18. package/dist/shell/Shell.js +124 -41
  19. package/dist/shell/Tabs.js +8 -2
  20. package/dist/shell/actions.js +0 -0
  21. package/dist/utils/config.js +46 -3
  22. package/dist/utils/create-app.js +9 -2
  23. package/dist/utils/i18n.js +36 -13
  24. package/dist/utils/jsonc.js +2 -1
  25. package/dist/utils/keychain.js +44 -4
  26. package/dist/utils/oauth2-auth.js +35 -7
  27. package/dist/utils/password-prompt.js +23 -3
  28. package/dist/utils/process-runner.js +4 -2
  29. package/dist/utils/project-detection.js +84 -33
  30. package/dist/utils/session-cookie-auth.js +5 -4
  31. package/dist/utils/sitevision-api.js +21 -14
  32. package/dist/utils/sitevision-scripts-runner.js +32 -15
  33. package/dist/utils/tasks.js +130 -64
  34. package/dist/utils/version-check.js +3 -3
  35. package/dist/utils/webpack-runner.js +6 -5
  36. package/dist/utils/workspace.js +41 -3
  37. package/dist/utils/zip.js +18 -19
  38. package/package.json +24 -3
  39. package/readme.md +11 -4
  40. package/dist/app.d.ts +0 -6
  41. package/dist/app.js +0 -321
  42. package/dist/cli.d.ts +0 -2
  43. package/dist/commands/build.d.ts +0 -12
  44. package/dist/commands/deploy.d.ts +0 -17
  45. package/dist/commands/dev.d.ts +0 -14
  46. package/dist/commands/index.d.ts +0 -4
  47. package/dist/commands/info.d.ts +0 -2
  48. package/dist/commands/setup-signing.d.ts +0 -2
  49. package/dist/commands/sign.d.ts +0 -14
  50. package/dist/commands/types.d.ts +0 -18
  51. package/dist/commands/watch.d.ts +0 -2
  52. package/dist/components/AnimatedLogo.d.ts +0 -10
  53. package/dist/components/AuthLoginScreen.d.ts +0 -21
  54. package/dist/components/DevPropertiesForm.d.ts +0 -11
  55. package/dist/components/DevPropertiesForm.js +0 -246
  56. package/dist/components/InfoScreen.d.ts +0 -7
  57. package/dist/components/InfoScreen.js +0 -14
  58. package/dist/components/KeychainPasswordChoice.d.ts +0 -8
  59. package/dist/components/KeychainPasswordChoice.js +0 -30
  60. package/dist/components/MainMenu.d.ts +0 -7
  61. package/dist/components/MainMenu.js +0 -88
  62. package/dist/components/PasswordInput.d.ts +0 -10
  63. package/dist/components/ProcessOutput.d.ts +0 -6
  64. package/dist/components/ProcessOutput.js +0 -30
  65. package/dist/components/SetupFlow.d.ts +0 -8
  66. package/dist/components/SetupFlow.js +0 -233
  67. package/dist/components/SigningPropertiesForm.d.ts +0 -7
  68. package/dist/components/SigningPropertiesForm.js +0 -38
  69. package/dist/components/StatusIndicator.d.ts +0 -8
  70. package/dist/components/TextInput.d.ts +0 -10
  71. package/dist/components/TextInput.js +0 -29
  72. package/dist/components/WelcomeScreen.d.ts +0 -14
  73. package/dist/scaffold/inquirer-stub.d.ts +0 -6
  74. package/dist/scaffold/register.d.ts +0 -1
  75. package/dist/shell/AddonPicker.d.ts +0 -14
  76. package/dist/shell/Changelog.d.ts +0 -10
  77. package/dist/shell/CommandPalette.d.ts +0 -12
  78. package/dist/shell/ConfigForm.d.ts +0 -42
  79. package/dist/shell/Frame.d.ts +0 -59
  80. package/dist/shell/Help.d.ts +0 -9
  81. package/dist/shell/Popover.d.ts +0 -12
  82. package/dist/shell/Settings.d.ts +0 -6
  83. package/dist/shell/Shell.d.ts +0 -11
  84. package/dist/shell/Tabs.d.ts +0 -36
  85. package/dist/shell/actions.d.ts +0 -49
  86. package/dist/types/index.d.ts +0 -295
  87. package/dist/utils/branding.d.ts +0 -28
  88. package/dist/utils/config.d.ts +0 -27
  89. package/dist/utils/create-app.d.ts +0 -53
  90. package/dist/utils/environments.d.ts +0 -20
  91. package/dist/utils/i18n.d.ts +0 -12
  92. package/dist/utils/jsonc.d.ts +0 -19
  93. package/dist/utils/keychain.d.ts +0 -15
  94. package/dist/utils/oauth2-auth.d.ts +0 -64
  95. package/dist/utils/password-prompt.d.ts +0 -14
  96. package/dist/utils/process-runner.d.ts +0 -32
  97. package/dist/utils/project-detection.d.ts +0 -210
  98. package/dist/utils/session-cookie-auth.d.ts +0 -35
  99. package/dist/utils/signing-password.d.ts +0 -12
  100. package/dist/utils/signing-step.d.ts +0 -15
  101. package/dist/utils/signing-step.js +0 -16
  102. package/dist/utils/sitevision-api.d.ts +0 -155
  103. package/dist/utils/sitevision-scripts-runner.d.ts +0 -84
  104. package/dist/utils/tasks.d.ts +0 -61
  105. package/dist/utils/version-check.d.ts +0 -9
  106. package/dist/utils/webpack-runner.d.ts +0 -76
  107. package/dist/utils/workspace.d.ts +0 -17
  108. package/dist/utils/zip.d.ts +0 -71
@@ -1,295 +0,0 @@
1
- /**
2
- * Sitevision CLI - Shared Type Definitions
3
- *
4
- * This file contains all shared types used across the CLI.
5
- */
6
- /**
7
- * App types supported by Sitevision
8
- */
9
- export type AppType = 'WebApp' | 'Widget' | 'RESTApp' | 'MCPServer';
10
- /**
11
- * Simplified app type for internal use
12
- */
13
- export type SimpleAppType = 'web' | 'widget' | 'rest' | 'mcp';
14
- /**
15
- * A manifest text field that may be a plain string or a localized object keyed
16
- * by language code, e.g. `{sv: 'Namn', en: 'Name'}`. Sitevision allows either
17
- * form for human-facing fields like `name` and `description`.
18
- */
19
- export type LocalizedString = string | Record<string, string>;
20
- /**
21
- * Sitevision app manifest (manifest.json)
22
- */
23
- export interface SitevisionManifest {
24
- id: string;
25
- name: LocalizedString;
26
- version: string;
27
- type: AppType;
28
- bundled?: boolean;
29
- description?: LocalizedString;
30
- author?: string;
31
- helpUrl?: string;
32
- license?: string;
33
- categories?: string[];
34
- }
35
- /**
36
- * Development properties.
37
- *
38
- * Persisted fields live in .dev_properties.json. `password` is runtime-only:
39
- * resolved from the OS keychain (or a legacy plaintext file during migration)
40
- * and never written back to disk.
41
- */
42
- export interface DevProperties {
43
- domain: string;
44
- siteName: string;
45
- addonName: string;
46
- username: string;
47
- password?: string;
48
- useHTTPForDevDeploy?: boolean;
49
- signingUsername?: string;
50
- certificateName?: string;
51
- authMethod?: 'basic' | 'oauth2' | 'cookie';
52
- oauth2?: OAuth2Config;
53
- sessionLoginUrl?: string;
54
- baseEnvironment?: string;
55
- production?: boolean;
56
- environments?: Record<string, EnvironmentOverride>;
57
- accessToken?: string;
58
- sessionCookie?: string;
59
- environmentName?: string;
60
- productionEnvironment?: boolean;
61
- }
62
- /** Fields an environment may override; everything else comes from the base. */
63
- export type EnvironmentOverride = Partial<Pick<DevProperties, 'domain' | 'siteName' | 'addonName' | 'username' | 'authMethod' | 'oauth2' | 'sessionLoginUrl' | 'useHTTPForDevDeploy'>> & {
64
- production?: boolean;
65
- };
66
- /**
67
- * OAuth2 provider config for bearer-token deploys.
68
- *
69
- * Deliberately secret-free: the client secret and refresh token live in the OS
70
- * keychain, so nothing here is unsafe to write to .dev_properties.json.
71
- */
72
- export interface OAuth2Config {
73
- authorizationEndpoint: string;
74
- tokenEndpoint: string;
75
- clientId: string;
76
- scopes?: string[];
77
- redirectPort?: number;
78
- }
79
- /**
80
- * Signing credentials (password is runtime-only, not persisted)
81
- */
82
- export interface SigningCredentials {
83
- username: string;
84
- password: string;
85
- certificateName?: string;
86
- }
87
- /**
88
- * Deployment configuration
89
- */
90
- export interface DeployConfig {
91
- domain: string;
92
- siteName: string;
93
- addonName: string;
94
- username: string;
95
- password?: string;
96
- accessToken?: string;
97
- sessionCookie?: string;
98
- useHTTP?: boolean;
99
- }
100
- /**
101
- * Production deployment configuration
102
- */
103
- export interface ProductionDeployConfig extends DeployConfig {
104
- activate?: boolean;
105
- }
106
- /**
107
- * Package.json sitevision_scripts_properties section
108
- */
109
- export interface SitevisionScriptsProperties {
110
- transpile?: boolean;
111
- transpilePackages?: string[];
112
- babel?: Record<string, unknown>;
113
- }
114
- /**
115
- * Full project information detected from the filesystem
116
- */
117
- export interface ProjectInfo {
118
- root: string;
119
- manifest: SitevisionManifest;
120
- hasDevProperties: boolean;
121
- hasSigningProperties: boolean;
122
- hasLegacyPassword: boolean;
123
- devProperties?: DevProperties;
124
- inheritedKeys: string[];
125
- packageJson: PackageJson;
126
- hasSitevisionScripts: boolean;
127
- hasNodeModules: boolean;
128
- paths: ProjectPaths;
129
- }
130
- /**
131
- * Standard project paths
132
- */
133
- export interface ProjectPaths {
134
- root: string;
135
- src: string;
136
- static: string;
137
- build: string;
138
- dist: string;
139
- manifest: string;
140
- devProperties: string | null;
141
- packageJson: string;
142
- nodeModules: string;
143
- }
144
- /**
145
- * Partial package.json with fields we care about
146
- */
147
- export interface PackageJson {
148
- name?: string;
149
- version?: string;
150
- scripts?: Record<string, string>;
151
- dependencies?: Record<string, string>;
152
- devDependencies?: Record<string, string>;
153
- sitevision_scripts_properties?: SitevisionScriptsProperties;
154
- developmentDomain?: string;
155
- productionDomain?: string;
156
- addonName?: string;
157
- siteName?: string;
158
- }
159
- /**
160
- * REST API endpoints by app type
161
- */
162
- export interface ApiEndpoints {
163
- addon: string;
164
- import: string;
165
- }
166
- /**
167
- * API response from app signing
168
- */
169
- export interface SigningResponse {
170
- success: boolean;
171
- signedFilePath?: string;
172
- error?: string;
173
- }
174
- /**
175
- * API response from deployment
176
- */
177
- export interface DeployResponse {
178
- success: boolean;
179
- executableId?: string;
180
- message?: string;
181
- error?: string;
182
- authExpired?: boolean;
183
- contextNodeMissing?: boolean;
184
- }
185
- /**
186
- * API response from addon creation
187
- */
188
- export interface CreateAddonResponse {
189
- success: boolean;
190
- addonId?: string;
191
- error?: string;
192
- authExpired?: boolean;
193
- }
194
- /**
195
- * API response from activation
196
- */
197
- export interface ActivationResponse {
198
- success: boolean;
199
- error?: string;
200
- authExpired?: boolean;
201
- }
202
- /**
203
- * Build mode
204
- */
205
- export type BuildMode = 'development' | 'production';
206
- /**
207
- * Build options for webpack
208
- */
209
- export interface BuildOptions {
210
- mode: BuildMode;
211
- watch?: boolean;
212
- cssPrefix?: string;
213
- restApp?: boolean;
214
- }
215
- /**
216
- * Build result
217
- */
218
- export interface BuildResult {
219
- success: boolean;
220
- outputPath?: string;
221
- errors?: string[];
222
- warnings?: string[];
223
- stats?: {
224
- time: number;
225
- hash: string;
226
- assets: string[];
227
- };
228
- }
229
- /**
230
- * Watch callback for webpack watch mode
231
- */
232
- export type WatchCallback = (result: BuildResult) => void;
233
- /**
234
- * Command execution context
235
- */
236
- export interface CommandContext {
237
- project: ProjectInfo;
238
- flags: Record<string, unknown>;
239
- args: string[];
240
- }
241
- /**
242
- * Command definition
243
- */
244
- export interface Command {
245
- name: string;
246
- description: string;
247
- requiresProject: boolean;
248
- flags?: Record<string, CommandFlag>;
249
- execute: (context: CommandContext) => Promise<void>;
250
- }
251
- /**
252
- * Command flag definition
253
- */
254
- export interface CommandFlag {
255
- type: 'string' | 'boolean';
256
- description: string;
257
- alias?: string;
258
- default?: unknown;
259
- }
260
- /**
261
- * Process output types
262
- */
263
- export interface ProcessOutput {
264
- type: 'stdout' | 'stderr';
265
- data: string;
266
- }
267
- /**
268
- * Process execution result
269
- */
270
- export interface ProcessResult {
271
- exitCode: number;
272
- output: ProcessOutput[];
273
- }
274
- /**
275
- * HTTP request options
276
- */
277
- export interface HttpRequestOptions {
278
- method: 'GET' | 'POST' | 'PUT' | 'DELETE';
279
- headers?: Record<string, string>;
280
- body?: unknown;
281
- auth?: {
282
- username: string;
283
- password: string;
284
- };
285
- }
286
- /**
287
- * Generic result type for operations that can fail
288
- */
289
- export type Result<T, E = Error> = {
290
- success: true;
291
- data: T;
292
- } | {
293
- success: false;
294
- error: E;
295
- };
@@ -1,28 +0,0 @@
1
- /**
2
- * Shared CLI branding — the logo art and author line. Used both by the Ink
3
- * first-run welcome screen and the non-interactive "what's new" update banner,
4
- * so the two stay identical.
5
- */
6
- export declare const LOGO: string[];
7
- export declare const AUTHOR = "Rasmus S\u00F6derstr\u00F6m";
8
- /**
9
- * Big block-shadow "Sitevision CLI" wordmark, used by the animated startup
10
- * intro (see components/AnimatedLogo). It's ~120 columns wide, so callers
11
- * should only render it when the terminal is at least that wide — otherwise it
12
- * wraps and looks broken.
13
- */
14
- export declare const BIG_LOGO: string[];
15
- /** Display width of the widest BIG_LOGO line. */
16
- export declare const BIG_LOGO_WIDTH: number;
17
- /**
18
- * Compact "Sitevision CLI" wordmark, animated on terminals too narrow for
19
- * BIG_LOGO. ~72 columns wide.
20
- */
21
- export declare const SMALL_LOGO: string[];
22
- /** Display width of the widest SMALL_LOGO line. */
23
- export declare const SMALL_LOGO_WIDTH: number;
24
- /**
25
- * Print the logo + author line straight to stdout (non-interactive), mirroring
26
- * how the masthead is printed. Used for the update banner.
27
- */
28
- export declare function printBranding(): void;
@@ -1,27 +0,0 @@
1
- import { type Language } from './i18n.js';
2
- /** User-facing preferences editable from the shell's Settings screen. */
3
- export interface Settings {
4
- language: Language;
5
- introAnimation: boolean;
6
- }
7
- export declare function getSettings(): Settings;
8
- export declare function setSettings(patch: Partial<Settings>): void;
9
- /** Path of the config file, for display. */
10
- export declare function settingsFile(): string;
11
- /**
12
- * True until the user has completed the first-run welcome at least once.
13
- */
14
- export declare function isFirstRun(): boolean;
15
- /**
16
- * Persist that the first-run welcome has been seen.
17
- */
18
- export declare function markFirstRunComplete(): void;
19
- /**
20
- * The CLI version that was last run, or undefined if never recorded (a fresh
21
- * install, or a user who completed first-run before version tracking existed).
22
- */
23
- export declare function getLastSeenVersion(): string | undefined;
24
- /**
25
- * Persist the CLI version that just ran, so the next run can detect an upgrade.
26
- */
27
- export declare function setLastSeenVersion(version: string): void;
@@ -1,53 +0,0 @@
1
- import { type Task } from './tasks.js';
2
- export declare const CREATE_COMMAND: string[];
3
- export interface PromptQuestion {
4
- name: string;
5
- type: string;
6
- message: string;
7
- choices: string[];
8
- default?: unknown;
9
- error?: string;
10
- }
11
- export type PromptReply = {
12
- value: unknown;
13
- } | {
14
- skip: true;
15
- };
16
- export type Ask = (question: PromptQuestion) => Promise<PromptReply | null>;
17
- /** A folder name that is also a usable package name and manifest id. */
18
- export declare const validAppName: (name: string) => boolean;
19
- /** The closest conventional name: "Min nya app!" and "MinNyaApp" become "min-nya-app". */
20
- export declare function suggestAppName(name: string): string;
21
- /** What is wrong with a typed app name, said so the fix is obvious. */
22
- export declare function appNameProblem(typed: string): string | undefined;
23
- /** A valid name that could be better; the user may keep it. */
24
- export declare function appNameAdvice(typed: string): string | undefined;
25
- export declare const isEmptyOrMissing: (dir: string) => boolean;
26
- /** Listen for the stub's questions. `null` from `ask` means the user cancelled. */
27
- export declare function servePrompts(ask: Ask, onCancel: () => void): Promise<{
28
- socketPath: string;
29
- connected: () => boolean;
30
- close: () => void;
31
- }>;
32
- export type CreateOutcome = 'created' | 'unmanaged' | 'failed' | 'stopped';
33
- /**
34
- * Run the scaffolder for `name` inside `parentDir`. "unmanaged" means it never
35
- * asked svc anything and left no app: the prompt bridge did not take.
36
- */
37
- export declare function startCreateApp(options: {
38
- name: string;
39
- parentDir: string;
40
- ask: Ask;
41
- command?: string[];
42
- }): {
43
- task: Task;
44
- done: Promise<CreateOutcome>;
45
- };
46
- /** Run the scaffolder on the real terminal; resolves when it exits. */
47
- export declare function createAppInTerminal(name: string, parentDir: string): Promise<boolean>;
48
- /**
49
- * Replace the template's placeholders with what is known, and fold the config
50
- * the tool wrote into svc's layout: no plaintext password, and nothing in the
51
- * app's .dev_properties.json that the workspace already provides.
52
- */
53
- export declare function seedNewApp(appDir: string, workspaceRoot?: string): void;
@@ -1,20 +0,0 @@
1
- import type { DevProperties, EnvironmentOverride, ProjectInfo } from '../types/index.js';
2
- /** Name of the environment the top-level dev properties describe. */
3
- export declare function baseEnvironment(dev?: Partial<DevProperties>): string;
4
- export declare function environmentNames(dev?: Partial<DevProperties>): string[];
5
- export declare function isProductionEnvironment(name: string, dev?: Partial<DevProperties>): boolean;
6
- /** Badge colour: dev green, production red, anything else yellow. */
7
- export declare function environmentColor(name: string, dev?: Partial<DevProperties>): 'green' | 'yellow' | 'red';
8
- /**
9
- * The effective dev properties for one environment: the base with that
10
- * environment's overrides applied and credentials resolved for its
11
- * domain/username. The base ("dev") is returned as-is.
12
- */
13
- export declare function resolveEnvironment(dev: DevProperties, name: string): DevProperties;
14
- /** A project view whose dev properties are resolved for `name`. */
15
- export declare function environmentProject(project: ProjectInfo, name: string): ProjectInfo;
16
- /**
17
- * Write one environment's override into the base: keep only the keys whose
18
- * value differs from the base, so the file stays minimal.
19
- */
20
- export declare function withEnvironmentOverride(base: DevProperties, name: string, values: EnvironmentOverride): DevProperties;
@@ -1,12 +0,0 @@
1
- /**
2
- * UI language. English strings are the keys; `t()` returns them untouched in
3
- * English and looks them up in the Swedish table otherwise, falling back to
4
- * English for anything untranslated. `{name}` placeholders are filled from
5
- * the vars argument.
6
- */
7
- export type Language = 'en' | 'sv';
8
- export declare const LANGUAGES: Language[];
9
- export declare const LANGUAGE_NAMES: Record<Language, string>;
10
- export declare function getLanguage(): Language;
11
- export declare function setLanguage(language: Language): void;
12
- export declare function t(text: string, vars?: Record<string, string | number>): string;
@@ -1,19 +0,0 @@
1
- /**
2
- * JSONC helpers.
3
- *
4
- * Sitevision's own manifest documentation shows manifest.json with line and
5
- * block comments (e.g. `"name": { // Multilingual-manifest requires SV 10.1`),
6
- * so real-world manifests copied from the docs contain them. Strict JSON.parse
7
- * rejects those, so we strip comments before parsing.
8
- */
9
- /**
10
- * Remove line comments (//...) and block comments from a JSON string, leaving
11
- * everything inside string literals untouched (so values like
12
- * `"https://example.com"` survive).
13
- */
14
- export declare function stripJsonComments(input: string): string;
15
- /**
16
- * Parse a JSON string that may contain comments (JSONC). Throws the underlying
17
- * SyntaxError if the content is invalid even after comments are removed.
18
- */
19
- export declare function parseJsonc<T>(input: string): T;
@@ -1,15 +0,0 @@
1
- export declare function getDeployPassword(domain: string, username: string): string | null;
2
- export declare function setDeployPassword(domain: string, username: string, password: string): boolean;
3
- export declare function deleteDeployPassword(domain: string, username: string): void;
4
- export declare function getSigningPassword(username: string): string | null;
5
- export declare function setSigningPassword(username: string, password: string): boolean;
6
- export declare function deleteSigningPassword(username: string): void;
7
- export declare function getOAuth2RefreshToken(domain: string, clientId: string): string | null;
8
- export declare function setOAuth2RefreshToken(domain: string, clientId: string, token: string): boolean;
9
- export declare function deleteOAuth2RefreshToken(domain: string, clientId: string): void;
10
- export declare function getOAuth2ClientSecret(domain: string, clientId: string): string | null;
11
- export declare function setOAuth2ClientSecret(domain: string, clientId: string, secret: string): boolean;
12
- export declare function deleteOAuth2ClientSecret(domain: string, clientId: string): void;
13
- export declare function getSessionCookie(domain: string, username: string): string | null;
14
- export declare function setSessionCookie(domain: string, username: string, cookie: string): boolean;
15
- export declare function deleteSessionCookie(domain: string, username: string): void;
@@ -1,64 +0,0 @@
1
- import type { DevProperties } from '../types/index.js';
2
- /** Default loopback port. Fixed so a single redirect URI can be whitelisted. */
3
- export declare const DEFAULT_REDIRECT_PORT = 8137;
4
- export declare const DEFAULT_SCOPES: string[];
5
- /** RFC 7636 S256 pair. Exported for testing the challenge derivation. */
6
- export declare function createPkcePair(): {
7
- verifier: string;
8
- challenge: string;
9
- };
10
- export interface DiscoveredOAuth2 {
11
- authorizationEndpoint: string;
12
- tokenEndpoint: string;
13
- scopesSupported?: string[];
14
- }
15
- /**
16
- * Fetch the site's OpenID configuration (unauthenticated) to auto-fill the
17
- * authorization/token endpoints. Returns null if it isn't published (provider
18
- * not enabled) or the response isn't a valid config, so callers fall back to
19
- * manual entry.
20
- */
21
- export declare function discoverOAuth2Config(domain: string, useHTTP?: boolean): Promise<DiscoveredOAuth2 | null>;
22
- export declare function openBrowser(url: string): void;
23
- /**
24
- * Serve the loopback redirect once. Returns the awaited code and a `close()`
25
- * that shuts the server down (freeing the port) if the login is cancelled — so
26
- * a retry doesn't hit an EADDRINUSE on the fixed redirect port.
27
- */
28
- interface LoopbackResult {
29
- code?: string;
30
- error?: string;
31
- }
32
- /**
33
- * Turn a redirect's query params into a result, prioritizing the provider's own
34
- * error (the most useful reason) over a generic "no code". Exported for testing.
35
- */
36
- export declare function classifyRedirect(params: {
37
- expectedState: string;
38
- state: string | null;
39
- error: string | null;
40
- errorDescription: string | null;
41
- code: string | null;
42
- }): LoopbackResult;
43
- /**
44
- * Start an interactive OAuth2 login. Returns the authorize URL to open and a
45
- * `complete()` that awaits the loopback redirect, exchanges the code, stores the
46
- * refresh token, and resolves the access token. UI-agnostic, so an Ink screen
47
- * can drive it without owning the terminal.
48
- */
49
- export declare function beginOAuth2Login(dev: DevProperties): {
50
- authUrl: string;
51
- complete: () => Promise<{
52
- token?: string;
53
- error?: string;
54
- }>;
55
- cancel: () => void;
56
- } | null;
57
- /**
58
- * Silently resolve an access token by refreshing the keychain refresh token.
59
- * Returns null when there's no refresh token or it's expired/revoked (in which
60
- * case the stale token is dropped). Interactive login lives in `beginOAuth2Login`,
61
- * driven by the Ink login screen — the access token is never persisted.
62
- */
63
- export declare function resolveOAuth2AccessToken(dev: DevProperties): Promise<string | null>;
64
- export {};
@@ -1,14 +0,0 @@
1
- /**
2
- * Prompt for a yes/no answer. Returns true for y/Y.
3
- * Pressing Enter (empty answer) returns `defaultYes` (default: false).
4
- */
5
- export declare function promptYesNo(prompt: string, defaultYes?: boolean): Promise<boolean>;
6
- /**
7
- * Wait for the user to press Enter (or Ctrl+C). Used to hand control to an
8
- * external browser and resume once the user says they're done.
9
- */
10
- export declare function promptEnter(prompt: string): Promise<void>;
11
- /**
12
- * Prompt for password input with masked display
13
- */
14
- export declare function promptPassword(prompt: string): Promise<string>;
@@ -1,32 +0,0 @@
1
- import { type ChildProcess, type SpawnOptions } from 'child_process';
2
- import { EventEmitter } from 'events';
3
- export interface ProcessOutput {
4
- type: 'stdout' | 'stderr';
5
- data: string;
6
- }
7
- export interface ProcessResult {
8
- exitCode: number;
9
- output: ProcessOutput[];
10
- }
11
- /**
12
- * Spawn a child in its own process group, so stopping it also stops whatever it
13
- * starts (npm, webpack workers), and track it so the CLI can kill leftovers on
14
- * exit.
15
- */
16
- export declare function spawnChild(command: string, args: string[], options?: SpawnOptions): ChildProcess;
17
- /** Stop a child and everything it started. */
18
- export declare function killChild(child: ChildProcess): void;
19
- /** Kill every child still running; returns how many were signalled. */
20
- export declare function killAllChildren(): number;
21
- export declare class ProcessRunner extends EventEmitter {
22
- private process;
23
- private readonly output;
24
- private readonly command;
25
- private readonly args;
26
- private readonly cwd?;
27
- private readonly env?;
28
- constructor(command: string, args?: string[], cwd?: string, env?: NodeJS.ProcessEnv);
29
- run(): Promise<ProcessResult>;
30
- kill(): void;
31
- getOutput(): ProcessOutput[];
32
- }