@projitive/mcp 1.0.3 → 1.0.4

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Language: English | [简体中文](README_CN.md)
4
4
 
5
- **Current Spec Version: projitive-spec v1.0.0 | MCP Version: 1.0.3**
5
+ **Current Spec Version: projitive-spec v1.0.0 | MCP Version: 1.0.4**
6
6
 
7
7
  Projitive MCP server (semantic interface edition) helps agents discover projects, select tasks, locate evidence, and execute under governance workflows.
8
8
 
@@ -92,10 +92,10 @@ MCP client config example (`mcp.json`):
92
92
  }
93
93
  ```
94
94
 
95
- Environment variables:
95
+ Environment variables (required):
96
96
 
97
- - `PROJITIVE_SCAN_ROOT_PATH`: fallback scan root for discovery methods when `rootPath` is omitted.
98
- - `PROJITIVE_SCAN_MAX_DEPTH`: fallback scan depth when `maxDepth` is omitted (`0-8`, default `3`).
97
+ - `PROJITIVE_SCAN_ROOT_PATH`: required scan root for discovery methods.
98
+ - `PROJITIVE_SCAN_MAX_DEPTH`: required scan depth for discovery methods (integer `0-8`).
99
99
 
100
100
  Local path startup is not the recommended usage mode in this README.
101
101
 
@@ -149,14 +149,14 @@ npm run test
149
149
  #### `projectInit`
150
150
 
151
151
  - **Purpose**: manually initialize governance directory structure for a project (default `.projitive`).
152
- - **Input**: `rootPath?`, `governanceDir?`, `force?`
152
+ - **Input**: `projectPath?`, `governanceDir?`, `force?`
153
153
  - **Output Example (Markdown)**:
154
154
 
155
155
  ```markdown
156
156
  # projectInit
157
157
 
158
158
  ## Summary
159
- - rootPath: /workspace/proj-a
159
+ - projectPath: /workspace/proj-a
160
160
  - governanceDir: /workspace/proj-a/.projitive
161
161
  - markerPath: /workspace/proj-a/.projitive/.projitive
162
162
  - force: false
@@ -206,7 +206,7 @@ npm run test
206
206
  #### `projectScan`
207
207
 
208
208
  - **Purpose**: scan directories and discover governable projects.
209
- - **Input**: `rootPath?`, `maxDepth?`
209
+ - **Input**: `(none)`
210
210
  - **Output Example (Markdown)**:
211
211
 
