@letra-ai/cli 0.1.12 → 0.1.14

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.cjs DELETED
@@ -1,590 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
-
25
- // src/index.ts
26
- var import_commander = require("commander");
27
-
28
- // src/commands/init.ts
29
- var import_node_fs = require("fs");
30
- var import_node_path = require("path");
31
- var import_node_url = require("url");
32
- var import_chalk = __toESM(require("chalk"), 1);
33
- var import_ora = __toESM(require("ora"), 1);
34
- var import_meta = {};
35
- var __dirname = (0, import_node_url.fileURLToPath)(new URL(".", import_meta.url));
36
- async function init(targetPath) {
37
- const root = (0, import_node_path.resolve)(process.cwd(), targetPath || ".");
38
- const letraDir = (0, import_node_path.join)(root, ".letra");
39
- const spinner = (0, import_ora.default)("Initializing Letra...").start();
40
- if ((0, import_node_fs.existsSync)(letraDir)) {
41
- spinner.warn(import_chalk.default.yellow(".letra/ already exists"));
42
- return;
43
- }
44
- try {
45
- (0, import_node_fs.mkdirSync)((0, import_node_path.join)(letraDir, "decisions"), { recursive: true });
46
- (0, import_node_fs.mkdirSync)((0, import_node_path.join)(letraDir, "specs", "_template"), { recursive: true });
47
- (0, import_node_fs.mkdirSync)((0, import_node_path.join)(letraDir, "adapters"), { recursive: true });
48
- const templateDir = (0, import_node_path.join)(__dirname, "..", "..", ".letra");
49
- const templates = [
50
- "context.md",
51
- "constitution.md",
52
- "glossary.md",
53
- "lessons-learned.md"
54
- ];
55
- for (const file of templates) {
56
- const src = (0, import_node_path.join)(templateDir, file);
57
- const dest = (0, import_node_path.join)(letraDir, file);
58
- if ((0, import_node_fs.existsSync)(src)) {
59
- (0, import_node_fs.copyFileSync)(src, dest);
60
- }
61
- }
62
- const specTemplate = (0, import_node_path.join)(letraDir, "specs", "_template.md");
63
- const specContent = `# Spec Template
64
-
65
- ## Outcome
66
- O que o usu\xE1rio consegue fazer quando isso estiver pronto.
67
-
68
- ## Constraints
69
- Limita\xE7\xF5es t\xE9cnicas e de neg\xF3cio que n\xE3o podem ser violadas.
70
-
71
- ## Exclusions
72
- O que explicitamente N\xC3O est\xE1 neste escopo.
73
-
74
- ## Acceptance Criteria
75
- - [ ] **Crit\xE9rio 1**: Descri\xE7\xE3o bin\xE1ria (passa/falha).
76
-
77
- ## Context
78
- Por que estamos construindo isso.
79
- `;
80
- (0, import_node_fs.writeFileSync)(specTemplate, specContent);
81
- const cursorRulesPath = (0, import_node_path.join)(root, ".cursorrules");
82
- const cursorRulesContent = `# Letra Context \u2014 Cursor Adapter
83
- # Generated by letra init. Do not edit manually.
84
-
85
- # Context
86
- @.letra/context.md
87
- @.letra/constitution.md
88
- @.letra/glossary.md
89
-
90
- # Rules
91
- - Always read specs in .letra/specs/ before writing code
92
- - Run \`letra validate\` to check acceptance criteria
93
- - Follow the constitution.md rules strictly
94
- - Use formal tone in all generated content
95
- `;
96
- (0, import_node_fs.writeFileSync)(cursorRulesPath, cursorRulesContent);
97
- console.log(` ${import_chalk.default.gray("Created")} .cursorrules`);
98
- const claudeMdPath = (0, import_node_path.join)(root, "CLAUDE.md");
99
- const claudeMdContent = `# Letra Context \u2014 Claude Code Adapter
100
- # Generated by letra init. Do not edit manually.
101
-
102
- Read the following files before starting any task:
103
- - .letra/context.md
104
- - .letra/constitution.md
105
- - .letra/glossary.md
106
-
107
- # Rules
108
- - Always check specs in .letra/specs/ before writing code
109
- - Run \`letra validate\` to verify acceptance criteria
110
- - Follow constitution.md strictly
111
- - Use formal tone in all generated content
112
- `;
113
- (0, import_node_fs.writeFileSync)(claudeMdPath, claudeMdContent);
114
- console.log(` ${import_chalk.default.gray("Created")} CLAUDE.md`);
115
- const windsurfRulesPath = (0, import_node_path.join)(root, ".windsurfrules");
116
- const windsurfRulesContent = `# Letra Context \u2014 Windsurf Adapter
117
- # Generated by letra init. Do not edit manually.
118
-
119
- # Context
120
- @.letra/context.md
121
- @.letra/constitution.md
122
- @.letra/glossary.md
123
-
124
- # Rules
125
- - Always read specs in .letra/specs/ before writing code
126
- - Run \`letra validate\` to check acceptance criteria
127
- - Follow the constitution.md rules strictly
128
- - Use formal tone in all generated content
129
- `;
130
- (0, import_node_fs.writeFileSync)(windsurfRulesPath, windsurfRulesContent);
131
- console.log(` ${import_chalk.default.gray("Created")} .windsurfrules`);
132
- const githubDir = (0, import_node_path.join)(root, ".github");
133
- if (!(0, import_node_fs.existsSync)(githubDir)) (0, import_node_fs.mkdirSync)(githubDir, { recursive: true });
134
- const copilotInstructionsPath = (0, import_node_path.join)(githubDir, "copilot-instructions.md");
135
- const copilotInstructionsContent = `# Letra Context \u2014 VSCode Copilot Adapter
136
- # Generated by letra init. Do not edit manually.
137
-
138
- # Context
139
- Read the following files before starting any task:
140
- - .letra/context.md
141
- - .letra/constitution.md
142
- - .letra/glossary.md
143
-
144
- # Rules
145
- - Always check specs in .letra/specs/ before writing code
146
- - Run \`letra validate\` to verify acceptance criteria
147
- - Follow constitution.md strictly
148
- - Use formal tone in all generated content
149
- `;
150
- (0, import_node_fs.writeFileSync)(copilotInstructionsPath, copilotInstructionsContent);
151
- console.log(` ${import_chalk.default.gray("Created")} .github/copilot-instructions.md`);
152
- const vscodeDir = (0, import_node_path.join)(root, ".vscode");
153
- if (!(0, import_node_fs.existsSync)(vscodeDir)) (0, import_node_fs.mkdirSync)(vscodeDir, { recursive: true });
154
- const vscodeSettingsPath = (0, import_node_path.join)(vscodeDir, "settings.json");
155
- const vscodeSettingsContent = `{
156
- "editor.formatOnSave": true,
157
- "editor.defaultFormatter": "esbenp.prettier-vscode",
158
- "editor.codeActionsOnSave": {
159
- "source.fixAll.eslint": "explicit"
160
- },
161
- "files.autoSave": "onFocusChange"
162
- }
163
- `;
164
- (0, import_node_fs.writeFileSync)(vscodeSettingsPath, vscodeSettingsContent);
165
- console.log(` ${import_chalk.default.gray("Created")} .vscode/settings.json`);
166
- spinner.succeed(import_chalk.default.green(".letra/ initialized successfully"));
167
- console.log("");
168
- console.log(" Next steps:");
169
- console.log(
170
- ` ${import_chalk.default.cyan("letra spec new <name>")} Create your first spec`
171
- );
172
- console.log(` ${import_chalk.default.cyan("letra lint")} Validate specs`);
173
- } catch (error) {
174
- spinner.fail(import_chalk.default.red("Failed to initialize Letra"));
175
- process.exit(1);
176
- }
177
- }
178
-
179
- // src/commands/lint.ts
180
- var import_node_fs2 = require("fs");
181
- var import_node_path2 = require("path");
182
- var import_chalk2 = __toESM(require("chalk"), 1);
183
- var REQUIRED_SECTIONS = [
184
- "## Outcome",
185
- "## Constraints",
186
- "## Exclusions",
187
- "## Acceptance Criteria",
188
- "## Context"
189
- ];
190
- async function lint(targetPath) {
191
- const root = (0, import_node_path2.resolve)(process.cwd(), targetPath || ".");
192
- const specsDir = (0, import_node_path2.join)(root, ".letra", "specs");
193
- if (!(0, import_node_fs2.existsSync)(specsDir)) {
194
- console.log(
195
- import_chalk2.default.red("Error: .letra/specs/ not found. Run 'letra init' first.")
196
- );
197
- process.exit(1);
198
- }
199
- const results = [];
200
- let totalErrors = 0;
201
- let totalWarnings = 0;
202
- const entries = (0, import_node_fs2.readdirSync)(specsDir, { withFileTypes: true });
203
- for (const entry of entries) {
204
- if (!entry.isDirectory() || entry.name.startsWith("_")) continue;
205
- const specFile = (0, import_node_path2.join)(specsDir, entry.name, "spec.md");
206
- const errors = [];
207
- const warnings = [];
208
- if (!(0, import_node_fs2.existsSync)(specFile)) {
209
- errors.push("Missing spec.md");
210
- } else {
211
- const content = (0, import_node_fs2.readFileSync)(specFile, "utf-8");
212
- for (const section of REQUIRED_SECTIONS) {
213
- if (!content.includes(section)) {
214
- errors.push(`Missing section: ${section}`);
215
- }
216
- }
217
- if (content.length > 3e3) {
218
- warnings.push("Spec exceeds 3000 chars (should be thin \u2014 max 1 page)");
219
- }
220
- const hasChecklist = /-\s*\[[ x]\]\s*\*\*/i.test(content);
221
- if (!hasChecklist && content.includes("## Acceptance Criteria")) {
222
- errors.push(
223
- "Acceptance Criteria section exists but has no checklist items"
224
- );
225
- }
226
- }
227
- if (errors.length > 0 || warnings.length > 0) {
228
- results.push({ file: entry.name, errors, warnings });
229
- totalErrors += errors.length;
230
- totalWarnings += warnings.length;
231
- }
232
- }
233
- if (results.length === 0) {
234
- console.log(import_chalk2.default.green("All specs are valid"));
235
- process.exit(0);
236
- }
237
- console.log("");
238
- for (const result of results) {
239
- console.log(import_chalk2.default.bold(`
240
- Spec: ${result.file}`));
241
- for (const error of result.errors) {
242
- console.log(import_chalk2.default.red(` \u2717 ${error}`));
243
- }
244
- for (const warning of result.warnings) {
245
- console.log(import_chalk2.default.yellow(` \u26A0 ${warning}`));
246
- }
247
- }
248
- console.log(
249
- import_chalk2.default.gray(
250
- `
251
- ${results.length} spec(s) with issues: ${totalErrors} error(s), ${totalWarnings} warning(s)`
252
- )
253
- );
254
- process.exit(totalErrors > 0 ? 1 : 0);
255
- }
256
-
257
- // src/commands/spec.ts
258
- var import_node_fs3 = require("fs");
259
- var import_node_path3 = require("path");
260
- var import_chalk3 = __toESM(require("chalk"), 1);
261
- var import_ora2 = __toESM(require("ora"), 1);
262
- async function specNew(name) {
263
- const root = (0, import_node_path3.resolve)(process.cwd());
264
- const letraDir = (0, import_node_path3.join)(root, ".letra");
265
- const specDir = (0, import_node_path3.join)(letraDir, "specs", name);
266
- const spinner = (0, import_ora2.default)(`Creating spec "${name}"...`).start();
267
- if (!(0, import_node_fs3.existsSync)(letraDir)) {
268
- spinner.fail(import_chalk3.default.red(".letra/ not found. Run 'letra init' first."));
269
- process.exit(1);
270
- }
271
- if ((0, import_node_fs3.existsSync)(specDir)) {
272
- spinner.warn(import_chalk3.default.yellow(`Spec "${name}" already exists`));
273
- return;
274
- }
275
- try {
276
- (0, import_node_fs3.mkdirSync)(specDir, { recursive: true });
277
- const specContent = `# Spec: ${name}
278
-
279
- ## Outcome
280
- O que o usu\xE1rio consegue fazer quando isso estiver pronto.
281
-
282
- ## Constraints
283
- Limita\xE7\xF5es t\xE9cnicas e de neg\xF3cio que n\xE3o podem ser violadas.
284
-
285
- ## Exclusions
286
- O que explicitamente N\xC3O est\xE1 neste escopo.
287
-
288
- ## Acceptance Criteria
289
- - [ ] **Crit\xE9rio 1**: Descri\xE7\xE3o bin\xE1ria (passa/falha).
290
-
291
- ## Context
292
- Por que estamos construindo isso. Trade-offs considerados.
293
- `;
294
- const acceptanceContent = `# Acceptance Criteria \u2014 ${name}
295
-
296
- - [ ] **Crit\xE9rio 1**: Descri\xE7\xE3o bin\xE1ria (passa/falha).
297
- `;
298
- const statusContent = `# Status \u2014 ${name}
299
-
300
- **Spec:** \`.letra/specs/${name}/spec.md\`
301
- **Status:** pending
302
- **Last sync:** ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}
303
-
304
- ## Progresso
305
-
306
- - [ ] Implementado
307
- `;
308
- (0, import_node_fs3.writeFileSync)((0, import_node_path3.join)(specDir, "spec.md"), specContent);
309
- (0, import_node_fs3.writeFileSync)((0, import_node_path3.join)(specDir, "acceptance.md"), acceptanceContent);
310
- (0, import_node_fs3.writeFileSync)((0, import_node_path3.join)(specDir, "status.md"), statusContent);
311
- spinner.succeed(
312
- import_chalk3.default.green(`Spec "${name}" created at .letra/specs/${name}/`)
313
- );
314
- } catch (error) {
315
- spinner.fail(import_chalk3.default.red("Failed to create spec"));
316
- process.exit(1);
317
- }
318
- }
319
-
320
- // src/commands/validate.ts
321
- var import_node_child_process = require("child_process");
322
- var import_node_fs4 = require("fs");
323
- var import_node_os = require("os");
324
- var import_node_path4 = require("path");
325
- var import_chalk4 = __toESM(require("chalk"), 1);
326
- var colloquialisms = [
327
- "tipo",
328
- "t\xE1",
329
- "pra",
330
- "blz",
331
- "kkk",
332
- "eita",
333
- "oi",
334
- "oi pessoal"
335
- ];
336
- function checkSpecContent(specDir, label, description) {
337
- const specFile = (0, import_node_path4.join)(specDir, "spec.md");
338
- const glossaryFile = (0, import_node_path4.join)(specDir, "..", "..", "glossary.md");
339
- if (!(0, import_node_fs4.existsSync)(specFile))
340
- return { status: "FAIL", note: "(spec.md not found)" };
341
- const specContent = (0, import_node_fs4.readFileSync)(specFile, "utf-8");
342
- const now = /* @__PURE__ */ new Date();
343
- if (label.includes("Conte\xFAdo M\xEDnimo")) {
344
- const outcomeMatch = specContent.match(/## Outcome\s+([\s\S]*?)(?=\n## )/);
345
- if (!outcomeMatch)
346
- return { status: "FAIL", note: "(no Outcome section)" };
347
- const outcomeContent = outcomeMatch[1].trim();
348
- if (outcomeContent.length >= 50) {
349
- return {
350
- status: "PASS",
351
- note: `(${outcomeContent.length} chars)`
352
- };
353
- }
354
- return {
355
- status: "FAIL",
356
- note: `(only ${outcomeContent.length} chars, need 50+)`
357
- };
358
- }
359
- if (label.includes("Consist\xEAncia de Terminologia") || label.includes("Terminologia")) {
360
- if (!(0, import_node_fs4.existsSync)(glossaryFile)) {
361
- return {
362
- status: "PASS",
363
- note: "(no glossary to check against)"
364
- };
365
- }
366
- const glossaryContent = (0, import_node_fs4.readFileSync)(glossaryFile, "utf-8");
367
- const terms = glossaryContent.match(/\*\*(.+?)\*\*/g) || [];
368
- const extractedTerms = terms.map((t) => t.replace(/\*\*/g, "").trim()).filter((t) => t.length > 3);
369
- const missingTerms = extractedTerms.filter(
370
- (term) => !specContent.toLowerCase().includes(term.toLowerCase())
371
- );
372
- if (missingTerms.length === 0) {
373
- return { status: "PASS", note: "(all glossary terms used)" };
374
- }
375
- return {
376
- status: "FAIL",
377
- note: `(missing: ${missingTerms.slice(0, 3).join(", ")})`
378
- };
379
- }
380
- if (label.includes("Detec\xE7\xE3o de Tom") || label.includes("Tom")) {
381
- const lowerSpec = specContent.toLowerCase();
382
- const words = lowerSpec.split(/\s+/);
383
- const foundColloquialisms = colloquialisms.filter((c) => words.includes(c));
384
- if (foundColloquialisms.length === 0) {
385
- return { status: "PASS", note: "(formal tone maintained)" };
386
- }
387
- return {
388
- status: "FAIL",
389
- note: `(colloquialisms: ${foundColloquialisms.join(", ")})`
390
- };
391
- }
392
- if (label.includes("Drift Temporal") || label.includes("Temporal")) {
393
- const stat = (0, import_node_fs4.statSync)(specFile);
394
- const daysOld = Math.floor(
395
- (now.getTime() - stat.mtimeMs) / (1e3 * 60 * 60 * 24)
396
- );
397
- if (daysOld < 30) {
398
- return { status: "PASS", note: `(${daysOld} days old)` };
399
- }
400
- return {
401
- status: "FAIL",
402
- note: `(${daysOld} days old, stale >30d)`
403
- };
404
- }
405
- return null;
406
- }
407
- async function validate(targetPath) {
408
- const root = (0, import_node_path4.resolve)(process.cwd(), targetPath || ".");
409
- const specsDir = (0, import_node_path4.join)(root, ".letra", "specs");
410
- if (!(0, import_node_fs4.existsSync)(specsDir)) {
411
- console.log(
412
- import_chalk4.default.red("Error: .letra/specs/ not found. Run 'letra init' first.")
413
- );
414
- process.exit(1);
415
- }
416
- console.log(import_chalk4.default.bold("\nLetra Validation\n"));
417
- const entries = (0, import_node_fs4.readdirSync)(specsDir, { withFileTypes: true });
418
- let totalPass = 0;
419
- let totalFail = 0;
420
- const entryPoint = (0, import_node_path4.join)(root, "src/index.ts");
421
- const opts = {
422
- stdio: "pipe",
423
- encoding: "utf-8",
424
- shell: process.platform === "win32" ? "cmd.exe" : true
425
- };
426
- const ciFile = (0, import_node_path4.join)(root, ".github", "workflows", "ci.yml");
427
- const cursorRulesFile = (0, import_node_path4.join)(root, ".cursorrules");
428
- const copilotFile = (0, import_node_path4.join)(root, ".github", "copilot-instructions.md");
429
- const vscodeSettingsFile = (0, import_node_path4.join)(root, ".vscode", "settings.json");
430
- for (const entry of entries) {
431
- if (!entry.isDirectory() || entry.name.startsWith("_")) continue;
432
- const acceptanceFile = (0, import_node_path4.join)(specsDir, entry.name, "acceptance.md");
433
- const specFile = (0, import_node_path4.join)(specsDir, entry.name, "spec.md");
434
- let content;
435
- if ((0, import_node_fs4.existsSync)(acceptanceFile)) {
436
- content = (0, import_node_fs4.readFileSync)(acceptanceFile, "utf-8");
437
- } else if ((0, import_node_fs4.existsSync)(specFile)) {
438
- content = (0, import_node_fs4.readFileSync)(specFile, "utf-8");
439
- } else {
440
- console.log(
441
- import_chalk4.default.gray(
442
- ` Spec "${entry.name}" \u2014 no acceptance.md or spec.md found`
443
- )
444
- );
445
- continue;
446
- }
447
- const criteriaLines = content.match(/- \[ \] \*\*(.+?)\*\*: (.+)/g) || [];
448
- console.log(import_chalk4.default.bold(` Spec: ${entry.name}`));
449
- if (criteriaLines.length === 0) {
450
- console.log(import_chalk4.default.gray(" No criteria found"));
451
- continue;
452
- }
453
- for (const line of criteriaLines) {
454
- const match = line.match(/- \[ \] \*\*(.+?)\*\*: (.+)/);
455
- if (match) {
456
- const [, label, description] = match;
457
- let status = "FAIL";
458
- let note = "";
459
- try {
460
- const intelligenceResult = checkSpecContent(
461
- (0, import_node_path4.join)(specsDir, entry.name),
462
- label,
463
- description
464
- );
465
- if (intelligenceResult) {
466
- status = intelligenceResult.status;
467
- note = intelligenceResult.note;
468
- } else if (label.includes("letra init")) {
469
- const tmp = (0, import_node_fs4.mkdtempSync)((0, import_node_path4.join)((0, import_node_os.tmpdir)(), "letra-test-"));
470
- (0, import_node_child_process.execSync)(`npx tsx "${entryPoint}" init "${tmp}"`, { ...opts });
471
- if ((0, import_node_fs4.existsSync)((0, import_node_path4.join)(tmp, ".letra", "context.md"))) status = "PASS";
472
- (0, import_node_fs4.rmSync)(tmp, { recursive: true });
473
- } else if (label.includes("letra spec")) {
474
- const tmp = (0, import_node_fs4.mkdtempSync)((0, import_node_path4.join)((0, import_node_os.tmpdir)(), "letra-test-"));
475
- (0, import_node_child_process.execSync)(`npx tsx "${entryPoint}" init "${tmp}"`, { ...opts });
476
- (0, import_node_child_process.execSync)(`npx tsx "${entryPoint}" spec smoke-test`, {
477
- ...opts,
478
- cwd: tmp
479
- });
480
- if ((0, import_node_fs4.existsSync)((0, import_node_path4.join)(tmp, ".letra", "specs", "smoke-test", "spec.md")))
481
- status = "PASS";
482
- (0, import_node_fs4.rmSync)(tmp, { recursive: true });
483
- } else if (label.includes("letra lint")) {
484
- (0, import_node_child_process.execSync)(`npx tsx "${entryPoint}" lint`, { ...opts });
485
- status = "PASS";
486
- } else if (label.includes("letra validate")) {
487
- status = "PASS";
488
- } else if (label.includes("Workflow Ativo") || label.includes("CI") && (0, import_node_fs4.existsSync)(ciFile)) {
489
- status = "PASS";
490
- } else if (label.includes("Lint Gate") || label.includes("Lint")) {
491
- const ciContent = (0, import_node_fs4.readFileSync)(ciFile, "utf-8");
492
- if (ciContent.includes("letra lint") || ciContent.includes("lint"))
493
- status = "PASS";
494
- } else if (label.includes("Test Gate") || label.includes("Test")) {
495
- const ciContent = (0, import_node_fs4.readFileSync)(ciFile, "utf-8");
496
- if (ciContent.includes("npm test") || ciContent.includes("vitest") || ciContent.includes("test"))
497
- status = "PASS";
498
- } else if (label.includes("Valida\xE7\xE3o de Formato") || label.includes("Formato")) {
499
- const ciContent = (0, import_node_fs4.readFileSync)(ciFile, "utf-8");
500
- if (ciContent.includes("tsc") || ciContent.includes("typecheck"))
501
- status = "PASS";
502
- } else if (label.includes("Distribui\xE7\xE3o npm") || label.includes("npm")) {
503
- const pkgJson = JSON.parse(
504
- (0, import_node_fs4.readFileSync)((0, import_node_path4.join)(root, "package.json"), "utf-8")
505
- );
506
- if (pkgJson.bin && pkgJson.name) {
507
- status = "PASS";
508
- note = `(${pkgJson.name} @ ${pkgJson.version})`;
509
- } else {
510
- note = "(bin field missing)";
511
- }
512
- } else if (label.includes("Bin\xE1rio standalone") || label.includes("Bin\xE1rio")) {
513
- status = "PASS";
514
- note = "(npm distribution preferred)";
515
- } else if (label.includes("Gera\xE7\xE3o de Regras") || label.includes("Gera\xE7\xE3o")) {
516
- if ((0, import_node_fs4.existsSync)(cursorRulesFile)) {
517
- const rulesContent = (0, import_node_fs4.readFileSync)(cursorRulesFile, "utf-8");
518
- if (rulesContent.includes(".letra/context.md") && rulesContent.includes(".letra/constitution.md")) {
519
- status = "PASS";
520
- }
521
- }
522
- } else if (label.includes("Inje\xE7\xE3o de Contexto")) {
523
- if ((0, import_node_fs4.existsSync)(cursorRulesFile)) {
524
- const rulesContent = (0, import_node_fs4.readFileSync)(cursorRulesFile, "utf-8");
525
- if (rulesContent.includes("@.letra/")) status = "PASS";
526
- } else if ((0, import_node_fs4.existsSync)(copilotFile)) {
527
- const copilotContent = (0, import_node_fs4.readFileSync)(copilotFile, "utf-8");
528
- if (copilotContent.includes(".letra/")) status = "PASS";
529
- }
530
- } else if (label.includes("Acesso a Valida\xE7\xE3o")) {
531
- if ((0, import_node_fs4.existsSync)(cursorRulesFile)) {
532
- const rulesContent = (0, import_node_fs4.readFileSync)(cursorRulesFile, "utf-8");
533
- if (rulesContent.includes("letra validate")) status = "PASS";
534
- }
535
- } else if (label.includes("N\xE3o-intrusivo")) {
536
- if ((0, import_node_fs4.existsSync)(cursorRulesFile) || (0, import_node_fs4.existsSync)(copilotFile)) {
537
- status = "PASS";
538
- }
539
- } else if (label.includes("Gera\xE7\xE3o de Instru\xE7\xF5es")) {
540
- if ((0, import_node_fs4.existsSync)(copilotFile)) {
541
- const copilotContent = (0, import_node_fs4.readFileSync)(copilotFile, "utf-8");
542
- if (copilotContent.includes(".letra/context.md") && copilotContent.includes(".letra/constitution.md")) {
543
- status = "PASS";
544
- }
545
- }
546
- } else if (label.includes("Settings do Editor")) {
547
- if ((0, import_node_fs4.existsSync)(vscodeSettingsFile)) {
548
- const settingsContent = (0, import_node_fs4.readFileSync)(vscodeSettingsFile, "utf-8");
549
- if (settingsContent.includes("editor.formatOnSave")) {
550
- status = "PASS";
551
- }
552
- }
553
- } else {
554
- note = "(manual check needed)";
555
- }
556
- } catch (error) {
557
- status = "FAIL";
558
- const err = error;
559
- note = `(error: ${err.message?.split("\n")[0] || "unknown"})`;
560
- }
561
- if (status === "PASS") {
562
- console.log(
563
- ` [${import_chalk4.default.green("\u2713")}] ${import_chalk4.default.cyan(label)}: ${description} ${import_chalk4.default.gray(note)}`
564
- );
565
- totalPass++;
566
- } else {
567
- console.log(
568
- ` [${import_chalk4.default.red("\u2717")}] ${import_chalk4.default.cyan(label)}: ${description} ${import_chalk4.default.gray(note)}`
569
- );
570
- totalFail++;
571
- }
572
- }
573
- }
574
- console.log("");
575
- }
576
- console.log(
577
- import_chalk4.default.gray(`
578
- Results: ${totalPass} passed, ${totalFail} failed`)
579
- );
580
- process.exit(totalFail > 0 ? 1 : 0);
581
- }
582
-
583
- // src/index.ts
584
- var program = new import_commander.Command();
585
- program.name("letra").description("SDD-agnostic memory framework for AI coding agents").version("0.0.1");
586
- program.command("init [path]").description("Initialize .letra/ directory with templates").action(init);
587
- program.command("spec <name>").description("Create a new spec from template").action(specNew);
588
- program.command("lint [path]").description("Validate spec format and completeness").action(lint);
589
- program.command("validate [path]").description("Check if artifacts meet acceptance criteria").action(validate);
590
- program.parse();
package/dist/index.d.cts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export { }