@integrity-labs/agt-cli 0.27.159 → 0.27.160
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/bin/agt.js +194 -112
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-GJVY7WKU.js → chunk-7RCGHACC.js} +2 -2
- package/dist/{chunk-5E5B4T7K.js → chunk-BC26YO7P.js} +95 -29
- package/dist/chunk-BC26YO7P.js.map +1 -0
- package/dist/{chunk-F5ZAIJHI.js → chunk-O24XVAYZ.js} +231 -26
- package/dist/{chunk-F5ZAIJHI.js.map → chunk-O24XVAYZ.js.map} +1 -1
- package/dist/{claude-pair-runtime-FTU6NTBF.js → claude-pair-runtime-G4MYOINJ.js} +2 -2
- package/dist/lib/manager-worker.js +51 -65
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/{persistent-session-EWHFMQRC.js → persistent-session-W6V2DO3R.js} +3 -3
- package/dist/{responsiveness-probe-SWHB27QI.js → responsiveness-probe-LY2H2XR5.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-5E5B4T7K.js.map +0 -1
- /package/dist/{chunk-GJVY7WKU.js.map → chunk-7RCGHACC.js.map} +0 -0
- /package/dist/{claude-pair-runtime-FTU6NTBF.js.map → claude-pair-runtime-G4MYOINJ.js.map} +0 -0
- /package/dist/{persistent-session-EWHFMQRC.js.map → persistent-session-W6V2DO3R.js.map} +0 -0
- /package/dist/{responsiveness-probe-SWHB27QI.js.map → responsiveness-probe-LY2H2XR5.js.map} +0 -0
package/dist/bin/agt.js
CHANGED
|
@@ -4,8 +4,10 @@ import {
|
|
|
4
4
|
LITERAL_SECRET_PATTERNS,
|
|
5
5
|
PROD_AGT_HOST,
|
|
6
6
|
api,
|
|
7
|
+
defaultFlagsCachePath,
|
|
7
8
|
error,
|
|
8
9
|
exchangeApiKey,
|
|
10
|
+
flagsCacheAgeSeconds,
|
|
9
11
|
getActiveTeam,
|
|
10
12
|
getApiKey,
|
|
11
13
|
getHost,
|
|
@@ -22,13 +24,16 @@ import {
|
|
|
22
24
|
managerUninstallCommand,
|
|
23
25
|
managerUninstallSystemUnitCommand,
|
|
24
26
|
provision,
|
|
27
|
+
readFlagsCache,
|
|
28
|
+
resolveAllFlags,
|
|
29
|
+
resolveFlagFromLayers,
|
|
25
30
|
setActiveTeam,
|
|
26
31
|
setJsonMode,
|
|
27
32
|
startWatchdog,
|
|
28
33
|
success,
|
|
29
34
|
table,
|
|
30
35
|
warn
|
|
31
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-O24XVAYZ.js";
|
|
32
37
|
import {
|
|
33
38
|
CHANNEL_REGISTRY,
|
|
34
39
|
DEPLOYMENT_TEMPLATES,
|
|
@@ -45,6 +50,7 @@ import {
|
|
|
45
50
|
getAllChannelIds,
|
|
46
51
|
getChannel,
|
|
47
52
|
getDefaultSlackScopes,
|
|
53
|
+
getFlagDefinition,
|
|
48
54
|
getFramework,
|
|
49
55
|
getScopesByCategory,
|
|
50
56
|
getTemplate,
|
|
@@ -54,11 +60,11 @@ import {
|
|
|
54
60
|
renderTemplate,
|
|
55
61
|
resolveChannels,
|
|
56
62
|
serializeManifestForSlackCli
|
|
57
|
-
} from "../chunk-
|
|
63
|
+
} from "../chunk-BC26YO7P.js";
|
|
58
64
|
|
|
59
65
|
// src/bin/agt.ts
|
|
60
|
-
import { join as
|
|
61
|
-
import { homedir as
|
|
66
|
+
import { join as join21 } from "path";
|
|
67
|
+
import { homedir as homedir10 } from "os";
|
|
62
68
|
import { Command } from "commander";
|
|
63
69
|
|
|
64
70
|
// src/commands/whoami.ts
|
|
@@ -119,6 +125,78 @@ async function whoamiCommand() {
|
|
|
119
125
|
}
|
|
120
126
|
}
|
|
121
127
|
|
|
128
|
+
// src/commands/flags.ts
|
|
129
|
+
import { join } from "path";
|
|
130
|
+
import { homedir } from "os";
|
|
131
|
+
function flagsResolveCommand(opts) {
|
|
132
|
+
const json = isJsonMode();
|
|
133
|
+
const configDir = opts.configDir ?? join(homedir(), ".augmented");
|
|
134
|
+
const cachePath = defaultFlagsCachePath(configDir);
|
|
135
|
+
const cache = readFlagsCache(cachePath);
|
|
136
|
+
const heartbeatFlags = cache?.flags;
|
|
137
|
+
let resolved;
|
|
138
|
+
if (opts.flag) {
|
|
139
|
+
const definition = getFlagDefinition(opts.flag);
|
|
140
|
+
if (!definition) {
|
|
141
|
+
if (json) {
|
|
142
|
+
jsonOutput({ ok: false, error: `Unknown flag '${opts.flag}'` });
|
|
143
|
+
} else {
|
|
144
|
+
error(`Unknown flag '${opts.flag}'. Run \`agt flags resolve\` to list registered flags.`);
|
|
145
|
+
}
|
|
146
|
+
process.exitCode = 1;
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
resolved = [resolveFlagFromLayers(definition, heartbeatFlags, process.env)];
|
|
150
|
+
} else {
|
|
151
|
+
resolved = resolveAllFlags(heartbeatFlags, process.env);
|
|
152
|
+
}
|
|
153
|
+
const ageSeconds = cache ? flagsCacheAgeSeconds(cache, cachePath) : null;
|
|
154
|
+
if (json) {
|
|
155
|
+
jsonOutput({
|
|
156
|
+
ok: true,
|
|
157
|
+
cache: {
|
|
158
|
+
path: cachePath,
|
|
159
|
+
present: cache !== null,
|
|
160
|
+
schema_version: cache?.schema_version ?? null,
|
|
161
|
+
age_seconds: ageSeconds === null ? null : Math.round(ageSeconds)
|
|
162
|
+
},
|
|
163
|
+
flags: resolved.map((r) => ({
|
|
164
|
+
key: r.key,
|
|
165
|
+
value: r.value,
|
|
166
|
+
source: r.source,
|
|
167
|
+
env_var: r.envVar ?? null,
|
|
168
|
+
env_masks_heartbeat: r.envMasksHeartbeat ?? false
|
|
169
|
+
}))
|
|
170
|
+
});
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
info("Feature flags \u2014 resolved env -> heartbeat-cache -> compiled default");
|
|
174
|
+
if (cache === null) {
|
|
175
|
+
info(`Cache: ${cachePath} (absent \u2014 manager hasn't cached a heartbeat yet; showing env + compiled defaults)`);
|
|
176
|
+
} else {
|
|
177
|
+
const age = ageSeconds === null ? "unknown" : `${Math.round(ageSeconds)}s`;
|
|
178
|
+
info(`Cache: ${cachePath} (age: ${age}, schema: ${cache.schema_version || "unknown"})`);
|
|
179
|
+
}
|
|
180
|
+
table(
|
|
181
|
+
["KEY", "VALUE", "SOURCE", "NOTE"],
|
|
182
|
+
resolved.map((r) => {
|
|
183
|
+
let note = "";
|
|
184
|
+
if (r.envMasksHeartbeat) {
|
|
185
|
+
note = `env ${r.envVar} masks heartbeat value`;
|
|
186
|
+
} else if (r.source === "env") {
|
|
187
|
+
note = `via ${r.envVar}`;
|
|
188
|
+
}
|
|
189
|
+
return [r.key, String(r.value), r.source, note];
|
|
190
|
+
})
|
|
191
|
+
);
|
|
192
|
+
if (opts.host && cache) {
|
|
193
|
+
const unknown = Object.keys(cache.flags).filter((key) => !getFlagDefinition(key));
|
|
194
|
+
if (unknown.length > 0) {
|
|
195
|
+
info(`Unrecognised cached keys (inert; upgrade agt-cli to consume): ${unknown.join(", ")}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
122
200
|
// src/commands/team.ts
|
|
123
201
|
import chalk2 from "chalk";
|
|
124
202
|
import ora2 from "ora";
|
|
@@ -245,7 +323,7 @@ import ora3 from "ora";
|
|
|
245
323
|
import { input, select, checkbox } from "@inquirer/prompts";
|
|
246
324
|
import { randomUUID } from "crypto";
|
|
247
325
|
import { mkdirSync, writeFileSync } from "fs";
|
|
248
|
-
import { join } from "path";
|
|
326
|
+
import { join as join2 } from "path";
|
|
249
327
|
function toSlug(name) {
|
|
250
328
|
return name.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
251
329
|
}
|
|
@@ -447,10 +525,10 @@ async function initCommand(opts) {
|
|
|
447
525
|
process.exitCode = 1;
|
|
448
526
|
return;
|
|
449
527
|
}
|
|
450
|
-
const agentDir =
|
|
528
|
+
const agentDir = join2(process.cwd(), ".augmented", codeName);
|
|
451
529
|
mkdirSync(agentDir, { recursive: true });
|
|
452
|
-
writeFileSync(
|
|
453
|
-
writeFileSync(
|
|
530
|
+
writeFileSync(join2(agentDir, "CHARTER.md"), charterMd);
|
|
531
|
+
writeFileSync(join2(agentDir, "TOOLS.md"), toolsMd);
|
|
454
532
|
spinner.succeed(`Agent "${chalk3.bold(displayName)}" created.`);
|
|
455
533
|
if (json) {
|
|
456
534
|
jsonOutput({
|
|
@@ -503,7 +581,7 @@ async function initCommand(opts) {
|
|
|
503
581
|
import chalk4 from "chalk";
|
|
504
582
|
import ora4 from "ora";
|
|
505
583
|
import { readFileSync, existsSync } from "fs";
|
|
506
|
-
import { join as
|
|
584
|
+
import { join as join3, resolve } from "path";
|
|
507
585
|
function printDiagnostics2(diagnostics) {
|
|
508
586
|
for (const d of diagnostics) {
|
|
509
587
|
const prefix = d.severity === "error" ? chalk4.red("ERR") : chalk4.yellow("WARN");
|
|
@@ -542,7 +620,7 @@ async function lintCommand(path) {
|
|
|
542
620
|
}
|
|
543
621
|
dirs.push({ name: path, dir: resolved });
|
|
544
622
|
} else {
|
|
545
|
-
const augmentedDir =
|
|
623
|
+
const augmentedDir = join3(process.cwd(), ".augmented");
|
|
546
624
|
if (!existsSync(augmentedDir)) {
|
|
547
625
|
if (json) {
|
|
548
626
|
jsonOutput({ ok: false, error: "No .augmented/ directory found" });
|
|
@@ -555,7 +633,7 @@ async function lintCommand(path) {
|
|
|
555
633
|
const { readdirSync: readdirSync7, statSync: statSync5 } = await import("fs");
|
|
556
634
|
const entries = readdirSync7(augmentedDir);
|
|
557
635
|
for (const entry of entries) {
|
|
558
|
-
const entryPath =
|
|
636
|
+
const entryPath = join3(augmentedDir, entry);
|
|
559
637
|
if (statSync5(entryPath).isDirectory()) {
|
|
560
638
|
dirs.push({ name: entry, dir: entryPath });
|
|
561
639
|
}
|
|
@@ -596,8 +674,8 @@ async function lintCommand(path) {
|
|
|
596
674
|
for (const { name, dir } of dirs) {
|
|
597
675
|
if (!json) console.log(chalk4.bold(`
|
|
598
676
|
Linting ${name}:`));
|
|
599
|
-
const charterPath =
|
|
600
|
-
const toolsPath =
|
|
677
|
+
const charterPath = join3(dir, "CHARTER.md");
|
|
678
|
+
const toolsPath = join3(dir, "TOOLS.md");
|
|
601
679
|
const hasCharter = existsSync(charterPath);
|
|
602
680
|
const hasTools = existsSync(toolsPath);
|
|
603
681
|
if (!hasCharter && !hasTools) {
|
|
@@ -765,7 +843,7 @@ import chalk6 from "chalk";
|
|
|
765
843
|
import ora6 from "ora";
|
|
766
844
|
import { checkbox as checkbox2, confirm as confirm2, input as input2 } from "@inquirer/prompts";
|
|
767
845
|
import { writeFile } from "fs/promises";
|
|
768
|
-
import { join as
|
|
846
|
+
import { join as join4 } from "path";
|
|
769
847
|
import { tmpdir } from "os";
|
|
770
848
|
async function channelSlackSetupCommand(agentCodeName, options) {
|
|
771
849
|
const teamSlug = requireTeam();
|
|
@@ -837,7 +915,7 @@ async function channelSlackSetupCommand(agentCodeName, options) {
|
|
|
837
915
|
});
|
|
838
916
|
const manifestObj = serializeManifestForSlackCli(manifest);
|
|
839
917
|
const manifestJson = JSON.stringify(manifestObj, null, 2);
|
|
840
|
-
const manifestPath =
|
|
918
|
+
const manifestPath = join4(tmpdir(), `augmented-slack-manifest-${agentCodeName}.json`);
|
|
841
919
|
await writeFile(manifestPath, manifestJson, "utf-8");
|
|
842
920
|
success(`Manifest written to ${manifestPath}`);
|
|
843
921
|
console.log(chalk6.dim(manifestJson));
|
|
@@ -1190,7 +1268,7 @@ import chalk8 from "chalk";
|
|
|
1190
1268
|
import ora8 from "ora";
|
|
1191
1269
|
import { select as select2, input as input3 } from "@inquirer/prompts";
|
|
1192
1270
|
import { writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "fs";
|
|
1193
|
-
import { join as
|
|
1271
|
+
import { join as join5 } from "path";
|
|
1194
1272
|
async function deployCommand(opts) {
|
|
1195
1273
|
const teamSlug = requireTeam();
|
|
1196
1274
|
if (!teamSlug) return;
|
|
@@ -1300,9 +1378,9 @@ async function deployCommand(opts) {
|
|
|
1300
1378
|
spinner.stop();
|
|
1301
1379
|
if (!json) info(`Warning: could not record deployment in database: ${deployErr.message}`);
|
|
1302
1380
|
}
|
|
1303
|
-
const outDir =
|
|
1381
|
+
const outDir = join5(process.cwd(), ".augmented", "deploy");
|
|
1304
1382
|
mkdirSync2(outDir, { recursive: true });
|
|
1305
|
-
const outPath =
|
|
1383
|
+
const outPath = join5(outDir, "docker-compose.yaml");
|
|
1306
1384
|
writeFileSync2(outPath, rendered);
|
|
1307
1385
|
spinner.succeed("Deployment config generated.");
|
|
1308
1386
|
if (json) {
|
|
@@ -1327,7 +1405,7 @@ async function deployCommand(opts) {
|
|
|
1327
1405
|
import chalk9 from "chalk";
|
|
1328
1406
|
import ora9 from "ora";
|
|
1329
1407
|
import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "fs";
|
|
1330
|
-
import { join as
|
|
1408
|
+
import { join as join6 } from "path";
|
|
1331
1409
|
function printDiagnostics3(diagnostics) {
|
|
1332
1410
|
for (const d of diagnostics) {
|
|
1333
1411
|
const prefix = d.severity === "error" ? chalk9.red("ERR") : chalk9.yellow("WARN");
|
|
@@ -1340,7 +1418,7 @@ async function provisionCommand(codeName, options) {
|
|
|
1340
1418
|
if (!teamSlug) return;
|
|
1341
1419
|
const json = isJsonMode();
|
|
1342
1420
|
const target = options.target ?? "local_docker";
|
|
1343
|
-
const outputDir = options.output ??
|
|
1421
|
+
const outputDir = options.output ?? join6(process.cwd(), ".augmented", codeName, "provision");
|
|
1344
1422
|
const dryRun = options.dryRun ?? false;
|
|
1345
1423
|
if (!json) console.log(chalk9.bold("\nAugmented \u2014 Provision\n"));
|
|
1346
1424
|
const spinner = ora9({ text: "Fetching agent data\u2026", isSilent: json });
|
|
@@ -1530,10 +1608,10 @@ async function provisionCommand(codeName, options) {
|
|
|
1530
1608
|
spinner.text = "Writing files\u2026";
|
|
1531
1609
|
mkdirSync3(outputDir, { recursive: true });
|
|
1532
1610
|
for (const artifact of provisionOutput.artifacts) {
|
|
1533
|
-
writeFileSync3(
|
|
1611
|
+
writeFileSync3(join6(outputDir, artifact.relativePath), artifact.content);
|
|
1534
1612
|
}
|
|
1535
1613
|
if (deploymentYaml) {
|
|
1536
|
-
writeFileSync3(
|
|
1614
|
+
writeFileSync3(join6(outputDir, "docker-compose.yaml"), deploymentYaml);
|
|
1537
1615
|
}
|
|
1538
1616
|
spinner.text = "Storing provision snapshot\u2026";
|
|
1539
1617
|
try {
|
|
@@ -1586,7 +1664,7 @@ import chalk10 from "chalk";
|
|
|
1586
1664
|
import ora10 from "ora";
|
|
1587
1665
|
import { spawn } from "child_process";
|
|
1588
1666
|
import { existsSync as existsSync6, readFileSync as readFileSync5, writeFileSync as writeFileSync7 } from "fs";
|
|
1589
|
-
import { delimiter, dirname as dirname3, join as
|
|
1667
|
+
import { delimiter, dirname as dirname3, join as join11 } from "path";
|
|
1590
1668
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1591
1669
|
|
|
1592
1670
|
// src/lib/impersonate-flag.ts
|
|
@@ -1630,16 +1708,16 @@ import {
|
|
|
1630
1708
|
rmSync,
|
|
1631
1709
|
writeFileSync as writeFileSync4
|
|
1632
1710
|
} from "fs";
|
|
1633
|
-
import { homedir } from "os";
|
|
1634
|
-
import { join as
|
|
1635
|
-
var IMPERSONATE_ROOT =
|
|
1636
|
-
var ACTIVE_DIR =
|
|
1637
|
-
var ACTIVE_MANIFEST_PATH =
|
|
1711
|
+
import { homedir as homedir2 } from "os";
|
|
1712
|
+
import { join as join7 } from "path";
|
|
1713
|
+
var IMPERSONATE_ROOT = join7(homedir2(), ".augmented-impersonate");
|
|
1714
|
+
var ACTIVE_DIR = join7(IMPERSONATE_ROOT, "active");
|
|
1715
|
+
var ACTIVE_MANIFEST_PATH = join7(ACTIVE_DIR, "manifest.json");
|
|
1638
1716
|
var SESSION_FILE_PREFIX = "session-";
|
|
1639
1717
|
var SESSION_FILE_SUFFIX = ".json";
|
|
1640
1718
|
function sessionManifestPath(projectCwd) {
|
|
1641
1719
|
const hash = createHash("sha256").update(projectCwd).digest("hex").slice(0, 16);
|
|
1642
|
-
return
|
|
1720
|
+
return join7(ACTIVE_DIR, `${SESSION_FILE_PREFIX}${hash}${SESSION_FILE_SUFFIX}`);
|
|
1643
1721
|
}
|
|
1644
1722
|
var CODE_NAME_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
1645
1723
|
function assertValidCodeName(codeName) {
|
|
@@ -1651,7 +1729,7 @@ function assertValidCodeName(codeName) {
|
|
|
1651
1729
|
}
|
|
1652
1730
|
function getImpersonateCodeNameDir(codeName) {
|
|
1653
1731
|
assertValidCodeName(codeName);
|
|
1654
|
-
return
|
|
1732
|
+
return join7(IMPERSONATE_ROOT, codeName);
|
|
1655
1733
|
}
|
|
1656
1734
|
function ensureCodeNameDir(codeName) {
|
|
1657
1735
|
assertValidCodeName(codeName);
|
|
@@ -1660,7 +1738,7 @@ function ensureCodeNameDir(codeName) {
|
|
|
1660
1738
|
return dir;
|
|
1661
1739
|
}
|
|
1662
1740
|
function ensureImpersonateWorkdir(codeName) {
|
|
1663
|
-
const dir =
|
|
1741
|
+
const dir = join7(ensureCodeNameDir(codeName), "workdir");
|
|
1664
1742
|
mkdirSync4(dir, { recursive: true });
|
|
1665
1743
|
return dir;
|
|
1666
1744
|
}
|
|
@@ -1723,7 +1801,7 @@ function listActiveManifests() {
|
|
|
1723
1801
|
if (!entry.startsWith(SESSION_FILE_PREFIX) || !entry.endsWith(SESSION_FILE_SUFFIX)) {
|
|
1724
1802
|
continue;
|
|
1725
1803
|
}
|
|
1726
|
-
const manifest = readManifestFile(
|
|
1804
|
+
const manifest = readManifestFile(join7(ACTIVE_DIR, entry));
|
|
1727
1805
|
if (manifest) out.push(manifest);
|
|
1728
1806
|
}
|
|
1729
1807
|
return out;
|
|
@@ -1758,14 +1836,14 @@ import {
|
|
|
1758
1836
|
symlinkSync,
|
|
1759
1837
|
unlinkSync
|
|
1760
1838
|
} from "fs";
|
|
1761
|
-
import { homedir as
|
|
1762
|
-
import { dirname, join as
|
|
1839
|
+
import { homedir as homedir3 } from "os";
|
|
1840
|
+
import { dirname, join as join8, parse, sep } from "path";
|
|
1763
1841
|
var BACKUP_SUFFIX = ".pre-impersonate-backup";
|
|
1764
1842
|
function findGitWorkTreeRoot(startDir) {
|
|
1765
1843
|
const { root } = parse(startDir);
|
|
1766
1844
|
let dir = startDir;
|
|
1767
1845
|
for (; ; ) {
|
|
1768
|
-
if (existsSync3(
|
|
1846
|
+
if (existsSync3(join8(dir, ".git"))) return dir;
|
|
1769
1847
|
if (dir === root) return null;
|
|
1770
1848
|
const parent = dirname(dir);
|
|
1771
1849
|
if (parent === dir) return null;
|
|
@@ -1780,7 +1858,7 @@ function swapInPersonaFile(projectPath, personaPath) {
|
|
|
1780
1858
|
const stat = lstatSync(projectPath);
|
|
1781
1859
|
if (stat.isSymbolicLink()) {
|
|
1782
1860
|
const target = readlinkSync(projectPath);
|
|
1783
|
-
const ourRoot = realpathSync(
|
|
1861
|
+
const ourRoot = realpathSync(homedir3()) + sep + ".augmented-impersonate" + sep;
|
|
1784
1862
|
let resolvedTarget;
|
|
1785
1863
|
try {
|
|
1786
1864
|
resolvedTarget = realpathSync(projectPath);
|
|
@@ -1848,14 +1926,14 @@ import {
|
|
|
1848
1926
|
unlinkSync as unlinkSync2,
|
|
1849
1927
|
writeFileSync as writeFileSync5
|
|
1850
1928
|
} from "fs";
|
|
1851
|
-
import { join as
|
|
1929
|
+
import { join as join9 } from "path";
|
|
1852
1930
|
var INTRODUCE_HOOK_COMMAND = "agt impersonate introduce";
|
|
1853
1931
|
var SESSION_START_MATCHER = "startup";
|
|
1854
1932
|
function registerIntroduceHook(projectCwd, command = INTRODUCE_HOOK_COMMAND) {
|
|
1855
|
-
const claudeDir =
|
|
1933
|
+
const claudeDir = join9(projectCwd, ".claude");
|
|
1856
1934
|
const createdClaudeDir = !existsSync4(claudeDir);
|
|
1857
1935
|
mkdirSync5(claudeDir, { recursive: true });
|
|
1858
|
-
const settingsPath =
|
|
1936
|
+
const settingsPath = join9(claudeDir, "settings.local.json");
|
|
1859
1937
|
const settingsExisted = existsSync4(settingsPath);
|
|
1860
1938
|
const backupPath = settingsPath + BACKUP_SUFFIX;
|
|
1861
1939
|
let settings = {};
|
|
@@ -1942,11 +2020,11 @@ import {
|
|
|
1942
2020
|
unlinkSync as unlinkSync3,
|
|
1943
2021
|
writeFileSync as writeFileSync6
|
|
1944
2022
|
} from "fs";
|
|
1945
|
-
import { homedir as
|
|
1946
|
-
import { dirname as dirname2, join as
|
|
2023
|
+
import { homedir as homedir4 } from "os";
|
|
2024
|
+
import { dirname as dirname2, join as join10 } from "path";
|
|
1947
2025
|
import { fileURLToPath } from "url";
|
|
1948
|
-
var INSTALLED_STATUSLINE_PATH =
|
|
1949
|
-
|
|
2026
|
+
var INSTALLED_STATUSLINE_PATH = join10(
|
|
2027
|
+
homedir4(),
|
|
1950
2028
|
".augmented-impersonate",
|
|
1951
2029
|
"statusline.sh"
|
|
1952
2030
|
);
|
|
@@ -1965,10 +2043,10 @@ function registerStatusLine(projectCwd, options = {}) {
|
|
|
1965
2043
|
if (options.installAsset !== false) {
|
|
1966
2044
|
installStatusLineAsset();
|
|
1967
2045
|
}
|
|
1968
|
-
const claudeDir =
|
|
2046
|
+
const claudeDir = join10(projectCwd, ".claude");
|
|
1969
2047
|
const createdClaudeDir = !existsSync5(claudeDir);
|
|
1970
2048
|
mkdirSync6(claudeDir, { recursive: true });
|
|
1971
|
-
const settingsPath =
|
|
2049
|
+
const settingsPath = join10(claudeDir, "settings.local.json");
|
|
1972
2050
|
const settingsExisted = existsSync5(settingsPath);
|
|
1973
2051
|
const backupPath = settingsPath + BACKUP_SUFFIX;
|
|
1974
2052
|
let settings = {};
|
|
@@ -2016,11 +2094,11 @@ function resolveBundledAssetPath() {
|
|
|
2016
2094
|
const moduleDir = dirname2(fileURLToPath(import.meta.url));
|
|
2017
2095
|
const candidates = [
|
|
2018
2096
|
// Built output: dist/<chunk>.js → dist/assets/...
|
|
2019
|
-
|
|
2097
|
+
join10(moduleDir, "assets", "impersonate-statusline.sh"),
|
|
2020
2098
|
// Built output sibling case: dist/<sub>/<chunk>.js → dist/assets/...
|
|
2021
|
-
|
|
2099
|
+
join10(moduleDir, "..", "assets", "impersonate-statusline.sh"),
|
|
2022
2100
|
// Dev source: src/lib/impersonate-statusline.ts → ../../assets/...
|
|
2023
|
-
|
|
2101
|
+
join10(moduleDir, "..", "..", "assets", "impersonate-statusline.sh")
|
|
2024
2102
|
];
|
|
2025
2103
|
for (const candidate of candidates) {
|
|
2026
2104
|
if (existsSync5(candidate)) return candidate;
|
|
@@ -2228,11 +2306,11 @@ async function impersonateConnectCommand(token, options = {}) {
|
|
|
2228
2306
|
spinner.text = "Writing persona files\u2026";
|
|
2229
2307
|
const personaDir = ensureCodeNameDir(bundle.agent.code_name);
|
|
2230
2308
|
writeFileSync7(
|
|
2231
|
-
|
|
2309
|
+
join11(personaDir, "CLAUDE.md"),
|
|
2232
2310
|
bundle.artifacts["CLAUDE.md"]
|
|
2233
2311
|
);
|
|
2234
2312
|
writeFileSync7(
|
|
2235
|
-
|
|
2313
|
+
join11(personaDir, ".mcp.json"),
|
|
2236
2314
|
rewriteMcpJsonForImpersonation(bundle.artifacts[".mcp.json"], {
|
|
2237
2315
|
operatorHome: process.env.HOME ?? "",
|
|
2238
2316
|
operatorPath: resolveOperatorPath(),
|
|
@@ -2261,8 +2339,8 @@ async function impersonateConnectCommand(token, options = {}) {
|
|
|
2261
2339
|
let statusLineBackup;
|
|
2262
2340
|
try {
|
|
2263
2341
|
for (const file of SWAP_FILES) {
|
|
2264
|
-
const projectPath =
|
|
2265
|
-
const kind = swapInPersonaFile(projectPath,
|
|
2342
|
+
const projectPath = join11(projectCwd, file);
|
|
2343
|
+
const kind = swapInPersonaFile(projectPath, join11(personaDir, file));
|
|
2266
2344
|
backups[file] = kind;
|
|
2267
2345
|
swapped.push({ file, kind });
|
|
2268
2346
|
}
|
|
@@ -2298,7 +2376,7 @@ async function impersonateConnectCommand(token, options = {}) {
|
|
|
2298
2376
|
}
|
|
2299
2377
|
for (const { file, kind } of [...swapped].reverse()) {
|
|
2300
2378
|
try {
|
|
2301
|
-
restoreSwapped(
|
|
2379
|
+
restoreSwapped(join11(projectCwd, file), kind);
|
|
2302
2380
|
} catch {
|
|
2303
2381
|
}
|
|
2304
2382
|
}
|
|
@@ -2506,7 +2584,7 @@ async function performImpersonateExit(manifest, opts) {
|
|
|
2506
2584
|
}
|
|
2507
2585
|
const restored = [];
|
|
2508
2586
|
for (const [file, kind] of Object.entries(manifest.backups)) {
|
|
2509
|
-
const projectPath =
|
|
2587
|
+
const projectPath = join11(manifest.project_cwd, file);
|
|
2510
2588
|
try {
|
|
2511
2589
|
restoreSwapped(projectPath, kind);
|
|
2512
2590
|
restored.push(file);
|
|
@@ -2584,8 +2662,8 @@ async function impersonateIntroduceCommand() {
|
|
|
2584
2662
|
const manifest = readActiveManifest(process.cwd());
|
|
2585
2663
|
if (!manifest || isExpired(manifest)) return;
|
|
2586
2664
|
const cwd = manifest.project_cwd;
|
|
2587
|
-
const identity = readClaudeMdIdentity(
|
|
2588
|
-
const integrations = readMcpIntegrations(
|
|
2665
|
+
const identity = readClaudeMdIdentity(join11(cwd, "CLAUDE.md"));
|
|
2666
|
+
const integrations = readMcpIntegrations(join11(cwd, ".mcp.json"));
|
|
2589
2667
|
const intro = buildIntroduction({
|
|
2590
2668
|
displayName: identity.displayName,
|
|
2591
2669
|
codeName: manifest.code_name,
|
|
@@ -2613,12 +2691,12 @@ function readMcpIntegrations(path) {
|
|
|
2613
2691
|
function resolveCliMcpBundleDir() {
|
|
2614
2692
|
const moduleDir = dirname3(fileURLToPath2(import.meta.url));
|
|
2615
2693
|
const candidates = [
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2694
|
+
join11(moduleDir, "mcp"),
|
|
2695
|
+
join11(moduleDir, "..", "mcp"),
|
|
2696
|
+
join11(moduleDir, "..", "..", "mcp")
|
|
2619
2697
|
];
|
|
2620
2698
|
for (const candidate of candidates) {
|
|
2621
|
-
if (existsSync6(
|
|
2699
|
+
if (existsSync6(join11(candidate, "index.js"))) return candidate;
|
|
2622
2700
|
}
|
|
2623
2701
|
return candidates[candidates.length - 1];
|
|
2624
2702
|
}
|
|
@@ -2647,7 +2725,7 @@ function buildImpersonateClaudeLaunch(projectCwd, inheritEnv = process.env, agen
|
|
|
2647
2725
|
args: [
|
|
2648
2726
|
"--strict-mcp-config",
|
|
2649
2727
|
"--mcp-config",
|
|
2650
|
-
|
|
2728
|
+
join11(projectCwd, ".mcp.json")
|
|
2651
2729
|
],
|
|
2652
2730
|
env
|
|
2653
2731
|
};
|
|
@@ -2660,7 +2738,7 @@ import ora11 from "ora";
|
|
|
2660
2738
|
// ../../packages/core/dist/drift/live-state-reader.js
|
|
2661
2739
|
import { readFile } from "fs/promises";
|
|
2662
2740
|
import { createHash as createHash2 } from "crypto";
|
|
2663
|
-
import { join as
|
|
2741
|
+
import { join as join12 } from "path";
|
|
2664
2742
|
import JSON5 from "json5";
|
|
2665
2743
|
async function hashFile(filePath) {
|
|
2666
2744
|
try {
|
|
@@ -2684,8 +2762,8 @@ async function readLiveState(options) {
|
|
|
2684
2762
|
const toolsFile = trackedFiles.find((f) => f.includes("TOOLS")) ?? "TOOLS.md";
|
|
2685
2763
|
const [frameworkConfig, charterHash, toolsHash] = await Promise.all([
|
|
2686
2764
|
readJsonFile(options.configPath),
|
|
2687
|
-
hashFile(
|
|
2688
|
-
hashFile(
|
|
2765
|
+
hashFile(join12(options.teamDir, charterFile)),
|
|
2766
|
+
hashFile(join12(options.teamDir, toolsFile))
|
|
2689
2767
|
]);
|
|
2690
2768
|
return {
|
|
2691
2769
|
frameworkConfig,
|
|
@@ -3386,14 +3464,14 @@ function terminate(child) {
|
|
|
3386
3464
|
import { useEffect, useState, useMemo } from "react";
|
|
3387
3465
|
import { render, Box, Text, useApp, useInput } from "ink";
|
|
3388
3466
|
import { existsSync as existsSync7, readFileSync as readFileSync6, statSync, openSync, readSync, closeSync } from "fs";
|
|
3389
|
-
import { homedir as
|
|
3390
|
-
import { join as
|
|
3467
|
+
import { homedir as homedir5 } from "os";
|
|
3468
|
+
import { join as join13 } from "path";
|
|
3391
3469
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3392
3470
|
var REFRESH_MS = 1e3;
|
|
3393
3471
|
var LOG_TAIL_LINES = 200;
|
|
3394
3472
|
var DETAIL_RECENT_LINES = 50;
|
|
3395
3473
|
function managerWatchCommand(opts = {}) {
|
|
3396
|
-
const configDir = opts.configDir ??
|
|
3474
|
+
const configDir = opts.configDir ?? join13(homedir5(), ".augmented");
|
|
3397
3475
|
const paths = getManagerPaths(configDir);
|
|
3398
3476
|
const isTty = process.stdout.isTTY === true && process.stdin.isTTY === true;
|
|
3399
3477
|
if (opts.noTui || !isTty) {
|
|
@@ -3713,11 +3791,11 @@ Start the manager first: agt manager start
|
|
|
3713
3791
|
import chalk14 from "chalk";
|
|
3714
3792
|
import JSON52 from "json5";
|
|
3715
3793
|
import { readFileSync as readFileSync7, existsSync as existsSync8 } from "fs";
|
|
3716
|
-
import { join as
|
|
3794
|
+
import { join as join14 } from "path";
|
|
3717
3795
|
async function agentShowCommand(codeName, opts) {
|
|
3718
3796
|
const json = isJsonMode();
|
|
3719
|
-
const unifiedDir =
|
|
3720
|
-
const legacyDir =
|
|
3797
|
+
const unifiedDir = join14(opts.configDir, codeName, "provision");
|
|
3798
|
+
const legacyDir = join14(opts.configDir, codeName, "claudecode", "provision");
|
|
3721
3799
|
const agentDir = existsSync8(unifiedDir) ? unifiedDir : legacyDir;
|
|
3722
3800
|
const hasLocalConfig = existsSync8(agentDir);
|
|
3723
3801
|
let apiChannels = null;
|
|
@@ -3752,7 +3830,7 @@ async function agentShowCommand(codeName, opts) {
|
|
|
3752
3830
|
let openclawConfig = null;
|
|
3753
3831
|
let agentState = null;
|
|
3754
3832
|
if (hasLocalConfig) {
|
|
3755
|
-
const charterPath =
|
|
3833
|
+
const charterPath = join14(agentDir, "CHARTER.md");
|
|
3756
3834
|
if (existsSync8(charterPath)) {
|
|
3757
3835
|
const raw = readFileSync7(charterPath, "utf-8");
|
|
3758
3836
|
const parsed = extractFrontmatter(raw);
|
|
@@ -3760,7 +3838,7 @@ async function agentShowCommand(codeName, opts) {
|
|
|
3760
3838
|
charter = parsed.frontmatter;
|
|
3761
3839
|
}
|
|
3762
3840
|
}
|
|
3763
|
-
const toolsPath =
|
|
3841
|
+
const toolsPath = join14(agentDir, "TOOLS.md");
|
|
3764
3842
|
if (existsSync8(toolsPath)) {
|
|
3765
3843
|
const raw = readFileSync7(toolsPath, "utf-8");
|
|
3766
3844
|
const parsed = extractFrontmatter(raw);
|
|
@@ -3768,7 +3846,7 @@ async function agentShowCommand(codeName, opts) {
|
|
|
3768
3846
|
tools = parsed.frontmatter;
|
|
3769
3847
|
}
|
|
3770
3848
|
}
|
|
3771
|
-
const openclawPath =
|
|
3849
|
+
const openclawPath = join14(agentDir, "openclaw.json5");
|
|
3772
3850
|
if (existsSync8(openclawPath)) {
|
|
3773
3851
|
try {
|
|
3774
3852
|
const raw = readFileSync7(openclawPath, "utf-8");
|
|
@@ -3776,7 +3854,7 @@ async function agentShowCommand(codeName, opts) {
|
|
|
3776
3854
|
} catch {
|
|
3777
3855
|
}
|
|
3778
3856
|
}
|
|
3779
|
-
const statePath =
|
|
3857
|
+
const statePath = join14(opts.configDir, "manager-state.json");
|
|
3780
3858
|
if (existsSync8(statePath)) {
|
|
3781
3859
|
try {
|
|
3782
3860
|
const raw = readFileSync7(statePath, "utf-8");
|
|
@@ -4117,23 +4195,23 @@ async function kanbanRecurringDisableCommand(titleOrId, opts) {
|
|
|
4117
4195
|
|
|
4118
4196
|
// src/commands/setup.ts
|
|
4119
4197
|
import { existsSync as existsSync9, readFileSync as readFileSync8, writeFileSync as writeFileSync8, mkdirSync as mkdirSync7, accessSync, constants as fsConstants } from "fs";
|
|
4120
|
-
import { join as
|
|
4121
|
-
import { homedir as
|
|
4198
|
+
import { join as join15, dirname as dirname4 } from "path";
|
|
4199
|
+
import { homedir as homedir6 } from "os";
|
|
4122
4200
|
import chalk16 from "chalk";
|
|
4123
4201
|
import ora14 from "ora";
|
|
4124
4202
|
function detectShellProfile() {
|
|
4125
4203
|
const shell = process.env["SHELL"] ?? "";
|
|
4126
|
-
const home =
|
|
4204
|
+
const home = homedir6();
|
|
4127
4205
|
if (shell.includes("zsh")) {
|
|
4128
|
-
return
|
|
4206
|
+
return join15(home, ".zshrc");
|
|
4129
4207
|
}
|
|
4130
4208
|
if (shell.includes("fish")) {
|
|
4131
|
-
const fishConfig =
|
|
4209
|
+
const fishConfig = join15(home, ".config", "fish", "config.fish");
|
|
4132
4210
|
return fishConfig;
|
|
4133
4211
|
}
|
|
4134
|
-
const bashrc =
|
|
4212
|
+
const bashrc = join15(home, ".bashrc");
|
|
4135
4213
|
if (existsSync9(bashrc)) return bashrc;
|
|
4136
|
-
return
|
|
4214
|
+
return join15(home, ".bash_profile");
|
|
4137
4215
|
}
|
|
4138
4216
|
function maybeWriteSystemWideEnv(apiUrl, apiKey, consoleUrl) {
|
|
4139
4217
|
const empty = { etcEnvironment: false, profileD: false, bashrc: false };
|
|
@@ -4390,7 +4468,7 @@ async function setupCommand(token, options = {}) {
|
|
|
4390
4468
|
const managerSpinner = ora14({ text: "Starting manager daemon\u2026", isSilent: json });
|
|
4391
4469
|
managerSpinner.start();
|
|
4392
4470
|
try {
|
|
4393
|
-
const configDir =
|
|
4471
|
+
const configDir = join15(homedir6(), ".augmented");
|
|
4394
4472
|
const { pid } = startWatchdog({ intervalMs: 1e4, configDir, detached: true });
|
|
4395
4473
|
managerSpinner.succeed(`Manager started (PID ${pid})`);
|
|
4396
4474
|
} catch (err) {
|
|
@@ -4941,7 +5019,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
4941
5019
|
import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
|
|
4942
5020
|
import chalk18 from "chalk";
|
|
4943
5021
|
import ora16 from "ora";
|
|
4944
|
-
var cliVersion = true ? "0.27.
|
|
5022
|
+
var cliVersion = true ? "0.27.160" : "dev";
|
|
4945
5023
|
async function fetchLatestVersion() {
|
|
4946
5024
|
const host2 = getHost();
|
|
4947
5025
|
if (!host2) return null;
|
|
@@ -5173,12 +5251,12 @@ async function checkForUpdateOnStartup() {
|
|
|
5173
5251
|
}
|
|
5174
5252
|
|
|
5175
5253
|
// src/commands/audit-subagents.ts
|
|
5176
|
-
import { homedir as
|
|
5177
|
-
import { join as
|
|
5254
|
+
import { homedir as homedir7 } from "os";
|
|
5255
|
+
import { join as join17 } from "path";
|
|
5178
5256
|
|
|
5179
5257
|
// src/lib/subagent-mcp-audit.ts
|
|
5180
5258
|
import { readdirSync as readdirSync4, readFileSync as readFileSync9, statSync as statSync2 } from "fs";
|
|
5181
|
-
import { join as
|
|
5259
|
+
import { join as join16 } from "path";
|
|
5182
5260
|
function parseFrontmatter(content) {
|
|
5183
5261
|
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
5184
5262
|
if (!match) return null;
|
|
@@ -5228,7 +5306,7 @@ function findSubagentFiles(dir, depth = 0) {
|
|
|
5228
5306
|
const out = [];
|
|
5229
5307
|
const isAgentsDir = dir.endsWith("/agents") || dir.endsWith("\\agents");
|
|
5230
5308
|
for (const entry of entries) {
|
|
5231
|
-
const full =
|
|
5309
|
+
const full = join16(dir, entry);
|
|
5232
5310
|
let s;
|
|
5233
5311
|
try {
|
|
5234
5312
|
s = statSync2(full);
|
|
@@ -5275,11 +5353,11 @@ function formatFinding(f) {
|
|
|
5275
5353
|
|
|
5276
5354
|
// src/commands/audit-subagents.ts
|
|
5277
5355
|
function defaultRoots() {
|
|
5278
|
-
const home =
|
|
5356
|
+
const home = homedir7();
|
|
5279
5357
|
return [
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5358
|
+
join17(home, ".claude", "agents"),
|
|
5359
|
+
join17(home, ".claude", "plugins"),
|
|
5360
|
+
join17(process.cwd(), ".claude", "agents")
|
|
5283
5361
|
];
|
|
5284
5362
|
}
|
|
5285
5363
|
async function auditSubagentsCommand(options = {}) {
|
|
@@ -5315,8 +5393,8 @@ async function auditSubagentsCommand(options = {}) {
|
|
|
5315
5393
|
|
|
5316
5394
|
// src/lib/mcp-render-allowlist-audit.ts
|
|
5317
5395
|
import { readdirSync as readdirSync5, readFileSync as readFileSync10, statSync as statSync3 } from "fs";
|
|
5318
|
-
import { homedir as
|
|
5319
|
-
import { join as
|
|
5396
|
+
import { homedir as homedir8 } from "os";
|
|
5397
|
+
import { join as join18 } from "path";
|
|
5320
5398
|
function expectedWildcard(serverKey) {
|
|
5321
5399
|
return `mcp__${serverKey.replace(/-/g, "_")}__*`;
|
|
5322
5400
|
}
|
|
@@ -5335,7 +5413,7 @@ function readMcpServerKeys(mcpJsonPath) {
|
|
|
5335
5413
|
return null;
|
|
5336
5414
|
}
|
|
5337
5415
|
}
|
|
5338
|
-
function auditMcpRenderAllowlist(rootDir =
|
|
5416
|
+
function auditMcpRenderAllowlist(rootDir = join18(homedir8(), ".augmented")) {
|
|
5339
5417
|
const findings = [];
|
|
5340
5418
|
let entries;
|
|
5341
5419
|
try {
|
|
@@ -5344,7 +5422,7 @@ function auditMcpRenderAllowlist(rootDir = join17(homedir7(), ".augmented")) {
|
|
|
5344
5422
|
return findings;
|
|
5345
5423
|
}
|
|
5346
5424
|
for (const entry of entries) {
|
|
5347
|
-
const agentDir =
|
|
5425
|
+
const agentDir = join18(rootDir, entry);
|
|
5348
5426
|
let s;
|
|
5349
5427
|
try {
|
|
5350
5428
|
s = statSync3(agentDir);
|
|
@@ -5353,12 +5431,12 @@ function auditMcpRenderAllowlist(rootDir = join17(homedir7(), ".augmented")) {
|
|
|
5353
5431
|
}
|
|
5354
5432
|
if (!s.isDirectory() || entry.startsWith("_") || entry.startsWith(".")) continue;
|
|
5355
5433
|
for (const scope of ["provision", "project"]) {
|
|
5356
|
-
const mcpJsonPath = scope === "provision" ?
|
|
5434
|
+
const mcpJsonPath = scope === "provision" ? join18(agentDir, "provision", ".mcp.json") : join18(agentDir, "project", ".mcp.json");
|
|
5357
5435
|
const keys = readMcpServerKeys(mcpJsonPath);
|
|
5358
5436
|
if (keys === null || keys.length === 0) continue;
|
|
5359
5437
|
const expected = new Set(keys.map(expectedWildcard));
|
|
5360
5438
|
for (const subagent of ["channel-message-handler", "augmented-worker"]) {
|
|
5361
|
-
const mdPath = scope === "provision" ?
|
|
5439
|
+
const mdPath = scope === "provision" ? join18(agentDir, ".claude", "agents", `${subagent}.md`) : join18(agentDir, "project", ".claude", "agents", `${subagent}.md`);
|
|
5362
5440
|
let content;
|
|
5363
5441
|
try {
|
|
5364
5442
|
content = readFileSync10(mdPath, "utf-8");
|
|
@@ -5419,12 +5497,12 @@ async function auditMcpRenderCommand(options = {}) {
|
|
|
5419
5497
|
}
|
|
5420
5498
|
|
|
5421
5499
|
// src/commands/audit-secrets.ts
|
|
5422
|
-
import { homedir as
|
|
5423
|
-
import { join as
|
|
5500
|
+
import { homedir as homedir9 } from "os";
|
|
5501
|
+
import { join as join20 } from "path";
|
|
5424
5502
|
|
|
5425
5503
|
// src/lib/secret-leak-audit.ts
|
|
5426
5504
|
import { readdirSync as readdirSync6, readFileSync as readFileSync11, statSync as statSync4 } from "fs";
|
|
5427
|
-
import { join as
|
|
5505
|
+
import { join as join19 } from "path";
|
|
5428
5506
|
var SECRET_KEY_NAME_RE = /TOKEN|KEY|SECRET|BEARER|PASSWORD/i;
|
|
5429
5507
|
function isTemplated(value) {
|
|
5430
5508
|
return value.includes("${");
|
|
@@ -5494,15 +5572,15 @@ function auditSecretLeaks(augmentedRoot) {
|
|
|
5494
5572
|
return findings;
|
|
5495
5573
|
}
|
|
5496
5574
|
for (const agent2 of agents) {
|
|
5497
|
-
const agentDir =
|
|
5575
|
+
const agentDir = join19(augmentedRoot, agent2);
|
|
5498
5576
|
try {
|
|
5499
5577
|
if (!statSync4(agentDir).isDirectory()) continue;
|
|
5500
5578
|
} catch {
|
|
5501
5579
|
continue;
|
|
5502
5580
|
}
|
|
5503
|
-
scanMcpFile(
|
|
5504
|
-
scanMcpFile(
|
|
5505
|
-
scanEnvIntegrations(
|
|
5581
|
+
scanMcpFile(join19(agentDir, "provision", ".mcp.json"), agent2, findings);
|
|
5582
|
+
scanMcpFile(join19(agentDir, "project", ".mcp.json"), agent2, findings);
|
|
5583
|
+
scanEnvIntegrations(join19(agentDir, ".env.integrations"), agent2, findings);
|
|
5506
5584
|
}
|
|
5507
5585
|
return findings;
|
|
5508
5586
|
}
|
|
@@ -5528,7 +5606,7 @@ function describe(f) {
|
|
|
5528
5606
|
return `secret file is mode ${f.mode} (expected 0600)`;
|
|
5529
5607
|
}
|
|
5530
5608
|
async function auditSecretsCommand(options = {}) {
|
|
5531
|
-
const root = options.root ??
|
|
5609
|
+
const root = options.root ?? join20(homedir9(), ".augmented");
|
|
5532
5610
|
const findings = auditSecretLeaks(root);
|
|
5533
5611
|
if (options.json) {
|
|
5534
5612
|
process.stdout.write(`${JSON.stringify({ findings, root }, null, 2)}
|
|
@@ -5864,7 +5942,7 @@ function handleError(err) {
|
|
|
5864
5942
|
}
|
|
5865
5943
|
|
|
5866
5944
|
// src/bin/agt.ts
|
|
5867
|
-
var cliVersion2 = true ? "0.27.
|
|
5945
|
+
var cliVersion2 = true ? "0.27.160" : "dev";
|
|
5868
5946
|
var program = new Command();
|
|
5869
5947
|
program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
|
|
5870
5948
|
program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
@@ -5880,6 +5958,10 @@ program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
|
5880
5958
|
}
|
|
5881
5959
|
});
|
|
5882
5960
|
program.command("whoami").description("Show the authenticated host, team, and user from AGT_API_KEY").action(whoamiCommand);
|
|
5961
|
+
var flags = program.command("flags").description("Inspect feature flags resolved on this host (ADR-0022)");
|
|
5962
|
+
flags.command("resolve").description("Print each flag\u2019s effective value and source layer (env / heartbeat-cache / compiled default)").option("--flag <key>", "Resolve a single flag by key instead of all registered flags").option("--host", "Show host-cache diagnostics (unrecognised cached keys from a newer API)").option("--config-dir <path>", "Manager config dir holding flags-cache.json (default ~/.augmented)").action((opts) => {
|
|
5963
|
+
flagsResolveCommand(opts);
|
|
5964
|
+
});
|
|
5883
5965
|
program.command("setup <token>").description("One-command host setup: exchange provisioning token, configure env vars, verify, and start manager").option(
|
|
5884
5966
|
"--api-host <url>",
|
|
5885
5967
|
// ENG-5831: required when AGT_HOST is not set in the shell — the setup
|
|
@@ -5957,16 +6039,16 @@ host.command("pair <host-name>").description("Start an SSM port-forward + shell
|
|
|
5957
6039
|
})
|
|
5958
6040
|
);
|
|
5959
6041
|
var manager = program.command("manager").description("Host config sync daemon \u2014 keeps local agent files in sync with API");
|
|
5960
|
-
manager.command("start").description("Start the manager daemon (polls API for config changes and detects local drift)").option("--interval <seconds>", "Poll interval in seconds (min 5)", "10").option("--config-dir <dir>", "Config directory for agent files",
|
|
5961
|
-
manager.command("stop").description("Stop the running manager daemon").option("--config-dir <dir>", "Config directory for agent files",
|
|
5962
|
-
manager.command("status").description("Show the current manager daemon status and discovered agents").option("--config-dir <dir>", "Config directory for agent files",
|
|
5963
|
-
manager.command("watch").description("Live TUI dashboard \u2014 per-agent boxes, drill-in, log tail. Read-only (ENG-4555).").option("--config-dir <dir>", "Config directory for agent files",
|
|
5964
|
-
manager.command("install").description("Install OS-level supervisor (launchd LaunchAgent on macOS) so the manager auto-restarts after crash, reboot, or self-update (ENG-4593)").option("--interval <seconds>", "Poll interval in seconds (min 5)", "10").option("--config-dir <dir>", "Config directory for agent files",
|
|
6042
|
+
manager.command("start").description("Start the manager daemon (polls API for config changes and detects local drift)").option("--interval <seconds>", "Poll interval in seconds (min 5)", "10").option("--config-dir <dir>", "Config directory for agent files", join21(homedir10(), ".augmented")).option("--supervise", "Wrap the manager in a respawn-on-clean-exit loop so auto-upgrades can restart it transparently (ENG-4488)", false).action(managerStartCommand);
|
|
6043
|
+
manager.command("stop").description("Stop the running manager daemon").option("--config-dir <dir>", "Config directory for agent files", join21(homedir10(), ".augmented")).action(managerStopCommand);
|
|
6044
|
+
manager.command("status").description("Show the current manager daemon status and discovered agents").option("--config-dir <dir>", "Config directory for agent files", join21(homedir10(), ".augmented")).action(managerStatusCommand);
|
|
6045
|
+
manager.command("watch").description("Live TUI dashboard \u2014 per-agent boxes, drill-in, log tail. Read-only (ENG-4555).").option("--config-dir <dir>", "Config directory for agent files", join21(homedir10(), ".augmented")).option("--no-tui", "Skip the TUI and stream the manager log to stdout instead (CI / scripts)").action(managerWatchCommand);
|
|
6046
|
+
manager.command("install").description("Install OS-level supervisor (launchd LaunchAgent on macOS) so the manager auto-restarts after crash, reboot, or self-update (ENG-4593)").option("--interval <seconds>", "Poll interval in seconds (min 5)", "10").option("--config-dir <dir>", "Config directory for agent files", join21(homedir10(), ".augmented")).action(managerInstallCommand);
|
|
5965
6047
|
manager.command("uninstall").description("Remove the OS-level supervisor (launchctl unload + delete plist on macOS). Idempotent.").action(managerUninstallCommand);
|
|
5966
6048
|
manager.command("install-system-unit").description("Install a system-level systemd unit (Linux, root) so the manager auto-starts on every boot. For headless EC2 hosts \u2014 survives reboot without `loginctl enable-linger`. (ENG-4706)").option("--interval <seconds>", "Poll interval in seconds (min 5)", "10").option("--config-dir <dir>", "Config directory for agent files (defaults to /root/.augmented or /home/<user>/.augmented)").option("--user <name>", "Unix user the manager runs as", "root").action(managerInstallSystemUnitCommand);
|
|
5967
6049
|
manager.command("uninstall-system-unit").description("Remove the system-level systemd unit (Linux, root). Idempotent. (ENG-4706)").action(managerUninstallSystemUnitCommand);
|
|
5968
6050
|
var agent = program.command("agent").description("Inspect and manage agents");
|
|
5969
|
-
agent.command("show <code-name>").description("Display an agent's provisioned OpenClaw configuration").option("--config-dir <dir>", "Config directory",
|
|
6051
|
+
agent.command("show <code-name>").description("Display an agent's provisioned OpenClaw configuration").option("--config-dir <dir>", "Config directory", join21(homedir10(), ".augmented")).option("--all-channels", "Show all channels (including disabled)").action(agentShowCommand);
|
|
5970
6052
|
var kanban = program.command("kanban").description("Manage agent kanban boards");
|
|
5971
6053
|
kanban.command("list").description("List kanban board items for an agent").requiredOption("--agent <code-name>", "Agent code name").action(kanbanListCommand);
|
|
5972
6054
|
kanban.command("add <title>").description("Add a new item to an agent kanban board").requiredOption("--agent <code-name>", "Agent code name").option("--priority <1|2|3>", "Priority: 1=high, 2=medium, 3=low", "2").option("--status <status>", "Initial status: backlog | todo | in_progress", "todo").option("--description <text>", "Item description").option("--estimate <minutes>", "Estimated time in minutes").option("--deliverable <text>", "Expected output/deliverable").action(kanbanAddCommand);
|