@joshski/dust 0.1.60 → 0.1.62

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.
@@ -0,0 +1,10 @@
1
+ import type { ReadableFileSystem } from '../cli/types';
2
+ export interface Fact {
3
+ slug: string;
4
+ title: string;
5
+ content: string;
6
+ }
7
+ /**
8
+ * Parses a fact markdown file into a structured Fact object.
9
+ */
10
+ export declare function parseFact(fileSystem: ReadableFileSystem, dustPath: string, slug: string): Promise<Fact>;
@@ -0,0 +1,49 @@
1
+ import type { FileSystem, ReadableFileSystem } from '../cli/types';
2
+ import { type Fact } from './facts';
3
+ import { type Idea, type IdeaOpenQuestion, type IdeaOption, parseOpenQuestions } from './ideas';
4
+ import { type Principle } from './principles';
5
+ import { type Task } from './tasks';
6
+ import { CAPTURE_IDEA_PREFIX, type CreateIdeaTransitionTaskResult, type DecomposeIdeaOptions, findAllCaptureIdeaTasks, type IdeaInProgress, type OpenQuestionResponse, type ParsedCaptureIdeaTask, type WorkflowTaskMatch } from './workflow-tasks';
7
+ export type { CreateIdeaTransitionTaskResult, DecomposeIdeaOptions, Fact, Idea, IdeaOpenQuestion, IdeaOption, OpenQuestionResponse, ParsedCaptureIdeaTask, Principle, Task, WorkflowTaskMatch, };
8
+ export { CAPTURE_IDEA_PREFIX, findAllCaptureIdeaTasks, parseOpenQuestions };
9
+ export type { IdeaInProgress };
10
+ export interface ArtifactsRepository {
11
+ parseIdea(options: {
12
+ slug: string;
13
+ }): Promise<Idea>;
14
+ listIdeas(): Promise<string[]>;
15
+ parsePrinciple(options: {
16
+ slug: string;
17
+ }): Promise<Principle>;
18
+ listPrinciples(): Promise<string[]>;
19
+ parseFact(options: {
20
+ slug: string;
21
+ }): Promise<Fact>;
22
+ listFacts(): Promise<string[]>;
23
+ parseTask(options: {
24
+ slug: string;
25
+ }): Promise<Task>;
26
+ listTasks(): Promise<string[]>;
27
+ createRefineIdeaTask(options: {
28
+ ideaSlug: string;
29
+ description?: string;
30
+ }): Promise<CreateIdeaTransitionTaskResult>;
31
+ createDecomposeIdeaTask(options: DecomposeIdeaOptions): Promise<CreateIdeaTransitionTaskResult>;
32
+ createShelveIdeaTask(options: {
33
+ ideaSlug: string;
34
+ description?: string;
35
+ }): Promise<CreateIdeaTransitionTaskResult>;
36
+ createCaptureIdeaTask(options: {
37
+ title: string;
38
+ description: string;
39
+ buildItNow?: boolean;
40
+ }): Promise<CreateIdeaTransitionTaskResult>;
41
+ findWorkflowTaskForIdea(options: {
42
+ ideaSlug: string;
43
+ }): Promise<WorkflowTaskMatch | null>;
44
+ parseCaptureIdeaTask(options: {
45
+ taskSlug: string;
46
+ }): Promise<ParsedCaptureIdeaTask | null>;
47
+ }
48
+ export declare function buildArtifactsRepository(fileSystem: FileSystem, dustPath: string): ArtifactsRepository;
49
+ export declare function buildReadOnlyArtifactsRepository(fileSystem: ReadableFileSystem, dustPath: string): Pick<ArtifactsRepository, 'parseIdea' | 'listIdeas' | 'parsePrinciple' | 'listPrinciples' | 'parseFact' | 'listFacts' | 'parseTask' | 'listTasks' | 'findWorkflowTaskForIdea' | 'parseCaptureIdeaTask'>;
@@ -0,0 +1,12 @@
1
+ import type { ReadableFileSystem } from '../cli/types';
2
+ export interface Principle {
3
+ slug: string;
4
+ title: string;
5
+ content: string;
6
+ parentPrinciple: string | null;
7
+ subPrinciples: string[];
8
+ }
9
+ /**
10
+ * Parses a principle markdown file into a structured Principle object.
11
+ */
12
+ export declare function parsePrinciple(fileSystem: ReadableFileSystem, dustPath: string, slug: string): Promise<Principle>;
@@ -0,0 +1,13 @@
1
+ import type { ReadableFileSystem } from '../cli/types';
2
+ export interface Task {
3
+ slug: string;
4
+ title: string;
5
+ content: string;
6
+ principles: string[];
7
+ blockedBy: string[];
8
+ definitionOfDone: string[];
9
+ }
10
+ /**
11
+ * Parses a task markdown file into a structured Task object.
12
+ */
13
+ export declare function parseTask(fileSystem: ReadableFileSystem, dustPath: string, slug: string): Promise<Task>;
package/dist/artifacts.js CHANGED
@@ -273,6 +273,32 @@ async function parseTask(fileSystem, dustPath, slug) {
273
273
  // lib/artifacts/workflow-tasks.ts
274
274
  var CAPTURE_IDEA_PREFIX = "Add Idea: ";
275
275
  var BUILD_IDEA_PREFIX = "Build Idea: ";
276
+ async function findAllCaptureIdeaTasks(fileSystem, dustPath) {
277
+ const tasksPath = `${dustPath}/tasks`;
278
+ if (!fileSystem.exists(tasksPath))
279
+ return [];
280
+ const files = await fileSystem.readdir(tasksPath);
281
+ const results = [];
282
+ for (const file of files.filter((f) => f.endsWith(".md")).sort()) {
283
+ const content = await fileSystem.readFile(`${tasksPath}/${file}`);
284
+ const titleMatch = content.match(/^#\s+(.+)$/m);
285
+ if (!titleMatch)
286
+ continue;
287
+ const title = titleMatch[1].trim();
288
+ if (title.startsWith(CAPTURE_IDEA_PREFIX)) {
289
+ results.push({
290
+ taskSlug: file.replace(/\.md$/, ""),
291
+ ideaTitle: title.slice(CAPTURE_IDEA_PREFIX.length)
292
+ });
293
+ } else if (title.startsWith(BUILD_IDEA_PREFIX)) {
294
+ results.push({
295
+ taskSlug: file.replace(/\.md$/, ""),
296
+ ideaTitle: title.slice(BUILD_IDEA_PREFIX.length)
297
+ });
298
+ }
299
+ }
300
+ return results;
301
+ }
276
302
  function titleToFilename(title) {
277
303
  return `${title.toLowerCase().replace(/\./g, "-").replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "")}.md`;
278
304
  }
@@ -594,6 +620,8 @@ function buildReadOnlyArtifactsRepository(fileSystem, dustPath) {
594
620
  }
595
621
  export {
596
622
  parseOpenQuestions,
623
+ findAllCaptureIdeaTasks,
597
624
  buildReadOnlyArtifactsRepository,
598
- buildArtifactsRepository
625
+ buildArtifactsRepository,
626
+ CAPTURE_IDEA_PREFIX
599
627
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joshski/dust",
3
- "version": "0.1.60",
3
+ "version": "0.1.62",
4
4
  "description": "Flow state for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "./artifacts": {
22
22
  "import": "./dist/artifacts.js",
23
- "types": "./dist/artifacts.d.ts"
23
+ "types": "./dist/artifacts/index.d.ts"
24
24
  },
25
25
  "./istanbul/minimal-reporter": "./lib/istanbul/minimal-reporter.cjs"
26
26
  },