episoda 0.2.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/dist/commands/auth.d.ts +22 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +384 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/dev.d.ts +20 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +305 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/status.d.ts +9 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +75 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/stop.d.ts +17 -0
- package/dist/commands/stop.d.ts.map +1 -0
- package/dist/commands/stop.js +81 -0
- package/dist/commands/stop.js.map +1 -0
- package/dist/core/auth.d.ts +26 -0
- package/dist/core/auth.d.ts.map +1 -0
- package/dist/core/auth.js +113 -0
- package/dist/core/auth.js.map +1 -0
- package/dist/core/command-protocol.d.ts +262 -0
- package/dist/core/command-protocol.d.ts.map +1 -0
- package/dist/core/command-protocol.js +13 -0
- package/dist/core/command-protocol.js.map +1 -0
- package/dist/core/connection-manager.d.ts +58 -0
- package/dist/core/connection-manager.d.ts.map +1 -0
- package/dist/core/connection-manager.js +215 -0
- package/dist/core/connection-manager.js.map +1 -0
- package/dist/core/errors.d.ts +18 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +55 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/git-executor.d.ts +157 -0
- package/dist/core/git-executor.d.ts.map +1 -0
- package/dist/core/git-executor.js +1605 -0
- package/dist/core/git-executor.js.map +1 -0
- package/dist/core/git-parser.d.ts +40 -0
- package/dist/core/git-parser.d.ts.map +1 -0
- package/dist/core/git-parser.js +194 -0
- package/dist/core/git-parser.js.map +1 -0
- package/dist/core/git-validator.d.ts +42 -0
- package/dist/core/git-validator.d.ts.map +1 -0
- package/dist/core/git-validator.js +102 -0
- package/dist/core/git-validator.js.map +1 -0
- package/dist/core/index.d.ts +17 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +41 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/version.d.ts +9 -0
- package/dist/core/version.d.ts.map +1 -0
- package/dist/core/version.js +19 -0
- package/dist/core/version.js.map +1 -0
- package/dist/core/websocket-client.d.ts +122 -0
- package/dist/core/websocket-client.d.ts.map +1 -0
- package/dist/core/websocket-client.js +438 -0
- package/dist/core/websocket-client.js.map +1 -0
- package/dist/daemon/daemon-manager.d.ts +71 -0
- package/dist/daemon/daemon-manager.d.ts.map +1 -0
- package/dist/daemon/daemon-manager.js +289 -0
- package/dist/daemon/daemon-manager.js.map +1 -0
- package/dist/daemon/daemon-process.d.ts +13 -0
- package/dist/daemon/daemon-process.d.ts.map +1 -0
- package/dist/daemon/daemon-process.js +608 -0
- package/dist/daemon/daemon-process.js.map +1 -0
- package/dist/daemon/machine-id.d.ts +36 -0
- package/dist/daemon/machine-id.d.ts.map +1 -0
- package/dist/daemon/machine-id.js +195 -0
- package/dist/daemon/machine-id.js.map +1 -0
- package/dist/daemon/project-tracker.d.ts +92 -0
- package/dist/daemon/project-tracker.d.ts.map +1 -0
- package/dist/daemon/project-tracker.js +259 -0
- package/dist/daemon/project-tracker.js.map +1 -0
- package/dist/dev-wrapper.d.ts +88 -0
- package/dist/dev-wrapper.d.ts.map +1 -0
- package/dist/dev-wrapper.js +288 -0
- package/dist/dev-wrapper.js.map +1 -0
- package/dist/framework-detector.d.ts +29 -0
- package/dist/framework-detector.d.ts.map +1 -0
- package/dist/framework-detector.js +276 -0
- package/dist/framework-detector.js.map +1 -0
- package/dist/git-helpers/git-credential-helper.d.ts +29 -0
- package/dist/git-helpers/git-credential-helper.d.ts.map +1 -0
- package/dist/git-helpers/git-credential-helper.js +349 -0
- package/dist/git-helpers/git-credential-helper.js.map +1 -0
- package/dist/hooks/post-checkout +296 -0
- package/dist/hooks/pre-commit +139 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +102 -0
- package/dist/index.js.map +1 -0
- package/dist/ipc/ipc-client.d.ts +95 -0
- package/dist/ipc/ipc-client.d.ts.map +1 -0
- package/dist/ipc/ipc-client.js +204 -0
- package/dist/ipc/ipc-client.js.map +1 -0
- package/dist/ipc/ipc-server.d.ts +55 -0
- package/dist/ipc/ipc-server.d.ts.map +1 -0
- package/dist/ipc/ipc-server.js +177 -0
- package/dist/ipc/ipc-server.js.map +1 -0
- package/dist/output.d.ts +48 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +129 -0
- package/dist/output.js.map +1 -0
- package/dist/utils/port-check.d.ts +15 -0
- package/dist/utils/port-check.d.ts.map +1 -0
- package/dist/utils/port-check.js +79 -0
- package/dist/utils/port-check.js.map +1 -0
- package/dist/utils/update-checker.d.ts +23 -0
- package/dist/utils/update-checker.d.ts.map +1 -0
- package/dist/utils/update-checker.js +95 -0
- package/dist/utils/update-checker.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `episoda auth` command (K722)
|
|
3
|
+
*
|
|
4
|
+
* Combines OAuth device flow with automatic configuration:
|
|
5
|
+
* 1. Initiates OAuth device flow (gets device_code and user_code)
|
|
6
|
+
* 2. Opens browser for user to authorize and select project
|
|
7
|
+
* 3. Monitors SSE stream for authorization completion
|
|
8
|
+
* 4. Exchanges device_code for access_token
|
|
9
|
+
* 5. Saves complete config to ~/.episoda/config.json
|
|
10
|
+
* 6. EP548: Installs git credential helper for seamless GitHub auth
|
|
11
|
+
*
|
|
12
|
+
* This replaces the old two-step flow (episoda init + setup token).
|
|
13
|
+
* Now users just run `episoda auth` and select their project in the browser.
|
|
14
|
+
*/
|
|
15
|
+
export interface AuthCommandOptions {
|
|
16
|
+
apiUrl?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Auth command - OAuth device flow with browser-based project selection
|
|
20
|
+
*/
|
|
21
|
+
export declare function authCommand(options?: AuthCommandOptions): Promise<void>;
|
|
22
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAqCH,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6EjF"}
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `episoda auth` command (K722)
|
|
4
|
+
*
|
|
5
|
+
* Combines OAuth device flow with automatic configuration:
|
|
6
|
+
* 1. Initiates OAuth device flow (gets device_code and user_code)
|
|
7
|
+
* 2. Opens browser for user to authorize and select project
|
|
8
|
+
* 3. Monitors SSE stream for authorization completion
|
|
9
|
+
* 4. Exchanges device_code for access_token
|
|
10
|
+
* 5. Saves complete config to ~/.episoda/config.json
|
|
11
|
+
* 6. EP548: Installs git credential helper for seamless GitHub auth
|
|
12
|
+
*
|
|
13
|
+
* This replaces the old two-step flow (episoda init + setup token).
|
|
14
|
+
* Now users just run `episoda auth` and select their project in the browser.
|
|
15
|
+
*/
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
+
}) : function(o, v) {
|
|
30
|
+
o["default"] = v;
|
|
31
|
+
});
|
|
32
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
33
|
+
var ownKeys = function(o) {
|
|
34
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
35
|
+
var ar = [];
|
|
36
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
return ownKeys(o);
|
|
40
|
+
};
|
|
41
|
+
return function (mod) {
|
|
42
|
+
if (mod && mod.__esModule) return mod;
|
|
43
|
+
var result = {};
|
|
44
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
45
|
+
__setModuleDefault(result, mod);
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
})();
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.authCommand = authCommand;
|
|
51
|
+
const os = __importStar(require("os"));
|
|
52
|
+
const fs = __importStar(require("fs"));
|
|
53
|
+
const path = __importStar(require("path"));
|
|
54
|
+
const child_process_1 = require("child_process");
|
|
55
|
+
const core_1 = require("../core");
|
|
56
|
+
const output_1 = require("../output");
|
|
57
|
+
const machine_id_1 = require("../daemon/machine-id");
|
|
58
|
+
const git_credential_helper_1 = require("../git-helpers/git-credential-helper");
|
|
59
|
+
/**
|
|
60
|
+
* Auth command - OAuth device flow with browser-based project selection
|
|
61
|
+
*/
|
|
62
|
+
async function authCommand(options = {}) {
|
|
63
|
+
const apiUrl = options.apiUrl || process.env.EPISODA_API_URL || 'https://episoda.dev';
|
|
64
|
+
output_1.status.info('Initializing Episoda CLI...');
|
|
65
|
+
output_1.status.info('');
|
|
66
|
+
// Step 1: Initiate device flow
|
|
67
|
+
output_1.status.info('Step 1/3: Requesting authorization code...');
|
|
68
|
+
const deviceAuth = await initiateDeviceFlow(apiUrl);
|
|
69
|
+
output_1.status.success(`✓ Authorization code received: ${deviceAuth.user_code}`);
|
|
70
|
+
output_1.status.info('');
|
|
71
|
+
// Step 2: Open browser and monitor for authorization
|
|
72
|
+
output_1.status.info('Step 2/3: Opening browser for authorization...');
|
|
73
|
+
output_1.status.info(` Visit: ${deviceAuth.verification_uri_complete}`);
|
|
74
|
+
output_1.status.info(` User code: ${deviceAuth.user_code}`);
|
|
75
|
+
output_1.status.info('');
|
|
76
|
+
// Open browser
|
|
77
|
+
openBrowser(deviceAuth.verification_uri_complete);
|
|
78
|
+
output_1.status.info('Waiting for authorization...');
|
|
79
|
+
const authorized = await monitorAuthorization(apiUrl, deviceAuth.device_code, deviceAuth.expires_in);
|
|
80
|
+
if (!authorized) {
|
|
81
|
+
throw new Error('Authorization failed or timed out');
|
|
82
|
+
}
|
|
83
|
+
output_1.status.success('✓ Authorization successful!');
|
|
84
|
+
output_1.status.info('');
|
|
85
|
+
// Step 3: Exchange device code for access token
|
|
86
|
+
output_1.status.info('Step 3/3: Exchanging authorization for access token...');
|
|
87
|
+
// EP609: Get machine ID to associate with token
|
|
88
|
+
const machineId = await (0, machine_id_1.getMachineId)();
|
|
89
|
+
const tokenResponse = await exchangeDeviceCode(apiUrl, deviceAuth.device_code, machineId);
|
|
90
|
+
output_1.status.success('✓ Access token received');
|
|
91
|
+
output_1.status.info(` Project: ${tokenResponse.project_uid}`);
|
|
92
|
+
output_1.status.info(` Workspace: ${tokenResponse.workspace_uid}`);
|
|
93
|
+
output_1.status.info('');
|
|
94
|
+
// Save configuration
|
|
95
|
+
await (0, core_1.saveConfig)({
|
|
96
|
+
project_id: tokenResponse.project_id,
|
|
97
|
+
user_id: tokenResponse.user_id,
|
|
98
|
+
workspace_id: tokenResponse.workspace_id,
|
|
99
|
+
access_token: tokenResponse.access_token,
|
|
100
|
+
api_url: apiUrl,
|
|
101
|
+
cli_version: core_1.VERSION,
|
|
102
|
+
});
|
|
103
|
+
output_1.status.success(`✓ Configuration saved to ${(0, core_1.getConfigPath)()}`);
|
|
104
|
+
output_1.status.info('');
|
|
105
|
+
// EP548: Install git credential helper
|
|
106
|
+
output_1.status.info('Installing git credential helper...');
|
|
107
|
+
const credentialHelperInstalled = await installGitCredentialHelper(apiUrl);
|
|
108
|
+
if (credentialHelperInstalled) {
|
|
109
|
+
output_1.status.success('✓ Git credential helper installed');
|
|
110
|
+
output_1.status.info(' Git operations will now use Episoda authentication automatically.');
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
output_1.status.warning('⚠ Git credential helper could not be installed automatically.');
|
|
114
|
+
output_1.status.info(' You can still use git with manual token setup.');
|
|
115
|
+
}
|
|
116
|
+
output_1.status.info('');
|
|
117
|
+
output_1.status.success('CLI initialized successfully!');
|
|
118
|
+
output_1.status.info('');
|
|
119
|
+
output_1.status.info('Next steps:');
|
|
120
|
+
output_1.status.info(' • Start daemon: episoda dev');
|
|
121
|
+
output_1.status.info(' • Check status: episoda status');
|
|
122
|
+
output_1.status.info(' • Git operations will use Episoda auth automatically');
|
|
123
|
+
output_1.status.info('');
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Step 1: Initiate OAuth device flow
|
|
127
|
+
*/
|
|
128
|
+
async function initiateDeviceFlow(apiUrl) {
|
|
129
|
+
const response = await fetch(`${apiUrl}/api/oauth/code`, {
|
|
130
|
+
method: 'POST',
|
|
131
|
+
headers: {
|
|
132
|
+
'Content-Type': 'application/json',
|
|
133
|
+
},
|
|
134
|
+
body: JSON.stringify({}),
|
|
135
|
+
});
|
|
136
|
+
if (!response.ok) {
|
|
137
|
+
const error = await response.json();
|
|
138
|
+
throw new Error(error.error_description || error.error || 'Failed to initiate device flow');
|
|
139
|
+
}
|
|
140
|
+
return await response.json();
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Step 2: Monitor authorization via SSE stream
|
|
144
|
+
*/
|
|
145
|
+
async function monitorAuthorization(apiUrl, deviceCode, expiresIn) {
|
|
146
|
+
return new Promise((resolve) => {
|
|
147
|
+
const timeout = setTimeout(() => {
|
|
148
|
+
output_1.status.error('Authorization timed out');
|
|
149
|
+
resolve(false);
|
|
150
|
+
}, expiresIn * 1000); // Convert seconds to milliseconds
|
|
151
|
+
// Start SSE stream
|
|
152
|
+
const url = `${apiUrl}/api/oauth/authorize-stream?device_code=${deviceCode}`;
|
|
153
|
+
// Use curl to handle SSE stream (simpler than implementing SSE parser in Node)
|
|
154
|
+
const curlProcess = (0, child_process_1.spawn)('curl', ['-N', url]);
|
|
155
|
+
let buffer = '';
|
|
156
|
+
curlProcess.stdout.on('data', (chunk) => {
|
|
157
|
+
buffer += chunk.toString();
|
|
158
|
+
// Process complete SSE messages
|
|
159
|
+
const messages = buffer.split('\n\n');
|
|
160
|
+
buffer = messages.pop() || ''; // Keep incomplete message in buffer
|
|
161
|
+
for (const message of messages) {
|
|
162
|
+
if (!message.trim())
|
|
163
|
+
continue;
|
|
164
|
+
// Parse SSE message
|
|
165
|
+
const lines = message.split('\n');
|
|
166
|
+
let eventType = '';
|
|
167
|
+
let data = '';
|
|
168
|
+
for (const line of lines) {
|
|
169
|
+
if (line.startsWith('event: ')) {
|
|
170
|
+
eventType = line.substring(7);
|
|
171
|
+
}
|
|
172
|
+
else if (line.startsWith('data: ')) {
|
|
173
|
+
data = line.substring(6);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (!eventType)
|
|
177
|
+
continue;
|
|
178
|
+
try {
|
|
179
|
+
// Handle based on event type
|
|
180
|
+
if (eventType === 'authorized') {
|
|
181
|
+
clearTimeout(timeout);
|
|
182
|
+
curlProcess.kill();
|
|
183
|
+
resolve(true);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
else if (eventType === 'denied') {
|
|
187
|
+
clearTimeout(timeout);
|
|
188
|
+
curlProcess.kill();
|
|
189
|
+
output_1.status.error('Authorization denied by user');
|
|
190
|
+
resolve(false);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
else if (eventType === 'expired') {
|
|
194
|
+
clearTimeout(timeout);
|
|
195
|
+
curlProcess.kill();
|
|
196
|
+
output_1.status.error('Authorization code expired');
|
|
197
|
+
resolve(false);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
else if (eventType === 'error') {
|
|
201
|
+
const errorData = JSON.parse(data);
|
|
202
|
+
clearTimeout(timeout);
|
|
203
|
+
curlProcess.kill();
|
|
204
|
+
output_1.status.error(`Authorization error: ${errorData.error_description || errorData.error || 'Unknown error'}`);
|
|
205
|
+
resolve(false);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
// For 'pending' events, continue waiting
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
// Ignore parse errors, continue monitoring
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
curlProcess.on('error', (error) => {
|
|
216
|
+
clearTimeout(timeout);
|
|
217
|
+
output_1.status.error(`Failed to monitor authorization: ${error.message}`);
|
|
218
|
+
resolve(false);
|
|
219
|
+
});
|
|
220
|
+
curlProcess.on('close', (code) => {
|
|
221
|
+
clearTimeout(timeout);
|
|
222
|
+
if (code !== 0 && code !== null) {
|
|
223
|
+
output_1.status.error(`Authorization monitoring failed with code ${code}`);
|
|
224
|
+
resolve(false);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Step 3: Exchange device code for access token
|
|
231
|
+
* EP609: Now includes machine_id to associate token with device
|
|
232
|
+
*/
|
|
233
|
+
async function exchangeDeviceCode(apiUrl, deviceCode, machineId) {
|
|
234
|
+
const response = await fetch(`${apiUrl}/api/oauth/token`, {
|
|
235
|
+
method: 'POST',
|
|
236
|
+
headers: {
|
|
237
|
+
'Content-Type': 'application/json',
|
|
238
|
+
},
|
|
239
|
+
body: JSON.stringify({
|
|
240
|
+
grant_type: 'urn:ietf:params:oauth:grant-type:device_code',
|
|
241
|
+
device_code: deviceCode,
|
|
242
|
+
machine_id: machineId,
|
|
243
|
+
}),
|
|
244
|
+
});
|
|
245
|
+
if (!response.ok) {
|
|
246
|
+
const error = await response.json();
|
|
247
|
+
throw new Error(error.error_description || error.error || 'Failed to exchange device code');
|
|
248
|
+
}
|
|
249
|
+
const tokenResponse = await response.json();
|
|
250
|
+
// Validate that we got all required fields
|
|
251
|
+
if (!tokenResponse.access_token || !tokenResponse.user_id || !tokenResponse.workspace_id || !tokenResponse.project_id) {
|
|
252
|
+
throw new Error('Incomplete token response from server');
|
|
253
|
+
}
|
|
254
|
+
return tokenResponse;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Open browser to verification URL
|
|
258
|
+
*/
|
|
259
|
+
function openBrowser(url) {
|
|
260
|
+
const platform = os.platform();
|
|
261
|
+
let command;
|
|
262
|
+
let args;
|
|
263
|
+
switch (platform) {
|
|
264
|
+
case 'darwin':
|
|
265
|
+
command = 'open';
|
|
266
|
+
args = [url];
|
|
267
|
+
break;
|
|
268
|
+
case 'win32':
|
|
269
|
+
command = 'cmd';
|
|
270
|
+
args = ['/c', 'start', url];
|
|
271
|
+
break;
|
|
272
|
+
default: // Linux and others
|
|
273
|
+
command = 'xdg-open';
|
|
274
|
+
args = [url];
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
try {
|
|
278
|
+
(0, child_process_1.spawn)(command, args, {
|
|
279
|
+
detached: true,
|
|
280
|
+
stdio: 'ignore',
|
|
281
|
+
}).unref();
|
|
282
|
+
}
|
|
283
|
+
catch (error) {
|
|
284
|
+
output_1.status.warning(`Could not open browser automatically. Please visit: ${url}`);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* EP548: Install git credential helper
|
|
289
|
+
*
|
|
290
|
+
* This function:
|
|
291
|
+
* 1. Creates ~/.episoda/bin directory
|
|
292
|
+
* 2. Writes the credential helper script
|
|
293
|
+
* 3. Makes it executable
|
|
294
|
+
* 4. Adds ~/.episoda/bin to PATH if needed
|
|
295
|
+
* 5. Configures git to use the credential helper
|
|
296
|
+
*
|
|
297
|
+
* The credential helper is added to git's credential helper chain,
|
|
298
|
+
* so existing credential helpers are preserved.
|
|
299
|
+
*/
|
|
300
|
+
async function installGitCredentialHelper(apiUrl) {
|
|
301
|
+
try {
|
|
302
|
+
const homeDir = os.homedir();
|
|
303
|
+
const episodaBinDir = path.join(homeDir, '.episoda', 'bin');
|
|
304
|
+
const helperPath = path.join(episodaBinDir, 'git-credential-episoda');
|
|
305
|
+
// 1. Create bin directory
|
|
306
|
+
fs.mkdirSync(episodaBinDir, { recursive: true });
|
|
307
|
+
// 2. Write credential helper script
|
|
308
|
+
const scriptContent = (0, git_credential_helper_1.generateCredentialHelperScript)(apiUrl);
|
|
309
|
+
fs.writeFileSync(helperPath, scriptContent, { mode: 0o755 });
|
|
310
|
+
// 3. Verify it's executable
|
|
311
|
+
try {
|
|
312
|
+
fs.accessSync(helperPath, fs.constants.X_OK);
|
|
313
|
+
}
|
|
314
|
+
catch {
|
|
315
|
+
// On Windows, this might fail but the script should still work
|
|
316
|
+
}
|
|
317
|
+
// 4. Configure git to use the credential helper
|
|
318
|
+
// Check if already configured (use --get-all to check all helpers in chain)
|
|
319
|
+
try {
|
|
320
|
+
const allHelpers = (0, child_process_1.execSync)('git config --global --get-all credential.helper', {
|
|
321
|
+
encoding: 'utf8',
|
|
322
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
323
|
+
}).trim().split('\n');
|
|
324
|
+
// If this exact helper path is already configured, we're done
|
|
325
|
+
// This prevents duplicate entries if user runs `episoda auth` multiple times
|
|
326
|
+
if (allHelpers.some(h => h.includes(helperPath) || h.includes('git-credential-episoda'))) {
|
|
327
|
+
return true;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
catch {
|
|
331
|
+
// No credential helper configured yet, that's fine
|
|
332
|
+
}
|
|
333
|
+
// Add episoda credential helper to the chain
|
|
334
|
+
// Using --add ensures we don't overwrite existing helpers
|
|
335
|
+
(0, child_process_1.execSync)(`git config --global --add credential.helper "${helperPath}"`, {
|
|
336
|
+
encoding: 'utf8',
|
|
337
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
338
|
+
});
|
|
339
|
+
// 5. Add to PATH by updating shell profile if needed
|
|
340
|
+
updateShellProfile(episodaBinDir);
|
|
341
|
+
return true;
|
|
342
|
+
}
|
|
343
|
+
catch (error) {
|
|
344
|
+
// Log error but don't fail the auth flow
|
|
345
|
+
output_1.status.warning(`Could not install credential helper: ${error.message}`);
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Update shell profile to include ~/.episoda/bin in PATH
|
|
351
|
+
*/
|
|
352
|
+
function updateShellProfile(binDir) {
|
|
353
|
+
const platform = os.platform();
|
|
354
|
+
if (platform === 'win32') {
|
|
355
|
+
// Windows uses a different mechanism (system PATH)
|
|
356
|
+
// Skip for now - the full path in git config should work
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
// For Unix-like systems, check common shell profiles
|
|
360
|
+
const homeDir = os.homedir();
|
|
361
|
+
const profiles = [
|
|
362
|
+
path.join(homeDir, '.bashrc'),
|
|
363
|
+
path.join(homeDir, '.zshrc'),
|
|
364
|
+
path.join(homeDir, '.profile'),
|
|
365
|
+
];
|
|
366
|
+
const exportLine = `export PATH="${binDir}:$PATH" # Added by episoda auth`;
|
|
367
|
+
for (const profile of profiles) {
|
|
368
|
+
try {
|
|
369
|
+
if (fs.existsSync(profile)) {
|
|
370
|
+
const content = fs.readFileSync(profile, 'utf8');
|
|
371
|
+
// Check if already added
|
|
372
|
+
if (content.includes('.episoda/bin')) {
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
// Append export line
|
|
376
|
+
fs.appendFileSync(profile, `\n# Episoda CLI\n${exportLine}\n`);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
catch {
|
|
380
|
+
// Ignore errors - PATH update is optional
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CH,kCA6EC;AAvHD,uCAAwB;AACxB,uCAAwB;AACxB,2CAA4B;AAC5B,iDAA+C;AAC/C,kCAA4D;AAC5D,sCAAkC;AAClC,qDAAmD;AACnD,gFAAqF;AAgCrF;;GAEG;AACI,KAAK,UAAU,WAAW,CAAC,UAA8B,EAAE;IAChE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,qBAAqB,CAAA;IAErF,eAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAA;IAC1C,eAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAEf,+BAA+B;IAC/B,eAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAA;IACzD,MAAM,UAAU,GAAG,MAAM,kBAAkB,CAAC,MAAM,CAAC,CAAA;IAEnD,eAAM,CAAC,OAAO,CAAC,kCAAkC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAA;IACxE,eAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAEf,qDAAqD;IACrD,eAAM,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAA;IAC7D,eAAM,CAAC,IAAI,CAAC,YAAY,UAAU,CAAC,yBAAyB,EAAE,CAAC,CAAA;IAC/D,eAAM,CAAC,IAAI,CAAC,gBAAgB,UAAU,CAAC,SAAS,EAAE,CAA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ED,MAAM,UAAU,GAAG,gBAAgB,MAAM,kCAAkC,CAAA;IAE3E,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC;YACH,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC3B,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;gBAEhD,yBAAyB;gBACzB,IAAI,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;oBACrC,SAAQ;gBACV,CAAC;gBAED,qBAAqB;gBACrB,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,oBAAoB,UAAU,IAAI,CAAC,CAAA;YAChE,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,0CAA0C;QAC5C,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `episoda dev` command
|
|
3
|
+
*
|
|
4
|
+
* K722 Architecture:
|
|
5
|
+
* - Ensures daemon is running
|
|
6
|
+
* - Adds project to daemon for WebSocket connection
|
|
7
|
+
* - Optionally wraps user's dev server command
|
|
8
|
+
* - Daemon handles WebSocket persistence across terminal sessions
|
|
9
|
+
*/
|
|
10
|
+
export interface DevCommandOptions {
|
|
11
|
+
command?: string[];
|
|
12
|
+
autoRestart?: boolean;
|
|
13
|
+
cwd?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Execute the `episoda dev` command
|
|
17
|
+
* @param options - Command options
|
|
18
|
+
*/
|
|
19
|
+
export declare function devCommand(options?: DevCommandOptions): Promise<void>;
|
|
20
|
+
//# sourceMappingURL=dev.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA+BH,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuL/E"}
|