@okfit/engine 0.19.0 → 0.20.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.
@@ -1,5 +1,5 @@
1
- import { documentNewline, locate, locateTopLevelScalar, stripBom } from "../verify/locate.js";
2
1
  import { formatDigest, locateIntegrity, spliceIntegrityVerified } from "../verify/integrity.js";
2
+ import { documentNewline, locate, locateTopLevelScalar, stripBom } from "../verify/locate.js";
3
3
  import { orderVerifyEdits, splice, spliceTopLevelScalar } from "../verify/splice.js";
4
4
  import { DiagnosticRange } from "@okfit/core";
5
5
  import { Effect, Result, Runtime, Schema } from "effect";
package/errors.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Runtime, Schema } from "effect";
2
- import { ErrorText } from "@effected/engine";
2
+ import { ErrorText } from "@effected/kit";
3
3
 
4
4
  // src/errors.ts
5
5
  /**
package/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import { FrontmatterWriteError, MarkdownEdit, MarkdownParseError } from "@effect
7
7
  import { YamlParseError } from "@effected/yaml";
8
8
  import { Digest } from "effect/crypto";
9
9
  import * as NodeServices from "@effect/platform-node/NodeServices";
10
- import { Distribution as Distribution$1 } from "@effected/engine";
10
+ import { Distribution as Distribution$1 } from "@effected/kit";
11
11
  import { Git, GitCommandError, UnknownRefError } from "@effected/git";
12
12
  /**
13
13
  * What {@link resolveProjectRoot} needs about the winning discovery source
@@ -1148,7 +1148,7 @@ export declare const contextEnvelope: (input: {
1148
1148
  * reports; `engine_version` and `okf_version` are the pair a reader
1149
1149
  * compares.
1150
1150
  *
1151
- * Re-exported from `@effected/engine`'s own `Distribution` -- the shape
1151
+ * Re-exported from `@effected/kit`'s own `Distribution` -- the shape
1152
1152
  * both `@okfit/cli`'s `CurrentDistribution` (K-137/carrier-version-threading)
1153
1153
  * and every JSON envelope in this package agree on, instead of two
1154
1154
  * independently hand-rolled `{ name, version }` structs drifting apart.
package/index.js CHANGED
@@ -1,41 +1,41 @@
1
1
  import { resolveBundleRoot, resolveProjectRoot } from "./config/anchor.js";
2
- import { ConfigMalformedError, ConfigPathNotFoundError, DocumentPathError, InitOverwriteError, MoveError, QueryConceptNotFoundError, QuerySelectionError, QueryUnknownVocabularyError, SyncPlanStaleError, SyncPublicationConflictError, TargetFailure, TargetResolutionError, VerifyConceptNotFoundError, VerifyContentUnhashableError, VerifyNothingToRevokeError, VerifySelectionError, VerifyUnsupportedFrontmatterError } from "./errors.js";
3
2
  import { buildConfigLayer, provideConfig } from "./config/layer.js";
4
3
  import { DEFAULT_PROFILE_NAME, resolveProjectConfig } from "./config/resolve.js";
5
4
  import { runContext } from "./context/run.js";
6
5
  import { FrontmatterEdits, UnsupportedFrontmatterError } from "./edits/FrontmatterEdits.js";
6
+ import { ConfigMalformedError, ConfigPathNotFoundError, DocumentPathError, InitOverwriteError, MoveError, QueryConceptNotFoundError, QuerySelectionError, QueryUnknownVocabularyError, SyncPlanStaleError, SyncPublicationConflictError, TargetFailure, TargetResolutionError, VerifyConceptNotFoundError, VerifyContentUnhashableError, VerifyNothingToRevokeError, VerifySelectionError, VerifyUnsupportedFrontmatterError } from "./errors.js";
7
7
  import { ExternalReferences, ReferenceCheck, ReferenceState } from "./external/ExternalReferences.js";
8
8
  import { runGraph } from "./graph/run.js";
9
9
  import { CONFIG_RELATIVE_PATH, configValue, files, targetPaths } from "./init/scaffold.js";
10
10
  import { referencesOf, rewriteReference } from "./move/references.js";
11
- import { Targets } from "./targets/resolve.js";
12
11
  import { planMove, runMove } from "./move/run.js";
13
- import { OverlayDocuments, layerOverlayFileSystem, makeOverlayFileSystem } from "./overlay/layer.js";
14
12
  import { provideDocuments, resolveDocumentPath } from "./overlay/documents.js";
13
+ import { OverlayDocuments, layerOverlayFileSystem, makeOverlayFileSystem } from "./overlay/layer.js";
15
14
  import { OkfitPlatform } from "./platform.js";
16
15
  import { ConceptQuery } from "./query/ConceptQuery.js";
17
16
  import { ContextEnvelope, ContextField, ContextFieldValue, ContextTag, ContextTrust, ContextType, contextEnvelope } from "./render/context.js";
18
17
  import { DistributionField } from "./render/distribution.js";
19
18
  import { forDiagnostics, tally } from "./render/exit.js";
20
- import { ENGINE_VERSION } from "./version.js";
21
19
  import { GraphEdgeEnvelope, GraphEnvelope, GraphNodeEnvelope, GraphSummary, graphEnvelope } from "./render/graph.js";
22
- import { collect, sort } from "./render/sort.js";
23
20
  import { JsonDiagnostic, JsonEnvelope, JsonErrorEnvelope, JsonSummary, json, jsonError } from "./render/json.js";
24
21
  import { MoveEnvelope, moveEnvelope } from "./render/move.js";
25
22
  import { ConceptSummary, QueryGetEnvelope, QueryLink, QueryListEnvelope, QueryNeighbor, QueryNeighborsEnvelope, TrustDrift, queryGetEnvelope, queryListEnvelope, queryNeighborsEnvelope, signalFor, toConceptSummary, toTrustDrift } from "./render/query.js";
23
+ import { collect, sort } from "./render/sort.js";
26
24
  import { StaleEnvelope, StaleItem, StaleSummary, staleEnvelope } from "./render/stale.js";
27
- import { SkipReason, applySyncPlan, planSync, runSync } from "./sync/run.js";
28
25
  import { PublicationEnvelope, SyncEnvelope, SyncModeEnvelope, syncEnvelope } from "./render/sync.js";
29
26
  import { RevokeEnvelope, VerifyBatchEnvelope, VerifyEnvelope, revokeEnvelope, verifyBatchEnvelope, verifyEnvelope } from "./render/verify.js";
30
- import { Now, run } from "./validate/run.js";
27
+ import { BundleSession } from "./session/BundleSession.js";
31
28
  import { conceptFor } from "./session/concept.js";
32
29
  import { withFallbackRange } from "./session/range.js";
33
- import { BundleSession } from "./session/BundleSession.js";
34
30
  import { runStale } from "./stale/run.js";
35
31
  import { NotAPublicationError, PublicationNotFoundError, stampPublication } from "./sync/publication.js";
32
+ import { SkipReason, applySyncPlan, planSync, runSync } from "./sync/run.js";
33
+ import { Targets } from "./targets/resolve.js";
36
34
  import { runContextTrust } from "./trust/run.js";
35
+ import { Now, run } from "./validate/run.js";
37
36
  import { changeSince } from "./verify/diff.js";
38
- import { resolveBatchTypes, selectAttestable, selectPickerCandidates, selectStaleCandidates } from "./verify/select.js";
39
37
  import { inspectDrift, loadPickerCandidates, loadPreviews, loadStaleCandidates, runRevoke, runRevokeIds, runVerify, runVerifyBatch, runVerifyIds } from "./verify/run.js";
38
+ import { resolveBatchTypes, selectAttestable, selectPickerCandidates, selectStaleCandidates } from "./verify/select.js";
39
+ import { ENGINE_VERSION } from "./version.js";
40
40
 
41
41
  export { BundleSession, CONFIG_RELATIVE_PATH, ConceptQuery, ConceptSummary, ConfigMalformedError, ConfigPathNotFoundError, ContextEnvelope, ContextField, ContextFieldValue, ContextTag, ContextTrust, ContextType, DEFAULT_PROFILE_NAME, DistributionField, DocumentPathError, ENGINE_VERSION, ExternalReferences, FrontmatterEdits, GraphEdgeEnvelope, GraphEnvelope, GraphNodeEnvelope, GraphSummary, InitOverwriteError, JsonDiagnostic, JsonEnvelope, JsonErrorEnvelope, JsonSummary, MoveEnvelope, MoveError, NotAPublicationError, Now, OkfitPlatform, OverlayDocuments, PublicationEnvelope, PublicationNotFoundError, QueryConceptNotFoundError, QueryGetEnvelope, QueryLink, QueryListEnvelope, QueryNeighbor, QueryNeighborsEnvelope, QuerySelectionError, QueryUnknownVocabularyError, ReferenceCheck, ReferenceState, RevokeEnvelope, SkipReason, StaleEnvelope, StaleItem, StaleSummary, SyncEnvelope, SyncModeEnvelope, SyncPlanStaleError, SyncPublicationConflictError, TargetFailure, TargetResolutionError, Targets, TrustDrift, UnsupportedFrontmatterError, VerifyBatchEnvelope, VerifyConceptNotFoundError, VerifyContentUnhashableError, VerifyEnvelope, VerifyNothingToRevokeError, VerifySelectionError, VerifyUnsupportedFrontmatterError, applySyncPlan, buildConfigLayer, changeSince, collect, conceptFor, configValue, contextEnvelope, files, forDiagnostics, graphEnvelope, inspectDrift, json, jsonError, layerOverlayFileSystem, loadPickerCandidates, loadPreviews, loadStaleCandidates, makeOverlayFileSystem, moveEnvelope, planMove, planSync, provideConfig, provideDocuments, queryGetEnvelope, queryListEnvelope, queryNeighborsEnvelope, referencesOf, resolveBatchTypes, resolveBundleRoot, resolveDocumentPath, resolveProjectConfig, resolveProjectRoot, revokeEnvelope, rewriteReference, run, runContext, runContextTrust, runGraph, runMove, runRevoke, runRevokeIds, runStale, runSync, runVerify, runVerifyBatch, runVerifyIds, selectAttestable, selectPickerCandidates, selectStaleCandidates, signalFor, sort, staleEnvelope, stampPublication, syncEnvelope, tally, targetPaths, toConceptSummary, toTrustDrift, verifyBatchEnvelope, verifyEnvelope, withFallbackRange };
package/move/run.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { MoveError } from "../errors.js";
2
- import { referencesOf, rewriteReference } from "./references.js";
3
2
  import { writeAtomic } from "../sync/write.js";
4
3
  import { Targets } from "../targets/resolve.js";
4
+ import { referencesOf, rewriteReference } from "./references.js";
5
5
  import { Bundle, ConceptId } from "@okfit/core";
6
6
  import { Effect, FileSystem, Option, Path } from "effect";
7
7
  import { Trust } from "@okfit/profiles";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okfit/engine",
3
- "version": "0.19.0",
3
+ "version": "0.20.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,24 +34,25 @@
34
34
  "./package.json": "./package.json"
35
35
  },
36
36
  "dependencies": {
37
- "@effect/platform-node": "~4.1.1",
38
- "@effected/app": "^0.30.0",
39
- "@effected/config-file": "^0.23.0",
40
- "@effected/engine": "^0.11.0",
41
- "@effected/git": "^0.29.0",
42
- "@effected/glob": "^0.17.0",
43
- "@effected/jsonc": "^0.22.0",
44
- "@effected/markdown": "^0.25.0",
45
- "@effected/schemastore": "^0.28.0",
46
- "@effected/source": "^0.2.0",
47
- "@effected/store": "^0.22.0",
48
- "@effected/toml": "^0.18.0",
49
- "@effected/walker": "^0.24.0",
50
- "@effected/xdg": "^0.18.0",
51
- "@effected/yaml": "^0.27.0",
52
- "@okfit/core": "0.12.0",
53
- "@okfit/profiles": "0.14.0",
54
- "effect": "~4.1.1"
37
+ "@effect/platform-node": "~4.1.2",
38
+ "@effected/app": "^0.31.1",
39
+ "@effected/config-file": "^0.25.0",
40
+ "@effected/files": "^0.1.0",
41
+ "@effected/git": "^0.30.0",
42
+ "@effected/glob": "^0.19.0",
43
+ "@effected/jsonc": "^0.24.0",
44
+ "@effected/kit": "^0.13.0",
45
+ "@effected/markdown": "^0.27.0",
46
+ "@effected/schemastore": "^0.30.0",
47
+ "@effected/source": "^0.4.0",
48
+ "@effected/store": "^0.24.0",
49
+ "@effected/toml": "^0.19.1",
50
+ "@effected/walker": "^0.25.1",
51
+ "@effected/xdg": "^0.19.1",
52
+ "@effected/yaml": "^0.29.0",
53
+ "@okfit/core": "0.13.0",
54
+ "@okfit/profiles": "0.14.2",
55
+ "effect": "~4.1.2"
55
56
  },
56
57
  "engines": {
57
58
  "node": ">=24.11.0"
@@ -1,4 +1,4 @@
1
- import { DistributionField } from "@effected/engine";
1
+ import { DistributionField } from "@effected/kit";
2
2
 
3
3
  // src/render/distribution.ts
4
4
  /** Every envelope's `distribution` field: a `Distribution` or `null`. @public */
