@letra-ai/cli 0.4.1 → 0.6.1

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 (96) hide show
  1. package/dist/chunk-4QDEU6KP.js +2765 -0
  2. package/dist/chunk-6HSUVCTR.js +363 -0
  3. package/dist/chunk-BKAUN5QH.js +300 -0
  4. package/dist/chunk-BTPFUKHG.js +275 -0
  5. package/dist/chunk-EDD55PWL.js +119 -0
  6. package/dist/chunk-ELBTIPYN.js +256 -0
  7. package/dist/chunk-IEFSLCJL.js +837 -0
  8. package/dist/chunk-JMIC5NKB.js +235 -0
  9. package/dist/chunk-KGQLHMGZ.js +4494 -0
  10. package/dist/chunk-MJ2QXNH6.js +130 -0
  11. package/dist/chunk-MSF44WWE.js +443 -0
  12. package/dist/chunk-PDX44BCA.js +11 -0
  13. package/dist/chunk-QIVKP3EY.js +362 -0
  14. package/dist/client/assets/index-BuABgOyz.js +232 -0
  15. package/dist/client/assets/index-CpseCZh9.css +1 -0
  16. package/dist/client/favicon.svg +15 -3
  17. package/dist/client/index.html +10 -5
  18. package/dist/fallback-UXSZ4LNR.js +47 -0
  19. package/dist/flow-serve-MTB6KZMR.js +19 -0
  20. package/dist/focus-sync-3D3XWCTI.js +17 -0
  21. package/dist/generate-N22QOXUF.js +20 -0
  22. package/dist/harness/default/v0.1.0/flows/sdlc.yaml +179 -0
  23. package/dist/harness/default/v0.1.0/gates/all-acs-passing.yaml +8 -0
  24. package/dist/harness/default/v0.1.0/gates/has-spec-file.yaml +7 -0
  25. package/dist/harness/default/v0.1.0/gates/human-approved-code.yaml +8 -0
  26. package/dist/harness/default/v0.1.0/gates/human-approved-spec.yaml +8 -0
  27. package/dist/harness/default/v0.1.0/gates/security-clear.yaml +8 -0
  28. package/dist/harness/default/v0.1.0/policies/sdlc-default.json +20 -0
  29. package/dist/harness/default/v0.1.0/roles/analyst.yaml +9 -0
  30. package/dist/harness/default/v0.1.0/roles/builder.yaml +9 -0
  31. package/dist/harness/default/v0.1.0/roles/pr-bot.yaml +8 -0
  32. package/dist/harness/default/v0.1.0/roles/reviewer.yaml +10 -0
  33. package/dist/harness/default/v0.1.0/roles/security.yaml +8 -0
  34. package/dist/harness/default/v0.1.1/flows/flow-main.yaml +61 -0
  35. package/dist/harness/default/v0.1.1/flows/sdlc.yaml +179 -0
  36. package/dist/harness/default/v0.1.1/gates/all-acs-passing.yaml +8 -0
  37. package/dist/harness/default/v0.1.1/gates/has-spec-file.yaml +7 -0
  38. package/dist/harness/default/v0.1.1/gates/human-approved-code.yaml +8 -0
  39. package/dist/harness/default/v0.1.1/gates/human-approved-spec.yaml +8 -0
  40. package/dist/harness/default/v0.1.1/gates/security-clear.yaml +8 -0
  41. package/dist/harness/default/v0.1.1/policies/sdlc-default.json +20 -0
  42. package/dist/harness/default/v0.1.1/roles/analyst.yaml +9 -0
  43. package/dist/harness/default/v0.1.1/roles/builder.yaml +9 -0
  44. package/dist/harness/default/v0.1.1/roles/pr-bot.yaml +8 -0
  45. package/dist/harness/default/v0.1.1/roles/reviewer.yaml +10 -0
  46. package/dist/harness/default/v0.1.1/roles/security.yaml +8 -0
  47. package/dist/harness/default/v0.1.2/flows/flow-main.yaml +86 -0
  48. package/dist/harness/default/v0.1.2/flows/sdlc.yaml +179 -0
  49. package/dist/harness/default/v0.1.2/gates/all-acs-passing.yaml +8 -0
  50. package/dist/harness/default/v0.1.2/gates/has-spec-file.yaml +7 -0
  51. package/dist/harness/default/v0.1.2/gates/human-approved-code.yaml +8 -0
  52. package/dist/harness/default/v0.1.2/gates/human-approved-spec.yaml +8 -0
  53. package/dist/harness/default/v0.1.2/gates/security-clear.yaml +8 -0
  54. package/dist/harness/default/v0.1.2/policies/sdlc-default.json +20 -0
  55. package/dist/harness/default/v0.1.2/roles/analyst.yaml +9 -0
  56. package/dist/harness/default/v0.1.2/roles/builder.yaml +9 -0
  57. package/dist/harness/default/v0.1.2/roles/pr-bot.yaml +8 -0
  58. package/dist/harness/default/v0.1.2/roles/reviewer.yaml +10 -0
  59. package/dist/harness/default/v0.1.2/roles/security.yaml +8 -0
  60. package/dist/harness/default/v0.1.3/flows/flow-main.yaml +90 -0
  61. package/dist/harness/default/v0.1.3/flows/sdlc.yaml +179 -0
  62. package/dist/harness/default/v0.1.3/gates/all-acs-passing.yaml +8 -0
  63. package/dist/harness/default/v0.1.3/gates/has-spec-file.yaml +7 -0
  64. package/dist/harness/default/v0.1.3/gates/human-approved-code.yaml +9 -0
  65. package/dist/harness/default/v0.1.3/gates/human-approved-spec.yaml +9 -0
  66. package/dist/harness/default/v0.1.3/gates/security-clear.yaml +8 -0
  67. package/dist/harness/default/v0.1.3/policies/sdlc-default.json +20 -0
  68. package/dist/harness/default/v0.1.3/roles/analyst.yaml +9 -0
  69. package/dist/harness/default/v0.1.3/roles/builder.yaml +9 -0
  70. package/dist/harness/default/v0.1.3/roles/pr-bot.yaml +8 -0
  71. package/dist/harness/default/v0.1.3/roles/reviewer.yaml +10 -0
  72. package/dist/harness/default/v0.1.3/roles/security.yaml +8 -0
  73. package/dist/harness/default/v0.2.0/executors/registry.yaml +51 -0
  74. package/dist/harness/default/v0.2.0/flows/flow-main.yaml +247 -0
  75. package/dist/harness/default/v0.2.0/gates/code-reviewed.yaml +7 -0
  76. package/dist/harness/default/v0.2.0/gates/human-approved.yaml +10 -0
  77. package/dist/harness/default/v0.2.0/gates/security-clear.yaml +7 -0
  78. package/dist/harness/default/v0.2.0/gates/spec-approved.yaml +10 -0
  79. package/dist/harness/default/v0.2.0/policies/sdlc-default.json +20 -0
  80. package/dist/harness/default/v0.2.0/roles/analyst.yaml +16 -0
  81. package/dist/harness/default/v0.2.0/roles/implementer.yaml +17 -0
  82. package/dist/harness/default/v0.2.0/roles/reviewer.yaml +17 -0
  83. package/dist/harness/default/v0.2.0/roles/security.yaml +17 -0
  84. package/dist/health-record-YDVXEVLR.js +21 -0
  85. package/dist/index.js +2595 -3046
  86. package/dist/init-wizard-NODBBNKO.js +178 -0
  87. package/dist/push-5JEYSXBY.js +116 -0
  88. package/dist/registry-6VPIA3EG.js +18 -0
  89. package/dist/server-FUP3APZA.js +415 -0
  90. package/dist/service-OGF7BMCQ.js +21 -0
  91. package/dist/session-log-WTQ5JBEN.js +21 -0
  92. package/dist/sitrep-DJXTP3JO.js +16 -0
  93. package/package.json +11 -2
  94. package/dist/client/assets/index-9KbFvLoH.css +0 -1
  95. package/dist/client/assets/index-s9Re0Bnf.js +0 -84
  96. package/tsup.config.ts +0 -11
