wtt-connect 0.2.1 → 0.2.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/README.md +1 -1
- package/package.json +1 -1
- package/src/main.js +5 -1
- package/src/service-manager.js +24 -0
package/README.md
CHANGED
|
@@ -142,7 +142,7 @@ Workdir rules:
|
|
|
142
142
|
|
|
143
143
|
- If `--workdir` or `WTT_CONNECT_WORKDIR` is provided, that exact directory is used for agent execution, shell, terminal, runtime info, and adapter cwd.
|
|
144
144
|
- If no workdir is provided, `wtt-connect` uses `./workspaces/<agent_id>` under the current default directory. This prevents multiple claimed agents on the same host from sharing the `wtt-connect` package directory.
|
|
145
|
-
- For an existing profile,
|
|
145
|
+
- For an existing profile, run `wtt-connect workdir <profile> /path/to/workspace --restart`. This updates `~/.config/wtt-connect/profiles/<profile>.env`, creates the directory, and restarts the service.
|
|
146
146
|
|
|
147
147
|
Useful flags:
|
|
148
148
|
|
package/package.json
CHANGED
package/src/main.js
CHANGED
|
@@ -10,7 +10,7 @@ import { DurableStore } from './store.js';
|
|
|
10
10
|
import { log, redact } from './logger.js';
|
|
11
11
|
import { adapterBin, normalizeProfileName } from './adapters/generic-cli.js';
|
|
12
12
|
import { normalizeAdapterName } from './adapters/index.js';
|
|
13
|
-
import { down, listProfiles, logs, resolveProfileEnvFile, restart, status, up } from './service-manager.js';
|
|
13
|
+
import { down, listProfiles, logs, resolveProfileEnvFile, restart, status, up, workdir } from './service-manager.js';
|
|
14
14
|
|
|
15
15
|
export async function main(args) {
|
|
16
16
|
const cmd = args[0] || 'help';
|
|
@@ -23,6 +23,7 @@ export async function main(args) {
|
|
|
23
23
|
if (cmd === 'status') return status(argv);
|
|
24
24
|
if (cmd === 'restart') return restart(argv);
|
|
25
25
|
if (cmd === 'logs') return logs(argv);
|
|
26
|
+
if (cmd === 'workdir') return workdir(argv);
|
|
26
27
|
if (cmd === 'down' || cmd === 'unlink') return down(argv);
|
|
27
28
|
if (cmd === 'doctor') return doctor(loadConfig(argv));
|
|
28
29
|
if (cmd === 'setup') return setup(loadConfig(argv), argv);
|
|
@@ -61,6 +62,7 @@ function parseArgs(args) {
|
|
|
61
62
|
else if (a === '--allow-yolo' || a === '--allow-dangerous-permissions') out.allowYolo = true;
|
|
62
63
|
else if (a === '--yes' || a === '-y') out.yes = true;
|
|
63
64
|
else if (a === '--publish-progress') out.publishProgress = true;
|
|
65
|
+
else if (a === '--restart') out.restart = true;
|
|
64
66
|
else if (a === '--enable-linger') out.enableLinger = true;
|
|
65
67
|
else if (a === '--no-start') out.noStart = true;
|
|
66
68
|
else if (a === '--node-bin') out.nodeBin = args[++i];
|
|
@@ -97,6 +99,8 @@ Commands:
|
|
|
97
99
|
status [profile|all] Show systemd service status for profiles
|
|
98
100
|
restart [profile|all] Restart one or all configured services
|
|
99
101
|
logs <profile> [--lines 100] Show service logs
|
|
102
|
+
workdir <profile> [path] [--restart]
|
|
103
|
+
Show or update the agent execution directory
|
|
100
104
|
down <profile> Stop/disable service; keep profile/state files
|
|
101
105
|
unlink <profile> Alias for down
|
|
102
106
|
setup [--claim-code] Register/write local .env and optionally print claim code
|
package/src/service-manager.js
CHANGED
|
@@ -142,6 +142,30 @@ export function logs(argv) {
|
|
|
142
142
|
throw new Error(`unsupported platform: ${process.platform}`);
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
export function workdir(argv) {
|
|
146
|
+
const [profile = '', nextDir = ''] = argv._ || [];
|
|
147
|
+
if (!profile) throw new Error('usage: wtt-connect workdir <profile> [path] [--restart]');
|
|
148
|
+
const safe = sanitizeProfile(profile);
|
|
149
|
+
const envFile = profileEnvFile(safe);
|
|
150
|
+
if (!fs.existsSync(envFile)) throw new Error(`profile not found: ${safe}`);
|
|
151
|
+
const env = readEnv(envFile);
|
|
152
|
+
if (!nextDir) {
|
|
153
|
+
console.log(env.WTT_CONNECT_WORKDIR || '');
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const resolved = path.resolve(nextDir);
|
|
157
|
+
ensureDir(resolved);
|
|
158
|
+
env.WTT_CONNECT_WORKDIR = resolved;
|
|
159
|
+
writeProfileEnv(envFile, env);
|
|
160
|
+
console.log(`updated ${safe} workdir: ${resolved}`);
|
|
161
|
+
if (argv.restart) {
|
|
162
|
+
restartService(safe);
|
|
163
|
+
console.log(`${safe}: ${serviceStatus(safe)}`);
|
|
164
|
+
} else {
|
|
165
|
+
console.log(`restart required: wtt-connect restart ${safe}`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
145
169
|
export function down(argv) {
|
|
146
170
|
const [profile = ''] = argv._ || [];
|
|
147
171
|
if (!profile) throw new Error('usage: wtt-connect down <profile>');
|