package/render/graph.js CHANGED
@@ -1,5 +1,5 @@
1
- import { DistributionField } from "./distribution.js";
2
1
  import { ENGINE_VERSION } from "../version.js";
2
+ import { DistributionField } from "./distribution.js";
3
3
  import { Schema } from "effect";
4
4
 
5
5
  // src/render/graph.ts
package/render/json.js CHANGED
@@ -1,10 +1,10 @@
1
+ import { ENGINE_VERSION } from "../version.js";
1
2
  import { DistributionField as DistributionField$1 } from "./distribution.js";
2
3
  import { tally } from "./exit.js";
3
- import { ENGINE_VERSION } from "../version.js";
4
4
  import { sort } from "./sort.js";
5
5
  import { DiagnosticRange, DiagnosticSeverity } from "@okfit/core";
6
6
  import { Runtime, Schema } from "effect";
7
- import { ErrorText } from "@effected/engine";
7
+ import { ErrorText } from "@effected/kit";
8
8
 
9
9
  // src/render/json.ts
10
10
  /** One entry of the `diagnostics` array (K-21). @public */
package/render/move.js CHANGED
@@ -1,5 +1,5 @@
1
- import { DistributionField } from "./distribution.js";
2
1
  import { ENGINE_VERSION } from "../version.js";
