@joshski/dust 0.1.96 → 0.1.98

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,8 +1,9 @@
1
1
  /**
2
2
  * Content validation for .dust markdown files
3
3
  */
4
+ import type { ParsedArtifact } from '../../artifacts/parsed-artifact';
4
5
  import type { Violation } from './types';
5
- export declare function validateOpeningSentence(filePath: string, content: string): Violation | null;
6
- export declare function validateOpeningSentenceLength(filePath: string, content: string): Violation | null;
7
- export declare function validateImperativeOpeningSentence(filePath: string, content: string): Violation | null;
8
- export declare function validateTaskHeadings(filePath: string, content: string): Violation[];
6
+ export declare function validateOpeningSentence(artifact: ParsedArtifact): Violation | null;
7
+ export declare function validateOpeningSentenceLength(artifact: ParsedArtifact): Violation | null;
8
+ export declare function validateImperativeOpeningSentence(artifact: ParsedArtifact): Violation | null;
9
+ export declare function validateTaskHeadings(artifact: ParsedArtifact): Violation[];
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Filename validation for .dust markdown files
3
3
  */
4
+ import type { ParsedArtifact } from '../../artifacts/parsed-artifact';
4
5
  import type { Violation } from './types';
5
6
  export declare function validateFilename(filePath: string): Violation | null;
6
- export declare function validateTitleFilenameMatch(filePath: string, content: string): Violation | null;
7
+ export declare function validateTitleFilenameMatch(artifact: ParsedArtifact): Violation | null;
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Idea file validation for .dust markdown files
3
3
  */
4
+ import type { ParsedArtifact } from '../../artifacts/parsed-artifact';
4
5
  import type { ReadableFileSystem } from '../../filesystem/types';
5
6
  import type { Violation } from './types';
6
- export declare function validateIdeaOpenQuestions(filePath: string, content: string): Violation[];
7
- export declare function validateIdeaTransitionTitle(filePath: string, content: string, ideasPath: string, fileSystem: ReadableFileSystem): Violation | null;
8
- export declare function validateWorkflowTaskBodySection(filePath: string, content: string, ideasPath: string, fileSystem: ReadableFileSystem): Violation[];
7
+ export declare function validateIdeaOpenQuestions(artifact: ParsedArtifact): Violation[];
8
+ export declare function validateIdeaTransitionTitle(artifact: ParsedArtifact, ideasPath: string, fileSystem: ReadableFileSystem): Violation | null;
9
+ export declare function validateWorkflowTaskBodySection(artifact: ParsedArtifact, ideasPath: string, fileSystem: ReadableFileSystem): Violation[];
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Link validation for .dust markdown files
3
3
  */
4
+ import type { ParsedArtifact } from '../../artifacts/parsed-artifact';
4
5
  import type { ReadableFileSystem } from '../../filesystem/types';
5
6
  import type { Violation } from './types';
6
- export declare function validateLinks(filePath: string, content: string, fileSystem: ReadableFileSystem): Violation[];
7
- export declare function validateSemanticLinks(filePath: string, content: string): Violation[];
8
- export declare function validatePrincipleHierarchyLinks(filePath: string, content: string): Violation[];
7
+ export declare function validateLinks(artifact: ParsedArtifact, fileSystem: ReadableFileSystem): Violation[];
8
+ export declare function validateSemanticLinks(artifact: ParsedArtifact): Violation[];
9
+ export declare function validatePrincipleHierarchyLinks(artifact: ParsedArtifact): Violation[];
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * Principle hierarchy validation for .dust markdown files
3
3
  */
4
+ import type { ParsedArtifact } from '../../artifacts/parsed-artifact';
4
5
  import type { PrincipleRelationships, Violation } from './types';
5
6
  export type { PrincipleRelationships };
6
- export declare function validatePrincipleHierarchySections(filePath: string, content: string): Violation[];
7
- export declare function extractPrincipleRelationships(filePath: string, content: string): PrincipleRelationships;
7
+ export declare function validatePrincipleHierarchySections(artifact: ParsedArtifact): Violation[];
8
+ export declare function extractPrincipleRelationships(artifact: ParsedArtifact): PrincipleRelationships;
8
9
  export declare function validateBidirectionalLinks(allPrincipleRelationships: PrincipleRelationships[]): Violation[];
9
10
  export declare function validateNoCycles(allPrincipleRelationships: PrincipleRelationships[]): Violation[];
@@ -47,6 +47,23 @@ export interface LoopDockerErrorEvent {
47
47
  type: 'loop.docker_error';
48
48
  error: string;
49
49
  }
