@profoundlogic/coderflow-cli 0.12.42 → 0.12.44
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/lib/commands/profile.js +1 -53
- package/lib/help.js +0 -2
- package/lib/profile.js +0 -21
- package/package.json +1 -1
package/lib/commands/profile.js
CHANGED
|
@@ -17,9 +17,7 @@ import {
|
|
|
17
17
|
profileExists,
|
|
18
18
|
isValidProfileName,
|
|
19
19
|
getProfileConfigKeys,
|
|
20
|
-
|
|
21
|
-
getProfilePath,
|
|
22
|
-
loadMainConfig
|
|
20
|
+
getProfilePath
|
|
23
21
|
} from '../profile.js';
|
|
24
22
|
import { invalidateConfigCache } from '../config.js';
|
|
25
23
|
|
|
@@ -87,10 +85,6 @@ export async function handleProfile(args) {
|
|
|
87
85
|
await showCurrentProfile();
|
|
88
86
|
break;
|
|
89
87
|
|
|
90
|
-
case 'migrate':
|
|
91
|
-
await migrateToProfile(args[1]);
|
|
92
|
-
break;
|
|
93
|
-
|
|
94
88
|
default:
|
|
95
89
|
console.error(`Unknown subcommand: ${subcommand}`);
|
|
96
90
|
showProfileHelp();
|
|
@@ -116,7 +110,6 @@ Commands:
|
|
|
116
110
|
set <key> <value> Set a value in the active profile
|
|
117
111
|
get <key> Get a value from the active profile
|
|
118
112
|
current Show the current active profile name
|
|
119
|
-
migrate <name> Create profile from current legacy config
|
|
120
113
|
|
|
121
114
|
Profile Keys:
|
|
122
115
|
server Server URL (e.g., http://localhost:3000)
|
|
@@ -151,9 +144,6 @@ async function listProfilesCommand() {
|
|
|
151
144
|
console.log('');
|
|
152
145
|
console.log('Create one with:');
|
|
153
146
|
console.log(' coder profile create <name>');
|
|
154
|
-
console.log('');
|
|
155
|
-
console.log('Or migrate your current config:');
|
|
156
|
-
console.log(' coder profile migrate default');
|
|
157
147
|
return;
|
|
158
148
|
}
|
|
159
149
|
|
|
@@ -482,48 +472,6 @@ async function showCurrentProfile() {
|
|
|
482
472
|
}
|
|
483
473
|
}
|
|
484
474
|
|
|
485
|
-
async function migrateToProfile(profileName) {
|
|
486
|
-
if (!profileName) {
|
|
487
|
-
console.error('Usage: coder profile migrate <name>');
|
|
488
|
-
console.error('');
|
|
489
|
-
console.error('This will create a new profile from your current legacy config.');
|
|
490
|
-
process.exit(1);
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
if (!isValidProfileName(profileName)) {
|
|
494
|
-
console.error(`Invalid profile name: ${profileName}`);
|
|
495
|
-
process.exit(1);
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
if (await profileExists(profileName)) {
|
|
499
|
-
console.error(`Profile '${profileName}' already exists.`);
|
|
500
|
-
process.exit(1);
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
const result = await createProfileFromLegacyConfig(profileName);
|
|
504
|
-
if (!result) {
|
|
505
|
-
console.log('No legacy configuration found to migrate.');
|
|
506
|
-
console.log('');
|
|
507
|
-
console.log('Create a new profile with:');
|
|
508
|
-
console.log(` coder profile create ${profileName}`);
|
|
509
|
-
return;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
console.log(`Created profile '${profileName}' from legacy config.`);
|
|
513
|
-
console.log('');
|
|
514
|
-
console.log('Migrated settings:');
|
|
515
|
-
for (const [key, value] of Object.entries(result)) {
|
|
516
|
-
if (key !== 'name') {
|
|
517
|
-
const displayValue = key === 'apiKey' ? maskApiKey(value) : value;
|
|
518
|
-
console.log(` ${key}: ${displayValue}`);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
console.log('');
|
|
523
|
-
console.log('To use this profile:');
|
|
524
|
-
console.log(` coder profile switch ${profileName}`);
|
|
525
|
-
}
|
|
526
|
-
|
|
527
475
|
async function promptConfirmation(message) {
|
|
528
476
|
const rl = readline.createInterface({
|
|
529
477
|
input: process.stdin,
|
package/lib/help.js
CHANGED
|
@@ -110,7 +110,6 @@ Commands:
|
|
|
110
110
|
set <key> <value> Set a value in the active profile
|
|
111
111
|
get <key> Get a value from the active profile
|
|
112
112
|
current Show the current active profile name
|
|
113
|
-
migrate <name> Create profile from legacy config
|
|
114
113
|
|
|
115
114
|
Examples:
|
|
116
115
|
coder profile list
|
|
@@ -400,7 +399,6 @@ PROFILE COMMANDS
|
|
|
400
399
|
coder profile set <key> <value> Set a value in the active profile
|
|
401
400
|
coder profile get <key> Get a value from the active profile
|
|
402
401
|
coder profile current Show the current active profile name
|
|
403
|
-
coder profile migrate <name> Create profile from legacy config
|
|
404
402
|
|
|
405
403
|
================================================================================
|
|
406
404
|
ENVIRONMENT VARIABLES
|
package/lib/profile.js
CHANGED
|
@@ -259,27 +259,6 @@ export async function getEffectiveConfig(cliProfileOverride = null) {
|
|
|
259
259
|
return config;
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
/**
|
|
263
|
-
* Create a profile from the current legacy config (migration helper)
|
|
264
|
-
*/
|
|
265
|
-
export async function createProfileFromLegacyConfig(profileName) {
|
|
266
|
-
const mainConfig = await loadMainConfig();
|
|
267
|
-
if (!mainConfig) {
|
|
268
|
-
return null;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
const profileData = { name: profileName };
|
|
272
|
-
|
|
273
|
-
for (const key of PROFILE_CONFIG_KEYS) {
|
|
274
|
-
if (mainConfig[key] !== undefined) {
|
|
275
|
-
profileData[key] = mainConfig[key];
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
await saveProfile(profileName, profileData);
|
|
280
|
-
return profileData;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
262
|
/**
|
|
284
263
|
* Validate profile name
|
|
285
264
|
*/
|