@okfit/engine 0.16.5 → 0.18.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/layer.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ConfigMalformedError, ConfigPathNotFoundError } from "../errors.js";
2
2
  import { AppConfig } from "@effected/app";
3
- import { ConfigCodecError, ConfigResolver, ConfigValidationError, MergeStrategy, TomlCodec } from "@effected/config-file";
3
+ import { ConfigCodecError, ConfigResolver, ConfigValidationError, MergeStrategy } from "@effected/config-file";
4
+ import { TomlCodec } from "@effected/config-file/toml";
4
5
  import { OkfitConfig, OkfitConfigFile } from "@okfit/core";
5
6
  import { Cause, Effect, FileSystem, Option, Result } from "effect";
6
7
 
package/errors.js CHANGED
@@ -128,20 +128,6 @@ var ConfigMalformedError = class extends Schema.TaggedError()("ConfigMalformedEr
128
128
  }
129
129
  };
130
130
  /**
131
- * Issue #140: `sync --staged` stamps the git index with a caller-given
132
- * instant instead of walking history, but a log group's date must come
133
- * from a commit, never from that stamp time -- so `runSync` refuses to
134
- * combine `staged` with log mode rather than write a fabricated date.
135
- *
136
- * @public
137
- */
138
- var SyncStagedLogError = class extends Schema.TaggedError()("SyncStagedLogError", {}) {
139
- [Runtime.errorExitCode] = 64;
140
- get message() {
141
- return "--staged cannot run log mode: a log group's date must come from a commit, not from the stamp time; use --only generated and/or --only index";
142
- }
143
- };
144
- /**
145
131
  * `applySyncPlan` found a file its plan would write changed since `planSync`
146
132
  * read it, so applying the plan would overwrite an edit the plan never showed.
147
133
  * Nothing was written. `paths` are the changed targets (absolute); re-run sync.
@@ -348,4 +334,4 @@ var MoveError = class extends Schema.TaggedError()("MoveError", {
348
334
  }
349
335
  };
350
336
 
351
- export { ConfigMalformedError, ConfigPathNotFoundError, DocumentPathError, InitOverwriteError, MoveError, QueryConceptNotFoundError, QuerySelectionError, QueryUnknownVocabularyError, SyncPlanStaleError, SyncPublicationConflictError, SyncStagedLogError, TargetFailure, TargetResolutionError, VerifyConceptNotFoundError, VerifyNothingToRevokeError, VerifySelectionError, VerifyUnsupportedFrontmatterError };
337
+ export { ConfigMalformedError, ConfigPathNotFoundError, DocumentPathError, InitOverwriteError, MoveError, QueryConceptNotFoundError, QuerySelectionError, QueryUnknownVocabularyError, SyncPlanStaleError, SyncPublicationConflictError, TargetFailure, TargetResolutionError, VerifyConceptNotFoundError, VerifyNothingToRevokeError, VerifySelectionError, VerifyUnsupportedFrontmatterError };
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ import { AppDirs, AppDirs as AppDirs$1, Xdg, Xdg as Xdg$1, XdgEnvError } from "@effected/xdg";
1
2
  import { Actor, BundleLoadError, ConceptId, Diagnostic, DiagnosticRange, DiagnosticSeverity, GraphLink, GraphNode, GraphNodeKind, LinkGraph, LoadedBundle, LoadedConcept, OkfitConfig, OkfitConfigFile, PathField, StaleConcept, Status, ValidationReport } from "@okfit/core";
2
3
  import { Context, Crypto, DateTime, Effect, FileSystem, Layer, Option, Path, PlatformError, Result, Runtime, Schema } from "effect";
3
- import { AppDirs, Xdg } from "@effected/xdg";
4
4
  import { ConfigReadError } from "@effected/config-file";
5
5
  import { ConceptSignal, DriftReason, GeneratedAtError, GitHistory, GitHistoryError, IntegrityState, Layout, Profile, ProfileDiagnostic } from "@okfit/profiles";
6
6
  import { FrontmatterWriteError, MarkdownEdit, MarkdownParseError } from "@effected/markdown";
@@ -173,19 +173,6 @@ export declare class ConfigMalformedError extends ConfigMalformedError_base {
173
173
  readonly [Runtime.errorExitCode] = 3;
174
174
  get message(): string;
175
175
  }
176
- declare const SyncStagedLogError_base: Schema.Class<SyncStagedLogError, Schema.TaggedStruct<"SyncStagedLogError", {}>, import("effect/Cause").YieldableError>;
177
- /**
178
- * Issue #140: `sync --staged` stamps the git index with a caller-given
179
- * instant instead of walking history, but a log group's date must come
180
- * from a commit, never from that stamp time -- so `runSync` refuses to
181
- * combine `staged` with log mode rather than write a fabricated date.
182
- *
183
- * @public
184
- */
185
- export declare class SyncStagedLogError extends SyncStagedLogError_base {
186
- readonly [Runtime.errorExitCode] = 64;
187
- get message(): string;
188
- }
189
176
  declare const SyncPlanStaleError_base: Schema.Class<SyncPlanStaleError, Schema.TaggedStruct<"SyncPlanStaleError", {
190
177
  readonly paths: Schema.$Array<Schema.String>;
191
178
  }>, import("effect/Cause").YieldableError>;
