@printpractical/cruze 0.0.6 → 0.0.8

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 (82) hide show
  1. package/README.md +9 -7
  2. package/dist/adapters/inbound/cli/commands/journal.js +1 -1
  3. package/dist/adapters/inbound/cli/commands/show.js +27 -0
  4. package/dist/adapters/inbound/cli/commands/status.js +19 -3
  5. package/dist/adapters/inbound/cli/commands.js +3 -1
  6. package/dist/app/use_cases/approve_artifact.js +19 -1
  7. package/dist/app/use_cases/check_code.js +10 -3
  8. package/dist/app/use_cases/journal_events.js +8 -5
  9. package/dist/app/use_cases/run_review.js +1 -1
  10. package/dist/app/use_cases/show_scope.js +35 -0
  11. package/dist/domain/check/budget_text.js +24 -0
  12. package/dist/domain/check/check_source.js +6 -3
  13. package/dist/domain/config.js +11 -1
  14. package/dist/domain/journal.js +2 -2
  15. package/dist/domain/project/scope_view.js +118 -0
  16. package/dist/domain/status/work_status.js +13 -2
  17. package/dist/domain/validation/element_rules.js +6 -1
  18. package/dist/domain/validation/size_rules.js +14 -5
  19. package/dist/domain/validation/work_item_rules.js +25 -3
  20. package/dist/domain/versions/rule_versions.js +1 -0
  21. package/dist/main.js +6 -0
  22. package/package.json +1 -1
  23. package/skills/architect/SKILL.md +2 -0
  24. package/skills/architect/feature.md +1 -1
  25. package/skills/architect/project.md +1 -1
  26. package/skills/architect/walkthrough.md +7 -4
  27. package/skills/build/SKILL.md +9 -8
  28. package/skills/dependency-approval/SKILL.md +8 -1
  29. package/skills/envision/SKILL.md +2 -0
  30. package/skills/envision/feature.md +1 -1
  31. package/skills/explore/SKILL.md +1 -1
  32. package/skills/formats/reference/architecture.md +1 -1
  33. package/skills/formats/reference/config.md +5 -1
  34. package/skills/formats/reference/specs.md +1 -1
  35. package/skills/formats/reference/work-items.md +1 -1
  36. package/skills/formats/templates/architecture.md +2 -2
  37. package/skills/grilling/SKILL.md +19 -7
  38. package/skills/grilling/illustrating.md +37 -0
  39. package/skills/hexagonal-design/SKILL.md +10 -3
  40. package/skills/hexagonal-design/languages/rust.md +3 -2
  41. package/skills/hexagonal-design/languages/swift.md +46 -0
  42. package/skills/hexagonal-design/shapes.md +49 -0
  43. package/skills/improve/SKILL.md +51 -0
  44. package/skills/land/SKILL.md +2 -2
  45. package/skills/next/SKILL.md +2 -2
  46. package/skills/plan/SKILL.md +3 -3
  47. package/skills/plan/tasks.md +9 -5
  48. package/skills/realign/SKILL.md +1 -1
  49. package/skills/realign/notes/0.0.7.md +11 -0
  50. package/skills/realign/notes/0.0.8.md +97 -0
  51. package/skills/realign/notes.md +2 -0
  52. package/skills/research/SKILL.md +2 -1
  53. package/skills/rethink/SKILL.md +2 -2
  54. package/skills/roadmap/SKILL.md +2 -0
  55. package/skills/roles/SKILL.md +9 -10
  56. package/skills/roles/code-reviewer.md +8 -8
  57. package/skills/roles/design-reviewer.md +10 -12
  58. package/skills/roles/surveyor.md +40 -0
  59. package/skills/roles/verifier.md +6 -5
  60. package/skills/triage/SKILL.md +2 -0
  61. package/skills/verify/SKILL.md +3 -1
  62. package/src/adapters/inbound/cli/commands/journal.ts +1 -1
  63. package/src/adapters/inbound/cli/commands/show.ts +27 -0
  64. package/src/adapters/inbound/cli/commands/status.ts +19 -3
  65. package/src/adapters/inbound/cli/commands.ts +3 -1
  66. package/src/app/use_cases/approve_artifact.ts +19 -1
  67. package/src/app/use_cases/check_code.ts +10 -3
  68. package/src/app/use_cases/journal_events.ts +8 -5
  69. package/src/app/use_cases/run_review.ts +1 -1
  70. package/src/app/use_cases/show_scope.ts +35 -0
  71. package/src/domain/check/budget_text.ts +24 -0
  72. package/src/domain/check/check_source.ts +6 -3
  73. package/src/domain/config.ts +11 -1
  74. package/src/domain/journal.ts +2 -2
  75. package/src/domain/project/scope_view.ts +118 -0
  76. package/src/domain/status/work_status.ts +13 -2
  77. package/src/domain/validation/element_rules.ts +6 -1
  78. package/src/domain/validation/size_rules.ts +14 -5
  79. package/src/domain/validation/work_item_rules.ts +25 -3
  80. package/src/domain/versions/rule_versions.ts +1 -0
  81. package/src/main.ts +6 -0
  82. package/templates/init/AGENTS.md +1 -1