2
+ import { DistributionField } from "./distribution.js";
3
3
  import { Schema } from "effect";
4
4
 
5
5
  // src/render/move.ts
package/render/query.js CHANGED
@@ -1,5 +1,5 @@
1
- import { DistributionField } from "./distribution.js";
2
1
  import { ENGINE_VERSION } from "../version.js";
2
+ import { DistributionField } from "./distribution.js";
3
3
  import { Derive, GraphNodeKind, Status } from "@okfit/core";
4
4
  import { Schema } from "effect";
5
5
  import { DriftReason } from "@okfit/profiles";
package/render/stale.js CHANGED
@@ -1,5 +1,5 @@
1
- import { DistributionField } from "./distribution.js";
2
1
  import { ENGINE_VERSION } from "../version.js";
2
+ import { DistributionField } from "./distribution.js";
3
3
  import { DateTime, Schema } from "effect";
4
4
 
5
5
  // src/render/stale.ts
package/render/sync.js CHANGED
@@ -1,6 +1,6 @@
1
- import { DistributionField } from "./distribution.js";
2
- import { ENGINE_VERSION } from "../version.js";
3
1
  import { SkipReason } from "../sync/run.js";
2
+ import { ENGINE_VERSION } from "../version.js";
3
+ import { DistributionField } from "./distribution.js";
4
4
  import { Schema } from "effect";
