xclaude-launcher 0.1.0 → 0.1.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.
- package/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/dist/adapters/file-config-repo.js +28 -8
- package/dist/index.js +1 -1
- package/dist/utils/paths.js +7 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# xClaude Launcher
|
|
2
2
|
|
|
3
3
|
[English](./README.md) | [中文](./README.zh-CN.md)
|
|
4
4
|
|
|
@@ -77,7 +77,7 @@ xclaude config path
|
|
|
77
77
|
Profiles are stored in:
|
|
78
78
|
|
|
79
79
|
```text
|
|
80
|
-
~/.
|
|
80
|
+
~/.xclaude-launcher/config.json
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
## Built-in environment variables
|
|
@@ -104,5 +104,5 @@ npm run start -- --help
|
|
|
104
104
|
|
|
105
105
|
## Links
|
|
106
106
|
|
|
107
|
-
- Repository: https://github.com/
|
|
108
|
-
- Issues: https://github.com/
|
|
107
|
+
- Repository: https://github.com/Jango26/xclaude-launcher
|
|
108
|
+
- Issues: https://github.com/Jango26/xclaude-launcher/issues
|
package/README.zh-CN.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# xClaude Launcher
|
|
2
2
|
|
|
3
3
|
[English](./README.md) | [中文](./README.zh-CN.md)
|
|
4
4
|
|
|
@@ -86,7 +86,7 @@ xclaude config path
|
|
|
86
86
|
profile 保存在:
|
|
87
87
|
|
|
88
88
|
```text
|
|
89
|
-
~/.
|
|
89
|
+
~/.xclaude-launcher/config.json
|
|
90
90
|
```
|
|
91
91
|
|
|
92
92
|
## 内置支持的环境变量
|
|
@@ -113,5 +113,5 @@ npm run start -- --help
|
|
|
113
113
|
|
|
114
114
|
## 链接
|
|
115
115
|
|
|
116
|
-
- Repository: https://github.com/
|
|
117
|
-
- Issues: https://github.com/
|
|
116
|
+
- Repository: https://github.com/Jango26/xclaude-launcher
|
|
117
|
+
- Issues: https://github.com/Jango26/xclaude-launcher/issues
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { CliError } from '../utils/errors.js';
|
|
3
|
-
import { getConfigDir, getConfigPath } from '../utils/paths.js';
|
|
3
|
+
import { getConfigDir, getConfigPath, getLegacyConfigPath } from '../utils/paths.js';
|
|
4
4
|
const DEFAULT_CONFIG = {
|
|
5
5
|
version: 1,
|
|
6
6
|
profiles: [],
|
|
@@ -10,22 +10,42 @@ export class FileConfigRepository {
|
|
|
10
10
|
const filePath = getConfigPath();
|
|
11
11
|
try {
|
|
12
12
|
const content = await readFile(filePath, 'utf8');
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
13
|
+
return this.parseConfig(content, filePath);
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
if (error.code !== 'ENOENT') {
|
|
17
|
+
throw new CliError(`Failed to read config: ${filePath}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const legacyFilePath = getLegacyConfigPath();
|
|
21
|
+
try {
|
|
22
|
+
const legacyContent = await readFile(legacyFilePath, 'utf8');
|
|
23
|
+
const config = this.parseConfig(legacyContent, legacyFilePath);
|
|
24
|
+
await this.save(config);
|
|
25
|
+
return config;
|
|
19
26
|
}
|
|
20
27
|
catch (error) {
|
|
21
28
|
if (error.code === 'ENOENT') {
|
|
22
29
|
return structuredClone(DEFAULT_CONFIG);
|
|
23
30
|
}
|
|
24
|
-
throw new CliError(`Failed to read config: ${
|
|
31
|
+
throw new CliError(`Failed to read config: ${legacyFilePath}`);
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
34
|
async save(config) {
|
|
28
35
|
await mkdir(getConfigDir(), { recursive: true });
|
|
29
36
|
await writeFile(getConfigPath(), `${JSON.stringify(config, null, 2)}\n`, 'utf8');
|
|
30
37
|
}
|
|
38
|
+
parseConfig(content, filePath) {
|
|
39
|
+
try {
|
|
40
|
+
const parsed = JSON.parse(content);
|
|
41
|
+
return {
|
|
42
|
+
version: parsed.version ?? 1,
|
|
43
|
+
profiles: parsed.profiles ?? [],
|
|
44
|
+
lastUsedProfileId: parsed.lastUsedProfileId,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
throw new CliError(`Failed to read config: ${filePath}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
31
51
|
}
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ function parseRunClaudeOptions(args) {
|
|
|
41
41
|
return options;
|
|
42
42
|
}
|
|
43
43
|
function printHelp() {
|
|
44
|
-
console.log(`xclaude -
|
|
44
|
+
console.log(`xclaude - xClaude Launcher\n\nUsage:\n xclaude [claude args...]\n xclaude config [list|add|edit]\n`);
|
|
45
45
|
}
|
|
46
46
|
main().catch((error) => {
|
|
47
47
|
const message = error instanceof Error ? error.message : 'Unknown error';
|
package/dist/utils/paths.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import os from 'node:os';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
export function
|
|
3
|
+
export function getLegacyConfigDir() {
|
|
4
4
|
return path.join(os.homedir(), '.claude-launcher');
|
|
5
5
|
}
|
|
6
|
+
export function getLegacyConfigPath() {
|
|
7
|
+
return path.join(getLegacyConfigDir(), 'config.json');
|
|
8
|
+
}
|
|
9
|
+
export function getConfigDir() {
|
|
10
|
+
return path.join(os.homedir(), '.xclaude-launcher');
|
|
11
|
+
}
|
|
6
12
|
export function getConfigPath() {
|
|
7
13
|
return path.join(getConfigDir(), 'config.json');
|
|
8
14
|
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xclaude-launcher",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Launch Claude Code with reusable environment profiles.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/Jango26/
|
|
8
|
+
"url": "https://github.com/Jango26/xclaude-launcher.git"
|
|
9
9
|
},
|
|
10
|
-
"homepage": "https://github.com/Jango26/
|
|
10
|
+
"homepage": "https://github.com/Jango26/xclaude-launcher",
|
|
11
11
|
"bugs": {
|
|
12
|
-
"url": "https://github.com/Jango26/
|
|
12
|
+
"url": "https://github.com/Jango26/xclaude-launcher/issues"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
15
|
"claude",
|