@@ -11,7 +11,7 @@ import { deltaProblems } from "./delta_rules.ts";
11
11
  import { malformedIdHeadings, lineOf } from "./living_rules.ts";
12
12
  import { changePlanProblems } from "./plan_rules.ts";
13
13
  import { error, warning, type Problem } from "./problem.ts";
14
- import { changeRowSizeProblems } from "./size_rules.ts";
14
+ import { changeRowSizeProblems, sizeAccepted } from "./size_rules.ts";
15
15
 
16
16
  const REQUIRED_SECTIONS: Record<WorkItem["kind"], string[]> = {
17
17
  feature: ["Intent", "Spec delta", "Architecture delta", "Changes"],
@@ -45,6 +45,10 @@ function itemProblems(view: ProjectView, item: WorkItem): Problem[] {
45
45
  for (const cited of findIds(text).filter((cited) => !available.has(cited))) {
46
46
  problems.push(error(path, lineOf(text, cited), "unknown-id", `${cited} is cited but defined neither in the living docs nor in this work's deltas`));
47
47
  }
48
+ const dropped = droppedScenarios(view, delta);
49
+ for (const cited of findIds(text).filter((cited) => dropped.has(cited))) {
50
+ problems.push(error(path, lineOf(text, cited), "cites-dropped", `${cited} is cited, but ${dropped.get(cited)} in this work's delta leaves it out, so it won't exist once the work lands; describe it in words instead`));
51
+ }
48
52
  if (item.kind !== "change") problems.push(...deltaProblems(view, item));
49
53
  if (item.kind === "feature") problems.push(...featureScopeProblems(view, item, delta));
50
54
  // A landed change is history: its scope named what it built, which is now built.
@@ -69,10 +73,10 @@ function featureScopeProblems(view: ProjectView, feature: WorkItem, delta: Delta
69
73
  );
70
74
  const names = rows.map((row) => row.change);
71
75
  const extra = rows[MAX_CHANGES];
72
- if (extra !== undefined) {
76
+ if (extra !== undefined && !sizeAccepted(view, feature.ref)) {
73
77
  problems.push(warning(feature.path, extra.line, "feature-size", `the feature has ${rows.length} changes, over ${MAX_CHANGES}; split it into features a single design review can hold`));
74
78
  }
75
- problems.push(...changeRowSizeProblems(view, feature.path, rows, landedChanges));
79
+ problems.push(...changeRowSizeProblems(view, feature, rows, landedChanges));
76
80
  for (const row of rows) {
77
81
  if (!/^\d\d-[a-z0-9]+(?:-[a-z0-9]+)*$/.test(row.change)) problems.push(error(feature.path, row.line, "change-name", `change "${row.change}" must be named NN-slug`));
78
82
  if (names.indexOf(row.change) !== names.lastIndexOf(row.change)) problems.push(error(feature.path, row.line, "change-name", `change ${row.change} is listed twice`));
@@ -151,3 +155,21 @@ function scopeIds(item: WorkItem): string[] {
151
155
  const scope = readScope(item.doc);
152
156
  return scope === null ? [] : [...scope.delivers, ...scope.builds, ...scope.removes];
153
157
  }
158
+
159
+ /**
160
+ * Living scenarios that a MODIFIED requirement in the delta leaves out, each with that requirement.
161
+ * Land drops them, so a citation of one passes validation now and breaks only at land.
162
+ */
163
+ function droppedScenarios(view: ProjectView, delta: Delta): Map<string, string> {
164
+ const dropped = new Map<string, string>();
165
+ for (const entry of delta.entries.filter((e) => e.element.op === "MODIFIED" && kindOf(e.element.id) === "REQ")) {
166
+ const living = view.living.elements.get(entry.element.id);
167
+ if (living === undefined) continue;
168
+ const kept = new Set(entry.scenarios.map((s) => s.id));
169
+ for (const scenario of view.living.elements.values()) {
170
+ const nested = scenario.doc === living.doc && scenario.element.start > living.element.start && scenario.element.start < living.element.end;
171
+ if (nested && kindOf(scenario.id) === "SCN" && !kept.has(scenario.id) && !delta.ids.has(scenario.id)) dropped.set(scenario.id, entry.element.id);
172
+ }
173
+ }
174
+ return dropped;
175
+ }
@@ -16,6 +16,7 @@ export const RULE_SINCE: Record<string, string> = {
16
16
  "validate:change-too-small": "0.0.5",
17
17
  "validate:change-too-large": "0.0.5",
18
18
  "validate:plan-too-large": "0.0.5",
19
+ "validate:module-path-glob": "0.0.8",
19
20
  };
20
21
 
21
22
  /** Whether a rule arrived after the version the project's code meets, so it waits for `realign`. */
package/src/main.ts CHANGED
@@ -9,6 +9,12 @@ import { ProcessAgentRunner } from "./adapters/outbound/process_agent_runner.ts"
9
9
  import { SystemClock } from "./adapters/outbound/system_clock.ts";
10
10
  import { DefaultAnswerPrompter, TerminalPrompter } from "./adapters/outbound/terminal_prompter.ts";
11
11
 
12
+ // A reader that stops early, such as `cruze journal list | head`, closes the pipe; that is not an error worth a stack trace.
13
+ process.stdout.on("error", (error: NodeJS.ErrnoException) => {
14
+ if (error.code === "EPIPE") process.exit(0);
15
+ throw error;
16
+ });
17
+
12
18
  const cwd = process.cwd();
13
19
  const exitCode = await runCli(
14
20
  process.argv.slice(2),
@@ -4,7 +4,7 @@ Instructions for coding agents working in this repository. Cruze keeps the manag
4
4
 
5
5
  ## Workflow
6
6
 
7
- This project uses [Cruze](https://github.com/PrintPractical/cruze) for spec-driven development. Durable documents live in `docs/`: vision, glossary, architecture, ADRs, specs and roadmap. Work in progress lives in `.cruze/`. Read `docs/architecture.md` before changing code, once it exists. The Cruze skills run the `cruze` command; when it is missing, install it as https://github.com/PrintPractical/cruze#quick-start describes.
7
+ This project uses [Cruze](https://github.com/PrintPractical/cruze) for spec-driven development. Durable documents live in `docs/`: vision, glossary, architecture, ADRs, specs and roadmap. Work in progress lives in `.cruze/`. Before changing code, read the design the change builds with `cruze show <change>`, once it exists. Each Cruze step runs in a new session, so its context holds what the step reads and nothing else. The Cruze skills run the `cruze` command; when it is missing, install it as https://github.com/PrintPractical/cruze#quick-start describes.
8
8
 
9
9
  ## Commands
10
10