5
5
 
6
6
  // src/render/sync.ts
package/render/verify.js CHANGED
@@ -1,5 +1,5 @@
1
- import { DistributionField } from "./distribution.js";
2
1
  import { ENGINE_VERSION } from "../version.js";
2
+ import { DistributionField } from "./distribution.js";
3
3
  import { Status } from "@okfit/core";
4
4
  import { Schema } from "effect";
5
5
  import { DriftReason } from "@okfit/profiles";
package/sync/generated.js CHANGED
@@ -1,7 +1,7 @@
1
- import { detectNewline, locateGenerated, locateGeneratedBlock, stripBom } from "../verify/locate.js";
1
+ import { FrontmatterEdits } from "../edits/FrontmatterEdits.js";
2
2
  import { locateIntegrity, locateLegacyBodySha256, removeLine, spliceIntegrityGenerated } from "../verify/integrity.js";
3
+ import { detectNewline, locateGenerated, locateGeneratedBlock, stripBom } from "../verify/locate.js";
3
4
  import { mergeSameOffset, spliceGenerated, spliceGeneratedBlock } from "../verify/splice.js";
4
- import { FrontmatterEdits } from "../edits/FrontmatterEdits.js";
5
5
  import { writeAtomic } from "./write.js";
6
6
  import { Timestamp } from "@okfit/core";
