@karmaniverous/stan-cli 0.11.5 → 0.11.7
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 +15 -14
- package/dist/cjs/index.js +1 -1
- package/dist/cli/stan.js +80 -7
- package/dist/mjs/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/stan.js
CHANGED
|
@@ -28953,17 +28953,37 @@ const stanDirs = (cwd, stanPath) => {
|
|
|
28953
28953
|
|
|
28954
28954
|
// src/stan/run/archive/util.ts
|
|
28955
28955
|
/**
|
|
28956
|
-
* Stage imports
|
|
28957
|
-
*
|
|
28956
|
+
* Stage imports under <stanPath>/imports so both full and diff archives see the same
|
|
28957
|
+
* staged context.
|
|
28958
|
+
*
|
|
28959
|
+
* Behavior:
|
|
28960
|
+
* - Always clear the entire <stanPath>/imports directory first (best‑effort).
|
|
28961
|
+
* - Then, if a map is provided, call core.prepareImports to stage the current labels.
|
|
28962
|
+
*
|
|
28963
|
+
* Notes:
|
|
28964
|
+
* - Core's prepareImports also clears each label directory; we keep that as a
|
|
28965
|
+
* belt‑and‑suspenders for non‑CLI callers while the CLI clears the root up front
|
|
28966
|
+
* to remove labels that were dropped from config.
|
|
28967
|
+
* - All operations are best‑effort and swallow errors to avoid impacting the run.
|
|
28958
28968
|
*/
|
|
28959
28969
|
const stageImports = async (cwd, stanPath, imports) => {
|
|
28960
|
-
|
|
28961
|
-
|
|
28970
|
+
// 1) Clear the entire imports root first (best‑effort).
|
|
28971
|
+
const importsAbs = path.join(cwd, stanPath, 'imports');
|
|
28962
28972
|
try {
|
|
28963
|
-
await
|
|
28973
|
+
const entries = await readdir(importsAbs, { withFileTypes: true });
|
|
28974
|
+
await Promise.all(entries.map((e) => rm(resolve(importsAbs, e.name), { recursive: true, force: true })));
|
|
28964
28975
|
}
|
|
28965
28976
|
catch {
|
|
28966
|
-
// best‑effort;
|
|
28977
|
+
// best‑effort; root may not exist yet.
|
|
28978
|
+
}
|
|
28979
|
+
// 2) Stage current map (if any).
|
|
28980
|
+
if (imports && typeof imports === 'object') {
|
|
28981
|
+
try {
|
|
28982
|
+
await yh({ cwd, stanPath, map: imports });
|
|
28983
|
+
}
|
|
28984
|
+
catch {
|
|
28985
|
+
// best‑effort; continue without imports
|
|
28986
|
+
}
|
|
28967
28987
|
}
|
|
28968
28988
|
};
|
|
28969
28989
|
/**
|
|
@@ -32234,6 +32254,11 @@ async function handleSnap(opts) {
|
|
|
32234
32254
|
try {
|
|
32235
32255
|
const coreModUnknown = await Promise.resolve().then(function () { return index; });
|
|
32236
32256
|
const core = coreModUnknown;
|
|
32257
|
+
const ensureOutFn = typeof core.ensureOutputDir === 'function'
|
|
32258
|
+
? core.ensureOutputDir
|
|
32259
|
+
: typeof core.default?.ensureOutputDir === 'function'
|
|
32260
|
+
? core.default.ensureOutputDir
|
|
32261
|
+
: null;
|
|
32237
32262
|
const loadConfigFn = typeof core.loadConfig === 'function'
|
|
32238
32263
|
? core.loadConfig
|
|
32239
32264
|
: typeof core.default?.loadConfig === 'function'
|
|
@@ -32245,19 +32270,67 @@ async function handleSnap(opts) {
|
|
|
32245
32270
|
? core.default.writeArchiveSnapshot
|
|
32246
32271
|
: null;
|
|
32247
32272
|
if (writeSnapshotFn) {
|
|
32273
|
+
// Make sure <stanPath>/diff (and output) exist before writing the snapshot.
|
|
32274
|
+
// This avoids ENOENT when snapping a fresh repo or temp workspace.
|
|
32275
|
+
try {
|
|
32276
|
+
if (ensureOutFn) {
|
|
32277
|
+
await ensureOutFn(cwd, stanPath, true);
|
|
32278
|
+
}
|
|
32279
|
+
}
|
|
32280
|
+
catch {
|
|
32281
|
+
/* best‑effort directory ensure */
|
|
32282
|
+
}
|
|
32248
32283
|
let includes = [];
|
|
32249
32284
|
let excludes = [];
|
|
32285
|
+
// Overlay inputs derived the same way as “run”:
|
|
32286
|
+
// - overlay enabled state from cliDefaults.run.facets
|
|
32287
|
+
// - inactive facets contribute subtree excludes; anchors re-include breadcrumbs
|
|
32288
|
+
let anchors = [];
|
|
32289
|
+
let overlayExcludes = [];
|
|
32250
32290
|
try {
|
|
32251
32291
|
const cfg = loadConfigFn ? await loadConfigFn(cwd) : null;
|
|
32252
32292
|
includes = Array.isArray(cfg?.includes) ? cfg.includes : [];
|
|
32253
32293
|
excludes = Array.isArray(cfg?.excludes) ? cfg.excludes : [];
|
|
32294
|
+
// Decide overlay enablement from run defaults (snap has no facet flags).
|
|
32295
|
+
const eff = getRunDefaults(cwd);
|
|
32296
|
+
try {
|
|
32297
|
+
const ov = await computeFacetOverlay({
|
|
32298
|
+
cwd,
|
|
32299
|
+
stanPath,
|
|
32300
|
+
enabled: eff.facets,
|
|
32301
|
+
activate: [],
|
|
32302
|
+
deactivate: [],
|
|
32303
|
+
nakedActivateAll: false,
|
|
32304
|
+
});
|
|
32305
|
+
// Always keep anchors (breadcrumbs) materialized in snapshot selection.
|
|
32306
|
+
anchors = Array.isArray(ov.anchorsOverlay) ? ov.anchorsOverlay : [];
|
|
32307
|
+
// Only map subtree roots into excludes when overlay is enabled.
|
|
32308
|
+
overlayExcludes =
|
|
32309
|
+
ov.enabled && Array.isArray(ov.excludesOverlay)
|
|
32310
|
+
? ov.excludesOverlay
|
|
32311
|
+
: [];
|
|
32312
|
+
}
|
|
32313
|
+
catch {
|
|
32314
|
+
// best-effort overlay; fall back to engine selection only
|
|
32315
|
+
anchors = [];
|
|
32316
|
+
overlayExcludes = [];
|
|
32317
|
+
}
|
|
32254
32318
|
}
|
|
32255
32319
|
catch {
|
|
32256
32320
|
// best-effort
|
|
32257
32321
|
includes = [];
|
|
32258
32322
|
excludes = [];
|
|
32323
|
+
anchors = [];
|
|
32324
|
+
overlayExcludes = [];
|
|
32259
32325
|
}
|
|
32260
|
-
|
|
32326
|
+
const excludesFinal = [...excludes, ...overlayExcludes];
|
|
32327
|
+
await writeSnapshotFn({
|
|
32328
|
+
cwd,
|
|
32329
|
+
stanPath,
|
|
32330
|
+
includes,
|
|
32331
|
+
excludes: excludesFinal,
|
|
32332
|
+
anchors,
|
|
32333
|
+
});
|
|
32261
32334
|
}
|
|
32262
32335
|
}
|
|
32263
32336
|
catch {
|