@joshski/dust 0.1.100 → 0.1.101

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 (68) hide show
  1. package/.dust/principles/actionable-errors.md +18 -0
  2. package/.dust/principles/agent-agnostic-design.md +21 -0
  3. package/.dust/principles/agent-autonomy.md +19 -0
  4. package/.dust/principles/agent-context-inference.md +19 -0
  5. package/.dust/principles/agent-specific-enhancement.md +23 -0
  6. package/.dust/principles/atomic-commits.md +15 -0
  7. package/.dust/principles/batteries-included.md +17 -0
  8. package/.dust/principles/boy-scout-rule.md +15 -0
  9. package/.dust/principles/broken-windows.md +17 -0
  10. package/.dust/principles/clarity-over-brevity.md +13 -0
  11. package/.dust/principles/co-located-tests.md +13 -0
  12. package/.dust/principles/comprehensive-assertions.md +50 -0
  13. package/.dust/principles/comprehensive-test-coverage.md +15 -0
  14. package/.dust/principles/consistent-naming.md +13 -0
  15. package/.dust/principles/context-optimised-code.md +15 -0
  16. package/.dust/principles/context-window-efficiency.md +15 -0
  17. package/.dust/principles/cross-platform-compatibility.md +19 -0
  18. package/.dust/principles/debugging-tooling.md +19 -0
  19. package/.dust/principles/decoupled-code.md +16 -0
  20. package/.dust/principles/dependency-injection.md +15 -0
  21. package/.dust/principles/design-for-testability.md +17 -0
  22. package/.dust/principles/development-traceability.md +19 -0
  23. package/.dust/principles/easy-adoption.md +17 -0
  24. package/.dust/principles/enable-flow-state.md +20 -0
  25. package/.dust/principles/environment-independent-tests.md +19 -0
  26. package/.dust/principles/exploratory-tooling.md +19 -0
  27. package/.dust/principles/fast-feedback-loops.md +15 -0
  28. package/.dust/principles/fast-feedback.md +13 -0
  29. package/.dust/principles/functional-core-imperative-shell.md +15 -0
  30. package/.dust/principles/human-ai-collaboration.md +18 -0
  31. package/.dust/principles/ideal-agent-developer-experience.md +24 -0
  32. package/.dust/principles/intuitive-directory-structure.md +13 -0
  33. package/.dust/principles/keep-unit-tests-pure.md +25 -0
  34. package/.dust/principles/lightweight-planning.md +16 -0
  35. package/.dust/principles/lint-everything.md +19 -0
  36. package/.dust/principles/maintainable-codebase.md +21 -0
  37. package/.dust/principles/make-changes-with-confidence.md +23 -0
  38. package/.dust/principles/make-the-change-easy.md +15 -0
  39. package/.dust/principles/minimal-dependencies.md +13 -0
  40. package/.dust/principles/naming-matters.md +14 -0
  41. package/.dust/principles/progressive-disclosure.md +15 -0
  42. package/.dust/principles/readable-test-data.md +48 -0
  43. package/.dust/principles/reasonably-dry.md +13 -0
  44. package/.dust/principles/repository-hygiene.md +14 -0
  45. package/.dust/principles/reproducible-checks.md +13 -0
  46. package/.dust/principles/runtime-agnostic-tests.md +13 -0
  47. package/.dust/principles/self-contained-repository.md +17 -0
  48. package/.dust/principles/self-diagnosing-tests.md +54 -0
  49. package/.dust/principles/slow-feedback-coping.md +15 -0
  50. package/.dust/principles/small-units.md +17 -0
  51. package/.dust/principles/some-big-design-up-front.md +34 -0
  52. package/.dust/principles/stop-the-line.md +13 -0
  53. package/.dust/principles/stubs-over-mocks.md +19 -0
  54. package/.dust/principles/task-first-workflow.md +13 -0
  55. package/.dust/principles/test-isolation.md +19 -0
  56. package/.dust/principles/traceable-decisions.md +13 -0
  57. package/.dust/principles/trunk-based-development.md +19 -0
  58. package/.dust/principles/unit-test-coverage.md +13 -0
  59. package/.dust/principles/unsurprising-ux.md +15 -0
  60. package/.dust/principles/vcs-independence.md +13 -0
  61. package/dist/bucket/repository.d.ts +28 -0
  62. package/dist/cli/types.d.ts +1 -0
  63. package/dist/core-principles.js +184 -0
  64. package/dist/dust.js +470 -54
  65. package/dist/lint/validators/principle-hierarchy.d.ts +0 -1
  66. package/dist/patch/index.d.ts +8 -0
  67. package/dist/patch.js +54 -1
  68. package/package.json +7 -2
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import type { ParsedArtifact } from '../../artifacts/parsed-artifact';
5
5
  import type { PrincipleRelationships, Violation } from './types';
