xtrm-tools 2.1.28 → 2.1.30
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/cli/dist/index.cjs +48 -1
- package/cli/dist/index.cjs.map +1 -1
- package/cli/package.json +1 -1
- package/config/hooks.json +5 -0
- package/config/instructions/agents-top.md +30 -0
- package/config/instructions/claude-top.md +30 -0
- package/config/pi/extensions/beads.ts +22 -7
- package/config/pi/extensions/custom-footer.ts +15 -13
- package/config/pi/pi-worktrees-settings.json +6 -0
- package/config/pi/settings.json.template +2 -1
- package/hooks/beads-claim-sync.mjs +82 -0
- package/package.json +1 -1
package/cli/dist/index.cjs
CHANGED
|
@@ -40985,6 +40985,9 @@ function resolvePkgRoot2() {
|
|
|
40985
40985
|
var PKG_ROOT2 = resolvePkgRoot2();
|
|
40986
40986
|
var PROJECT_SKILLS_DIR = import_path11.default.join(PKG_ROOT2, "project-skills");
|
|
40987
40987
|
var MCP_CORE_CONFIG_PATH = import_path11.default.join(PKG_ROOT2, "config", "mcp_servers.json");
|
|
40988
|
+
var INSTRUCTIONS_DIR = import_path11.default.join(PKG_ROOT2, "config", "instructions");
|
|
40989
|
+
var XTRM_BLOCK_START = "<!-- xtrm:start -->";
|
|
40990
|
+
var XTRM_BLOCK_END = "<!-- xtrm:end -->";
|
|
40988
40991
|
var syncedProjectMcpRoots = /* @__PURE__ */ new Set();
|
|
40989
40992
|
function resolveEnvVars(value) {
|
|
40990
40993
|
if (typeof value !== "string") return value;
|
|
@@ -41060,6 +41063,49 @@ async function syncProjectMcpServers(projectRoot) {
|
|
|
41060
41063
|
}
|
|
41061
41064
|
console.log(kleur_default.dim(` \u21B3 MCP project-scope result: ${added} added, ${existing} existing, ${failed} failed`));
|
|
41062
41065
|
}
|
|
41066
|
+
function upsertManagedBlock(fileContent, blockBody, startMarker = XTRM_BLOCK_START, endMarker = XTRM_BLOCK_END) {
|
|
41067
|
+
const normalizedBody = blockBody.trim();
|
|
41068
|
+
const managedBlock = `${startMarker}
|
|
41069
|
+
${normalizedBody}
|
|
41070
|
+
${endMarker}`;
|
|
41071
|
+
const escapedStart = startMarker.replace(/[.*+?^${}()|[\\]\\]/g, "\\$&");
|
|
41072
|
+
const escapedEnd = endMarker.replace(/[.*+?^${}()|[\\]\\]/g, "\\$&");
|
|
41073
|
+
const existingBlockPattern = new RegExp(`${escapedStart}[\\s\\S]*?${escapedEnd}`, "m");
|
|
41074
|
+
if (existingBlockPattern.test(fileContent)) {
|
|
41075
|
+
return fileContent.replace(existingBlockPattern, managedBlock);
|
|
41076
|
+
}
|
|
41077
|
+
const trimmed = fileContent.trimStart();
|
|
41078
|
+
if (!trimmed) return `${managedBlock}
|
|
41079
|
+
`;
|
|
41080
|
+
return `${managedBlock}
|
|
41081
|
+
|
|
41082
|
+
${trimmed}`;
|
|
41083
|
+
}
|
|
41084
|
+
async function injectProjectInstructionHeaders(projectRoot) {
|
|
41085
|
+
const targets = [
|
|
41086
|
+
{ output: "AGENTS.md", template: "agents-top.md" },
|
|
41087
|
+
{ output: "CLAUDE.md", template: "claude-top.md" }
|
|
41088
|
+
];
|
|
41089
|
+
console.log(kleur_default.bold("Injecting xtrm agent instruction headers..."));
|
|
41090
|
+
for (const target of targets) {
|
|
41091
|
+
const templatePath = import_path11.default.join(INSTRUCTIONS_DIR, target.template);
|
|
41092
|
+
if (!await import_fs_extra11.default.pathExists(templatePath)) {
|
|
41093
|
+
console.log(kleur_default.yellow(` \u26A0 Missing template: ${target.template}`));
|
|
41094
|
+
continue;
|
|
41095
|
+
}
|
|
41096
|
+
const template = await import_fs_extra11.default.readFile(templatePath, "utf8");
|
|
41097
|
+
const outputPath = import_path11.default.join(projectRoot, target.output);
|
|
41098
|
+
const existing = await import_fs_extra11.default.pathExists(outputPath) ? await import_fs_extra11.default.readFile(outputPath, "utf8") : "";
|
|
41099
|
+
const next = upsertManagedBlock(existing, template);
|
|
41100
|
+
if (next === existing) {
|
|
41101
|
+
console.log(kleur_default.dim(` \u2713 ${target.output} already up to date`));
|
|
41102
|
+
continue;
|
|
41103
|
+
}
|
|
41104
|
+
await import_fs_extra11.default.writeFile(outputPath, next.endsWith("\n") ? next : `${next}
|
|
41105
|
+
`, "utf8");
|
|
41106
|
+
console.log(`${kleur_default.green(" \u2713")} updated ${target.output}`);
|
|
41107
|
+
}
|
|
41108
|
+
}
|
|
41063
41109
|
async function getAvailableProjectSkills() {
|
|
41064
41110
|
if (!await import_fs_extra11.default.pathExists(PROJECT_SKILLS_DIR)) {
|
|
41065
41111
|
return [];
|
|
@@ -41069,7 +41115,7 @@ async function getAvailableProjectSkills() {
|
|
|
41069
41115
|
for (const entry of entries) {
|
|
41070
41116
|
const entryPath = import_path11.default.join(PROJECT_SKILLS_DIR, entry);
|
|
41071
41117
|
const stat = await import_fs_extra11.default.stat(entryPath);
|
|
41072
|
-
if (stat.isDirectory()) {
|
|
41118
|
+
if (stat.isDirectory() && await import_fs_extra11.default.pathExists(import_path11.default.join(entryPath, ".claude"))) {
|
|
41073
41119
|
skills.push(entry);
|
|
41074
41120
|
}
|
|
41075
41121
|
}
|
|
@@ -41404,6 +41450,7 @@ async function bootstrapProjectInit() {
|
|
|
41404
41450
|
return;
|
|
41405
41451
|
}
|
|
41406
41452
|
await runBdInitForProject(projectRoot);
|
|
41453
|
+
await injectProjectInstructionHeaders(projectRoot);
|
|
41407
41454
|
await runGitNexusInitForProject(projectRoot);
|
|
41408
41455
|
await syncProjectMcpServers(projectRoot);
|
|
41409
41456
|
}
|