@@ -380,7 +367,7 @@ export declare const buildConfigLayer: (options: {
380
367
  * in test environments. No production call site sets it.
381
368
  */
382
369
  readonly systemConfigDir?: string;
383
- }) => Layer.Layer<OkfitConfigFile, never, FileSystem.FileSystem | Path.Path | AppDirs | Xdg>;
370
+ }) => Layer.Layer<OkfitConfigFile, never, FileSystem.FileSystem | Path.Path | AppDirs$1 | Xdg$1>;
384
371
  /**
385
372
  * The K-1 pre-flight and the provide, in that order and in one place: stat
386
373
  * `explicitConfigPath` with `FileSystem.exists` and fail with
@@ -419,7 +406,7 @@ export declare const provideConfig: (options: {
419
406
  readonly explicitConfigPath: Option.Option<string>;
420
407
  readonly discoveryCwd: string;
421
408
  readonly systemConfigDir?: string;
422
- }) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E | ConfigPathNotFoundError | ConfigMalformedError | PlatformError.PlatformError, Exclude<R, OkfitConfigFile> | FileSystem.FileSystem | Path.Path | AppDirs | Xdg>;
409
+ }) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E | ConfigPathNotFoundError | ConfigMalformedError | PlatformError.PlatformError, Exclude<R, OkfitConfigFile> | FileSystem.FileSystem | Path.Path | AppDirs$1 | Xdg$1>;
423
410
  /**
424
411
  * `OkfitConfig.DEFAULTS.bundle.profile` is `"software-project"` at runtime
425
412
  * (the frozen literal always sets it), but `bundle` and `profile` are both
@@ -906,7 +893,7 @@ export declare const layerOverlayFileSystem: Layer.Layer<FileSystem.FileSystem,
906
893
  *
907
894
  * @public
908
895
  */
909
- export declare const OkfitPlatform: Layer.Layer<AppDirs | Xdg | NodeServices.NodeServices, import("@effected/xdg").XdgEnvError, never>;
896
+ export declare const OkfitPlatform: Layer.Layer<AppDirs$1 | Xdg$1 | NodeServices.NodeServices, import("@effected/xdg").XdgEnvError, never>;
910
897
  /**
911
898
  * Filter for {@link ConceptQuery.list}. Every field is optional; an absent
912
899
  * field does not constrain.
@@ -1371,7 +1358,7 @@ export type JsonEnvelope = typeof JsonEnvelope.Type;
1371
1358
  /**
1372
1359
  * K-22's envelope: the ONLY thing stdout carries under `--format json` on an
1373
1360
  * infrastructure failure. `exit_code` is `3` for most errors, or `64` for the
1374
- * usage-tier errors (`SyncStagedLogError`, `VerifySelectionError`) that carry
1361
+ * usage-tier errors (`VerifySelectionError` and the like) that carry
1375
1362
  * their own `[Runtime.errorExitCode]`.
1376
1363
  *
1377
1364
  * @public
@@ -1765,7 +1752,7 @@ interface SyncOptions {
1765
1752
  readonly dryRun: boolean;
1766
1753
  /** Issue #18: log mode's inclusive floor (`YYYY-MM-DD`); default is the newest logged date. */
