@letra-ai/cli 0.5.3 → 0.6.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.
Files changed (98) hide show
  1. package/dist/chunk-6HSUVCTR.js +363 -0
  2. package/dist/chunk-BKAUN5QH.js +300 -0
  3. package/dist/chunk-DMOLJWWW.js +3321 -0
  4. package/dist/chunk-EDD55PWL.js +119 -0
  5. package/dist/chunk-H64RC3YS.js +254 -0
  6. package/dist/chunk-JMIC5NKB.js +235 -0
  7. package/dist/chunk-L6YKDTAQ.js +275 -0
  8. package/dist/chunk-MJ2QXNH6.js +130 -0
  9. package/dist/chunk-OIHMDOIN.js +1326 -0
  10. package/dist/chunk-PDX44BCA.js +11 -0
  11. package/dist/chunk-URUC6ZZP.js +4781 -0
  12. package/dist/client/assets/index-EyRsq1SH.css +1 -0
  13. package/dist/client/assets/index-WfKR7Xp6.js +232 -0
  14. package/dist/client/favicon.svg +16 -4
  15. package/dist/client/index.html +25 -20
  16. package/dist/fallback-MQLGS4KL.js +46 -0
  17. package/dist/flow-serve-G5MSSB3G.js +18 -0
  18. package/dist/focus-sync-3D3XWCTI.js +17 -0
  19. package/dist/generate-UPFERQMD.js +20 -0
  20. package/dist/harness/default/v0.1.0/flows/sdlc.yaml +179 -0
  21. package/dist/harness/default/v0.1.0/gates/all-acs-passing.yaml +8 -0
  22. package/dist/harness/default/v0.1.0/gates/has-spec-file.yaml +7 -0
  23. package/dist/harness/default/v0.1.0/gates/human-approved-code.yaml +8 -0
  24. package/dist/harness/default/v0.1.0/gates/human-approved-spec.yaml +8 -0
  25. package/dist/harness/default/v0.1.0/gates/security-clear.yaml +8 -0
  26. package/dist/harness/default/v0.1.0/policies/sdlc-default.json +20 -0
  27. package/dist/harness/default/v0.1.0/roles/analyst.yaml +9 -0
  28. package/dist/harness/default/v0.1.0/roles/builder.yaml +9 -0
  29. package/dist/harness/default/v0.1.0/roles/pr-bot.yaml +8 -0
  30. package/dist/harness/default/v0.1.0/roles/reviewer.yaml +10 -0
  31. package/dist/harness/default/v0.1.0/roles/security.yaml +8 -0
  32. package/dist/harness/default/v0.1.1/flows/flow-main.yaml +61 -0
  33. package/dist/harness/default/v0.1.1/flows/sdlc.yaml +179 -0
  34. package/dist/harness/default/v0.1.1/gates/all-acs-passing.yaml +8 -0
  35. package/dist/harness/default/v0.1.1/gates/has-spec-file.yaml +7 -0
  36. package/dist/harness/default/v0.1.1/gates/human-approved-code.yaml +8 -0
  37. package/dist/harness/default/v0.1.1/gates/human-approved-spec.yaml +8 -0
  38. package/dist/harness/default/v0.1.1/gates/security-clear.yaml +8 -0
  39. package/dist/harness/default/v0.1.1/policies/sdlc-default.json +20 -0
  40. package/dist/harness/default/v0.1.1/roles/analyst.yaml +9 -0
  41. package/dist/harness/default/v0.1.1/roles/builder.yaml +9 -0
  42. package/dist/harness/default/v0.1.1/roles/pr-bot.yaml +8 -0
  43. package/dist/harness/default/v0.1.1/roles/reviewer.yaml +10 -0
  44. package/dist/harness/default/v0.1.1/roles/security.yaml +8 -0
  45. package/dist/harness/default/v0.1.2/flows/flow-main.yaml +86 -0
  46. package/dist/harness/default/v0.1.2/flows/sdlc.yaml +179 -0
  47. package/dist/harness/default/v0.1.2/gates/all-acs-passing.yaml +8 -0
  48. package/dist/harness/default/v0.1.2/gates/has-spec-file.yaml +7 -0
  49. package/dist/harness/default/v0.1.2/gates/human-approved-code.yaml +8 -0
  50. package/dist/harness/default/v0.1.2/gates/human-approved-spec.yaml +8 -0
  51. package/dist/harness/default/v0.1.2/gates/security-clear.yaml +8 -0
  52. package/dist/harness/default/v0.1.2/policies/sdlc-default.json +20 -0
  53. package/dist/harness/default/v0.1.2/roles/analyst.yaml +9 -0
  54. package/dist/harness/default/v0.1.2/roles/builder.yaml +9 -0
  55. package/dist/harness/default/v0.1.2/roles/pr-bot.yaml +8 -0
  56. package/dist/harness/default/v0.1.2/roles/reviewer.yaml +10 -0
  57. package/dist/harness/default/v0.1.2/roles/security.yaml +8 -0
  58. package/dist/harness/default/v0.1.3/flows/flow-main.yaml +90 -0
  59. package/dist/harness/default/v0.1.3/flows/sdlc.yaml +179 -0
  60. package/dist/harness/default/v0.1.3/gates/all-acs-passing.yaml +8 -0
  61. package/dist/harness/default/v0.1.3/gates/has-spec-file.yaml +7 -0
  62. package/dist/harness/default/v0.1.3/gates/human-approved-code.yaml +9 -0
  63. package/dist/harness/default/v0.1.3/gates/human-approved-spec.yaml +9 -0
  64. package/dist/harness/default/v0.1.3/gates/security-clear.yaml +8 -0
  65. package/dist/harness/default/v0.1.3/policies/sdlc-default.json +20 -0
  66. package/dist/harness/default/v0.1.3/roles/analyst.yaml +9 -0
  67. package/dist/harness/default/v0.1.3/roles/builder.yaml +9 -0
  68. package/dist/harness/default/v0.1.3/roles/pr-bot.yaml +8 -0
  69. package/dist/harness/default/v0.1.3/roles/reviewer.yaml +10 -0
  70. package/dist/harness/default/v0.1.3/roles/security.yaml +8 -0
  71. package/dist/harness/default/v0.2.0/executors/registry.yaml +51 -0
  72. package/dist/harness/default/v0.2.0/flows/flow-main.yaml +249 -0
  73. package/dist/harness/default/v0.2.0/gates/code-reviewed.yaml +7 -0
  74. package/dist/harness/default/v0.2.0/gates/human-approved.yaml +10 -0
  75. package/dist/harness/default/v0.2.0/gates/security-clear.yaml +7 -0
  76. package/dist/harness/default/v0.2.0/gates/spec-approved.yaml +10 -0
  77. package/dist/harness/default/v0.2.0/policies/sdlc-default.json +20 -0
  78. package/dist/harness/default/v0.2.0/roles/analyst.yaml +16 -0
  79. package/dist/harness/default/v0.2.0/roles/implementer.yaml +17 -0
  80. package/dist/harness/default/v0.2.0/roles/reviewer.yaml +17 -0
  81. package/dist/harness/default/v0.2.0/roles/security.yaml +17 -0
  82. package/dist/health-record-YDVXEVLR.js +21 -0
  83. package/dist/index.js +1951 -2530
  84. package/dist/init-wizard-NODBBNKO.js +178 -0
  85. package/dist/push-VJRSQGUD.js +116 -0
  86. package/dist/registry-6VPIA3EG.js +18 -0
  87. package/dist/server-P6GKRWDX.js +423 -0
  88. package/dist/service-2JN2KI4D.js +29 -0
  89. package/dist/session-log-WTQ5JBEN.js +21 -0
  90. package/dist/sitrep-OKNZJICV.js +16 -0
  91. package/package.json +37 -28
  92. package/dist/chunk-56GTTLC4.js +0 -1322
  93. package/dist/chunk-QWT5M4XU.js +0 -643
  94. package/dist/client/assets/index-CuLfFw4K.js +0 -85
  95. package/dist/client/assets/index-iyLqZcWx.css +0 -1
  96. package/dist/generate-BF5R5GGA.js +0 -7
  97. package/dist/sitrep-SI6ZFIAM.js +0 -10
  98. package/tsup.config.ts +0 -11
