@planu/cli 4.3.23 → 4.3.25
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/CHANGELOG.md +6 -0
- package/dist/engine/handoff-artifacts/index.d.ts +1 -16
- package/dist/engine/handoff-artifacts/io.d.ts +1 -1
- package/dist/engine/handoff-artifacts/schemas.d.ts +1 -1
- package/dist/engine/handoff-artifacts/validation-result.d.ts +18 -0
- package/dist/engine/handoff-artifacts/validation-result.js +3 -0
- package/dist/engine/hooks/handlers/on-impl-change.js +3 -2
- package/dist/engine/test-contract-generator.js +41 -39
- package/dist/engine/test-scaffold-generator/unit-scaffold.js +10 -10
- package/dist/engine/test-spec-generator/criterion-parser.js +5 -24
- package/dist/storage/base-store.d.ts +0 -1
- package/dist/storage/base-store.js +0 -4
- package/dist/tools/generate-tests/generators/concurrency-test-generator/java-templates.js +8 -13
- package/dist/tools/generate-tests/generators/concurrency-test-generator/js-templates.js +21 -47
- package/dist/tools/generate-tests/generators/concurrency-test-generator/python-rust-templates.js +3 -14
- package/dist/tools/git/auto-complete-ops.d.ts +18 -0
- package/dist/tools/git/auto-complete-ops.js +63 -0
- package/dist/tools/git/branch-ops.d.ts +0 -17
- package/dist/tools/git/branch-ops.js +0 -54
- package/dist/tools/git/cleanup-ops.js +0 -16
- package/dist/tools/git/release-ops.js +1 -1
- package/dist/tools/init-project/handler.js +1 -1
- package/dist/tools/manage-hooks.js +3 -1
- package/dist/tools/status-handler.js +1 -1
- package/dist/tools/update-status-actions.js +8 -5
- package/dist/types/clarification-token.d.ts +1 -1
- package/dist/types/clarification.d.ts +2 -18
- package/dist/types/hook-status-update.d.ts +10 -0
- package/dist/types/hook-status-update.js +3 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/interactive-question.d.ts +19 -0
- package/dist/types/interactive-question.js +3 -0
- package/dist/types/storage.d.ts +1 -1
- package/package.json +9 -9
- package/planu-native.json +8 -29
- package/planu-plugin.json +7 -35
- package/dist/engine/hooks/index.d.ts +0 -20
- package/dist/engine/hooks/index.js +0 -25
- package/dist/storage/crud-store-factory.d.ts +0 -22
- package/dist/storage/crud-store-factory.js +0 -72
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// storage/crud-store-factory.ts — Generic CRUD store factory
|
|
2
|
-
// Kept in a separate file so that tests mocking base-store.js can intercept
|
|
3
|
-
// readJson / writeJson calls made by the factory (ESM live binding rule).
|
|
4
|
-
import { readJson, writeJson, projectDataDir } from './base-store.js';
|
|
5
|
-
import { withFileLock } from './file-mutex.js';
|
|
6
|
-
/**
|
|
7
|
-
* Create a generic CRUD store backed by a single JSON array file per project.
|
|
8
|
-
*
|
|
9
|
-
* @param fileName - File name relative to `projectDataDir(projectId)/`, e.g. `"patterns.json"`.
|
|
10
|
-
*
|
|
11
|
-
* All mutating methods (add / update / remove) acquire a per-file lock via
|
|
12
|
-
* `withFileLock` to prevent concurrent-write races.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* const store = createCrudStore<MyEntity>('my-entities.json');
|
|
17
|
-
* const all = await store.list(projectId);
|
|
18
|
-
* await store.add(projectId, { id: 'x', ... });
|
|
19
|
-
* await store.update(projectId, 'x', { field: 'value' });
|
|
20
|
-
* await store.remove(projectId, 'x');
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export function createCrudStore(fileName) {
|
|
24
|
-
function filePath(projectId) {
|
|
25
|
-
return `${projectDataDir(projectId)}/${fileName}`;
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
async list(projectId) {
|
|
29
|
-
return readJson(filePath(projectId), []);
|
|
30
|
-
},
|
|
31
|
-
async get(projectId, id) {
|
|
32
|
-
const items = await readJson(filePath(projectId), []);
|
|
33
|
-
return items.find((item) => item.id === id);
|
|
34
|
-
},
|
|
35
|
-
async add(projectId, item) {
|
|
36
|
-
const fp = filePath(projectId);
|
|
37
|
-
await withFileLock(fp, async () => {
|
|
38
|
-
const items = await readJson(fp, []);
|
|
39
|
-
items.push(item);
|
|
40
|
-
await writeJson(fp, items);
|
|
41
|
-
});
|
|
42
|
-
},
|
|
43
|
-
async update(projectId, id, updates) {
|
|
44
|
-
const fp = filePath(projectId);
|
|
45
|
-
await withFileLock(fp, async () => {
|
|
46
|
-
const items = await readJson(fp, []);
|
|
47
|
-
const idx = items.findIndex((item) => item.id === id);
|
|
48
|
-
if (idx === -1) {
|
|
49
|
-
throw new Error(`[Planu] Item "${id}" not found in ${fileName} for project "${projectId}"`);
|
|
50
|
-
}
|
|
51
|
-
const existing = items[idx];
|
|
52
|
-
/* v8 ignore next 5 */
|
|
53
|
-
if (!existing) {
|
|
54
|
-
throw new Error(`[Planu] Item "${id}" not found in ${fileName} for project "${projectId}"`);
|
|
55
|
-
}
|
|
56
|
-
items[idx] = { ...existing, ...updates, id };
|
|
57
|
-
await writeJson(fp, items);
|
|
58
|
-
});
|
|
59
|
-
},
|
|
60
|
-
async remove(projectId, id) {
|
|
61
|
-
const fp = filePath(projectId);
|
|
62
|
-
await withFileLock(fp, async () => {
|
|
63
|
-
const items = await readJson(fp, []);
|
|
64
|
-
const filtered = items.filter((item) => item.id !== id);
|
|
65
|
-
if (filtered.length !== items.length) {
|
|
66
|
-
await writeJson(fp, filtered);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
//# sourceMappingURL=crud-store-factory.js.map
|