7
7
  import { Effect, FileSystem, Path, Schema } from "effect";
package/sync/run.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { SyncPlanStaleError } from "../errors.js";
2
- import { writeAtomic } from "./write.js";
3
2
  import { syncGenerated } from "./generated.js";
4
3
  import { syncIndex } from "./index.js";
5
4
  import { logWindow, syncLog, wantsLogEntry } from "./log.js";
5
+ import { writeAtomic } from "./write.js";
6
6
  import { Bundle, Derive } from "@okfit/core";
7
7
  import { DateTime, Effect, FileSystem, Option, Path, Schema } from "effect";
8
8
  import { Derivation } from "@okfit/profiles";
package/sync/write.js CHANGED
@@ -1,47 +1,19 @@
1
- import { Effect, FileSystem, Option, Path } from "effect";
2
- import { SecureRandom } from "effect/crypto";
1
+ import { Effect } from "effect";
2
+ import { AtomicFile } from "@effected/files";
3
3
 
4
4
  // src/sync/write.ts
5
5
  /**
6
- * S-33: the one atomic write every sync mode shares. Resolves `target`'s
7
- * real path first when it already exists (so a symlinked
8
- * `index.md`/`log.md`/concept file is replaced by writing through the
9
- * link rather than over it -- `generated` mode's own discipline, formerly
10
- * not shared with `index`/`log`) and falls back to `target` itself for a
11
- * file `sync` is about to create for the first time (`index`/`log` modes
12
- * both write files that may not exist yet; `generated` mode's targets
13
- * always exist, since they come from an already-loaded concept). Writes
14
- * `contents` to a uniquely-scoped temp file beside the resolved target (so
15
- * two concurrent `sync` runs never collide on a fixed name), preserves an
16
- * existing target's mode via `stat` + `chmod` (a brand-new file keeps
17
- * whatever mode `writeFileString` gives it), and renames the temp file
18
- * over the target. On any failure -- including a failed `rename` -- the
19
- * temp file is removed (`Effect.onError`), so a partial write never
20
- * leaves a stray `<file>.okfit-sync.<token>.tmp` behind (F-5/S-33).
21
- *
22
- * DISCREPANCY from S-33's literal "the temp name carries the pid": `src/`
23
- * outside `bin.ts`/`commands/*`/`internal/exit.ts`/`internal/tty.ts` never
24
- * reads the global `process` (K-39, enforced by `__test__/boundaries.test.ts`),
25
- * and `sync/write.ts` is not on that allowlist. A random UUIDv4 token
26
- * (`SecureRandom.uuidV4Unsafe` from `effect/crypto`, not `process`) satisfies S-33's actual requirement --
27
- * two concurrent `sync` runs never collide on a fixed temp name -- without
28
- * widening the process-access boundary for one helper. Recorded here per
29
- * the Global Constraints' "record the discrepancy" instruction.
6
+ * S-33: the one atomic write every sync mode shares, over the kit's
7
+ * `AtomicFile.write`. A symlinked `index.md`/`log.md`/concept file is written
8
+ * through its link, an existing file keeps its mode, a file `sync` creates for
9
+ * the first time is simply created, and a failure at any step leaves the
10
+ * target untouched with no temp file behind. A target without write permission
11
+ * is refused rather than replaced.
30
12
  *
31
13
  * @internal
32
14
  */