@@ -0,0 +1,178 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ supportedAdapterTools
4
+ } from "./chunk-JMIC5NKB.js";
5
+ import "./chunk-PDX44BCA.js";
6
+
7
+ // src/tui/init-wizard.tsx
8
+ import { useState, useCallback } from "react";
9
+ import { Box, Text, useInput, render, Spacer } from "ink";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ var LOGO = `
12
+ __ __
13
+ / /_____ _/ /____ ____
14
+ / __/ __ \`/ __/ _ \\/ __ \\
15
+ / /_/ /_/ / /_/ __/ / / /
16
+ \\__/\\__,_/\\__/\\___/_/ /_/
17
+ `;
18
+ var PROJECT_TYPES = ["web-app", "cli", "library", "mobile"];
19
+ var TOOL_OPTIONS = [
20
+ ...supportedAdapterTools().map((adapter) => ({ id: adapter.id, label: adapter.label })),
21
+ { id: "todos", label: "Todos (recomendado)" }
22
+ ];
23
+ function WelcomeStep({ onNext }) {
24
+ useInput((_input, key) => {
25
+ if (key.return || _input === " ") onNext();
26
+ });
27
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", alignItems: "center", paddingY: 1, children: [
28
+ /* @__PURE__ */ jsx(Text, { color: "cyan", children: LOGO }),
29
+ /* @__PURE__ */ jsx(Text, { bold: true, children: " Bem-vindo ao Letra! " }),
30
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: " Specification-Driven Development " }),
31
+ /* @__PURE__ */ jsx(Spacer, {}),
32
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: " Pressione Enter para continuar " })
33
+ ] });
34
+ }
35
+ function SelectStep({ title, options, selected, onSelect, onConfirm }) {
36
+ const [cursor, setCursor] = useState(0);
37
+ useInput((_input, key) => {
38
+ if (key.upArrow) {
39
+ setCursor((p) => p > 0 ? p - 1 : options.length - 1);
40
+ } else if (key.downArrow) {
41
+ setCursor((p) => p < options.length - 1 ? p + 1 : 0);
42
+ } else if (key.return) {
43
+ onSelect(options[cursor].id);
44
+ onConfirm();
45
+ }
46
+ });
47
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingY: 1, children: [
48
+ /* @__PURE__ */ jsxs(Text, { bold: true, children: [
49
+ " ",
50
+ title,
51
+ " "
52
+ ] }),
53
+ /* @__PURE__ */ jsx(Spacer, {}),
54
+ options.map((opt, i) => /* @__PURE__ */ jsx(Box, { marginY: 0, children: /* @__PURE__ */ jsxs(Text, { color: i === cursor ? "cyan" : void 0, children: [
55
+ i === cursor ? " > " : " ",
56
+ opt.label,
57
+ selected === opt.id ? " (selecionado)" : ""
58
+ ] }) }, opt.id)),
59
+ /* @__PURE__ */ jsx(Spacer, {}),
60
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: " Setas: navegar | Enter: confirmar " })
61
+ ] });
62
+ }
63
+ function PreviewStep({
64
+ projectType,
65
+ tool,
66
+ onConfirm,
67
+ onBack
68
+ }) {
69
+ useInput((_input, key) => {
70
+ if (key.return) onConfirm();
71
+ if (key.escape) onBack();
72
+ });
73
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingY: 1, children: [
74
+ /* @__PURE__ */ jsx(Text, { bold: true, children: " Preview do Setup " }),
75
+ /* @__PURE__ */ jsx(Spacer, {}),
76
+ /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 2, children: [
77
+ /* @__PURE__ */ jsxs(Text, { children: [
78
+ " ",
79
+ "Tipo de projeto: ",
80
+ /* @__PURE__ */ jsx(Text, { bold: true, children: projectType })
81
+ ] }),
82
+ /* @__PURE__ */ jsxs(Text, { children: [
83
+ " ",
84
+ "Ferramenta IA:",
85
+ " ",
86
+ /* @__PURE__ */ jsx(Text, { bold: true, children: TOOL_OPTIONS.find((t) => t.id === tool)?.label || tool })
87
+ ] })
88
+ ] }),
89
+ /* @__PURE__ */ jsx(Spacer, {}),
90
+ /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 2, children: [
91
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: " Ser\xE1 criado: " }),
92
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: " - .letra/ (contexto, constitui\xE7\xE3o, specs) " }),
93
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: " - Adapters para a ferramenta selecionada " }),
94
+ tool === "vscode" || tool === "todos" ? /* @__PURE__ */ jsx(Text, { dimColor: true, children: " - .vscode/settings.json " }) : null
95
+ ] }),
96
+ /* @__PURE__ */ jsx(Spacer, {}),
97
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: " Enter: criar | Esc: voltar " })
98
+ ] });
99
+ }
100
+ function ProgressStep({ done }) {
101
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", alignItems: "center", paddingY: 1, children: [
102
+ /* @__PURE__ */ jsxs(Text, { children: [
103
+ " ",
104
+ done ? " Criado com sucesso!" : " Criando...",
105
+ " "
106
+ ] }),
107
+ /* @__PURE__ */ jsx(Spacer, {}),
108
+ /* @__PURE__ */ jsx(Text, { color: done ? "green" : "yellow", children: done ? " .letra/ inicializado" : " Configurando..." })
109
+ ] });
110
+ }
111
+ async function runInitWizard() {
112
+ return new Promise((resolve, reject) => {
113
+ const { waitUntilExit } = render(/* @__PURE__ */ jsx(WizardApp, { onDone: resolve }));
114
+ waitUntilExit().then(() => {
115
+ }).catch(reject);
116
+ });
117
+ }
118
+ function WizardApp({ onDone }) {
119
+ const [step, setStep] = useState(0);
120
+ const [projectType, setProjectType] = useState("web-app");
121
+ const [tool, setTool] = useState("todos");
122
+ const [creating, setCreating] = useState(false);
123
+ const [created, setCreated] = useState(false);
124
+ const handleFinish = useCallback(() => {
125
+ onDone({ projectType, tool });
126
+ }, [projectType, tool, onDone]);
127
+ if (creating) {
128
+ setTimeout(() => {
129
+ setCreated(true);
130
+ setTimeout(() => handleFinish(), 500);
131
+ }, 10);
132
+ return /* @__PURE__ */ jsx(ProgressStep, { done: created });
133
+ }
134
+ switch (step) {
135
+ case 0:
136
+ return /* @__PURE__ */ jsx(WelcomeStep, { onNext: () => setStep(1) });
137
+ case 1:
138
+ return /* @__PURE__ */ jsx(
139
+ SelectStep,
140
+ {
141
+ title: "Tipo de projeto?",
142
+ options: PROJECT_TYPES.map((t) => ({ id: t, label: t })),
143
+ selected: projectType,
144
+ onSelect: setProjectType,
145
+ onConfirm: () => setStep(2)
146
+ }
147
+ );
148
+ case 2:
149
+ return /* @__PURE__ */ jsx(
150
+ SelectStep,
151
+ {
152
+ title: "Ferramenta de IA?",
153
+ options: TOOL_OPTIONS.map((t) => ({ id: t.id, label: t.label })),
154
+ selected: tool,
155
+ onSelect: setTool,
156
+ onConfirm: () => setStep(3)
157
+ }
158
+ );
159
+ case 3:
160
+ return /* @__PURE__ */ jsx(
161
+ PreviewStep,
162
+ {
163
+ projectType,
164
+ tool,
165
+ onConfirm: () => {
166
+ setCreating(true);
167
+ setStep(4);
168
+ },
169
+ onBack: () => setStep(2)
170
+ }
171
+ );
172
+ default:
173
+ return null;
174
+ }
175
+ }
176
+ export {
177
+ runInitWizard
178
+ };
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ generateAdapters,
4
+ loadWorkflow
5
+ } from "./chunk-4QDEU6KP.js";
6
+ import "./chunk-BKAUN5QH.js";
7
+ import "./chunk-JMIC5NKB.js";
8
+ import "./chunk-EDD55PWL.js";
9
+ import "./chunk-MJ2QXNH6.js";
10
+ import {
11
+ getLetraDir2 as getLetraDir,
12
+ getSpecsDir,
13
+ isWorkspaceMode,
14
+ resolveWorkspaceRoot
15
+ } from "./chunk-6HSUVCTR.js";
16
+ import {
17
+ __require
18
+ } from "./chunk-PDX44BCA.js";
19
+
20
+ // src/commands/push.ts
21
+ import { existsSync, mkdirSync, cpSync } from "fs";
22
+ import { join, relative } from "path";
23
+ import chalk from "chalk";
24
+ async function push(targetPath, options) {
25
+ const cwd = targetPath ? join(process.cwd(), targetPath) : process.cwd();
26
+ const resolution = resolveWorkspaceRoot(cwd);
27
+ if (!isWorkspaceMode(resolution)) {
28
+ console.log(
29
+ chalk.yellow(
30
+ "Nenhum workspace isolado detectado. Use `letra init --workspace <nome>` primeiro."
31
+ )
32
+ );
33
+ return;
34
+ }
35
+ const workflow = loadWorkflow(resolution.targetDir);
36
+ if (!workflow) {
37
+ console.log(chalk.yellow("Nenhum workflow encontrado no workspace."));
38
+ return;
39
+ }
40
+ const { workspaceDir, targetDir } = resolution;
41
+ const dryRun = options?.dryRun ?? false;
42
+ const quiet = options?.quiet ?? false;
43
+ if (!quiet) {
44
+ console.log(chalk.cyan(`
45
+ Workspace: ${workspaceDir}`));
46
+ console.log(chalk.cyan(` Target: ${targetDir}`));
47
+ console.log(chalk.cyan(` Dry-run: ${dryRun ? "sim" : "n\xE3o"}
48
+ `));
49
+ }
50
+ const files = [];
51
+ const specsDir = getSpecsDir(resolution.workspaceDir);
52
+ if (existsSync(specsDir)) {
53
+ const targetSpecs = join(getLetraDir(targetDir), "specs");
54
+ if (!existsSync(targetSpecs)) mkdirSync(targetSpecs, { recursive: true });
55
+ if (!dryRun) {
56
+ cpSync(specsDir, targetSpecs, { recursive: true, force: true });
57
+ }
58
+ const specFiles = readdirSyncSimple(specsDir);
59
+ for (const f of specFiles) {
60
+ files.push(`.letra/specs/${relative(specsDir, f)}`);
61
+ }
62
+ }
63
+ const normalizedTarget = targetDir.replace(/\\/g, "/");
64
+ const relativeTarget = relative(process.cwd(), targetDir).replace(/\\/g, "/");
65
+ const targetConfig = workflow.locations?.find((location) => {
66
+ const locationPath = location.path.replace(/\\/g, "/");
67
+ return locationPath === normalizedTarget || locationPath === relativeTarget || locationPath === targetPath;
68
+ });
69
+ const effectiveTools = targetConfig?.adapters && targetConfig.adapters.length > 0 ? targetConfig.adapters : workflow.tools;
70
+ if (effectiveTools && effectiveTools.length > 0 && !dryRun) {
71
+ const activeStage = workflow.primaryItemId ? workflow.items.find((i) => i.id === workflow.primaryItemId)?.stage : workflow.items[0]?.stage;
72
+ generateAdapters(targetDir, effectiveTools, {
73
+ source: "flow-move",
74
+ workflow: {
75
+ name: workflow.name,
76
+ stages: workflow.stages,
77
+ items: workflow.items
78
+ },
79
+ activeStageId: activeStage || workflow.stages[0]?.id || "backlog",
80
+ primaryItemId: workflow.primaryItemId || workflow.items[0]?.id,
81
+ workspaceDir
82
+ });
83
+ files.push(
84
+ "AGENTS.md",
85
+ ".cursorrules",
86
+ "CLAUDE.md",
87
+ ".windsurfrules",
88
+ ".github/copilot-instructions.md"
89
+ );
90
+ }
91
+ if (!quiet) {
92
+ if (files.length === 0) {
93
+ console.log(chalk.gray(" Nada para enviar.\n"));
94
+ } else {
95
+ const verb = dryRun ? "Enviaria" : "Enviado";
96
+ console.log(chalk.green(` ${verb} ${files.length} arquivo(s):`));
97
+ for (const f of files.slice(0, 10)) {
98
+ console.log(chalk.gray(` \u2022 ${f}`));
99
+ }
100
+ if (files.length > 10) {
101
+ console.log(chalk.gray(` + ${files.length - 10} outro(s)`));
102
+ }
103
+ console.log();
104
+ }
105
+ }
106
+ }
107
+ function readdirSyncSimple(dir) {
108
+ try {
109
+ return __require("fs").readdirSync(dir, { recursive: true });
110
+ } catch {
111
+ return [];
112
+ }
113
+ }
114
+ export {
115
+ push
116
+ };
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ ADAPTER_ARTIFACTS,
4
+ ADAPTER_REGISTRY,
5
+ adapterDiagnosticFiles,
6
+ adapterInstructionTargets,
7
+ instructionArtifactsForAdapters,
8
+ supportedAdapterTools
9
+ } from "./chunk-JMIC5NKB.js";
10
+ import "./chunk-PDX44BCA.js";
11
+ export {
12
+ ADAPTER_ARTIFACTS,
13
+ ADAPTER_REGISTRY,
14
+ adapterDiagnosticFiles,
15
+ adapterInstructionTargets,
16
+ instructionArtifactsForAdapters,
17
+ supportedAdapterTools
18
+ };