@@ -0,0 +1,423 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ activityOperation,
4
+ claimOperation,
5
+ completeAcOperation,
6
+ recordExecutionEvent,
7
+ requestHandoffOperation,
8
+ requestTransitionOperation,
9
+ runValidationOperation,
10
+ submitEvidenceOperation
11
+ } from "./chunk-OIHMDOIN.js";
12
+ import "./chunk-H64RC3YS.js";
13
+ import {
14
+ createWorkspaceBoundary,
15
+ loadHarnessForWorkflow,
16
+ loadWorkflow,
17
+ resolveActiveFlowFor,
18
+ resolveAgentDirection
19
+ } from "./chunk-DMOLJWWW.js";
20
+ import {
21
+ logEntry
22
+ } from "./chunk-BKAUN5QH.js";
23
+ import "./chunk-JMIC5NKB.js";
24
+ import "./chunk-EDD55PWL.js";
25
+ import {
26
+ getActiveEntries,
27
+ loadHealthRecord
28
+ } from "./chunk-MJ2QXNH6.js";
29
+ import {
30
+ getLetraDir2 as getLetraDir,
31
+ resolveWorkspaceRoot
32
+ } from "./chunk-6HSUVCTR.js";
33
+ import "./chunk-PDX44BCA.js";
34
+
35
+ // src/mcp/server.ts
36
+ import { existsSync, readFileSync } from "fs";
37
+ import { join, resolve } from "path";
38
+ import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
39
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
40
+ import { z } from "zod";
41
+ function jsonText(value) {
42
+ return {
43
+ content: [{ type: "text", text: JSON.stringify(value, null, 2) }]
44
+ };
45
+ }
46
+ function safeActiveSpec(root, boundary) {
47
+ const direction = resolveAgentDirection(root);
48
+ const name = direction.item?.spec ?? null;
49
+ if (!name || !/^[a-zA-Z0-9._-]+$/.test(name)) {
50
+ return { name, path: null, content: null };
51
+ }
52
+ const specsRoot = resolve(root, ".letra", "specs");
53
+ const specDir = resolve(specsRoot, name);
54
+ if (specDir !== specsRoot && !specDir.startsWith(`${specsRoot}\\`) && !specDir.startsWith(`${specsRoot}/`)) {
55
+ return { name, path: null, content: null };
56
+ }
57
+ const acceptancePath = join(specDir, "acceptance.md");
58
+ const specPath = join(specDir, "spec.md");
59
+ const selectedPath = existsSync(acceptancePath) ? acceptancePath : existsSync(specPath) ? specPath : null;
60
+ return {
61
+ name,
62
+ path: selectedPath ? boundary.assertPath(selectedPath).replace(/\\/g, "/") : null,
63
+ content: selectedPath ? readFileSync(boundary.assertPath(selectedPath), "utf-8") : null
64
+ };
65
+ }
66
+ function gateIdFromRef(gateRef) {
67
+ return gateRef.replace(/^.*[\\/]/, "").replace(/\.ya?ml$/, "");
68
+ }
69
+ function loadHarnessManifest(root) {
70
+ return loadHarnessForWorkflow(root, loadWorkflow(root));
71
+ }
72
+ function collectGates(root) {
73
+ const harness = loadHarnessManifest(root);
74
+ return harness ? Object.values(harness.gates) : [];
75
+ }
76
+ function collectRoles(root) {
77
+ const resolution = resolveActiveFlowFor(root);
78
+ return [...resolution.flow?.roles ?? []];
79
+ }
80
+ function healthPayload(root) {
81
+ const record = loadHealthRecord(root);
82
+ return {
83
+ scannedAt: record.lastScanAt ?? null,
84
+ active: getActiveEntries(record)
85
+ };
86
+ }
87
+ function resourceText(uri, text, mimeType = "application/json") {
88
+ return {
89
+ contents: [{ uri, mimeType, text }]
90
+ };
91
+ }
92
+ function createLetraMcpServer(root) {
93
+ const resolution = resolveWorkspaceRoot(root);
94
+ const workspaceDir = resolution.workspaceDir;
95
+ const boundary = createWorkspaceBoundary(workspaceDir);
96
+ const workspaceRoot = boundary.root;
97
+ const auditedReads = /* @__PURE__ */ new Set();
98
+ const server = new McpServer({
99
+ name: "letra",
100
+ version: "0.5.3"
101
+ });
102
+ const readOnlyAnnotations = {
103
+ readOnlyHint: true,
104
+ destructiveHint: false,
105
+ idempotentHint: true,
106
+ openWorldHint: false
107
+ };
108
+ const verificationAnnotations = {
109
+ readOnlyHint: false,
110
+ destructiveHint: false,
111
+ idempotentHint: false,
112
+ openWorldHint: false
113
+ };
114
+ const mutationAnnotations = {
115
+ readOnlyHint: false,
116
+ destructiveHint: true,
117
+ idempotentHint: false,
118
+ openWorldHint: false
119
+ };
120
+ const expectedRevision = z.string().regex(/^sha256:[a-f0-9]{64}$/);
121
+ const reason = z.string().trim().min(1).max(500);
122
+ const clientIdentity = () => {
123
+ const client = server.server.getClientVersion();
124
+ return {
125
+ actor: client?.name ? `mcp:${client.name}` : "mcp:unknown",
126
+ clientVersion: client?.version ?? null
127
+ };
128
+ };
129
+ const auditRead = (resource, direction = resolveAgentDirection(workspaceRoot)) => {
130
+ const key = `${resource}:${direction.revision}`;
131
+ if (auditedReads.has(key)) return direction;
132
+ auditedReads.add(key);
133
+ const client = clientIdentity();
134
+ logEntry(workspaceRoot, "agent_direction_read", `MCP read: ${resource}`, {
135
+ itemId: direction.item?.id,
136
+ acId: direction.pendingAC?.id,
137
+ details: {
138
+ adapter: "codex",
139
+ by: client.actor,
140
+ clientVersion: client.clientVersion,
141
+ resource,
142
+ revision: direction.revision,
143
+ reason: "Consulta de contexto pelo transporte MCP.",
144
+ outcome: "accepted"
145
+ }
146
+ });
147
+ return direction;
148
+ };
149
+ server.registerTool(
150
+ "get_direction",
151
+ {
152
+ description: "Retorna a dire\xE7\xE3o vigente e versionada do harness para o workspace atual.",
153
+ annotations: readOnlyAnnotations
154
+ },
155
+ async () => jsonText(auditRead("direction"))
156
+ );
157
+ server.registerTool(
158
+ "get_active_spec",
159
+ {
160
+ description: "Retorna a spec ativa e seus crit\xE9rios de aceita\xE7\xE3o.",
161
+ annotations: readOnlyAnnotations
162
+ },
163
+ async () => {
164
+ auditRead("active-spec");
165
+ return jsonText(safeActiveSpec(workspaceRoot, boundary));
166
+ }
167
+ );
168
+ server.registerTool(
169
+ "get_health",
170
+ {
171
+ description: "Retorna alertas operacionais ativos do workspace.",
172
+ annotations: readOnlyAnnotations
173
+ },
174
+ async () => {
175
+ auditRead("health");
176
+ return jsonText(healthPayload(workspaceRoot));
177
+ }
178
+ );
179
+ server.registerTool(
180
+ "validate",
181
+ {
182
+ description: "Valida o workspace pela implementa\xE7\xE3o can\xF4nica e registra o resultado.",
183
+ inputSchema: {
184
+ expectedRevision,
185
+ reason
186
+ },
187
+ annotations: verificationAnnotations
188
+ },
189
+ async (input) => jsonText(
190
+ await runValidationOperation(workspaceRoot, {
191
+ ...input,
192
+ actor: clientIdentity().actor
193
+ })
194
+ )
195
+ );
196
+ server.registerTool(
197
+ "complete_ac",
198
+ {
199
+ description: "Conclui o AC vigente ap\xF3s validar revis\xE3o e evid\xEAncia de regress\xE3o.",
200
+ inputSchema: {
201
+ acId: z.string().regex(/^AC\d+(?:\.\d+)*$/i),
202
+ expectedRevision,
203
+ evidence: z.array(z.string().trim().min(1).max(500)).max(20),
204
+ reason
205
+ },
206
+ annotations: mutationAnnotations
207
+ },
208
+ async (input) => jsonText(
209
+ completeAcOperation(workspaceRoot, {
210
+ ...input,
211
+ actor: clientIdentity().actor
212
+ })
213
+ )
214
+ );
215
+ server.registerTool(
216
+ "request_transition",
217
+ {
218
+ description: "Solicita transi\xE7\xE3o do item vigente sem contornar ACs, pap\xE9is ou gates.",
219
+ inputSchema: {
220
+ itemId: z.string().regex(/^ITEM-\d+$/i),
221
+ targetStageId: z.string().regex(/^[a-zA-Z0-9._-]+$/),
222
+ expectedRevision,
223
+ reason
224
+ },
225
+ annotations: mutationAnnotations
226
+ },
227
+ async (input) => jsonText(
228
+ await requestTransitionOperation(workspaceRoot, {
229
+ ...input,
230
+ actor: clientIdentity().actor
231
+ })
232
+ )
233
+ );
234
+ server.registerTool("get_context", { description: "Retorna contexto operacional can\xF4nico.", annotations: readOnlyAnnotations }, async () => jsonText(auditRead("context")));
235
+ server.registerTool("get_activity", { description: "Retorna atividade operacional vigente.", inputSchema: { itemId: z.string().optional() }, annotations: readOnlyAnnotations }, async ({ itemId }) => jsonText(activityOperation(workspaceRoot, itemId)));
236
+ server.registerTool("claim", { description: "Solicita claim exclusivo.", inputSchema: { itemId: z.string(), executorId: z.string(), capability: z.string(), expectedRevision, reason, ttlMinutes: z.number().optional() }, annotations: mutationAnnotations }, async (input) => jsonText(await claimOperation(workspaceRoot, { ...input, actor: clientIdentity().actor })));
237
+ server.registerTool("execution_event", { description: "Registra started, heartbeat, succeeded ou failed.", inputSchema: { itemId: z.string(), status: z.enum(["started", "heartbeat", "succeeded", "failed"]), executorId: z.string(), expectedRevision, reason, message: z.string().optional(), recovery: z.enum(["retry", "release", "handoff", "human"]).optional(), errorCode: z.string().optional() }, annotations: mutationAnnotations }, async (input) => jsonText(await recordExecutionEvent(workspaceRoot, { ...input, actor: clientIdentity().actor })));
238
+ server.registerTool("submit_evidence", { description: "Registra evid\xEAncia estruturada confinada.", inputSchema: { itemId: z.string(), executorId: z.string(), expectedRevision, reason, evidence: z.array(z.object({ kind: z.enum(["diff", "file", "command", "test", "artifact"]), value: z.string(), source: z.string(), observedAt: z.string().optional(), sha256: z.string().optional(), exitCode: z.number().optional() })) }, annotations: mutationAnnotations }, async (input) => jsonText(await submitEvidenceOperation(workspaceRoot, { ...input, actor: clientIdentity().actor })));
239
+ server.registerTool("request_handoff", { description: "Solicita handoff at\xF4mico.", inputSchema: { itemId: z.string(), to: z.string(), executorId: z.string(), summary: z.string(), evidence: z.array(z.string()), expectedRevision, reason }, annotations: mutationAnnotations }, async (input) => jsonText(await requestHandoffOperation(workspaceRoot, { ...input, actor: clientIdentity().actor })));
240
+ server.registerResource(
241
+ "direction",
242
+ "letra://direction",
243
+ { title: "Dire\xE7\xE3o vigente do harness", mimeType: "application/json" },
244
+ async () => resourceText("letra://direction", JSON.stringify(auditRead("direction"), null, 2))
245
+ );
246
+ server.registerResource(
247
+ "active-spec",
248
+ "letra://spec/active",
249
+ { title: "Spec ativa", mimeType: "text/markdown" },
250
+ async () => resourceText(
251
+ "letra://spec/active",
252
+ (auditRead("active-spec"), safeActiveSpec(workspaceRoot, boundary).content ?? ""),
253
+ "text/markdown"
254
+ )
255
+ );
256
+ server.registerResource(
257
+ "constitution",
258
+ "letra://constitution",
259
+ { title: "Constitui\xE7\xE3o do workspace", mimeType: "text/markdown" },
260
+ async () => {
261
+ auditRead("constitution");
262
+ const path = boundary.assertPath(join(getLetraDir(workspaceRoot), "constitution.md"));
263
+ const content = existsSync(path) ? readFileSync(path, "utf-8") : "";
264
+ logEntry(workspaceRoot, "constitution_read", "Constitution read via MCP", {
265
+ details: {
266
+ adapter: "mcp",
267
+ by: "mcp:constitution-resource",
268
+ available: existsSync(path),
269
+ version: content.match(/\*\*Version:\*\*\s*(.+)/)?.[1]?.trim() ?? null
270
+ }
271
+ });
272
+ return resourceText("letra://constitution", content, "text/markdown");
273
+ }
274
+ );
275
+ server.registerResource(
276
+ "health",
277
+ "letra://health",
278
+ { title: "Sa\xFAde operacional", mimeType: "application/json" },
279
+ async () => resourceText(
280
+ "letra://health",
281
+ JSON.stringify((auditRead("health"), healthPayload(workspaceRoot)), null, 2)
282
+ )
283
+ );
284
+ const auditHarnessRead = (resource) => {
285
+ const direction = resolveAgentDirection(workspaceRoot);
286
+ const key = `harness:${resource}:${direction.revision}`;
287
+ if (auditedReads.has(key)) return;
288
+ auditedReads.add(key);
289
+ const client = clientIdentity();
290
+ logEntry(workspaceRoot, "agent_harness_read", `MCP harness read: ${resource}`, {
291
+ itemId: direction.item?.id,
292
+ acId: direction.pendingAC?.id,
293
+ details: {
294
+ adapter: "codex",
295
+ by: client.actor,
296
+ clientVersion: client.clientVersion,
297
+ resource,
298
+ revision: direction.revision,
299
+ outcome: "accepted"
300
+ }
301
+ });
302
+ };
303
+ server.registerResource(
304
+ "harness-templates",
305
+ "letra://harness/templates",
306
+ { title: "Templates dispon\xEDveis no harness", mimeType: "application/json" },
307
+ async () => {
308
+ auditHarnessRead("templates");
309
+ const workflow = loadWorkflow(workspaceRoot);
310
+ const harness = loadHarnessForWorkflow(workspaceRoot, workflow);
311
+ const templateIds = harness ? Object.keys(harness.flows).sort() : [];
312
+ return resourceText("letra://harness/templates", JSON.stringify(templateIds, null, 2));
313
+ }
314
+ );
315
+ server.resource(
316
+ "harness-template",
317
+ new ResourceTemplate("letra://harness/templates/{flowId}", { list: void 0 }),
318
+ async (uri, variables) => {
319
+ const flowId = variables.flowId;
320
+ auditHarnessRead(`templates/${flowId}`);
321
+ const workflow = loadWorkflow(workspaceRoot);
322
+ const harness = loadHarnessForWorkflow(workspaceRoot, workflow);
323
+ if (!harness) {
324
+ return resourceText(uri.href, JSON.stringify({ error: "Harness not available" }));
325
+ }
326
+ const template = harness.flows[flowId];
327
+ if (!template) {
328
+ return resourceText(
329
+ uri.href,
330
+ JSON.stringify({ error: `Template "${flowId}" not found` })
331
+ );
332
+ }
333
+ const resolvedStages = template.stages.map((stage) => {
334
+ const gateId = stage.gate ? gateIdFromRef(stage.gate) : null;
335
+ return {
336
+ id: stage.id,
337
+ name: stage.name,
338
+ order: stage.order,
339
+ zone: stage.zone,
340
+ description: stage.description,
341
+ gate: gateId && harness.gates[gateId] ? harness.gates[gateId] : null,
342
+ roles: stage.agents.map((roleId) => harness.roles[roleId]).filter(Boolean),
343
+ phases: stage.phases,
344
+ activity: stage.activity
345
+ };
346
+ });
347
+ const policyId = template.defaultPolicy ? template.defaultPolicy.replace(/^.*[\\/]/, "").replace(/\.json$/, "") : null;
348
+ return resourceText(
349
+ uri.href,
350
+ JSON.stringify(
351
+ {
352
+ id: template.id,
353
+ version: template.version,
354
+ name: template.name,
355
+ description: template.description,
356
+ defaultPolicy: template.defaultPolicy,
357
+ stages: resolvedStages,
358
+ gates: Object.values(harness.gates),
359
+ roles: Object.values(harness.roles),
360
+ policy: policyId && harness.policies[policyId] ? harness.policies[policyId] : null
361
+ },
362
+ null,
363
+ 2
364
+ )
365
+ );
366
+ }
367
+ );
368
+ server.registerResource(
369
+ "harness-gates",
370
+ "letra://harness/gates",
371
+ { title: "Gates do harness", mimeType: "application/json" },
372
+ async () => {
373
+ auditHarnessRead("gates");
374
+ return resourceText(
375
+ "letra://harness/gates",
376
+ JSON.stringify(collectGates(workspaceRoot), null, 2)
377
+ );
378
+ }
379
+ );
380
+ server.registerResource(
381
+ "harness-roles",
382
+ "letra://harness/roles",
383
+ { title: "Roles do harness", mimeType: "application/json" },
384
+ async () => {
385
+ auditHarnessRead("roles");
386
+ return resourceText(
387
+ "letra://harness/roles",
388
+ JSON.stringify(collectRoles(workspaceRoot), null, 2)
389
+ );
390
+ }
391
+ );
392
+ server.registerTool(
393
+ "list_gates",
394
+ {
395
+ description: "Lista todos os gates do template ativo do harness.",
396
+ annotations: readOnlyAnnotations
397
+ },
398
+ async () => {
399
+ auditHarnessRead("gates");
400
+ return jsonText(collectGates(workspaceRoot));
401
+ }
402
+ );
403
+ server.registerTool(
404
+ "list_roles",
405
+ {
406
+ description: "Lista todos os roles do template ativo do harness.",
407
+ annotations: readOnlyAnnotations
408
+ },
409
+ async () => {
410
+ auditHarnessRead("roles");
411
+ return jsonText(collectRoles(workspaceRoot));
412
+ }
413
+ );
414
+ return server;
415
+ }
416
+ async function startLetraMcpServer(root) {
417
+ const server = createLetraMcpServer(root);
418
+ await server.connect(new StdioServerTransport());
419
+ }
420
+ export {
421
+ createLetraMcpServer,
422
+ startLetraMcpServer
423
+ };
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ activityOperation,
4
+ claimOperation,
5
+ completeAcOperation,
6
+ recordExecutionEvent,
7
+ requestHandoffOperation,
8
+ requestTransitionOperation,
9
+ runValidationOperation,
10
+ submitEvidenceOperation
11
+ } from "./chunk-OIHMDOIN.js";
12
+ import "./chunk-H64RC3YS.js";
13
+ import "./chunk-DMOLJWWW.js";
14
+ import "./chunk-BKAUN5QH.js";
15
+ import "./chunk-JMIC5NKB.js";
16
+ import "./chunk-EDD55PWL.js";
17
+ import "./chunk-MJ2QXNH6.js";
18
+ import "./chunk-6HSUVCTR.js";
19
+ import "./chunk-PDX44BCA.js";
20
+ export {
21
+ activityOperation,
22
+ claimOperation,
23
+ completeAcOperation,
24
+ recordExecutionEvent,
25
+ requestHandoffOperation,
26
+ requestTransitionOperation,
27
+ runValidationOperation,
28
+ submitEvidenceOperation
29
+ };
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ closeSessionLogHandles,
4
+ loadSessionLog,
5
+ logEntry,
6
+ pruneSessionLog,
7
+ queryLog,
8
+ queryLogWithMeta,
9
+ saveSessionLog
10
+ } from "./chunk-BKAUN5QH.js";
11
+ import "./chunk-6HSUVCTR.js";
12
+ import "./chunk-PDX44BCA.js";
13
+ export {
14
+ closeSessionLogHandles,
15
+ loadSessionLog,
16
+ logEntry,
17
+ pruneSessionLog,
18
+ queryLog,
19
+ queryLogWithMeta,
20
+ saveSessionLog
21
+ };
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ sitrep,
4
+ sitrep_default
5
+ } from "./chunk-L6YKDTAQ.js";
6
+ import "./chunk-DMOLJWWW.js";
7
+ import "./chunk-BKAUN5QH.js";
8
+ import "./chunk-JMIC5NKB.js";
9
+ import "./chunk-EDD55PWL.js";
10
+ import "./chunk-MJ2QXNH6.js";
11
+ import "./chunk-6HSUVCTR.js";
12
+ import "./chunk-PDX44BCA.js";
13
+ export {
14
+ sitrep_default as default,
15
+ sitrep
16
+ };
package/package.json CHANGED
@@ -1,28 +1,37 @@
1
- {
2
- "name": "@letra-ai/cli",
3
- "version": "0.5.3",
4
- "type": "module",
5
- "bin": {
6
- "letra": "dist/index.js"
7
- },
8
- "main": "./dist/index.js",
9
- "types": "./dist/index.d.ts",
10
- "scripts": {
11
- "dev": "tsx src/index.ts",
12
- "build": "node ../../scripts/build-cli.mjs",
13
- "typecheck": "tsc --noEmit",
14
- "test": "vitest run",
15
- "test:watch": "vitest"
16
- },
17
- "dependencies": {
18
- "chalk": "^5.4.1",
19
- "commander": "^12.1.0",
20
- "glob": "^11.0.0",
21
- "ora": "^9.3.0"
22
- },
23
- "devDependencies": {
24
- "tsup": "^8.5.0",
25
- "typescript": "^5.8.3",
26
- "vitest": "^3.2.4"
27
- }
28
- }
1
+ {
2
+ "name": "@letra-ai/cli",
3
+ "version": "0.6.2",
4
+ "type": "module",
5
+ "bin": {
6
+ "letra": "dist/index.js"
7
+ },
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "files": ["dist"],
11
+ "engines": {
12
+ "node": ">=22"
13
+ },
14
+ "scripts": {
15
+ "dev": "tsx src/index.ts",
16
+ "build": "node ../../scripts/build-cli.mjs",
17
+ "typecheck": "tsc --noEmit",
18
+ "test": "vitest run",
19
+ "test:watch": "vitest"
20
+ },
21
+ "dependencies": {
22
+ "@modelcontextprotocol/sdk": "^1.29.0",
23
+ "chalk": "^5.4.1",
24
+ "commander": "^12.1.0",
25
+ "glob": "^11.0.0",
26
+ "ink": "^7.1.0",
27
+ "ora": "^9.3.0",
28
+ "react": "^19.2.7",
29
+ "zod": "^3.25.76"
30
+ },
31
+ "devDependencies": {
32
+ "@letra/types": "*",
33
+ "tsup": "^8.5.0",
34
+ "typescript": "^5.8.3",
35
+ "vitest": "^3.2.4"
36
+ }
37
+ }