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.
Files changed (111) hide show
  1. package/dist/{base-ZLSUOdyk.d.ts → base-BxGCoslm.d.ts} +2 -2
  2. package/dist/base-CSwZL00J.js +1 -30
  3. package/dist/{base-B5MGQGLN.d.ts → base-D1BJt9i-.d.ts} +3 -2
  4. package/dist/base-DtcPVpvU.js +1 -68
  5. package/dist/claude-C6lOG2Mk.js +1 -206
  6. package/dist/claude-lgXq7-0w.js +1 -0
  7. package/dist/claudeDefault-ewrEKzlX.js +1 -18
  8. package/dist/client-DTC49Rug.js +1 -88
  9. package/dist/codex-Dl7Rx7Nr.js +1 -83
  10. package/dist/codex-sOnl7pFp.js +1 -0
  11. package/dist/commands/git/index.js +5 -35
  12. package/dist/commands/git/prc.js +2 -121
  13. package/dist/commands/git/prr.js +2 -80
  14. package/dist/commands/git/prv.js +2 -70
  15. package/dist/commands/git/worktree.js +3 -135
  16. package/dist/commands/git/wta.js +3 -78
  17. package/dist/commands/git/wtl.js +3 -42
  18. package/dist/commands/git/wtp.js +3 -42
  19. package/dist/commands/git/wtr.js +3 -77
  20. package/dist/commands/git/wts.js +2 -99
  21. package/dist/commands/p/index.js +15 -380
  22. package/dist/commands/settings/get.js +2 -119
  23. package/dist/commands/settings/inspect.js +3 -85
  24. package/dist/commands/settings/list.js +6 -151
  25. package/dist/commands/settings/set.js +2 -87
  26. package/dist/commands/settings/switch.js +4 -165
  27. package/dist/commands/sx/index.js +12 -93
  28. package/dist/commands/version/index.js +1 -22
  29. package/dist/commands/x/index.js +4 -104
  30. package/dist/config-JHw2hqMN.js +1 -141
  31. package/dist/create-CKUHliul.js +1 -95
  32. package/dist/dispatcher-5y9x6plQ.js +1 -0
  33. package/dist/dispatcher-BYazaYbC.js +1 -75
  34. package/dist/dispatcher-D4bEJonH.js +1 -30
  35. package/dist/domain/git.js +1 -3
  36. package/dist/domain/interfaces.d.ts +2 -2
  37. package/dist/domain/interfaces.js +1 -1
  38. package/dist/domain/types.d.ts +1 -1
  39. package/dist/domain/types.js +1 -1
  40. package/dist/domain/validators.d.ts +1 -1
  41. package/dist/domain/validators.js +1 -57
  42. package/dist/domain/xling/config.js +1 -3
  43. package/dist/domain/xling/template.js +1 -3
  44. package/dist/editor-CUiekAEb.js +1 -31
  45. package/dist/errors-pXKbCKbL.js +1 -115
  46. package/dist/format-a_tYXjv9.js +4 -229
  47. package/dist/fsStore-S8RslR8L.js +1 -122
  48. package/dist/gemini-DQoPiuiw.js +1 -49
  49. package/dist/git-BZvqM5hz.js +1 -12
  50. package/dist/{interfaces-Cy1OFHgI.d.ts → interfaces-D5gBXflS.d.ts} +2 -1
  51. package/dist/pr-DjdO-vJk.js +1 -61
  52. package/dist/providerRegistry-Cljln1eo.js +1 -151
  53. package/dist/router-DX-dIEei.js +1 -177
  54. package/dist/run.js +1 -13
  55. package/dist/runner-Bi5mGd-w.js +1 -203
  56. package/dist/runner-DYk4q6mP.js +1 -145
  57. package/dist/services/git/create.js +1 -6
  58. package/dist/services/git/dispatcher.js +1 -10
  59. package/dist/services/git/pr.js +1 -6
  60. package/dist/services/git/utils.js +1 -5
  61. package/dist/services/git/view.js +1 -6
  62. package/dist/services/git/worktree.js +1 -5
  63. package/dist/services/launch/adapters/base.d.ts +3 -3
  64. package/dist/services/launch/adapters/base.js +1 -4
  65. package/dist/services/launch/adapters/claude.d.ts +6 -3
  66. package/dist/services/launch/adapters/claude.js +1 -5
  67. package/dist/services/launch/adapters/codex.d.ts +6 -3
  68. package/dist/services/launch/adapters/codex.js +1 -5
  69. package/dist/services/launch/dispatcher.d.ts +2 -2
  70. package/dist/services/launch/dispatcher.js +1 -8
  71. package/dist/services/prompt/client.js +1 -3
  72. package/dist/services/prompt/providerRegistry.js +1 -10
  73. package/dist/services/prompt/router.js +1 -13
  74. package/dist/services/prompt/types.js +1 -3
  75. package/dist/services/settings/adapters/base.d.ts +3 -3
  76. package/dist/services/settings/adapters/base.js +1 -5
  77. package/dist/services/settings/adapters/claude.d.ts +3 -3
  78. package/dist/services/settings/adapters/claude.js +1 -9
  79. package/dist/services/settings/adapters/codex.d.ts +3 -3
  80. package/dist/services/settings/adapters/codex.js +1 -6
  81. package/dist/services/settings/adapters/gemini.d.ts +3 -3
  82. package/dist/services/settings/adapters/gemini.js +1 -6
  83. package/dist/services/settings/adapters/xling.d.ts +3 -3
  84. package/dist/services/settings/adapters/xling.js +1 -9
  85. package/dist/services/settings/dispatcher.d.ts +2 -2
  86. package/dist/services/settings/dispatcher.js +1 -15
  87. package/dist/services/settings/fsStore.d.ts +1 -1
  88. package/dist/services/settings/fsStore.js +1 -4
  89. package/dist/services/settings/templates/claudeDefault.d.ts +1 -1
  90. package/dist/services/settings/templates/claudeDefault.js +1 -3
  91. package/dist/services/shortcuts/runner.js +1 -11
  92. package/dist/services/shortcuts/types.js +1 -3
  93. package/dist/template-B19CdPfg.js +1 -164
  94. package/dist/types-99-EmVXg.js +2 -25
  95. package/dist/types-DblJSHMa.js +1 -23
  96. package/dist/{types-5rST51Xi.d.ts → types-RoapPbyI.d.ts} +1 -0
  97. package/dist/utils/editor.js +1 -4
  98. package/dist/utils/errors.js +1 -3
  99. package/dist/utils/format.d.ts +1 -1
  100. package/dist/utils/format.js +1 -3
  101. package/dist/utils/logger.js +1 -42
  102. package/dist/utils/runner.d.ts +1 -1
  103. package/dist/utils/runner.js +1 -3
  104. package/dist/utils-DDnNMPIq.js +1 -35
  105. package/dist/view-JZaEEspp.js +1 -84
  106. package/dist/worktree-BuIXmI0X.js +3 -205
  107. package/dist/xling-BxVsmPja.js +1 -254
  108. package/package.json +1 -1
  109. package/dist/claude-YXQbPr5h.js +0 -29
  110. package/dist/codex-UE8EaZGt.js +0 -30
  111. package/dist/dispatcher-BCISF-Uw.js +0 -87