50
- export type LoopEvent = LoopWarningEvent | LoopStartedEvent | LoopSyncingEvent | LoopSyncSkippedEvent | LoopCheckingTasksEvent | LoopNoTasksEvent | LoopTasksFoundEvent | LoopIterationCompleteEvent | LoopEndedEvent | LoopDockerDetectedEvent | LoopDockerBuildingEvent | LoopDockerBuiltEvent | LoopDockerErrorEvent;
50
+ export interface LoopInstallingEvent {
51
+ type: 'loop.installing';
52
+ }
53
+ export interface LoopInstallFailedEvent {
54
+ type: 'loop.install_failed';
55
+ output: string;
56
+ }
57
+ export interface LoopRunningChecksEvent {
58
+ type: 'loop.running_checks';
59
+ }
60
+ export interface LoopChecksPassedEvent {
61
+ type: 'loop.checks_passed';
62
+ }
63
+ export interface LoopChecksFailedEvent {
64
+ type: 'loop.checks_failed';
65
+ output: string;
66
+ }
67
+ export type LoopEvent = LoopWarningEvent | LoopStartedEvent | LoopSyncingEvent | LoopSyncSkippedEvent | LoopCheckingTasksEvent | LoopNoTasksEvent | LoopTasksFoundEvent | LoopIterationCompleteEvent | LoopEndedEvent | LoopDockerDetectedEvent | LoopDockerBuildingEvent | LoopDockerBuiltEvent | LoopDockerErrorEvent | LoopInstallingEvent | LoopInstallFailedEvent | LoopRunningChecksEvent | LoopChecksPassedEvent | LoopChecksFailedEvent;
51
68
  export type LoopEmitFn = (event: LoopEvent) => void;
52
69
  export declare function formatLoopEvent(event: LoopEvent): string | null;
@@ -1,9 +1,9 @@
1
1
  import type { spawn as nodeSpawn } from 'node:child_process';
