@okfit/engine 0.2.0 → 0.3.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/config/anchor.js +1 -1
- package/index.d.ts +59 -4
- package/index.js +2 -2
- package/init/scaffold.js +2 -2
- package/package.json +16 -16
- package/render/context.js +44 -4
- package/tsdoc-metadata.json +1 -1
package/config/anchor.js
CHANGED
|
@@ -15,7 +15,7 @@ const anchorForExplicit = (configPath, path) => {
|
|
|
15
15
|
/**
|
|
16
16
|
* K-12's project root, as amended by K-58 and C1-2, in order:
|
|
17
17
|
*
|
|
18
|
-
* 1. `pathArg`, if given. `Argument.
|
|
18
|
+
* 1. `pathArg`, if given. `Argument.Path` has already resolved it absolute.
|
|
19
19
|
* 2. otherwise, if `--config` was given: `anchorForExplicit` applied to that
|
|
20
20
|
* path.
|
|
21
21
|
* 3. otherwise, if a config was discovered by the `"project"` resolver
|
package/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ interface DiscoveredConfig {
|
|
|
32
32
|
/**
|
|
33
33
|
* K-12's project root, as amended by K-58 and C1-2, in order:
|
|
34
34
|
*
|
|
35
|
-
* 1. `pathArg`, if given. `Argument.
|
|
35
|
+
* 1. `pathArg`, if given. `Argument.Path` has already resolved it absolute.
|
|
36
36
|
* 2. otherwise, if `--config` was given: `anchorForExplicit` applied to that
|
|
37
37
|
* path.
|
|
38
38
|
* 3. otherwise, if a config was discovered by the `"project"` resolver
|
|
@@ -418,11 +418,55 @@ export declare const files: (options: ScaffoldOptions) => Effect.Effect<Readonly
|
|
|
418
418
|
export declare const OkfitPlatform: Layer.Layer<AppDirs | Xdg | NodeServices.NodeServices, import("@effected/xdg").XdgEnvError, never>;
|
|
419
419
|
//#endregion
|
|
420
420
|
//#region src/render/context.d.ts
|
|
421
|
-
/** One `
|
|
421
|
+
/** One enumerated value of a `fields[]` entry. @public */
|
|
422
|
+
export declare const ContextFieldValue: Schema.Struct<{
|
|
423
|
+
readonly name: Schema.String;
|
|
424
|
+
readonly description: Schema.String;
|
|
425
|
+
}>;
|
|
426
|
+
/** @public */
|
|
427
|
+
export type ContextFieldValue = typeof ContextFieldValue.Type;
|
|
428
|
+
/**
|
|
429
|
+
* One `types[].fields[]` entry: a `[types.<Name>.fields.<key>]` declaration
|
|
430
|
+
* flattened for a consumer. `values` keeps the declaration's own order (it
|
|
431
|
+
* is a vocabulary, and the config author chose the order); `kind` is
|
|
432
|
+
* `"path"` or `null`.
|
|
433
|
+
*
|
|
434
|
+
* @public
|
|
435
|
+
*/
|
|
436
|
+
export declare const ContextField: Schema.Struct<{
|
|
437
|
+
readonly name: Schema.String;
|
|
438
|
+
readonly description: Schema.String;
|
|
439
|
+
readonly kind: Schema.NullOr<Schema.Literal<"path">>;
|
|
440
|
+
readonly values: Schema.NullOr<Schema.$Array<Schema.Struct<{
|
|
441
|
+
readonly name: Schema.String;
|
|
442
|
+
readonly description: Schema.String;
|
|
443
|
+
}>>>;
|
|
444
|
+
}>;
|
|
445
|
+
/** @public */
|
|
446
|
+
export type ContextField = typeof ContextField.Type;
|
|
447
|
+
/**
|
|
448
|
+
* One `types[]` entry (M-15). `required`, `require_verified` and `fields`
|
|
449
|
+
* carry the constraints `validate` enforces (issue #33): without them an
|
|
450
|
+
* agent learns that `Interface` exists but not that it requires `kind`, nor
|
|
451
|
+
* which values `kind` accepts, until a lint error says so.
|
|
452
|
+
*
|
|
453
|
+
* @public
|
|
454
|
+
*/
|
|
422
455
|
export declare const ContextType: Schema.Struct<{
|
|
423
456
|
readonly name: Schema.String;
|
|
424
457
|
readonly description: Schema.NullOr<Schema.String>;
|
|
425
458
|
readonly guidance: Schema.NullOr<Schema.String>;
|
|
459
|
+
readonly required: Schema.NullOr<Schema.$Array<Schema.String>>;
|
|
460
|
+
readonly require_verified: Schema.NullOr<Schema.Boolean>;
|
|
461
|
+
readonly fields: Schema.$Array<Schema.Struct<{
|
|
462
|
+
readonly name: Schema.String;
|
|
463
|
+
readonly description: Schema.String;
|
|
464
|
+
readonly kind: Schema.NullOr<Schema.Literal<"path">>;
|
|
465
|
+
readonly values: Schema.NullOr<Schema.$Array<Schema.Struct<{
|
|
466
|
+
readonly name: Schema.String;
|
|
467
|
+
readonly description: Schema.String;
|
|
468
|
+
}>>>;
|
|
469
|
+
}>>;
|
|
426
470
|
}>;
|
|
427
471
|
/** @public */
|
|
428
472
|
export type ContextType = typeof ContextType.Type;
|
|
@@ -474,6 +518,17 @@ export declare const ContextEnvelope: Schema.Struct<{
|
|
|
474
518
|
readonly name: Schema.String;
|
|
475
519
|
readonly description: Schema.NullOr<Schema.String>;
|
|
476
520
|
readonly guidance: Schema.NullOr<Schema.String>;
|
|
521
|
+
readonly required: Schema.NullOr<Schema.$Array<Schema.String>>;
|
|
522
|
+
readonly require_verified: Schema.NullOr<Schema.Boolean>;
|
|
523
|
+
readonly fields: Schema.$Array<Schema.Struct<{
|
|
524
|
+
readonly name: Schema.String;
|
|
525
|
+
readonly description: Schema.String;
|
|
526
|
+
readonly kind: Schema.NullOr<Schema.Literal<"path">>;
|
|
527
|
+
readonly values: Schema.NullOr<Schema.$Array<Schema.Struct<{
|
|
528
|
+
readonly name: Schema.String;
|
|
529
|
+
readonly description: Schema.String;
|
|
530
|
+
}>>>;
|
|
531
|
+
}>>;
|
|
477
532
|
}>>;
|
|
478
533
|
readonly tags: Schema.$Array<Schema.Struct<{
|
|
479
534
|
readonly name: Schema.String;
|
|
@@ -869,8 +924,8 @@ interface RunOptions {
|
|
|
869
924
|
* default severity. Tier 1 (the pure, in-memory body-digest comparison)
|
|
870
925
|
* still runs regardless — that is exactly the signal edit time wants,
|
|
871
926
|
* at the cost of one sha256 over text already in memory. Defaults to
|
|
872
|
-
* `false`; `run` still gates the whole lint call on
|
|
873
|
-
* "off"`, but no longer on this flag.
|
|
927
|
+
* `false`; `run` still gates the whole lint call on
|
|
928
|
+
* `severity === "off"`, but no longer on this flag.
|
|
874
929
|
*/
|
|
875
930
|
readonly skipProvenance?: boolean;
|
|
876
931
|
}
|
package/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { DEFAULT_PROFILE_NAME, resolveProjectConfig } from "./config/resolve.js"
|
|
|
5
5
|
import { runContext } from "./context/run.js";
|
|
6
6
|
import { CONFIG_RELATIVE_PATH, SCHEMA_DIRECTIVE, configValue, files, targetPaths } from "./init/scaffold.js";
|
|
7
7
|
import { OkfitPlatform } from "./platform.js";
|
|
8
|
-
import { ContextEnvelope, ContextTag, ContextType, contextEnvelope } from "./render/context.js";
|
|
8
|
+
import { ContextEnvelope, ContextField, ContextFieldValue, ContextTag, ContextType, contextEnvelope } from "./render/context.js";
|
|
9
9
|
import { forDiagnostics, tally } from "./render/exit.js";
|
|
10
10
|
import { collect, sort } from "./render/sort.js";
|
|
11
11
|
import { JsonDiagnostic, JsonEnvelope, JsonErrorEnvelope, JsonSummary, json, jsonError } from "./render/json.js";
|
|
@@ -15,4 +15,4 @@ import { VerifyEnvelope, verifyEnvelope } from "./render/verify.js";
|
|
|
15
15
|
import { Now, run } from "./validate/run.js";
|
|
16
16
|
import { runVerify } from "./verify/run.js";
|
|
17
17
|
|
|
18
|
-
export { CONFIG_RELATIVE_PATH, ConfigMalformedError, ConfigPathNotFoundError, ContextEnvelope, ContextTag, ContextType, DEFAULT_PROFILE_NAME, InitOverwriteError, JsonDiagnostic, JsonEnvelope, JsonErrorEnvelope, JsonSummary, Now, OkfitPlatform, SCHEMA_DIRECTIVE, SkipReason, SyncEnvelope, SyncModeEnvelope, VerifyConceptNotFoundError, VerifyEnvelope, VerifyUnsupportedFrontmatterError, buildConfigLayer, collect, configValue, contextEnvelope, files, forDiagnostics, json, jsonError, provideConfig, resolveBundleRoot, resolveProjectConfig, resolveProjectRoot, run, runContext, runSync, runVerify, sort, syncEnvelope, tally, targetPaths, verifyEnvelope };
|
|
18
|
+
export { CONFIG_RELATIVE_PATH, ConfigMalformedError, ConfigPathNotFoundError, ContextEnvelope, ContextField, ContextFieldValue, ContextTag, ContextType, DEFAULT_PROFILE_NAME, InitOverwriteError, JsonDiagnostic, JsonEnvelope, JsonErrorEnvelope, JsonSummary, Now, OkfitPlatform, SCHEMA_DIRECTIVE, SkipReason, SyncEnvelope, SyncModeEnvelope, VerifyConceptNotFoundError, VerifyEnvelope, VerifyUnsupportedFrontmatterError, buildConfigLayer, collect, configValue, contextEnvelope, files, forDiagnostics, json, jsonError, provideConfig, resolveBundleRoot, resolveProjectConfig, resolveProjectRoot, run, runContext, runSync, runVerify, sort, syncEnvelope, tally, targetPaths, verifyEnvelope };
|
package/init/scaffold.js
CHANGED
|
@@ -145,10 +145,10 @@ const files = (options) => Effect.gen(function* () {
|
|
|
145
145
|
okfVersion: OKF_SPEC_VERSION,
|
|
146
146
|
subdirectories
|
|
147
147
|
});
|
|
148
|
-
const logText = Derive.
|
|
148
|
+
const logText = Derive.renderLog([{
|
|
149
149
|
date: today,
|
|
150
150
|
items: [`Initialized the bundle with the ${profileName} profile`]
|
|
151
|
-
});
|
|
151
|
+
}]);
|
|
152
152
|
const directoryFiles = layout.directories.map((directory) => ({
|
|
153
153
|
path: `${bundleRoot}/${directory.directory}/${layout.root.index}`,
|
|
154
154
|
contents: `# ${capitalize(directory.directory)}\n`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okfit/engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The okfit engine: platform layer, config discovery, and the validate, verify, sync, init and context programs shared by the okfit CLI and MCP server.",
|
|
6
6
|
"keywords": [
|
|
@@ -34,21 +34,21 @@
|
|
|
34
34
|
"./package.json": "./package.json"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@effect/platform-node": "4.0.0-rc.
|
|
38
|
-
"@effected/app": "^0.
|
|
39
|
-
"@effected/config-file": "^0.
|
|
40
|
-
"@effected/git": "^0.
|
|
41
|
-
"@effected/glob": "^0.
|
|
42
|
-
"@effected/jsonc": "^0.
|
|
43
|
-
"@effected/markdown": "^0.
|
|
44
|
-
"@effected/store": "^0.
|
|
45
|
-
"@effected/toml": "^0.
|
|
46
|
-
"@effected/walker": "^0.
|
|
47
|
-
"@effected/xdg": "^0.
|
|
48
|
-
"@effected/yaml": "^0.
|
|
49
|
-
"@okfit/core": "0.
|
|
50
|
-
"@okfit/profiles": "0.
|
|
51
|
-
"effect": "4.0.0-rc.
|
|
37
|
+
"@effect/platform-node": "4.0.0-rc.115",
|
|
38
|
+
"@effected/app": "^0.16.1",
|
|
39
|
+
"@effected/config-file": "^0.9.0",
|
|
40
|
+
"@effected/git": "^0.15.1",
|
|
41
|
+
"@effected/glob": "^0.6.0",
|
|
42
|
+
"@effected/jsonc": "^0.11.0",
|
|
43
|
+
"@effected/markdown": "^0.10.0",
|
|
44
|
+
"@effected/store": "^0.8.0",
|
|
45
|
+
"@effected/toml": "^0.7.0",
|
|
46
|
+
"@effected/walker": "^0.9.0",
|
|
47
|
+
"@effected/xdg": "^0.5.1",
|
|
48
|
+
"@effected/yaml": "^0.15.1",
|
|
49
|
+
"@okfit/core": "0.4.0",
|
|
50
|
+
"@okfit/profiles": "0.4.0",
|
|
51
|
+
"effect": "4.0.0-rc.115"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=24.11.0"
|
package/render/context.js
CHANGED
|
@@ -1,11 +1,40 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
3
|
//#region src/render/context.ts
|
|
4
|
-
/** One `
|
|
4
|
+
/** One enumerated value of a `fields[]` entry. @public */
|
|
5
|
+
const ContextFieldValue = Schema.Struct({
|
|
6
|
+
name: Schema.String,
|
|
7
|
+
description: Schema.String
|
|
8
|
+
});
|
|
9
|
+
/**
|
|
10
|
+
* One `types[].fields[]` entry: a `[types.<Name>.fields.<key>]` declaration
|
|
11
|
+
* flattened for a consumer. `values` keeps the declaration's own order (it
|
|
12
|
+
* is a vocabulary, and the config author chose the order); `kind` is
|
|
13
|
+
* `"path"` or `null`.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
const ContextField = Schema.Struct({
|
|
18
|
+
name: Schema.String,
|
|
19
|
+
description: Schema.String,
|
|
20
|
+
kind: Schema.NullOr(Schema.Literal("path")),
|
|
21
|
+
values: Schema.NullOr(Schema.Array(ContextFieldValue))
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* One `types[]` entry (M-15). `required`, `require_verified` and `fields`
|
|
25
|
+
* carry the constraints `validate` enforces (issue #33): without them an
|
|
26
|
+
* agent learns that `Interface` exists but not that it requires `kind`, nor
|
|
27
|
+
* which values `kind` accepts, until a lint error says so.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
5
31
|
const ContextType = Schema.Struct({
|
|
6
32
|
name: Schema.String,
|
|
7
33
|
description: Schema.NullOr(Schema.String),
|
|
8
|
-
guidance: Schema.NullOr(Schema.String)
|
|
34
|
+
guidance: Schema.NullOr(Schema.String),
|
|
35
|
+
required: Schema.NullOr(Schema.Array(Schema.String)),
|
|
36
|
+
require_verified: Schema.NullOr(Schema.Boolean),
|
|
37
|
+
fields: Schema.Array(ContextField)
|
|
9
38
|
});
|
|
10
39
|
/** One `tags[]` entry (M-15). @public */
|
|
11
40
|
const ContextTag = Schema.Struct({
|
|
@@ -71,7 +100,18 @@ const contextEnvelope = (input) => ({
|
|
|
71
100
|
types: Object.entries(input.config.types ?? {}).map(([name, decl]) => ({
|
|
72
101
|
name,
|
|
73
102
|
description: decl.description ?? null,
|
|
74
|
-
guidance: decl.guidance ?? null
|
|
103
|
+
guidance: decl.guidance ?? null,
|
|
104
|
+
required: decl.required ?? null,
|
|
105
|
+
require_verified: decl.require_verified ?? null,
|
|
106
|
+
fields: Object.entries(decl.fields ?? {}).map(([fieldName, field]) => ({
|
|
107
|
+
name: fieldName,
|
|
108
|
+
description: field.description,
|
|
109
|
+
kind: field.kind ?? null,
|
|
110
|
+
values: field.values === void 0 ? null : Object.entries(field.values).map(([valueName, description]) => ({
|
|
111
|
+
name: valueName,
|
|
112
|
+
description
|
|
113
|
+
}))
|
|
114
|
+
})).toSorted((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)
|
|
75
115
|
})).toSorted((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0),
|
|
76
116
|
tags: Object.entries(input.config.tags ?? {}).map(([name, decl]) => ({
|
|
77
117
|
name,
|
|
@@ -80,4 +120,4 @@ const contextEnvelope = (input) => ({
|
|
|
80
120
|
});
|
|
81
121
|
|
|
82
122
|
//#endregion
|
|
83
|
-
export { ContextEnvelope, ContextTag, ContextType, contextEnvelope };
|
|
123
|
+
export { ContextEnvelope, ContextField, ContextFieldValue, ContextTag, ContextType, contextEnvelope };
|