@joshski/dust 0.1.108 → 0.1.109
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/audits.js +503 -28
- package/dist/dust.js +545 -56
- package/dist/filesystem/error-codes.d.ts +2 -0
- package/dist/loop/iteration.d.ts +2 -2
- package/dist/patch.js +18 -10
- package/dist/validation.js +15 -7
- package/package.json +1 -1
package/dist/loop/iteration.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { CommandDependencies } from '../cli/types';
|
|
|
7
7
|
import { type InvalidTask, type UnblockedTask } from '../cli/commands/next';
|
|
8
8
|
import type { LoopEmitFn } from './events';
|
|
9
9
|
import type { PostEventFn, SendAgentEventFn } from './wire-events';
|
|
10
|
-
export declare
|
|
10
|
+
export declare function DUST_QUICK_REFERENCE(dustCommand: string): string;
|
|
11
11
|
export interface LoopDependencies {
|
|
12
12
|
spawn: typeof nodeSpawn;
|
|
13
13
|
run: BoundRunFn;
|
|
@@ -46,5 +46,5 @@ export declare function findAvailableTasks(dependencies: CommandDependencies): P
|
|
|
46
46
|
invalidTasks: InvalidTask[];
|
|
47
47
|
}>;
|
|
48
48
|
export declare function runOneIteration(dependencies: CommandDependencies, loopDependencies: LoopDependencies, onLoopEvent: LoopEmitFn, onAgentEvent?: SendAgentEventFn, options?: IterationOptions): Promise<IterationResult>;
|
|
49
|
-
export declare function buildTaskPrompt(taskPath: string, taskContent: string, instructions: string, toolsSection: string, branch?: string): string;
|
|
49
|
+
export declare function buildTaskPrompt(taskPath: string, taskContent: string, instructions: string, toolsSection: string, dustCommand: string, branch?: string): string;
|
|
50
50
|
export {};
|
package/dist/patch.js
CHANGED
|
@@ -158,6 +158,14 @@ var ARTIFACT_TYPES = [
|
|
|
158
158
|
"tasks"
|
|
159
159
|
];
|
|
160
160
|
|
|
161
|
+
// lib/filesystem/error-codes.ts
|
|
162
|
+
function isErrnoException(error) {
|
|
163
|
+
return typeof error === "object" && error !== null && "code" in error && typeof error.code === "string";
|
|
164
|
+
}
|
|
165
|
+
function isErrorCode(error, code) {
|
|
166
|
+
return isErrnoException(error) && error.code === code;
|
|
167
|
+
}
|
|
168
|
+
|
|
161
169
|
// lib/validation/index.ts
|
|
162
170
|
import { relative } from "node:path";
|
|
163
171
|
|
|
@@ -212,7 +220,7 @@ function createOverlayFileSystem(base, patchFiles, deletedPaths = new Set) {
|
|
|
212
220
|
}
|
|
213
221
|
}
|
|
214
222
|
} catch (error) {
|
|
215
|
-
if (error
|
|
223
|
+
if (!isErrorCode(error, "ENOENT")) {
|
|
216
224
|
throw error;
|
|
217
225
|
}
|
|
218
226
|
}
|
|
@@ -349,7 +357,7 @@ async function validateContentDirectoryFiles(dirPath, fileSystem) {
|
|
|
349
357
|
try {
|
|
350
358
|
entries = await fileSystem.readdir(dirPath);
|
|
351
359
|
} catch (error) {
|
|
352
|
-
if (error
|
|
360
|
+
if (isErrorCode(error, "ENOENT")) {
|
|
353
361
|
return [];
|
|
354
362
|
}
|
|
355
363
|
throw error;
|
|
@@ -770,7 +778,7 @@ async function parseArtifacts(fileSystem, dustPath) {
|
|
|
770
778
|
try {
|
|
771
779
|
rootEntries = await fileSystem.readdir(dustPath);
|
|
772
780
|
} catch (error) {
|
|
773
|
-
if (error
|
|
781
|
+
if (isErrorCode(error, "ENOENT")) {
|
|
774
782
|
rootEntries = [];
|
|
775
783
|
} else {
|
|
776
784
|
throw error;
|
|
@@ -784,7 +792,7 @@ async function parseArtifacts(fileSystem, dustPath) {
|
|
|
784
792
|
try {
|
|
785
793
|
content = await fileSystem.readFile(filePath);
|
|
786
794
|
} catch (error) {
|
|
787
|
-
if (error
|
|
795
|
+
if (isErrorCode(error, "ENOENT")) {
|
|
788
796
|
continue;
|
|
789
797
|
}
|
|
790
798
|
throw error;
|
|
@@ -800,7 +808,7 @@ async function parseArtifacts(fileSystem, dustPath) {
|
|
|
800
808
|
try {
|
|
801
809
|
entries = await fileSystem.readdir(dirPath);
|
|
802
810
|
} catch (error) {
|
|
803
|
-
if (error
|
|
811
|
+
if (isErrorCode(error, "ENOENT")) {
|
|
804
812
|
continue;
|
|
805
813
|
}
|
|
806
814
|
throw error;
|
|
@@ -828,7 +836,7 @@ async function parseArtifacts(fileSystem, dustPath) {
|
|
|
828
836
|
try {
|
|
829
837
|
auditEntries = await fileSystem.readdir(auditsPath);
|
|
830
838
|
} catch (error) {
|
|
831
|
-
if (error
|
|
839
|
+
if (isErrorCode(error, "ENOENT")) {
|
|
832
840
|
auditEntries = [];
|
|
833
841
|
} else {
|
|
834
842
|
throw error;
|
|
@@ -842,7 +850,7 @@ async function parseArtifacts(fileSystem, dustPath) {
|
|
|
842
850
|
try {
|
|
843
851
|
content = await fileSystem.readFile(filePath);
|
|
844
852
|
} catch (error) {
|
|
845
|
-
if (error
|
|
853
|
+
if (isErrorCode(error, "ENOENT")) {
|
|
846
854
|
continue;
|
|
847
855
|
}
|
|
848
856
|
throw error;
|
|
@@ -1278,7 +1286,7 @@ async function loadExistingPrincipleRelationships(fileSystem, dustPath) {
|
|
|
1278
1286
|
try {
|
|
1279
1287
|
entries = await fileSystem.readdir(principlesDir);
|
|
1280
1288
|
} catch (error) {
|
|
1281
|
-
if (error
|
|
1289
|
+
if (isErrorCode(error, "ENOENT")) {
|
|
1282
1290
|
return relationships;
|
|
1283
1291
|
}
|
|
1284
1292
|
throw error;
|
|
@@ -1393,7 +1401,7 @@ async function findReferencesToDeletedPaths(fileSystem, dustPath, deletedPaths)
|
|
|
1393
1401
|
try {
|
|
1394
1402
|
entries = await fileSystem.readdir(dirPath);
|
|
1395
1403
|
} catch (error) {
|
|
1396
|
-
if (error
|
|
1404
|
+
if (isErrorCode(error, "ENOENT")) {
|
|
1397
1405
|
continue;
|
|
1398
1406
|
}
|
|
1399
1407
|
throw error;
|
|
@@ -1559,7 +1567,7 @@ async function fileExists(fileSystem, path) {
|
|
|
1559
1567
|
await fileSystem.readFile(path);
|
|
1560
1568
|
return true;
|
|
1561
1569
|
} catch (error) {
|
|
1562
|
-
if (error
|
|
1570
|
+
if (isErrorCode(error, "ENOENT")) {
|
|
1563
1571
|
return false;
|
|
1564
1572
|
}
|
|
1565
1573
|
throw error;
|
package/dist/validation.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
// lib/validation/index.ts
|
|
2
2
|
import { relative } from "node:path";
|
|
3
3
|
|
|
4
|
+
// lib/filesystem/error-codes.ts
|
|
5
|
+
function isErrnoException(error) {
|
|
6
|
+
return typeof error === "object" && error !== null && "code" in error && typeof error.code === "string";
|
|
7
|
+
}
|
|
8
|
+
function isErrorCode(error, code) {
|
|
9
|
+
return isErrnoException(error) && error.code === code;
|
|
10
|
+
}
|
|
11
|
+
|
|
4
12
|
// lib/validation/overlay-filesystem.ts
|
|
5
13
|
function createOverlayFileSystem(base, patchFiles, deletedPaths = new Set) {
|
|
6
14
|
const patchDirs = new Set;
|
|
@@ -52,7 +60,7 @@ function createOverlayFileSystem(base, patchFiles, deletedPaths = new Set) {
|
|
|
52
60
|
}
|
|
53
61
|
}
|
|
54
62
|
} catch (error) {
|
|
55
|
-
if (error
|
|
63
|
+
if (!isErrorCode(error, "ENOENT")) {
|
|
56
64
|
throw error;
|
|
57
65
|
}
|
|
58
66
|
}
|
|
@@ -346,7 +354,7 @@ async function validateContentDirectoryFiles(dirPath, fileSystem) {
|
|
|
346
354
|
try {
|
|
347
355
|
entries = await fileSystem.readdir(dirPath);
|
|
348
356
|
} catch (error) {
|
|
349
|
-
if (error
|
|
357
|
+
if (isErrorCode(error, "ENOENT")) {
|
|
350
358
|
return [];
|
|
351
359
|
}
|
|
352
360
|
throw error;
|
|
@@ -767,7 +775,7 @@ async function parseArtifacts(fileSystem, dustPath) {
|
|
|
767
775
|
try {
|
|
768
776
|
rootEntries = await fileSystem.readdir(dustPath);
|
|
769
777
|
} catch (error) {
|
|
770
|
-
if (error
|
|
778
|
+
if (isErrorCode(error, "ENOENT")) {
|
|
771
779
|
rootEntries = [];
|
|
772
780
|
} else {
|
|
773
781
|
throw error;
|
|
@@ -781,7 +789,7 @@ async function parseArtifacts(fileSystem, dustPath) {
|
|
|
781
789
|
try {
|
|
782
790
|
content = await fileSystem.readFile(filePath);
|
|
783
791
|
} catch (error) {
|
|
784
|
-
if (error
|
|
792
|
+
if (isErrorCode(error, "ENOENT")) {
|
|
785
793
|
continue;
|
|
786
794
|
}
|
|
787
795
|
throw error;
|
|
@@ -797,7 +805,7 @@ async function parseArtifacts(fileSystem, dustPath) {
|
|
|
797
805
|
try {
|
|
798
806
|
entries = await fileSystem.readdir(dirPath);
|
|
799
807
|
} catch (error) {
|
|
800
|
-
if (error
|
|
808
|
+
if (isErrorCode(error, "ENOENT")) {
|
|
801
809
|
continue;
|
|
802
810
|
}
|
|
803
811
|
throw error;
|
|
@@ -825,7 +833,7 @@ async function parseArtifacts(fileSystem, dustPath) {
|
|
|
825
833
|
try {
|
|
826
834
|
auditEntries = await fileSystem.readdir(auditsPath);
|
|
827
835
|
} catch (error) {
|
|
828
|
-
if (error
|
|
836
|
+
if (isErrorCode(error, "ENOENT")) {
|
|
829
837
|
auditEntries = [];
|
|
830
838
|
} else {
|
|
831
839
|
throw error;
|
|
@@ -839,7 +847,7 @@ async function parseArtifacts(fileSystem, dustPath) {
|
|
|
839
847
|
try {
|
|
840
848
|
content = await fileSystem.readFile(filePath);
|
|
841
849
|
} catch (error) {
|
|
842
|
-
if (error
|
|
850
|
+
if (isErrorCode(error, "ENOENT")) {
|
|
843
851
|
continue;
|
|
844
852
|
}
|
|
845
853
|
throw error;
|