@fenglimg/fabric-server 2.3.0-rc.12 → 2.3.0-rc.15

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
@@ -7,7 +7,8 @@ Fabric MCP knowledge server. Runs over stdio transport and serves Claude Code an
7
7
  - `fab_recall` — single-step recall: returns candidate descriptions + native read paths (no body delivery over MCP; read a body on demand via a native Read of the returned path)
8
8
  - `fab_archive_scan` — scan recent work for archive-worthy knowledge candidates
9
9
  - `fab_propose` — persist a pending knowledge entry
10
- - `fab_review` — list / approve / reject / modify / defer pending entries
10
+ - `fab_pending` — read-only browse/search of pending + canonical knowledge (`list` / `search`)
11
+ - `fab_review` — write-only triage of pending knowledge (`approve` / `reject` / `modify` / `modify-content` / `modify-content-batch` / `modify-layer` / `defer` / `retire`)
11
12
 
12
13
  ## Install
13
14
 
package/dist/index.d.ts CHANGED
@@ -41,6 +41,114 @@ type BacklogAgeMetric = {
41
41
  declare function checkBacklogAge(projectRoot: string, nowMs?: number): Promise<BacklogAgeMetric>;
42
42
  declare function renderBacklogAgeLine(metric: BacklogAgeMetric): string;
43
43
 
44
+ /**
45
+ * doctor-types.ts — pure public report/check types for the doctor subsystem.
46
+ *
47
+ * Wave W1 extraction from doctor.ts (repo-hygiene-slim). No runtime logic —
48
+ * only type aliases. doctor.ts re-exports these for backward-compatible
49
+ * `import type { DoctorCheck } from "./doctor.js"` consumers.
50
+ */
51
+
52
+ type DoctorStatus = "ok" | "warn" | "error";
53
+ type DoctorIssueKind = "fixable_error" | "manual_error" | "warning" | "info";
54
+ type DoctorCheck = {
55
+ name: string;
56
+ status: DoctorStatus;
57
+ message: string;
58
+ kind?: DoctorIssueKind;
59
+ code?: string;
60
+ fixable?: boolean;
61
+ actionHint?: string;
62
+ audience?: "user" | "maintainer";
63
+ };
64
+ type DoctorIssue = {
65
+ code: string;
66
+ name: string;
67
+ message: string;
68
+ path?: string;
69
+ actionHint?: string;
70
+ audience?: "user" | "maintainer";
71
+ };
72
+ type DoctorPayloadLimits = {
73
+ warn_bytes: number;
74
+ hard_bytes: number;
75
+ source: "default" | "config";
76
+ };
77
+ type DoctorSummary = {
78
+ target: string;
79
+ framework: {
80
+ kind: string;
81
+ version: string;
82
+ subkind: string;
83
+ };
84
+ entryPoints: Array<{
85
+ path: string;
86
+ reason: string;
87
+ }>;
88
+ metaRevision: string | null;
89
+ computedMetaRevision: string | null;
90
+ ruleCount: number;
91
+ eventLedgerPath: string;
92
+ fixableErrorCount: number;
93
+ manualErrorCount: number;
94
+ warningCount: number;
95
+ infoCount: number;
96
+ targetFiles: Record<string, boolean>;
97
+ payload_limits: DoctorPayloadLimits;
98
+ health: DoctorHealth;
99
+ };
100
+ type DoctorReport = {
101
+ status: DoctorStatus;
102
+ checks: DoctorCheck[];
103
+ fixable_errors: DoctorIssue[];
104
+ manual_errors: DoctorIssue[];
105
+ warnings: DoctorIssue[];
106
+ infos: DoctorIssue[];
107
+ summary: DoctorSummary;
108
+ };
109
+ type DoctorFixReport = {
110
+ changed: boolean;
111
+ fixed: DoctorIssue[];
112
+ remaining_manual_errors: DoctorIssue[];
113
+ warnings: DoctorIssue[];
114
+ message: string;
115
+ report: DoctorReport;
116
+ };
117
+ type DoctorApplyLintMutationKind = "knowledge_session_hints_stale_cleanup" | "store_counter_floor";
118
+ type DoctorApplyLintMutation = {
119
+ kind: DoctorApplyLintMutationKind;
120
+ path: string;
121
+ detail: string;
122
+ applied: boolean;
123
+ error?: string;
124
+ };
125
+ type DoctorApplyLintReport = {
126
+ changed: boolean;
127
+ mutations: DoctorApplyLintMutation[];
128
+ warnings: DoctorIssue[];
129
+ manual_errors: DoctorIssue[];
130
+ aborted: boolean;
131
+ abort_reason?: string;
132
+ message: string;
133
+ report: DoctorReport;
134
+ };
135
+ type EnrichDescriptionsMode = "auto" | "preview" | "readonly" | "interactive";
136
+ type EnrichDescriptionsCandidate = {
137
+ path: string;
138
+ missing: Array<"intent_clues" | "tech_stack" | "impact" | "must_read_if">;
139
+ modified: boolean;
140
+ added_fields: Array<"intent_clues" | "tech_stack" | "impact" | "must_read_if">;
141
+ error?: string;
142
+ };
143
+ type EnrichDescriptionsReport = {
144
+ mode: EnrichDescriptionsMode;
145
+ dryRun: boolean;
146
+ scanned: number;
147
+ modified: number;
148
+ skipped: number;
149
+ candidates: EnrichDescriptionsCandidate[];
150
+ };
151
+
44
152
  declare function extractRuleDescription(source: string): RuleDescription | undefined;
45
153
 
46
154
  interface AlwaysActiveBody {
@@ -88,6 +196,7 @@ interface KnowledgeCensus {
88
196
  */
89
197
  declare function buildKnowledgeCensus(projectRoot: string): Promise<KnowledgeCensus>;
90
198
  declare function buildAlwaysActiveBodies(projectRoot: string): Promise<AlwaysActiveBody[]>;
199
+ declare function computeReadSetRevision(projectRoot: string): Promise<string>;
91
200
  interface StoreCanonicalEntry {
92
201
  stableId: string;
93
202
  qualifiedId: string;
@@ -177,6 +286,7 @@ type MetricsRow = {
177
286
  * dual-write allowlist below.
178
287
  */
179
288
  declare const METRIC_COUNTER_NAMES: {
289
+ readonly knowledge_body_read: "knowledge_body_read";
180
290
  readonly knowledge_consumed: "knowledge_consumed";
181
291
  readonly edit_intent_checked: "edit_intent_checked";
182
292
  readonly knowledge_context_planned: "knowledge_context_planned";
@@ -261,6 +371,7 @@ declare function runDoctorCiteCoverage(projectRoot: string, options: {
261
371
  until?: number;
262
372
  recallWindowMs?: number;
263
373
  }): Promise<CiteCoverageReport>;
374
+
264
375
  type ArchiveHistoryEntry = {
265
376
  session_id_short: string;
266
377
  last_attempted_at: string;
@@ -296,109 +407,10 @@ declare function runDoctorHistoryAll(projectRoot: string, options: {
296
407
  since: number;
297
408
  }): Promise<HistoryAllReport>;
298
409
 
299
- type DoctorStatus = "ok" | "warn" | "error";
300
- type DoctorIssueKind = "fixable_error" | "manual_error" | "warning" | "info";
301
- type DoctorCheck = {
302
- name: string;
303
- status: DoctorStatus;
304
- message: string;
305
- kind?: DoctorIssueKind;
306
- code?: string;
307
- fixable?: boolean;
308
- actionHint?: string;
309
- audience?: "user" | "maintainer";
310
- };
311
- type DoctorIssue = {
312
- code: string;
313
- name: string;
314
- message: string;
315
- path?: string;
316
- actionHint?: string;
317
- audience?: "user" | "maintainer";
318
- };
319
- type DoctorPayloadLimits = {
320
- warn_bytes: number;
321
- hard_bytes: number;
322
- source: "default" | "config";
323
- };
324
- type DoctorSummary = {
325
- target: string;
326
- framework: {
327
- kind: string;
328
- version: string;
329
- subkind: string;
330
- };
331
- entryPoints: Array<{
332
- path: string;
333
- reason: string;
334
- }>;
335
- metaRevision: string | null;
336
- computedMetaRevision: string | null;
337
- ruleCount: number;
338
- eventLedgerPath: string;
339
- fixableErrorCount: number;
340
- manualErrorCount: number;
341
- warningCount: number;
342
- infoCount: number;
343
- targetFiles: Record<string, boolean>;
344
- payload_limits: DoctorPayloadLimits;
345
- health: DoctorHealth;
346
- };
347
- type DoctorReport = {
348
- status: DoctorStatus;
349
- checks: DoctorCheck[];
350
- fixable_errors: DoctorIssue[];
351
- manual_errors: DoctorIssue[];
352
- warnings: DoctorIssue[];
353
- infos: DoctorIssue[];
354
- summary: DoctorSummary;
355
- };
356
- type DoctorFixReport = {
357
- changed: boolean;
358
- fixed: DoctorIssue[];
359
- remaining_manual_errors: DoctorIssue[];
360
- warnings: DoctorIssue[];
361
- message: string;
362
- report: DoctorReport;
363
- };
364
- type DoctorApplyLintMutationKind = "knowledge_orphan_demote_required" | "knowledge_stale_archive_required" | "knowledge_index_drift" | "knowledge_pending_auto_archive" | "knowledge_session_hints_stale_cleanup" | "knowledge_relevance_fields_missing";
365
- type DoctorApplyLintMutation = {
366
- kind: DoctorApplyLintMutationKind;
367
- path: string;
368
- detail: string;
369
- applied: boolean;
370
- error?: string;
371
- };
372
- type DoctorApplyLintReport = {
373
- changed: boolean;
374
- mutations: DoctorApplyLintMutation[];
375
- warnings: DoctorIssue[];
376
- manual_errors: DoctorIssue[];
377
- aborted: boolean;
378
- abort_reason?: string;
379
- message: string;
380
- report: DoctorReport;
381
- };
382
410
  declare function runDoctorReport(target: string): Promise<DoctorReport>;
383
411
  declare function runDoctorFix(target: string): Promise<DoctorFixReport>;
384
412
  declare function runDoctorApplyLint(target: string): Promise<DoctorApplyLintReport>;
385
413
 
386
- type EnrichDescriptionsMode = "auto" | "preview" | "readonly" | "interactive";
387
- type EnrichDescriptionsCandidate = {
388
- path: string;
389
- missing: Array<"intent_clues" | "tech_stack" | "impact" | "must_read_if">;
390
- modified: boolean;
391
- added_fields: Array<"intent_clues" | "tech_stack" | "impact" | "must_read_if">;
392
- error?: string;
393
- };
394
- type EnrichDescriptionsReport = {
395
- mode: EnrichDescriptionsMode;
396
- dryRun: boolean;
397
- scanned: number;
398
- modified: number;
399
- skipped: number;
400
- candidates: EnrichDescriptionsCandidate[];
401
- };
402
414
  declare function enrichDescriptions(projectRoot: string, opts?: {
403
415
  auto?: boolean;
404
416
  dryRun?: boolean;
@@ -1167,4 +1179,4 @@ interface ShutdownHandlerDeps {
1167
1179
  */
1168
1180
  declare function createShutdownHandler(deps: ShutdownHandlerDeps): () => void;
1169
1181
 
1170
- export { AGENTS_MD_RESOURCE_URI, type AlwaysActiveBody, type ArchiveHistoryEntry, type ArchiveHistoryReport, type BacklogAgeMetric, COLD_EVAL_RUBRIC, type CiteCoverageReport, type ColdEvalBatch, type ColdEvalCandidate, type ColdEvalVerdict, type ConflictEntry, type ConflictJudge, type ConflictLintReport, type ConflictPair, type ConflictVerdict, type ConsumptionEntry, type ConsumptionInspection, type ConsumptionLintConfig, DEFAULT_CONFLICT_SIMILARITY_THRESHOLD, type DoctorApplyLintMutation, type DoctorApplyLintMutationKind, type DoctorApplyLintReport, type DoctorFixReport, type DoctorIssue, type DoctorReport, EVENT_LEDGER_PATH, type EnrichDescriptionsCandidate, type EnrichDescriptionsMode, type EnrichDescriptionsReport, FABRIC_SERVER_INSTRUCTIONS, type HistoryAllReport, type HistoryDayRow, type InFlightTracker, type KnowledgeCensus, LEDGER_PATH, LEGACY_LEDGER_PATH, METRICS_LEDGER_PATH, METRIC_COUNTER_NAMES, type MetricCounterName, type MetricsRow, OPTIONAL_EMBED_PACKAGE, type PlanContextInput, type PlanContextResult, type PrecheckResult, RETIRED_TOKENS, type RecallInput, type RecallResult, type RelatedBrokenLink, type RelatedGraphInspection, type RelatedGraphNode, type RelatedHubEntry, type RequirementProfile, type RetiredReferenceHit, type RetiredReferenceInspection, type RetiredToken, type SelectionTokenState, type ShutdownHandlerDeps, type StoreCanonicalEntry, type StoreReachability, type SurfaceVerdict, type UnboundProjectViolation, type WhyNotSurfacedResult, aggregateConsumption, appendEventLedgerEvent, buildAlwaysActiveBodies, buildColdEvalBatch, buildKnowledgeCensus, buildRelatedGraph, bumpCounter, checkBacklogAge, clearPrecheckCache, collectStoreCanonicalEntries, contextCache, createFabricServer, createInFlightTracker, createShutdownHandler, defaultEmbedCacheDir, detectUnboundProject, drainCounters, enrichDescriptions, evaluateStoreDir, explainWhyNotSurfaced, extractKnowledge, findConflictCandidates, flushAndSyncEventLedger, flushMetrics, formatPreexistingRootMessage, getEventLedgerPath, getLedgerPath, getLegacyLedgerPath, getMetricsLedgerPath, inspectConsumption, inspectRelatedGraph, inspectRetiredReferences, isEmbedderResolvable, lintConflicts, loadConflictEntries, loadEmbedder, pairSimilarity, planContext, precheckStoreReachability, readEmbedConfig, readEventLedger, readFusion, readLedger, readMetrics, readSelectionToken, recall, rehydrateAgentsMetaAt, renderBacklogAgeLine, resolveLedgerPaths, reviewKnowledge, reviewPending, runDoctorApplyLint, runDoctorArchiveHistory, runDoctorCiteCoverage, runDoctorConflictLint, runDoctorFix, runDoctorHistoryAll, runDoctorReport, startMetricsFlush, startRotationTick, startStdioServer, stopMetricsFlush, stopRotationTick };
1182
+ export { AGENTS_MD_RESOURCE_URI, type AlwaysActiveBody, type ArchiveHistoryEntry, type ArchiveHistoryReport, type BacklogAgeMetric, COLD_EVAL_RUBRIC, type CiteCoverageReport, type ColdEvalBatch, type ColdEvalCandidate, type ColdEvalVerdict, type ConflictEntry, type ConflictJudge, type ConflictLintReport, type ConflictPair, type ConflictVerdict, type ConsumptionEntry, type ConsumptionInspection, type ConsumptionLintConfig, DEFAULT_CONFLICT_SIMILARITY_THRESHOLD, type DoctorApplyLintMutation, type DoctorApplyLintMutationKind, type DoctorApplyLintReport, type DoctorFixReport, type DoctorIssue, type DoctorReport, EVENT_LEDGER_PATH, type EnrichDescriptionsCandidate, type EnrichDescriptionsMode, type EnrichDescriptionsReport, FABRIC_SERVER_INSTRUCTIONS, type HistoryAllReport, type HistoryDayRow, type InFlightTracker, type KnowledgeCensus, LEDGER_PATH, LEGACY_LEDGER_PATH, METRICS_LEDGER_PATH, METRIC_COUNTER_NAMES, type MetricCounterName, type MetricsRow, OPTIONAL_EMBED_PACKAGE, type PlanContextInput, type PlanContextResult, type PrecheckResult, RETIRED_TOKENS, type RecallInput, type RecallResult, type RelatedBrokenLink, type RelatedGraphInspection, type RelatedGraphNode, type RelatedHubEntry, type RequirementProfile, type RetiredReferenceHit, type RetiredReferenceInspection, type RetiredToken, type SelectionTokenState, type ShutdownHandlerDeps, type StoreCanonicalEntry, type StoreReachability, type SurfaceVerdict, type UnboundProjectViolation, type WhyNotSurfacedResult, aggregateConsumption, appendEventLedgerEvent, buildAlwaysActiveBodies, buildColdEvalBatch, buildKnowledgeCensus, buildRelatedGraph, bumpCounter, checkBacklogAge, clearPrecheckCache, collectStoreCanonicalEntries, computeReadSetRevision, contextCache, createFabricServer, createInFlightTracker, createShutdownHandler, defaultEmbedCacheDir, detectUnboundProject, drainCounters, enrichDescriptions, evaluateStoreDir, explainWhyNotSurfaced, extractKnowledge, findConflictCandidates, flushAndSyncEventLedger, flushMetrics, formatPreexistingRootMessage, getEventLedgerPath, getLedgerPath, getLegacyLedgerPath, getMetricsLedgerPath, inspectConsumption, inspectRelatedGraph, inspectRetiredReferences, isEmbedderResolvable, lintConflicts, loadConflictEntries, loadEmbedder, pairSimilarity, planContext, precheckStoreReachability, readEmbedConfig, readEventLedger, readFusion, readLedger, readMetrics, readSelectionToken, recall, rehydrateAgentsMetaAt, renderBacklogAgeLine, resolveLedgerPaths, reviewKnowledge, reviewPending, runDoctorApplyLint, runDoctorArchiveHistory, runDoctorCiteCoverage, runDoctorConflictLint, runDoctorFix, runDoctorHistoryAll, runDoctorReport, startMetricsFlush, startRotationTick, startStdioServer, stopMetricsFlush, stopRotationTick };