@popoverai/dotrequirements 0.24.0 ā 0.24.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.
- package/README.md +4 -3
- package/dist/cli.js +0 -0
- package/dist/codebase-to-spec/claude.d.ts +1 -0
- package/dist/codebase-to-spec/claude.js +9 -0
- package/dist/codebase-to-spec/pack.d.ts +16 -0
- package/dist/codebase-to-spec/pack.js +17 -3
- package/dist/codebase-to-spec/present.d.ts +8 -1
- package/dist/codebase-to-spec/present.js +7 -4
- package/dist/codebase-to-spec/progress.d.ts +6 -0
- package/dist/codebase-to-spec/progress.js +34 -0
- package/dist/codebase-to-spec/prompts/outline-reviewer.d.ts +1 -1
- package/dist/codebase-to-spec/prompts/outline-reviewer.js +3 -1
- package/dist/codebase-to-spec/prompts/planner-initial.d.ts +1 -1
- package/dist/codebase-to-spec/prompts/planner-initial.js +4 -0
- package/dist/codebase-to-spec/prompts/planner-revise.d.ts +1 -1
- package/dist/codebase-to-spec/prompts/planner-revise.js +2 -2
- package/dist/codebase-to-spec/prompts/spec-reviewer.d.ts +1 -1
- package/dist/codebase-to-spec/prompts/spec-reviewer.js +6 -1
- package/dist/codebase-to-spec/prompts/specifier.d.ts +1 -1
- package/dist/codebase-to-spec/prompts/specifier.js +6 -4
- package/dist/codebase-to-spec/prompts/style-check.d.ts +10 -2
- package/dist/codebase-to-spec/prompts/style-check.js +76 -46
- package/dist/codebase-to-spec/schemas.d.ts +85 -1
- package/dist/codebase-to-spec/schemas.js +25 -1
- package/dist/codebase-to-spec/specifier.js +6 -0
- package/dist/commands/codebase-to-spec/index.js +13 -0
- package/dist/commands/codebase-to-spec/pack.d.ts +6 -0
- package/dist/commands/codebase-to-spec/pack.js +1 -0
- package/dist/commands/codebase-to-spec/present.d.ts +5 -0
- package/dist/commands/codebase-to-spec/present.js +6 -1
- package/dist/commands/codebase-to-spec/run.js +1 -0
- package/package.json +5 -6
- package/dist/codebase-to-spec/prompts/planner-apply.d.ts +0 -12
- package/dist/codebase-to-spec/prompts/planner-apply.js +0 -32
- package/dist/commands/browsertest.d.ts +0 -6
- package/dist/commands/browsertest.js +0 -212
- package/dist/commands/login.d.ts +0 -12
- package/dist/commands/login.js +0 -117
- package/dist/commands/logout.d.ts +0 -5
- package/dist/commands/logout.js +0 -17
- package/dist/commands/mcp-setup.d.ts +0 -5
- package/dist/commands/mcp-setup.js +0 -441
- package/dist/commands/test.d.ts +0 -6
- package/dist/commands/test.js +0 -72
- package/dist/mcp/grep.d.ts +0 -24
- package/dist/mcp/grep.js +0 -306
- package/dist/mcp/handlers/coverage.d.ts +0 -44
- package/dist/mcp/handlers/coverage.js +0 -103
- package/dist/mcp/requirements.d.ts +0 -57
- package/dist/mcp/requirements.js +0 -155
- package/dist/mcp/testCodeExtractor.d.ts +0 -22
- package/dist/mcp/testCodeExtractor.js +0 -150
- package/dist/mcp/types.d.ts +0 -27
- package/dist/mcp/types.js +0 -2
- package/dist/utils/local-project.d.ts +0 -31
- package/dist/utils/local-project.js +0 -33
- package/dist/utils/token-refresh.d.ts +0 -24
- package/dist/utils/token-refresh.js +0 -69
- package/dist/utils/token-storage.d.ts +0 -31
- package/dist/utils/token-storage.js +0 -57
|
@@ -1,441 +0,0 @@
|
|
|
1
|
-
import { execSync } from "node:child_process";
|
|
2
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { homedir } from "node:os";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
import prompts from "prompts";
|
|
6
|
-
import { brand } from "../utils/brand.js";
|
|
7
|
-
import { appendOrUpdateSection, buildNoGitRepoMessage, findDotrequirementsSection, findGitRoot, getContextFileName, } from "../utils/context-file.js";
|
|
8
|
-
import { loadTemplate } from "../utils/templates.js";
|
|
9
|
-
/**
|
|
10
|
-
* Load the context file section template
|
|
11
|
-
*/
|
|
12
|
-
function loadContextFileSection() {
|
|
13
|
-
return loadTemplate("context-file-section.md");
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Install workflow guidance to the appropriate context file for a platform
|
|
17
|
-
*/
|
|
18
|
-
async function installContextFileSection(platform) {
|
|
19
|
-
const fileName = getContextFileName(platform);
|
|
20
|
-
if (!fileName) {
|
|
21
|
-
console.error(`\nā Unknown platform: ${platform}`);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const gitRoot = await findGitRoot();
|
|
25
|
-
if (!gitRoot) {
|
|
26
|
-
console.log(`\n${buildNoGitRepoMessage(fileName)}\n`);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const contextFilePath = join(gitRoot, fileName);
|
|
30
|
-
const sectionContent = loadContextFileSection();
|
|
31
|
-
// Check if file exists and has existing section
|
|
32
|
-
let existingSection = null;
|
|
33
|
-
if (existsSync(contextFilePath)) {
|
|
34
|
-
const content = readFileSync(contextFilePath, "utf-8");
|
|
35
|
-
const section = findDotrequirementsSection(content);
|
|
36
|
-
if (section) {
|
|
37
|
-
existingSection = section.content;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
// Prompt user
|
|
41
|
-
const action = existingSection
|
|
42
|
-
? "Update"
|
|
43
|
-
: existsSync(contextFilePath)
|
|
44
|
-
? "Add to"
|
|
45
|
-
: "Create";
|
|
46
|
-
const response = await prompts({
|
|
47
|
-
type: "confirm",
|
|
48
|
-
name: "install",
|
|
49
|
-
message: `${action} ${fileName} with dotrequirements workflow guidance?`,
|
|
50
|
-
initial: true,
|
|
51
|
-
});
|
|
52
|
-
if (!response.install) {
|
|
53
|
-
console.log("");
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
// If updating, show what will change
|
|
57
|
-
if (existingSection) {
|
|
58
|
-
const confirmUpdate = await prompts({
|
|
59
|
-
type: "confirm",
|
|
60
|
-
name: "confirm",
|
|
61
|
-
message: "Existing dotrequirements section found. Replace it?",
|
|
62
|
-
initial: true,
|
|
63
|
-
});
|
|
64
|
-
if (!confirmUpdate.confirm) {
|
|
65
|
-
console.log(" Skipped.\n");
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
try {
|
|
70
|
-
const result = appendOrUpdateSection(contextFilePath, sectionContent);
|
|
71
|
-
const actionVerb = result.action === "created"
|
|
72
|
-
? "Created"
|
|
73
|
-
: result.action === "appended"
|
|
74
|
-
? "Added to"
|
|
75
|
-
: "Updated";
|
|
76
|
-
console.log(`ā
${actionVerb} ${contextFilePath}\n`);
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
console.error(`ā Failed to update ${fileName}`);
|
|
80
|
-
console.log(` Error: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* MCP setup command - configures the MCP server for AI assistants
|
|
85
|
-
*/
|
|
86
|
-
export async function mcpSetupCommand() {
|
|
87
|
-
console.log(`š§ Setting up ${brand} MCP server\n`);
|
|
88
|
-
// Interactive client selector
|
|
89
|
-
const response = await prompts({
|
|
90
|
-
type: "select",
|
|
91
|
-
name: "client",
|
|
92
|
-
message: "Which AI assistant are you using?",
|
|
93
|
-
choices: [
|
|
94
|
-
{ title: "Claude Code", value: "claude-code" },
|
|
95
|
-
{ title: "Claude Desktop", value: "claude-desktop" },
|
|
96
|
-
{ title: "Cursor", value: "cursor" },
|
|
97
|
-
{ title: "Google Antigravity", value: "antigravity" },
|
|
98
|
-
{ title: "OpenAI Codex", value: "codex" },
|
|
99
|
-
{ title: "GitHub Copilot", value: "github-copilot" },
|
|
100
|
-
{ title: "Other (custom path)", value: "other" },
|
|
101
|
-
],
|
|
102
|
-
initial: 0,
|
|
103
|
-
});
|
|
104
|
-
if (!response.client) {
|
|
105
|
-
console.log("\nSetup cancelled.");
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
switch (response.client) {
|
|
109
|
-
case "claude-code":
|
|
110
|
-
await setupClaudeCode();
|
|
111
|
-
break;
|
|
112
|
-
case "claude-desktop":
|
|
113
|
-
await setupClaudeDesktop();
|
|
114
|
-
break;
|
|
115
|
-
case "cursor":
|
|
116
|
-
await setupCursor();
|
|
117
|
-
break;
|
|
118
|
-
case "antigravity":
|
|
119
|
-
await setupAntigravity();
|
|
120
|
-
break;
|
|
121
|
-
case "codex":
|
|
122
|
-
await setupCodex();
|
|
123
|
-
break;
|
|
124
|
-
case "github-copilot":
|
|
125
|
-
await setupGitHubCopilot();
|
|
126
|
-
break;
|
|
127
|
-
case "other":
|
|
128
|
-
await setupOther();
|
|
129
|
-
break;
|
|
130
|
-
default:
|
|
131
|
-
console.log(`\nā ${response.client} is not yet supported.`);
|
|
132
|
-
console.log("Please refer to the documentation for manual setup.");
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
async function setupClaudeCode() {
|
|
136
|
-
console.log("\nš¦ Configuring MCP for Claude Code...\n");
|
|
137
|
-
const command = `claude mcp add-json dotrequirements '{"type":"stdio","command":"npx","args":["-y","@popoverai/dotrequirements","mcp"]}'`;
|
|
138
|
-
let mcpConfigured = false;
|
|
139
|
-
try {
|
|
140
|
-
execSync(command, { stdio: "pipe" });
|
|
141
|
-
console.log("ā
MCP configured successfully for Claude Code!");
|
|
142
|
-
mcpConfigured = true;
|
|
143
|
-
}
|
|
144
|
-
catch (error) {
|
|
145
|
-
const execError = error;
|
|
146
|
-
const stderr = execError.stderr?.toString() || "";
|
|
147
|
-
const errorMessage = execError.message || "";
|
|
148
|
-
const combinedError = stderr + errorMessage;
|
|
149
|
-
if (combinedError.includes("already exists")) {
|
|
150
|
-
console.log("ā
MCP server already configured for Claude Code");
|
|
151
|
-
mcpConfigured = true;
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
console.error("ā Failed to configure MCP automatically.");
|
|
155
|
-
console.log("\nYou can manually run:");
|
|
156
|
-
console.log(` ${command}`);
|
|
157
|
-
if (stderr) {
|
|
158
|
-
console.log(`\nError: ${stderr}`);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
if (mcpConfigured) {
|
|
163
|
-
console.log("\nā ļø Important: Restart Claude Code for changes to take effect.");
|
|
164
|
-
console.log("\nYou can now ask your AI assistant to help write requirements!\n");
|
|
165
|
-
await installContextFileSection("claude-code");
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
async function setupClaudeDesktop() {
|
|
169
|
-
console.log("\nš¦ Configuring MCP for Claude Desktop...\n");
|
|
170
|
-
// Determine config path based on OS
|
|
171
|
-
const platform = process.platform;
|
|
172
|
-
let configPath;
|
|
173
|
-
let configDir;
|
|
174
|
-
if (platform === "darwin") {
|
|
175
|
-
configDir = join(homedir(), "Library", "Application Support", "Claude");
|
|
176
|
-
configPath = join(configDir, "claude_desktop_config.json");
|
|
177
|
-
}
|
|
178
|
-
else if (platform === "win32") {
|
|
179
|
-
const appData = process.env.APPDATA || join(homedir(), "AppData", "Roaming");
|
|
180
|
-
configDir = join(appData, "Claude");
|
|
181
|
-
configPath = join(configDir, "claude_desktop_config.json");
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
console.error("ā Claude Desktop is only supported on macOS and Windows.");
|
|
185
|
-
console.log("\nFor Linux, please manually configure the MCP server.");
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
const mcpServerConfig = {
|
|
189
|
-
command: "npx",
|
|
190
|
-
args: ["-y", "@popoverai/dotrequirements", "mcp"],
|
|
191
|
-
env: {
|
|
192
|
-
REQUIREMENTS_DIR: process.cwd(),
|
|
193
|
-
},
|
|
194
|
-
};
|
|
195
|
-
try {
|
|
196
|
-
if (!existsSync(configDir)) {
|
|
197
|
-
console.log("Creating Claude Desktop config directory...");
|
|
198
|
-
mkdirSync(configDir, { recursive: true });
|
|
199
|
-
}
|
|
200
|
-
let config = {};
|
|
201
|
-
if (existsSync(configPath)) {
|
|
202
|
-
try {
|
|
203
|
-
const existingContent = readFileSync(configPath, "utf-8");
|
|
204
|
-
if (existingContent.trim()) {
|
|
205
|
-
config = JSON.parse(existingContent);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
catch (parseError) {
|
|
209
|
-
console.log("ā ļø Existing config file is invalid, creating fresh config...");
|
|
210
|
-
config = {};
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
if (!config.mcpServers) {
|
|
214
|
-
config.mcpServers = {};
|
|
215
|
-
}
|
|
216
|
-
config.mcpServers.dotrequirements = mcpServerConfig;
|
|
217
|
-
writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
218
|
-
console.log(`ā
MCP configured successfully!`);
|
|
219
|
-
console.log(` Config file: ${configPath}`);
|
|
220
|
-
console.log(` REQUIREMENTS_DIR: ${process.cwd()}\n`);
|
|
221
|
-
console.log("ā ļø Important: Quit and restart Claude Desktop for changes to take effect.");
|
|
222
|
-
console.log(" (Cmd+Q on macOS, not just close the window)\n");
|
|
223
|
-
console.log("You can now ask Claude Desktop to help write requirements!\n");
|
|
224
|
-
// Claude Desktop doesn't use skills like Claude Code, so we skip that step
|
|
225
|
-
}
|
|
226
|
-
catch (error) {
|
|
227
|
-
console.error("ā Failed to configure MCP automatically.");
|
|
228
|
-
console.log(`\nError: ${error instanceof Error ? error.message : String(error)}`);
|
|
229
|
-
console.log("\nYou can manually edit the config file at:");
|
|
230
|
-
console.log(` ${configPath}\n`);
|
|
231
|
-
console.log("Add the following configuration:");
|
|
232
|
-
const manualConfig = {
|
|
233
|
-
mcpServers: {
|
|
234
|
-
dotrequirements: mcpServerConfig,
|
|
235
|
-
},
|
|
236
|
-
};
|
|
237
|
-
console.log(JSON.stringify(manualConfig, null, 2));
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
async function setupCursor() {
|
|
241
|
-
console.log("\nš¦ Configuring MCP for Cursor (project-specific)...\n");
|
|
242
|
-
const configPath = join(process.cwd(), ".cursor", "mcp.json");
|
|
243
|
-
const configDir = join(process.cwd(), ".cursor");
|
|
244
|
-
const mcpServerConfig = {
|
|
245
|
-
command: "npx",
|
|
246
|
-
args: ["-y", "@popoverai/dotrequirements", "mcp"],
|
|
247
|
-
};
|
|
248
|
-
try {
|
|
249
|
-
if (!existsSync(configDir)) {
|
|
250
|
-
console.log("Creating Cursor config directory...");
|
|
251
|
-
mkdirSync(configDir, { recursive: true });
|
|
252
|
-
}
|
|
253
|
-
let config = {};
|
|
254
|
-
if (existsSync(configPath)) {
|
|
255
|
-
try {
|
|
256
|
-
const existingContent = readFileSync(configPath, "utf-8");
|
|
257
|
-
if (existingContent.trim()) {
|
|
258
|
-
config = JSON.parse(existingContent);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
catch (parseError) {
|
|
262
|
-
console.log("ā ļø Existing config file is invalid, creating fresh config...");
|
|
263
|
-
config = {};
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
if (!config.mcpServers) {
|
|
267
|
-
config.mcpServers = {};
|
|
268
|
-
}
|
|
269
|
-
config.mcpServers.dotrequirements = mcpServerConfig;
|
|
270
|
-
writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
271
|
-
console.log(`ā
MCP configured successfully!`);
|
|
272
|
-
console.log(` Config file: ${configPath}\n`);
|
|
273
|
-
console.log("ā ļø Important: Reload or restart Cursor for changes to take effect.");
|
|
274
|
-
console.log("\nYou can now ask your AI assistant to help write requirements!\n");
|
|
275
|
-
await installContextFileSection("cursor");
|
|
276
|
-
}
|
|
277
|
-
catch (error) {
|
|
278
|
-
console.error("ā Failed to configure MCP automatically.");
|
|
279
|
-
console.log(`\nError: ${error instanceof Error ? error.message : String(error)}`);
|
|
280
|
-
console.log("\nYou can manually edit the config file at:");
|
|
281
|
-
console.log(` ${configPath}\n`);
|
|
282
|
-
console.log("Add the following configuration:");
|
|
283
|
-
const manualConfig = {
|
|
284
|
-
mcpServers: {
|
|
285
|
-
dotrequirements: mcpServerConfig,
|
|
286
|
-
},
|
|
287
|
-
};
|
|
288
|
-
console.log(JSON.stringify(manualConfig, null, 2));
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
async function setupAntigravity() {
|
|
292
|
-
console.log("\nš¦ Configuring MCP for Google Antigravity...\n");
|
|
293
|
-
const configPath = join(homedir(), ".gemini", "antigravity", "mcp_config.json");
|
|
294
|
-
const configDir = join(homedir(), ".gemini", "antigravity");
|
|
295
|
-
// Check if we're in a dotrequirements project directory
|
|
296
|
-
const envLocalPath = join(process.cwd(), ".env.local");
|
|
297
|
-
let projectId = null;
|
|
298
|
-
let projectPath = null;
|
|
299
|
-
if (existsSync(envLocalPath)) {
|
|
300
|
-
try {
|
|
301
|
-
const envContent = readFileSync(envLocalPath, "utf-8");
|
|
302
|
-
const lines = envContent.split("\n");
|
|
303
|
-
for (const line of lines) {
|
|
304
|
-
const trimmed = line.trim();
|
|
305
|
-
if (trimmed.startsWith("DOTREQUIREMENTS_PROJECT_ID=")) {
|
|
306
|
-
projectId = trimmed.split("=")[1]?.trim().replace(/['"]/g, "");
|
|
307
|
-
projectPath = process.cwd();
|
|
308
|
-
break;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
catch (error) {
|
|
313
|
-
// .env.local exists but couldn't read it - continue with global setup
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
try {
|
|
317
|
-
if (!existsSync(configDir)) {
|
|
318
|
-
console.log("Creating Antigravity config directory...");
|
|
319
|
-
mkdirSync(configDir, { recursive: true });
|
|
320
|
-
}
|
|
321
|
-
let config = {};
|
|
322
|
-
if (existsSync(configPath)) {
|
|
323
|
-
try {
|
|
324
|
-
const existingContent = readFileSync(configPath, "utf-8");
|
|
325
|
-
if (existingContent.trim()) {
|
|
326
|
-
config = JSON.parse(existingContent);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
catch (parseError) {
|
|
330
|
-
console.log("ā ļø Existing config file is invalid, creating fresh config...");
|
|
331
|
-
config = {};
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
if (!config.mcpServers) {
|
|
335
|
-
config.mcpServers = {};
|
|
336
|
-
}
|
|
337
|
-
if (!config.mcpServers.dotrequirements) {
|
|
338
|
-
config.mcpServers.dotrequirements = {
|
|
339
|
-
command: "npx",
|
|
340
|
-
args: ["-y", "@popoverai/dotrequirements", "mcp"],
|
|
341
|
-
env: {},
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
// biome-ignore lint/suspicious/noExplicitAny: `config` is parsed JSON from a user-owned MCP config file; its shape isn't ours to type fully. We only need the `env` bag, which we narrow ad-hoc here.
|
|
345
|
-
const dotreqServer = config.mcpServers.dotrequirements;
|
|
346
|
-
if (!dotreqServer.env) {
|
|
347
|
-
dotreqServer.env = {};
|
|
348
|
-
}
|
|
349
|
-
if (projectId && projectPath) {
|
|
350
|
-
const envKey = `PROJ_${projectId}`;
|
|
351
|
-
dotreqServer.env[envKey] = projectPath;
|
|
352
|
-
console.log(`ā
Added project to MCP config: ${envKey}`);
|
|
353
|
-
console.log(` Path: ${projectPath}\n`);
|
|
354
|
-
}
|
|
355
|
-
else {
|
|
356
|
-
console.log(`ā¹ļø Not in a ${brand} project directory (no .env.local with DOTREQUIREMENTS_PROJECT_ID found)`);
|
|
357
|
-
console.log(" Setting up global MCP server only.\n");
|
|
358
|
-
}
|
|
359
|
-
writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
360
|
-
console.log(`ā
MCP configured successfully!`);
|
|
361
|
-
console.log(` Config file: ${configPath}\n`);
|
|
362
|
-
console.log("ā ļø Important: Reload or restart Google Antigravity for changes to take effect.");
|
|
363
|
-
console.log("\nYou can now ask your AI assistant to help write requirements!");
|
|
364
|
-
if (projectId) {
|
|
365
|
-
console.log(`\nš” To add more projects, run \`dotreq mcp-setup\` from each project directory.\n`);
|
|
366
|
-
}
|
|
367
|
-
else {
|
|
368
|
-
console.log("");
|
|
369
|
-
}
|
|
370
|
-
await installContextFileSection("antigravity");
|
|
371
|
-
}
|
|
372
|
-
catch (error) {
|
|
373
|
-
console.error("ā Failed to configure MCP automatically.");
|
|
374
|
-
console.log(`\nError: ${error instanceof Error ? error.message : String(error)}`);
|
|
375
|
-
console.log("\nYou can manually edit the config file at:");
|
|
376
|
-
console.log(` ${configPath}`);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
async function setupCodex() {
|
|
380
|
-
console.log("\nš¦ Configuring MCP for OpenAI Codex...\n");
|
|
381
|
-
const command = `codex mcp add dotrequirements -- npx -y @popoverai/dotrequirements mcp`;
|
|
382
|
-
try {
|
|
383
|
-
execSync(command, { stdio: "inherit" });
|
|
384
|
-
console.log("\nā
MCP configured successfully for Codex!");
|
|
385
|
-
console.log("\nā ļø Important: Restart Codex for changes to take effect.");
|
|
386
|
-
console.log("\nYou can now ask your AI assistant to help write requirements!\n");
|
|
387
|
-
await installContextFileSection("codex");
|
|
388
|
-
}
|
|
389
|
-
catch (error) {
|
|
390
|
-
console.error("\nā Failed to configure MCP automatically.");
|
|
391
|
-
console.log("\nYou can manually run:");
|
|
392
|
-
console.log(` ${command}`);
|
|
393
|
-
console.log("\nOr manually edit ~/.codex/config.toml and add:");
|
|
394
|
-
console.log("[mcp_servers.dotrequirements]");
|
|
395
|
-
console.log('command = "npx"');
|
|
396
|
-
console.log('args = ["-y", "@popoverai/dotrequirements", "mcp"]');
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
async function setupGitHubCopilot() {
|
|
400
|
-
console.log("\nš¦ Configuring skills for GitHub Copilot...\n");
|
|
401
|
-
console.log("ā¹ļø GitHub Copilot discovers MCP servers from your IDE configuration.");
|
|
402
|
-
console.log(" Please configure the MCP server in VS Code settings or GitHub settings.\n");
|
|
403
|
-
console.log(" MCP server command: npx -y @popoverai/dotrequirements mcp\n");
|
|
404
|
-
await installContextFileSection("github-copilot");
|
|
405
|
-
}
|
|
406
|
-
async function setupOther() {
|
|
407
|
-
console.log("\nš¦ Custom Context File Setup\n");
|
|
408
|
-
console.log("ā¹ļø Workflow guidance is added to a context file at your project root.");
|
|
409
|
-
console.log(" Common file names by platform:");
|
|
410
|
-
console.log(" - CLAUDE.md (Claude Code)");
|
|
411
|
-
console.log(" - AGENTS.md (Cursor, Codex, GitHub Copilot)");
|
|
412
|
-
console.log(" - GEMINI.md (Antigravity)\n");
|
|
413
|
-
const response = await prompts({
|
|
414
|
-
type: "select",
|
|
415
|
-
name: "file",
|
|
416
|
-
message: "Which context file should we update?",
|
|
417
|
-
choices: [
|
|
418
|
-
{ title: "AGENTS.md (most compatible)", value: "AGENTS.md" },
|
|
419
|
-
{ title: "CLAUDE.md", value: "CLAUDE.md" },
|
|
420
|
-
{ title: "GEMINI.md", value: "GEMINI.md" },
|
|
421
|
-
],
|
|
422
|
-
initial: 0,
|
|
423
|
-
});
|
|
424
|
-
if (!response.file) {
|
|
425
|
-
console.log("\nSetup cancelled.");
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
console.log("\nš MCP Server Setup\n");
|
|
429
|
-
console.log("Configure your AI assistant to run the MCP server:");
|
|
430
|
-
console.log(" Command: npx");
|
|
431
|
-
console.log(" Args: -y @popoverai/dotrequirements mcp\n");
|
|
432
|
-
// Determine platform based on file choice for the install function
|
|
433
|
-
const platformMap = {
|
|
434
|
-
"CLAUDE.md": "claude-code",
|
|
435
|
-
"AGENTS.md": "cursor", // Any AGENTS.md platform works
|
|
436
|
-
"GEMINI.md": "antigravity",
|
|
437
|
-
};
|
|
438
|
-
const platform = platformMap[response.file];
|
|
439
|
-
await installContextFileSection(platform);
|
|
440
|
-
}
|
|
441
|
-
//# sourceMappingURL=mcp-setup.js.map
|
package/dist/commands/test.d.ts
DELETED
package/dist/commands/test.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import * as fs from "node:fs";
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
import { parseRequirementsFromFile, } from "../schema/index.js";
|
|
4
|
-
export async function testCommand(options) {
|
|
5
|
-
console.log("Parsing and validating requirements...");
|
|
6
|
-
const requirementsDir = path.join(process.cwd(), ".requirements");
|
|
7
|
-
if (!fs.existsSync(requirementsDir)) {
|
|
8
|
-
console.error("Error: .requirements/ directory not found.");
|
|
9
|
-
console.log('Run "dotrequirements pull" first to sync requirements.');
|
|
10
|
-
process.exit(1);
|
|
11
|
-
}
|
|
12
|
-
// Get files to test
|
|
13
|
-
let files;
|
|
14
|
-
if (options.file) {
|
|
15
|
-
files = [options.file];
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
files = fs
|
|
19
|
-
.readdirSync(requirementsDir)
|
|
20
|
-
.filter((f) => f.endsWith(".requirements.md"))
|
|
21
|
-
.map((f) => path.join(requirementsDir, f));
|
|
22
|
-
}
|
|
23
|
-
if (files.length === 0) {
|
|
24
|
-
console.log("No Markdown requirements files found to test.");
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
let totalRequirements = 0;
|
|
28
|
-
let passCount = 0;
|
|
29
|
-
let failCount = 0;
|
|
30
|
-
for (const filePath of files) {
|
|
31
|
-
const fileName = path.basename(filePath);
|
|
32
|
-
console.log(`\nTesting: ${fileName}`);
|
|
33
|
-
try {
|
|
34
|
-
// Parse and validate using shared schema module
|
|
35
|
-
const { metadata, requirements } = parseRequirementsFromFile(filePath);
|
|
36
|
-
// Count total requirements (root + all descendants)
|
|
37
|
-
let count = 0;
|
|
38
|
-
for (const req of requirements) {
|
|
39
|
-
count += countRequirementsInTree(req);
|
|
40
|
-
}
|
|
41
|
-
totalRequirements += count;
|
|
42
|
-
console.log(` ā Valid structure (${count} requirement(s))`);
|
|
43
|
-
console.log(` ā Version: ${metadata.version}`);
|
|
44
|
-
console.log(` ā Last sync: ${metadata.pulledAt}`);
|
|
45
|
-
passCount++;
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
console.error(` ā Validation failed:`, error);
|
|
49
|
-
failCount++;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
console.log(`\n${"=".repeat(50)}`);
|
|
53
|
-
console.log(`Total files: ${files.length}`);
|
|
54
|
-
console.log(`Passed: ${passCount}`);
|
|
55
|
-
console.log(`Failed: ${failCount}`);
|
|
56
|
-
console.log(`Total requirements: ${totalRequirements}`);
|
|
57
|
-
if (failCount > 0) {
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Recursively count requirements in a tree (1 for root + all descendants)
|
|
63
|
-
*/
|
|
64
|
-
function countRequirementsInTree(node) {
|
|
65
|
-
let count = 1; // Count this node
|
|
66
|
-
// Count all children
|
|
67
|
-
for (const child of node.children) {
|
|
68
|
-
count += countRequirementsInTree(child);
|
|
69
|
-
}
|
|
70
|
-
return count;
|
|
71
|
-
}
|
|
72
|
-
//# sourceMappingURL=test.js.map
|
package/dist/mcp/grep.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { TestReference } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Find all test files that reference a specific requirement ID
|
|
4
|
-
*
|
|
5
|
-
* Uses execFile with array arguments to avoid command injection vulnerabilities.
|
|
6
|
-
*/
|
|
7
|
-
export declare function findTestsForRequirement(workspaceRoot: string, requirementId: string): Promise<TestReference[]>;
|
|
8
|
-
/**
|
|
9
|
-
* Find all requirement references in a specific file using AST parsing
|
|
10
|
-
*/
|
|
11
|
-
export declare function findRequirementsInFile(filePath: string): Promise<TestReference[]>;
|
|
12
|
-
/**
|
|
13
|
-
* Find all requirement references in the entire workspace
|
|
14
|
-
*
|
|
15
|
-
* Uses execFile with array arguments to avoid command injection vulnerabilities.
|
|
16
|
-
*/
|
|
17
|
-
export declare function findAllTestReferences(workspaceRoot: string): Promise<TestReference[]>;
|
|
18
|
-
/**
|
|
19
|
-
* Get all unique requirement IDs referenced in tests
|
|
20
|
-
* Normalizes child IDs (e.g., AUTH-VALID-LOGIN.0) to root IDs (e.g., AUTH-VALID-LOGIN)
|
|
21
|
-
* Uses AST parsing instead of grep for reliability across environments
|
|
22
|
-
*/
|
|
23
|
-
export declare function getReferencedRequirementIds(workspaceRoot: string): Promise<Set<string>>;
|
|
24
|
-
//# sourceMappingURL=grep.d.ts.map
|