@karmaniverous/stan-core 0.9.3 → 0.10.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/README.md CHANGED
@@ -50,6 +50,26 @@ const { diffPath } = await createArchiveDiff({
50
50
  });
51
51
  ```
52
52
 
53
+ Create a full archive from an explicit allowlist (context-mode building block):
54
+
55
+ ```ts
56
+ import { createArchiveFromFiles } from '@karmaniverous/stan-core';
57
+
58
+ const cwd = process.cwd();
59
+ const stanPath = '.stan';
60
+
61
+ const tarPath = await createArchiveFromFiles(
62
+ cwd,
63
+ stanPath,
64
+ [
65
+ // repo-relative POSIX paths
66
+ 'README.md',
67
+ `${stanPath}/system/stan.system.md`,
68
+ ],
69
+ { includeOutputDir: false },
70
+ );
71
+ ```
72
+
53
73
  Apply a unified diff (with safe fallback) and/or run File Ops:
54
74
 
55
75
  ```ts
@@ -139,11 +159,13 @@ await prepareImports({
139
159
 
140
160
  Top‑level (via `import '@karmaniverous/stan-core'`):
141
161
 
142
- - Archiving/diff/snapshot: `createArchive`, `createArchiveDiff`, `writeArchiveSnapshot`
162
+ - Archiving/diff/snapshot (denylist selection): `createArchive`, `createArchiveDiff`, `writeArchiveSnapshot`
163
+ - Archiving/diff/snapshot (explicit allowlist): `createArchiveFromFiles`, `createArchiveDiffFromFiles`, `writeArchiveSnapshotFromFiles`
143
164
  - Selection/FS: `listFiles`, `filterFiles`
144
165
  - Patch engine: `applyPatchPipeline`, `detectAndCleanPatch`, `executeFileOps`, `parseFileOpsBlock`
145
166
  - Imports: `prepareImports`
146
167
  - Config: `loadConfig`, `loadConfigSync`, `resolveStanPath`, `resolveStanPathSync`
168
+ - Context mode orchestration (Base + closure allowlist): `createContextArchiveWithDependencyContext`, `createContextArchiveDiffWithDependencyContext`
147
169
 
148
170
  See CHANGELOG for behavior changes. Typedoc site is generated from source.
149
171
 
@@ -189,6 +211,33 @@ await buildDependencyMeta({
189
211
  });
190
212
  ```
191
213
 
214
+ ## Context mode (allowlist-only FULL + DIFF; recommended engine-owned orchestration)
215
+
216
+ In context mode, the correct archive selection universe is allowlist-only: Base (system + dependency meta/state + repo-root base files) + the dependency-state-selected closure. Hosts (e.g., `stan-cli`) should use the engine-owned orchestration helpers:
217
+
218
+ ```ts
219
+ import {
220
+ createContextArchiveWithDependencyContext,
221
+ createContextArchiveDiffWithDependencyContext,
222
+ } from '@karmaniverous/stan-core';
223
+
224
+ const cwd = process.cwd();
225
+ const stanPath = '.stan';
226
+
227
+ const full = await createContextArchiveWithDependencyContext({
228
+ cwd,
229
+ stanPath,
230
+ dependency: { meta, map, state, clean: true },
231
+ });
232
+
233
+ const diff = await createContextArchiveDiffWithDependencyContext({
234
+ cwd,
235
+ stanPath,
236
+ dependency: { meta, map, state, clean: false },
237
+ diff: { baseName: 'archive', snapshotFileName: '.archive.snapshot.context.json' },
238
+ });
239
+ ```
240
+
192
241
  ## Environment variables
193
242
 
194
243
  See [Env Vars](./guides/env-vars.md) for a complete list of environment variable switches observed by the engine, tests, and release scripts.