xclaude-launcher 0.1.1 → 0.1.3
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 +5 -2
- package/README.zh-CN.md +5 -2
- package/dist/commands/config.js +29 -19
- package/dist/services/prompt-service.js +17 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,7 +62,6 @@ If you have not created any profiles yet, start with `xclaude config add`.
|
|
|
62
62
|
```bash
|
|
63
63
|
xclaude
|
|
64
64
|
xclaude --profile my-profile
|
|
65
|
-
xclaude --list
|
|
66
65
|
xclaude config
|
|
67
66
|
xclaude config path
|
|
68
67
|
```
|
|
@@ -70,7 +69,11 @@ xclaude config path
|
|
|
70
69
|
## What it does
|
|
71
70
|
|
|
72
71
|
- `xclaude` opens an interactive profile picker and launches `claude` with the selected profile environment.
|
|
73
|
-
- `xclaude config` opens the interactive profile manager.
|
|
72
|
+
- `xclaude config` opens the interactive profile manager. The top-level menu provides:
|
|
73
|
+
- `List profiles` — pick a profile and then choose `View` / `Edit` / `Remove`. `View` prints the profile's environment variables one entry per block (key on one line, value on the next) so it stays readable on narrow terminals.
|
|
74
|
+
- `Add profile` — create a new profile.
|
|
75
|
+
- `Edit profile` — pick a profile and edit it directly.
|
|
76
|
+
- `Show config path` — print the absolute path of the config file.
|
|
74
77
|
|
|
75
78
|
## Config file
|
|
76
79
|
|
package/README.zh-CN.md
CHANGED
|
@@ -71,7 +71,6 @@ xclaude config add
|
|
|
71
71
|
```bash
|
|
72
72
|
xclaude
|
|
73
73
|
xclaude --profile my-profile
|
|
74
|
-
xclaude --list
|
|
75
74
|
xclaude config
|
|
76
75
|
xclaude config path
|
|
77
76
|
```
|
|
@@ -79,7 +78,11 @@ xclaude config path
|
|
|
79
78
|
## 这个工具会做什么
|
|
80
79
|
|
|
81
80
|
- `xclaude` 会打开一个交互式 profile 选择器,并使用所选 profile 的环境变量启动 `claude`
|
|
82
|
-
- `xclaude config` 会打开交互式 profile
|
|
81
|
+
- `xclaude config` 会打开交互式 profile 管理界面,顶层菜单包含:
|
|
82
|
+
- `List profiles`:选择一个 profile 后再选 `View` / `Edit` / `Remove`。`View` 会把该 profile 的环境变量逐项打印,每个变量 key 一行、value 在下一行缩进显示,窄终端也不会被折断。
|
|
83
|
+
- `Add profile`:新增一个 profile
|
|
84
|
+
- `Edit profile`:直接选一个 profile 进行编辑
|
|
85
|
+
- `Show config path`:打印配置文件的绝对路径
|
|
83
86
|
|
|
84
87
|
## 配置文件位置
|
|
85
88
|
|
package/dist/commands/config.js
CHANGED
|
@@ -18,8 +18,8 @@ export async function runConfigCommand(action) {
|
|
|
18
18
|
if (nextAction === 'list') {
|
|
19
19
|
while (true) {
|
|
20
20
|
const config = await configService.getConfig();
|
|
21
|
-
promptService.printProfiles(config.profiles, config.lastUsedProfileId);
|
|
22
21
|
if (config.profiles.length === 0) {
|
|
22
|
+
console.log('No profiles');
|
|
23
23
|
break;
|
|
24
24
|
}
|
|
25
25
|
const profile = await promptService.chooseProfileOrBackOrExit(config.profiles, config.lastUsedProfileId);
|
|
@@ -29,28 +29,38 @@ export async function runConfigCommand(action) {
|
|
|
29
29
|
if (profile === 'back') {
|
|
30
30
|
break;
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (profileAction === 'back') {
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
if (profileAction === 'edit') {
|
|
40
|
-
const input = await promptService.promptProfileInput(profile);
|
|
41
|
-
if (input === 'exit') {
|
|
32
|
+
let backToProfiles = false;
|
|
33
|
+
while (!backToProfiles) {
|
|
34
|
+
const profileAction = await promptService.chooseProfileAction();
|
|
35
|
+
if (profileAction === 'exit') {
|
|
42
36
|
return 0;
|
|
43
37
|
}
|
|
44
|
-
if (
|
|
38
|
+
if (profileAction === 'back') {
|
|
39
|
+
backToProfiles = true;
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
if (profileAction === 'view') {
|
|
43
|
+
promptService.printProfileEnv(profile);
|
|
45
44
|
continue;
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
if (profileAction === 'edit') {
|
|
47
|
+
const input = await promptService.promptProfileInput(profile);
|
|
48
|
+
if (input === 'exit') {
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
if (input === 'back') {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const updated = await configService.updateProfile(profile.id, input);
|
|
55
|
+
console.log(`Updated profile: ${updated.name}`);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (await promptService.confirmRemoveProfile(profile)) {
|
|
59
|
+
const removed = await configService.removeProfile(profile.id);
|
|
60
|
+
console.log(`Removed profile: ${removed.name}`);
|
|
61
|
+
backToProfiles = true;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
54
64
|
}
|
|
55
65
|
}
|
|
56
66
|
continue;
|
|
@@ -11,7 +11,6 @@ export class PromptService {
|
|
|
11
11
|
choices: profiles.map((profile) => ({
|
|
12
12
|
name: this.formatProfileLabel(profile, lastUsedProfileId),
|
|
13
13
|
value: profile.id,
|
|
14
|
-
description: this.describeProfile(profile),
|
|
15
14
|
})),
|
|
16
15
|
});
|
|
17
16
|
const profile = profiles.find((item) => item.id === answer);
|
|
@@ -80,7 +79,6 @@ export class PromptService {
|
|
|
80
79
|
...profiles.map((profile) => ({
|
|
81
80
|
name: this.formatProfileLabel(profile, lastUsedProfileId),
|
|
82
81
|
value: profile.id,
|
|
83
|
-
description: this.describeProfile(profile),
|
|
84
82
|
})),
|
|
85
83
|
{
|
|
86
84
|
name: 'Back',
|
|
@@ -106,6 +104,7 @@ export class PromptService {
|
|
|
106
104
|
return select({
|
|
107
105
|
message: 'Choose an action',
|
|
108
106
|
choices: [
|
|
107
|
+
{ name: 'View', value: 'view' },
|
|
109
108
|
{ name: 'Edit', value: 'edit' },
|
|
110
109
|
{ name: 'Remove', value: 'remove' },
|
|
111
110
|
{ name: 'Back', value: 'back' },
|
|
@@ -113,6 +112,22 @@ export class PromptService {
|
|
|
113
112
|
],
|
|
114
113
|
});
|
|
115
114
|
}
|
|
115
|
+
printProfileEnv(profile) {
|
|
116
|
+
const entries = Object.entries(profile.env);
|
|
117
|
+
console.log('');
|
|
118
|
+
console.log(`Profile: ${profile.name} (${profile.id})`);
|
|
119
|
+
console.log('');
|
|
120
|
+
if (entries.length === 0) {
|
|
121
|
+
console.log(' (no env)');
|
|
122
|
+
console.log('');
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
for (const [key, value] of entries) {
|
|
126
|
+
console.log(` ${key}`);
|
|
127
|
+
console.log(` ${value}`);
|
|
128
|
+
console.log('');
|
|
129
|
+
}
|
|
130
|
+
}
|
|
116
131
|
async confirmRemoveProfile(profile) {
|
|
117
132
|
return confirm({
|
|
118
133
|
message: `Remove profile ${profile.name}?`,
|