@codazen/harmonica-mcp 3.8.4 → 3.8.6
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/index.js +33 -33
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22208,7 +22208,7 @@ function registerBaselineTools(server, ctx, client) {
|
|
|
22208
22208
|
async ({ systemId, beatIds, runChecks, localPath }) => {
|
|
22209
22209
|
try {
|
|
22210
22210
|
await assertProjectInOrg(client, systemId, ctx.orgId);
|
|
22211
|
-
const task = await client.
|
|
22211
|
+
const task = await client.baselineSystem(systemId, { beatIds, runChecks, localPath });
|
|
22212
22212
|
return {
|
|
22213
22213
|
content: [{
|
|
22214
22214
|
type: "text",
|
|
@@ -22668,12 +22668,12 @@ ${beat.description}`);
|
|
|
22668
22668
|
}
|
|
22669
22669
|
|
|
22670
22670
|
// ../../libs/harmonica-services/src/mcp/formatters/system-formatter.ts
|
|
22671
|
-
function
|
|
22672
|
-
if (
|
|
22671
|
+
function formatSystemSummaryTable(systems) {
|
|
22672
|
+
if (systems.length === 0) return "_No systems found._";
|
|
22673
22673
|
const header = "| System ID | Title | Status |\n|-----------|-------|--------|";
|
|
22674
|
-
const rows =
|
|
22675
|
-
const status =
|
|
22676
|
-
return `| ${
|
|
22674
|
+
const rows = systems.map((s) => {
|
|
22675
|
+
const status = s.status.replace("_", " ");
|
|
22676
|
+
return `| ${s.systemId} | ${s.title} | ${status} |`;
|
|
22677
22677
|
});
|
|
22678
22678
|
return [header, ...rows].join("\n");
|
|
22679
22679
|
}
|
|
@@ -22699,34 +22699,34 @@ function formatDeliveryPolicy(policy, unresolvedReason) {
|
|
|
22699
22699
|
const footer = unresolvedReason ? [`- _Policy could not be resolved (${unresolvedReason}) \u2014 ask first; this is not proof that no policy is set._`] : [];
|
|
22700
22700
|
return ["## Agent Delivery Policy", ...lines, ...footer].join("\n");
|
|
22701
22701
|
}
|
|
22702
|
-
function
|
|
22702
|
+
function formatSystemContext(system, notes, orgCoda) {
|
|
22703
22703
|
const sections = [];
|
|
22704
|
-
sections.push(`# System: ${
|
|
22705
|
-
sections.push(`**ID:** ${
|
|
22706
|
-
sections.push(`**Status:** ${
|
|
22707
|
-
if (
|
|
22708
|
-
const branch =
|
|
22709
|
-
sections.push(`**Repo:** ${
|
|
22704
|
+
sections.push(`# System: ${system.title}`);
|
|
22705
|
+
sections.push(`**ID:** ${system.systemId}`);
|
|
22706
|
+
sections.push(`**Status:** ${system.status.replace("_", " ")}`);
|
|
22707
|
+
if (system.repoOwner && system.repoName) {
|
|
22708
|
+
const branch = system.repoDefaultBranch ?? "main";
|
|
22709
|
+
sections.push(`**Repo:** ${system.repoOwner}/${system.repoName} (branch: ${branch})`);
|
|
22710
22710
|
}
|
|
22711
22711
|
sections.push(`
|
|
22712
|
-
${formatDeliveryPolicy(
|
|
22712
|
+
${formatDeliveryPolicy(system.agentDeliveryPolicy)}`);
|
|
22713
22713
|
if (orgCoda) {
|
|
22714
22714
|
sections.push(`
|
|
22715
22715
|
## Organization Coda
|
|
22716
22716
|
${orgCoda}`);
|
|
22717
22717
|
}
|
|
22718
|
-
if (
|
|
22718
|
+
if (system.description) {
|
|
22719
22719
|
sections.push(`
|
|
22720
22720
|
## Description
|
|
22721
|
-
${
|
|
22721
|
+
${system.description}`);
|
|
22722
22722
|
}
|
|
22723
|
-
if (
|
|
22723
|
+
if (system.strategy) {
|
|
22724
22724
|
sections.push(`
|
|
22725
22725
|
## Strategy (Project Coda)
|
|
22726
|
-
${
|
|
22726
|
+
${system.strategy}`);
|
|
22727
22727
|
}
|
|
22728
22728
|
if (notes.length === 0) {
|
|
22729
|
-
sections.push("\n_No
|
|
22729
|
+
sections.push("\n_No system notes yet._");
|
|
22730
22730
|
return sections.join("\n");
|
|
22731
22731
|
}
|
|
22732
22732
|
const grouped = /* @__PURE__ */ new Map();
|
|
@@ -26710,7 +26710,7 @@ var NotificationSchema2 = external_exports.object({
|
|
|
26710
26710
|
description: external_exports.string(),
|
|
26711
26711
|
createdAt: external_exports.string(),
|
|
26712
26712
|
read: external_exports.boolean(),
|
|
26713
|
-
|
|
26713
|
+
systemId: external_exports.string(),
|
|
26714
26714
|
beatId: external_exports.string().optional(),
|
|
26715
26715
|
revisionId: external_exports.string().optional(),
|
|
26716
26716
|
noteId: external_exports.string().optional(),
|
|
@@ -30711,13 +30711,13 @@ function accountLine(_request, resolved) {
|
|
|
30711
30711
|
return resolved ? `**Account:** ${resolved}` : "";
|
|
30712
30712
|
}
|
|
30713
30713
|
var PROJECT_EMBEDDING_FIELDS = ["title", "description", "strategy"];
|
|
30714
|
-
function
|
|
30714
|
+
function registerSystemTools(server, ctx, client) {
|
|
30715
30715
|
const listSystemsHandler = async ({ teamspaceId }) => {
|
|
30716
30716
|
try {
|
|
30717
30717
|
const projects = await client.listOrgSystems(ctx.orgId);
|
|
30718
30718
|
const trimmed = teamspaceId?.trim();
|
|
30719
30719
|
const filtered = trimmed ? projects.filter((p) => p.teamspaceId === trimmed) : projects;
|
|
30720
|
-
const text =
|
|
30720
|
+
const text = formatSystemSummaryTable(filtered);
|
|
30721
30721
|
return { content: [{ type: "text", text }] };
|
|
30722
30722
|
} catch (err) {
|
|
30723
30723
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -30750,7 +30750,7 @@ function registerProjectTools(server, ctx, client) {
|
|
|
30750
30750
|
const notes = await client.listSystemNotes(systemId, {
|
|
30751
30751
|
limit: noteLimit ?? DEFAULT_CONTEXT_NOTE_LIMIT
|
|
30752
30752
|
});
|
|
30753
|
-
const text =
|
|
30753
|
+
const text = formatSystemContext(project, notes, org?.coda);
|
|
30754
30754
|
return { content: [{ type: "text", text }] };
|
|
30755
30755
|
} catch (err) {
|
|
30756
30756
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -31955,7 +31955,7 @@ var TOOL_PROFILES = Object.freeze({
|
|
|
31955
31955
|
registerNextActionsTools,
|
|
31956
31956
|
registerBeatTools,
|
|
31957
31957
|
registerNoteTools,
|
|
31958
|
-
|
|
31958
|
+
registerSystemTools,
|
|
31959
31959
|
registerAnalysisTools,
|
|
31960
31960
|
registerLayerTools
|
|
31961
31961
|
]),
|
|
@@ -31963,7 +31963,7 @@ var TOOL_PROFILES = Object.freeze({
|
|
|
31963
31963
|
registerOrganizationTools,
|
|
31964
31964
|
registerTeamspaceTools,
|
|
31965
31965
|
registerMembershipTools,
|
|
31966
|
-
|
|
31966
|
+
registerSystemTools,
|
|
31967
31967
|
registerProjectLifecycleTools,
|
|
31968
31968
|
allow(registerBeatVersionTools, ["relocate_beat_version"])
|
|
31969
31969
|
]),
|
|
@@ -31972,13 +31972,13 @@ var TOOL_PROFILES = Object.freeze({
|
|
|
31972
31972
|
registerBaselineTools,
|
|
31973
31973
|
registerSnapshotTools,
|
|
31974
31974
|
registerBeatComposerTools,
|
|
31975
|
-
|
|
31975
|
+
registerSystemTools
|
|
31976
31976
|
]),
|
|
31977
31977
|
// Curated read-heavy surface for Microsoft 365 Copilot declarative agents (B-235).
|
|
31978
31978
|
// Copilot's orchestrator degrades with large tool sets, so each module is trimmed
|
|
31979
31979
|
// to its query tools; create_note is the single write action.
|
|
31980
31980
|
"copilot": Object.freeze([
|
|
31981
|
-
allow(
|
|
31981
|
+
allow(registerSystemTools, ["list_systems", "get_system_context"]),
|
|
31982
31982
|
allow(registerBeatTools, ["list_beats", "get_beat", "list_revisions", "get_revision"]),
|
|
31983
31983
|
allow(registerBeatVersionTools, ["list_beat_versions", "get_beat_version"]),
|
|
31984
31984
|
allow(registerNoteTools, ["list_notes", "get_note", "create_note", "list_documents"]),
|
|
@@ -32001,7 +32001,7 @@ function registerAllTools(server, ctx, client, profile) {
|
|
|
32001
32001
|
}
|
|
32002
32002
|
return;
|
|
32003
32003
|
}
|
|
32004
|
-
|
|
32004
|
+
registerSystemTools(server, ctx, client);
|
|
32005
32005
|
registerProjectLifecycleTools(server, ctx, client);
|
|
32006
32006
|
registerMembershipTools(server, ctx, client);
|
|
32007
32007
|
registerBeatTools(server, ctx, client);
|
|
@@ -32101,7 +32101,7 @@ function registerSystemResources(server, ctx, client) {
|
|
|
32101
32101
|
const sid = String(systemId);
|
|
32102
32102
|
const project = await fetchSystemInOrg(client, sid, ctx.orgId);
|
|
32103
32103
|
const notes = await client.listSystemNotes(sid, { limit: DEFAULT_CONTEXT_NOTE_LIMIT });
|
|
32104
|
-
const text =
|
|
32104
|
+
const text = formatSystemContext(project, notes);
|
|
32105
32105
|
return { contents: [{ uri: uri.href, text }] };
|
|
32106
32106
|
}
|
|
32107
32107
|
);
|
|
@@ -32345,7 +32345,7 @@ function createHttpClient(config2) {
|
|
|
32345
32345
|
// Systems (canonical)
|
|
32346
32346
|
listOrgSystems: async (orgId) => {
|
|
32347
32347
|
const raw = await request("GET", `/api/organizations/${encodeURIComponent(orgId)}/systems/summaries`);
|
|
32348
|
-
return (raw ?? []).map((p) => ({ ...p, projectId: p.id, title: p.name, orgId: p.organizationId }));
|
|
32348
|
+
return (raw ?? []).map((p) => ({ ...p, systemId: p.id, projectId: p.id, title: p.name, orgId: p.organizationId }));
|
|
32349
32349
|
},
|
|
32350
32350
|
getSystem: async (projectId) => {
|
|
32351
32351
|
const raw = await request("GET", `/api/systems/${encodeURIComponent(projectId)}`);
|
|
@@ -33388,14 +33388,14 @@ function createHttpClient(config2) {
|
|
|
33388
33388
|
if (!result?.taskId) throw new Error("Triage enqueue failed: no taskId returned");
|
|
33389
33389
|
return { taskId: result.taskId, taskType: "triage_loop", status: result.status ?? "pending", systemId: projectId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
33390
33390
|
},
|
|
33391
|
-
|
|
33391
|
+
baselineSystem: async (projectId, options) => {
|
|
33392
33392
|
const result = await request(
|
|
33393
33393
|
"POST",
|
|
33394
33394
|
`/api/systems/${encodeURIComponent(projectId)}/baseline`,
|
|
33395
33395
|
{ beatIds: options?.beatIds, runChecks: options?.runChecks ?? true, localPath: options?.localPath }
|
|
33396
33396
|
);
|
|
33397
33397
|
if (!result?.taskId) throw new Error("Baseline enqueue failed: no taskId returned");
|
|
33398
|
-
return { taskId: result.taskId, taskType: "
|
|
33398
|
+
return { taskId: result.taskId, taskType: "baseline_system", status: result.status ?? "pending", systemId: projectId, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
33399
33399
|
},
|
|
33400
33400
|
runCheck: async (projectId, checkType, targetId, options) => {
|
|
33401
33401
|
const result = await request(
|
|
@@ -34317,7 +34317,7 @@ function loadConfig() {
|
|
|
34317
34317
|
};
|
|
34318
34318
|
}
|
|
34319
34319
|
async function main() {
|
|
34320
|
-
console.error(`[harmonica-mcp] v${"3.8.
|
|
34320
|
+
console.error(`[harmonica-mcp] v${"3.8.6"} starting\u2026`);
|
|
34321
34321
|
const config2 = loadConfig();
|
|
34322
34322
|
const client = createHttpClient({
|
|
34323
34323
|
apiBaseUrl: config2.apiBaseUrl,
|