6
- export type { PrincipleRelationships };
7
6
  export declare function validatePrincipleHierarchySections(artifact: ParsedArtifact): Violation[];
8
7
  export declare function extractPrincipleRelationships(artifact: ParsedArtifact): PrincipleRelationships;
9
8
  export declare function validateBidirectionalLinks(allPrincipleRelationships: PrincipleRelationships[]): Violation[];
@@ -26,10 +26,18 @@ export interface ArtifactPatchInput {
26
26
  principles?: Record<string, PrincipleInput | null>;
27
27
  tasks?: Record<string, TaskInput | null>;
28
28
  }
29
+ export type ArtifactType = 'fact' | 'idea' | 'principle' | 'task';
30
+ export interface ArtifactPreview {
31
+ type: ArtifactType;
32
+ slug: string;
33
+ action: 'create' | 'update' | 'delete';
34
+ content: string | null;
35
+ }
29
36
  export interface BuildArtifactPatchResult {
30
37
  valid: boolean;
31
38
  violations: Violation[];
32
39
  patch: ArtifactPatch;
40
+ previews: ArtifactPreview[];
33
41
  }
34
42
  interface ValidatePatchOptions {
35
43
  cwd?: string;
package/dist/patch.js CHANGED
@@ -1521,6 +1521,57 @@ function normalizeTargetPath(target, sourceDir) {
1521
1521
  }
1522
1522
  return null;
1523
1523
  }
1524
+ function parseArtifactPath(path) {
1525
+ const match = path.match(/^(facts|ideas|principles|tasks)\/([^/]+)\.md$/);
1526
+ if (!match)
1527
+ return null;
1528
+ const dirToType = {
1529
+ facts: "fact",
1530
+ ideas: "idea",
1531
+ principles: "principle",
1532
+ tasks: "task"
1533
+ };
1534
+ return {
1535
+ type: dirToType[match[1]],
1536
+ slug: match[2]
1537
+ };
1538
+ }
1539
+ async function buildPreviews(fileSystem, dustPath, files) {
1540
+ const previews = [];
1541
+ for (const [path, content] of Object.entries(files)) {
1542
+ const parsed = parseArtifactPath(path);
1543
+ if (!parsed)
1544
+ continue;
1545
+ if (content === null) {
1546
+ previews.push({
1547
+ type: parsed.type,
1548
+ slug: parsed.slug,
1549
+ action: "delete",
1550
+ content: null
1551
+ });
1552
+ } else {
1553
+ const exists = await fileExists(fileSystem, `${dustPath}/${path}`);
1554
+ previews.push({
1555
+ type: parsed.type,
1556
+ slug: parsed.slug,
1557
+ action: exists ? "update" : "create",
1558
+ content
1559
+ });
1560
+ }
1561
+ }
1562
+ return previews;
1563
+ }
1564
+ async function fileExists(fileSystem, path) {
1565
+ try {
1566
+ await fileSystem.readFile(path);
1567
+ return true;
1568
+ } catch (error) {
1569
+ if (error.code === "ENOENT") {
1570
+ return false;
1571
+ }
1572
+ throw error;
1573
+ }
1574
+ }
1524
1575
  function processFacts(facts, accumulator) {
1525
1576
  for (const [slug, factInput] of Object.entries(facts)) {
1526
1577
  if (factInput === null) {
@@ -1630,10 +1681,12 @@ async function buildArtifactPatch(fileSystem, dustPath, input, options = {}) {
1630
1681
  }
1631
1682
  const patch = { files: accumulator.files };
1632
1683
  const validationResult = await validatePatch(fileSystem, dustPath, patch, options);
1684
+ const previews = await buildPreviews(fileSystem, dustPath, accumulator.files);
1633
1685
  return {
1634
1686
  valid: validationResult.valid && hierarchyViolations.length === 0,
1635
1687
  violations: [...hierarchyViolations, ...validationResult.violations],
1636
- patch
1688
+ patch,
1689
+ previews
1637
1690
  };
1638
1691
  }
1639
1692
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joshski/dust",
3
- "version": "0.1.100",
3
+ "version": "0.1.101",
4
4
  "description": "Flow state for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -45,13 +45,18 @@
45
45
  "./patch": {
46
46
  "import": "./dist/patch.js",
47
47
  "types": "./dist/patch/index.d.ts"
48
+ },
49
+ "./core-principles": {
50
+ "import": "./dist/core-principles.js",
51
+ "types": "./dist/core-principles.d.ts"
48
52
  }
49
53
  },
50
54
  "files": [
51
55
  "dist",
52
56
  "bin",
53
57
  "lib/istanbul/minimal-reporter.cjs",
54
- "biome"
58
+ "biome",
59
+ ".dust/principles"
55
60
  ],
56
61
  "repository": {
57
62
  "type": "git",