@mulmoclaude/core 0.2.5 → 0.2.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.
@@ -1501,21 +1501,29 @@ function deleteTargets(collection, workspaceRoot) {
1501
1501
  ];
1502
1502
  }
1503
1503
  /** The records directory the delete recursively archives + removes
1504
- * (`collection.dataDir`) must live in this collection's OWN
1505
- * `data/<slug>/` subtree. `dataDir` is normally derived from
1506
- * `schema.dataPath`, but `deleteCollection` accepts a `LoadedCollection`
1507
- * whose fields could be inconsistent — so we validate the RESOLVED
1508
- * target the destructive ops actually touch, not the schema string.
1509
- * `resolveDataDir` only proves containment in the workspace; a shared
1510
- * root like `data` or `data/skills` would otherwise turn the recursive
1511
- * removal into a workspace-wide wipe whose archive captures only this
1512
- * collection. `path.resolve` collapses any `..` before the prefix test
1513
- * (symlink escapes are caught separately by the realpath containment
1514
- * check in `deleteTargets`). */
1504
+ * (`collection.dataDir`) must live in this collection's OWN per-slug
1505
+ * subtree. `dataDir` is normally derived from `schema.dataPath`, but
1506
+ * `deleteCollection` accepts a `LoadedCollection` whose fields could be
1507
+ * inconsistent — so we validate the RESOLVED target the destructive ops
1508
+ * actually touch, not the schema string. A shared root like `data` or
1509
+ * `data/skills` would otherwise turn the recursive removal into a
1510
+ * workspace-wide wipe whose archive captures only this collection.
1511
+ * `path.resolve` collapses any `..` before the prefix test (symlink
1512
+ * escapes are caught separately by the realpath containment check in
1513
+ * `deleteTargets`).
1514
+ *
1515
+ * TWO acceptable per-slug subtrees:
1516
+ * - `data/<slug>/...` — the convention authored collections default to.
1517
+ * - `data/collections/<slug>/...` — what `normalizedDataPath` in the
1518
+ * registry-import path stamps onto every imported schema (so imported
1519
+ * collections never collide with `data/<slug>/`-shaped authored ones).
1520
+ * Both are equally per-collection and equally safe; a delete that targets
1521
+ * anything else (e.g. raw `data/`, `data/wiki/`, a sibling slug) is
1522
+ * refused. */
1515
1523
  function isDataDirSafe(dataDir, slug, workspaceRoot) {
1516
- const expectedRoot = path.resolve(workspaceRoot, "data", slug);
1524
+ const acceptableRoots = [path.resolve(workspaceRoot, "data", slug), path.resolve(workspaceRoot, "data", "collections", slug)];
1517
1525
  const resolved = path.resolve(dataDir);
1518
- return resolved === expectedRoot || resolved.startsWith(expectedRoot + path.sep);
1526
+ return acceptableRoots.some((root) => resolved === root || resolved.startsWith(root + path.sep));
1519
1527
  }
1520
1528
  function buildRestoreDoc(collection) {
1521
1529
  const { slug, schema } = collection;
@@ -1711,4 +1719,4 @@ async function deleteCustomView(collection, viewId, opts = {}) {
1711
1719
  //#endregion
1712
1720
  export { readSkillTemplate as A, safeSlugName as B, buildActionSeedPrompt as C, listItems as D, generateItemId as E, isContainedInWorkspace as F, setCollectionChangePublisher as G, getWorkspaceRoot as H, itemFilePath as I, resolveDataDir as L, writeItem as M, SCHEMA_FILE as N, readCustomViewHtml as O, isContainedInRoot as P, resolveTemplatePath as R, validateRecordObject as S, deleteItem as T, log as U, configureCollectionHost as V, publishCollectionChange as W, loadCollection as _, computeSuccessor as a, COMPUTED_TYPES as b, isTriggerDue as c, resolveEvery as d, successorId as f, discoverCollections as g, acceptParsedSchema as h, advanceTriggerDate as i, resolveCreateItemId as j, readItem as k, maybeSpawnSuccessor as l, CollectionSchemaZ as m, deleteCollection as n, daysInMonth as o, enrichItems as p, deleteCollectionRefusalMessage as r, formatCivil as s, deleteCustomView as t, parseCivil as u, toDetail as v, buildCollectionActionSeedPrompt as w, validateCollectionRecords as x, toSummary as y, safeRecordId as z };
1713
1721
 
1714
- //# sourceMappingURL=server-B2YkcCwl.js.map
1722
+ //# sourceMappingURL=server-q4WPXtbU.js.map