@patterkit/ops 0.3.6 → 0.5.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +48 -5
  2. package/dist/index.js +3172 -2814
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -80,17 +80,25 @@ interface ValidateResult {
80
80
  hygiene: HygieneIssue[];
81
81
  /** Committed `.patterc` bundles whose hash no longer matches source (spec §11). */
82
82
  staleBundles: HygieneIssue[];
83
+ /** Conditions provably unsatisfiable over monotonic latches (reachability.ts). WARNINGS, and
84
+ * deliberately NOT part of `ok`: content is written in pieces, so a gate whose writer has not been
85
+ * authored yet is the normal state mid-work and must never fail a build. */
86
+ reachability: ConditionIssue[];
83
87
  /** Lingering `.patterconflict` sidecars - an unresolved merge (patter-merge.md §3.6). */
84
88
  unresolvedMerges: HygieneIssue[];
89
+ /** Patter shards on disk that the project does NOT contain - see `orphanShards`. */
90
+ orphans: HygieneIssue[];
85
91
  ok: boolean;
86
92
  }
87
93
  /** Run structural + expression + interpolation + hygiene + bundle-staleness + merge validation. */
88
94
  declare function runValidate(loaded: LoadedProject): ValidateResult;
89
95
 
90
- /** Compile a loaded project to the runtime bundle, applying its build localisation mode (spec §11):
91
- * "embedded" (default) keeps every locale's strings inline; "ids" strips them so the runtime emits beat
92
- * IDs (the game localises). `sourceDebug` keeps only the SOURCE locale, embedded for debug playback and
93
- * flagged so the runtime warns it is not a shippable build. */
96
+ /**
97
+ * Conditions that can never hold, as warnings. Empty for a project with no monotonic latches, which is
98
+ * most of them: this only speaks when it can prove an ordering.
99
+ */
100
+ declare function reachabilityIssues(loaded: LoadedProject, compiled?: Bundle): ConditionIssue[];
101
+
94
102
  declare function runExport(loaded: LoadedProject): Bundle;
95
103
  /** Compile WITHOUT the localisation-mode transform - the full bundle with every locale inline. Used where
96
104
  * the host needs all strings regardless of build mode (e.g. Patterpad's Play window + Export Localisation). */
@@ -213,6 +221,19 @@ interface CoverageBeat {
213
221
  /** Set on a never-reached beat that is gated on a host-scope ref (`@world.x`) nothing writes and no
214
222
  * driver provides, i.e. it may just need an input, not be truly dead. Lists the offending refs. */
215
223
  needsInput?: string[];
224
+ /** Set on a never-reached beat gated on a ref that IS written, but ONLY by content that was itself
225
+ * never reached: the beat is dead at one remove, and the gate is not the real question. Names the
226
+ * ref and the beats that witness its only writers, so two mysteries collapse into one. Absent
227
+ * whenever the chain cannot be refuted (see `writerSites` in the analysis). */
228
+ blockedBy?: BlockedGate[];
229
+ }
230
+ /** A gate on a never-reached beat whose every writer was itself never reached. */
231
+ interface BlockedGate {
232
+ /** The gating ref, at the granularity the condition reads it: `@world.alarm`, or `@world.mood:armed`
233
+ * for a single flag of a flags property. */
234
+ ref: string;
235
+ /** Beat ids witnessing the writers: content that would have to play for this gate to be written. */
236
+ writers: string[];
216
237
  }
217
238
  /** A choice that ran DRY during the coverage run: at some point it had no takeable option and no eligible
218
239
  * fallback, so it fell through silently and the flow carried on past it. This is easy to author by
@@ -797,6 +818,24 @@ declare class UnsupportedMergeError extends Error {
797
818
  }
798
819
  type Obj = Record<string, unknown>;
799
820
  /** Detect the merge type from a file's `schema` tag. */
821
+ /** The conflict sidecar's extension. One constant, because three callers now look for it. */
822
+ declare const CONFLICT_SIDECAR = ".patterconflict";
823
+ /**
824
+ * Turn a set of lingering `.patterconflict` paths into the issues that STOP work.
825
+ *
826
+ * The rule is patter-merge.md §3.6: a merged shard is valid canonical source with conflicted values
827
+ * resolved provisionally to OURS, so an unresolved merge cannot be allowed to reach CI or an export.
828
+ * That was stated in the design and enforced in exactly one place - `validate` - while `export` and
829
+ * `pack` never looked. Pack is the worse of the two: a pack carries shards but NOT sidecars, so
830
+ * sending one hands the recipient your side of a disagreement with nothing to say it was in dispute.
831
+ *
832
+ * It lives here, beside the sentence it enforces, because three call sites each re-deciding what a
833
+ * lingering sidecar means is how the rule drifted out of the code in the first place.
834
+ */
835
+ declare function sidecarIssues(sidecarPaths: readonly string[]): Array<{
836
+ file: string;
837
+ message: string;
838
+ }>;
800
839
  declare function detectMergeType(file: {
801
840
  schema?: unknown;
802
841
  }): MergeFileType;