33
15
  const writeAtomic = Effect.fn("okfit/sync/writeAtomic")(function* (target, contents) {
34
- const fs = yield* FileSystem.FileSystem;
35
- const path = yield* Path.Path;
36
- const resolved = yield* fs.realPath(target).pipe(Effect.catchReason("PlatformError", "NotFound", () => Effect.succeed(target)));
37
- const dir = path.dirname(resolved);
38
- const base = path.basename(resolved);
39
- const tempPath = path.join(dir, `${base}.okfit-sync.${SecureRandom.uuidV4Unsafe()}.tmp`);
40
- const originalMode = yield* fs.stat(resolved).pipe(Effect.map((info) => Option.some(info.mode)), Effect.catchReason("PlatformError", "NotFound", () => Effect.succeed(Option.none())));
41
- yield* fs.writeFileString(tempPath, contents).pipe(Effect.tap(() => Option.match(originalMode, {
42
- onNone: () => Effect.void,
43
- onSome: (mode) => fs.chmod(tempPath, mode)
44
- })), Effect.tap(() => fs.rename(tempPath, resolved)), Effect.onError(() => fs.remove(tempPath, { force: true }).pipe(Effect.ignore)));
16
+ yield* AtomicFile.write(target, contents);
45
17
  });
46
18
 
47
19
  export { writeAtomic };
@@ -3,21 +3,9 @@ import { relativeInside } from "./inside.js";
3
3
  import { ConceptId } from "@okfit/core";
4
4
  import { Effect, FileSystem, Option, Path } from "effect";
5
5
  import { posix } from "node:path";
6
+ import { EditDistance } from "@effected/source";
6
7
 
7
8
  // src/targets/resolve.ts
8
- const levenshtein = (a, b) => {
9
- const row = Array.from({ length: b.length + 1 }, (_, i) => i);
10
- for (let i = 1; i <= a.length; i++) {
11
- let previous = row[0] ?? 0;
12
- row[0] = i;
13
- for (let j = 1; j <= b.length; j++) {
14
- const current = row[j] ?? 0;
15
- row[j] = Math.min(current + 1, (row[j - 1] ?? 0) + 1, previous + (a[i - 1] === b[j - 1] ? 0 : 1));
16
- previous = current;
17
- }
18
- }
19
- return row[b.length] ?? 0;
20
- };
21
9
  const suggest = (arg, bundle) => {
22
10
  const wanted = Option.getOrUndefined(ConceptId.normalize(arg));
23
11
  if (wanted === void 0) return void 0;
@@ -25,16 +13,7 @@ const suggest = (arg, bundle) => {
25
13
  const base = posix.basename(wanted);
26
14
  const byBase = ids.filter((id) => posix.basename(id) === base);
27
15
  if (byBase.length === 1) return byBase[0];
28
- const limit = Math.max(2, Math.floor(wanted.length / 3));
29
- let best;
30
- for (const id of ids) {
31
- const distance = levenshtein(wanted, id);
32
- if (distance <= limit && (best === void 0 || distance < best.distance)) best = {
33
- id,
34
- distance
35
- };
36
- }
37
- return best?.id;
16
+ return EditDistance.suggest(wanted, ids, { maxDistance: Math.max(2, Math.floor(wanted.length / 3)) })[0];
38
17
  };
39
18
  const withSuggestion = (arg, bundle) => {
40
19
  const suggestion = suggest(arg, bundle);
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.60.0"
8
+ "packageVersion": "7.60.1"
9
9
  }
10
10
  ]
