@tiflis-io/tiflis-code-workstation 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/dist/main.js +43 -3
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -134,23 +134,49 @@ function parseAgentAliases() {
|
|
|
134
134
|
console.warn(`Invalid agent alias ${key}: empty command`);
|
|
135
135
|
continue;
|
|
136
136
|
}
|
|
137
|
-
const
|
|
138
|
-
|
|
137
|
+
const envVars = {};
|
|
138
|
+
let commandStartIndex = 0;
|
|
139
|
+
for (let i = 0; i < parts.length; i++) {
|
|
140
|
+
const part = parts[i];
|
|
141
|
+
const eqIndex = part.indexOf("=");
|
|
142
|
+
if (eqIndex > 0 && !part.startsWith("-")) {
|
|
143
|
+
const varName = part.slice(0, eqIndex);
|
|
144
|
+
const varValue = part.slice(eqIndex + 1);
|
|
145
|
+
if (/^[A-Z_][A-Z0-9_]*$/.test(varName)) {
|
|
146
|
+
envVars[varName] = varValue;
|
|
147
|
+
commandStartIndex = i + 1;
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
const commandParts = parts.slice(commandStartIndex);
|
|
154
|
+
if (commandParts.length === 0) {
|
|
155
|
+
console.warn(`Invalid agent alias ${key}: no command after env vars`);
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
const baseCommand = commandParts[0];
|
|
159
|
+
const additionalArgs = commandParts.slice(1);
|
|
139
160
|
aliases.set(aliasName, {
|
|
140
161
|
name: aliasName,
|
|
141
162
|
baseCommand,
|
|
142
163
|
additionalArgs,
|
|
164
|
+
envVars,
|
|
143
165
|
rawCommand: value
|
|
144
166
|
});
|
|
145
167
|
}
|
|
146
168
|
return aliases;
|
|
147
169
|
}
|
|
148
170
|
function parseCommandString(command) {
|
|
171
|
+
let cmd = command.trim();
|
|
172
|
+
if (cmd.startsWith('"') && cmd.endsWith('"') || cmd.startsWith("'") && cmd.endsWith("'")) {
|
|
173
|
+
cmd = cmd.slice(1, -1);
|
|
174
|
+
}
|
|
149
175
|
const parts = [];
|
|
150
176
|
let current = "";
|
|
151
177
|
let inQuote = false;
|
|
152
178
|
let quoteChar = "";
|
|
153
|
-
for (const char of
|
|
179
|
+
for (const char of cmd) {
|
|
154
180
|
if (!inQuote && (char === '"' || char === "'")) {
|
|
155
181
|
inQuote = true;
|
|
156
182
|
quoteChar = char;
|
|
@@ -325,6 +351,7 @@ function getAvailableAgents() {
|
|
|
325
351
|
name: "cursor",
|
|
326
352
|
command: AGENT_COMMANDS.cursor.command,
|
|
327
353
|
aliasArgs: [],
|
|
354
|
+
aliasEnvVars: {},
|
|
328
355
|
baseType: "cursor",
|
|
329
356
|
description: AGENT_COMMANDS.cursor.description,
|
|
330
357
|
isAlias: false
|
|
@@ -333,6 +360,7 @@ function getAvailableAgents() {
|
|
|
333
360
|
name: "claude",
|
|
334
361
|
command: AGENT_COMMANDS.claude.command,
|
|
335
362
|
aliasArgs: [],
|
|
363
|
+
aliasEnvVars: {},
|
|
336
364
|
baseType: "claude",
|
|
337
365
|
description: AGENT_COMMANDS.claude.description,
|
|
338
366
|
isAlias: false
|
|
@@ -341,6 +369,7 @@ function getAvailableAgents() {
|
|
|
341
369
|
name: "opencode",
|
|
342
370
|
command: AGENT_COMMANDS.opencode.command,
|
|
343
371
|
aliasArgs: [],
|
|
372
|
+
aliasEnvVars: {},
|
|
344
373
|
baseType: "opencode",
|
|
345
374
|
description: AGENT_COMMANDS.opencode.description,
|
|
346
375
|
isAlias: false
|
|
@@ -358,6 +387,7 @@ function getAvailableAgents() {
|
|
|
358
387
|
name,
|
|
359
388
|
command: alias.baseCommand,
|
|
360
389
|
aliasArgs: alias.additionalArgs,
|
|
390
|
+
aliasEnvVars: alias.envVars,
|
|
361
391
|
baseType,
|
|
362
392
|
description: `${name} (alias for ${baseType} with custom config)`,
|
|
363
393
|
isAlias: true
|
|
@@ -2563,10 +2593,13 @@ var HeadlessAgentExecutor = class extends EventEmitter {
|
|
|
2563
2593
|
await this.killAndWait();
|
|
2564
2594
|
}
|
|
2565
2595
|
const { command, args } = this.buildCommand(prompt);
|
|
2596
|
+
const aliasEnvVars = this.getAliasEnvVars();
|
|
2566
2597
|
this.subprocess = spawn2(command, args, {
|
|
2567
2598
|
cwd: this.workingDir,
|
|
2568
2599
|
env: {
|
|
2569
2600
|
...process.env,
|
|
2601
|
+
// Apply alias env vars (e.g., CLAUDE_CONFIG_DIR)
|
|
2602
|
+
...aliasEnvVars,
|
|
2570
2603
|
// Ensure proper terminal environment
|
|
2571
2604
|
TERM: "xterm-256color",
|
|
2572
2605
|
// Disable interactive prompts
|
|
@@ -2626,6 +2659,13 @@ var HeadlessAgentExecutor = class extends EventEmitter {
|
|
|
2626
2659
|
getAliasArgs() {
|
|
2627
2660
|
return this.agentConfig?.aliasArgs ?? [];
|
|
2628
2661
|
}
|
|
2662
|
+
/**
|
|
2663
|
+
* Get alias environment variables from agent config.
|
|
2664
|
+
* Returns empty object if no alias configured.
|
|
2665
|
+
*/
|
|
2666
|
+
getAliasEnvVars() {
|
|
2667
|
+
return this.agentConfig?.aliasEnvVars ?? {};
|
|
2668
|
+
}
|
|
2629
2669
|
/**
|
|
2630
2670
|
* Build cursor-agent command.
|
|
2631
2671
|
* Format: cursor-agent [alias-args] --output-format stream-json --print [--resume <session_id>] "prompt"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiflis-io/tiflis-code-workstation",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Workstation server for tiflis-code - manages agent sessions and terminal access",
|
|
5
5
|
"author": "Roman Barinov <rbarinov@gmail.com>",
|
|
6
6
|
"license": "FSL-1.1-NC",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"vitest": "^2.1.8"
|
|
65
65
|
},
|
|
66
66
|
"engines": {
|
|
67
|
-
"node": ">=
|
|
67
|
+
"node": ">=24.0.0"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"dev": "tsx watch src/main.ts",
|