1767
1754
  readonly logSince?: string;
1768
- /** Issue #140: stamp the concepts in the git index with this instant instead of walking history; log mode must not be selected. */
1755
+ /** Issue #140: stamp the concepts in the git index with this instant instead of walking history. Issue #295: log mode dates their entries with the same instant. */
1769
1756
  readonly staged?: {
1770
1757
  readonly at: DateTime.Utc;
1771
1758
  };
@@ -1821,7 +1808,7 @@ interface SyncPlan {
1821
1808
  *
1822
1809
  * @public
1823
1810
  */
1824
- export declare const planSync: (options: SyncOptions) => Effect.Effect<SyncPlan, BundleLoadError | GeneratedAtError | SyncStagedLogError, Git | GitHistory | FileSystem.FileSystem | Path.Path | Crypto.Crypto>;
1811
+ export declare const planSync: (options: SyncOptions) => Effect.Effect<SyncPlan, BundleLoadError | GeneratedAtError, Git | GitHistory | FileSystem.FileSystem | Path.Path | Crypto.Crypto>;
1825
1812
  /**
1826
1813
  * Performs exactly the writes a {@link SyncPlan} recorded (atomically, in plan
1827
1814
  * order), then the `--staged` re-add, and returns the non-dry-run
@@ -1844,7 +1831,7 @@ export declare const applySyncPlan: (plan: SyncPlan) => Effect.Effect<{
1844
1831
  *
1845
1832
  * @public
1846
1833
  */
1847
- export declare const runSync: (options: SyncOptions) => Effect.Effect<SyncResult, BundleLoadError | GeneratedAtError | SyncStagedLogError | SyncPlanStaleError, Git | GitHistory | FileSystem.FileSystem | Path.Path | Crypto.Crypto>;
1834
+ export declare const runSync: (options: SyncOptions) => Effect.Effect<SyncResult, BundleLoadError | GeneratedAtError | SyncPlanStaleError, Git | GitHistory | FileSystem.FileSystem | Path.Path | Crypto.Crypto>;
1848
1835
  /** @public */
1849
1836
  export declare const SyncModeEnvelope: Schema.Struct<{
1850
1837
  readonly selected: Schema.Boolean;
@@ -2894,5 +2881,5 @@ export declare const loadPreviews: (candidates: readonly PickerCandidate[]) => E
2894
2881
  * @public
2895
2882
  */
2896
2883
  export declare const ENGINE_VERSION: string;
2897
- export type { AttestableSelection, BundleSessionOptions, BundleSessionServices, BundleSessionShape, ChangeSince, ConceptFilter, ConceptLink, ConceptNeighbor, ContextResult, ContextRunOptions, ContextTrustOptions, DiagnosticSource, DiscoveredConfig, Distribution, DocumentInput, DriftInspection, ExternalReferencesShape, GraphRunOptions, GraphRunResult, MovePlan, OverlayDocument, OverlayDocumentsShape, PendingWrite, PickerCandidate, PickerCandidatesOptions, PlanError, PlanMoveOptions, Reference, RenderedDiagnostic, ResolveProjectConfigInput, ResolvedProjectConfig, ResolvedTarget, RevalidateError, RevalidateOptions, RevalidateResult, RevalidateTier, RevokeIdsOptions, RevokeOptions, RevokeResult, RunMoveOptions, RunOptions, RunResult, ScaffoldFile, ScaffoldOptions, StaleRunOptions, StaleRunResult, SyncMode, SyncModeResult, SyncOptions, SyncPlan, SyncResult, Tally, UnlocatableReference, VerifyBatchOptions, VerifyBatchResult, VerifyBatchSkipReason, VerifyIdsOptions, VerifyOptions, VerifyResult, WatchedFilesOutcome };
2884
+ export type { AppDirs, AttestableSelection, BundleSessionOptions, BundleSessionServices, BundleSessionShape, ChangeSince, ConceptFilter, ConceptLink, ConceptNeighbor, ContextResult, ContextRunOptions, ContextTrustOptions, DiagnosticSource, DiscoveredConfig, Distribution, DocumentInput, DriftInspection, ExternalReferencesShape, GraphRunOptions, GraphRunResult, MovePlan, OverlayDocument, OverlayDocumentsShape, PendingWrite, PickerCandidate, PickerCandidatesOptions, PlanError, PlanMoveOptions, Reference, RenderedDiagnostic, ResolveProjectConfigInput, ResolvedProjectConfig, ResolvedTarget, RevalidateError, RevalidateOptions, RevalidateResult, RevalidateTier, RevokeIdsOptions, RevokeOptions, RevokeResult, RunMoveOptions, RunOptions, RunResult, ScaffoldFile, ScaffoldOptions, StaleRunOptions, StaleRunResult, SyncMode, SyncModeResult, SyncOptions, SyncPlan, SyncResult, Tally, UnlocatableReference, VerifyBatchOptions, VerifyBatchResult, VerifyBatchSkipReason, VerifyIdsOptions, VerifyOptions, VerifyResult, WatchedFilesOutcome, Xdg, XdgEnvError };
2898
2885
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { resolveBundleRoot, resolveProjectRoot } from "./config/anchor.js";
2
- import { ConfigMalformedError, ConfigPathNotFoundError, DocumentPathError, InitOverwriteError, MoveError, QueryConceptNotFoundError, QuerySelectionError, QueryUnknownVocabularyError, SyncPlanStaleError, SyncPublicationConflictError, SyncStagedLogError, TargetFailure, TargetResolutionError, VerifyConceptNotFoundError, VerifyNothingToRevokeError, VerifySelectionError, VerifyUnsupportedFrontmatterError } from "./errors.js";
2
+ import { ConfigMalformedError, ConfigPathNotFoundError, DocumentPathError, InitOverwriteError, MoveError, QueryConceptNotFoundError, QuerySelectionError, QueryUnknownVocabularyError, SyncPlanStaleError, SyncPublicationConflictError, TargetFailure, TargetResolutionError, VerifyConceptNotFoundError, VerifyNothingToRevokeError, VerifySelectionError, VerifyUnsupportedFrontmatterError } from "./errors.js";
3
3
  import { buildConfigLayer, provideConfig } from "./config/layer.js";
4
4
  import { DEFAULT_PROFILE_NAME, resolveProjectConfig } from "./config/resolve.js";
5
5
  import { runContext } from "./context/run.js";
@@ -38,4 +38,4 @@ import { changeSince } from "./verify/diff.js";
38
38
  import { resolveBatchTypes, selectAttestable, selectPickerCandidates, selectStaleCandidates } from "./verify/select.js";
39
39
  import { inspectDrift, loadPickerCandidates, loadPreviews, loadStaleCandidates, runRevoke, runRevokeIds, runVerify, runVerifyBatch, runVerifyIds } from "./verify/run.js";
40
40
 
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, SyncStagedLogError, TargetFailure, TargetResolutionError, Targets, TrustDrift, UnsupportedFrontmatterError, VerifyBatchEnvelope, VerifyConceptNotFoundError, 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 };
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, 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okfit/engine",
3
- "version": "0.16.5",
3
+ "version": "0.18.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": [
@@ -35,21 +35,21 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@effect/platform-node": "^4.0.6",
38
- "@effected/app": "^0.26.0",
39
- "@effected/config-file": "^0.19.1",
38
+ "@effected/app": "^0.27.1",
39
+ "@effected/config-file": "^0.20.1",
40
40
  "@effected/engine": "^0.8.0",
41
- "@effected/git": "^0.25.0",
41
+ "@effected/git": "^0.25.1",
42
42
  "@effected/glob": "^0.14.0",
43
43
  "@effected/jsonc": "^0.20.0",
44
- "@effected/markdown": "^0.22.0",
45
- "@effected/schemastore": "^0.26.1",
46
- "@effected/store": "^0.18.0",
44
+ "@effected/markdown": "^0.23.0",
45
+ "@effected/schemastore": "^0.26.2",
46
+ "@effected/store": "^0.19.0",
47
47
  "@effected/toml": "^0.16.0",
48
- "@effected/walker": "^0.19.0",
49
- "@effected/xdg": "^0.14.1",
50
- "@effected/yaml": "^0.25.0",
51
- "@okfit/core": "0.11.5",
52
- "@okfit/profiles": "0.10.6",
48
+ "@effected/walker": "^0.20.1",
49
+ "@effected/xdg": "^0.15.1",
50
+ "@effected/yaml": "^0.25.1",
51
+ "@okfit/core": "0.11.6",
52
+ "@okfit/profiles": "0.11.0",
53
53
  "effect": "^4.0.6"
54
54
  },
55
55
  "engines": {
package/render/json.js CHANGED
@@ -62,7 +62,7 @@ const JsonEnvelope = Schema.Struct({
62
62
  /**
63
63
  * K-22's envelope: the ONLY thing stdout carries under `--format json` on an
64
64
  * infrastructure failure. `exit_code` is `3` for most errors, or `64` for the
65
- * usage-tier errors (`SyncStagedLogError`, `VerifySelectionError`) that carry
65
+ * usage-tier errors (`VerifySelectionError` and the like) that carry
66
66
  * their own `[Runtime.errorExitCode]`.
67
67
  *
68
68
  * @public
package/sync/run.js CHANGED
@@ -1,10 +1,10 @@
1
- import { SyncPlanStaleError, SyncStagedLogError } from "../errors.js";
1
+ import { SyncPlanStaleError } from "../errors.js";
2
2
  import { writeAtomic } from "./write.js";
3
3
  import { syncGenerated } from "./generated.js";
4
4
  import { syncIndex } from "./index.js";
5
5
  import { logWindow, syncLog, wantsLogEntry } from "./log.js";
6
6
  import { Bundle, Derive } from "@okfit/core";
7
- import { DateTime, Effect, FileSystem, Path, Schema } from "effect";
7
+ import { DateTime, Effect, FileSystem, Option, Path, Schema } from "effect";
8
8
  import { Derivation } from "@okfit/profiles";
9
9
  import { Git } from "@effected/git";
10
10
 
@@ -50,24 +50,27 @@ const UNSELECTED = {
50
50
  */
51
51
  const planSync = Effect.fn("okfit/sync/planSync")(function* (options) {
52
52
  const bundle = yield* Bundle.load({ root: options.bundleRoot });
53
- if (options.staged !== void 0 && options.modes.has("log")) return yield* new SyncStagedLogError({});
54
53
  const walked = /* @__PURE__ */ new Map();
55
54
  let staged;
56
55
  let scope;
57
56
  let repoRoot;
58
57
  let realPaths;
58
+ let stagedLog;
59
+ let logDirty = false;
59
60
  if (options.staged !== void 0) {
60
61
  const git = yield* Git;
61
62
  const fs = yield* FileSystem.FileSystem;
62
63
  const path = yield* Path.Path;
63
- repoRoot = yield* fs.realPath(yield* git.repoRoot(bundle.root));
64
+ repoRoot = yield* fs.realPath((yield* Derivation.worktreeRoot(bundle.root)) ?? (yield* git.repoRoot(bundle.root)));
64
65
  const stagedPaths = new Set(yield* git.stagedChanges(repoRoot));
65
66
  const selected = /* @__PURE__ */ new Set();
66
67
  const provenanceStaged = /* @__PURE__ */ new Map();
67
68
  const resolvedPaths = /* @__PURE__ */ new Map();
69
+ const logProvenance = /* @__PURE__ */ new Map();
70
+ const root = repoRoot;
68
71
  for (const [id, concept] of bundle.concepts) {
69
72
  const real = yield* fs.realPath(path.join(bundle.root, concept.path));
70
- const rel = path.relative(repoRoot, real).split(path.sep).join("/");
73
+ const rel = path.relative(root, real).split(path.sep).join("/");
71
74
  if (!stagedPaths.has(rel)) continue;
72
75
  selected.add(id);
73
76
  provenanceStaged.set(id, {
@@ -75,8 +78,24 @@ const planSync = Effect.fn("okfit/sync/planSync")(function* (options) {
75
78
  at: options.staged.at
76
79
  });
77
80
  resolvedPaths.set(id, real);
81
+ if (options.modes.has("log")) {
82
+ const inHead = yield* git.show(root, "HEAD", rel).pipe(Effect.catchTag("UnknownRefError", () => Effect.succeed(Option.none())));
83
+ logProvenance.set(id, {
84
+ _tag: "committed",
85
+ at: options.staged.at,
86
+ creating: Option.isNone(inHead)
87
+ });
88
+ }
89
+ }
90
+ if (options.modes.has("log")) {
91
+ const logReal = yield* fs.realPath(path.join(bundle.root, "log.md")).pipe(Effect.catchReason("PlatformError", "NotFound", () => Effect.succeed(void 0)));
92
+ if (logReal !== void 0) {
93
+ const logRel = path.relative(root, logReal).split(path.sep).join("/");
94
+ logDirty = (yield* git.unstagedChanges(root)).includes(logRel);
95
+ }
78
96
  }
79
97
  staged = provenanceStaged;
98
+ stagedLog = logProvenance;
80
99
  scope = selected;
81
100
  realPaths = resolvedPaths;
82
101
  } else if (options.modes.has("generated") || options.modes.has("log")) {
@@ -105,15 +124,31 @@ const planSync = Effect.fn("okfit/sync/planSync")(function* (options) {
105
124
  ...yield* syncIndex(bundle, true, pending),
106
125
  migrated: []
107
126
  } : UNSELECTED;
108
- const log = options.modes.has("log") ? {
109
- ...yield* syncLog(bundle, walked, true, options.logSince, pending),
127
+ const log = !options.modes.has("log") ? UNSELECTED : logDirty ? {
128
+ selected: true,
129
+ written: [],
130
+ unchanged: [],
131
+ skipped: [{
132
+ id: "log.md",
133
+ reason: "dirty"
134
+ }],
110
135
  migrated: []
111
- } : UNSELECTED;
136
+ } : {
137
+ ...yield* syncLog(bundle, stagedLog ?? walked, true, options.logSince, pending),
138
+ migrated: []
139
+ };
112
140
  let restage;
113
141
  if (options.staged !== void 0 && repoRoot !== void 0) {
114
142
  const path = yield* Path.Path;
115
143
  const writtenIds = /* @__PURE__ */ new Set([...generated.written, ...generated.migrated]);
116
- const files = [...realPaths === void 0 ? [] : Array.from(realPaths.entries()).filter(([id]) => writtenIds.has(id)).map(([, real]) => real), ...index.written.map((relative) => path.join(bundle.root, relative))];
144
+ const fs = yield* FileSystem.FileSystem;
145
+ const realBundle = yield* fs.realPath(bundle.root);
146
+ const reserved = [];
147
+ for (const relative of [...index.written, ...log.written]) {
148
+ const target = path.join(realBundle, relative);
149
+ reserved.push(yield* fs.realPath(target).pipe(Effect.catchReason("PlatformError", "NotFound", () => Effect.succeed(target))));
150
+ }
151
+ const files = [...realPaths === void 0 ? [] : Array.from(realPaths.entries()).filter(([id]) => writtenIds.has(id)).map(([, real]) => real), ...reserved];
117
152
  if (files.length > 0) restage = {
118
153
  repoRoot,
119
154
  files
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.59.1"
8
+ "packageVersion": "7.59.4"
9
9
  }
10
10
  ]
11
11
  }
package/version.js CHANGED
@@ -11,6 +11,6 @@
11
11
  *
12
12
  * @public
13
13
  */
14
- const ENGINE_VERSION = "0.16.5";
14
+ const ENGINE_VERSION = "0.18.0";
15
15
 
16
16
  export { ENGINE_VERSION };