@popoverai/dotrequirements 0.23.0 → 0.24.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.
- package/README.md +169 -22
- package/dist/cli.js +121 -60
- package/dist/codebase-to-spec/budget.d.ts +53 -0
- package/dist/codebase-to-spec/budget.js +80 -0
- package/dist/codebase-to-spec/cache.d.ts +49 -0
- package/dist/codebase-to-spec/cache.js +54 -0
- package/dist/codebase-to-spec/claude.d.ts +69 -0
- package/dist/codebase-to-spec/claude.js +126 -0
- package/dist/codebase-to-spec/compose.d.ts +49 -0
- package/dist/codebase-to-spec/compose.js +124 -0
- package/dist/codebase-to-spec/edit-loop.d.ts +54 -0
- package/dist/codebase-to-spec/edit-loop.js +195 -0
- package/dist/codebase-to-spec/editor.d.ts +54 -0
- package/dist/codebase-to-spec/editor.js +74 -0
- package/dist/codebase-to-spec/exit-codes.d.ts +40 -0
- package/dist/codebase-to-spec/exit-codes.js +58 -0
- package/dist/codebase-to-spec/fan-out.d.ts +63 -0
- package/dist/codebase-to-spec/fan-out.js +215 -0
- package/dist/codebase-to-spec/interactive.d.ts +30 -0
- package/dist/codebase-to-spec/interactive.js +48 -0
- package/dist/codebase-to-spec/outline-review-loop.d.ts +51 -0
- package/dist/codebase-to-spec/outline-review-loop.js +187 -0
- package/dist/codebase-to-spec/pack.d.ts +51 -0
- package/dist/codebase-to-spec/pack.js +127 -0
- package/dist/codebase-to-spec/planner.d.ts +41 -0
- package/dist/codebase-to-spec/planner.js +76 -0
- package/dist/codebase-to-spec/present.d.ts +94 -0
- package/dist/codebase-to-spec/present.js +288 -0
- package/dist/codebase-to-spec/progress.d.ts +33 -0
- package/dist/codebase-to-spec/progress.js +28 -0
- package/dist/codebase-to-spec/prompts/editor.d.ts +13 -0
- package/dist/codebase-to-spec/prompts/editor.js +57 -0
- package/dist/codebase-to-spec/prompts/outline-reviewer.d.ts +12 -0
- package/dist/codebase-to-spec/prompts/outline-reviewer.js +87 -0
- package/dist/codebase-to-spec/prompts/planner-initial.d.ts +11 -0
- package/dist/codebase-to-spec/prompts/planner-initial.js +125 -0
- package/dist/codebase-to-spec/prompts/planner-revise.d.ts +14 -0
- package/dist/codebase-to-spec/prompts/planner-revise.js +60 -0
- package/dist/codebase-to-spec/prompts/spec-reviewer.d.ts +16 -0
- package/dist/codebase-to-spec/prompts/spec-reviewer.js +96 -0
- package/dist/codebase-to-spec/prompts/specifier.d.ts +12 -0
- package/dist/codebase-to-spec/prompts/specifier.js +100 -0
- package/dist/codebase-to-spec/prompts/style-check.d.ts +12 -0
- package/dist/codebase-to-spec/prompts/style-check.js +78 -0
- package/dist/codebase-to-spec/schemas.d.ts +257 -0
- package/dist/codebase-to-spec/schemas.js +183 -0
- package/dist/codebase-to-spec/skill-install.d.ts +57 -0
- package/dist/codebase-to-spec/skill-install.js +79 -0
- package/dist/codebase-to-spec/slice.d.ts +49 -0
- package/dist/codebase-to-spec/slice.js +111 -0
- package/dist/codebase-to-spec/specifier.d.ts +60 -0
- package/dist/codebase-to-spec/specifier.js +79 -0
- package/dist/codebase-to-spec/style-check.d.ts +29 -0
- package/dist/codebase-to-spec/style-check.js +33 -0
- package/dist/codebase-to-spec/summary.d.ts +51 -0
- package/dist/codebase-to-spec/summary.js +183 -0
- package/dist/codebase-to-spec/validate.d.ts +46 -0
- package/dist/codebase-to-spec/validate.js +130 -0
- package/dist/commands/acceptance-test.d.ts +6 -0
- package/dist/commands/{browsertest.js → acceptance-test.js} +36 -29
- package/dist/commands/ai-setup.d.ts +5 -0
- package/dist/commands/ai-setup.js +441 -0
- package/dist/commands/codebase-to-spec/compose.d.ts +14 -0
- package/dist/commands/codebase-to-spec/compose.js +57 -0
- package/dist/commands/codebase-to-spec/edit-loop.d.ts +16 -0
- package/dist/commands/codebase-to-spec/edit-loop.js +83 -0
- package/dist/commands/codebase-to-spec/fan-out.d.ts +19 -0
- package/dist/commands/codebase-to-spec/fan-out.js +77 -0
- package/dist/commands/codebase-to-spec/index.d.ts +9 -0
- package/dist/commands/codebase-to-spec/index.js +135 -0
- package/dist/commands/codebase-to-spec/pack.d.ts +22 -0
- package/dist/commands/codebase-to-spec/pack.js +76 -0
- package/dist/commands/codebase-to-spec/plan-loop.d.ts +26 -0
- package/dist/commands/codebase-to-spec/plan-loop.js +105 -0
- package/dist/commands/codebase-to-spec/present.d.ts +21 -0
- package/dist/commands/codebase-to-spec/present.js +92 -0
- package/dist/commands/codebase-to-spec/run.d.ts +20 -0
- package/dist/commands/codebase-to-spec/run.js +85 -0
- package/dist/commands/codebase-to-spec/skill-install.d.ts +20 -0
- package/dist/commands/codebase-to-spec/skill-install.js +51 -0
- package/dist/commands/codebase-to-spec/specify-area.d.ts +18 -0
- package/dist/commands/codebase-to-spec/specify-area.js +82 -0
- package/dist/commands/codebase-to-spec/style-check.d.ts +15 -0
- package/dist/commands/codebase-to-spec/style-check.js +42 -0
- package/dist/commands/codebase-to-spec/validate.d.ts +18 -0
- package/dist/commands/codebase-to-spec/validate.js +38 -0
- package/dist/commands/create-requirement-document.d.ts +2 -0
- package/dist/commands/create-requirement-document.js +41 -0
- package/dist/commands/finalize.js +7 -7
- package/dist/commands/get.d.ts +2 -0
- package/dist/commands/get.js +55 -0
- package/dist/commands/init.js +132 -117
- package/dist/commands/link.js +27 -27
- package/dist/commands/list.d.ts +6 -0
- package/dist/commands/list.js +43 -0
- package/dist/commands/mcp.js +1 -1
- package/dist/commands/prepare.js +4 -4
- package/dist/commands/pull.js +116 -121
- package/dist/commands/push.js +106 -112
- package/dist/commands/report.d.ts +6 -2
- package/dist/commands/report.js +177 -122
- package/dist/commands/requirements-for.d.ts +2 -0
- package/dist/commands/requirements-for.js +29 -0
- package/dist/commands/review-test.d.ts +2 -0
- package/dist/commands/review-test.js +75 -0
- package/dist/commands/search.d.ts +6 -0
- package/dist/commands/search.js +39 -0
- package/dist/commands/style-check.d.ts +7 -0
- package/dist/commands/style-check.js +75 -0
- package/dist/commands/tests-for.d.ts +2 -0
- package/dist/commands/tests-for.js +80 -0
- package/dist/commands/validate.d.ts +6 -0
- package/dist/commands/validate.js +72 -0
- package/dist/config.js +1 -1
- package/dist/convex.d.ts +34 -22
- package/dist/convex.js +38 -22
- package/dist/harness/cache.d.ts +1 -5
- package/dist/harness/cache.js +49 -59
- package/dist/harness/convexReporting.d.ts +1 -1
- package/dist/harness/convexReporting.js +9 -7
- package/dist/harness/coverageCache.js +3 -3
- package/dist/harness/finalize.js +59 -46
- package/dist/harness/index.d.ts +6 -7
- package/dist/harness/index.js +9 -10
- package/dist/harness/prepare.js +6 -5
- package/dist/harness/requirementsLoader.d.ts +2 -2
- package/dist/harness/requirementsLoader.js +13 -35
- package/dist/harness/tracking.js +18 -18
- package/dist/harness/types.d.ts +1 -1
- package/dist/mcp/convexClient.d.ts +0 -39
- package/dist/mcp/convexClient.js +2 -107
- package/dist/mcp/handlers/authoring.d.ts +1 -1
- package/dist/mcp/handlers/authoring.js +30 -234
- package/dist/mcp/handlers/debug.d.ts +2 -3
- package/dist/mcp/handlers/debug.js +10 -10
- package/dist/mcp/handlers/get.d.ts +1 -1
- package/dist/mcp/handlers/get.js +11 -10
- package/dist/mcp/handlers/index.d.ts +20 -20
- package/dist/mcp/handlers/index.js +10 -10
- package/dist/mcp/handlers/list.d.ts +4 -33
- package/dist/mcp/handlers/list.js +16 -38
- package/dist/mcp/handlers/push.d.ts +1 -1
- package/dist/mcp/handlers/push.js +28 -18
- package/dist/mcp/handlers/report.d.ts +16 -0
- package/dist/mcp/handlers/report.js +134 -0
- package/dist/mcp/handlers/review.d.ts +1 -1
- package/dist/mcp/handlers/review.js +40 -59
- package/dist/mcp/handlers/search.d.ts +1 -1
- package/dist/mcp/handlers/search.js +7 -9
- package/dist/mcp/handlers/test-mapping.d.ts +1 -1
- package/dist/mcp/handlers/test-mapping.js +14 -14
- package/dist/mcp/handlers/types.d.ts +3 -3
- package/dist/mcp/handlers/types.js +2 -2
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +147 -167
- package/dist/push/core.d.ts +2 -2
- package/dist/push/core.js +20 -20
- package/dist/push/index.d.ts +1 -1
- package/dist/push/index.js +2 -2
- package/dist/requirements/cloud-ai.d.ts +57 -0
- package/dist/requirements/cloud-ai.js +104 -0
- package/dist/requirements/cloud-coverage.d.ts +41 -0
- package/dist/requirements/cloud-coverage.js +60 -0
- package/dist/requirements/coverage.d.ts +45 -0
- package/dist/requirements/coverage.js +114 -0
- package/dist/{mcp → requirements}/grep.d.ts +10 -1
- package/dist/{mcp → requirements}/grep.js +89 -44
- package/dist/{mcp/requirements.d.ts → requirements/index.d.ts} +19 -3
- package/dist/{mcp/requirements.js → requirements/index.js} +54 -35
- package/dist/requirements/style-guide.d.ts +67 -0
- package/dist/requirements/style-guide.js +299 -0
- package/dist/{mcp → requirements}/testCodeExtractor.js +24 -26
- package/dist/schema/browser.d.ts +8 -8
- package/dist/schema/browser.js +13 -15
- package/dist/schema/builder.d.ts +1 -1
- package/dist/schema/builder.js +13 -44
- package/dist/schema/conversions.d.ts +2 -2
- package/dist/schema/conversions.js +11 -11
- package/dist/schema/index.d.ts +9 -9
- package/dist/schema/index.js +15 -15
- package/dist/schema/parser-core.d.ts +1 -1
- package/dist/schema/parser-core.js +23 -22
- package/dist/schema/parser.d.ts +3 -3
- package/dist/schema/parser.js +27 -31
- package/dist/schema/resolver.d.ts +1 -1
- package/dist/schema/resolver.js +9 -9
- package/dist/schema/scenario.d.ts +1 -1
- package/dist/schema/scenario.js +1 -1
- package/dist/schema/schemas.d.ts +3 -3
- package/dist/schema/schemas.js +41 -28
- package/dist/schema/test-schema.js +27 -27
- package/dist/templates/context-file-section.md +3 -2
- package/dist/templates/example-requirements.js +1 -1
- package/dist/templates/example-requirements.ts +3 -1
- package/dist/templates/requirements-readme.js +1 -1
- package/dist/templates/requirements-readme.ts +1 -1
- package/dist/templates/skills/codebase-to-spec/SKILL.md +118 -0
- package/dist/utils/brand.js +3 -3
- package/dist/utils/browser-launch.js +4 -4
- package/dist/utils/context-file.d.ts +1 -1
- package/dist/utils/context-file.js +26 -26
- package/dist/utils/env.js +7 -7
- package/dist/utils/gitignore.js +7 -7
- package/dist/utils/oauth-callback-server.d.ts +1 -1
- package/dist/utils/oauth-callback-server.js +27 -25
- package/dist/utils/oauth-flow.js +32 -29
- package/dist/utils/project-discovery.d.ts +3 -3
- package/dist/utils/project-discovery.js +18 -17
- package/dist/utils/project-name.js +8 -8
- package/dist/utils/project-selector.d.ts +1 -1
- package/dist/utils/project-selector.js +24 -21
- package/dist/utils/project-settings.d.ts +1 -1
- package/dist/utils/project-settings.js +24 -22
- package/dist/utils/templates.js +6 -6
- package/package.json +3 -2
- package/dist/commands/browsertest.d.ts +0 -6
- 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 -431
- package/dist/commands/test.d.ts +0 -6
- package/dist/commands/test.js +0 -78
- package/dist/mcp/handlers/coverage.d.ts +0 -44
- package/dist/mcp/handlers/coverage.js +0 -105
- 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
- /package/dist/{mcp → requirements}/testCodeExtractor.d.ts +0 -0
package/dist/mcp/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
6
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
|
+
import { CallToolRequestSchema, GetPromptRequestSchema, ListPromptsRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
8
|
+
import { loadAllRequirements, } from "../requirements/index.js";
|
|
9
|
+
import { discoverProjects, resolveProject, } from "../utils/project-discovery.js";
|
|
10
|
+
import { getCredentialsFromEnv } from "../utils/project-settings.js";
|
|
11
|
+
import { handleCreateRequirementDocument, handleDebugMcpEnvironment, handleGetRequirement, handleGetRequirementsByTest, handleGetTestsByRequirement, handleList, handlePushRequirements, handleReport, handleReviewTest, handleSearchRequirements, handleStyleCheck, handleValidateRequirements, } from "./handlers/index.js";
|
|
12
12
|
// Read version from package.json
|
|
13
13
|
const __filename = fileURLToPath(import.meta.url);
|
|
14
14
|
const __dirname = dirname(__filename);
|
|
15
|
-
const packageJson = JSON.parse(readFileSync(join(__dirname,
|
|
15
|
+
const packageJson = JSON.parse(readFileSync(join(__dirname, "../../package.json"), "utf-8"));
|
|
16
16
|
const VERSION = packageJson.version;
|
|
17
17
|
// Get project paths from environment variables
|
|
18
18
|
// Supports both PROJ_* pattern (Antigravity) and REQUIREMENTS_DIR fallback
|
|
@@ -20,7 +20,7 @@ function getProjectPathsFromEnv() {
|
|
|
20
20
|
const projects = new Map();
|
|
21
21
|
// Check for PROJ_* env vars (project ID -> path mapping)
|
|
22
22
|
for (const [key, value] of Object.entries(process.env)) {
|
|
23
|
-
if (key.startsWith(
|
|
23
|
+
if (key.startsWith("PROJ_") && value) {
|
|
24
24
|
const projectId = key.substring(5); // Remove 'PROJ_' prefix
|
|
25
25
|
projects.set(projectId, value);
|
|
26
26
|
}
|
|
@@ -32,7 +32,7 @@ const WORKSPACE_ROOT = process.env.REQUIREMENTS_DIR || process.cwd();
|
|
|
32
32
|
const PROJECT_PATHS = getProjectPathsFromEnv();
|
|
33
33
|
// Parse --auth-from-env flag for CI/CD environments
|
|
34
34
|
// When set, credentials are read from DOTREQ_PROJECT_ID and DOTREQ_PROJECT_SECRET env vars
|
|
35
|
-
const USE_ENV_AUTH = process.argv.includes(
|
|
35
|
+
const USE_ENV_AUTH = process.argv.includes("--auth-from-env");
|
|
36
36
|
let cachedDiscoveryResult = null;
|
|
37
37
|
// Requirements are loaded fresh on every call. A long-lived in-memory cache
|
|
38
38
|
// silently served stale data when .requirements/*.md files were created or
|
|
@@ -45,13 +45,13 @@ async function getRequirements(projectId) {
|
|
|
45
45
|
return flattened;
|
|
46
46
|
}
|
|
47
47
|
async function getProjectFromDiscovery(projectId) {
|
|
48
|
-
const { isConfiguredProject } = await import(
|
|
48
|
+
const { isConfiguredProject } = await import("../utils/project-discovery.js");
|
|
49
49
|
// If --auth-from-env flag is set, use credentials from environment variables
|
|
50
50
|
// This is the explicit opt-in for CI/CD environments
|
|
51
51
|
if (USE_ENV_AUTH) {
|
|
52
52
|
const envCredentials = getCredentialsFromEnv();
|
|
53
53
|
if (!envCredentials) {
|
|
54
|
-
throw new Error(
|
|
54
|
+
throw new Error("--auth-from-env flag requires DOTREQ_PROJECT_ID and DOTREQ_PROJECT_SECRET environment variables to be set");
|
|
55
55
|
}
|
|
56
56
|
// Return a synthetic project using env credentials and workspace root
|
|
57
57
|
return {
|
|
@@ -64,7 +64,7 @@ async function getProjectFromDiscovery(projectId) {
|
|
|
64
64
|
if (PROJECT_PATHS.size > 0) {
|
|
65
65
|
const projects = [];
|
|
66
66
|
// Validate all env var projects
|
|
67
|
-
for (const [
|
|
67
|
+
for (const [, path] of PROJECT_PATHS.entries()) {
|
|
68
68
|
const project = isConfiguredProject(path);
|
|
69
69
|
if (project) {
|
|
70
70
|
projects.push(project);
|
|
@@ -73,15 +73,15 @@ async function getProjectFromDiscovery(projectId) {
|
|
|
73
73
|
// Build discovery result from env var projects
|
|
74
74
|
if (projects.length === 0) {
|
|
75
75
|
cachedDiscoveryResult = {
|
|
76
|
-
type:
|
|
77
|
-
message:
|
|
76
|
+
type: "none",
|
|
77
|
+
message: "No valid dotrequirements projects found in PROJ_* environment variables",
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
else if (projects.length === 1) {
|
|
81
|
-
cachedDiscoveryResult = { type:
|
|
81
|
+
cachedDiscoveryResult = { type: "single", project: projects[0] };
|
|
82
82
|
}
|
|
83
83
|
else {
|
|
84
|
-
cachedDiscoveryResult = { type:
|
|
84
|
+
cachedDiscoveryResult = { type: "multiple", projects };
|
|
85
85
|
}
|
|
86
86
|
return resolveProject(cachedDiscoveryResult, projectId);
|
|
87
87
|
}
|
|
@@ -99,166 +99,147 @@ export function invalidateCache() {
|
|
|
99
99
|
// Tool definitions
|
|
100
100
|
const tools = [
|
|
101
101
|
{
|
|
102
|
-
name:
|
|
103
|
-
description:
|
|
102
|
+
name: "debug_mcp_environment",
|
|
103
|
+
description: "DEBUG TOOL: Returns diagnostic information about the MCP server environment (working directory, env vars, etc.)",
|
|
104
104
|
inputSchema: {
|
|
105
|
-
type:
|
|
105
|
+
type: "object",
|
|
106
106
|
properties: {},
|
|
107
107
|
required: [],
|
|
108
108
|
},
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
|
-
name:
|
|
112
|
-
description:
|
|
111
|
+
name: "search_requirements",
|
|
112
|
+
description: "Search requirements by text or regex query. Searches requirement IDs, content, and labels. Returns matching requirements with their full context.",
|
|
113
113
|
inputSchema: {
|
|
114
|
-
type:
|
|
114
|
+
type: "object",
|
|
115
115
|
properties: {
|
|
116
116
|
query: {
|
|
117
|
-
type:
|
|
118
|
-
description:
|
|
117
|
+
type: "string",
|
|
118
|
+
description: "Text or regex pattern to search for in requirement IDs, content, or labels",
|
|
119
119
|
},
|
|
120
120
|
useRegex: {
|
|
121
|
-
type:
|
|
122
|
-
description:
|
|
121
|
+
type: "boolean",
|
|
122
|
+
description: "If true, treat query as a regular expression (default: false)",
|
|
123
123
|
},
|
|
124
124
|
projectId: {
|
|
125
|
-
type:
|
|
126
|
-
description:
|
|
125
|
+
type: "string",
|
|
126
|
+
description: "Optional: Specify which project to search (required when multiple projects exist)",
|
|
127
127
|
},
|
|
128
128
|
},
|
|
129
|
-
required: [
|
|
129
|
+
required: ["query"],
|
|
130
130
|
},
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
|
-
name:
|
|
133
|
+
name: "get_requirement",
|
|
134
134
|
description: 'Get a requirement and all its children, including test coverage information. Accepts any requirement path (e.g., "REQ-123" returns the root and all children, "REQ-123.0" returns that node and its children). Shows which tests reference this requirement and includes the test code.',
|
|
135
135
|
inputSchema: {
|
|
136
|
-
type:
|
|
136
|
+
type: "object",
|
|
137
137
|
properties: {
|
|
138
138
|
id: {
|
|
139
|
-
type:
|
|
139
|
+
type: "string",
|
|
140
140
|
description: 'The requirement ID or path (e.g., "REQ-123" for root, "REQ-123.0" for child)',
|
|
141
141
|
},
|
|
142
142
|
projectId: {
|
|
143
|
-
type:
|
|
144
|
-
description:
|
|
143
|
+
type: "string",
|
|
144
|
+
description: "Optional: Specify which project to search (required when multiple projects exist)",
|
|
145
145
|
},
|
|
146
146
|
},
|
|
147
|
-
required: [
|
|
147
|
+
required: ["id"],
|
|
148
148
|
},
|
|
149
149
|
},
|
|
150
150
|
{
|
|
151
|
-
name:
|
|
152
|
-
description:
|
|
151
|
+
name: "list_requirements",
|
|
152
|
+
description: "List requirements in the workspace. Defaults to every root requirement (summary of IDs and content with child counts). Set untested to true to filter to only the root requirements that have no requirement() references in the codebase.",
|
|
153
153
|
inputSchema: {
|
|
154
|
-
type:
|
|
154
|
+
type: "object",
|
|
155
155
|
properties: {
|
|
156
|
-
|
|
157
|
-
type:
|
|
158
|
-
description:
|
|
156
|
+
untested: {
|
|
157
|
+
type: "boolean",
|
|
158
|
+
description: "When true, return only root requirements that have no test references (default: false)",
|
|
159
159
|
},
|
|
160
|
-
},
|
|
161
|
-
required: [],
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
name: 'list_all_requirements',
|
|
166
|
-
description: 'List all requirements in the workspace. Returns a summary of all requirements with their IDs, labels, and content.',
|
|
167
|
-
inputSchema: {
|
|
168
|
-
type: 'object',
|
|
169
|
-
properties: {
|
|
170
160
|
projectId: {
|
|
171
|
-
type:
|
|
172
|
-
description:
|
|
161
|
+
type: "string",
|
|
162
|
+
description: "Optional: Specify which project to search (required when multiple projects exist)",
|
|
173
163
|
},
|
|
174
164
|
},
|
|
175
165
|
required: [],
|
|
176
166
|
},
|
|
177
167
|
},
|
|
178
168
|
{
|
|
179
|
-
name:
|
|
180
|
-
description:
|
|
169
|
+
name: "get_requirements_by_test",
|
|
170
|
+
description: "Get the semantic meaning of requirement() references in a test file. Returns requirement content with line numbers where they are referenced.",
|
|
181
171
|
inputSchema: {
|
|
182
|
-
type:
|
|
172
|
+
type: "object",
|
|
183
173
|
properties: {
|
|
184
174
|
testFile: {
|
|
185
|
-
type:
|
|
186
|
-
description:
|
|
175
|
+
type: "string",
|
|
176
|
+
description: "Path to the test file to analyze",
|
|
187
177
|
},
|
|
188
178
|
projectId: {
|
|
189
|
-
type:
|
|
190
|
-
description:
|
|
179
|
+
type: "string",
|
|
180
|
+
description: "Optional: Specify which project to search (required when multiple projects exist)",
|
|
191
181
|
},
|
|
192
182
|
},
|
|
193
|
-
required: [
|
|
183
|
+
required: ["testFile"],
|
|
194
184
|
},
|
|
195
185
|
},
|
|
196
186
|
{
|
|
197
|
-
name:
|
|
198
|
-
description:
|
|
187
|
+
name: "get_tests_by_requirement",
|
|
188
|
+
description: "Show which requirements from a requirements file have test coverage. Returns a coverage report showing which requirements are tested and where the tests are located. This is the inverse of get_requirements_by_test.",
|
|
199
189
|
inputSchema: {
|
|
200
|
-
type:
|
|
190
|
+
type: "object",
|
|
201
191
|
properties: {
|
|
202
192
|
requirementsFile: {
|
|
203
|
-
type:
|
|
193
|
+
type: "string",
|
|
204
194
|
description: 'Path to the requirements file (e.g., ".requirements/auth.requirements.md")',
|
|
205
195
|
},
|
|
206
196
|
projectId: {
|
|
207
|
-
type:
|
|
208
|
-
description:
|
|
197
|
+
type: "string",
|
|
198
|
+
description: "Optional: Specify which project to search (required when multiple projects exist)",
|
|
209
199
|
},
|
|
210
200
|
},
|
|
211
|
-
required: [
|
|
201
|
+
required: ["requirementsFile"],
|
|
212
202
|
},
|
|
213
203
|
},
|
|
214
204
|
{
|
|
215
|
-
name:
|
|
216
|
-
description:
|
|
205
|
+
name: "report_coverage",
|
|
206
|
+
description: "Display test coverage for the project's requirements. Defaults to local source (most recent test run on this machine, requires `dotrequirements harness prepare` to have run); set source to cloud to query the dot•requirements cloud-persisted record (requires project to be linked via `dotrequirements link`). Optional requirementKey scopes to a single requirement; branch / sinceTimestamp filter cloud-source results.",
|
|
217
207
|
inputSchema: {
|
|
218
|
-
type:
|
|
208
|
+
type: "object",
|
|
219
209
|
properties: {
|
|
220
|
-
|
|
221
|
-
type:
|
|
222
|
-
|
|
210
|
+
source: {
|
|
211
|
+
type: "string",
|
|
212
|
+
enum: ["local", "cloud"],
|
|
213
|
+
description: "Where to read coverage from (default: local)",
|
|
223
214
|
},
|
|
224
|
-
|
|
225
|
-
type:
|
|
226
|
-
description: 'Optional:
|
|
215
|
+
requirementKey: {
|
|
216
|
+
type: "string",
|
|
217
|
+
description: 'Optional: scope to a single requirement (e.g., "REQ-123"). For local source, also includes that requirement\'s children.',
|
|
227
218
|
},
|
|
228
|
-
},
|
|
229
|
-
required: ['requirementKey'],
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
name: 'get_project_coverage_summary',
|
|
234
|
-
description: 'Get a summary of test coverage for all requirements in the project from dot•requirements cloud. Shows which requirements have been tested and which haven\'t. Optionally filter by branch or time range. Requires project to be linked to cloud (run `dotrequirements link`).',
|
|
235
|
-
inputSchema: {
|
|
236
|
-
type: 'object',
|
|
237
|
-
properties: {
|
|
238
219
|
branch: {
|
|
239
|
-
type:
|
|
240
|
-
description: '
|
|
220
|
+
type: "string",
|
|
221
|
+
description: 'Cloud-only: filter coverage to a specific git branch (e.g., "main")',
|
|
241
222
|
},
|
|
242
223
|
sinceTimestamp: {
|
|
243
|
-
type:
|
|
244
|
-
description:
|
|
224
|
+
type: "number",
|
|
225
|
+
description: "Cloud-only: only include coverage recorded after this timestamp (milliseconds since epoch)",
|
|
245
226
|
},
|
|
246
227
|
projectId: {
|
|
247
|
-
type:
|
|
248
|
-
description:
|
|
228
|
+
type: "string",
|
|
229
|
+
description: "Optional: specify which project to use (required when multiple projects exist)",
|
|
249
230
|
},
|
|
250
231
|
},
|
|
251
232
|
required: [],
|
|
252
233
|
},
|
|
253
234
|
},
|
|
254
235
|
{
|
|
255
|
-
name:
|
|
256
|
-
description:
|
|
236
|
+
name: "create_requirement_document",
|
|
237
|
+
description: "Returns a well-formatted Markdown template that demonstrates the requirements file format. Use this to understand the format before creating requirements files. AI should use this template as a reference, then use filesystem tools (Read/Write) to create actual files.",
|
|
257
238
|
inputSchema: {
|
|
258
|
-
type:
|
|
239
|
+
type: "object",
|
|
259
240
|
properties: {
|
|
260
241
|
filePath: {
|
|
261
|
-
type:
|
|
242
|
+
type: "string",
|
|
262
243
|
description: 'Optional: Suggested file path for documentation purposes (e.g., ".requirements/auth.requirements.md")',
|
|
263
244
|
},
|
|
264
245
|
},
|
|
@@ -266,97 +247,97 @@ const tools = [
|
|
|
266
247
|
},
|
|
267
248
|
},
|
|
268
249
|
{
|
|
269
|
-
name:
|
|
270
|
-
description:
|
|
250
|
+
name: "validate_requirements",
|
|
251
|
+
description: "Validate a requirements Markdown file's schema. Returns detailed error messages on syntax problems. Works offline (no network/auth required). Use this to verify files before pushing.",
|
|
271
252
|
inputSchema: {
|
|
272
|
-
type:
|
|
253
|
+
type: "object",
|
|
273
254
|
properties: {
|
|
274
255
|
filePath: {
|
|
275
|
-
type:
|
|
256
|
+
type: "string",
|
|
276
257
|
description: 'Path to the Markdown file to validate (e.g., ".requirements/auth.requirements.md")',
|
|
277
258
|
},
|
|
278
259
|
},
|
|
279
|
-
required: [
|
|
260
|
+
required: ["filePath"],
|
|
280
261
|
},
|
|
281
262
|
},
|
|
282
263
|
{
|
|
283
|
-
name:
|
|
284
|
-
description:
|
|
264
|
+
name: "push_requirements",
|
|
265
|
+
description: "Push local requirements from .requirements/ directory to dot•requirements cloud. First call returns diff summary for user review. Second call with confirmed=true executes the push. Requires project to be linked to cloud (run `dotrequirements link`).",
|
|
285
266
|
inputSchema: {
|
|
286
|
-
type:
|
|
267
|
+
type: "object",
|
|
287
268
|
properties: {
|
|
288
269
|
filePath: {
|
|
289
|
-
type:
|
|
270
|
+
type: "string",
|
|
290
271
|
description: 'Optional: Push specific file only (e.g., ".requirements/auth.requirements.md"). If omitted, pushes all files.',
|
|
291
272
|
},
|
|
292
273
|
confirmed: {
|
|
293
|
-
type:
|
|
294
|
-
description:
|
|
274
|
+
type: "boolean",
|
|
275
|
+
description: "Set to true to execute the push after reviewing the diff. First call should omit this.",
|
|
295
276
|
},
|
|
296
277
|
projectId: {
|
|
297
|
-
type:
|
|
298
|
-
description:
|
|
278
|
+
type: "string",
|
|
279
|
+
description: "Optional: Specify which project to use (required when multiple projects exist)",
|
|
299
280
|
},
|
|
300
281
|
},
|
|
301
282
|
required: [],
|
|
302
283
|
},
|
|
303
284
|
},
|
|
304
285
|
{
|
|
305
|
-
name:
|
|
306
|
-
description:
|
|
286
|
+
name: "style_check",
|
|
287
|
+
description: "Check requirements files or test files for style issues and best practices. Uses AI to provide actionable feedback on writing style, clarity, and conventions. Supports requirements files (*.requirements.md) and test files (*.test.*, *.spec.*). For requirements files, you can optionally specify requirement keys to check only those requirements instead of the entire file. Requires project to be linked to cloud (run `dotrequirements link`).",
|
|
307
288
|
inputSchema: {
|
|
308
|
-
type:
|
|
289
|
+
type: "object",
|
|
309
290
|
properties: {
|
|
310
291
|
filePath: {
|
|
311
|
-
type:
|
|
292
|
+
type: "string",
|
|
312
293
|
description: 'Path to the file to check (e.g., ".requirements/auth.requirements.md" or "src/auth.test.ts")',
|
|
313
294
|
},
|
|
314
295
|
requirementKeys: {
|
|
315
|
-
type:
|
|
316
|
-
items: { type:
|
|
296
|
+
type: "array",
|
|
297
|
+
items: { type: "string" },
|
|
317
298
|
description: 'Optional: Array of requirement keys to check (e.g., ["AUTH-1", "AUTH-2"]). Only valid for requirements files (*.requirements.md). When provided, only these requirements are checked instead of the entire file.',
|
|
318
299
|
},
|
|
319
300
|
model: {
|
|
320
|
-
type:
|
|
301
|
+
type: "string",
|
|
321
302
|
description: 'Optional: AI model to use for style checking (default: "anthropic/claude-haiku-4.5"). Supported models: "anthropic/claude-haiku-4.5", "google/gemini-3-flash"',
|
|
322
303
|
},
|
|
323
304
|
},
|
|
324
|
-
required: [
|
|
305
|
+
required: ["filePath"],
|
|
325
306
|
},
|
|
326
307
|
},
|
|
327
308
|
{
|
|
328
|
-
name:
|
|
329
|
-
description:
|
|
309
|
+
name: "review_test",
|
|
310
|
+
description: "Comprehensively review a test file for both style and semantic correctness. Checks if tests actually validate what the requirements specify (not just style). Loads referenced requirements and validates that test setup, actions, and assertions match requirement preconditions, triggers, and outcomes. Requires project to be linked to cloud (run `dotrequirements link`).",
|
|
330
311
|
inputSchema: {
|
|
331
|
-
type:
|
|
312
|
+
type: "object",
|
|
332
313
|
properties: {
|
|
333
314
|
testFilePath: {
|
|
334
|
-
type:
|
|
315
|
+
type: "string",
|
|
335
316
|
description: 'Path to the test file to review (e.g., "src/auth.test.ts")',
|
|
336
317
|
},
|
|
337
318
|
projectId: {
|
|
338
|
-
type:
|
|
339
|
-
description:
|
|
319
|
+
type: "string",
|
|
320
|
+
description: "Optional: Specify which project to use (required when multiple projects exist)",
|
|
340
321
|
},
|
|
341
322
|
},
|
|
342
|
-
required: [
|
|
323
|
+
required: ["testFilePath"],
|
|
343
324
|
},
|
|
344
325
|
},
|
|
345
326
|
];
|
|
346
327
|
// Prompt definitions
|
|
347
328
|
const prompts = [
|
|
348
329
|
{
|
|
349
|
-
name:
|
|
350
|
-
description:
|
|
330
|
+
name: "capture-requirements",
|
|
331
|
+
description: "Guide the user through capturing requirements for a new feature before implementation",
|
|
351
332
|
},
|
|
352
333
|
{
|
|
353
|
-
name:
|
|
354
|
-
description:
|
|
334
|
+
name: "write-tests",
|
|
335
|
+
description: "Guide writing tests that reference and validate requirements",
|
|
355
336
|
},
|
|
356
337
|
];
|
|
357
338
|
// Create server (exported for testing with InMemoryTransport)
|
|
358
339
|
export const server = new Server({
|
|
359
|
-
name:
|
|
340
|
+
name: "dotrequirements",
|
|
360
341
|
version: VERSION,
|
|
361
342
|
}, {
|
|
362
343
|
capabilities: {
|
|
@@ -375,13 +356,13 @@ server.setRequestHandler(ListPromptsRequestSchema, async () => {
|
|
|
375
356
|
// Handle get prompt
|
|
376
357
|
server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
377
358
|
const { name } = request.params;
|
|
378
|
-
if (name ===
|
|
359
|
+
if (name === "capture-requirements") {
|
|
379
360
|
return {
|
|
380
361
|
messages: [
|
|
381
362
|
{
|
|
382
|
-
role:
|
|
363
|
+
role: "user",
|
|
383
364
|
content: {
|
|
384
|
-
type:
|
|
365
|
+
type: "text",
|
|
385
366
|
text: `# Capture Requirements for New Feature
|
|
386
367
|
|
|
387
368
|
Let's document what this feature should do before building it.
|
|
@@ -429,13 +410,13 @@ After capturing requirements:
|
|
|
429
410
|
],
|
|
430
411
|
};
|
|
431
412
|
}
|
|
432
|
-
if (name ===
|
|
413
|
+
if (name === "write-tests") {
|
|
433
414
|
return {
|
|
434
415
|
messages: [
|
|
435
416
|
{
|
|
436
|
-
role:
|
|
417
|
+
role: "user",
|
|
437
418
|
content: {
|
|
438
|
-
type:
|
|
419
|
+
type: "text",
|
|
439
420
|
text: `# Write Tests for Requirements
|
|
440
421
|
|
|
441
422
|
Let's write tests that validate the requirements.
|
|
@@ -533,7 +514,7 @@ After writing tests:
|
|
|
533
514
|
|
|
534
515
|
- \`get_requirement\` - Get requirement tree with existing coverage
|
|
535
516
|
- \`get_requirements_by_test\` - See requirements referenced in a test file
|
|
536
|
-
- \`
|
|
517
|
+
- \`list_requirements\` (with \`untested: true\`) - Find requirements without tests
|
|
537
518
|
- \`review_test\` - Validate test actually checks what requirement specifies (run after writing tests)`,
|
|
538
519
|
},
|
|
539
520
|
},
|
|
@@ -557,39 +538,38 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
557
538
|
};
|
|
558
539
|
try {
|
|
559
540
|
switch (name) {
|
|
560
|
-
case
|
|
561
|
-
return handleDebugMcpEnvironment(
|
|
562
|
-
case
|
|
541
|
+
case "debug_mcp_environment":
|
|
542
|
+
return handleDebugMcpEnvironment({}, handlerContext);
|
|
543
|
+
case "search_requirements":
|
|
563
544
|
return handleSearchRequirements(args, handlerContext);
|
|
564
|
-
case
|
|
545
|
+
case "get_requirement":
|
|
565
546
|
return handleGetRequirement(args, handlerContext);
|
|
566
|
-
case
|
|
567
|
-
return
|
|
568
|
-
case
|
|
569
|
-
return handleListAllRequirements(args, handlerContext);
|
|
570
|
-
case 'get_requirements_by_test':
|
|
547
|
+
case "list_requirements":
|
|
548
|
+
return handleList(args, handlerContext);
|
|
549
|
+
case "get_requirements_by_test":
|
|
571
550
|
return handleGetRequirementsByTest(args, handlerContext);
|
|
572
|
-
case
|
|
551
|
+
case "get_tests_by_requirement":
|
|
573
552
|
return handleGetTestsByRequirement(args, handlerContext);
|
|
574
|
-
case
|
|
575
|
-
return
|
|
576
|
-
case
|
|
577
|
-
return handleGetProjectCoverageSummary(args, handlerContext);
|
|
578
|
-
case 'create_requirement_document':
|
|
553
|
+
case "report_coverage":
|
|
554
|
+
return handleReport(args, handlerContext);
|
|
555
|
+
case "create_requirement_document":
|
|
579
556
|
return handleCreateRequirementDocument(args, handlerContext);
|
|
580
|
-
case
|
|
557
|
+
case "validate_requirements":
|
|
581
558
|
return handleValidateRequirements(args, handlerContext);
|
|
582
|
-
case
|
|
559
|
+
case "push_requirements":
|
|
583
560
|
return handlePushRequirements(args, handlerContext);
|
|
584
|
-
case
|
|
585
|
-
return handleStyleCheck(args, handlerContext, {
|
|
586
|
-
|
|
561
|
+
case "style_check":
|
|
562
|
+
return handleStyleCheck(args, handlerContext, {
|
|
563
|
+
useEnvAuth: USE_ENV_AUTH,
|
|
564
|
+
apiBaseUrl: process.env.DOTREQUIREMENTS_API_URL,
|
|
565
|
+
});
|
|
566
|
+
case "review_test":
|
|
587
567
|
return handleReviewTest(args, handlerContext, { apiBaseUrl: process.env.DOTREQUIREMENTS_API_URL });
|
|
588
568
|
default:
|
|
589
569
|
return {
|
|
590
570
|
content: [
|
|
591
571
|
{
|
|
592
|
-
type:
|
|
572
|
+
type: "text",
|
|
593
573
|
text: `Unknown tool: ${name}`,
|
|
594
574
|
},
|
|
595
575
|
],
|
|
@@ -601,7 +581,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
601
581
|
return {
|
|
602
582
|
content: [
|
|
603
583
|
{
|
|
604
|
-
type:
|
|
584
|
+
type: "text",
|
|
605
585
|
text: `Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
606
586
|
},
|
|
607
587
|
],
|
|
@@ -613,10 +593,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
613
593
|
export async function main() {
|
|
614
594
|
const transport = new StdioServerTransport();
|
|
615
595
|
await server.connect(transport);
|
|
616
|
-
console.error(
|
|
617
|
-
console.error(
|
|
618
|
-
console.error(
|
|
619
|
-
console.error(
|
|
596
|
+
console.error("dot•requirements MCP server running");
|
|
597
|
+
console.error("WORKSPACE_ROOT:", WORKSPACE_ROOT);
|
|
598
|
+
console.error("process.cwd():", process.cwd());
|
|
599
|
+
console.error("REQUIREMENTS_DIR env:", process.env.REQUIREMENTS_DIR);
|
|
620
600
|
}
|
|
621
601
|
// Only run when executed directly, not when imported (enables InMemoryTransport testing)
|
|
622
602
|
if (import.meta.url === `file://${process.argv[1]}`) {
|
package/dist/push/core.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - Executing the push
|
|
10
10
|
* - Updating local files with document IDs and timestamps
|
|
11
11
|
*/
|
|
12
|
-
import type { Metadata } from
|
|
12
|
+
import type { Metadata } from "../schema/index.js";
|
|
13
13
|
export interface PushCredentials {
|
|
14
14
|
projectId: string;
|
|
15
15
|
projectSecret: string;
|
|
@@ -41,7 +41,7 @@ export interface CloudDocumentMetadata {
|
|
|
41
41
|
*/
|
|
42
42
|
export interface DryRunResultItem {
|
|
43
43
|
dryRun: true;
|
|
44
|
-
action:
|
|
44
|
+
action: "create" | "update" | "not_found" | "invalid";
|
|
45
45
|
documentId?: string;
|
|
46
46
|
title?: string;
|
|
47
47
|
warning?: string;
|