@@ -1,5 +1,5 @@
1
- import { f as SettingsListData, g as ToolId, h as SwitchOptions, i as InspectResult, l as Scope, m as SettingsResult, r as EditOptions, t as ConfigObject } from "./types-5rST51Xi.js";
2
- import { n as SettingsAdapter } from "./interfaces-Cy1OFHgI.js";
1
+ import { f as SettingsListData, g as ToolId, h as SwitchOptions, i as InspectResult, l as Scope, m as SettingsResult, r as EditOptions, t as ConfigObject } from "./types-RoapPbyI.js";
2
+ import { n as SettingsAdapter } from "./interfaces-D5gBXflS.js";
3
3
 
4
4
  //#region src/services/settings/adapters/base.d.ts
5
5
 
@@ -1,30 +1 @@
1
- import { n as getExecutableVersion, t as checkExecutable } from "./runner-DYk4q6mP.js";
2
-
3
- //#region src/services/launch/adapters/base.ts
4
- /**
5
- * Abstract base implementing SOLID principles:
6
- * - SRP: only responsible for building command specs
7
- * - Template Method: subclasses override specific pieces
8
- * - DRY: shares validateAvailability and getVersion logic
9
- */
10
- var BaseLaunchAdapter = class {
11
- /**
12
- * Default availability check (subclasses may override)
13
- */
14
- async validateAvailability() {
15
- return checkExecutable(this.executable);
16
- }
17
- /**
18
- * Default version check (subclasses may override)
19
- */
20
- async getVersion() {
21
- try {
22
- return await getExecutableVersion(this.executable);
23
- } catch {
24
- return "unknown";
25
- }
26
- }
27
- };
28
-
29
- //#endregion
30
- export { BaseLaunchAdapter as t };
1
+ import{n as e,t}from"./runner-DYk4q6mP.js";var n=class{async validateAvailability(){return t(this.executable)}async getVersion(){try{return await e(this.executable)}catch{return`unknown`}}};export{n as t};
@@ -1,5 +1,5 @@
1
- import { a as LaunchCommandSpec, g as ToolId } from "./types-5rST51Xi.js";
2
- import { t as LaunchAdapter } from "./interfaces-Cy1OFHgI.js";
1
+ import { a as LaunchCommandSpec, g as ToolId } from "./types-RoapPbyI.js";
2
+ import { t as LaunchAdapter } from "./interfaces-D5gBXflS.js";
3
3
 
4
4
  //#region src/services/launch/adapters/base.d.ts
5
5
 
