@leynier/ccst 0.3.0 → 0.3.2
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/package.json +1 -1
- package/src/core/context-manager.ts +1 -1
- package/src/index.ts +2 -0
- package/src/utils/ccs-paths.ts +8 -8
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import { Command } from "commander";
|
|
3
|
+
import pkg from "../package.json";
|
|
3
4
|
import { completionsCommand } from "./commands/completions.js";
|
|
4
5
|
import { configDumpCommand } from "./commands/config/dump.js";
|
|
5
6
|
import { configLoadCommand } from "./commands/config/load.js";
|
|
@@ -30,6 +31,7 @@ const main = async (): Promise<void> => {
|
|
|
30
31
|
program
|
|
31
32
|
.name("ccst")
|
|
32
33
|
.description("Claude Code Switch Tools")
|
|
34
|
+
.version(pkg.version)
|
|
33
35
|
.argument("[context]", "context name")
|
|
34
36
|
.option("-d, --delete", "delete context")
|
|
35
37
|
.option("-c, --current", "print current context")
|
package/src/utils/ccs-paths.ts
CHANGED
|
@@ -7,7 +7,7 @@ export const getCcsHome = (): string => join(homedir(), ".ccs");
|
|
|
7
7
|
|
|
8
8
|
// File patterns to backup
|
|
9
9
|
export type CcsBackupFiles = {
|
|
10
|
-
|
|
10
|
+
config: string | null;
|
|
11
11
|
settingsProfiles: string[];
|
|
12
12
|
cliproxyAccounts: string | null;
|
|
13
13
|
cliproxyConfig: string | null;
|
|
@@ -27,7 +27,7 @@ const safeReaddirSync = (dirPath: string): string[] => {
|
|
|
27
27
|
export const getCcsBackupFiles = (): CcsBackupFiles => {
|
|
28
28
|
const ccsHome = getCcsHome();
|
|
29
29
|
const result: CcsBackupFiles = {
|
|
30
|
-
|
|
30
|
+
config: null,
|
|
31
31
|
settingsProfiles: [],
|
|
32
32
|
cliproxyAccounts: null,
|
|
33
33
|
cliproxyConfig: null,
|
|
@@ -37,9 +37,9 @@ export const getCcsBackupFiles = (): CcsBackupFiles => {
|
|
|
37
37
|
return result;
|
|
38
38
|
}
|
|
39
39
|
// config.yaml
|
|
40
|
-
const
|
|
41
|
-
if (existsSync(
|
|
42
|
-
result.
|
|
40
|
+
const configPath = join(ccsHome, "config.yaml");
|
|
41
|
+
if (existsSync(configPath)) {
|
|
42
|
+
result.config = configPath;
|
|
43
43
|
}
|
|
44
44
|
// *.settings.json profiles
|
|
45
45
|
const rootFiles = safeReaddirSync(ccsHome);
|
|
@@ -55,7 +55,7 @@ export const getCcsBackupFiles = (): CcsBackupFiles => {
|
|
|
55
55
|
if (existsSync(accountsPath)) {
|
|
56
56
|
result.cliproxyAccounts = accountsPath;
|
|
57
57
|
}
|
|
58
|
-
const configPath = join(cliproxyDir, "config.
|
|
58
|
+
const configPath = join(cliproxyDir, "config.yaml");
|
|
59
59
|
if (existsSync(configPath)) {
|
|
60
60
|
result.cliproxyConfig = configPath;
|
|
61
61
|
}
|
|
@@ -93,8 +93,8 @@ export const ensureDirectoryExists = (filePath: string): void => {
|
|
|
93
93
|
export const getAllBackupFilePaths = (): string[] => {
|
|
94
94
|
const files = getCcsBackupFiles();
|
|
95
95
|
const paths: string[] = [];
|
|
96
|
-
if (files.
|
|
97
|
-
paths.push(files.
|
|
96
|
+
if (files.config) {
|
|
97
|
+
paths.push(files.config);
|
|
98
98
|
}
|
|
99
99
|
paths.push(...files.settingsProfiles);
|
|
100
100
|
if (files.cliproxyAccounts) {
|