@joshski/dust 0.1.28 → 0.1.29

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.
@@ -1,5 +1,11 @@
1
1
  import type { FileSystem } from './cli/types';
2
2
  export declare const IDEA_TRANSITION_PREFIXES: string[];
3
+ export declare const CAPTURE_IDEA_PREFIX = "Add Idea: ";
4
+ export interface IdeaInProgress {
5
+ taskSlug: string;
6
+ ideaTitle: string;
7
+ }
8
+ export declare function findAllCaptureIdeaTasks(fileSystem: FileSystem, dustPath: string): Promise<IdeaInProgress[]>;
3
9
  /**
4
10
  * Converts a markdown title to the expected filename using deterministic rules:
5
11
  * 1. Convert to lowercase
@@ -4,6 +4,28 @@ var IDEA_TRANSITION_PREFIXES = [
4
4
  "Create Task From Idea: ",
5
5
  "Shelve Idea: "
6
6
  ];
7
+ var CAPTURE_IDEA_PREFIX = "Add Idea: ";
8
+ async function findAllCaptureIdeaTasks(fileSystem, dustPath) {
9
+ const tasksPath = `${dustPath}/tasks`;
10
+ if (!fileSystem.exists(tasksPath))
11
+ return [];
12
+ const files = await fileSystem.readdir(tasksPath);
13
+ const results = [];
14
+ for (const file of files.filter((f) => f.endsWith(".md")).sort()) {
15
+ const content = await fileSystem.readFile(`${tasksPath}/${file}`);
16
+ const titleMatch = content.match(/^#\s+(.+)$/m);
17
+ if (!titleMatch)
18
+ continue;
19
+ const title = titleMatch[1].trim();
20
+ if (title.startsWith(CAPTURE_IDEA_PREFIX)) {
21
+ results.push({
22
+ taskSlug: file.replace(/\.md$/, ""),
23
+ ideaTitle: title.slice(CAPTURE_IDEA_PREFIX.length)
24
+ });
25
+ }
26
+ }
27
+ return results;
28
+ }
7
29
  function titleToFilename(title) {
8
30
  return `${title.toLowerCase().replace(/\./g, "-").replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "")}.md`;
9
31
  }
@@ -125,9 +147,11 @@ async function createCaptureIdeaTask(fileSystem, dustPath, title, description) {
125
147
  export {
126
148
  titleToFilename,
127
149
  findWorkflowTask,
150
+ findAllCaptureIdeaTasks,
128
151
  createTaskFromIdea,
129
152
  createShelveIdeaTask,
130
153
  createRefineIdeaTask,
131
154
  createCaptureIdeaTask,
132
- IDEA_TRANSITION_PREFIXES
155
+ IDEA_TRANSITION_PREFIXES,
156
+ CAPTURE_IDEA_PREFIX
133
157
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joshski/dust",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "Flow state for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {