@okfit/engine 0.9.4 → 0.11.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/errors.js +56 -6
- package/index.d.ts +409 -18
- package/index.js +6 -3
- package/package.json +18 -18
- package/query/ConceptQuery.js +102 -0
- package/render/query.js +104 -0
- package/render/verify.js +12 -1
- package/verify/run.js +127 -56
- package/verify/select.js +86 -0
- package/verify/splice.js +25 -1
- package/version.js +1 -1
package/errors.js
CHANGED
|
@@ -60,7 +60,8 @@ var VerifyConceptNotFoundError = class extends Schema.TaggedError()("VerifyConce
|
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
/**
|
|
63
|
-
* V-14: fail closed on a `verified`
|
|
63
|
+
* V-14: fail closed on a `verified` (or, under `--stable`/`--draft`, `status`)
|
|
64
|
+
* shape the classifier does not name; `key` says which, omitted meaning `verified`.
|
|
64
65
|
* `shape` is one of `"alias"`, `"merge-key"`, `"scalar"`, `"empty"` (and,
|
|
65
66
|
* defensively, `"no-frontmatter"` or `"not-a-mapping"`, neither reachable
|
|
66
67
|
* for a concept that reached `bundle.concepts`). The file is never opened
|
|
@@ -70,11 +71,12 @@ var VerifyConceptNotFoundError = class extends Schema.TaggedError()("VerifyConce
|
|
|
70
71
|
*/
|
|
71
72
|
var VerifyUnsupportedFrontmatterError = class extends Schema.TaggedError()("VerifyUnsupportedFrontmatterError", {
|
|
72
73
|
id: Schema.String,
|
|
73
|
-
shape: Schema.String
|
|
74
|
+
shape: Schema.String,
|
|
75
|
+
key: Schema.optionalKey(Schema.Literals(["verified", "status"]))
|
|
74
76
|
}) {
|
|
75
77
|
[Runtime.errorExitCode] = 3;
|
|
76
78
|
get message() {
|
|
77
|
-
return `"${this.id}"'s verified value is a shape okfit verify cannot edit (${this.shape}); edit it by hand`;
|
|
79
|
+
return `"${this.id}"'s ${this.key ?? "verified"} value is a shape okfit verify cannot edit (${this.shape}); edit it by hand`;
|
|
78
80
|
}
|
|
79
81
|
};
|
|
80
82
|
/** The error's `message` when it has one as a string, else `String(error)`. */
|
|
@@ -127,14 +129,18 @@ var VerifySelectionError = class extends Schema.TaggedError()("VerifySelectionEr
|
|
|
127
129
|
reason: Schema.Literals([
|
|
128
130
|
"no-selection",
|
|
129
131
|
"id-and-batch",
|
|
130
|
-
"unknown-type"
|
|
132
|
+
"unknown-type",
|
|
133
|
+
"status-conflict",
|
|
134
|
+
"status-and-batch"
|
|
131
135
|
]),
|
|
132
136
|
detail: Schema.optionalKey(Schema.String)
|
|
133
137
|
}) {
|
|
134
138
|
[Runtime.errorExitCode] = 64;
|
|
135
139
|
get message() {
|
|
136
|
-
if (this.reason === "no-selection") return "verify needs a concept id, --all, or --type <Type>";
|
|
140
|
+
if (this.reason === "no-selection") return "verify needs a concept id, --all, or --type <Type> (run in a terminal to pick interactively)";
|
|
137
141
|
if (this.reason === "id-and-batch") return "verify takes either a concept id or --all/--type, not both";
|
|
142
|
+
if (this.reason === "status-conflict") return "verify takes --stable or --draft, not both";
|
|
143
|
+
if (this.reason === "status-and-batch") return "--stable and --draft need a concept id; batch mode never changes status";
|
|
138
144
|
return `type "${this.detail ?? ""}" is not declared in the config`;
|
|
139
145
|
}
|
|
140
146
|
};
|
|
@@ -170,6 +176,50 @@ var DocumentPathError = class extends Schema.TaggedError()("DocumentPathError",
|
|
|
170
176
|
return `document path "${this.path}" ${DOCUMENT_PATH_REASON_TEXT[this.reason]}`;
|
|
171
177
|
}
|
|
172
178
|
};
|
|
179
|
+
/**
|
|
180
|
+
* `okfit query list` named a type or tag the config does not declare. `valid`
|
|
181
|
+
* is the sorted declared names. Exit 64: a usage error.
|
|
182
|
+
*
|
|
183
|
+
* @public
|
|
184
|
+
*/
|
|
185
|
+
var QueryUnknownVocabularyError = class extends Schema.TaggedError()("QueryUnknownVocabularyError", {
|
|
186
|
+
kind: Schema.Literals(["type", "tag"]),
|
|
187
|
+
requested: Schema.String,
|
|
188
|
+
valid: Schema.Array(Schema.String)
|
|
189
|
+
}) {
|
|
190
|
+
[Runtime.errorExitCode] = 64;
|
|
191
|
+
get message() {
|
|
192
|
+
return `${this.kind} "${this.requested}" is not declared in the config; declared: ${this.valid.join(", ")}`;
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* A query's concept id named no concept: empty after normalisation
|
|
197
|
+
* (`empty-id`) or absent from the bundle (`not-a-concept`). Exit 3.
|
|
198
|
+
*
|
|
199
|
+
* @public
|
|
200
|
+
*/
|
|
201
|
+
var QueryConceptNotFoundError = class extends Schema.TaggedError()("QueryConceptNotFoundError", {
|
|
202
|
+
id: Schema.String,
|
|
203
|
+
reason: Schema.Literals(["empty-id", "not-a-concept"])
|
|
204
|
+
}) {
|
|
205
|
+
[Runtime.errorExitCode] = 3;
|
|
206
|
+
get message() {
|
|
207
|
+
if (this.reason === "empty-id") return "a concept id must not be empty";
|
|
208
|
+
return `no concept "${this.id}" in this bundle`;
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* `okfit query list` was given contradictory selection flags. Exit 64: a
|
|
213
|
+
* usage error.
|
|
214
|
+
*
|
|
215
|
+
* @public
|
|
216
|
+
*/
|
|
217
|
+
var QuerySelectionError = class extends Schema.TaggedError()("QuerySelectionError", { reason: Schema.Literals(["verified-conflict"]) }) {
|
|
218
|
+
[Runtime.errorExitCode] = 64;
|
|
219
|
+
get message() {
|
|
220
|
+
return "query list takes --verified or --unverified, not both";
|
|
221
|
+
}
|
|
222
|
+
};
|
|
173
223
|
|
|
174
224
|
//#endregion
|
|
175
|
-
export { ConfigMalformedError, ConfigPathNotFoundError, DocumentPathError, InitOverwriteError, SyncStagedLogError, VerifyConceptNotFoundError, VerifySelectionError, VerifyUnsupportedFrontmatterError };
|
|
225
|
+
export { ConfigMalformedError, ConfigPathNotFoundError, DocumentPathError, InitOverwriteError, QueryConceptNotFoundError, QuerySelectionError, QueryUnknownVocabularyError, SyncStagedLogError, VerifyConceptNotFoundError, VerifySelectionError, VerifyUnsupportedFrontmatterError };
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Actor, BundleLoadError, ConceptId, Diagnostic, DiagnosticRange, DiagnosticSeverity, GraphLink, GraphNode, LinkGraph, LoadedBundle, LoadedConcept, OkfitConfig, OkfitConfigFile, StaleConcept, Status, ValidationReport } from "@okfit/core";
|
|
1
|
+
import { Actor, BundleLoadError, ConceptId, Diagnostic, DiagnosticRange, DiagnosticSeverity, GraphLink, GraphNode, GraphNodeKind, LinkGraph, LoadedBundle, LoadedConcept, OkfitConfig, OkfitConfigFile, StaleConcept, Status, ValidationReport } from "@okfit/core";
|
|
2
2
|
import { Context, Crypto, DateTime, Effect, FileSystem, Layer, Option, Path, PlatformError, Result, Runtime, Schema } from "effect";
|
|
3
3
|
import { AppDirs, Xdg } from "@effected/xdg";
|
|
4
4
|
import { ConfigReadError } from "@effected/config-file";
|
|
@@ -126,9 +126,11 @@ export declare class VerifyConceptNotFoundError extends VerifyConceptNotFoundErr
|
|
|
126
126
|
declare const VerifyUnsupportedFrontmatterError_base: Schema.Class<VerifyUnsupportedFrontmatterError, Schema.TaggedStruct<"VerifyUnsupportedFrontmatterError", {
|
|
127
127
|
readonly id: Schema.String;
|
|
128
128
|
readonly shape: Schema.String;
|
|
129
|
+
readonly key: Schema.optionalKey<Schema.Literals<readonly ["verified", "status"]>>;
|
|
129
130
|
}>, import("effect/Cause").YieldableError>;
|
|
130
131
|
/**
|
|
131
|
-
* V-14: fail closed on a `verified`
|
|
132
|
+
* V-14: fail closed on a `verified` (or, under `--stable`/`--draft`, `status`)
|
|
133
|
+
* shape the classifier does not name; `key` says which, omitted meaning `verified`.
|
|
132
134
|
* `shape` is one of `"alias"`, `"merge-key"`, `"scalar"`, `"empty"` (and,
|
|
133
135
|
* defensively, `"no-frontmatter"` or `"not-a-mapping"`, neither reachable
|
|
134
136
|
* for a concept that reached `bundle.concepts`). The file is never opened
|
|
@@ -172,7 +174,7 @@ export declare class SyncStagedLogError extends SyncStagedLogError_base {
|
|
|
172
174
|
get message(): string;
|
|
173
175
|
}
|
|
174
176
|
declare const VerifySelectionError_base: Schema.Class<VerifySelectionError, Schema.TaggedStruct<"VerifySelectionError", {
|
|
175
|
-
readonly reason: Schema.Literals<readonly ["no-selection", "id-and-batch", "unknown-type"]>;
|
|
177
|
+
readonly reason: Schema.Literals<readonly ["no-selection", "id-and-batch", "unknown-type", "status-conflict", "status-and-batch"]>;
|
|
176
178
|
readonly detail: Schema.optionalKey<Schema.String>;
|
|
177
179
|
}>, import("effect/Cause").YieldableError>;
|
|
178
180
|
/**
|
|
@@ -202,6 +204,48 @@ export declare class DocumentPathError extends DocumentPathError_base {
|
|
|
202
204
|
readonly [Runtime.errorExitCode] = 64;
|
|
203
205
|
get message(): string;
|
|
204
206
|
}
|
|
207
|
+
declare const QueryUnknownVocabularyError_base: Schema.Class<QueryUnknownVocabularyError, Schema.TaggedStruct<"QueryUnknownVocabularyError", {
|
|
208
|
+
readonly kind: Schema.Literals<readonly ["type", "tag"]>;
|
|
209
|
+
readonly requested: Schema.String;
|
|
210
|
+
readonly valid: Schema.$Array<Schema.String>;
|
|
211
|
+
}>, import("effect/Cause").YieldableError>;
|
|
212
|
+
/**
|
|
213
|
+
* `okfit query list` named a type or tag the config does not declare. `valid`
|
|
214
|
+
* is the sorted declared names. Exit 64: a usage error.
|
|
215
|
+
*
|
|
216
|
+
* @public
|
|
217
|
+
*/
|
|
218
|
+
export declare class QueryUnknownVocabularyError extends QueryUnknownVocabularyError_base {
|
|
219
|
+
readonly [Runtime.errorExitCode] = 64;
|
|
220
|
+
get message(): string;
|
|
221
|
+
}
|
|
222
|
+
declare const QueryConceptNotFoundError_base: Schema.Class<QueryConceptNotFoundError, Schema.TaggedStruct<"QueryConceptNotFoundError", {
|
|
223
|
+
readonly id: Schema.String;
|
|
224
|
+
readonly reason: Schema.Literals<readonly ["empty-id", "not-a-concept"]>;
|
|
225
|
+
}>, import("effect/Cause").YieldableError>;
|
|
226
|
+
/**
|
|
227
|
+
* A query's concept id named no concept: empty after normalisation
|
|
228
|
+
* (`empty-id`) or absent from the bundle (`not-a-concept`). Exit 3.
|
|
229
|
+
*
|
|
230
|
+
* @public
|
|
231
|
+
*/
|
|
232
|
+
export declare class QueryConceptNotFoundError extends QueryConceptNotFoundError_base {
|
|
233
|
+
readonly [Runtime.errorExitCode] = 3;
|
|
234
|
+
get message(): string;
|
|
235
|
+
}
|
|
236
|
+
declare const QuerySelectionError_base: Schema.Class<QuerySelectionError, Schema.TaggedStruct<"QuerySelectionError", {
|
|
237
|
+
readonly reason: Schema.Literals<readonly ["verified-conflict"]>;
|
|
238
|
+
}>, import("effect/Cause").YieldableError>;
|
|
239
|
+
/**
|
|
240
|
+
* `okfit query list` was given contradictory selection flags. Exit 64: a
|
|
241
|
+
* usage error.
|
|
242
|
+
*
|
|
243
|
+
* @public
|
|
244
|
+
*/
|
|
245
|
+
export declare class QuerySelectionError extends QuerySelectionError_base {
|
|
246
|
+
readonly [Runtime.errorExitCode] = 64;
|
|
247
|
+
get message(): string;
|
|
248
|
+
}
|
|
205
249
|
//#endregion
|
|
206
250
|
//#region src/config/layer.d.ts
|
|
207
251
|
/**
|
|
@@ -652,6 +696,58 @@ export declare const layerOverlayFileSystem: Layer.Layer<FileSystem.FileSystem,
|
|
|
652
696
|
*/
|
|
653
697
|
export declare const OkfitPlatform: Layer.Layer<AppDirs | Xdg | NodeServices.NodeServices, import("@effected/xdg").XdgEnvError, never>;
|
|
654
698
|
//#endregion
|
|
699
|
+
//#region src/query/ConceptQuery.d.ts
|
|
700
|
+
/**
|
|
701
|
+
* Filter for {@link ConceptQuery.list}. Every field is optional; an absent
|
|
702
|
+
* field does not constrain.
|
|
703
|
+
*
|
|
704
|
+
* @public
|
|
705
|
+
*/
|
|
706
|
+
interface ConceptFilter {
|
|
707
|
+
/** OR across types. */
|
|
708
|
+
readonly types?: ReadonlyArray<string>;
|
|
709
|
+
/** AND: every tag must be present. */
|
|
710
|
+
readonly tags?: ReadonlyArray<string>;
|
|
711
|
+
/** OR, compared against `Derive.status` (an absent status reads as stable). */
|
|
712
|
+
readonly statuses?: ReadonlyArray<Status>;
|
|
713
|
+
/** `true`: at least one verified entry; `false`: none. */
|
|
714
|
+
readonly verified?: boolean;
|
|
715
|
+
}
|
|
716
|
+
/** One outgoing link of a concept. @public */
|
|
717
|
+
interface ConceptLink {
|
|
718
|
+
readonly to: string;
|
|
719
|
+
readonly kind: GraphNodeKind;
|
|
720
|
+
readonly source: "body" | "frontmatter";
|
|
721
|
+
readonly field?: string;
|
|
722
|
+
}
|
|
723
|
+
/** One graph neighbour; `concept` is `null` for a non-concept node (J-4). @public */
|
|
724
|
+
interface ConceptNeighbor {
|
|
725
|
+
readonly id: string;
|
|
726
|
+
readonly kind: GraphNodeKind;
|
|
727
|
+
readonly concept: LoadedConcept | null;
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Read-only queries over a loaded bundle, shared by `okfit query` and the MCP
|
|
731
|
+
* tools.
|
|
732
|
+
*
|
|
733
|
+
* @public
|
|
734
|
+
*/
|
|
735
|
+
export declare const ConceptQuery: {
|
|
736
|
+
/** Validates types then tags against config (first unknown fails), then filters and sorts by id. */
|
|
737
|
+
readonly list: (bundle: LoadedBundle, config: OkfitConfig, filter: ConceptFilter) => Effect.Effect<ReadonlyArray<LoadedConcept>, QueryUnknownVocabularyError>;
|
|
738
|
+
/** One concept by tolerant id, with its outgoing links. */
|
|
739
|
+
readonly get: (bundle: LoadedBundle, id: string) => Effect.Effect<{
|
|
740
|
+
readonly concept: LoadedConcept;
|
|
741
|
+
readonly links: ReadonlyArray<ConceptLink>;
|
|
742
|
+
}, QueryConceptNotFoundError>;
|
|
743
|
+
/** Outgoing and incoming graph neighbours of one concept. */
|
|
744
|
+
readonly neighbors: (bundle: LoadedBundle, id: string) => Effect.Effect<{
|
|
745
|
+
readonly id: string;
|
|
746
|
+
readonly outgoing: ReadonlyArray<ConceptNeighbor>;
|
|
747
|
+
readonly incoming: ReadonlyArray<ConceptNeighbor>;
|
|
748
|
+
}, QueryConceptNotFoundError>;
|
|
749
|
+
};
|
|
750
|
+
//#endregion
|
|
655
751
|
//#region src/render/context.d.ts
|
|
656
752
|
/** One enumerated value of a `fields[]` entry. @public */
|
|
657
753
|
export declare const ContextFieldValue: Schema.Struct<{
|
|
@@ -1088,6 +1184,159 @@ export declare const json: (input: {
|
|
|
1088
1184
|
/** K-22. `tag` is the error's `_tag` when it has one, else its constructor name. @public */
|
|
1089
1185
|
export declare const jsonError: (error: unknown, okfitVersion: string, distribution?: Distribution) => JsonErrorEnvelope;
|
|
1090
1186
|
//#endregion
|
|
1187
|
+
//#region src/render/query.d.ts
|
|
1188
|
+
/** The seven-field shape every list-like query result carries (N-16). @public */
|
|
1189
|
+
export declare const ConceptSummary: Schema.Struct<{
|
|
1190
|
+
readonly id: Schema.String;
|
|
1191
|
+
readonly type: Schema.String;
|
|
1192
|
+
readonly title: Schema.String;
|
|
1193
|
+
readonly description: Schema.NullOr<Schema.String>;
|
|
1194
|
+
readonly status: Schema.Literals<readonly ["draft", "stable", "deprecated"]>;
|
|
1195
|
+
readonly tags: Schema.$Array<Schema.String>;
|
|
1196
|
+
readonly path: Schema.String;
|
|
1197
|
+
}>;
|
|
1198
|
+
/** @public */
|
|
1199
|
+
export type ConceptSummary = typeof ConceptSummary.Type;
|
|
1200
|
+
/** Project one loaded concept into its summary. @public */
|
|
1201
|
+
export declare const toConceptSummary: (concept: LoadedConcept) => ConceptSummary;
|
|
1202
|
+
/** `okfit query list --format json`'s envelope, schema 1, snake_case. @public */
|
|
1203
|
+
export declare const QueryListEnvelope: Schema.Struct<{
|
|
1204
|
+
readonly schema: Schema.Literal<1>;
|
|
1205
|
+
readonly okfit_version: Schema.String;
|
|
1206
|
+
readonly engine_version: Schema.String;
|
|
1207
|
+
readonly distribution: Schema.NullOr<Schema.Struct<{
|
|
1208
|
+
readonly name: Schema.String;
|
|
1209
|
+
readonly version: Schema.String;
|
|
1210
|
+
}>>;
|
|
1211
|
+
readonly total: Schema.Int;
|
|
1212
|
+
readonly items: Schema.$Array<Schema.Struct<{
|
|
1213
|
+
readonly id: Schema.String;
|
|
1214
|
+
readonly type: Schema.String;
|
|
1215
|
+
readonly title: Schema.String;
|
|
1216
|
+
readonly description: Schema.NullOr<Schema.String>;
|
|
1217
|
+
readonly status: Schema.Literals<readonly ["draft", "stable", "deprecated"]>;
|
|
1218
|
+
readonly tags: Schema.$Array<Schema.String>;
|
|
1219
|
+
readonly path: Schema.String;
|
|
1220
|
+
}>>;
|
|
1221
|
+
}>;
|
|
1222
|
+
/** @public */
|
|
1223
|
+
export type QueryListEnvelope = typeof QueryListEnvelope.Type;
|
|
1224
|
+
/** One outgoing link of a concept, as `okfit query get` reports it. @public */
|
|
1225
|
+
export declare const QueryLink: Schema.Struct<{
|
|
1226
|
+
readonly to: Schema.String;
|
|
1227
|
+
readonly kind: Schema.Literals<readonly ["concept", "file", "missing"]>;
|
|
1228
|
+
readonly source: Schema.Literals<readonly ["body", "frontmatter"]>;
|
|
1229
|
+
readonly field: Schema.optionalKey<Schema.String>;
|
|
1230
|
+
}>;
|
|
1231
|
+
/** @public */
|
|
1232
|
+
export type QueryLink = typeof QueryLink.Type;
|
|
1233
|
+
/** `okfit query get --format json`'s envelope, schema 1, snake_case. @public */
|
|
1234
|
+
export declare const QueryGetEnvelope: Schema.Struct<{
|
|
1235
|
+
readonly schema: Schema.Literal<1>;
|
|
1236
|
+
readonly okfit_version: Schema.String;
|
|
1237
|
+
readonly engine_version: Schema.String;
|
|
1238
|
+
readonly distribution: Schema.NullOr<Schema.Struct<{
|
|
1239
|
+
readonly name: Schema.String;
|
|
1240
|
+
readonly version: Schema.String;
|
|
1241
|
+
}>>;
|
|
1242
|
+
readonly concept: Schema.Struct<{
|
|
1243
|
+
readonly id: Schema.String;
|
|
1244
|
+
readonly type: Schema.String;
|
|
1245
|
+
readonly title: Schema.String;
|
|
1246
|
+
readonly description: Schema.NullOr<Schema.String>;
|
|
1247
|
+
readonly status: Schema.Literals<readonly ["draft", "stable", "deprecated"]>;
|
|
1248
|
+
readonly tags: Schema.$Array<Schema.String>;
|
|
1249
|
+
readonly path: Schema.String;
|
|
1250
|
+
readonly frontmatter: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
1251
|
+
readonly links: Schema.$Array<Schema.Struct<{
|
|
1252
|
+
readonly to: Schema.String;
|
|
1253
|
+
readonly kind: Schema.Literals<readonly ["concept", "file", "missing"]>;
|
|
1254
|
+
readonly source: Schema.Literals<readonly ["body", "frontmatter"]>;
|
|
1255
|
+
readonly field: Schema.optionalKey<Schema.String>;
|
|
1256
|
+
}>>;
|
|
1257
|
+
}>;
|
|
1258
|
+
}>;
|
|
1259
|
+
/** @public */
|
|
1260
|
+
export type QueryGetEnvelope = typeof QueryGetEnvelope.Type;
|
|
1261
|
+
/** One neighbour of a concept; `summary` is `null` for a non-concept node. @public */
|
|
1262
|
+
export declare const QueryNeighbor: Schema.Struct<{
|
|
1263
|
+
readonly id: Schema.String;
|
|
1264
|
+
readonly kind: Schema.Literals<readonly ["concept", "file", "missing"]>;
|
|
1265
|
+
readonly summary: Schema.NullOr<Schema.Struct<{
|
|
1266
|
+
readonly id: Schema.String;
|
|
1267
|
+
readonly type: Schema.String;
|
|
1268
|
+
readonly title: Schema.String;
|
|
1269
|
+
readonly description: Schema.NullOr<Schema.String>;
|
|
1270
|
+
readonly status: Schema.Literals<readonly ["draft", "stable", "deprecated"]>;
|
|
1271
|
+
readonly tags: Schema.$Array<Schema.String>;
|
|
1272
|
+
readonly path: Schema.String;
|
|
1273
|
+
}>>;
|
|
1274
|
+
}>;
|
|
1275
|
+
/** @public */
|
|
1276
|
+
export type QueryNeighbor = typeof QueryNeighbor.Type;
|
|
1277
|
+
/** `okfit query neighbors --format json`'s envelope, schema 1, snake_case. @public */
|
|
1278
|
+
export declare const QueryNeighborsEnvelope: Schema.Struct<{
|
|
1279
|
+
readonly schema: Schema.Literal<1>;
|
|
1280
|
+
readonly okfit_version: Schema.String;
|
|
1281
|
+
readonly engine_version: Schema.String;
|
|
1282
|
+
readonly distribution: Schema.NullOr<Schema.Struct<{
|
|
1283
|
+
readonly name: Schema.String;
|
|
1284
|
+
readonly version: Schema.String;
|
|
1285
|
+
}>>;
|
|
1286
|
+
readonly id: Schema.String;
|
|
1287
|
+
readonly outgoing: Schema.$Array<Schema.Struct<{
|
|
1288
|
+
readonly id: Schema.String;
|
|
1289
|
+
readonly kind: Schema.Literals<readonly ["concept", "file", "missing"]>;
|
|
1290
|
+
readonly summary: Schema.NullOr<Schema.Struct<{
|
|
1291
|
+
readonly id: Schema.String;
|
|
1292
|
+
readonly type: Schema.String;
|
|
1293
|
+
readonly title: Schema.String;
|
|
1294
|
+
readonly description: Schema.NullOr<Schema.String>;
|
|
1295
|
+
readonly status: Schema.Literals<readonly ["draft", "stable", "deprecated"]>;
|
|
1296
|
+
readonly tags: Schema.$Array<Schema.String>;
|
|
1297
|
+
readonly path: Schema.String;
|
|
1298
|
+
}>>;
|
|
1299
|
+
}>>;
|
|
1300
|
+
readonly incoming: Schema.$Array<Schema.Struct<{
|
|
1301
|
+
readonly id: Schema.String;
|
|
1302
|
+
readonly kind: Schema.Literals<readonly ["concept", "file", "missing"]>;
|
|
1303
|
+
readonly summary: Schema.NullOr<Schema.Struct<{
|
|
1304
|
+
readonly id: Schema.String;
|
|
1305
|
+
readonly type: Schema.String;
|
|
1306
|
+
readonly title: Schema.String;
|
|
1307
|
+
readonly description: Schema.NullOr<Schema.String>;
|
|
1308
|
+
readonly status: Schema.Literals<readonly ["draft", "stable", "deprecated"]>;
|
|
1309
|
+
readonly tags: Schema.$Array<Schema.String>;
|
|
1310
|
+
readonly path: Schema.String;
|
|
1311
|
+
}>>;
|
|
1312
|
+
}>>;
|
|
1313
|
+
}>;
|
|
1314
|
+
/** @public */
|
|
1315
|
+
export type QueryNeighborsEnvelope = typeof QueryNeighborsEnvelope.Type;
|
|
1316
|
+
/** Build the list envelope; `items` is the already-paged, already-sorted summaries. @public */
|
|
1317
|
+
export declare const queryListEnvelope: (input: {
|
|
1318
|
+
readonly okfitVersion: string;
|
|
1319
|
+
readonly total: number;
|
|
1320
|
+
readonly items: ReadonlyArray<ConceptSummary>;
|
|
1321
|
+
readonly distribution?: Distribution;
|
|
1322
|
+
}) => QueryListEnvelope;
|
|
1323
|
+
/** Build the get envelope from a summary, the raw frontmatter and the outgoing links. @public */
|
|
1324
|
+
export declare const queryGetEnvelope: (input: {
|
|
1325
|
+
readonly okfitVersion: string;
|
|
1326
|
+
readonly concept: ConceptSummary;
|
|
1327
|
+
readonly frontmatter: Readonly<Record<string, unknown>>;
|
|
1328
|
+
readonly links: ReadonlyArray<QueryLink>;
|
|
1329
|
+
readonly distribution?: Distribution;
|
|
1330
|
+
}) => QueryGetEnvelope;
|
|
1331
|
+
/** Build the neighbors envelope. @public */
|
|
1332
|
+
export declare const queryNeighborsEnvelope: (input: {
|
|
1333
|
+
readonly okfitVersion: string;
|
|
1334
|
+
readonly id: string;
|
|
1335
|
+
readonly outgoing: ReadonlyArray<QueryNeighbor>;
|
|
1336
|
+
readonly incoming: ReadonlyArray<QueryNeighbor>;
|
|
1337
|
+
readonly distribution?: Distribution;
|
|
1338
|
+
}) => QueryNeighborsEnvelope;
|
|
1339
|
+
//#endregion
|
|
1091
1340
|
//#region src/render/stale.d.ts
|
|
1092
1341
|
/** One entry of the `items` array. @public */
|
|
1093
1342
|
export declare const StaleItem: Schema.Struct<{
|
|
@@ -1298,6 +1547,71 @@ export declare const syncEnvelope: (input: {
|
|
|
1298
1547
|
readonly distribution?: Distribution;
|
|
1299
1548
|
}) => SyncEnvelope;
|
|
1300
1549
|
//#endregion
|
|
1550
|
+
//#region src/verify/select.d.ts
|
|
1551
|
+
/**
|
|
1552
|
+
* Why a candidate concept was skipped by batch selection: `"draft"` and
|
|
1553
|
+
* `"deprecated"` mirror `status`, `"already-verified"` means the actor already
|
|
1554
|
+
* carries a `verified` entry.
|
|
1555
|
+
*
|
|
1556
|
+
* @public
|
|
1557
|
+
*/
|
|
1558
|
+
type VerifyBatchSkipReason = "draft" | "deprecated" | "already-verified";
|
|
1559
|
+
/**
|
|
1560
|
+
* The outcome of {@link selectAttestable}.
|
|
1561
|
+
*
|
|
1562
|
+
* @public
|
|
1563
|
+
*/
|
|
1564
|
+
interface AttestableSelection {
|
|
1565
|
+
/** In bundle iteration order. */
|
|
1566
|
+
readonly candidates: ReadonlyArray<LoadedConcept>;
|
|
1567
|
+
readonly skipped: ReadonlyArray<{
|
|
1568
|
+
readonly id: string;
|
|
1569
|
+
readonly reason: VerifyBatchSkipReason;
|
|
1570
|
+
}>;
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* Issue #138/#143: which concepts of `types` the actor may attest in one
|
|
1574
|
+
* batch. A draft is unsettled and a deprecated concept is retired (#143), so
|
|
1575
|
+
* both are skipped before the already-verified check.
|
|
1576
|
+
*
|
|
1577
|
+
* @public
|
|
1578
|
+
*/
|
|
1579
|
+
export declare const selectAttestable: (bundle: LoadedBundle, types: ReadonlySet<string>, actor: string) => AttestableSelection;
|
|
1580
|
+
/**
|
|
1581
|
+
* One row of the interactive verify picker: a `require_verified` concept the
|
|
1582
|
+
* actor has not attested yet.
|
|
1583
|
+
*
|
|
1584
|
+
* @public
|
|
1585
|
+
*/
|
|
1586
|
+
interface PickerCandidate {
|
|
1587
|
+
readonly id: string;
|
|
1588
|
+
readonly type: string;
|
|
1589
|
+
/** `"stable"` when the concept carries no `status`. */
|
|
1590
|
+
readonly status: "draft" | "stable";
|
|
1591
|
+
readonly title: string | null;
|
|
1592
|
+
readonly description: string | null;
|
|
1593
|
+
/** How many `verified` entries by actors other than the current one. */
|
|
1594
|
+
readonly otherAttestations: number;
|
|
1595
|
+
}
|
|
1596
|
+
/**
|
|
1597
|
+
* Every concept whose type sets `require_verified` that `actor` has not
|
|
1598
|
+
* attested: drafts included, deprecated concepts and the actor's own
|
|
1599
|
+
* attestations excluded. Sorted by type, then id; grouping is the caller's.
|
|
1600
|
+
*
|
|
1601
|
+
* @public
|
|
1602
|
+
*/
|
|
1603
|
+
export declare const selectPickerCandidates: (bundle: LoadedBundle, config: OkfitConfig, actor: string) => ReadonlyArray<PickerCandidate>;
|
|
1604
|
+
/**
|
|
1605
|
+
* The batch type-resolution rule shared by `runVerifyBatch` and any future
|
|
1606
|
+
* interactive picker: explicit `types` must each be declared in
|
|
1607
|
+
* `config.types` (else `VerifySelectionError` with reason `unknown-type`);
|
|
1608
|
+
* an empty `types` selects every declared type whose `require_verified` is
|
|
1609
|
+
* `true`.
|
|
1610
|
+
*
|
|
1611
|
+
* @public
|
|
1612
|
+
*/
|
|
1613
|
+
export declare const resolveBatchTypes: (config: OkfitConfig, types: ReadonlyArray<string>) => Effect.Effect<ReadonlySet<string>, VerifySelectionError>;
|
|
1614
|
+
//#endregion
|
|
1301
1615
|
//#region src/render/verify.d.ts
|
|
1302
1616
|
/**
|
|
1303
1617
|
* V-11's success envelope, schema 1, snake_case — the same convention as
|
|
@@ -1322,6 +1636,11 @@ export declare const VerifyEnvelope: Schema.Struct<{
|
|
|
1322
1636
|
readonly by: Schema.String;
|
|
1323
1637
|
readonly at: Schema.String;
|
|
1324
1638
|
}>;
|
|
1639
|
+
/** Issue #185: the status change `--stable`/`--draft` made; `null` when neither flag was given. */
|
|
1640
|
+
readonly status: Schema.NullOr<Schema.Struct<{
|
|
1641
|
+
readonly from: Schema.NullOr<Schema.Literals<readonly ["draft", "stable", "deprecated"]>>;
|
|
1642
|
+
readonly to: Schema.Literals<readonly ["stable", "draft"]>;
|
|
1643
|
+
}>>;
|
|
1325
1644
|
readonly dry_run: Schema.Boolean;
|
|
1326
1645
|
readonly exit_code: Schema.Literal<0>;
|
|
1327
1646
|
}>;
|
|
@@ -1342,6 +1661,10 @@ export declare const verifyEnvelope: (input: {
|
|
|
1342
1661
|
readonly by: string;
|
|
1343
1662
|
readonly at: string;
|
|
1344
1663
|
readonly dryRun: boolean;
|
|
1664
|
+
readonly status: {
|
|
1665
|
+
readonly from: Status | null;
|
|
1666
|
+
readonly to: "stable" | "draft";
|
|
1667
|
+
} | null;
|
|
1345
1668
|
readonly distribution?: Distribution;
|
|
1346
1669
|
}) => VerifyEnvelope;
|
|
1347
1670
|
/**
|
|
@@ -1368,7 +1691,7 @@ export declare const VerifyBatchEnvelope: Schema.Struct<{
|
|
|
1368
1691
|
}>>;
|
|
1369
1692
|
readonly skipped: Schema.$Array<Schema.Struct<{
|
|
1370
1693
|
readonly id: Schema.String;
|
|
1371
|
-
readonly reason: Schema.Literals<readonly ["draft", "already-verified"]>;
|
|
1694
|
+
readonly reason: Schema.Literals<readonly ["draft", "deprecated", "already-verified"]>;
|
|
1372
1695
|
}>>;
|
|
1373
1696
|
readonly dry_run: Schema.Boolean;
|
|
1374
1697
|
readonly exit_code: Schema.Literal<0>;
|
|
@@ -1391,7 +1714,7 @@ export declare const verifyBatchEnvelope: (input: {
|
|
|
1391
1714
|
}>;
|
|
1392
1715
|
readonly skipped: ReadonlyArray<{
|
|
1393
1716
|
readonly id: string;
|
|
1394
|
-
readonly reason:
|
|
1717
|
+
readonly reason: VerifyBatchSkipReason;
|
|
1395
1718
|
}>;
|
|
1396
1719
|
readonly dryRun: boolean;
|
|
1397
1720
|
readonly distribution?: Distribution;
|
|
@@ -1621,6 +1944,8 @@ interface VerifyOptions {
|
|
|
1621
1944
|
/** `--at` when given, else the `Now` service (K-47/K-49). */
|
|
1622
1945
|
readonly at: DateTime.Utc;
|
|
1623
1946
|
readonly dryRun: boolean;
|
|
1947
|
+
/** Issue #185: also set the concept's `status` in the same write. */
|
|
1948
|
+
readonly status?: "stable" | "draft";
|
|
1624
1949
|
}
|
|
1625
1950
|
/** @internal */
|
|
1626
1951
|
interface VerifyResult {
|
|
@@ -1638,6 +1963,13 @@ interface VerifyResult {
|
|
|
1638
1963
|
readonly dryRun: boolean;
|
|
1639
1964
|
/** The exact bytes `splice`'s edit would insert, written or not. */
|
|
1640
1965
|
readonly fragment: string;
|
|
1966
|
+
/** `null` when no status flag was given; `from` is the RAW frontmatter status. */
|
|
1967
|
+
readonly status: {
|
|
1968
|
+
readonly from: Status | null;
|
|
1969
|
+
readonly to: "stable" | "draft";
|
|
1970
|
+
} | null;
|
|
1971
|
+
/** The exact status bytes spliced, or `null` when no status edit was made. */
|
|
1972
|
+
readonly statusFragment: string | null;
|
|
1641
1973
|
}
|
|
1642
1974
|
/**
|
|
1643
1975
|
* Issue #138: options for {@link runVerifyBatch}. `types` restricts the
|
|
@@ -1655,14 +1987,6 @@ interface VerifyBatchOptions {
|
|
|
1655
1987
|
/** Restrict to these types; empty = every type with `require_verified = true`. */
|
|
1656
1988
|
readonly types: ReadonlyArray<string>;
|
|
1657
1989
|
}
|
|
1658
|
-
/**
|
|
1659
|
-
* Why {@link runVerifyBatch} skipped a candidate concept: `"draft"` for
|
|
1660
|
-
* `status === "draft"`, `"already-verified"` when the resolved actor already
|
|
1661
|
-
* carries a `verified` entry.
|
|
1662
|
-
*
|
|
1663
|
-
* @public
|
|
1664
|
-
*/
|
|
1665
|
-
type VerifyBatchSkipReason = "draft" | "already-verified";
|
|
1666
1990
|
/**
|
|
1667
1991
|
* The result of {@link runVerifyBatch}.
|
|
1668
1992
|
*
|
|
@@ -1689,8 +2013,9 @@ interface VerifyBatchResult {
|
|
|
1689
2013
|
* human actor from git, splices exactly one entry into the concept's
|
|
1690
2014
|
* frontmatter and writes it back atomically.
|
|
1691
2015
|
*
|
|
1692
|
-
* Nothing here reads `
|
|
1693
|
-
*
|
|
2016
|
+
* Nothing here reads `stale_after` or a type's `require_verified`; `status`
|
|
2017
|
+
* is read only to skip a no-op edit under `options.status` (#185). `verify`
|
|
2018
|
+
* is mechanical, not config-aware (V-4, V-5).
|
|
1694
2019
|
*
|
|
1695
2020
|
* @internal
|
|
1696
2021
|
*/
|
|
@@ -1703,11 +2028,16 @@ export declare const runVerify: (options: VerifyOptions) => Effect.Effect<{
|
|
|
1703
2028
|
priorAt: string[];
|
|
1704
2029
|
dryRun: boolean;
|
|
1705
2030
|
fragment: string;
|
|
2031
|
+
status: {
|
|
2032
|
+
from: "deprecated" | "draft" | "stable" | null;
|
|
2033
|
+
to: "draft" | "stable";
|
|
2034
|
+
} | null;
|
|
2035
|
+
statusFragment: string | null;
|
|
1706
2036
|
}, import("effect/PlatformError").PlatformError | VerifyConceptNotFoundError | VerifyUnsupportedFrontmatterError | import("@effected/yaml").YamlParseError | import("@okfit/core").BundleLoadError | import("@okfit/profiles").GeneratedByError, FileSystem.FileSystem | import("@effected/git").Git | Path.Path>;
|
|
1707
2037
|
/**
|
|
1708
2038
|
* Issue #138. Attests every concept selected by `options.types` (or, when
|
|
1709
2039
|
* empty, every type whose declaration sets `require_verified = true`) that
|
|
1710
|
-
* is not a draft and does not already carry a `verified` entry by the
|
|
2040
|
+
* is not a draft, is not deprecated (#143) and does not already carry a `verified` entry by the
|
|
1711
2041
|
* resolved actor. Every candidate is located FIRST -- an unsupported
|
|
1712
2042
|
* `verified` shape on any one of them fails the whole batch with nothing
|
|
1713
2043
|
* written, mirroring `runVerify`'s own fail-closed rule at batch scale.
|
|
@@ -1724,11 +2054,72 @@ export declare const runVerifyBatch: (options: VerifyBatchOptions) => Effect.Eff
|
|
|
1724
2054
|
conceptPath: string;
|
|
1725
2055
|
fragment: string;
|
|
1726
2056
|
}[];
|
|
1727
|
-
skipped: {
|
|
2057
|
+
skipped: readonly {
|
|
1728
2058
|
readonly id: string;
|
|
1729
2059
|
readonly reason: VerifyBatchSkipReason;
|
|
1730
2060
|
}[];
|
|
1731
2061
|
}, import("effect/PlatformError").PlatformError | VerifySelectionError | VerifyUnsupportedFrontmatterError | import("@effected/yaml").YamlParseError | import("@okfit/core").BundleLoadError | import("@okfit/profiles").GeneratedByError, FileSystem.FileSystem | import("@effected/git").Git | Path.Path>;
|
|
2062
|
+
/**
|
|
2063
|
+
* Issue #214: options for {@link runVerifyIds}.
|
|
2064
|
+
*
|
|
2065
|
+
* @public
|
|
2066
|
+
*/
|
|
2067
|
+
interface VerifyIdsOptions {
|
|
2068
|
+
readonly bundleRoot: string;
|
|
2069
|
+
readonly projectRoot: string;
|
|
2070
|
+
readonly config: OkfitConfig;
|
|
2071
|
+
readonly at: DateTime.Utc;
|
|
2072
|
+
readonly dryRun: boolean;
|
|
2073
|
+
/** Concept ids, resolved as `runVerify` resolves one (tolerant: leading slash, trailing `.md`). */
|
|
2074
|
+
readonly ids: ReadonlyArray<string>;
|
|
2075
|
+
/** Also set `status: stable` on every selected concept whose status is `draft`. Default `false`. */
|
|
2076
|
+
readonly promote?: boolean;
|
|
2077
|
+
}
|
|
2078
|
+
/**
|
|
2079
|
+
* Issue #214. Attests an explicit list of concept ids in one all-or-nothing
|
|
2080
|
+
* batch. Every id is resolved exactly as {@link runVerify} resolves it, and
|
|
2081
|
+
* every concept is located and spliced BEFORE any file is written, so one
|
|
2082
|
+
* unknown id, reserved file or unsupported `verified`/`status` shape fails the
|
|
2083
|
+
* whole call with the tree untouched. An explicit pick is never second-guessed:
|
|
2084
|
+
* drafts, deprecated and already-attested concepts are all attested, and
|
|
2085
|
+
* `skipped` is always empty. Duplicate ids (after normalisation) are written
|
|
2086
|
+
* once. With `promote`, a draft's `status` becomes `stable` in the same write.
|
|
2087
|
+
*
|
|
2088
|
+
* @public
|
|
2089
|
+
*/
|
|
2090
|
+
export declare const runVerifyIds: (options: VerifyIdsOptions) => Effect.Effect<{
|
|
2091
|
+
bundleRoot: string;
|
|
2092
|
+
by: Actor;
|
|
2093
|
+
at: string;
|
|
2094
|
+
dryRun: boolean;
|
|
2095
|
+
verified: {
|
|
2096
|
+
id: string;
|
|
2097
|
+
conceptPath: string;
|
|
2098
|
+
fragment: string;
|
|
2099
|
+
}[];
|
|
2100
|
+
skipped: never[];
|
|
2101
|
+
}, import("effect/PlatformError").PlatformError | VerifyConceptNotFoundError | VerifyUnsupportedFrontmatterError | import("@effected/yaml").YamlParseError | import("@okfit/core").BundleLoadError | import("@okfit/profiles").GeneratedByError, FileSystem.FileSystem | import("@effected/git").Git | Path.Path>;
|
|
2102
|
+
/**
|
|
2103
|
+
* Options for {@link loadPickerCandidates}.
|
|
2104
|
+
*
|
|
2105
|
+
* @public
|
|
2106
|
+
*/
|
|
2107
|
+
interface PickerCandidatesOptions {
|
|
2108
|
+
readonly bundleRoot: string;
|
|
2109
|
+
readonly projectRoot: string;
|
|
2110
|
+
readonly config: OkfitConfig;
|
|
2111
|
+
}
|
|
2112
|
+
/**
|
|
2113
|
+
* The interactive verify picker's starting point: loads the bundle, resolves
|
|
2114
|
+
* the human actor from git exactly as {@link runVerify} does, and selects the
|
|
2115
|
+
* rows that actor may still attest. Reads only; nothing is written.
|
|
2116
|
+
*
|
|
2117
|
+
* @public
|
|
2118
|
+
*/
|
|
2119
|
+
export declare const loadPickerCandidates: (options: PickerCandidatesOptions) => Effect.Effect<{
|
|
2120
|
+
by: Actor;
|
|
2121
|
+
candidates: readonly PickerCandidate[];
|
|
2122
|
+
}, import("@okfit/core").BundleLoadError | import("@okfit/profiles").GeneratedByError, FileSystem.FileSystem | import("@effected/git").Git | Path.Path>;
|
|
1732
2123
|
//#endregion
|
|
1733
2124
|
//#region src/version.d.ts
|
|
1734
2125
|
/**
|
|
@@ -1745,5 +2136,5 @@ export declare const runVerifyBatch: (options: VerifyBatchOptions) => Effect.Eff
|
|
|
1745
2136
|
*/
|
|
1746
2137
|
export declare const ENGINE_VERSION: string;
|
|
1747
2138
|
//#endregion
|
|
1748
|
-
export type { BundleSessionOptions, BundleSessionServices, BundleSessionShape, ContextResult, ContextRunOptions, DiagnosticSource, DiscoveredConfig, Distribution, DocumentInput, ExternalReferencesShape, GraphRunOptions, GraphRunResult, OverlayDocument, OverlayDocumentsShape, RenderedDiagnostic, ResolveProjectConfigInput, ResolvedProjectConfig, RevalidateError, RevalidateOptions, RevalidateResult, RevalidateTier, RunOptions, RunResult, ScaffoldFile, ScaffoldOptions, StaleRunOptions, StaleRunResult, SyncMode, SyncModeResult, SyncOptions, SyncResult, Tally, VerifyBatchOptions, VerifyBatchResult, VerifyBatchSkipReason, VerifyOptions, VerifyResult, WatchedFilesOutcome };
|
|
2139
|
+
export type { AttestableSelection, BundleSessionOptions, BundleSessionServices, BundleSessionShape, ConceptFilter, ConceptLink, ConceptNeighbor, ContextResult, ContextRunOptions, DiagnosticSource, DiscoveredConfig, Distribution, DocumentInput, ExternalReferencesShape, GraphRunOptions, GraphRunResult, OverlayDocument, OverlayDocumentsShape, PickerCandidate, PickerCandidatesOptions, RenderedDiagnostic, ResolveProjectConfigInput, ResolvedProjectConfig, RevalidateError, RevalidateOptions, RevalidateResult, RevalidateTier, RunOptions, RunResult, ScaffoldFile, ScaffoldOptions, StaleRunOptions, StaleRunResult, SyncMode, SyncModeResult, SyncOptions, SyncResult, Tally, VerifyBatchOptions, VerifyBatchResult, VerifyBatchSkipReason, VerifyIdsOptions, VerifyOptions, VerifyResult, WatchedFilesOutcome };
|
|
1749
2140
|
//# sourceMappingURL=index.d.ts.map
|