@okfit/mcp 0.5.1 → 0.5.3

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
@@ -41,7 +41,7 @@ or `.config/okfit.toml`.
41
41
  | `get_concept` | One concept by id: its whole decoded frontmatter, the file's raw markdown text, its bundle-relative path, and every outgoing link. |
42
42
  | `concept_neighbors` | A concept's graph neighbours — everything it links to and everything that links to it — each with its node kind and, for a concept target, its full summary. |
43
43
  | `stale_report` | Every concept whose `stale_after` instant has passed, each with its summary and how many whole days past it, as of now or an explicit instant. |
44
- | `validate_bundle` | The same conformance and lint report `okfit validate --format json` produces, unchanged. Its `engine_version` and `okf_version` match the CLI's over one bundle; `okfit_version` is this package's own version and `producer` is `@okfit/mcp`. |
44
+ | `validate_bundle` | The same conformance and lint report `okfit validate --format json` produces, unchanged. Its `engine_version` and `okf_version` match the CLI's over one bundle; `okfit_version` is this package's own version and `producer` is `@okfit/mcp`. Optional `documents: [{ path, text }]` validates unsaved text (bundle-relative paths, a new file only under an existing directory) without writing it. |
45
45
 
46
46
  ## Resources
47
47
 
package/errors.js CHANGED
@@ -16,7 +16,7 @@ const Remediation = Schema.Struct({
16
16
  * `{ isError: true, content: [{ type: "text", text: error.message }] }`
17
17
  * and never surfaces `structuredContent` for it
18
18
  * (`.repos/effect/packages/effect/src/unstable/ai/McpServer.ts:1774-1778,1842-1846`
19
- * at effect@4.0.0-rc.116: `toolErrorResult` and `declaredFailureResult`'s
19
+ * at `effect@4.0.0-rc.116`: `toolErrorResult` and `declaredFailureResult`'s
20
20
  * `error instanceof Error` branch; confirmed empirically in Task B1's own
21
21
  * build). Since rc.116 that declared branch is rendered WITHOUT a log line
22
22
  * — only an internal failure goes through `Effect.logError` — so the
package/index.d.ts CHANGED
@@ -22,7 +22,7 @@ export type Remediation = typeof Remediation.Type;
22
22
  * `{ isError: true, content: [{ type: "text", text: error.message }] }`
23
23
  * and never surfaces `structuredContent` for it
24
24
  * (`.repos/effect/packages/effect/src/unstable/ai/McpServer.ts:1774-1778,1842-1846`
25
- * at effect@4.0.0-rc.116: `toolErrorResult` and `declaredFailureResult`'s
25
+ * at `effect@4.0.0-rc.116`: `toolErrorResult` and `declaredFailureResult`'s
26
26
  * `error instanceof Error` branch; confirmed empirically in Task B1's own
27
27
  * build). Since rc.116 that declared branch is rendered WITHOUT a log line
28
28
  * — only an internal failure goes through `Effect.logError` — so the
@@ -356,9 +356,13 @@ export declare const StaleReportSuccess: Schema.Struct<{
356
356
  }>;
357
357
  /** @public */
358
358
  export type StaleReportSuccess = typeof StaleReportSuccess.Type;
359
- /** `validate_bundle`'s arguments: the same shape and decode path as stale_report. @public */
359
+ /** `validate_bundle`'s arguments: stale_report's `now`, plus optional unsaved `documents` (spec 4.5). @public */
360
360
  export declare const ValidateBundleParams: Schema.Struct<{
361
361
  readonly now: Schema.optionalKey<Schema.String>;
362
+ readonly documents: Schema.optionalKey<Schema.$Array<Schema.Struct<{
363
+ readonly path: Schema.String;
364
+ readonly text: Schema.String;
365
+ }>>>;
362
366
  }>;
363
367
  /** @public */
364
368
  export type ValidateBundleParams = typeof ValidateBundleParams.Type;
@@ -584,6 +588,10 @@ export declare const OkfitToolkit: Toolkit.Toolkit<{
584
588
  readonly validate_bundle: import("effect/unstable/ai/Tool").Tool<"validate_bundle", {
585
589
  readonly parameters: import("effect/Schema").Struct<{
586
590
  readonly now: import("effect/Schema").optionalKey<import("effect/Schema").String>;
591
+ readonly documents: import("effect/Schema").optionalKey<import("effect/Schema").$Array<import("effect/Schema").Struct<{
592
+ readonly path: import("effect/Schema").String;
593
+ readonly text: import("effect/Schema").String;
594
+ }>>>;
587
595
  }>;
588
596
  readonly success: import("effect/Schema").Struct<{
589
597
  readonly schema: import("effect/Schema").Literal<1>;
@@ -770,6 +778,10 @@ export declare const ToolsLayer: (projectRoot: string, distribution?: Distributi
770
778
  readonly validate_bundle: import("effect/unstable/ai/Tool").Tool<"validate_bundle", {
771
779
  readonly parameters: import("effect/Schema").Struct<{
772
780
  readonly now: import("effect/Schema").optionalKey<import("effect/Schema").String>;
781
+ readonly documents: import("effect/Schema").optionalKey<import("effect/Schema").$Array<import("effect/Schema").Struct<{
782
+ readonly path: import("effect/Schema").String;
783
+ readonly text: import("effect/Schema").String;
784
+ }>>>;
773
785
  }>;
774
786
  readonly success: import("effect/Schema").Struct<{
775
787
  readonly schema: import("effect/Schema").Literal<1>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okfit/mcp",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "private": false,
5
5
  "description": "Model Context Protocol server for okfit: query and understand Open Knowledge Format (OKF) bundles from an agent.",
6
6
  "keywords": [
@@ -44,13 +44,13 @@
44
44
  "okfit-mcp": "bin/okfit-mcp.js"
45
45
  },
46
46
  "dependencies": {
47
- "@effect/platform-node": "4.0.0-rc.116",
48
- "@effected/git": "^0.16.0",
49
- "@effected/xdg": "^0.6.1",
50
- "@okfit/core": "0.7.3",
51
- "@okfit/engine": "0.7.4",
52
- "@okfit/profiles": "0.7.4",
53
- "effect": "4.0.0-rc.116"
47
+ "@effect/platform-node": "4.0.0-rc.117",
48
+ "@effected/git": "^0.17.0",
49
+ "@effected/xdg": "^0.7.0",
50
+ "@okfit/core": "0.8.0",
51
+ "@okfit/engine": "0.8.0",
52
+ "@okfit/profiles": "0.8.0",
53
+ "effect": "4.0.0-rc.117"
54
54
  },
55
55
  "engines": {
56
56
  "node": ">=24.11.0"
package/schema/tools.js CHANGED
@@ -71,8 +71,16 @@ const StaleReportSuccess = Schema.Struct({
71
71
  days_past: Schema.Int
72
72
  }))
73
73
  });
74
- /** `validate_bundle`'s arguments: the same shape and decode path as stale_report. @public */
75
- const ValidateBundleParams = Schema.Struct({ now: Schema.optionalKey(Schema.String) });
74
+ /** One unsaved document for `validate_bundle`: bundle-relative posix `path`, full `text`. @public */
75
+ const ValidateBundleDocument = Schema.Struct({
76
+ path: Schema.String,
77
+ text: Schema.String
78
+ });
79
+ /** `validate_bundle`'s arguments: stale_report's `now`, plus optional unsaved `documents` (spec 4.5). @public */
80
+ const ValidateBundleParams = Schema.Struct({
81
+ now: Schema.optionalKey(Schema.String),
82
+ documents: Schema.optionalKey(Schema.Array(ValidateBundleDocument))
83
+ });
76
84
 
77
85
  //#endregion
78
- export { ConceptNeighborsSuccess, DescribeVocabularySuccess, GetConceptSuccess, ListConceptsParams, ListConceptsSuccess, Neighbor, StaleReportParams, StaleReportSuccess, ValidateBundleParams };
86
+ export { ConceptNeighborsSuccess, DescribeVocabularySuccess, GetConceptSuccess, ListConceptsParams, ListConceptsSuccess, Neighbor, StaleReportParams, StaleReportSuccess, ValidateBundleDocument, ValidateBundleParams };
@@ -1,4 +1,4 @@
1
- import { BundleNotFound, McpToolError, composeRemediatedMessage } from "../errors.js";
1
+ import { BundleNotFound, InvalidArgument, McpToolError, composeRemediatedMessage } from "../errors.js";
2
2
  import { resolveConfigOnly } from "../internal/toolContext.js";
3
3
  import { ValidateBundleParams } from "../schema/tools.js";
4
4
  import { resolveNow } from "../internal/resolveNow.js";
@@ -6,13 +6,13 @@ import { MCP_VERSION } from "../version.js";
6
6
  import { Crypto, Effect, FileSystem, Option, Path } from "effect";
7
7
  import { OKF_SPEC_VERSION } from "@okfit/core";
8
8
  import { Tool } from "effect/unstable/ai";
9
- import { JsonEnvelope, collect, forDiagnostics, json, run } from "@okfit/engine";
9
+ import { DocumentPathError, JsonEnvelope, collect, forDiagnostics, json, provideDocuments, run } from "@okfit/engine";
10
10
  import { Git } from "@effected/git";
11
11
  import { GitHistory } from "@okfit/profiles";
12
12
  import { AppDirs, Xdg } from "@effected/xdg";
13
13
 
14
14
  //#region src/tools/validateBundle.ts
15
- const DESCRIPTION = "Runs the same conformance and lint checks as `okfit validate --format json` and returns that report unchanged: every diagnostic's file, code, severity, message and range, plus the summary counts and the exit code the CLI would use. Call it after writing or editing any concept file, before moving on to the next one.";
15
+ const DESCRIPTION = "Returns the report `okfit validate --format json` prints, unchanged: each diagnostic's file, code, severity, message and range, the summary counts and the CLI's exit code. Call it after editing any concept file. Optional documents: [{ path, text }] (bundle-relative, e.g. metrics/churn.md) stand in for disk, a file not yet written under an existing directory included; nothing is written.";
16
16
  /**
17
17
  * `dependencies` mirrors the other tools' (Task B1's Deviation 1):
18
18
  * `resolveConfigOnly` and `run()` need the same platform services, and
@@ -75,7 +75,15 @@ const handleValidateBundle = (projectRoot, params, distribution) => Effect.gen(f
75
75
  config: resolved.config,
76
76
  profile: resolved.profile,
77
77
  now
78
- }).pipe(Effect.mapError((cause) => {
78
+ }).pipe(provideDocuments(resolved.bundleRoot, params.documents ?? []), Effect.mapError((cause) => {
79
+ if (cause instanceof DocumentPathError) {
80
+ const remediation = { hint: "Give each document path relative to the bundle root, in posix form, naming a .md file once (for example metrics/churn.md)." };
81
+ return new InvalidArgument({
82
+ argument: "documents",
83
+ message: composeRemediatedMessage(cause.message, remediation),
84
+ remediation
85
+ });
86
+ }
79
87
  const remediation = { hint: `The bundle root "${resolved.bundleRoot}" does not exist or could not be read; check the config's [bundle].path, or run \`okfit init\`.` };
80
88
  return new BundleNotFound({
81
89
  root: resolved.bundleRoot,
package/version.js CHANGED
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @public
7
7
  */
8
- const MCP_VERSION = "0.5.1";
8
+ const MCP_VERSION = "0.5.3";
9
9
 
10
10
  //#endregion
11
11
  export { MCP_VERSION };