@@ -804,6 +843,10 @@ declare function detectMergeType(file: {
804
843
  declare function runMerge(base: Obj, ours: Obj, theirs: Obj, opts?: {
805
844
  type?: MergeFileType;
806
845
  }): MergeResult;
846
+ /** Every authoring key with a strategy of its own above. A key NOT here falls to the plain 3-way, which
847
+ * is coarse but never lossy; the set exists so the fallback does not re-merge what was already merged
848
+ * (an empty result from `setIf` must not be reconsidered as "unhandled"). */
849
+ declare const AUTHORING_HANDLED: Set<string>;
807
850
 
808
851
  /** A document entry whose path escapes the target dir (rejected). */
809
852
  declare class UnsafeEntryError extends Error {
@@ -887,4 +930,4 @@ declare function classesForChannel(classes: DocumentationClass[], channel: strin
887
930
  */
888
931
  declare function resolveDocumentation(loaded: LoadedProject, channel: string): Map<string, DocLine[]>;
889
932
 
890
- export { type ApplyStats, type BundlePosture, type CharacterReport, type Conflict, type ConflictKind, type CoverageAsyncHooks, type CoverageBeat, type CoverageHooks, type CoverageOptions, type CoverageReport, type DocumentManifest, type FormatResult, type HygieneIssue, type InitOptions, type InitResult, type InitVcs, type LoadedProject, type LocCatalog, type LocEntry, type LocaleReport, type MergeFileType, type MergeResult, type MergedShard, type PlannedWrite, type PlayEvent, type PlayOptions, type PlayOutcome, type PlayResult, type ProvenanceCheck, type ReplaceHit, type ReplaceOptions, type ReplacePlan, type ReportData, type ReportTotals, type ResolveEntry, SHARD_EXTENSIONS, type SceneReport, type ScriptDoc, type ScriptElement, type SearchFocus, type UnpackMergeResult, UnsafeEntryError, UnsupportedMergeError, type ValidateResult, type VoiceLine, type VoiceScript, type VoicedCounts, type WebExport, type WrittenCounts, applyLoc, applySceneOrder, applyWrites, bundleOutputPath, catalogToJson, catalogToPo, catalogToXlsx, classesForChannel, detectMergeType, extractLoc, findProjectFile, isUnsafeEntry, jsonToCatalog, listProjectTags, loadProject, loadProjectLanding, poToCatalog, proposeCoverageDrivers, renderCoverageText, renderPlay, renderReportText, resolveDocumentation, resolveStart, runCoverage, runCoverageAsync, runExport, runExportFull, runExportHtml, runExportWeb, runFormat, runInit, runMerge, runPack, runPlay, runPropertyUsage, runReplace, runReport, runReportXlsx, runResolve, runScriptDoc, runSearch, runStatusBrowse, runTagBrowse, runUnpack, runUnpackMerge, runValidate, runVoiceScript, scanAudioStatus, sceneIdForShard, scriptToDocx, scriptToPdf, vcsConfigWrites, voiceScriptToXlsx, xlsxToCatalog };
933
+ export { AUTHORING_HANDLED, type ApplyStats, type BundlePosture, CONFLICT_SIDECAR, type CharacterReport, type Conflict, type ConflictKind, type CoverageAsyncHooks, type CoverageBeat, type CoverageHooks, type CoverageOptions, type CoverageReport, type DocumentManifest, type FormatResult, type HygieneIssue, type InitOptions, type InitResult, type InitVcs, type LoadedProject, type LocCatalog, type LocEntry, type LocaleReport, type MergeFileType, type MergeResult, type MergedShard, type PlannedWrite, type PlayEvent, type PlayOptions, type PlayOutcome, type PlayResult, type ProvenanceCheck, type ReplaceHit, type ReplaceOptions, type ReplacePlan, type ReportData, type ReportTotals, type ResolveEntry, SHARD_EXTENSIONS, type SceneReport, type ScriptDoc, type ScriptElement, type SearchFocus, type UnpackMergeResult, UnsafeEntryError, UnsupportedMergeError, type ValidateResult, type VoiceLine, type VoiceScript, type VoicedCounts, type WebExport, type WrittenCounts, applyLoc, applySceneOrder, applyWrites, bundleOutputPath, catalogToJson, catalogToPo, catalogToXlsx, classesForChannel, detectMergeType, extractLoc, findProjectFile, isUnsafeEntry, jsonToCatalog, listProjectTags, loadProject, loadProjectLanding, poToCatalog, proposeCoverageDrivers, reachabilityIssues, renderCoverageText, renderPlay, renderReportText, resolveDocumentation, resolveStart, runCoverage, runCoverageAsync, runExport, runExportFull, runExportHtml, runExportWeb, runFormat, runInit, runMerge, runPack, runPlay, runPropertyUsage, runReplace, runReport, runReportXlsx, runResolve, runScriptDoc, runSearch, runStatusBrowse, runTagBrowse, runUnpack, runUnpackMerge, runValidate, runVoiceScript, scanAudioStatus, sceneIdForShard, scriptToDocx, scriptToPdf, sidecarIssues, vcsConfigWrites, voiceScriptToXlsx, xlsxToCatalog };