@auto-engineer/file-store 1.147.0 → 1.149.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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-test.log +3 -3
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +45 -0
- package/README.md +101 -49
- package/package.json +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @auto-engineer/file-store@1.
|
|
2
|
+
> @auto-engineer/file-store@1.149.0 build /home/runner/work/auto-engineer/auto-engineer/packages/file-store
|
|
3
3
|
> tsc && tsx ../../scripts/fix-esm-imports.ts
|
|
4
4
|
|
|
5
5
|
Fixed ESM imports in dist/
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @auto-engineer/file-store@1.
|
|
2
|
+
> @auto-engineer/file-store@1.148.0 test /home/runner/work/auto-engineer/auto-engineer/packages/file-store
|
|
3
3
|
> vitest run --reporter=dot
|
|
4
4
|
|
|
5
5
|
|
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
|
|
10
10
|
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
11
11
|
[2m Tests [22m [1m[32m5 passed[39m[22m[90m (5)[39m
|
|
12
|
-
[2m Start at [22m
|
|
13
|
-
[2m Duration [22m 2.
|
|
12
|
+
[2m Start at [22m 07:22:16
|
|
13
|
+
[2m Duration [22m 2.14s[2m (transform 388ms, setup 0ms, collect 342ms, tests 186ms, environment 0ms, prepare 579ms)[22m
|
|
14
14
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# @auto-engineer/file-store
|
|
2
2
|
|
|
3
|
+
## 1.149.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`e1eebbd`](https://github.com/BeOnAuto/auto-engineer/commit/e1eebbdf4f209780e790094d2e6887c4fa809f98) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **server-generator-apollo-emmett**: add Given state ref hints to state.ts.ejs
|
|
8
|
+
- **server-generator-apollo-emmett**: context-aware nonCommandField instructions
|
|
9
|
+
- **server-generator-apollo-emmett**: add state context instruction
|
|
10
|
+
- **server-generator-apollo-emmett**: extract shared template helpers
|
|
11
|
+
- **server-generator-apollo-emmett**: filter state refs from hasGivenEvents in decide.ts.ejs
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`d38c81e`](https://github.com/BeOnAuto/auto-engineer/commit/d38c81e7bb442a39626564cf4f6d8d55b60d0a38) Thanks [@SamHatoum](https://github.com/SamHatoum)! -
|
|
16
|
+
|
|
17
|
+
## 1.148.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- [`d5ba3a0`](https://github.com/BeOnAuto/auto-engineer/commit/d5ba3a0e3fb0f6a9ad7a3a8b1815590ea77a5b42) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - Added state context instruction to generated decide handlers, preventing unnecessary narrowing when Given steps contain only state references
|
|
22
|
+
|
|
23
|
+
- [`e0cdc4e`](https://github.com/BeOnAuto/auto-engineer/commit/e0cdc4e3363ad84d4bc49996a600ac75c97ccc38) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - Added context-aware classification of non-command fields in generated decide.ts scaffolds, distinguishing between date-derived, state-derived, and not-yet-tested fields
|
|
24
|
+
|
|
25
|
+
- [`9195db7`](https://github.com/BeOnAuto/auto-engineer/commit/9195db78cb707d658866cee99a1c73d34fb4efde) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - Extracted shared template helpers into a dedicated module for cleaner code generation
|
|
26
|
+
|
|
27
|
+
- [`abb6540`](https://github.com/BeOnAuto/auto-engineer/commit/abb6540db7196ed7935c8a8610695828f9035fc3) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - Added status variant hints from Given state references to the state template, helping implementers create matching discriminated union variants
|
|
28
|
+
|
|
29
|
+
- [`9195db7`](https://github.com/BeOnAuto/auto-engineer/commit/9195db78cb707d658866cee99a1c73d34fb4efde) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - Extracted shared template helper functions into a dedicated module for better code reuse across generators
|
|
30
|
+
- Simplified template specs by removing inline duplicate definitions in favor of the shared helpers
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- [`88fb1da`](https://github.com/BeOnAuto/auto-engineer/commit/88fb1da2b222de04dd4959d87657395ee960a6ce) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **server-generator-apollo-emmett**: skip empty file plans in scaffold output
|
|
35
|
+
- **server-generator-apollo-emmett**: filter state refs from given() in decide.specs.ts.ejs
|
|
36
|
+
- **server-generator-apollo-emmett**: move CS Given states from events to states array
|
|
37
|
+
- **global**: version packages
|
|
38
|
+
- **server-generator-apollo-emmett**: mark G1+G2 ketchup plan complete
|
|
39
|
+
|
|
40
|
+
- [`4255f6d`](https://github.com/BeOnAuto/auto-engineer/commit/4255f6db0d128979e573244a615886482ce799b0) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - Updated ketchup plan for state reference fix in decide template generator
|
|
41
|
+
- Marked generator bug fix milestones G1 and G2 as complete
|
|
42
|
+
|
|
43
|
+
- [`62f1ea3`](https://github.com/BeOnAuto/auto-engineer/commit/62f1ea3dd1b4275211574e3df9d9a6571ae9b27a) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - Fixed scaffold generation to correctly distinguish between event and state references in decision handlers
|
|
44
|
+
- Prevented contradictory instructions from appearing in generated code when Given clauses contain only state references
|
|
45
|
+
|
|
46
|
+
- [`ba4f5c9`](https://github.com/BeOnAuto/auto-engineer/commit/ba4f5c9749fb1c15d444e78ca9a2689817f039cb) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - Added implementation plan for decide.ts code generation fixes in the Apollo Emmett server generator
|
|
47
|
+
|
|
3
48
|
## 1.147.0
|
|
4
49
|
|
|
5
50
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -6,9 +6,17 @@ Platform-agnostic file storage abstraction with in-memory and Node.js implementa
|
|
|
6
6
|
|
|
7
7
|
## Purpose
|
|
8
8
|
|
|
9
|
-
Without `@auto-engineer/file-store`, you would have to write platform-specific file operations, handle path normalization across operating systems, and
|
|
9
|
+
Without `@auto-engineer/file-store`, you would have to write platform-specific file operations, handle path normalization across operating systems, and maintain separate test doubles for every component that touches the filesystem.
|
|
10
10
|
|
|
11
|
-
This package
|
|
11
|
+
This package defines a single `IFileStore` interface that both `InMemoryFileStore` and `NodeFileStore` implement. Code that depends on `IFileStore` can run against the in-memory store in tests and the Node store in production with no changes. All paths are normalized to POSIX format, and all reads return `null` for missing files instead of throwing.
|
|
12
|
+
|
|
13
|
+
## Key Concepts
|
|
14
|
+
|
|
15
|
+
- **Binary-first API** -- Core operations use `Uint8Array` for cross-platform compatibility. The Node store adds text convenience methods via `IExtendedFileStore`.
|
|
16
|
+
- **Null over exceptions** -- `read()` and `readText()` return `null` for missing files rather than throwing.
|
|
17
|
+
- **POSIX normalization** -- All paths use forward slashes, even on Windows.
|
|
18
|
+
- **Auto directory creation** -- `write()` and `writeText()` create parent directories automatically.
|
|
19
|
+
- **Two entry points** -- The main entry point (`"."`) is platform-agnostic; the `"./node"` entry point requires Node.js built-ins.
|
|
12
20
|
|
|
13
21
|
---
|
|
14
22
|
|
|
@@ -36,7 +44,7 @@ console.log(new TextDecoder().decode(data!));
|
|
|
36
44
|
|
|
37
45
|
## How-to Guides
|
|
38
46
|
|
|
39
|
-
### Use In-Memory Store for Testing
|
|
47
|
+
### Use the In-Memory Store for Testing
|
|
40
48
|
|
|
41
49
|
```typescript
|
|
42
50
|
import { InMemoryFileStore } from '@auto-engineer/file-store';
|
|
@@ -48,7 +56,7 @@ const exists = await store.exists('/input.txt');
|
|
|
48
56
|
const tree = await store.listTree('/');
|
|
49
57
|
```
|
|
50
58
|
|
|
51
|
-
### Use Node Store for Production
|
|
59
|
+
### Use the Node Store for Production
|
|
52
60
|
|
|
53
61
|
```typescript
|
|
54
62
|
import { NodeFileStore } from '@auto-engineer/file-store/node';
|
|
@@ -59,7 +67,7 @@ await store.writeText('config.json', JSON.stringify({ key: 'value' }));
|
|
|
59
67
|
const text = await store.readText('config.json');
|
|
60
68
|
```
|
|
61
69
|
|
|
62
|
-
### List Directory Tree
|
|
70
|
+
### List a Directory Tree with Pruning
|
|
63
71
|
|
|
64
72
|
```typescript
|
|
65
73
|
import { NodeFileStore } from '@auto-engineer/file-store/node';
|
|
@@ -69,10 +77,16 @@ const tree = await store.listTree('/project', {
|
|
|
69
77
|
pruneDirRegex: /node_modules|\.git/,
|
|
70
78
|
includeSizes: true,
|
|
71
79
|
});
|
|
80
|
+
|
|
81
|
+
for (const entry of tree) {
|
|
82
|
+
console.log(`${entry.type} ${entry.path} (${entry.size} bytes)`);
|
|
83
|
+
}
|
|
72
84
|
```
|
|
73
85
|
|
|
74
86
|
### Dependency Injection
|
|
75
87
|
|
|
88
|
+
Accept `IFileStore` in your constructors so callers can swap implementations:
|
|
89
|
+
|
|
76
90
|
```typescript
|
|
77
91
|
import type { IFileStore } from '@auto-engineer/file-store';
|
|
78
92
|
|
|
@@ -91,52 +105,66 @@ class DocumentManager {
|
|
|
91
105
|
|
|
92
106
|
### Package Exports
|
|
93
107
|
|
|
108
|
+
| Entry Point | Import Path | Exports |
|
|
109
|
+
|-------------|-------------|---------|
|
|
110
|
+
| Main (`.`) | `@auto-engineer/file-store` | `InMemoryFileStore`, `IFileStore`, `IExtendedFileStore` |
|
|
111
|
+
| Node (`./node`) | `@auto-engineer/file-store/node` | `NodeFileStore`, `IFileStore`, `IExtendedFileStore` |
|
|
112
|
+
|
|
94
113
|
```typescript
|
|
114
|
+
// Platform-agnostic (no Node.js dependency)
|
|
95
115
|
import { InMemoryFileStore, type IFileStore, type IExtendedFileStore } from '@auto-engineer/file-store';
|
|
96
116
|
|
|
117
|
+
// Node.js only
|
|
97
118
|
import { NodeFileStore } from '@auto-engineer/file-store/node';
|
|
98
119
|
```
|
|
99
120
|
|
|
100
|
-
###
|
|
121
|
+
### `IFileStore` Interface
|
|
101
122
|
|
|
102
|
-
|
|
103
|
-
|-------------|-------------|-------------|
|
|
104
|
-
| Main | `@auto-engineer/file-store` | Platform-agnostic (InMemoryFileStore, types) |
|
|
105
|
-
| Node | `@auto-engineer/file-store/node` | Node.js-specific (NodeFileStore) |
|
|
123
|
+
The base interface implemented by both stores.
|
|
106
124
|
|
|
107
|
-
|
|
125
|
+
| Method | Signature | Description |
|
|
126
|
+
|--------|-----------|-------------|
|
|
127
|
+
| `write` | `(path: string, data: Uint8Array) => Promise<void>` | Write binary data. Creates parent directories. |
|
|
128
|
+
| `read` | `(path: string) => Promise<Uint8Array \| null>` | Read binary data. Returns `null` if missing. |
|
|
129
|
+
| `exists` | `(path: string) => Promise<boolean>` | Check whether a file or directory exists. |
|
|
130
|
+
| `listTree` | `(root?: string, opts?: ListTreeOpts) => Promise<TreeEntry[]>` | Recursively list files and directories. |
|
|
131
|
+
| `remove` | `(path: string) => Promise<void>` | Delete a file. |
|
|
108
132
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
```
|
|
133
|
+
#### `listTree` Options
|
|
134
|
+
|
|
135
|
+
| Option | Type | Default | Description |
|
|
136
|
+
|--------|------|---------|-------------|
|
|
137
|
+
| `followSymlinkDirs` | `boolean` | `true` | Traverse symlinked directories |
|
|
138
|
+
| `includeSizes` | `boolean` | `true` | Include file sizes in results |
|
|
139
|
+
| `pruneDirRegex` | `RegExp` | -- | Skip directories whose path matches |
|
|
118
140
|
|
|
119
|
-
|
|
141
|
+
#### `listTree` Return Type
|
|
120
142
|
|
|
121
143
|
```typescript
|
|
122
|
-
|
|
123
|
-
ensureDir(path: string): Promise<void>;
|
|
124
|
-
readdir(path: string): Promise<DirEntry[]>;
|
|
125
|
-
readText(path: string): Promise<string | null>;
|
|
126
|
-
writeText(path: string, text: string): Promise<void>;
|
|
127
|
-
join(...parts: string[]): string;
|
|
128
|
-
dirname(p: string): string;
|
|
129
|
-
fromHere(relative: string, base?: string): string;
|
|
130
|
-
}
|
|
144
|
+
Array<{ path: string; type: 'file' | 'dir'; size: number }>
|
|
131
145
|
```
|
|
132
146
|
|
|
133
|
-
###
|
|
147
|
+
### `IExtendedFileStore` Interface
|
|
134
148
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
|
138
|
-
|
|
139
|
-
| `
|
|
149
|
+
Extends `IFileStore` with convenience methods. Implemented by `NodeFileStore`.
|
|
150
|
+
|
|
151
|
+
| Method | Signature | Description |
|
|
152
|
+
|--------|-----------|-------------|
|
|
153
|
+
| `ensureDir` | `(path: string) => Promise<void>` | Create a directory recursively (like `mkdir -p`). |
|
|
154
|
+
| `readdir` | `(path: string) => Promise<Array<{ name: string; type: 'file' \| 'dir' }>>` | List immediate children of a directory. |
|
|
155
|
+
| `readText` | `(path: string) => Promise<string \| null>` | Read a file as UTF-8 text. Returns `null` if missing. |
|
|
156
|
+
| `writeText` | `(path: string, text: string) => Promise<void>` | Write a UTF-8 text file. Creates parent directories. |
|
|
157
|
+
| `join` | `(...parts: string[]) => string` | Join path segments, returning a POSIX path. Handles `file://` URLs. |
|
|
158
|
+
| `dirname` | `(p: string) => string` | Return the directory portion of a path as a POSIX path. |
|
|
159
|
+
| `fromHere` | `(relative: string, base?: string) => string` | Resolve a relative path from a base directory (defaults to `__dirname`). |
|
|
160
|
+
|
|
161
|
+
### `InMemoryFileStore` Class
|
|
162
|
+
|
|
163
|
+
Implements `IFileStore`. Stores files in a `Map<string, Uint8Array>`. Paths are normalized to start with `/`. The `remove` method deletes the path and any files beneath it (prefix match), so it works for both files and directories.
|
|
164
|
+
|
|
165
|
+
### `NodeFileStore` Class
|
|
166
|
+
|
|
167
|
+
Implements `IExtendedFileStore`. Delegates to `node:fs/promises`. Paths can be absolute, relative (resolved against `process.cwd()`), or `file://` URLs. All returned paths use POSIX separators.
|
|
140
168
|
|
|
141
169
|
---
|
|
142
170
|
|
|
@@ -144,21 +172,45 @@ interface IExtendedFileStore extends IFileStore {
|
|
|
144
172
|
|
|
145
173
|
```
|
|
146
174
|
src/
|
|
147
|
-
├── index.ts
|
|
148
|
-
├── node.ts
|
|
149
|
-
├── types.ts
|
|
150
|
-
├── path.ts
|
|
151
|
-
├── InMemoryFileStore.ts
|
|
152
|
-
└── NodeFileStore.ts
|
|
175
|
+
├── index.ts # Main entry: exports InMemoryFileStore + types
|
|
176
|
+
├── node.ts # Node entry: exports NodeFileStore + types
|
|
177
|
+
├── types.ts # IFileStore and IExtendedFileStore interfaces
|
|
178
|
+
├── path.ts # toPosix() helper
|
|
179
|
+
├── InMemoryFileStore.ts # In-memory implementation (Map-backed)
|
|
180
|
+
└── NodeFileStore.ts # Node.js fs implementation
|
|
153
181
|
```
|
|
154
182
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
183
|
+
```mermaid
|
|
184
|
+
classDiagram
|
|
185
|
+
class IFileStore {
|
|
186
|
+
<<interface>>
|
|
187
|
+
+write(path, data) Promise~void~
|
|
188
|
+
+read(path) Promise~Uint8Array | null~
|
|
189
|
+
+exists(path) Promise~boolean~
|
|
190
|
+
+listTree(root, opts) Promise~TreeEntry[]~
|
|
191
|
+
+remove(path) Promise~void~
|
|
192
|
+
}
|
|
193
|
+
class IExtendedFileStore {
|
|
194
|
+
<<interface>>
|
|
195
|
+
+ensureDir(path) Promise~void~
|
|
196
|
+
+readdir(path) Promise~DirEntry[]~
|
|
197
|
+
+readText(path) Promise~string | null~
|
|
198
|
+
+writeText(path, text) Promise~void~
|
|
199
|
+
+join(parts) string
|
|
200
|
+
+dirname(p) string
|
|
201
|
+
+fromHere(relative, base) string
|
|
202
|
+
}
|
|
203
|
+
IExtendedFileStore --|> IFileStore
|
|
204
|
+
InMemoryFileStore ..|> IFileStore
|
|
205
|
+
NodeFileStore ..|> IExtendedFileStore
|
|
206
|
+
|
|
207
|
+
class InMemoryFileStore {
|
|
208
|
+
-files Map~string, Uint8Array~
|
|
209
|
+
}
|
|
210
|
+
class NodeFileStore {
|
|
211
|
+
}
|
|
212
|
+
```
|
|
161
213
|
|
|
162
214
|
### Dependencies
|
|
163
215
|
|
|
164
|
-
This package has **zero external dependencies**.
|
|
216
|
+
This package has **zero external dependencies**. The Node entry point uses only Node.js built-in modules (`node:fs/promises`, `node:path`, `node:url`).
|