11
11
  }
package/verify/run.js CHANGED
@@ -1,14 +1,15 @@
1
1
  import { VerifyConceptNotFoundError, VerifyContentUnhashableError, VerifyNothingToRevokeError, VerifyUnsupportedFrontmatterError } from "../errors.js";
2
- import { documentNewline, locate, locateTopLevelScalar, locateVerifiedAt, stripBom } from "./locate.js";
3
- import { locateIntegrity, removeIntegrityVerified, spliceIntegrityVerified } from "./integrity.js";
4
- import { orderVerifyEdits, quoteLike, splice, spliceTopLevelScalar } from "./splice.js";
5
2
  import { changeSince } from "./diff.js";
3
+ import { locateIntegrity, removeIntegrityVerified, spliceIntegrityVerified } from "./integrity.js";
4
+ import { documentNewline, locate, locateTopLevelScalar, locateVerifiedAt, stripBom } from "./locate.js";
6
5
  import { locateVerifiedEntries } from "./revoke.js";
7
6
  import { resolveBatchTypes, selectAttestable, selectPickerCandidates, selectStaleCandidates } from "./select.js";
7
+ import { orderVerifyEdits, quoteLike, splice, spliceTopLevelScalar } from "./splice.js";
8
8
  import { Bundle, ConceptId, Derive, Timestamp } from "@okfit/core";
9
9
  import { DateTime, Effect, FileSystem, Option, Path, Schema } from "effect";
10
10
  import { Derivation, Trust } from "@okfit/profiles";
11
11
  import { MarkdownEdit } from "@effected/markdown";
12
+ import { AtomicFile } from "@effected/files";
12
13
 
13
14
  // src/verify/run.ts
14
15
  /**
@@ -106,13 +107,7 @@ const prepareVerify = Effect.fn("okfit/verify/prepareVerify")(function* (bundle,
106
107
  });
107
108
  /** The I4/V-16 atomic write: real path, temp beside it, mode preserved, rename. */
108
109
  const writeVerified = Effect.fn("okfit/verify/writeVerified")(function* (absolutePath, finalText) {
109
- const fs = yield* FileSystem.FileSystem;
110
- const target = yield* fs.realPath(absolutePath);
111
- const tempPath = `${target}.okfit-verify.tmp`;
112
- const original = yield* fs.stat(target);
113
- yield* fs.writeFileString(tempPath, finalText);
114
- yield* fs.chmod(tempPath, original.mode);
115
- yield* fs.rename(tempPath, target).pipe(Effect.onError(() => fs.remove(tempPath, { force: true }).pipe(Effect.ignore)));
110
+ yield* AtomicFile.write(absolutePath, finalText);
116
111
  });
117
112
  /** Steps 7a-7d of runVerify, shared with `runVerifyIds`: tolerant id, reserved file, located concept. */
118
113
  const resolveConcept = (bundle, rawId) => Effect.gen(function* () {
package/version.js CHANGED
@@ -11,6 +11,6 @@
11
11
  *
12
12
  * @public
13
13
  */
14
- const ENGINE_VERSION = "0.19.0";
14
+ const ENGINE_VERSION = "0.20.0";
15
15
 
16
16
  export { ENGINE_VERSION };