2
- type GitPullResult = {
2
+ type PullResult = {
3
3
  success: true;
4
4
  } | {
5
5
  success: false;
6
6
  message: string;
7
7
  };
8
- export declare function gitPull(cwd: string, spawn: typeof nodeSpawn): Promise<GitPullResult>;
8
+ export declare function gitPull(cwd: string, spawn: typeof nodeSpawn): Promise<PullResult>;
9
9
  export {};
@@ -3,6 +3,7 @@ import { run as claudeRun } from '../claude/run';
3
3
  import type { DockerSpawnConfig } from '../claude/types';
4
4
  import type { DockerDependencies } from '../docker/docker-agent';
5
5
  import { type SessionConfig } from '../env-config';
6
+ import { type ShellRunner } from '../cli/process-runner';
6
7
  import type { CommandDependencies } from '../cli/types';
7
8
  import { type InvalidTask, type UnblockedTask } from '../cli/commands/next';
8
9
  import type { LoopEmitFn } from './events';
@@ -17,9 +18,11 @@ export interface LoopDependencies {
17
18
  fetch?: typeof fetch;
18
19
  /** Optional overrides for Docker dependency functions (for testing) */
19
20
  dockerDeps?: Partial<DockerDependencies>;
21
+ /** Shell runner for executing pre-flight commands (install, check) */
22
+ shellRunner?: ShellRunner;
20
23
  }
21
24
  export declare function createDefaultDependencies(): LoopDependencies;
22
- type IterationResult = 'no_tasks' | 'ran_claude' | 'claude_error' | 'resolved_pull_conflict';
25
+ type IterationResult = 'no_tasks' | 'ran_claude' | 'claude_error' | 'resolved_pull_conflict' | 'ran_check_fix';
23
26
  type LogFn = (message: string) => void;
24
27
  export interface IterationOptions {
25
28
  onRawEvent?: (rawEvent: Record<string, unknown>) => void;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Fact serialization and patch building functions.
3
+ */
4
+ export interface FactInput {
5
+ title: string;
6
+ body: string;
7
+ }
8
+ /**
9
+ * Serializes a FactInput object to markdown format.
10
+ */
11
+ export declare function serializeFact(input: FactInput): string;
12
+ /**
13
+ * Builds file entries for a fact artifact patch.
14
+ */
15
+ export declare function buildFactFiles(input: FactInput, slug: string): Record<string, string>;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Idea serialization and patch building functions.
3
+ */
4
+ export interface IdeaOpenQuestion {
5
+ question: string;
6
+ options: Array<{
7
+ name: string;
8
+ description: string;
9
+ }>;
10
+ }
11
+ export interface IdeaInput {
12
+ title: string;
13
+ body?: string;
14
+ openQuestions?: IdeaOpenQuestion[];
15
+ }
16
+ /**
17
+ * Serializes an IdeaInput object to markdown format.
18
+ */
19
+ export declare function serializeIdea(input: IdeaInput): string;
20
+ /**
21
+ * Builds file entries for an idea artifact patch.
22
+ */
23
+ export declare function buildIdeaFiles(input: IdeaInput, slug: string): Record<string, string>;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Artifact patch building API.
3
+ *
4
+ * Provides functions for building multi-file artifact patches from
5
+ * structured objects with automatic validation.
6
+ */
7
+ import type { ReadableFileSystem } from '../filesystem/types';
8
+ import type { Violation } from '../lint/validators/types';
9
+ import { type ArtifactPatch } from '../validation/index';
10
+ import { type FactInput } from './fact';
11
+ import { type IdeaInput } from './idea';
12
+ import { type PrincipleInput } from './principle';
13
+ import { type TaskInput } from './task';
14
+ export { serializeFact } from './fact';
15
+ export type { FactInput } from './fact';
16
+ export { serializeIdea } from './idea';
17
+ export type { IdeaInput, IdeaOpenQuestion } from './idea';
18
+ export { serializePrinciple } from './principle';
19
+ export type { PrincipleInput } from './principle';
20
+ export { serializeTask } from './task';
21
+ export type { TaskInput, StandardTaskInput, WorkflowTaskInput } from './task';
22
+ export type { ArtifactPatch, Violation };
23
+ export interface ArtifactPatchInput {
24
+ facts?: Record<string, FactInput | null>;
25
+ ideas?: Record<string, IdeaInput | null>;
26
+ principles?: Record<string, PrincipleInput | null>;
27
+ tasks?: Record<string, TaskInput | null>;
28
+ }
29
+ export interface BuildArtifactPatchResult {
30
+ valid: boolean;
31
+ violations: Violation[];
32
+ patch: ArtifactPatch;
33
+ }
34
+ interface ValidatePatchOptions {
35
+ cwd?: string;
36
+ }
37
+ /**
38
+ * Builds an artifact patch from structured input objects.
39
+ *
40
+ * @param fileSystem - The existing filesystem
41
+ * @param dustPath - Absolute path to the .dust directory
42
+ * @param input - Structured artifact input objects
43
+ * @param options - Optional configuration (e.g., cwd for relative violation paths)
44
+ * @returns Result with validation status and the patch
45
+ *
46
+ * @example
47
+ * const result = await buildArtifactPatch(fileSystem, '.dust', {
48
+ * facts: {
49
+ * 'new-fact': { title: 'New Fact', body: 'Description here.' },
50
+ * 'old-fact': null, // delete
51
+ * },
52
+ * })
53
+ */
54
+ export declare function buildArtifactPatch(fileSystem: ReadableFileSystem, dustPath: string, input: ArtifactPatchInput, options?: ValidatePatchOptions): Promise<BuildArtifactPatchResult>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Principle serialization and patch building functions.
3
+ */
4
+ export interface PrincipleInput {
5
+ title: string;
6
+ body?: string;
7
+ parentPrinciple?: string | null;
8
+ subPrinciples?: string[];
9
+ }
10
+ /**
11
+ * Serializes a PrincipleInput object to markdown format.
12
+ */
13
+ export declare function serializePrinciple(input: PrincipleInput): string;
14
+ /**
15
+ * Builds file entries for a principle artifact patch.
16
+ */
17
+ export declare function buildPrincipleFiles(input: PrincipleInput, slug: string): Record<string, string>;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Task serialization and patch building functions.
3
+ */
4
+ export interface StandardTaskInput {
5
+ type?: undefined;
6
+ title: string;
7
+ body?: string;
8
+ blockedBy?: string[];
9
+ principles?: string[];
10
+ definitionOfDone: string[];
11
+ }
12
+ export interface WorkflowTaskInput {
13
+ type: 'capture-idea' | 'refine-idea' | 'decompose-idea' | 'shelve-idea';
14
+ ideaSlug: string;
15
+ definitionOfDone?: string[];
16
+ }
17
+ export type TaskInput = StandardTaskInput | WorkflowTaskInput;
18
+ /**
19
+ * Serializes a TaskInput object to markdown format.
20
+ */
21
+ export declare function serializeTask(input: TaskInput): string;
22
+ /**
23
+ * Builds file entries for a task artifact patch.
24
+ */
25
+ export declare function buildTaskFiles(input: TaskInput, slug: string): Record<string, string>;