digital-tasks 2.1.1 → 2.3.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +560 -0
  3. package/package.json +20 -5
  4. package/src/client.ts +268 -0
  5. package/src/index.ts +12 -10
  6. package/src/markdown.ts +63 -48
  7. package/src/project.ts +57 -42
  8. package/src/queue.ts +76 -37
  9. package/src/task.ts +132 -75
  10. package/src/types.ts +177 -40
  11. package/src/worker.ts +959 -0
  12. package/test/project.test.ts +28 -84
  13. package/test/queue.test.ts +51 -24
  14. package/test/task.test.ts +80 -27
  15. package/test/worker.test.ts +1158 -0
  16. package/tsconfig.json +2 -13
  17. package/vitest.config.ts +48 -0
  18. package/wrangler.jsonc +44 -0
  19. package/.turbo/turbo-build.log +0 -5
  20. package/dist/function-task.d.ts +0 -319
  21. package/dist/function-task.d.ts.map +0 -1
  22. package/dist/function-task.js +0 -286
  23. package/dist/function-task.js.map +0 -1
  24. package/dist/index.d.ts +0 -72
  25. package/dist/index.d.ts.map +0 -1
  26. package/dist/index.js +0 -74
  27. package/dist/index.js.map +0 -1
  28. package/dist/markdown.d.ts +0 -112
  29. package/dist/markdown.d.ts.map +0 -1
  30. package/dist/markdown.js +0 -510
  31. package/dist/markdown.js.map +0 -1
  32. package/dist/project.d.ts +0 -259
  33. package/dist/project.d.ts.map +0 -1
  34. package/dist/project.js +0 -397
  35. package/dist/project.js.map +0 -1
  36. package/dist/queue.d.ts +0 -17
  37. package/dist/queue.d.ts.map +0 -1
  38. package/dist/queue.js +0 -347
  39. package/dist/queue.js.map +0 -1
  40. package/dist/task.d.ts +0 -69
  41. package/dist/task.d.ts.map +0 -1
  42. package/dist/task.js +0 -321
  43. package/dist/task.js.map +0 -1
  44. package/dist/types.d.ts +0 -292
  45. package/dist/types.d.ts.map +0 -1
  46. package/dist/types.js +0 -15
  47. package/dist/types.js.map +0 -1
  48. package/src/index.js +0 -73
  49. package/src/markdown.js +0 -509
  50. package/src/project.js +0 -396
  51. package/src/queue.js +0 -346
  52. package/src/task.js +0 -320
  53. package/src/types.js +0 -14
