@adrkit/evaluator 0.1.0 → 0.2.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 CHANGED
@@ -6,7 +6,7 @@ reports and schema-compatible patches, and routes proposals without approving
6
6
  or persisting them.
7
7
 
8
8
  ```sh
9
- bun add @adrkit/evaluator
9
+ npm install @adrkit/evaluator # or: bun add @adrkit/evaluator
10
10
  ```
11
11
 
12
12
  ```ts
@@ -16,7 +16,12 @@ const result = evaluatePass0(input);
16
16
  ```
17
17
 
18
18
  No model, network, clock, filesystem traversal, or database is used by the
19
- library. The published ESM artifacts run on Node.js 22 or newer.
19
+ library. The published ESM artifacts run on Node.js 22 or newer; development in
20
+ the adrkit repository uses Bun.
21
+
22
+ See also [`@adrkit/mcp`](../mcp/README.md) — a local, read-only Model Context
23
+ Protocol server that exposes the ADR corpus (including superseded/rejected
24
+ decisions) to coding agents.
20
25
 
21
26
  Documentation: <https://adrkit.dev>
22
27
 
package/dist/index.js CHANGED
@@ -505,12 +505,7 @@ function evaluateSupersessionConsistent(ctx) {
505
505
  }
506
506
 
507
507
  // src/rules/no-orphan-refs.ts
508
- function parseRef(ref) {
509
- const idx = ref.indexOf(":");
510
- if (idx <= 0)
511
- return { id: ref };
512
- return { log: ref.slice(0, idx), id: ref.slice(idx + 1) };
513
- }
508
+ import { parseAdrRef } from "@adrkit/core";
514
509
  function evaluateNoOrphanRefs(ctx) {
515
510
  const resolutionLog = ctx.input.resolutionLog;
516
511
  const localIds = new Set;
@@ -533,7 +528,7 @@ function evaluateNoOrphanRefs(ctx) {
533
528
  }
534
529
  const subs = [];
535
530
  function classify(ref) {
536
- const parsed = parseRef(ref);
531
+ const parsed = parseAdrRef(ref);
537
532
  if (parsed.log === undefined || parsed.log === resolutionLog) {
538
533
  return localIds.has(parsed.id) ? "resolved" : "dangling";
539
534
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adrkit/evaluator",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Deterministic, model-free ADR proposal evaluation and routing for adrkit.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -40,7 +40,7 @@
40
40
  "typecheck": "tsc --noEmit --customConditions bun --project ../../tsconfig.json"
41
41
  },
42
42
  "dependencies": {
43
- "@adrkit/core": "0.1.0",
43
+ "@adrkit/core": "0.2.1",
44
44
  "jsonpath-rfc9535": "1.3.0"
45
45
  },
46
46
  "devDependencies": {
@@ -9,23 +9,13 @@
9
9
  */
10
10
 
11
11
  import type { Adr } from '@adrkit/core';
12
+ import { parseAdrRef } from '@adrkit/core';
12
13
  import { aggregate, passResult, type SubResult } from './kernel.ts';
13
14
  import type { RuleContext } from './context.ts';
14
15
  import type { ReasonCode, RuleFinding, RuleResult } from '../types.ts';
15
16
 
16
17
  type RefField = 'supersedes' | 'relatesTo';
17
18
 
18
- interface Parsed {
19
- readonly log?: string;
20
- readonly id: string;
21
- }
22
-
23
- function parseRef(ref: string): Parsed {
24
- const idx = ref.indexOf(':');
25
- if (idx <= 0) return { id: ref };
26
- return { log: ref.slice(0, idx), id: ref.slice(idx + 1) };
27
- }
28
-
29
19
  export function evaluateNoOrphanRefs(ctx: RuleContext): RuleResult {
30
20
  const resolutionLog = ctx.input.resolutionLog;
31
21
 
@@ -50,7 +40,7 @@ export function evaluateNoOrphanRefs(ctx: RuleContext): RuleResult {
50
40
  const subs: SubResult[] = [];
51
41
 
52
42
  function classify(ref: string): 'resolved' | 'dangling' | 'federated-absent' {
53
- const parsed = parseRef(ref);
43
+ const parsed = parseAdrRef(ref);
54
44
  if (parsed.log === undefined || parsed.log === resolutionLog) {
55
45
  return localIds.has(parsed.id) ? 'resolved' : 'dangling';
56
46
  }