@okf-harness/core 0.1.0
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 +14 -0
- package/dist/index.d.ts +539 -0
- package/dist/index.js +2717 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# @okf-harness/core
|
|
2
|
+
|
|
3
|
+
Core library for OKF Harness workspace parsing, config loading, manifest handling, path safety, linting, search, graph generation, and source registration.
|
|
4
|
+
|
|
5
|
+
OKF Harness is an independent open-source project built on [Andrej Karpathy's LLM Wiki](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f) pattern and Google's [Open Knowledge Format](https://cloud.google.com/blog/products/data-analytics/how-the-open-knowledge-format-can-improve-data-sharing) / [OKF specification](https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md).
|
|
6
|
+
|
|
7
|
+
Most users should install the CLI instead:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @okf-harness/cli
|
|
11
|
+
okfh doctor --json
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
For project overview, workflows, and security notes, see the [main repository README](https://github.com/pumblus/okf-harness#readme).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,539 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const CONFIG_INVALID: "CONFIG_INVALID";
|
|
4
|
+
declare const workspaceConfigSchema: z.ZodObject<{
|
|
5
|
+
version: z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<0.1>, z.ZodLiteral<"0.1">]>, z.ZodTransform<"0.1", 0.1 | "0.1">>;
|
|
6
|
+
workspace: z.ZodObject<{
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
created_at: z.ZodString;
|
|
9
|
+
platform: z.ZodLiteral<"macos">;
|
|
10
|
+
}, z.core.$strict>;
|
|
11
|
+
okf: z.ZodObject<{
|
|
12
|
+
bundle_root: z.ZodString;
|
|
13
|
+
profile: z.ZodString;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
agents: z.ZodObject<{
|
|
16
|
+
tier1: z.ZodObject<{
|
|
17
|
+
claude: z.ZodBoolean;
|
|
18
|
+
codex: z.ZodBoolean;
|
|
19
|
+
}, z.core.$strict>;
|
|
20
|
+
tier2: z.ZodObject<{
|
|
21
|
+
pi: z.ZodBoolean;
|
|
22
|
+
opencode: z.ZodBoolean;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
}, z.core.$strict>;
|
|
25
|
+
paths: z.ZodObject<{
|
|
26
|
+
raw_inbox: z.ZodString;
|
|
27
|
+
raw_sources: z.ZodString;
|
|
28
|
+
wiki_root: z.ZodString;
|
|
29
|
+
manifest: z.ZodString;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
safety: z.ZodObject<{
|
|
32
|
+
raw_sources_immutable: z.ZodBoolean;
|
|
33
|
+
require_git_checkpoint_before_agent_write: z.ZodBoolean;
|
|
34
|
+
max_files_changed_per_ingest: z.ZodNumber;
|
|
35
|
+
}, z.core.$strict>;
|
|
36
|
+
}, z.core.$strict>;
|
|
37
|
+
type WorkspaceConfig = z.infer<typeof workspaceConfigSchema>;
|
|
38
|
+
type ConfigIssue = {
|
|
39
|
+
code: typeof CONFIG_INVALID;
|
|
40
|
+
path: string;
|
|
41
|
+
message: string;
|
|
42
|
+
};
|
|
43
|
+
type WorkspaceConfigParseResult = {
|
|
44
|
+
ok: true;
|
|
45
|
+
config: WorkspaceConfig;
|
|
46
|
+
} | {
|
|
47
|
+
ok: false;
|
|
48
|
+
issues: ConfigIssue[];
|
|
49
|
+
};
|
|
50
|
+
declare class WorkspaceConfigError extends Error {
|
|
51
|
+
readonly issues: ConfigIssue[];
|
|
52
|
+
readonly code: "CONFIG_INVALID";
|
|
53
|
+
constructor(issues: ConfigIssue[]);
|
|
54
|
+
}
|
|
55
|
+
declare function parseWorkspaceConfig(source: string): WorkspaceConfigParseResult;
|
|
56
|
+
declare function readWorkspaceConfig(workspaceRoot: string): Promise<WorkspaceConfigParseResult>;
|
|
57
|
+
declare function loadWorkspaceConfig(workspaceRoot: string): Promise<WorkspaceConfig>;
|
|
58
|
+
|
|
59
|
+
declare const GRAPH_WRITE_FAILED: "GRAPH_WRITE_FAILED";
|
|
60
|
+
declare class GraphWorkspaceError extends Error {
|
|
61
|
+
readonly code: typeof GRAPH_WRITE_FAILED;
|
|
62
|
+
readonly details: Record<string, unknown>;
|
|
63
|
+
constructor(message: string, code: typeof GRAPH_WRITE_FAILED, details?: Record<string, unknown>);
|
|
64
|
+
}
|
|
65
|
+
type GraphNode = {
|
|
66
|
+
id: string;
|
|
67
|
+
path: string;
|
|
68
|
+
title: string;
|
|
69
|
+
type: string;
|
|
70
|
+
tags: string[];
|
|
71
|
+
};
|
|
72
|
+
type GraphEdge = {
|
|
73
|
+
from: string;
|
|
74
|
+
to: string;
|
|
75
|
+
kind: "link" | "citation";
|
|
76
|
+
};
|
|
77
|
+
type GraphIssue = {
|
|
78
|
+
code: string;
|
|
79
|
+
message: string;
|
|
80
|
+
path?: string;
|
|
81
|
+
};
|
|
82
|
+
type MissingGraphTarget = {
|
|
83
|
+
from: string;
|
|
84
|
+
target: string;
|
|
85
|
+
path: string;
|
|
86
|
+
};
|
|
87
|
+
type GraphBacklinksData = {
|
|
88
|
+
generatedAt: string;
|
|
89
|
+
workspaceRoot: string;
|
|
90
|
+
nodes: GraphNode[];
|
|
91
|
+
edges: GraphEdge[];
|
|
92
|
+
backlinks: Record<string, string[]>;
|
|
93
|
+
issues: GraphIssue[];
|
|
94
|
+
missingTargets: MissingGraphTarget[];
|
|
95
|
+
};
|
|
96
|
+
type BuildWorkspaceGraphOptions = {
|
|
97
|
+
workspaceRoot: string;
|
|
98
|
+
now?: Date;
|
|
99
|
+
};
|
|
100
|
+
type BuildWorkspaceGraphResult = {
|
|
101
|
+
workspaceRoot: string;
|
|
102
|
+
report: {
|
|
103
|
+
backlinksPath: string;
|
|
104
|
+
htmlPath: string;
|
|
105
|
+
};
|
|
106
|
+
stats: {
|
|
107
|
+
nodes: number;
|
|
108
|
+
conceptEdges: number;
|
|
109
|
+
evidenceEdges: number;
|
|
110
|
+
missingTargets: number;
|
|
111
|
+
};
|
|
112
|
+
issues: GraphIssue[];
|
|
113
|
+
missingTargets: MissingGraphTarget[];
|
|
114
|
+
};
|
|
115
|
+
declare function buildWorkspaceGraph(options: BuildWorkspaceGraphOptions): Promise<BuildWorkspaceGraphResult>;
|
|
116
|
+
|
|
117
|
+
type LintSeverity = "error" | "warning" | "info";
|
|
118
|
+
type LintIssue = {
|
|
119
|
+
code: string;
|
|
120
|
+
severity: LintSeverity;
|
|
121
|
+
message: string;
|
|
122
|
+
path?: string;
|
|
123
|
+
line?: number;
|
|
124
|
+
fixable?: boolean;
|
|
125
|
+
};
|
|
126
|
+
type LintResult = {
|
|
127
|
+
ok: boolean;
|
|
128
|
+
issues: LintIssue[];
|
|
129
|
+
};
|
|
130
|
+
declare const OKF_MISSING_FRONTMATTER: "OKF_MISSING_FRONTMATTER";
|
|
131
|
+
declare const OKF_INVALID_FRONTMATTER: "OKF_INVALID_FRONTMATTER";
|
|
132
|
+
declare const OKF_MISSING_TYPE: "OKF_MISSING_TYPE";
|
|
133
|
+
declare const RESERVED_FILE_HAS_CONCEPT_FRONTMATTER: "RESERVED_FILE_HAS_CONCEPT_FRONTMATTER";
|
|
134
|
+
declare const LOG_INVALID_DATE_HEADING: "LOG_INVALID_DATE_HEADING";
|
|
135
|
+
declare const SOURCE_HASH_DRIFT: "SOURCE_HASH_DRIFT";
|
|
136
|
+
declare const SOURCE_MISSING: "SOURCE_MISSING";
|
|
137
|
+
declare const REFERENCE_SOURCE_MISSING: "REFERENCE_SOURCE_MISSING";
|
|
138
|
+
declare const BROKEN_LINK: "BROKEN_LINK";
|
|
139
|
+
declare const MISSING_INDEX_ENTRY: "MISSING_INDEX_ENTRY";
|
|
140
|
+
declare const MISSING_CITATIONS_SECTION: "MISSING_CITATIONS_SECTION";
|
|
141
|
+
declare function lintWorkspace(workspaceRoot: string): Promise<LintResult>;
|
|
142
|
+
|
|
143
|
+
type MarkdownFrontmatter = {
|
|
144
|
+
ok: true;
|
|
145
|
+
hasFrontmatter: true;
|
|
146
|
+
data: Record<string, unknown>;
|
|
147
|
+
body: string;
|
|
148
|
+
raw: string;
|
|
149
|
+
} | {
|
|
150
|
+
ok: false;
|
|
151
|
+
hasFrontmatter: false;
|
|
152
|
+
error: "missing";
|
|
153
|
+
message: string;
|
|
154
|
+
} | {
|
|
155
|
+
ok: false;
|
|
156
|
+
hasFrontmatter: true;
|
|
157
|
+
error: "invalid";
|
|
158
|
+
message: string;
|
|
159
|
+
};
|
|
160
|
+
declare function parseMarkdownFrontmatter(markdown: string): MarkdownFrontmatter;
|
|
161
|
+
|
|
162
|
+
declare const RESERVED_OKF_FILENAMES: Set<string>;
|
|
163
|
+
declare const SCAN_FAILED: "SCAN_FAILED";
|
|
164
|
+
declare class ConceptScanError extends Error {
|
|
165
|
+
readonly details: Record<string, unknown>;
|
|
166
|
+
readonly code: "SCAN_FAILED";
|
|
167
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
168
|
+
}
|
|
169
|
+
type OkfMarkdownFile = {
|
|
170
|
+
absolutePath: string;
|
|
171
|
+
workspacePath: string;
|
|
172
|
+
bundlePath: string;
|
|
173
|
+
conceptId: string;
|
|
174
|
+
isReserved: boolean;
|
|
175
|
+
markdown: string;
|
|
176
|
+
frontmatter: MarkdownFrontmatter;
|
|
177
|
+
};
|
|
178
|
+
type OkfConcept = {
|
|
179
|
+
id: string;
|
|
180
|
+
absolutePath: string;
|
|
181
|
+
workspacePath: string;
|
|
182
|
+
bundlePath: string;
|
|
183
|
+
type: string;
|
|
184
|
+
title?: string;
|
|
185
|
+
description?: string;
|
|
186
|
+
tags: string[];
|
|
187
|
+
timestamp?: string;
|
|
188
|
+
frontmatter: Record<string, unknown>;
|
|
189
|
+
body: string;
|
|
190
|
+
};
|
|
191
|
+
type ConceptScanResult = {
|
|
192
|
+
workspaceRoot: string;
|
|
193
|
+
wikiRoot: string;
|
|
194
|
+
files: OkfMarkdownFile[];
|
|
195
|
+
concepts: OkfConcept[];
|
|
196
|
+
};
|
|
197
|
+
declare function scanConcepts(workspaceRoot: string, config: WorkspaceConfig): Promise<ConceptScanResult>;
|
|
198
|
+
declare function conceptIdFromPath(markdownPath: string): string;
|
|
199
|
+
declare function isReservedOkfFile(bundlePath: string): boolean;
|
|
200
|
+
|
|
201
|
+
type MarkdownLink = {
|
|
202
|
+
text: string;
|
|
203
|
+
target: string;
|
|
204
|
+
title?: string;
|
|
205
|
+
raw: string;
|
|
206
|
+
line: number;
|
|
207
|
+
};
|
|
208
|
+
declare function parseMarkdownLinks(markdown: string): MarkdownLink[];
|
|
209
|
+
declare function resolveOkfLinkTarget(target: string, fromBundlePath: string): string | undefined;
|
|
210
|
+
|
|
211
|
+
declare const PATH_OUTSIDE_WORKSPACE: "PATH_OUTSIDE_WORKSPACE";
|
|
212
|
+
declare class WorkspacePathError extends Error {
|
|
213
|
+
readonly workspaceRoot: string;
|
|
214
|
+
readonly input: string;
|
|
215
|
+
readonly code: "PATH_OUTSIDE_WORKSPACE";
|
|
216
|
+
constructor(message: string, workspaceRoot: string, input: string);
|
|
217
|
+
}
|
|
218
|
+
type WorkspacePathResolution = {
|
|
219
|
+
workspaceRoot: string;
|
|
220
|
+
absolutePath: string;
|
|
221
|
+
relativePath: string;
|
|
222
|
+
};
|
|
223
|
+
declare function toPosixPath(input: string): string;
|
|
224
|
+
declare function toPosixRelativePath(from: string, to: string): string;
|
|
225
|
+
declare function safeResolveWorkspacePath(workspaceRoot: string, input: string): Promise<WorkspacePathResolution>;
|
|
226
|
+
|
|
227
|
+
declare const MANIFEST_INVALID: "MANIFEST_INVALID";
|
|
228
|
+
declare const SOURCE_REGISTRATION_FAILED: "SOURCE_REGISTRATION_FAILED";
|
|
229
|
+
declare const SOURCE_INPUT_NOT_FOUND: "SOURCE_INPUT_NOT_FOUND";
|
|
230
|
+
declare const SOURCE_INPUT_UNSUPPORTED: "SOURCE_INPUT_UNSUPPORTED";
|
|
231
|
+
declare const SOURCE_NOT_REGISTERED: "SOURCE_NOT_REGISTERED";
|
|
232
|
+
type SourceKind = "file" | "url";
|
|
233
|
+
type SourceStatus = "registered";
|
|
234
|
+
type SourceManifestEntry = {
|
|
235
|
+
id: string;
|
|
236
|
+
kind: SourceKind;
|
|
237
|
+
original: string;
|
|
238
|
+
path: string;
|
|
239
|
+
sha256: string;
|
|
240
|
+
added_at: string;
|
|
241
|
+
status: SourceStatus;
|
|
242
|
+
mime?: string;
|
|
243
|
+
title?: string;
|
|
244
|
+
reference_concept?: string;
|
|
245
|
+
notes?: string;
|
|
246
|
+
};
|
|
247
|
+
type SourceManifestIssue = {
|
|
248
|
+
code: typeof MANIFEST_INVALID;
|
|
249
|
+
message: string;
|
|
250
|
+
path: string;
|
|
251
|
+
line: number;
|
|
252
|
+
};
|
|
253
|
+
type SourceManifestReadResult = {
|
|
254
|
+
entries: SourceManifestEntry[];
|
|
255
|
+
issues: SourceManifestIssue[];
|
|
256
|
+
};
|
|
257
|
+
type AddSourceOptions = {
|
|
258
|
+
workspaceRoot: string;
|
|
259
|
+
input: string;
|
|
260
|
+
dryRun?: boolean;
|
|
261
|
+
now?: Date;
|
|
262
|
+
};
|
|
263
|
+
type SourceAddResult = {
|
|
264
|
+
workspaceRoot: string;
|
|
265
|
+
input: string;
|
|
266
|
+
action: "registered" | "reused" | "planned";
|
|
267
|
+
dryRun: boolean;
|
|
268
|
+
source: SourceManifestEntry;
|
|
269
|
+
};
|
|
270
|
+
type ListSourcesOptions = {
|
|
271
|
+
workspaceRoot: string;
|
|
272
|
+
};
|
|
273
|
+
type ListSourcesResult = {
|
|
274
|
+
workspaceRoot: string;
|
|
275
|
+
sources: SourceManifestEntry[];
|
|
276
|
+
};
|
|
277
|
+
type CreateIngestPlanOptions = {
|
|
278
|
+
workspaceRoot: string;
|
|
279
|
+
source: string;
|
|
280
|
+
};
|
|
281
|
+
type IngestPlanCandidateConcept = {
|
|
282
|
+
id: string;
|
|
283
|
+
path: string;
|
|
284
|
+
type: string;
|
|
285
|
+
title?: string;
|
|
286
|
+
score: number;
|
|
287
|
+
reason: string;
|
|
288
|
+
};
|
|
289
|
+
type IngestPlanResult = {
|
|
290
|
+
workspaceRoot: string;
|
|
291
|
+
source: SourceManifestEntry;
|
|
292
|
+
recommendedReferencePath: string;
|
|
293
|
+
candidateConcepts: IngestPlanCandidateConcept[];
|
|
294
|
+
checklist: string[];
|
|
295
|
+
};
|
|
296
|
+
declare class SourceManagementError extends Error {
|
|
297
|
+
readonly code: string;
|
|
298
|
+
readonly workspaceRoot?: string | undefined;
|
|
299
|
+
constructor(message: string, code: string, workspaceRoot?: string | undefined);
|
|
300
|
+
}
|
|
301
|
+
declare function addSource(options: AddSourceOptions): Promise<SourceAddResult>;
|
|
302
|
+
declare function listSources(options: ListSourcesOptions): Promise<ListSourcesResult>;
|
|
303
|
+
declare function createIngestPlan(options: CreateIngestPlanOptions): Promise<IngestPlanResult>;
|
|
304
|
+
declare function readSourceManifest(workspaceRootInput: string, config?: WorkspaceConfig): Promise<SourceManifestReadResult>;
|
|
305
|
+
|
|
306
|
+
declare const INVALID_TARGET: "INVALID_TARGET";
|
|
307
|
+
declare const TARGET_NOT_FOUND: "TARGET_NOT_FOUND";
|
|
308
|
+
declare const AMBIGUOUS_SECTION: "AMBIGUOUS_SECTION";
|
|
309
|
+
declare const READ_LIMIT_EXCEEDED: "READ_LIMIT_EXCEEDED";
|
|
310
|
+
declare const NON_MARKDOWN_TARGET: "NON_MARKDOWN_TARGET";
|
|
311
|
+
declare const NON_UTF8_TARGET: "NON_UTF8_TARGET";
|
|
312
|
+
type ReadWorkspaceErrorCode = typeof INVALID_TARGET | typeof TARGET_NOT_FOUND | typeof AMBIGUOUS_SECTION | typeof READ_LIMIT_EXCEEDED | typeof NON_MARKDOWN_TARGET | typeof NON_UTF8_TARGET;
|
|
313
|
+
declare class ReadWorkspaceError extends Error {
|
|
314
|
+
readonly code: ReadWorkspaceErrorCode;
|
|
315
|
+
readonly details: Record<string, unknown>;
|
|
316
|
+
constructor(message: string, code: ReadWorkspaceErrorCode, details?: Record<string, unknown>);
|
|
317
|
+
}
|
|
318
|
+
type ReadWorkspaceOptions = {
|
|
319
|
+
workspaceRoot: string;
|
|
320
|
+
target: string;
|
|
321
|
+
section?: string | undefined;
|
|
322
|
+
sectionId?: string | undefined;
|
|
323
|
+
offset?: number | undefined;
|
|
324
|
+
limit?: number | undefined;
|
|
325
|
+
full?: boolean | undefined;
|
|
326
|
+
};
|
|
327
|
+
type ReadTarget = {
|
|
328
|
+
input: string;
|
|
329
|
+
conceptId: string;
|
|
330
|
+
path: string;
|
|
331
|
+
bundlePath: string;
|
|
332
|
+
reserved: boolean;
|
|
333
|
+
};
|
|
334
|
+
type ReadFrontmatter = {
|
|
335
|
+
ok: true;
|
|
336
|
+
data: Record<string, unknown>;
|
|
337
|
+
} | {
|
|
338
|
+
ok: false;
|
|
339
|
+
error: "missing" | "invalid";
|
|
340
|
+
message: string;
|
|
341
|
+
};
|
|
342
|
+
type ReadMetadata = {
|
|
343
|
+
title: string;
|
|
344
|
+
type: string;
|
|
345
|
+
tags: string[];
|
|
346
|
+
description?: string;
|
|
347
|
+
timestamp?: string;
|
|
348
|
+
};
|
|
349
|
+
type ReadSection = {
|
|
350
|
+
sectionId: string;
|
|
351
|
+
headingPath: string[];
|
|
352
|
+
heading: string;
|
|
353
|
+
level: number;
|
|
354
|
+
startOffset: number;
|
|
355
|
+
endOffset: number;
|
|
356
|
+
};
|
|
357
|
+
type ReadLink = {
|
|
358
|
+
text: string;
|
|
359
|
+
target: string;
|
|
360
|
+
conceptId?: string;
|
|
361
|
+
exists: boolean;
|
|
362
|
+
line: number;
|
|
363
|
+
};
|
|
364
|
+
type ReadCitation = {
|
|
365
|
+
kind: "reference";
|
|
366
|
+
target: string;
|
|
367
|
+
conceptId?: string;
|
|
368
|
+
exists: boolean;
|
|
369
|
+
line: number;
|
|
370
|
+
} | {
|
|
371
|
+
kind: "source";
|
|
372
|
+
sourceId: string;
|
|
373
|
+
exists: boolean;
|
|
374
|
+
source?: SourceManifestEntry;
|
|
375
|
+
line: number;
|
|
376
|
+
};
|
|
377
|
+
type CitationIssue = {
|
|
378
|
+
code: string;
|
|
379
|
+
message: string;
|
|
380
|
+
line?: number;
|
|
381
|
+
};
|
|
382
|
+
type ReadContent = {
|
|
383
|
+
mode: "preview" | "section" | "range" | "full";
|
|
384
|
+
text: string;
|
|
385
|
+
startOffset: number;
|
|
386
|
+
endOffset: number;
|
|
387
|
+
contentLength: number;
|
|
388
|
+
returnedChars: number;
|
|
389
|
+
truncated: boolean;
|
|
390
|
+
};
|
|
391
|
+
type ReadWorkspaceResult = {
|
|
392
|
+
workspaceRoot: string;
|
|
393
|
+
target: ReadTarget;
|
|
394
|
+
frontmatter: ReadFrontmatter;
|
|
395
|
+
metadata: ReadMetadata;
|
|
396
|
+
outline: ReadSection[];
|
|
397
|
+
availableSections: ReadSection[];
|
|
398
|
+
links: ReadLink[];
|
|
399
|
+
citations: ReadCitation[];
|
|
400
|
+
citationIssues: CitationIssue[];
|
|
401
|
+
content: ReadContent;
|
|
402
|
+
source?: SourceManifestEntry;
|
|
403
|
+
indexLinks?: Array<{
|
|
404
|
+
title: string;
|
|
405
|
+
target: string;
|
|
406
|
+
conceptId?: string;
|
|
407
|
+
exists: boolean;
|
|
408
|
+
}>;
|
|
409
|
+
logEntries?: Array<{
|
|
410
|
+
date: string;
|
|
411
|
+
line: number;
|
|
412
|
+
text: string;
|
|
413
|
+
}>;
|
|
414
|
+
warnings: Array<{
|
|
415
|
+
code: string;
|
|
416
|
+
message: string;
|
|
417
|
+
path?: string;
|
|
418
|
+
}>;
|
|
419
|
+
};
|
|
420
|
+
declare function readWorkspaceDocument(options: ReadWorkspaceOptions): Promise<ReadWorkspaceResult>;
|
|
421
|
+
|
|
422
|
+
type SearchFilter = {
|
|
423
|
+
type?: string;
|
|
424
|
+
tag?: string;
|
|
425
|
+
path?: string;
|
|
426
|
+
};
|
|
427
|
+
type SearchScoreBreakdown = {
|
|
428
|
+
field: string;
|
|
429
|
+
reason: string;
|
|
430
|
+
score: number;
|
|
431
|
+
};
|
|
432
|
+
type SearchResultCard = {
|
|
433
|
+
conceptId: string;
|
|
434
|
+
path: string;
|
|
435
|
+
title: string;
|
|
436
|
+
type: string;
|
|
437
|
+
tags: string[];
|
|
438
|
+
description?: string;
|
|
439
|
+
frontmatterOk: boolean;
|
|
440
|
+
indexMentioned: boolean;
|
|
441
|
+
score: number;
|
|
442
|
+
scoreBreakdown: SearchScoreBreakdown[];
|
|
443
|
+
matchedFields: string[];
|
|
444
|
+
bodyHitCount: number;
|
|
445
|
+
};
|
|
446
|
+
type SearchWarning = {
|
|
447
|
+
code: string;
|
|
448
|
+
message: string;
|
|
449
|
+
path?: string;
|
|
450
|
+
};
|
|
451
|
+
type SearchWorkspaceOptions = {
|
|
452
|
+
workspaceRoot: string;
|
|
453
|
+
query: string;
|
|
454
|
+
limit?: number | undefined;
|
|
455
|
+
};
|
|
456
|
+
type SearchWorkspaceResult = {
|
|
457
|
+
workspaceRoot: string;
|
|
458
|
+
query: string;
|
|
459
|
+
filtersApplied: SearchFilter;
|
|
460
|
+
limit: number;
|
|
461
|
+
totalMatches: number;
|
|
462
|
+
truncated: boolean;
|
|
463
|
+
results: SearchResultCard[];
|
|
464
|
+
warnings: SearchWarning[];
|
|
465
|
+
};
|
|
466
|
+
declare function searchWorkspace(options: SearchWorkspaceOptions): Promise<SearchWorkspaceResult>;
|
|
467
|
+
|
|
468
|
+
type WorkspaceWarning = {
|
|
469
|
+
code: string;
|
|
470
|
+
message: string;
|
|
471
|
+
};
|
|
472
|
+
type InitWorkspaceOptions = {
|
|
473
|
+
workspaceRoot: string;
|
|
474
|
+
name: string;
|
|
475
|
+
now?: Date;
|
|
476
|
+
dryRun?: boolean;
|
|
477
|
+
git?: boolean;
|
|
478
|
+
};
|
|
479
|
+
type InitWorkspaceResult = {
|
|
480
|
+
workspaceRoot: string;
|
|
481
|
+
name: string;
|
|
482
|
+
dryRun: boolean;
|
|
483
|
+
git: {
|
|
484
|
+
requested: boolean;
|
|
485
|
+
initialized: boolean;
|
|
486
|
+
};
|
|
487
|
+
files: string[];
|
|
488
|
+
directories: string[];
|
|
489
|
+
lint: LintResult;
|
|
490
|
+
warnings: WorkspaceWarning[];
|
|
491
|
+
};
|
|
492
|
+
type WorkspacePlanFile = {
|
|
493
|
+
path: string;
|
|
494
|
+
contents: string;
|
|
495
|
+
};
|
|
496
|
+
type WorkspacePlan = {
|
|
497
|
+
name: string;
|
|
498
|
+
createdAt: string;
|
|
499
|
+
directories: string[];
|
|
500
|
+
files: WorkspacePlanFile[];
|
|
501
|
+
warnings: WorkspaceWarning[];
|
|
502
|
+
};
|
|
503
|
+
type WorkspaceStatus = {
|
|
504
|
+
workspaceRoot: string;
|
|
505
|
+
initialized: boolean;
|
|
506
|
+
name?: string;
|
|
507
|
+
wikiFiles: number;
|
|
508
|
+
concepts: number;
|
|
509
|
+
lint: LintResult;
|
|
510
|
+
warnings: WorkspaceWarning[];
|
|
511
|
+
};
|
|
512
|
+
declare const WORKSPACE_NOT_FOUND: "WORKSPACE_NOT_FOUND";
|
|
513
|
+
declare class WorkspaceResolutionError extends Error {
|
|
514
|
+
readonly startDir: string;
|
|
515
|
+
readonly code: "WORKSPACE_NOT_FOUND";
|
|
516
|
+
constructor(message: string, startDir: string);
|
|
517
|
+
}
|
|
518
|
+
declare class WorkspaceInitError extends Error {
|
|
519
|
+
readonly code: string;
|
|
520
|
+
constructor(message: string, code: string);
|
|
521
|
+
}
|
|
522
|
+
declare function initWorkspace(options: InitWorkspaceOptions): Promise<InitWorkspaceResult>;
|
|
523
|
+
declare function readWorkspaceStatus(workspaceRootInput: string): Promise<WorkspaceStatus>;
|
|
524
|
+
declare function resolveWorkspaceRoot(options: {
|
|
525
|
+
workspaceRoot?: string | undefined;
|
|
526
|
+
startDir?: string | undefined;
|
|
527
|
+
}): Promise<string>;
|
|
528
|
+
declare function createWorkspacePlan(options: {
|
|
529
|
+
name: string;
|
|
530
|
+
now?: Date;
|
|
531
|
+
}): WorkspacePlan;
|
|
532
|
+
|
|
533
|
+
declare const packageInfo: {
|
|
534
|
+
readonly name: "@okf-harness/core";
|
|
535
|
+
readonly role: "core";
|
|
536
|
+
};
|
|
537
|
+
type PackageInfo = typeof packageInfo;
|
|
538
|
+
|
|
539
|
+
export { AMBIGUOUS_SECTION, type AddSourceOptions, BROKEN_LINK, type BuildWorkspaceGraphOptions, type BuildWorkspaceGraphResult, CONFIG_INVALID, type CitationIssue, ConceptScanError, type ConceptScanResult, type ConfigIssue, type CreateIngestPlanOptions, GRAPH_WRITE_FAILED, type GraphBacklinksData, type GraphEdge, type GraphIssue, type GraphNode, GraphWorkspaceError, INVALID_TARGET, type IngestPlanCandidateConcept, type IngestPlanResult, type InitWorkspaceOptions, type InitWorkspaceResult, LOG_INVALID_DATE_HEADING, type LintIssue, type LintResult, type LintSeverity, type ListSourcesOptions, type ListSourcesResult, MANIFEST_INVALID, MISSING_CITATIONS_SECTION, MISSING_INDEX_ENTRY, type MarkdownFrontmatter, type MarkdownLink, type MissingGraphTarget, NON_MARKDOWN_TARGET, NON_UTF8_TARGET, OKF_INVALID_FRONTMATTER, OKF_MISSING_FRONTMATTER, OKF_MISSING_TYPE, type OkfConcept, type OkfMarkdownFile, PATH_OUTSIDE_WORKSPACE, type PackageInfo, READ_LIMIT_EXCEEDED, REFERENCE_SOURCE_MISSING, RESERVED_FILE_HAS_CONCEPT_FRONTMATTER, RESERVED_OKF_FILENAMES, type ReadCitation, type ReadContent, type ReadFrontmatter, type ReadLink, type ReadMetadata, type ReadSection, type ReadTarget, ReadWorkspaceError, type ReadWorkspaceErrorCode, type ReadWorkspaceOptions, type ReadWorkspaceResult, SCAN_FAILED, SOURCE_HASH_DRIFT, SOURCE_INPUT_NOT_FOUND, SOURCE_INPUT_UNSUPPORTED, SOURCE_MISSING, SOURCE_NOT_REGISTERED, SOURCE_REGISTRATION_FAILED, type SearchFilter, type SearchResultCard, type SearchScoreBreakdown, type SearchWarning, type SearchWorkspaceOptions, type SearchWorkspaceResult, type SourceAddResult, type SourceKind, SourceManagementError, type SourceManifestEntry, type SourceManifestIssue, type SourceManifestReadResult, type SourceStatus, TARGET_NOT_FOUND, WORKSPACE_NOT_FOUND, type WorkspaceConfig, WorkspaceConfigError, type WorkspaceConfigParseResult, WorkspaceInitError, WorkspacePathError, type WorkspacePathResolution, type WorkspacePlan, type WorkspacePlanFile, WorkspaceResolutionError, type WorkspaceStatus, type WorkspaceWarning, addSource, buildWorkspaceGraph, conceptIdFromPath, createIngestPlan, createWorkspacePlan, initWorkspace, isReservedOkfFile, lintWorkspace, listSources, loadWorkspaceConfig, packageInfo, parseMarkdownFrontmatter, parseMarkdownLinks, parseWorkspaceConfig, readSourceManifest, readWorkspaceConfig, readWorkspaceDocument, readWorkspaceStatus, resolveOkfLinkTarget, resolveWorkspaceRoot, safeResolveWorkspacePath, scanConcepts, searchWorkspace, toPosixPath, toPosixRelativePath, workspaceConfigSchema };
|