@@ -25,6 +25,7 @@ declare abstract class BaseLaunchAdapter implements LaunchAdapter {
25
25
  yolo?: boolean;
26
26
  resume?: boolean;
27
27
  continue?: boolean;
28
+ settings?: string;
28
29
  }): LaunchCommandSpec;
29
30
  /**
30
31
  * Default availability check (subclasses may override)
@@ -1,68 +1 @@
1
- import { c as InvalidScopeError } from "./errors-pXKbCKbL.js";
2
- import { a as readJSON, c as writeJSON, i as getFileInfo, r as fileExists } from "./fsStore-S8RslR8L.js";
3
-
4
- //#region src/services/settings/adapters/base.ts
5
- /**
6
- * Abstract adapter implementation
7
- */
8
- var BaseAdapter = class {
9
- /**
10
- * List all configuration entries for a scope
11
- */
12
- async list(scope) {
13
- if (!this.validateScope(scope)) throw new InvalidScopeError(scope);
14
- const path = this.resolvePath(scope);
15
- return {
16
- type: "entries",
17
- entries: this.readConfig(path),
18
- filePath: path
19
- };
20
- }
21
- /**
22
- * Default switchProfile implementation (throws unless overridden)
23
- */
24
- async switchProfile(_scope, _profile, _options) {
25
- throw new Error(`Tool ${this.toolId} does not support profile switching`);
26
- }
27
- /**
28
- * Inspect the configuration file
29
- */
30
- async inspect(scope) {
31
- if (!this.validateScope(scope)) throw new InvalidScopeError(scope);
32
- const path = this.resolvePath(scope);
33
- if (!fileExists(path)) return {
34
- path,
35
- exists: false
36
- };
37
- const fileInfo = getFileInfo(path);
38
- const config = this.readConfig(path);
39
- return {
40
- path,
41
- exists: true,
42
- content: JSON.stringify(config, null, 2),
43
- size: fileInfo?.size,
44
- lastModified: fileInfo?.lastModified
45
- };
46
- }
47
- /**
48
- * Default edit implementation (throws unless overridden)
49
- */
50
- async edit(scope, _options) {
51
- throw new Error(`Tool ${this.toolId} does not support edit for ${scope}`);
52
- }
53
- /**
54
- * Read the configuration file (subclasses may override)
55
- */
56
- readConfig(path) {
57
- return readJSON(path);
58
- }
59
- /**
60
- * Write the configuration file (subclasses may override)
61
- */
62
- writeConfig(path, data, backup = true) {
63
- writeJSON(path, data, backup);
64
- }
65
- };
66
-
67
- //#endregion
68
- export { BaseAdapter as t };
1
+ import{c as e}from"./errors-pXKbCKbL.js";import{a as t,c as n,i as r,r as i}from"./fsStore-S8RslR8L.js";var a=class{async list(t){if(!this.validateScope(t))throw new e(t);let n=this.resolvePath(t);return{type:`entries`,entries:this.readConfig(n),filePath:n}}async switchProfile(e,t,n){throw Error(`Tool ${this.toolId} does not support profile switching`)}async inspect(t){if(!this.validateScope(t))throw new e(t);let n=this.resolvePath(t);if(!i(n))return{path:n,exists:!1};let a=r(n),o=this.readConfig(n);return{path:n,exists:!0,content:JSON.stringify(o,null,2),size:a?.size,lastModified:a?.lastModified}}async edit(e,t){throw Error(`Tool ${this.toolId} does not support edit for ${e}`)}readConfig(e){return t(e)}writeConfig(e,t,r=!0){n(e,t,r)}};export{a as t};
@@ -1,206 +1 @@
1
- import { c as InvalidScopeError, u as SettingsVariantNotFoundError } from "./errors-pXKbCKbL.js";
2
- import { n as resolveEditorCommand, t as openInEditor } from "./editor-CUiekAEb.js";
3
- import { t as formatDiff } from "./format-a_tYXjv9.js";
4
- import { c as writeJSON, i as getFileInfo, n as ensureDir, s as resolveHome } from "./fsStore-S8RslR8L.js";
5
- import { t as BaseAdapter } from "./base-DtcPVpvU.js";
6
- import { t as CLAUDE_SETTINGS_TEMPLATE } from "./claudeDefault-ewrEKzlX.js";
7
- import * as fs from "fs";
8
- import * as path from "path";
9
-
10
- //#region src/services/settings/adapters/claude.ts
11
- /**
12
- * Claude Code settings adapter
13
- */
14
- /**
15
- * Resolves the following config locations:
16
- * - user: ~/.claude/settings.json
17
- * - project: <cwd>/.claude/settings.json
18
- * - local: <cwd>/.claude/settings.local.json
19
- */
20
- var ClaudeAdapter = class extends BaseAdapter {
21
- toolId = "claude";
22
- /**
23
- * List every settings.*.json file in the scope directory
24
- */
25
- async list(scope) {
26
- if (!this.validateScope(scope)) throw new InvalidScopeError(scope);
27
- const activePath = resolveHome(this.resolvePath(scope));
28
- const directory = path.dirname(activePath);
29
- const activeFilename = path.basename(activePath);
30
- const files = [this.#buildEntry(activePath, scope, true)];
31
- if (fs.existsSync(directory)) {
32
- const entries = fs.readdirSync(directory, { withFileTypes: true });
33
- for (const entry of entries) {
34
- if (!entry.isFile()) continue;
35
- if (entry.name === activeFilename) continue;
36
- if (!this.#isSettingsFile(entry.name)) continue;
37
- const entryPath = path.join(directory, entry.name);
38
- files.push(this.#buildEntry(entryPath, scope, false));
39
- }
40
- }
41
- return {
42
- type: "files",
43
- files: this.#sortFiles(files)
44
- };
45
- }
46
- /**
47
- * Resolve the config path for a scope
48
- */
49
- resolvePath(scope) {
50
- switch (scope) {
51
- case "user": return "~/.claude/settings.json";
52
- case "project": return ".claude/settings.json";
53
- case "local": return ".claude/settings.local.json";
54
- default: throw new Error(`Unsupported scope for Claude: ${scope}`);
55
- }
56
- }
57
- /**
58
- * Validate supported scopes
59
- */
60
- validateScope(scope) {
61
- return [
62
- "user",
63
- "project",
64
- "local"
65
- ].includes(scope);
66
- }
67
- /**
68
- * Replace the active settings file with the selected variant
69
- */
70
- async switchProfile(scope, profile, options) {
71
- if (!this.validateScope(scope)) throw new InvalidScopeError(scope);
72
- const variant = profile.trim();
73
- if (!variant) throw new Error("Variant name cannot be empty");
74
- const targetPath = resolveHome(this.resolvePath(scope));
75
- const directory = path.dirname(targetPath);
76
- const sourcePath = this.#findVariantPath(directory, variant, targetPath);
77
- if (!sourcePath) throw new SettingsVariantNotFoundError(variant);
78
- const nextConfig = this.readConfig(sourcePath);
79
- let currentConfig = {};
80
- try {
81
- currentConfig = this.readConfig(targetPath);
82
- } catch {
83
- currentConfig = {};
84
- }
85
- const diff = formatDiff(currentConfig, nextConfig);
86
- if (options?.preview) return {
87
- success: true,
88
- preview: true,
89
- filePath: targetPath,
90
- diff: diff ?? void 0,
91
- data: {
92
- from: sourcePath,
93
- to: targetPath,
94
- hasChanges: Boolean(diff)
95
- },
96
- message: diff ? "Preview generated. Review diff before applying." : "Current settings already match the selected variant."
97
- };
98
- if (!diff) return {
99
- success: true,
100
- message: "Current settings already match the selected variant.",
101
- filePath: targetPath
102
- };
103
- const shouldBackup = options?.backup ?? false;
104
- this.writeConfig(targetPath, nextConfig, shouldBackup);
105
- return {
106
- success: true,
107
- message: `Switched to ${path.basename(sourcePath)}`,
108
- filePath: targetPath,
109
- data: {
110
- from: sourcePath,
111
- to: targetPath
112
- }
113
- };
114
- }
115
- async edit(scope, options) {
116
- if (!this.validateScope(scope)) throw new InvalidScopeError(scope);
117
- const basePath = resolveHome(this.resolvePath(scope));
118
- const directory = path.dirname(basePath);
119
- const variantName = options.name?.trim();
120
- const resolvedEditor = resolveEditorCommand(options.ide);
121
- ensureDir(directory);
122
- let targetPath = basePath;
123
- let label = "default";
124
- if (variantName && variantName !== "" && variantName !== "default") {
125
- const existingPath = this.#findVariantPath(directory, variantName, basePath);
126
- if (existingPath) targetPath = existingPath;
127
- else {
128
- targetPath = path.join(directory, `settings.${variantName}.json`);
129
- if (!fs.existsSync(targetPath)) {
130
- const seed = this.#buildSeedConfig(basePath);
131
- writeJSON(targetPath, seed, false);
132
- }
133
- }
134
- label = variantName;
135
- } else if (!fs.existsSync(targetPath)) {
136
- const seed = this.#buildSeedConfig(basePath);
137
- writeJSON(targetPath, seed, false);
138
- }
139
- await openInEditor(resolvedEditor, targetPath);
140
- return {
141
- success: true,
142
- message: `Opened ${label} settings in ${resolvedEditor}`,
143
- filePath: targetPath,
144
- data: {
145
- variant: label,
146
- ide: resolvedEditor
147
- }
148
- };
149
- }
150
- #buildEntry(filePath, scope, active) {
151
- const info = getFileInfo(filePath);
152
- return {
153
- filename: path.basename(filePath),
154
- variant: this.#extractVariant(filePath),
155
- path: filePath,
156
- scope,
157
- active,
158
- exists: Boolean(info),
159
- size: info?.size,
160
- lastModified: info?.lastModified
161
- };
162
- }
163
- #extractVariant(filePath) {
164
- const filename = path.basename(filePath);
165
- const match = filename.match(/^settings(?:[._-](.+))?\.json$/);
166
- if (!match) return filename.replace(/\.json$/, "");
167
- return match[1] ?? "default";
168
- }
169
- #buildSeedConfig(basePath) {
170
- try {
171
- if (fs.existsSync(basePath)) {
172
- const content = fs.readFileSync(basePath, "utf-8");
173
- return JSON.parse(content);
174
- }
175
- } catch {}
176
- return { ...CLAUDE_SETTINGS_TEMPLATE };
177
- }
178
- #isSettingsFile(filename) {
179
- return /^settings[._-].+\.json$/.test(filename);
180
- }
181
- #sortFiles(files) {
182
- return files.sort((a, b) => {
183
- if (a.active && !b.active) return -1;
184
- if (!a.active && b.active) return 1;
185
- return a.variant.localeCompare(b.variant);
186
- });
187
- }
188
- #findVariantPath(directory, profile, defaultPath) {
189
- const candidates = [];
190
- const pushCandidate = (value) => {
191
- if (!candidates.includes(value)) candidates.push(value);
192
- };
193
- if (profile === "default") pushCandidate(defaultPath);
194
- if (profile.endsWith(".json")) pushCandidate(path.isAbsolute(profile) ? profile : path.join(directory, profile));
195
- else {
196
- pushCandidate(path.join(directory, `settings.${profile}.json`));
197
- pushCandidate(path.join(directory, `settings-${profile}.json`));
198
- pushCandidate(path.join(directory, `settings_${profile}.json`));
199
- }
200
- for (const candidate of candidates) if (fs.existsSync(candidate)) return candidate;
201
- return null;
202
- }
203
- };
204
-
205
- //#endregion
206
- export { ClaudeAdapter as t };
1
+ import{c as e,u as t}from"./errors-pXKbCKbL.js";import{n,t as r}from"./editor-CUiekAEb.js";import{t as i}from"./format-a_tYXjv9.js";import{c as a,i as o,n as s,s as c}from"./fsStore-S8RslR8L.js";import{t as l}from"./base-DtcPVpvU.js";import{t as u}from"./claudeDefault-ewrEKzlX.js";import*as d from"fs";import*as f from"path";var p=class extends l{toolId=`claude`;async list(t){if(!this.validateScope(t))throw new e(t);let n=c(this.resolvePath(t)),r=f.dirname(n),i=f.basename(n),a=[this.#e(n,t,!0)];if(d.existsSync(r)){let e=d.readdirSync(r,{withFileTypes:!0});for(let n of e){if(!n.isFile()||n.name===i||!this.#r(n.name))continue;let e=f.join(r,n.name);a.push(this.#e(e,t,!1))}}return{type:`files`,files:this.#i(a)}}resolvePath(e){switch(e){case`user`:return`~/.claude/settings.json`;case`project`:return`.claude/settings.json`;case`local`:return`.claude/settings.local.json`;default:throw Error(`Unsupported scope for Claude: ${e}`)}}validateScope(e){return[`user`,`project`,`local`].includes(e)}async switchProfile(n,r,a){if(!this.validateScope(n))throw new e(n);let o=r.trim();if(!o)throw Error(`Variant name cannot be empty`);let s=c(this.resolvePath(n)),l=f.dirname(s),u=this.#a(l,o,s);if(!u)throw new t(o);let d=this.readConfig(u),p={};try{p=this.readConfig(s)}catch{p={}}let m=i(p,d);if(a?.preview)return{success:!0,preview:!0,filePath:s,diff:m??void 0,data:{from:u,to:s,hasChanges:!!m},message:m?`Preview generated. Review diff before applying.`:`Current settings already match the selected variant.`};if(!m)return{success:!0,message:`Current settings already match the selected variant.`,filePath:s};let h=a?.backup??!1;return this.writeConfig(s,d,h),{success:!0,message:`Switched to ${f.basename(u)}`,filePath:s,data:{from:u,to:s}}}async edit(t,i){if(!this.validateScope(t))throw new e(t);let o=c(this.resolvePath(t)),l=f.dirname(o),u=i.name?.trim(),p=n(i.ide);s(l);let m=o,h=`default`;if(u&&u!==``&&u!==`default`){let e=this.#a(l,u,o);if(e)m=e;else if(m=f.join(l,`settings.${u}.json`),!d.existsSync(m)){let e=this.#n(o);a(m,e,!1)}h=u}else if(!d.existsSync(m)){let e=this.#n(o);a(m,e,!1)}return await r(p,m),{success:!0,message:`Opened ${h} settings in ${p}`,filePath:m,data:{variant:h,ide:p}}}#e(e,t,n){let r=o(e);return{filename:f.basename(e),variant:this.#t(e),path:e,scope:t,active:n,exists:!!r,size:r?.size,lastModified:r?.lastModified}}#t(e){let t=f.basename(e),n=t.match(/^settings(?:[._-](.+))?\.json$/);return n?n[1]??`default`:t.replace(/\.json$/,``)}#n(e){try{if(d.existsSync(e)){let t=d.readFileSync(e,`utf-8`);return JSON.parse(t)}}catch{}return{...u}}#r(e){return/^settings[._-].+\.json$/.test(e)}#i(e){return e.sort((e,t)=>e.active&&!t.active?-1:!e.active&&t.active?1:e.variant.localeCompare(t.variant))}#a(e,t,n){let r=[],i=e=>{r.includes(e)||r.push(e)};t===`default`&&i(n),t.endsWith(`.json`)?i(f.isAbsolute(t)?t:f.join(e,t)):(i(f.join(e,`settings.${t}.json`)),i(f.join(e,`settings-${t}.json`)),i(f.join(e,`settings_${t}.json`)));for(let e of r)if(d.existsSync(e))return e;return null}};export{p as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./base-CSwZL00J.js";import*as t from"fs";import*as n from"path";import*as r from"os";var i=class extends e{toolId=`claude`;executable=`claude`;buildCommandSpec(e){let t=[];if(e.continue?t.push(`-c`):e.resume&&t.push(`-r`),e.settings){let n=this.#e(e.settings);t.push(`--settings`,n)}return{executable:this.executable,baseArgs:t,yoloArgs:e.yolo?[`--dangerously-skip-permissions`]:void 0}}#e(e){if(e.trim().startsWith(`{`)||n.isAbsolute(e)||e.endsWith(`.json`))return e;let i=n.join(r.homedir(),`.claude`),a=n.join(i,`settings.${e}.json`);if(t.existsSync(a))return a;let o=n.join(i,`settings-${e}.json`);return t.existsSync(o)?o:a}};export{i as t};
@@ -1,18 +1 @@
1
- //#region src/services/settings/templates/claudeDefault.ts
2
- const CLAUDE_SETTINGS_TEMPLATE = {
3
- env: {
4
- ANTHROPIC_AUTH_TOKEN: "",
5
- ANTHROPIC_BASE_URL: "https://api.anthropic.com",
6
- CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1",
7
- ANTHROPIC_MODEL: "claude-sonnet-4-5-20250929",
8
- ANTHROPIC_SMALL_FAST_MODEL: "claude-haiku-4-5-20251001"
9
- },
10
- permissions: {
11
- allow: [],
12
- deny: []
13
- },
14
- enabledPlugins: { "example-skills@anthropic-agent-skills": false }
15
- };
16
-
17
- //#endregion
18
- export { CLAUDE_SETTINGS_TEMPLATE as t };
1
+ const e={env:{ANTHROPIC_AUTH_TOKEN:``,ANTHROPIC_BASE_URL:`https://api.anthropic.com`,CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC:`1`,ANTHROPIC_MODEL:`claude-sonnet-4-5-20250929`,ANTHROPIC_SMALL_FAST_MODEL:`claude-haiku-4-5-20251001`},permissions:{allow:[],deny:[]},enabledPlugins:{"example-skills@anthropic-agent-skills":!1}};export{e as t};
@@ -1,88 +1 @@
1
- import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
2
- import { generateText, streamText } from "ai";
3
-
4
- //#region src/services/prompt/client.ts
5
- /**
6
- * OpenAI Compatible Client Wrapper
7
- * Wraps @ai-sdk/openai-compatible for each provider
8
- */
9
- /**
10
- * Client for a single provider using AI SDK
11
- */
12
- var PromptClient = class {
13
- #provider;
14
- #config;
15
- constructor(config) {
16
- this.#config = config;
17
- this.#provider = createOpenAICompatible({
18
- name: config.name,
19
- baseURL: config.baseUrl,
20
- apiKey: config.apiKey,
21
- headers: config.headers
22
- });
23
- }
24
- /**
25
- * Convert AI SDK v2 usage to our internal format
26
- */
27
- #convertUsage(usage) {
28
- if (!usage) return;
29
- return {
30
- promptTokens: usage.inputTokens ?? 0,
31
- completionTokens: usage.outputTokens ?? 0,
32
- totalTokens: usage.totalTokens ?? 0
33
- };
34
- }
35
- /**
36
- * Generate text (non-streaming)
37
- */
38
- async generate(request) {
39
- const baseParams = {
40
- model: this.#provider(request.model || ""),
41
- temperature: request.temperature,
42
- maxOutputTokens: request.maxTokens,
43
- maxRetries: 2,
44
- abortSignal: request.abortSignal
45
- };
46
- const result = await generateText(request.messages && request.messages.length > 0 ? {
47
- ...baseParams,
48
- messages: request.messages
49
- } : {
50
- ...baseParams,
51
- prompt: request.prompt || "",
52
- system: request.system
53
- });
54
- return {
55
- content: result.text,
56
- model: request.model || "",
57
- provider: this.#config.name,
58
- usage: this.#convertUsage(result.usage),
59
- finishReason: result.finishReason
60
- };
61
- }
62
- /**
63
- * Stream text
64
- */
65
- async stream(request) {
66
- const baseParams = {
67
- model: this.#provider(request.model || ""),
68
- temperature: request.temperature,
69
- maxOutputTokens: request.maxTokens,
70
- maxRetries: 2,
71
- abortSignal: request.abortSignal
72
- };
73
- return await streamText(request.messages && request.messages.length > 0 ? {
74
- ...baseParams,
75
- messages: request.messages
76
- } : {
77
- ...baseParams,
78
- prompt: request.prompt || "",
79
- system: request.system
80
- });
81
- }
82
- getProviderName() {
83
- return this.#config.name;
84
- }
85
- };
86
-
87
- //#endregion
88
- export { PromptClient as t };
1
+ import{createOpenAICompatible as e}from"@ai-sdk/openai-compatible";import{generateText as t,streamText as n}from"ai";var r=class{#e;#t;constructor(t){this.#t=t,this.#e=e({name:t.name,baseURL:t.baseUrl,apiKey:t.apiKey,headers:t.headers})}#n(e){if(e)return{promptTokens:e.inputTokens??0,completionTokens:e.outputTokens??0,totalTokens:e.totalTokens??0}}async generate(e){let n={model:this.#e(e.model||``),temperature:e.temperature,maxOutputTokens:e.maxTokens,maxRetries:2,abortSignal:e.abortSignal},r=await t(e.messages&&e.messages.length>0?{...n,messages:e.messages}:{...n,prompt:e.prompt||``,system:e.system});return{content:r.text,model:e.model||``,provider:this.#t.name,usage:this.#n(r.usage),finishReason:r.finishReason}}async stream(e){let t={model:this.#e(e.model||``),temperature:e.temperature,maxOutputTokens:e.maxTokens,maxRetries:2,abortSignal:e.abortSignal};return await n(e.messages&&e.messages.length>0?{...t,messages:e.messages}:{...t,prompt:e.prompt||``,system:e.system})}getProviderName(){return this.#t.name}};export{r as t};
@@ -1,83 +1 @@
1
- import { c as InvalidScopeError, l as ProfileNotFoundError } from "./errors-pXKbCKbL.js";
2
- import { l as writeTOML, o as readTOML } from "./fsStore-S8RslR8L.js";
3
- import { t as BaseAdapter } from "./base-DtcPVpvU.js";
4
-
5
- //#region src/services/settings/adapters/codex.ts
6
- /**
7
- * Resolves ~/.codex/config.toml (user scope) and supports profile switching
8
- */
9
- var CodexAdapter = class extends BaseAdapter {
10
- toolId = "codex";
11
- /**
12
- * Custom list implementation that focuses on model_providers
13
- */
14
- async list(scope) {
15
- if (!this.validateScope(scope)) throw new InvalidScopeError(scope);
16
- const path = this.resolvePath(scope);
17
- const config = this.readConfig(path);
18
- return {
19
- type: "entries",
20
- entries: this.#extractProviders(config),
21
- filePath: path
22
- };
23
- }
24
- /**
25
- * Resolve the config path
26
- */
27
- resolvePath(scope) {
28
- switch (scope) {
29
- case "user": return "~/.codex/config.toml";
30
- default: throw new Error(`Unsupported scope for Codex: ${scope}`);
31
- }
32
- }
33
- /**
34
- * Validate the supported scope
35
- */
36
- validateScope(scope) {
37
- return scope === "user";
38
- }
39
- /**
40
- * Switch to a different Codex profile
41
- */
42
- async switchProfile(scope, profile, _options) {
43
- if (!this.validateScope(scope)) throw new InvalidScopeError(scope);
44
- const path = this.resolvePath(scope);
45
- const config = this.readConfig(path);
46
- const profilesValue = config.profiles;
47
- const profiles = isConfigObject(profilesValue) ? profilesValue : void 0;
48
- if (!profiles || !(profile in profiles)) throw new ProfileNotFoundError(profile);
49
- const profileValue = profiles[profile];
50
- if (!isConfigObject(profileValue)) throw new ProfileNotFoundError(profile);
51
- const profileConfig = profileValue;
52
- const newConfig = { ...config };
53
- for (const [key, value] of Object.entries(profileConfig)) newConfig[key] = value;
54
- newConfig.current_profile = profile;
55
- this.writeConfig(path, newConfig);
56
- return {
57
- success: true,
58
- message: `Switched to profile: ${profile}`,
59
- filePath: path
60
- };
61
- }
62
- /**
63
- * Read the TOML configuration
64
- */
65
- readConfig(path) {
66
- return readTOML(path);
67
- }
68
- /**
69
- * Write the TOML configuration
70
- */
71
- writeConfig(path, data) {
72
- writeTOML(path, data);
73
- }
74
- #extractProviders(config) {
75
- const providers = config.model_providers;
76
- if (isConfigObject(providers)) return providers;
77
- return {};
78
- }
79
- };
80
- const isConfigObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Date);
81
-
82
- //#endregion
83
- export { CodexAdapter as t };
1
+ import{c as e,l as t}from"./errors-pXKbCKbL.js";import{l as n,o as r}from"./fsStore-S8RslR8L.js";import{t as i}from"./base-DtcPVpvU.js";var a=class extends i{toolId=`codex`;async list(t){if(!this.validateScope(t))throw new e(t);let n=this.resolvePath(t),r=this.readConfig(n);return{type:`entries`,entries:this.#e(r),filePath:n}}resolvePath(e){switch(e){case`user`:return`~/.codex/config.toml`;default:throw Error(`Unsupported scope for Codex: ${e}`)}}validateScope(e){return e===`user`}async switchProfile(n,r,i){if(!this.validateScope(n))throw new e(n);let a=this.resolvePath(n),s=this.readConfig(a),c=s.profiles,l=o(c)?c:void 0;if(!l||!(r in l))throw new t(r);let u=l[r];if(!o(u))throw new t(r);let d=u,f={...s};for(let[e,t]of Object.entries(d))f[e]=t;return f.current_profile=r,this.writeConfig(a,f),{success:!0,message:`Switched to profile: ${r}`,filePath:a}}readConfig(e){return r(e)}writeConfig(e,t){n(e,t)}#e(e){let t=e.model_providers;return o(t)?t:{}}};const o=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date);export{a as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./base-CSwZL00J.js";var t=class extends e{toolId=`codex`;executable=`codex`;buildCommandSpec(e){let t=[];if(e.settings){let n=this.#e(e.settings);t.push(...n)}return e.continue?t.push(`resume`,`--last`):e.resume&&t.push(`resume`),{executable:this.executable,baseArgs:t,yoloArgs:e.yolo?[`--dangerously-bypass-approvals-and-sandbox`]:void 0}}#e(e){let t=[];if(e.includes(`=`)){let n=e.split(`;`).map(e=>e.trim());for(let e of n)e&&t.push(`-c`,e)}else t.push(`-c`,`model=${e}`);return t}};export{t};
@@ -1,37 +1,7 @@
1
- import { Command } from "@oclif/core";
2
-
3
- //#region src/commands/git/index.ts
4
- /**
5
- * git command (main entry point)
6
- * Provides utilities for git workflow (PR management, worktrees)
7
- */
8
- var Git = class extends Command {
9
- static summary = "Git workflow utilities";
10
- static description = `
1
+ import{Command as e}from"@oclif/core";var t=class extends e{static summary=`Git workflow utilities`;static description=`
11
2
  Git workflow tools for PR management and worktrees.
12
3
  Supports PR checkout with gh/git fallback, browser PR viewing, and worktree operations.
13
- `;
14
- static examples = [
15
- "<%= config.bin %> <%= command.id %>:prc --web",
16
- "<%= config.bin %> <%= command.id %>:prr 123",
17
- "<%= config.bin %> <%= command.id %>:worktree --list",
18
- "<%= config.bin %> <%= command.id %>:prv 456 --browser safari"
19
- ];
20
- async run() {
21
- this.log("Git workflow utilities for xling\n");
22
- this.log("Available subcommands:");
23
- this.log(" prc - Create PR with optional browser preview");
24
- this.log(" prr - Checkout PR branch (PR Read/Retrieve)");
25
- this.log(" prv - Open PR in web browser (PR View)");
26
- this.log(" worktree - Manage git worktrees (list, add, remove, prune)\n");
27
- this.log("Use --help with any subcommand for details");
28
- this.log("\nExamples:");
29
- this.log(" xling git:prc --web --browser chrome");
30
- this.log(" xling git:prr 123");
31
- this.log(" xling git:prv 456 --browser safari");
32
- this.log(" xling git:worktree --list");
33
- }
34
- };
35
-
36
- //#endregion
37
- export { Git as default };
4
+ `;static examples=[`<%= config.bin %> <%= command.id %>:prc --web`,`<%= config.bin %> <%= command.id %>:prr 123`,`<%= config.bin %> <%= command.id %>:worktree --list`,`<%= config.bin %> <%= command.id %>:prv 456 --browser safari`];async run(){this.log(`Git workflow utilities for xling
5
+ `),this.log(`Available subcommands:`),this.log(` prc - Create PR with optional browser preview`),this.log(` prr - Checkout PR branch (PR Read/Retrieve)`),this.log(` prv - Open PR in web browser (PR View)`),this.log(` worktree - Manage git worktrees (list, add, remove, prune)
6
+ `),this.log(`Use --help with any subcommand for details`),this.log(`
7
+ Examples:`),this.log(` xling git:prc --web --browser chrome`),this.log(` xling git:prr 123`),this.log(` xling git:prv 456 --browser safari`),this.log(` xling git:worktree --list`)}};export{t as default};