@@ -1,286 +0,0 @@
1
- /**
2
- * Function-Task Integration
3
- *
4
- * Connects the task system with ai-functions Function definitions.
5
- * Every task is essentially a function call with typed inputs/outputs.
6
- *
7
- * ## Function Types
8
- *
9
- * Tasks can execute different function types:
10
- * - **Code**: Generates executable code
11
- * - **Generative**: AI generates text/objects (no tools)
12
- * - **Agentic**: AI with tools in a loop
13
- * - **Human**: Requires human input/approval
14
- *
15
- * ## Data Flow
16
- *
17
- * Tasks form a typed DAG where outputs flow to dependent task inputs:
18
- *
19
- * ```ts
20
- * const workflow = defineWorkflow({
21
- * name: 'Data Pipeline',
22
- * tasks: {
23
- * fetchData: generativeTask({
24
- * prompt: 'Fetch user data from API',
25
- * output: z.object({ users: z.array(z.object({ name: z.string() })) }),
26
- * }),
27
- * processData: codeTask({
28
- * input: (ctx) => ctx.outputs.fetchData, // Type-safe reference
29
- * language: 'typescript',
30
- * description: 'Filter active users',
31
- * }),
32
- * reviewResults: humanTask({
33
- * input: (ctx) => ctx.outputs.processData,
34
- * channel: 'slack',
35
- * instructions: 'Review the processed user list',
36
- * }),
37
- * },
38
- * // Dependencies inferred from input references
39
- * })
40
- * ```
41
- *
42
- * @packageDocumentation
43
- */
44
- // ============================================================================
45
- // Task Factory Functions
46
- // ============================================================================
47
- let taskIdCounter = 0;
48
- function generateFunctionTaskId() {
49
- return `ftask_${Date.now()}_${++taskIdCounter}`;
50
- }
51
- /**
52
- * Create a code task
53
- *
54
- * @example
55
- * ```ts
56
- * const task = codeTask({
57
- * name: 'Generate API client',
58
- * language: 'typescript',
59
- * instructions: 'Generate a type-safe API client from OpenAPI spec',
60
- * input: { spec: openApiSpec },
61
- * })
62
- * ```
63
- */
64
- export function codeTask(options) {
65
- return {
66
- id: generateFunctionTaskId(),
67
- functionType: 'code',
68
- ...options,
69
- };
70
- }
71
- /**
72
- * Create a generative task
73
- *
74
- * @example
75
- * ```ts
76
- * const task = generativeTask({
77
- * name: 'Summarize document',
78
- * prompt: 'Summarize the following document: {{document}}',
79
- * outputSchema: { summary: 'string', keyPoints: ['string'] },
80
- * })
81
- * ```
82
- */
83
- export function generativeTask(options) {
84
- return {
85
- id: generateFunctionTaskId(),
86
- functionType: 'generative',
87
- ...options,
88
- };
89
- }
90
- /**
91
- * Create an agentic task
92
- *
93
- * @example
94
- * ```ts
95
- * const task = agenticTask({
96
- * name: 'Research topic',
97
- * instructions: 'Research the given topic and compile a report',
98
- * tools: [searchTool, fetchTool, extractTool],
99
- * maxIterations: 10,
100
- * })
101
- * ```
102
- */
103
- export function agenticTask(options) {
104
- return {
105
- id: generateFunctionTaskId(),
106
- functionType: 'agentic',
107
- ...options,
108
- };
109
- }
110
- /**
111
- * Create a human task
112
- *
113
- * @example
114
- * ```ts
115
- * const task = humanTask({
116
- * name: 'Review PR',
117
- * channel: 'slack',
118
- * instructions: 'Review the code changes and approve or request changes',
119
- * responseSchema: { approved: 'boolean', feedback: 'string' },
120
- * })
121
- * ```
122
- */
123
- export function humanTask(options) {
124
- return {
125
- id: generateFunctionTaskId(),
126
- functionType: 'human',
127
- ...options,
128
- };
129
- }
130
- /**
131
- * Create a typed workflow with automatic dependency inference
132
- *
133
- * @example
134
- * ```ts
135
- * const contentPipeline = Workflow({
136
- * name: 'Content Pipeline',
137
- * tasks: {
138
- * research: agenticTask({
139
- * name: 'Research topic',
140
- * instructions: 'Research AI trends',
141
- * tools: [searchTool],
142
- * }),
143
- * outline: generativeTask({
144
- * name: 'Create outline',
145
- * prompt: 'Create outline from research',
146
- * input: (ctx) => ctx.getOutput('research'),
147
- * }),
148
- * draft: generativeTask({
149
- * name: 'Write draft',
150
- * prompt: 'Write article from outline',
151
- * input: (ctx) => ctx.getOutput('outline'),
152
- * }),
153
- * review: humanTask({
154
- * name: 'Review article',
155
- * channel: 'web',
156
- * instructions: 'Review and approve the article',
157
- * input: (ctx) => ctx.getOutput('draft'),
158
- * }),
159
- * },
160
- * })
161
- * ```
162
- */
163
- export function Workflow(options) {
164
- return {
165
- id: `wf_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
166
- name: options.name,
167
- description: options.description,
168
- tasks: options.tasks,
169
- dependencies: options.dependencies,
170
- defaultMode: options.defaultMode || 'sequential',
171
- metadata: options.metadata,
172
- };
173
- }
174
- /**
175
- * Convert function task type to base task type
176
- */
177
- function functionTypeToTaskType(functionType) {
178
- switch (functionType) {
179
- case 'code':
180
- return 'generation';
181
- case 'generative':
182
- return 'generation';
183
- case 'agentic':
184
- return 'research';
185
- case 'human':
186
- return 'approval';
187
- default:
188
- return 'action';
189
- }
190
- }
191
- /**
192
- * Convert a function task to a base Task
193
- */
194
- export function functionTaskToTask(functionTask) {
195
- return {
196
- title: functionTask.name,
197
- description: functionTask.description,
198
- type: functionTypeToTaskType(functionTask.functionType),
199
- priority: functionTask.priority || 'normal',
200
- tags: functionTask.tags,
201
- allowedWorkers: functionTask.functionType === 'human'
202
- ? ['human']
203
- : functionTask.functionType === 'agentic'
204
- ? ['agent']
205
- : ['any'],
206
- metadata: {
207
- _functionTaskId: functionTask.id,
208
- _functionType: functionTask.functionType,
209
- _functionDefinition: functionTask.definition,
210
- },
211
- };
212
- }
213
- /**
214
- * Infer dependencies from input resolvers
215
- */
216
- export function inferDependencies(workflow) {
217
- const dependencies = new Map();
218
- const taskIds = Object.keys(workflow.tasks);
219
- for (const [taskId, task] of Object.entries(workflow.tasks)) {
220
- const deps = [];
221
- // Check if input is a resolver function
222
- if (typeof task.input === 'function') {
223
- // Create a mock context to track which outputs are accessed
224
- const accessedOutputs = [];
225
- const mockContext = {
226
- outputs: new Proxy({}, {
227
- get(_, prop) {
228
- if (typeof prop === 'string' && taskIds.includes(prop)) {
229
- accessedOutputs.push(prop);
230
- }
231
- return undefined;
232
- },
233
- }),
234
- getOutput: (id) => {
235
- if (taskIds.includes(id)) {
236
- accessedOutputs.push(id);
237
- }
238
- return undefined;
239
- },
240
- metadata: {},
241
- };
242
- try {
243
- // Call the resolver to detect accessed outputs
244
- ;
245
- task.input(mockContext);
246
- }
247
- catch {
248
- // Resolver may throw if outputs are not available, that's ok
249
- }
250
- deps.push(...accessedOutputs);
251
- }
252
- // Add explicit dependencies
253
- const explicit = workflow.dependencies?.find(d => d.task === taskId);
254
- if (explicit) {
255
- const explicitDeps = Array.isArray(explicit.dependsOn)
256
- ? explicit.dependsOn
257
- : [explicit.dependsOn];
258
- deps.push(...explicitDeps);
259
- }
260
- dependencies.set(taskId, [...new Set(deps)]);
261
- }
262
- return dependencies;
263
- }
264
- /**
265
- * Get execution order for a workflow (topological sort)
266
- */
267
- export function getExecutionOrder(workflow) {
268
- const dependencies = inferDependencies(workflow);
269
- const taskIds = Object.keys(workflow.tasks);
270
- const result = [];
271
- const completed = new Set();
272
- while (completed.size < taskIds.length) {
273
- // Find tasks whose dependencies are all completed
274
- const ready = taskIds.filter(id => !completed.has(id) &&
275
- (dependencies.get(id) || []).every(dep => completed.has(dep)));
276
- if (ready.length === 0 && completed.size < taskIds.length) {
277
- throw new Error('Circular dependency detected in workflow');
278
- }
279
- // Group ready tasks (can run in parallel)
280
- result.push(ready);
281
- // Mark as completed
282
- ready.forEach(id => completed.add(id));
283
- }
284
- return result;
285
- }
286
- //# sourceMappingURL=function-task.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"function-task.js","sourceRoot":"","sources":["../src/function-task.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAkKH,+EAA+E;AAC/E,yBAAyB;AACzB,+EAA+E;AAE/E,IAAI,aAAa,GAAG,CAAC,CAAA;AAErB,SAAS,sBAAsB;IAC7B,OAAO,SAAS,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,CAAA;AACjD,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,QAAQ,CACtB,OA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
@@ -1,72 +0,0 @@
1
- /**
2
- * digital-tasks - Task management primitives for digital workers
3
- *
4
- * Task = Function + metadata (status, progress, assignment, dependencies)
5
- *
6
- * Every task wraps a function (code, generative, agentic, or human)
7
- * with lifecycle management, worker assignment, and dependency tracking.
8
- *
9
- * ## Quick Start
10
- *
11
- * ```ts
12
- * import { Task, createTask, taskQueue } from 'digital-tasks'
13
- *
14
- * // Create a task from a function
15
- * const task = await createTask({
16
- * function: {
17
- * type: 'generative',
18
- * name: 'summarize',
19
- * args: { text: 'The text to summarize' },
20
- * output: 'string',
21
- * promptTemplate: 'Summarize: {{text}}',
22
- * },
23
- * input: { text: 'Long article...' },
24
- * priority: 'high',
25
- * })
26
- *
27
- * // Start and complete
28
- * await startTask(task.id, { type: 'agent', id: 'agent_1' })
29
- * await completeTask(task.id, 'Summary of the article...')
30
- * ```
31
- *
32
- * ## Projects with Parallel/Sequential Tasks
33
- *
34
- * ```ts
35
- * import { createProject, task, parallel, sequential, toMarkdown } from 'digital-tasks'
36
- *
37
- * const project = createProject({
38
- * name: 'Launch Feature',
39
- * tasks: [
40
- * parallel(
41
- * task('Design mockups'),
42
- * task('Write tech spec'),
43
- * ),
44
- * sequential(
45
- * task('Implement backend'),
46
- * task('Implement frontend'),
47
- * task('Write tests'),
48
- * ),
49
- * ],
50
- * })
51
- *
52
- * // Convert to markdown
53
- * const md = toMarkdown(project)
54
- * // # Launch Feature
55
- * // - [ ] Design mockups
56
- * // - [ ] Write tech spec
57
- * // 1. [ ] Implement backend
58
- * // 2. [ ] Implement frontend
59
- * // 3. [ ] Write tests
60
- * ```
61
- *
62
- * @packageDocumentation
63
- */
64
- export type * from './types.js';
65
- export type { Task, AnyTask, TaskStatus, TaskPriority, TaskQueue, TaskQueueOptions, TaskResult, WorkerRef, WorkerType, TaskDependency, DependencyType, TaskProgress, TaskEvent, CreateTaskOptions, UpdateTaskOptions, TaskQuery, TaskQueueStats, FunctionDefinition, CodeFunctionDefinition, GenerativeFunctionDefinition, AgenticFunctionDefinition, HumanFunctionDefinition, } from './types.js';
66
- export { taskQueue, createTaskQueue } from './queue.js';
67
- export { createTask, getTask, startTask, updateProgress, completeTask, failTask, cancelTask, addComment, createSubtask, getSubtasks, waitForTask, } from './task.js';
68
- export type { ExecutionMode, FunctionType, TaskNode, TaskDefinition, ParallelGroup, SequentialGroup, Project, ProjectStatus, CreateProjectOptions, } from './project.js';
69
- export { task, parallel, sequential, createProject, workflow, materializeProject, getDependants, getDependencies, getReadyTasks, hasCycles, sortTasks, } from './project.js';
70
- export type { SerializeOptions } from './markdown.js';
71
- export { parseMarkdown, toMarkdown, syncStatusFromMarkdown, } from './markdown.js';
72
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAMH,mBAAmB,YAAY,CAAA;AAE/B,YAAY,EACV,IAAI,EACJ,OAAO,EACP,UAAU,EACV,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,UAAU,EACV,cAAc,EACd,cAAc,EACd,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,cAAc,EAEd,kBAAkB,EAClB,sBAAsB,EACtB,4BAA4B,EAC5B,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,YAAY,CAAA;AAMnB,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAMvD,OAAO,EACL,UAAU,EACV,OAAO,EACP,SAAS,EACT,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,UAAU,EACV,aAAa,EACb,WAAW,EACX,WAAW,GACZ,MAAM,WAAW,CAAA;AAMlB,YAAY,EACV,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,aAAa,EACb,eAAe,EACf,OAAO,EACP,aAAa,EACb,oBAAoB,GACrB,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,aAAa,EACb,QAAQ,EACR,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,aAAa,EACb,SAAS,EACT,SAAS,GACV,MAAM,cAAc,CAAA;AAMrB,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,OAAO,EACL,aAAa,EACb,UAAU,EACV,sBAAsB,GACvB,MAAM,eAAe,CAAA"}
package/dist/index.js DELETED
@@ -1,74 +0,0 @@
1
- /**
2
- * digital-tasks - Task management primitives for digital workers
3
- *
4
- * Task = Function + metadata (status, progress, assignment, dependencies)
5
- *
6
- * Every task wraps a function (code, generative, agentic, or human)
7
- * with lifecycle management, worker assignment, and dependency tracking.
8
- *
9
- * ## Quick Start
10
- *
11
- * ```ts
12
- * import { Task, createTask, taskQueue } from 'digital-tasks'
13
- *
14
- * // Create a task from a function
15
- * const task = await createTask({
16
- * function: {
17
- * type: 'generative',
18
- * name: 'summarize',
19
- * args: { text: 'The text to summarize' },
20
- * output: 'string',
21
- * promptTemplate: 'Summarize: {{text}}',
22
- * },
23
- * input: { text: 'Long article...' },
24
- * priority: 'high',
25
- * })
26
- *
27
- * // Start and complete
28
- * await startTask(task.id, { type: 'agent', id: 'agent_1' })
29
- * await completeTask(task.id, 'Summary of the article...')
30
- * ```
31
- *
32
- * ## Projects with Parallel/Sequential Tasks
33
- *
34
- * ```ts
35
- * import { createProject, task, parallel, sequential, toMarkdown } from 'digital-tasks'
36
- *
37
- * const project = createProject({
38
- * name: 'Launch Feature',
39
- * tasks: [
40
- * parallel(
41
- * task('Design mockups'),
42
- * task('Write tech spec'),
43
- * ),
44
- * sequential(
45
- * task('Implement backend'),
46
- * task('Implement frontend'),
47
- * task('Write tests'),
48
- * ),
49
- * ],
50
- * })
51
- *
52
- * // Convert to markdown
53
- * const md = toMarkdown(project)
54
- * // # Launch Feature
55
- * // - [ ] Design mockups
56
- * // - [ ] Write tech spec
57
- * // 1. [ ] Implement backend
58
- * // 2. [ ] Implement frontend
59
- * // 3. [ ] Write tests
60
- * ```
61
- *
62
- * @packageDocumentation
63
- */
64
- // ============================================================================
65
- // Task Queue
66
- // ============================================================================
67
- export { taskQueue, createTaskQueue } from './queue.js';
68
- // ============================================================================
69
- // Task Management
70
- // ============================================================================
71
- export { createTask, getTask, startTask, updateProgress, completeTask, failTask, cancelTask, addComment, createSubtask, getSubtasks, waitForTask, } from './task.js';
72
- export { task, parallel, sequential, createProject, workflow, materializeProject, getDependants, getDependencies, getReadyTasks, hasCycles, sortTasks, } from './project.js';
73
- export { parseMarkdown, toMarkdown, syncStatusFromMarkdown, } from './markdown.js';
74
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAkCH,+EAA+E;AAC/E,aAAa;AACb,+EAA+E;AAE/E,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEvD,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAE/E,OAAO,EACL,UAAU,EACV,OAAO,EACP,SAAS,EACT,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,UAAU,EACV,aAAa,EACb,WAAW,EACX,WAAW,GACZ,MAAM,WAAW,CAAA;AAkBlB,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,aAAa,EACb,QAAQ,EACR,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,aAAa,EACb,SAAS,EACT,SAAS,GACV,MAAM,cAAc,CAAA;AAQrB,OAAO,EACL,aAAa,EACb,UAAU,EACV,sBAAsB,GACvB,MAAM,eAAe,CAAA"}
@@ -1,112 +0,0 @@
1
- /**
2
- * Markdown Task List Parser and Serializer
3
- *
4
- * Bidirectional conversion between markdown task lists and Task objects.
5
- *
6
- * ## Syntax
7
- *
8
- * - `- [ ]` = Unordered/parallel tasks (can run simultaneously)
9
- * - `1. [ ]` = Ordered/sequential tasks (must run in order)
10
- * - `- [x]` or `1. [x]` = Completed task
11
- * - `- [-]` = In progress task
12
- * - `- [~]` = Blocked task
13
- * - `- [!]` = Failed task
14
- * - Indentation (2 spaces) = Subtasks
15
- * - `# Heading` = Project name
16
- * - `## Heading` = Task group/section
17
- *
18
- * ## Example
19
- *
20
- * ```markdown
21
- * # Launch Feature
22
- *
23
- * ## Planning (parallel)
24
- * - [ ] Design mockups
25
- * - [ ] Write technical spec
26
- * - [x] Create project board
27
- *
28
- * ## Implementation (sequential)
29
- * 1. [ ] Implement backend API
30
- * 2. [-] Implement frontend UI
31
- * - [ ] Create components
32
- * - [ ] Add state management
33
- * 3. [ ] Write tests
34
- *
35
- * ## Deployment
36
- * 1. [ ] Deploy to staging
37
- * 2. [ ] QA testing
38
- * 3. [ ] Deploy to production
39
- * ```
40
- *
41
- * @packageDocumentation
42
- */
43
- import type { Project } from './project.js';
44
- /**
45
- * Parse a markdown string into a Project
46
- *
47
- * @example
48
- * ```ts
49
- * const markdown = `
50
- * # My Project
51
- *
52
- * - [ ] Task 1
53
- * - [ ] Task 2
54
- *
55
- * ## Sequential Work
56
- * 1. [ ] Step 1
57
- * 2. [ ] Step 2
58
- * `
59
- *
60
- * const project = parseMarkdown(markdown)
61
- * ```
62
- */
63
- export declare function parseMarkdown(markdown: string): Project;
64
- /**
65
- * Options for markdown serialization
66
- */
67
- export interface SerializeOptions {
68
- /** Include status markers (default: true) */
69
- includeStatus?: boolean;
70
- /** Include priority markers (default: false) */
71
- includePriority?: boolean;
72
- /** Indent size in spaces (default: 2) */
73
- indentSize?: number;
74
- /** Include section headings (default: true) */
75
- includeSections?: boolean;
76
- }
77
- /**
78
- * Serialize a Project to markdown
79
- *
80
- * @example
81
- * ```ts
82
- * const project = createProject({
83
- * name: 'My Project',
84
- * tasks: [
85
- * parallel(
86
- * task('Task 1'),
87
- * task('Task 2'),
88
- * ),
89
- * sequential(
90
- * task('Step 1'),
91
- * task('Step 2'),
92
- * ),
93
- * ],
94
- * })
95
- *
96
- * const markdown = toMarkdown(project)
97
- * // # My Project
98
- * //
99
- * // - [ ] Task 1
100
- * // - [ ] Task 2
101
- * //
102
- * // 1. [ ] Step 1
103
- * // 2. [ ] Step 2
104
- * ```
105
- */
106
- export declare function toMarkdown(project: Project, options?: SerializeOptions): string;
107
- /**
108
- * Update task statuses in a project from markdown
109
- * (Useful for syncing when markdown is edited externally)
110
- */
111
- export declare function syncStatusFromMarkdown(project: Project, markdown: string): Project;
112
- //# sourceMappingURL=markdown.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAGH,OAAO,KAAK,EACV,OAAO,EAMR,MAAM,cAAc,CAAA;AAqPrB;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAwFvD;AAMD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,gDAAgD;IAChD,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,+CAA+C;IAC/C,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AA4ED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAwBnF;AAMD;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CA0DT"}