@joshski/dust 0.1.72 → 0.1.73

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/dist/dust.js CHANGED
@@ -275,7 +275,7 @@ async function loadSettings(cwd, fileSystem) {
275
275
  }
276
276
 
277
277
  // lib/version.ts
278
- var DUST_VERSION = "0.1.72";
278
+ var DUST_VERSION = "0.1.73";
279
279
 
280
280
  // lib/session.ts
281
281
  var DUST_UNATTENDED = "DUST_UNATTENDED";
@@ -25,10 +25,12 @@ export interface FileSystemEmulator extends FileSystem, GlobScanner {
25
25
  * Implements both FileSystem and GlobScanner interfaces - the scan() method
26
26
  * iterates over the files the emulator knows about.
27
27
  *
28
- * @param tree - Nested object representing file system hierarchy
28
+ * @param tree - Nested object representing file system hierarchy (paths get '/' prefix)
29
+ * @param flatFiles - Optional record of path→content entries added as-is (no prefix)
29
30
  * @returns FileSystemEmulator with tracking for created directories and written files
30
31
  *
31
32
  * @example
33
+ * // Nested tree (paths become /project/.dust/...)
32
34
  * createFileSystemEmulator({
33
35
  * project: {
34
36
  * '.dust': {
@@ -37,5 +39,11 @@ export interface FileSystemEmulator extends FileSystem, GlobScanner {
37
39
  * }
38
40
  * }
39
41
  * })
42
+ *
43
+ * // Flat files (paths used as-is)
44
+ * createFileSystemEmulator({}, {
45
+ * '.dust/config/audits/security.md': '# Security Audit\n...',
46
+ * '.dust/tasks/audit-security.md': '# Run security audit\n...',
47
+ * })
40
48
  */
41
- export declare function createFileSystemEmulator(tree?: FileSystemTree): FileSystemEmulator;
49
+ export declare function createFileSystemEmulator(tree?: FileSystemTree, flatFiles?: Record<string, string>): FileSystemEmulator;
@@ -28,8 +28,17 @@ function flattenFileSystemTree(tree, basePath = "") {
28
28
  }
29
29
  return { files, paths };
30
30
  }
31
- function createFileSystemEmulator(tree = {}) {
31
+ function createFileSystemEmulator(tree = {}, flatFiles) {
32
32
  const { files, paths } = flattenFileSystemTree(tree);
33
+ if (flatFiles) {
34
+ for (const [filePath, content] of Object.entries(flatFiles)) {
35
+ files.set(filePath, content);
36
+ paths.add(filePath);
37
+ for (let dir = filePath.substring(0, filePath.lastIndexOf("/"));dir; dir = dir.substring(0, dir.lastIndexOf("/"))) {
38
+ paths.add(dir);
39
+ }
40
+ }
41
+ }
33
42
  const createdDirs = [];
34
43
  const writtenFiles = new Map;
35
44
  const permissions = new Map;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joshski/dust",
3
- "version": "0.1.72",
3
+ "version": "0.1.73",
4
4
  "description": "Flow state for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {