@uzysjung/agent-harness 26.115.0 → 26.117.0

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.
@@ -1158,6 +1158,357 @@ var CATEGORY_TITLES = {
1158
1158
  "ecc-suite": "\u{1F4E6} ECC Suite"
1159
1159
  };
1160
1160
 
1161
+ // src/manifest.ts
1162
+ init_esm_shims();
1163
+ var all = () => true;
1164
+ var dev = (s) => hasDevTrack(s.tracks);
1165
+ var ui = (s) => hasUiTrack(s.tracks);
1166
+ var onTracks = (pattern) => (s) => anyTrack(s.tracks, pattern);
1167
+ var COMMON_RULES = ["git-policy", "change-management", "gates-taxonomy", "doc-governance"];
1168
+ var DEV_RULES = ["test-policy", "ship-checklist", "code-style", "error-handling"];
1169
+ var UI_RULES = ["design-workflow", "playwright-launch", "benchmark-parity"];
1170
+ var TRACK_RULES = {
1171
+ "csr-supabase": ["shadcn", "api-contract"],
1172
+ "csr-fastify": ["shadcn", "api-contract", "database"],
1173
+ "csr-fastapi": ["shadcn", "api-contract", "database"],
1174
+ "ssr-htmx": ["htmx"],
1175
+ "ssr-nextjs": ["nextjs", "shadcn"],
1176
+ data: ["pyside6", "data-analysis"],
1177
+ executive: [],
1178
+ tooling: ["cli-development"],
1179
+ full: [
1180
+ "shadcn",
1181
+ "api-contract",
1182
+ "database",
1183
+ "htmx",
1184
+ "nextjs",
1185
+ "pyside6",
1186
+ "data-analysis",
1187
+ "cli-development"
1188
+ ],
1189
+ // v0.5.0 — executive-style baselines (no dev rules; common rules only).
1190
+ "project-management": [],
1191
+ "growth-marketing": []
1192
+ };
1193
+ function resolveRules(spec) {
1194
+ const set = new Set(COMMON_RULES);
1195
+ if (hasDevTrack(spec.tracks)) {
1196
+ for (const r of DEV_RULES) {
1197
+ set.add(r);
1198
+ }
1199
+ }
1200
+ if (spec.withTauri && anyTrack(spec.tracks, "csr-*|full")) {
1201
+ set.add("tauri");
1202
+ }
1203
+ if (hasUiTrack(spec.tracks)) {
1204
+ for (const r of UI_RULES) {
1205
+ set.add(r);
1206
+ }
1207
+ }
1208
+ for (const t of spec.tracks) {
1209
+ for (const r of TRACK_RULES[t]) {
1210
+ set.add(r);
1211
+ }
1212
+ }
1213
+ return [...set].sort();
1214
+ }
1215
+ var CORE_AGENTS = ["reviewer", "data-analyst", "strategist"];
1216
+ var CORE_AGENTS_ECC = ["code-reviewer", "security-reviewer"];
1217
+ var DEV_AGENTS = ["plan-checker"];
1218
+ var DEV_AGENTS_ECC = ["silent-failure-hunter", "build-error-resolver"];
1219
+ var ALWAYS_HOOKS = [
1220
+ "session-start.sh",
1221
+ "protect-files.sh",
1222
+ "mcp-pre-exec.sh",
1223
+ "spec-drift-check.sh",
1224
+ "checkpoint-snapshot.sh"
1225
+ ];
1226
+ var COMMON_SKILL_DIRS = ["north-star", "gh-issue-workflow"];
1227
+ var COMMON_SKILL_DIRS_ECC = ["strategic-compact"];
1228
+ var MODIFIED_COMMON_SKILL_DIRS = ["continuous-learning-v2", "deep-research"];
1229
+ var DEV_SKILL_DIRS = [];
1230
+ var DEV_SKILL_DIRS_ECC = ["agent-introspection-debugging"];
1231
+ var MODIFIED_DEV_SKILL_DIRS = ["verification-loop", "eval-harness"];
1232
+ var MODIFIED_ECC_SKILL_DIRS = [...MODIFIED_COMMON_SKILL_DIRS, ...MODIFIED_DEV_SKILL_DIRS];
1233
+ var UI_SKILL_DIRS = ["ui-visual-review"];
1234
+ var UI_SKILL_DIRS_ECC = ["e2e-testing"];
1235
+ var PYTHON_SKILL_DIRS_ECC = ["python-patterns", "python-testing"];
1236
+ function buildManifest(spec) {
1237
+ const m = [];
1238
+ for (const r of resolveRules(spec)) {
1239
+ m.push({
1240
+ source: `rules/${r}.md`,
1241
+ target: `.claude/rules/${r}.md`,
1242
+ type: "file",
1243
+ applies: all
1244
+ });
1245
+ }
1246
+ m.push({
1247
+ source: "commands/ecc",
1248
+ target: ".claude/commands/ecc",
1249
+ type: "dir",
1250
+ applies: (s) => !s.withEcc
1251
+ });
1252
+ m.push({
1253
+ source: "CLAUDE.md",
1254
+ target: ".claude/CLAUDE.md",
1255
+ type: "file",
1256
+ applies: all
1257
+ });
1258
+ for (const a of CORE_AGENTS) {
1259
+ m.push({
1260
+ source: `agents/${a}.md`,
1261
+ target: `.claude/agents/${a}.md`,
1262
+ type: "file",
1263
+ applies: all
1264
+ });
1265
+ }
1266
+ for (const a of DEV_AGENTS) {
1267
+ m.push({
1268
+ source: `agents/${a}.md`,
1269
+ target: `.claude/agents/${a}.md`,
1270
+ type: "file",
1271
+ applies: dev
1272
+ });
1273
+ }
1274
+ for (const a of CORE_AGENTS_ECC) {
1275
+ m.push({
1276
+ source: `agents/${a}.md`,
1277
+ target: `.claude/agents/${a}.md`,
1278
+ type: "file",
1279
+ applies: (s) => !s.withEcc
1280
+ });
1281
+ }
1282
+ for (const a of DEV_AGENTS_ECC) {
1283
+ m.push({
1284
+ source: `agents/${a}.md`,
1285
+ target: `.claude/agents/${a}.md`,
1286
+ type: "file",
1287
+ applies: (s) => !s.withEcc && hasDevTrack(s.tracks)
1288
+ });
1289
+ }
1290
+ for (const sd of COMMON_SKILL_DIRS) {
1291
+ m.push({
1292
+ source: `skills/${sd}`,
1293
+ target: `.claude/skills/${sd}`,
1294
+ type: "dir",
1295
+ applies: all
1296
+ });
1297
+ }
1298
+ for (const sd of COMMON_SKILL_DIRS_ECC) {
1299
+ m.push({
1300
+ source: `skills/${sd}`,
1301
+ target: `.claude/skills/${sd}`,
1302
+ type: "dir",
1303
+ applies: (s) => !s.withEcc
1304
+ });
1305
+ }
1306
+ for (const sd of MODIFIED_COMMON_SKILL_DIRS) {
1307
+ m.push({
1308
+ source: `skills/${sd}`,
1309
+ target: `.claude/skills/${sd}`,
1310
+ type: "dir",
1311
+ applies: all
1312
+ });
1313
+ }
1314
+ m.push({
1315
+ source: "skills/spec-scaling/SKILL.md",
1316
+ target: ".claude/skills/spec-scaling/SKILL.md",
1317
+ type: "file",
1318
+ applies: all
1319
+ });
1320
+ m.push({
1321
+ source: "skills/market-research",
1322
+ target: ".claude/skills/market-research",
1323
+ type: "dir",
1324
+ applies: onTracks("executive|full")
1325
+ });
1326
+ for (const sd of ["investor-materials", "investor-outreach"]) {
1327
+ m.push({
1328
+ source: `skills/${sd}`,
1329
+ target: `.claude/skills/${sd}`,
1330
+ type: "dir",
1331
+ applies: onTracks("executive|full")
1332
+ });
1333
+ }
1334
+ m.push({
1335
+ source: "skills/nextjs-turbopack",
1336
+ target: ".claude/skills/nextjs-turbopack",
1337
+ type: "dir",
1338
+ applies: onTracks("ssr-nextjs|full")
1339
+ });
1340
+ for (const sd of INTERNAL_BUNDLED_SKILL_IDS) {
1341
+ m.push({
1342
+ source: `skills/${sd}`,
1343
+ target: `.claude/skills/${sd}`,
1344
+ type: "dir",
1345
+ applies: (s) => (s.selectedInternalSkills ?? []).includes(sd)
1346
+ });
1347
+ }
1348
+ for (const sd of PYTHON_SKILL_DIRS_ECC) {
1349
+ m.push({
1350
+ source: `skills/${sd}`,
1351
+ target: `.claude/skills/${sd}`,
1352
+ type: "dir",
1353
+ applies: (s) => !s.withEcc && anyTrack(s.tracks, "data|csr-fastapi|full")
1354
+ });
1355
+ }
1356
+ for (const sd of DEV_SKILL_DIRS) {
1357
+ m.push({
1358
+ source: `skills/${sd}`,
1359
+ target: `.claude/skills/${sd}`,
1360
+ type: "dir",
1361
+ applies: dev
1362
+ });
1363
+ }
1364
+ for (const sd of DEV_SKILL_DIRS_ECC) {
1365
+ m.push({
1366
+ source: `skills/${sd}`,
1367
+ target: `.claude/skills/${sd}`,
1368
+ type: "dir",
1369
+ applies: (s) => !s.withEcc && hasDevTrack(s.tracks)
1370
+ });
1371
+ }
1372
+ for (const sd of MODIFIED_DEV_SKILL_DIRS) {
1373
+ m.push({
1374
+ source: `skills/${sd}`,
1375
+ target: `.claude/skills/${sd}`,
1376
+ type: "dir",
1377
+ applies: dev
1378
+ });
1379
+ }
1380
+ for (const sd of UI_SKILL_DIRS) {
1381
+ m.push({
1382
+ source: `skills/${sd}`,
1383
+ target: `.claude/skills/${sd}`,
1384
+ type: "dir",
1385
+ applies: ui
1386
+ });
1387
+ }
1388
+ for (const sd of UI_SKILL_DIRS_ECC) {
1389
+ m.push({
1390
+ source: `skills/${sd}`,
1391
+ target: `.claude/skills/${sd}`,
1392
+ type: "dir",
1393
+ applies: (s) => !s.withEcc && hasUiTrack(s.tracks)
1394
+ });
1395
+ }
1396
+ for (const h of ALWAYS_HOOKS) {
1397
+ m.push({
1398
+ source: `hooks/${h}`,
1399
+ target: `.claude/hooks/${h}`,
1400
+ type: "file",
1401
+ applies: all
1402
+ });
1403
+ }
1404
+ m.push({
1405
+ source: "settings.json",
1406
+ target: ".claude/settings.json",
1407
+ type: "file",
1408
+ applies: all
1409
+ });
1410
+ return m;
1411
+ }
1412
+
1413
+ // src/context-cost.ts
1414
+ init_esm_shims();
1415
+ import { existsSync, readFileSync } from "fs";
1416
+ import { join, resolve } from "path";
1417
+ import { fileURLToPath as fileURLToPath2 } from "url";
1418
+ var CHARS_PER_TOKEN = 4;
1419
+ function estimateTokens(chars) {
1420
+ return Math.ceil(chars / CHARS_PER_TOKEN);
1421
+ }
1422
+ function resolveBundleRoot() {
1423
+ return resolve(fileURLToPath2(new URL(".", import.meta.url)), "..");
1424
+ }
1425
+ function extractFrontmatter(content) {
1426
+ const m = content.match(/^?---\r?\n([\s\S]*?)\r?\n---/);
1427
+ return m?.[1] ?? null;
1428
+ }
1429
+ function assetDescriptorTokens(assetId, root = resolveBundleRoot()) {
1430
+ const asset = EXTERNAL_ASSETS.find((a) => a.id === assetId);
1431
+ if (!asset || asset.method.kind !== "internal") return null;
1432
+ const skillMd = join(root, "templates", "skills", asset.method.key, "SKILL.md");
1433
+ if (!existsSync(skillMd)) return null;
1434
+ const fm = extractFrontmatter(readFileSync(skillMd, "utf8"));
1435
+ return fm === null ? null : estimateTokens(fm.length);
1436
+ }
1437
+ function assetBodyTokens(assetId, root = resolveBundleRoot()) {
1438
+ const asset = EXTERNAL_ASSETS.find((a) => a.id === assetId);
1439
+ if (!asset || asset.method.kind !== "internal") return null;
1440
+ const skillMd = join(root, "templates", "skills", asset.method.key, "SKILL.md");
1441
+ if (!existsSync(skillMd)) return null;
1442
+ const content = readFileSync(skillMd, "utf8");
1443
+ const fm = extractFrontmatter(content);
1444
+ if (fm === null) return estimateTokens(content.length);
1445
+ const close = content.indexOf("\n---", content.indexOf(fm) + fm.length);
1446
+ const body = close === -1 ? "" : content.slice(close + "\n---".length);
1447
+ return estimateTokens(body.trim().length);
1448
+ }
1449
+ function assetCostRows(assetIds, root = resolveBundleRoot()) {
1450
+ return assetIds.map((id) => ({
1451
+ id,
1452
+ descriptorTokens: assetDescriptorTokens(id, root),
1453
+ bodyTokens: assetBodyTokens(id, root)
1454
+ })).sort((a, b) => (b.bodyTokens ?? -1) - (a.bodyTokens ?? -1));
1455
+ }
1456
+ function fileTokens(path2) {
1457
+ return existsSync(path2) ? estimateTokens(readFileSync(path2, "utf8").trim().length) : 0;
1458
+ }
1459
+ function descriptorTokens(path2) {
1460
+ if (!existsSync(path2)) return 0;
1461
+ const fm = extractFrontmatter(readFileSync(path2, "utf8"));
1462
+ return fm === null ? 0 : estimateTokens(fm.length);
1463
+ }
1464
+ function residentCost(entries, root = resolveBundleRoot()) {
1465
+ const tpl = (source) => join(root, "templates", source);
1466
+ let rules = 0;
1467
+ let skillDescriptors = 0;
1468
+ let agentDescriptors = 0;
1469
+ for (const e of entries) {
1470
+ if (e.target.startsWith(".claude/rules/")) rules += fileTokens(tpl(e.source));
1471
+ else if (e.target.startsWith(".claude/agents/"))
1472
+ agentDescriptors += descriptorTokens(tpl(e.source));
1473
+ else if (e.target.startsWith(".claude/skills/")) {
1474
+ skillDescriptors += descriptorTokens(join(tpl(e.source), "SKILL.md"));
1475
+ }
1476
+ }
1477
+ const projectClaudeMd = fileTokens(join(root, "templates", "CLAUDE.md"));
1478
+ return {
1479
+ rules,
1480
+ projectClaudeMd,
1481
+ skillDescriptors,
1482
+ agentDescriptors,
1483
+ total: rules + projectClaudeMd + skillDescriptors + agentDescriptors
1484
+ };
1485
+ }
1486
+ function summarizeContextCost(assetIds, root = resolveBundleRoot()) {
1487
+ let measuredTokens = 0;
1488
+ let measuredCount = 0;
1489
+ let unmeasuredCount = 0;
1490
+ for (const id of assetIds) {
1491
+ const tokens = assetDescriptorTokens(id, root);
1492
+ if (tokens === null) unmeasuredCount += 1;
1493
+ else {
1494
+ measuredTokens += tokens;
1495
+ measuredCount += 1;
1496
+ }
1497
+ }
1498
+ return { measuredTokens, measuredCount, unmeasuredCount };
1499
+ }
1500
+ function formatResidentCostLine(r, unmeasuredCount) {
1501
+ if (r.total === 0) return null;
1502
+ const parts = [
1503
+ `rules ~${r.rules}`,
1504
+ `CLAUDE.md ~${r.projectClaudeMd}`,
1505
+ `skills ~${r.skillDescriptors}`,
1506
+ `agents ~${r.agentDescriptors}`
1507
+ ].join(" \xB7 ");
1508
+ const external = unmeasuredCount > 0 ? ` \xB7 ${unmeasuredCount} external asset${unmeasuredCount === 1 ? "" : "s"} unmeasured` : "";
1509
+ return `session-start context cost: ~${r.total} tokens/session (${parts}${external})`;
1510
+ }
1511
+
1161
1512
  export {
1162
1513
  __commonJS,
1163
1514
  __toESM,
@@ -1170,7 +1521,6 @@ export {
1170
1521
  resolveScope,
1171
1522
  DEFAULT_OPTIONS,
1172
1523
  anyTrack,
1173
- hasDevTrack,
1174
1524
  hasUiTrack,
1175
1525
  EXTERNAL_ASSETS,
1176
1526
  DEV_METHOD_SKILL_IDS,
@@ -1183,6 +1533,13 @@ export {
1183
1533
  assetReachesCli,
1184
1534
  filterApplicableAssets,
1185
1535
  CATEGORIES,
1186
- CATEGORY_TITLES
1536
+ CATEGORY_TITLES,
1537
+ buildManifest,
1538
+ estimateTokens,
1539
+ resolveBundleRoot,
1540
+ assetCostRows,
1541
+ residentCost,
1542
+ summarizeContextCost,
1543
+ formatResidentCostLine
1187
1544
  };
1188
- //# sourceMappingURL=chunk-P6YR3FBR.js.map
1545
+ //# sourceMappingURL=chunk-2VII24JD.js.map