212
212
  ```markdown
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projitive/mcp",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Projitive MCP Server for project and task discovery/update",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -41,15 +41,27 @@ function parseDepthFromEnv(rawDepth) {
41
41
  }
42
42
  return Math.min(MAX_SCAN_DEPTH, Math.max(0, parsed));
43
43
  }
44
+ function requireEnvVar(name) {
45
+ const value = process.env[name];
46
+ if (typeof value !== "string" || value.trim().length === 0) {
47
+ throw new Error(`Missing required environment variable: ${name}`);
48
+ }
49
+ return value.trim();
50
+ }
44
51
  export function resolveScanRoot(inputPath) {
45
- const fallback = process.env.PROJITIVE_SCAN_ROOT_PATH;
46
- return normalizePath(inputPath ?? fallback);
52
+ const configuredRoot = requireEnvVar("PROJITIVE_SCAN_ROOT_PATH");
53
+ return normalizePath(inputPath ?? configuredRoot);
47
54
  }
48
55
  export function resolveScanDepth(inputDepth) {
56
+ const configuredDepthRaw = requireEnvVar("PROJITIVE_SCAN_MAX_DEPTH");
57
+ const configuredDepth = parseDepthFromEnv(configuredDepthRaw);
58
+ if (typeof configuredDepth !== "number") {
59
+ throw new Error("Invalid PROJITIVE_SCAN_MAX_DEPTH: expected integer in range 0-8");
60
+ }
49
61
  if (typeof inputDepth === "number") {
50
62
  return inputDepth;
51
63
  }
52
- return parseDepthFromEnv(process.env.PROJITIVE_SCAN_MAX_DEPTH) ?? DEFAULT_SCAN_DEPTH;
64
+ return configuredDepth;
53
65
  }
54
66
  function renderArtifactsMarkdown(artifacts) {
55
67
  const rows = artifacts.map((item) => {
@@ -226,16 +238,16 @@ function defaultNoTaskDiscoveryHookMarkdown() {
226
238
  ].join("\n");
227
239
  }
228
240
  export async function initializeProjectStructure(inputPath, governanceDir, force = false) {
229
- const rootPath = normalizePath(inputPath);
241
+ const projectPath = normalizePath(inputPath);
230
242
  const governanceDirName = normalizeGovernanceDirName(governanceDir);
231
- const rootStat = await catchIt(fs.stat(rootPath));
243
+ const rootStat = await catchIt(fs.stat(projectPath));
232
244
  if (rootStat.isError()) {
233
- throw new Error(`Path not found: ${rootPath}`);
245
+ throw new Error(`Path not found: ${projectPath}`);
234
246
  }
235
247
  if (!rootStat.value.isDirectory()) {
236
- throw new Error(`rootPath must be a directory: ${rootPath}`);
248
+ throw new Error(`projectPath must be a directory: ${projectPath}`);
237
249
  }
238
- const governancePath = path.join(rootPath, governanceDirName);
250
+ const governancePath = path.join(projectPath, governanceDirName);
239
251
  const directories = [];
240
252
  const requiredDirectories = [governancePath, path.join(governancePath, "designs"), path.join(governancePath, "reports"), path.join(governancePath, "hooks")];
241
253
  for (const dirPath of requiredDirectories) {
@@ -252,7 +264,7 @@ export async function initializeProjectStructure(inputPath, governanceDir, force
252
264
  writeTextFile(path.join(governancePath, "hooks", "task_no_actionable.md"), defaultNoTaskDiscoveryHookMarkdown(), force),
253
265
  ]);
254
266
  return {
255
- rootPath,
267
+ projectPath,
256
268
  governanceDir: governancePath,
257
269
  markerPath,
258
270
  directories,
@@ -264,12 +276,12 @@ export function registerProjectTools(server) {
264
276
  title: "Project Init",
265
277
  description: "Initialize Projitive governance directory structure manually (default .projitive)",
266
278
  inputSchema: {
267
- rootPath: z.string().optional(),
279
+ projectPath: z.string().optional(),
268
280
  governanceDir: z.string().optional(),
269
281
  force: z.boolean().optional(),
270
282
  },
271
- }, async ({ rootPath, governanceDir, force }) => {
272
- const initialized = await initializeProjectStructure(rootPath, governanceDir, force ?? false);
283
+ }, async ({ projectPath, governanceDir, force }) => {
284
+ const initialized = await initializeProjectStructure(projectPath, governanceDir, force ?? false);
273
285
  const filesByAction = {
274
286
  created: initialized.files.filter((item) => item.action === "created"),
275
287
  updated: initialized.files.filter((item) => item.action === "updated"),
@@ -279,7 +291,7 @@ export function registerProjectTools(server) {
279
291
  toolName: "projectInit",
280
292
  sections: [
281
293
  summarySection([
282
- `- rootPath: ${initialized.rootPath}`,
294
+ `- projectPath: ${initialized.projectPath}`,
283
295
  `- governanceDir: ${initialized.governanceDir}`,
284
296
  `- markerPath: ${initialized.markerPath}`,
285
297
  `- force: ${force === true ? "true" : "false"}`,
@@ -309,13 +321,10 @@ export function registerProjectTools(server) {
309
321
  server.registerTool("projectScan", {
310
322
  title: "Project Scan",
311
323
  description: "Scan filesystem and discover project governance roots marked by .projitive",
312
- inputSchema: {
313
- rootPath: z.string().optional(),
314
- maxDepth: z.number().int().min(0).max(8).optional(),
315
- },
316
- }, async ({ rootPath, maxDepth }) => {
317
- const root = resolveScanRoot(rootPath);
318
- const depth = resolveScanDepth(maxDepth);
324
+ inputSchema: {},
325
+ }, async () => {
326
+ const root = resolveScanRoot();
327
+ const depth = resolveScanDepth();
319
328
  const projects = await discoverProjects(root, depth);
320
329
  const markdown = renderToolResponseMarkdown({
321
330
  toolName: "projectScan",
@@ -611,7 +611,7 @@ export function registerTaskTools(server) {
611
611
  ]),
612
612
  nextCallSection(preferredProject
613
613
  ? `projectContext(projectPath=\"${preferredProject.governanceDir}\")`
614
- : `projectScan(rootPath=\"${root}\", maxDepth=${depth})`),
614
+ : "projectScan()"),
615
615
  ],
616
616
  });
617
617
  return asText(markdown);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projitive/mcp",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Projitive MCP Server for project and task discovery/update",
5
5
  "license": "ISC",
6
6
  "author": "",