xling 0.7.0 → 0.7.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/dist/{base-ZLSUOdyk.d.ts → base-BxGCoslm.d.ts} +2 -2
- package/dist/base-CSwZL00J.js +1 -30
- package/dist/{base-B5MGQGLN.d.ts → base-D1BJt9i-.d.ts} +3 -2
- package/dist/base-DtcPVpvU.js +1 -68
- package/dist/claude-C6lOG2Mk.js +1 -206
- package/dist/claude-lgXq7-0w.js +1 -0
- package/dist/claudeDefault-ewrEKzlX.js +1 -18
- package/dist/client-DTC49Rug.js +1 -88
- package/dist/codex-Dl7Rx7Nr.js +1 -83
- package/dist/codex-sOnl7pFp.js +1 -0
- package/dist/commands/git/index.js +5 -35
- package/dist/commands/git/prc.js +2 -121
- package/dist/commands/git/prr.js +2 -80
- package/dist/commands/git/prv.js +2 -70
- package/dist/commands/git/worktree.js +3 -135
- package/dist/commands/git/wta.js +3 -78
- package/dist/commands/git/wtl.js +3 -42
- package/dist/commands/git/wtp.js +3 -42
- package/dist/commands/git/wtr.js +3 -77
- package/dist/commands/git/wts.js +2 -99
- package/dist/commands/p/index.js +15 -380
- package/dist/commands/settings/get.js +2 -119
- package/dist/commands/settings/inspect.js +3 -85
- package/dist/commands/settings/list.js +6 -151
- package/dist/commands/settings/set.js +2 -87
- package/dist/commands/settings/switch.js +4 -165
- package/dist/commands/sx/index.js +12 -93
- package/dist/commands/version/index.js +1 -22
- package/dist/commands/x/index.js +4 -104
- package/dist/config-JHw2hqMN.js +1 -141
- package/dist/create-CKUHliul.js +1 -95
- package/dist/dispatcher-5y9x6plQ.js +1 -0
- package/dist/dispatcher-BYazaYbC.js +1 -75
- package/dist/dispatcher-D4bEJonH.js +1 -30
- package/dist/domain/git.js +1 -3
- package/dist/domain/interfaces.d.ts +2 -2
- package/dist/domain/interfaces.js +1 -1
- package/dist/domain/types.d.ts +1 -1
- package/dist/domain/types.js +1 -1
- package/dist/domain/validators.d.ts +1 -1
- package/dist/domain/validators.js +1 -57
- package/dist/domain/xling/config.js +1 -3
- package/dist/domain/xling/template.js +1 -3
- package/dist/editor-CUiekAEb.js +1 -31
- package/dist/errors-pXKbCKbL.js +1 -115
- package/dist/format-a_tYXjv9.js +4 -229
- package/dist/fsStore-S8RslR8L.js +1 -122
- package/dist/gemini-DQoPiuiw.js +1 -49
- package/dist/git-BZvqM5hz.js +1 -12
- package/dist/{interfaces-Cy1OFHgI.d.ts → interfaces-D5gBXflS.d.ts} +2 -1
- package/dist/pr-DjdO-vJk.js +1 -61
- package/dist/providerRegistry-Cljln1eo.js +1 -151
- package/dist/router-DX-dIEei.js +1 -177
- package/dist/run.js +1 -13
- package/dist/runner-Bi5mGd-w.js +1 -203
- package/dist/runner-DYk4q6mP.js +1 -145
- package/dist/services/git/create.js +1 -6
- package/dist/services/git/dispatcher.js +1 -10
- package/dist/services/git/pr.js +1 -6
- package/dist/services/git/utils.js +1 -5
- package/dist/services/git/view.js +1 -6
- package/dist/services/git/worktree.js +1 -5
- package/dist/services/launch/adapters/base.d.ts +3 -3
- package/dist/services/launch/adapters/base.js +1 -4
- package/dist/services/launch/adapters/claude.d.ts +6 -3
- package/dist/services/launch/adapters/claude.js +1 -5
- package/dist/services/launch/adapters/codex.d.ts +6 -3
- package/dist/services/launch/adapters/codex.js +1 -5
- package/dist/services/launch/dispatcher.d.ts +2 -2
- package/dist/services/launch/dispatcher.js +1 -8
- package/dist/services/prompt/client.js +1 -3
- package/dist/services/prompt/providerRegistry.js +1 -10
- package/dist/services/prompt/router.js +1 -13
- package/dist/services/prompt/types.js +1 -3
- package/dist/services/settings/adapters/base.d.ts +3 -3
- package/dist/services/settings/adapters/base.js +1 -5
- package/dist/services/settings/adapters/claude.d.ts +3 -3
- package/dist/services/settings/adapters/claude.js +1 -9
- package/dist/services/settings/adapters/codex.d.ts +3 -3
- package/dist/services/settings/adapters/codex.js +1 -6
- package/dist/services/settings/adapters/gemini.d.ts +3 -3
- package/dist/services/settings/adapters/gemini.js +1 -6
- package/dist/services/settings/adapters/xling.d.ts +3 -3
- package/dist/services/settings/adapters/xling.js +1 -9
- package/dist/services/settings/dispatcher.d.ts +2 -2
- package/dist/services/settings/dispatcher.js +1 -15
- package/dist/services/settings/fsStore.d.ts +1 -1
- package/dist/services/settings/fsStore.js +1 -4
- package/dist/services/settings/templates/claudeDefault.d.ts +1 -1
- package/dist/services/settings/templates/claudeDefault.js +1 -3
- package/dist/services/shortcuts/runner.js +1 -11
- package/dist/services/shortcuts/types.js +1 -3
- package/dist/template-B19CdPfg.js +1 -164
- package/dist/types-99-EmVXg.js +2 -25
- package/dist/types-DblJSHMa.js +1 -23
- package/dist/{types-5rST51Xi.d.ts → types-RoapPbyI.d.ts} +1 -0
- package/dist/utils/editor.js +1 -4
- package/dist/utils/errors.js +1 -3
- package/dist/utils/format.d.ts +1 -1
- package/dist/utils/format.js +1 -3
- package/dist/utils/logger.js +1 -42
- package/dist/utils/runner.d.ts +1 -1
- package/dist/utils/runner.js +1 -3
- package/dist/utils-DDnNMPIq.js +1 -35
- package/dist/view-JZaEEspp.js +1 -84
- package/dist/worktree-BuIXmI0X.js +3 -205
- package/dist/xling-BxVsmPja.js +1 -254
- package/package.json +1 -1
- package/dist/claude-YXQbPr5h.js +0 -29
- package/dist/codex-UE8EaZGt.js +0 -30
- package/dist/dispatcher-BCISF-Uw.js +0 -87
|
@@ -1,121 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "../../editor-CUiekAEb.js";
|
|
3
|
-
import { r as formatJson } from "../../format-a_tYXjv9.js";
|
|
4
|
-
import { s as resolveHome } from "../../fsStore-S8RslR8L.js";
|
|
5
|
-
import "../../base-DtcPVpvU.js";
|
|
6
|
-
import "../../config-JHw2hqMN.js";
|
|
7
|
-
import "../../template-B19CdPfg.js";
|
|
8
|
-
import "../../xling-BxVsmPja.js";
|
|
9
|
-
import "../../claudeDefault-ewrEKzlX.js";
|
|
10
|
-
import { t as ClaudeAdapter } from "../../claude-C6lOG2Mk.js";
|
|
11
|
-
import "../../codex-Dl7Rx7Nr.js";
|
|
12
|
-
import "../../gemini-DQoPiuiw.js";
|
|
13
|
-
import { t as SettingsDispatcher } from "../../dispatcher-BYazaYbC.js";
|
|
14
|
-
import { Args, Command, Flags } from "@oclif/core";
|
|
15
|
-
import path from "node:path";
|
|
16
|
-
import fs from "node:fs";
|
|
17
|
-
|
|
18
|
-
//#region src/commands/settings/get.ts
|
|
19
|
-
/**
|
|
20
|
-
* settings:get command
|
|
21
|
-
* Retrieve the selected configuration file
|
|
22
|
-
*/
|
|
23
|
-
var SettingsGet = class SettingsGet extends Command {
|
|
24
|
-
static summary = "View the full configuration file";
|
|
25
|
-
static description = `
|
|
1
|
+
import"../../errors-pXKbCKbL.js";import"../../editor-CUiekAEb.js";import{r as e}from"../../format-a_tYXjv9.js";import{s as t}from"../../fsStore-S8RslR8L.js";import"../../base-DtcPVpvU.js";import"../../config-JHw2hqMN.js";import"../../template-B19CdPfg.js";import"../../xling-BxVsmPja.js";import"../../claudeDefault-ewrEKzlX.js";import{t as n}from"../../claude-C6lOG2Mk.js";import"../../codex-Dl7Rx7Nr.js";import"../../gemini-DQoPiuiw.js";import{t as r}from"../../dispatcher-BYazaYbC.js";import{Args as i,Command as a,Flags as o}from"@oclif/core";import s from"node:path";import c from"node:fs";var l=class l extends a{static summary=`View the full configuration file`;static description=`
|
|
26
2
|
Print the entire configuration file for the selected tool/scope.
|
|
27
3
|
Use --json for structured output or --no-json for plain text.
|
|
28
|
-
`;
|
|
29
|
-
static examples = ["<%= config.bin %> <%= command.id %> --tool claude --scope user", "<%= config.bin %> <%= command.id %> --tool codex --no-json"];
|
|
30
|
-
static args = { name: Args.string({
|
|
31
|
-
description: "Claude variant name (optional). Example: settings:get hxi",
|
|
32
|
-
required: false
|
|
33
|
-
}) };
|
|
34
|
-
static flags = {
|
|
35
|
-
tool: Flags.string({
|
|
36
|
-
char: "t",
|
|
37
|
-
description: "AI CLI tool to manage",
|
|
38
|
-
options: [
|
|
39
|
-
"claude",
|
|
40
|
-
"codex",
|
|
41
|
-
"gemini",
|
|
42
|
-
"xling"
|
|
43
|
-
],
|
|
44
|
-
default: "claude"
|
|
45
|
-
}),
|
|
46
|
-
scope: Flags.string({
|
|
47
|
-
char: "s",
|
|
48
|
-
description: "Configuration scope",
|
|
49
|
-
options: [
|
|
50
|
-
"user",
|
|
51
|
-
"project",
|
|
52
|
-
"local",
|
|
53
|
-
"system"
|
|
54
|
-
],
|
|
55
|
-
default: "user"
|
|
56
|
-
})
|
|
57
|
-
};
|
|
58
|
-
async run() {
|
|
59
|
-
const { args, flags } = await this.parse(SettingsGet);
|
|
60
|
-
try {
|
|
61
|
-
const tool = flags.tool;
|
|
62
|
-
const scope = flags.scope;
|
|
63
|
-
const data = tool === "claude" && args.name ? await this.#inspectClaudeVariant(scope, args.name) : await this.#inspectViaDispatcher(tool, scope);
|
|
64
|
-
if (flags.json) {
|
|
65
|
-
this.log(formatJson({
|
|
66
|
-
success: true,
|
|
67
|
-
data
|
|
68
|
-
}));
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (!data.exists) {
|
|
72
|
-
this.warn(`Config file not found: ${data.path}`);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
if (data.content) this.log(data.content);
|
|
76
|
-
else this.log("File is empty.");
|
|
77
|
-
} catch (error) {
|
|
78
|
-
this.error(error.message, { exit: 1 });
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
async #inspectViaDispatcher(tool, scope) {
|
|
82
|
-
return (await new SettingsDispatcher().execute({
|
|
83
|
-
tool,
|
|
84
|
-
scope,
|
|
85
|
-
action: "inspect"
|
|
86
|
-
})).data;
|
|
87
|
-
}
|
|
88
|
-
async #inspectClaudeVariant(scope, name) {
|
|
89
|
-
const adapter = new ClaudeAdapter();
|
|
90
|
-
if (!adapter.validateScope(scope)) throw new Error(`Invalid scope for Claude: ${scope}`);
|
|
91
|
-
const normalized = name.trim();
|
|
92
|
-
if (!normalized || normalized === "default") return this.#inspectViaDispatcher("claude", scope);
|
|
93
|
-
const basePath = adapter.resolvePath(scope);
|
|
94
|
-
const resolvedBase = resolveHome(basePath);
|
|
95
|
-
const directory = path.dirname(resolvedBase);
|
|
96
|
-
const variantPath = this.#findVariantPath(directory, normalized) ?? path.join(directory, `settings.${normalized}.json`);
|
|
97
|
-
if (!fs.existsSync(variantPath)) return {
|
|
98
|
-
path: variantPath,
|
|
99
|
-
exists: false
|
|
100
|
-
};
|
|
101
|
-
const stats = fs.statSync(variantPath);
|
|
102
|
-
return {
|
|
103
|
-
path: variantPath,
|
|
104
|
-
exists: true,
|
|
105
|
-
content: fs.readFileSync(variantPath, "utf-8"),
|
|
106
|
-
size: stats.size,
|
|
107
|
-
lastModified: stats.mtime
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
#findVariantPath(directory, name) {
|
|
111
|
-
const candidates = [`settings.${name}.json`, `settings-${name}.json`];
|
|
112
|
-
for (const candidate of candidates) {
|
|
113
|
-
const fullPath = path.join(directory, candidate);
|
|
114
|
-
if (fs.existsSync(fullPath)) return fullPath;
|
|
115
|
-
}
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
//#endregion
|
|
121
|
-
export { SettingsGet as default };
|
|
4
|
+
`;static examples=[`<%= config.bin %> <%= command.id %> --tool claude --scope user`,`<%= config.bin %> <%= command.id %> --tool codex --no-json`];static args={name:i.string({description:`Claude variant name (optional). Example: settings:get hxi`,required:!1})};static flags={tool:o.string({char:`t`,description:`AI CLI tool to manage`,options:[`claude`,`codex`,`gemini`,`xling`],default:`claude`}),scope:o.string({char:`s`,description:`Configuration scope`,options:[`user`,`project`,`local`,`system`],default:`user`})};async run(){let{args:t,flags:n}=await this.parse(l);try{let r=n.tool,i=n.scope,a=r===`claude`&&t.name?await this.#t(i,t.name):await this.#e(r,i);if(n.json){this.log(e({success:!0,data:a}));return}if(!a.exists){this.warn(`Config file not found: ${a.path}`);return}a.content?this.log(a.content):this.log(`File is empty.`)}catch(e){this.error(e.message,{exit:1})}}async#e(e,t){return(await new r().execute({tool:e,scope:t,action:`inspect`})).data}async#t(e,r){let i=new n;if(!i.validateScope(e))throw Error(`Invalid scope for Claude: ${e}`);let a=r.trim();if(!a||a===`default`)return this.#e(`claude`,e);let o=t(i.resolvePath(e)),l=s.dirname(o),u=this.#n(l,a)??s.join(l,`settings.${a}.json`);if(!c.existsSync(u))return{path:u,exists:!1};let d=c.statSync(u);return{path:u,exists:!0,content:c.readFileSync(u,`utf-8`),size:d.size,lastModified:d.mtime}}#n(e,t){let n=[`settings.${t}.json`,`settings-${t}.json`];for(let t of n){let n=s.join(e,t);if(c.existsSync(n))return n}return null}};export{l as default};
|
|
@@ -1,91 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "../../editor-CUiekAEb.js";
|
|
3
|
-
import { r as formatJson } from "../../format-a_tYXjv9.js";
|
|
4
|
-
import "../../fsStore-S8RslR8L.js";
|
|
5
|
-
import "../../base-DtcPVpvU.js";
|
|
6
|
-
import "../../config-JHw2hqMN.js";
|
|
7
|
-
import "../../template-B19CdPfg.js";
|
|
8
|
-
import "../../xling-BxVsmPja.js";
|
|
9
|
-
import "../../claudeDefault-ewrEKzlX.js";
|
|
10
|
-
import "../../claude-C6lOG2Mk.js";
|
|
11
|
-
import "../../codex-Dl7Rx7Nr.js";
|
|
12
|
-
import "../../gemini-DQoPiuiw.js";
|
|
13
|
-
import { t as SettingsDispatcher } from "../../dispatcher-BYazaYbC.js";
|
|
14
|
-
import { Command, Flags } from "@oclif/core";
|
|
15
|
-
|
|
16
|
-
//#region src/commands/settings/inspect.ts
|
|
17
|
-
/**
|
|
18
|
-
* settings:inspect command
|
|
19
|
-
* Check the status of configuration files
|
|
20
|
-
*/
|
|
21
|
-
var SettingsInspect = class SettingsInspect extends Command {
|
|
22
|
-
static summary = "Inspect configuration file status";
|
|
23
|
-
static description = `
|
|
1
|
+
import"../../errors-pXKbCKbL.js";import"../../editor-CUiekAEb.js";import{r as e}from"../../format-a_tYXjv9.js";import"../../fsStore-S8RslR8L.js";import"../../base-DtcPVpvU.js";import"../../config-JHw2hqMN.js";import"../../template-B19CdPfg.js";import"../../xling-BxVsmPja.js";import"../../claudeDefault-ewrEKzlX.js";import"../../claude-C6lOG2Mk.js";import"../../codex-Dl7Rx7Nr.js";import"../../gemini-DQoPiuiw.js";import{t}from"../../dispatcher-BYazaYbC.js";import{Command as n,Flags as r}from"@oclif/core";var i=class i extends n{static summary=`Inspect configuration file status`;static description=`
|
|
24
2
|
Display information about the configuration file, including:
|
|
25
3
|
- File path
|
|
26
4
|
- Existence status
|
|
27
5
|
- File size
|
|
28
6
|
- Last modified date
|
|
29
7
|
- File contents (if exists)
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
static flags = {
|
|
33
|
-
tool: Flags.string({
|
|
34
|
-
char: "t",
|
|
35
|
-
description: "AI CLI tool to manage",
|
|
36
|
-
options: [
|
|
37
|
-
"claude",
|
|
38
|
-
"codex",
|
|
39
|
-
"gemini",
|
|
40
|
-
"xling"
|
|
41
|
-
],
|
|
42
|
-
default: "claude"
|
|
43
|
-
}),
|
|
44
|
-
scope: Flags.string({
|
|
45
|
-
char: "s",
|
|
46
|
-
description: "Configuration scope",
|
|
47
|
-
options: [
|
|
48
|
-
"user",
|
|
49
|
-
"project",
|
|
50
|
-
"local",
|
|
51
|
-
"system"
|
|
52
|
-
],
|
|
53
|
-
default: "user"
|
|
54
|
-
}),
|
|
55
|
-
json: Flags.boolean({
|
|
56
|
-
description: "Output JSON (default)",
|
|
57
|
-
default: true,
|
|
58
|
-
allowNo: true
|
|
59
|
-
})
|
|
60
|
-
};
|
|
61
|
-
async run() {
|
|
62
|
-
const { flags } = await this.parse(SettingsInspect);
|
|
63
|
-
try {
|
|
64
|
-
const result = await new SettingsDispatcher().execute({
|
|
65
|
-
tool: flags.tool,
|
|
66
|
-
scope: flags.scope,
|
|
67
|
-
action: "inspect"
|
|
68
|
-
});
|
|
69
|
-
if (flags.json) {
|
|
70
|
-
this.log(formatJson(result));
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const data = result.data;
|
|
74
|
-
this.log(`Path: ${data.path}`);
|
|
75
|
-
this.log(`Exists: ${data.exists ? "Yes" : "No"}`);
|
|
76
|
-
if (data.exists) {
|
|
77
|
-
if (data.size !== void 0) this.log(`Size: ${data.size} bytes`);
|
|
78
|
-
if (data.lastModified) this.log(`Last Modified: ${data.lastModified.toISOString()}`);
|
|
79
|
-
if (data.content) {
|
|
80
|
-
this.log("\nContents:");
|
|
81
|
-
this.log(data.content);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
} catch (error) {
|
|
85
|
-
this.error(error.message, { exit: 1 });
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
//#endregion
|
|
91
|
-
export { SettingsInspect as default };
|
|
8
|
+
`;static examples=[`<%= config.bin %> <%= command.id %> --tool claude --scope user`,`<%= config.bin %> <%= command.id %> --tool codex --json`];static flags={tool:r.string({char:`t`,description:`AI CLI tool to manage`,options:[`claude`,`codex`,`gemini`,`xling`],default:`claude`}),scope:r.string({char:`s`,description:`Configuration scope`,options:[`user`,`project`,`local`,`system`],default:`user`}),json:r.boolean({description:`Output JSON (default)`,default:!0,allowNo:!0})};async run(){let{flags:n}=await this.parse(i);try{let r=await new t().execute({tool:n.tool,scope:n.scope,action:`inspect`});if(n.json){this.log(e(r));return}let i=r.data;this.log(`Path: ${i.path}`),this.log(`Exists: ${i.exists?`Yes`:`No`}`),i.exists&&(i.size!==void 0&&this.log(`Size: ${i.size} bytes`),i.lastModified&&this.log(`Last Modified: ${i.lastModified.toISOString()}`),i.content&&(this.log(`
|
|
9
|
+
Contents:`),this.log(i.content)))}catch(e){this.error(e.message,{exit:1})}}};export{i as default};
|
|
@@ -1,153 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "../../editor-CUiekAEb.js";
|
|
3
|
-
import { i as formatTable, n as formatFilesTable, r as formatJson } from "../../format-a_tYXjv9.js";
|
|
4
|
-
import "../../fsStore-S8RslR8L.js";
|
|
5
|
-
import "../../base-DtcPVpvU.js";
|
|
6
|
-
import "../../config-JHw2hqMN.js";
|
|
7
|
-
import "../../template-B19CdPfg.js";
|
|
8
|
-
import "../../xling-BxVsmPja.js";
|
|
9
|
-
import "../../claudeDefault-ewrEKzlX.js";
|
|
10
|
-
import "../../claude-C6lOG2Mk.js";
|
|
11
|
-
import "../../codex-Dl7Rx7Nr.js";
|
|
12
|
-
import "../../gemini-DQoPiuiw.js";
|
|
13
|
-
import { t as SettingsDispatcher } from "../../dispatcher-BYazaYbC.js";
|
|
14
|
-
import { Command, Flags } from "@oclif/core";
|
|
15
|
-
|
|
16
|
-
//#region src/commands/settings/list.ts
|
|
17
|
-
/**
|
|
18
|
-
* settings:list command
|
|
19
|
-
* List every configuration entry for a tool
|
|
20
|
-
*/
|
|
21
|
-
var SettingsList = class SettingsList extends Command {
|
|
22
|
-
static summary = "List all settings for a tool";
|
|
23
|
-
static description = `
|
|
1
|
+
import"../../errors-pXKbCKbL.js";import"../../editor-CUiekAEb.js";import{i as e,n as t,r as n}from"../../format-a_tYXjv9.js";import"../../fsStore-S8RslR8L.js";import"../../base-DtcPVpvU.js";import"../../config-JHw2hqMN.js";import"../../template-B19CdPfg.js";import"../../xling-BxVsmPja.js";import"../../claudeDefault-ewrEKzlX.js";import"../../claude-C6lOG2Mk.js";import"../../codex-Dl7Rx7Nr.js";import"../../gemini-DQoPiuiw.js";import{t as r}from"../../dispatcher-BYazaYbC.js";import{Command as i,Flags as a}from"@oclif/core";var o=class o extends i{static summary=`List all settings for a tool`;static description=`
|
|
24
2
|
Display all configuration settings for the specified AI CLI tool.
|
|
25
3
|
Supports multiple scopes (user, project, local, system).
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
];
|
|
32
|
-
static flags = {
|
|
33
|
-
tool: Flags.string({
|
|
34
|
-
char: "t",
|
|
35
|
-
description: "AI CLI tool to manage",
|
|
36
|
-
options: [
|
|
37
|
-
"claude",
|
|
38
|
-
"codex",
|
|
39
|
-
"gemini",
|
|
40
|
-
"xling"
|
|
41
|
-
],
|
|
42
|
-
default: "claude"
|
|
43
|
-
}),
|
|
44
|
-
scope: Flags.string({
|
|
45
|
-
char: "s",
|
|
46
|
-
description: "Configuration scope",
|
|
47
|
-
options: [
|
|
48
|
-
"user",
|
|
49
|
-
"project",
|
|
50
|
-
"local",
|
|
51
|
-
"system"
|
|
52
|
-
],
|
|
53
|
-
default: "user"
|
|
54
|
-
}),
|
|
55
|
-
json: Flags.boolean({
|
|
56
|
-
description: "Output JSON instead of text summary",
|
|
57
|
-
default: false
|
|
58
|
-
}),
|
|
59
|
-
table: Flags.boolean({
|
|
60
|
-
description: "Render table output instead of JSON",
|
|
61
|
-
default: false
|
|
62
|
-
})
|
|
63
|
-
};
|
|
64
|
-
async run() {
|
|
65
|
-
const { flags } = await this.parse(SettingsList);
|
|
66
|
-
try {
|
|
67
|
-
const result = await new SettingsDispatcher().execute({
|
|
68
|
-
tool: flags.tool,
|
|
69
|
-
scope: flags.scope,
|
|
70
|
-
action: "list"
|
|
71
|
-
});
|
|
72
|
-
if (flags.table) {
|
|
73
|
-
this.#renderDetailed(result.data);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
if (flags.json) {
|
|
77
|
-
this.log(formatJson(result));
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
this.#renderSummary(result.data);
|
|
81
|
-
} catch (error) {
|
|
82
|
-
this.error(error.message, { exit: 1 });
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
#renderSummary(data) {
|
|
86
|
-
if (!data) {
|
|
87
|
-
this.log("No settings found.");
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (data.type === "files") {
|
|
91
|
-
if (data.files.length === 0) {
|
|
92
|
-
this.log("No settings files found.");
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
this.log(this.#formatFilesSummary(data.files));
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (Object.keys(data.entries).length === 0) {
|
|
99
|
-
this.log("No settings found.");
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
this.log(this.#formatEntriesSummary(data.entries, data.filePath));
|
|
103
|
-
}
|
|
104
|
-
#renderDetailed(data) {
|
|
105
|
-
if (!data) {
|
|
106
|
-
this.log("No settings found.");
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
if (data.type === "files") {
|
|
110
|
-
if (data.files.length === 0) {
|
|
111
|
-
this.log("No settings files found.");
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
this.log(formatFilesTable(data.files));
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
if (Object.keys(data.entries).length === 0) {
|
|
118
|
-
this.log("No settings found.");
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
this.log(formatTable(data.entries));
|
|
122
|
-
this.log(`File: ${data.filePath}`);
|
|
123
|
-
}
|
|
124
|
-
#formatFilesSummary(files) {
|
|
125
|
-
const lines = files.map((file) => {
|
|
126
|
-
return `${file.active ? "* " : "- "}${file.variant} -> ${file.path}` + (file.exists ? "" : " (missing)");
|
|
127
|
-
});
|
|
128
|
-
return ["files:"].concat(lines).join("\n");
|
|
129
|
-
}
|
|
130
|
-
#formatEntriesSummary(entries, filePath) {
|
|
131
|
-
const lines = ["entries:"];
|
|
132
|
-
for (const [key, value] of Object.entries(entries)) {
|
|
133
|
-
const formatted = this.#stringify(value);
|
|
134
|
-
if (formatted.includes("\n")) {
|
|
135
|
-
lines.push(`- ${key}:`);
|
|
136
|
-
for (const line of formatted.split("\n")) lines.push(` ${line}`);
|
|
137
|
-
} else lines.push(`- ${key}: ${formatted}`);
|
|
138
|
-
}
|
|
139
|
-
lines.push(`file: ${filePath}`);
|
|
140
|
-
return lines.join("\n");
|
|
141
|
-
}
|
|
142
|
-
#stringify(value) {
|
|
143
|
-
if (value === null) return "null";
|
|
144
|
-
if (typeof value === "object") {
|
|
145
|
-
if (value instanceof Date) return value.toISOString();
|
|
146
|
-
return JSON.stringify(value, null, 2);
|
|
147
|
-
}
|
|
148
|
-
return String(value);
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
//#endregion
|
|
153
|
-
export { SettingsList as default };
|
|
4
|
+
`;static examples=[`<%= config.bin %> <%= command.id %> --tool claude --scope user`,`<%= config.bin %> <%= command.id %> --tool codex --scope user --table`,`<%= config.bin %> -t gemini -s project --no-json`];static flags={tool:a.string({char:`t`,description:`AI CLI tool to manage`,options:[`claude`,`codex`,`gemini`,`xling`],default:`claude`}),scope:a.string({char:`s`,description:`Configuration scope`,options:[`user`,`project`,`local`,`system`],default:`user`}),json:a.boolean({description:`Output JSON instead of text summary`,default:!1}),table:a.boolean({description:`Render table output instead of JSON`,default:!1})};async run(){let{flags:e}=await this.parse(o);try{let t=await new r().execute({tool:e.tool,scope:e.scope,action:`list`});if(e.table){this.#t(t.data);return}if(e.json){this.log(n(t));return}this.#e(t.data)}catch(e){this.error(e.message,{exit:1})}}#e(e){if(!e){this.log(`No settings found.`);return}if(e.type===`files`){if(e.files.length===0){this.log(`No settings files found.`);return}this.log(this.#n(e.files));return}if(Object.keys(e.entries).length===0){this.log(`No settings found.`);return}this.log(this.#r(e.entries,e.filePath))}#t(n){if(!n){this.log(`No settings found.`);return}if(n.type===`files`){if(n.files.length===0){this.log(`No settings files found.`);return}this.log(t(n.files));return}if(Object.keys(n.entries).length===0){this.log(`No settings found.`);return}this.log(e(n.entries)),this.log(`File: ${n.filePath}`)}#n(e){let t=e.map(e=>`${e.active?`* `:`- `}${e.variant} -> ${e.path}`+(e.exists?``:` (missing)`));return[`files:`].concat(t).join(`
|
|
5
|
+
`)}#r(e,t){let n=[`entries:`];for(let[t,r]of Object.entries(e)){let e=this.#i(r);if(e.includes(`
|
|
6
|
+
`)){n.push(`- ${t}:`);for(let t of e.split(`
|
|
7
|
+
`))n.push(` ${t}`)}else n.push(`- ${t}: ${e}`)}return n.push(`file: ${t}`),n.join(`
|
|
8
|
+
`)}#i(e){return e===null?`null`:typeof e==`object`?e instanceof Date?e.toISOString():JSON.stringify(e,null,2):String(e)}};export{o as default};
|
|
@@ -1,90 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "../../editor-CUiekAEb.js";
|
|
3
|
-
import { r as formatJson } from "../../format-a_tYXjv9.js";
|
|
4
|
-
import "../../fsStore-S8RslR8L.js";
|
|
5
|
-
import "../../base-DtcPVpvU.js";
|
|
6
|
-
import "../../config-JHw2hqMN.js";
|
|
7
|
-
import "../../template-B19CdPfg.js";
|
|
8
|
-
import "../../xling-BxVsmPja.js";
|
|
9
|
-
import "../../claudeDefault-ewrEKzlX.js";
|
|
10
|
-
import "../../claude-C6lOG2Mk.js";
|
|
11
|
-
import "../../codex-Dl7Rx7Nr.js";
|
|
12
|
-
import "../../gemini-DQoPiuiw.js";
|
|
13
|
-
import { t as SettingsDispatcher } from "../../dispatcher-BYazaYbC.js";
|
|
14
|
-
import { Command, Flags } from "@oclif/core";
|
|
15
|
-
|
|
16
|
-
//#region src/commands/settings/set.ts
|
|
17
|
-
/**
|
|
18
|
-
* settings:set command
|
|
19
|
-
* Edit Claude settings files through an IDE
|
|
20
|
-
*/
|
|
21
|
-
var SettingsSet = class SettingsSet extends Command {
|
|
22
|
-
static summary = "Open settings files in your IDE";
|
|
23
|
-
static description = `
|
|
1
|
+
import"../../errors-pXKbCKbL.js";import"../../editor-CUiekAEb.js";import{r as e}from"../../format-a_tYXjv9.js";import"../../fsStore-S8RslR8L.js";import"../../base-DtcPVpvU.js";import"../../config-JHw2hqMN.js";import"../../template-B19CdPfg.js";import"../../xling-BxVsmPja.js";import"../../claudeDefault-ewrEKzlX.js";import"../../claude-C6lOG2Mk.js";import"../../codex-Dl7Rx7Nr.js";import"../../gemini-DQoPiuiw.js";import{t}from"../../dispatcher-BYazaYbC.js";import{Command as n,Flags as r}from"@oclif/core";var i=class i extends n{static summary=`Open settings files in your IDE`;static description=`
|
|
24
2
|
Create or open settings files for AI CLI tools in your preferred editor.
|
|
25
3
|
For Claude: provide --name to edit settings.<name>.json (default: settings.json).
|
|
26
4
|
For Xling: edits ~/.claude/xling.json configuration.
|
|
27
|
-
`;
|
|
28
|
-
static examples = [
|
|
29
|
-
"<%= config.bin %> <%= command.id %> --tool claude --scope user --name hxi",
|
|
30
|
-
"<%= config.bin %> <%= command.id %> --tool claude --scope project --name default --ide cursor",
|
|
31
|
-
"<%= config.bin %> <%= command.id %> --tool xling --scope user --ide cursor"
|
|
32
|
-
];
|
|
33
|
-
static args = {};
|
|
34
|
-
static flags = {
|
|
35
|
-
tool: Flags.string({
|
|
36
|
-
char: "t",
|
|
37
|
-
description: "AI CLI tool to manage",
|
|
38
|
-
options: [
|
|
39
|
-
"claude",
|
|
40
|
-
"codex",
|
|
41
|
-
"gemini",
|
|
42
|
-
"xling"
|
|
43
|
-
],
|
|
44
|
-
default: "claude"
|
|
45
|
-
}),
|
|
46
|
-
scope: Flags.string({
|
|
47
|
-
char: "s",
|
|
48
|
-
description: "Configuration scope",
|
|
49
|
-
options: [
|
|
50
|
-
"user",
|
|
51
|
-
"project",
|
|
52
|
-
"local",
|
|
53
|
-
"system"
|
|
54
|
-
],
|
|
55
|
-
default: "user"
|
|
56
|
-
}),
|
|
57
|
-
name: Flags.string({ description: "Claude variant name (e.g., hxi). Creates settings.<name>.json if missing and opens it in the IDE." }),
|
|
58
|
-
ide: Flags.string({
|
|
59
|
-
description: "Editor command or alias (default: code for VS Code)",
|
|
60
|
-
default: "code"
|
|
61
|
-
}),
|
|
62
|
-
json: Flags.boolean({
|
|
63
|
-
description: "Output JSON (default)",
|
|
64
|
-
default: true,
|
|
65
|
-
allowNo: true
|
|
66
|
-
})
|
|
67
|
-
};
|
|
68
|
-
async run() {
|
|
69
|
-
const { flags } = await this.parse(SettingsSet);
|
|
70
|
-
try {
|
|
71
|
-
const result = await new SettingsDispatcher().execute({
|
|
72
|
-
tool: flags.tool,
|
|
73
|
-
scope: flags.scope,
|
|
74
|
-
action: "edit",
|
|
75
|
-
name: flags.name,
|
|
76
|
-
ide: flags.ide
|
|
77
|
-
});
|
|
78
|
-
if (flags.json) this.log(formatJson(result));
|
|
79
|
-
else {
|
|
80
|
-
this.log(result.message ?? "Opened settings file");
|
|
81
|
-
if (result.filePath) this.log(`File: ${result.filePath}`);
|
|
82
|
-
}
|
|
83
|
-
} catch (error) {
|
|
84
|
-
this.error(error.message, { exit: 1 });
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
//#endregion
|
|
90
|
-
export { SettingsSet as default };
|
|
5
|
+
`;static examples=[`<%= config.bin %> <%= command.id %> --tool claude --scope user --name hxi`,`<%= config.bin %> <%= command.id %> --tool claude --scope project --name default --ide cursor`,`<%= config.bin %> <%= command.id %> --tool xling --scope user --ide cursor`];static args={};static flags={tool:r.string({char:`t`,description:`AI CLI tool to manage`,options:[`claude`,`codex`,`gemini`,`xling`],default:`claude`}),scope:r.string({char:`s`,description:`Configuration scope`,options:[`user`,`project`,`local`,`system`],default:`user`}),name:r.string({description:`Claude variant name (e.g., hxi). Creates settings.<name>.json if missing and opens it in the IDE.`}),ide:r.string({description:`Editor command or alias (default: code for VS Code)`,default:`code`}),json:r.boolean({description:`Output JSON (default)`,default:!0,allowNo:!0})};async run(){let{flags:n}=await this.parse(i);try{let r=await new t().execute({tool:n.tool,scope:n.scope,action:`edit`,name:n.name,ide:n.ide});n.json?this.log(e(r)):(this.log(r.message??`Opened settings file`),r.filePath&&this.log(`File: ${r.filePath}`))}catch(e){this.error(e.message,{exit:1})}}};export{i as default};
|
|
@@ -1,167 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "../../editor-CUiekAEb.js";
|
|
3
|
-
import { r as formatJson } from "../../format-a_tYXjv9.js";
|
|
4
|
-
import "../../fsStore-S8RslR8L.js";
|
|
5
|
-
import "../../base-DtcPVpvU.js";
|
|
6
|
-
import "../../config-JHw2hqMN.js";
|
|
7
|
-
import "../../template-B19CdPfg.js";
|
|
8
|
-
import "../../xling-BxVsmPja.js";
|
|
9
|
-
import "../../claudeDefault-ewrEKzlX.js";
|
|
10
|
-
import "../../claude-C6lOG2Mk.js";
|
|
11
|
-
import "../../codex-Dl7Rx7Nr.js";
|
|
12
|
-
import "../../gemini-DQoPiuiw.js";
|
|
13
|
-
import { t as SettingsDispatcher } from "../../dispatcher-BYazaYbC.js";
|
|
14
|
-
import { Args, Command, Flags } from "@oclif/core";
|
|
15
|
-
import readline from "node:readline/promises";
|
|
16
|
-
import { stdin, stdout } from "node:process";
|
|
17
|
-
|
|
18
|
-
//#region src/commands/settings/switch.ts
|
|
19
|
-
/**
|
|
20
|
-
* settings:switch command
|
|
21
|
-
* Switch profiles for Codex or variants for Claude
|
|
22
|
-
*/
|
|
23
|
-
var SettingsSwitch = class SettingsSwitch extends Command {
|
|
24
|
-
static summary = "Switch Codex profiles or Claude settings variants";
|
|
25
|
-
static description = `
|
|
1
|
+
import"../../errors-pXKbCKbL.js";import"../../editor-CUiekAEb.js";import{r as e}from"../../format-a_tYXjv9.js";import"../../fsStore-S8RslR8L.js";import"../../base-DtcPVpvU.js";import"../../config-JHw2hqMN.js";import"../../template-B19CdPfg.js";import"../../xling-BxVsmPja.js";import"../../claudeDefault-ewrEKzlX.js";import"../../claude-C6lOG2Mk.js";import"../../codex-Dl7Rx7Nr.js";import"../../gemini-DQoPiuiw.js";import{t}from"../../dispatcher-BYazaYbC.js";import{Args as n,Command as r,Flags as i}from"@oclif/core";import a from"node:readline/promises";import{stdin as o,stdout as s}from"node:process";var c=class c extends r{static summary=`Switch Codex profiles or Claude settings variants`;static description=`
|
|
26
2
|
Switch to a different profile configuration for Codex
|
|
27
3
|
or activate a specific settings.<variant>.json for Claude.
|
|
28
|
-
`;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"<%= config.bin %> <%= command.id %> production --tool codex",
|
|
32
|
-
"<%= config.bin %> <%= command.id %> hxi --tool claude --scope user"
|
|
33
|
-
];
|
|
34
|
-
static args = { profile: Args.string({
|
|
35
|
-
description: "Profile name to switch to",
|
|
36
|
-
required: true
|
|
37
|
-
}) };
|
|
38
|
-
static flags = {
|
|
39
|
-
tool: Flags.string({
|
|
40
|
-
char: "t",
|
|
41
|
-
description: "AI CLI tool to manage",
|
|
42
|
-
options: [
|
|
43
|
-
"claude",
|
|
44
|
-
"codex",
|
|
45
|
-
"gemini",
|
|
46
|
-
"xling"
|
|
47
|
-
],
|
|
48
|
-
default: "claude"
|
|
49
|
-
}),
|
|
50
|
-
scope: Flags.string({
|
|
51
|
-
char: "s",
|
|
52
|
-
description: "Configuration scope",
|
|
53
|
-
options: [
|
|
54
|
-
"user",
|
|
55
|
-
"project",
|
|
56
|
-
"local",
|
|
57
|
-
"system"
|
|
58
|
-
],
|
|
59
|
-
default: "user"
|
|
60
|
-
}),
|
|
61
|
-
json: Flags.boolean({
|
|
62
|
-
description: "Output JSON instead of interactive text",
|
|
63
|
-
default: false
|
|
64
|
-
}),
|
|
65
|
-
force: Flags.boolean({
|
|
66
|
-
description: "Skip confirmation prompts (Claude only)",
|
|
67
|
-
default: false
|
|
68
|
-
}),
|
|
69
|
-
backup: Flags.boolean({
|
|
70
|
-
description: "Create a .bak backup when switching (Claude only)",
|
|
71
|
-
default: false
|
|
72
|
-
})
|
|
73
|
-
};
|
|
74
|
-
async run() {
|
|
75
|
-
const { args, flags } = await this.parse(SettingsSwitch);
|
|
76
|
-
try {
|
|
77
|
-
const dispatcher = new SettingsDispatcher();
|
|
78
|
-
const result = flags.tool === "claude" ? await this.#handleClaudeSwitch(dispatcher, args.profile, flags) : await dispatcher.execute({
|
|
79
|
-
tool: flags.tool,
|
|
80
|
-
scope: flags.scope,
|
|
81
|
-
action: "switch-profile",
|
|
82
|
-
profile: args.profile
|
|
83
|
-
});
|
|
84
|
-
if (!result) return;
|
|
85
|
-
this.#printResult(result, args.profile, flags);
|
|
86
|
-
} catch (error) {
|
|
87
|
-
this.error(error.message, { exit: 1 });
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
async #handleClaudeSwitch(dispatcher, profile, flags) {
|
|
91
|
-
if (flags.json && !flags.force) this.error("--json requires --force when switching Claude settings.", { exit: 1 });
|
|
92
|
-
const preview = await dispatcher.execute({
|
|
93
|
-
tool: "claude",
|
|
94
|
-
scope: flags.scope,
|
|
95
|
-
action: "switch-profile",
|
|
96
|
-
profile,
|
|
97
|
-
switchOptions: { preview: true }
|
|
98
|
-
});
|
|
99
|
-
if (preview.diff) this.log("Proposed changes:\n" + preview.diff);
|
|
100
|
-
else {
|
|
101
|
-
this.log("No differences detected. Current settings already match the selected variant.");
|
|
102
|
-
return preview;
|
|
103
|
-
}
|
|
104
|
-
let backup = Boolean(flags.backup);
|
|
105
|
-
if (!flags.force && !backup) {
|
|
106
|
-
const action = await this.#promptClaudeAction();
|
|
107
|
-
if (action === "cancel") {
|
|
108
|
-
this.log("Switch cancelled.");
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
111
|
-
backup = action === "backup";
|
|
112
|
-
}
|
|
113
|
-
const result = await dispatcher.execute({
|
|
114
|
-
tool: "claude",
|
|
115
|
-
scope: flags.scope,
|
|
116
|
-
action: "switch-profile",
|
|
117
|
-
profile,
|
|
118
|
-
switchOptions: { backup }
|
|
119
|
-
});
|
|
120
|
-
result.diff = preview.diff;
|
|
121
|
-
return result;
|
|
122
|
-
}
|
|
123
|
-
async #promptClaudeAction() {
|
|
124
|
-
const rl = readline.createInterface({
|
|
125
|
-
input: stdin,
|
|
126
|
-
output: stdout
|
|
127
|
-
});
|
|
128
|
-
try {
|
|
129
|
-
while (true) {
|
|
130
|
-
const answer = (await rl.question("Choose action ([o]verwrite/[b]ackup/[c]ancel): ")).trim().toLowerCase();
|
|
131
|
-
if ([
|
|
132
|
-
"overwrite",
|
|
133
|
-
"backup",
|
|
134
|
-
"cancel"
|
|
135
|
-
].includes(answer)) return answer;
|
|
136
|
-
if ([
|
|
137
|
-
"o",
|
|
138
|
-
"b",
|
|
139
|
-
"c"
|
|
140
|
-
].includes(answer)) return {
|
|
141
|
-
o: "overwrite",
|
|
142
|
-
b: "backup",
|
|
143
|
-
c: "cancel"
|
|
144
|
-
}[answer];
|
|
145
|
-
}
|
|
146
|
-
} finally {
|
|
147
|
-
rl.close();
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
#printResult(result, profile, flags) {
|
|
151
|
-
if (flags.json) {
|
|
152
|
-
this.log(formatJson(result));
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
if (result.preview) {
|
|
156
|
-
this.log("Preview only. No changes applied.");
|
|
157
|
-
if (result.diff) this.log(result.diff);
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
this.log(result.message ?? `Switched to profile: ${profile}`);
|
|
161
|
-
if (result.filePath) this.log(` File: ${result.filePath}`);
|
|
162
|
-
if (result.diff) this.log("Applied diff:\n" + result.diff);
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
//#endregion
|
|
167
|
-
export { SettingsSwitch as default };
|
|
4
|
+
`;static examples=[`<%= config.bin %> <%= command.id %> oss --tool codex`,`<%= config.bin %> <%= command.id %> production --tool codex`,`<%= config.bin %> <%= command.id %> hxi --tool claude --scope user`];static args={profile:n.string({description:`Profile name to switch to`,required:!0})};static flags={tool:i.string({char:`t`,description:`AI CLI tool to manage`,options:[`claude`,`codex`,`gemini`,`xling`],default:`claude`}),scope:i.string({char:`s`,description:`Configuration scope`,options:[`user`,`project`,`local`,`system`],default:`user`}),json:i.boolean({description:`Output JSON instead of interactive text`,default:!1}),force:i.boolean({description:`Skip confirmation prompts (Claude only)`,default:!1}),backup:i.boolean({description:`Create a .bak backup when switching (Claude only)`,default:!1})};async run(){let{args:e,flags:n}=await this.parse(c);try{let r=new t,i=n.tool===`claude`?await this.#e(r,e.profile,n):await r.execute({tool:n.tool,scope:n.scope,action:`switch-profile`,profile:e.profile});if(!i)return;this.#n(i,e.profile,n)}catch(e){this.error(e.message,{exit:1})}}async#e(e,t,n){n.json&&!n.force&&this.error(`--json requires --force when switching Claude settings.`,{exit:1});let r=await e.execute({tool:`claude`,scope:n.scope,action:`switch-profile`,profile:t,switchOptions:{preview:!0}});if(r.diff)this.log(`Proposed changes:
|
|
5
|
+
`+r.diff);else return this.log(`No differences detected. Current settings already match the selected variant.`),r;let i=!!n.backup;if(!n.force&&!i){let e=await this.#t();if(e===`cancel`)return this.log(`Switch cancelled.`),null;i=e===`backup`}let a=await e.execute({tool:`claude`,scope:n.scope,action:`switch-profile`,profile:t,switchOptions:{backup:i}});return a.diff=r.diff,a}async#t(){let e=a.createInterface({input:o,output:s});try{for(;;){let t=(await e.question(`Choose action ([o]verwrite/[b]ackup/[c]ancel): `)).trim().toLowerCase();if([`overwrite`,`backup`,`cancel`].includes(t))return t;if([`o`,`b`,`c`].includes(t))return{o:`overwrite`,b:`backup`,c:`cancel`}[t]}}finally{e.close()}}#n(t,n,r){if(r.json){this.log(e(t));return}if(t.preview){this.log(`Preview only. No changes applied.`),t.diff&&this.log(t.diff);return}this.log(t.message??`Switched to profile: ${n}`),t.filePath&&this.log(` File: ${t.filePath}`),t.diff&&this.log(`Applied diff:
|
|
6
|
+
`+t.diff)}};export{c as default};
|