@intentius/chant 0.1.6 → 0.1.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 (44) hide show
  1. package/package.json +1 -1
  2. package/src/cli/commands/build.test.ts +58 -5
  3. package/src/cli/commands/build.ts +24 -3
  4. package/src/cli/handlers/graph.test.ts +91 -0
  5. package/src/cli/handlers/graph.ts +23 -0
  6. package/src/cli/handlers/run-client.ts +134 -0
  7. package/src/cli/handlers/run-report.ts +160 -0
  8. package/src/cli/handlers/run.test.ts +448 -0
  9. package/src/cli/handlers/run.ts +453 -0
  10. package/src/cli/handlers/state.test.ts +409 -0
  11. package/src/cli/handlers/state.ts +232 -10
  12. package/src/cli/main.test.ts +65 -0
  13. package/src/cli/main.ts +32 -18
  14. package/src/cli/mcp/op-tools.ts +204 -0
  15. package/src/cli/mcp/resource-handlers.ts +69 -50
  16. package/src/cli/mcp/resources/context.ts +27 -0
  17. package/src/cli/mcp/server.test.ts +176 -3
  18. package/src/cli/mcp/server.ts +7 -3
  19. package/src/cli/mcp/state-tools.ts +0 -51
  20. package/src/cli/mcp/tools/search.ts +6 -1
  21. package/src/cli/registry.ts +3 -0
  22. package/src/composite.ts +10 -5
  23. package/src/index.ts +1 -2
  24. package/src/lexicon-plugin-helpers.ts +13 -5
  25. package/src/lexicon.ts +57 -1
  26. package/src/lint/config.test.ts +21 -0
  27. package/src/lint/config.ts +19 -3
  28. package/src/op/discover.test.ts +43 -0
  29. package/src/op/discover.ts +89 -0
  30. package/src/op/index.ts +3 -1
  31. package/src/op/types.ts +13 -6
  32. package/src/state/digest.test.ts +117 -0
  33. package/src/state/git.test.ts +191 -0
  34. package/src/state/git.ts +63 -11
  35. package/src/state/live-diff.test.ts +184 -0
  36. package/src/state/live-diff.ts +215 -0
  37. package/src/state/snapshot.test.ts +171 -0
  38. package/src/state/snapshot.ts +39 -19
  39. package/src/state/types.ts +4 -2
  40. package/src/cli/handlers/spell.ts +0 -396
  41. package/src/spell/discovery.ts +0 -183
  42. package/src/spell/index.ts +0 -3
  43. package/src/spell/prompt.ts +0 -133
  44. package/src/spell/types.ts +0 -89
@@ -1,89 +0,0 @@
1
- /**
2
- * Spell types and factory functions.
3
- *
4
- * A spell is a structured task definition for agent orchestration.
5
- */
6
-
7
- // ── Types ────────────────────────────────────────────────────────
8
-
9
- export interface ContextItem {
10
- type: "file" | "cmd";
11
- value: string;
12
- }
13
-
14
- export interface Task {
15
- description: string;
16
- done: boolean;
17
- }
18
-
19
- export type Status = "blocked" | "ready" | "done";
20
-
21
- export interface SpellDefinition {
22
- name: string;
23
- lexicon?: string;
24
- overview: string;
25
- context?: (string | ContextItem)[];
26
- tasks: Task[];
27
- depends?: string[];
28
- afterAll?: string[];
29
- }
30
-
31
- // ── Validation ───────────────────────────────────────────────────
32
-
33
- const NAME_PATTERN = /^[a-z0-9]+(-[a-z0-9]+)*$/;
34
- const MAX_NAME_LENGTH = 64;
35
- const RESERVED_NAMES = new Set([
36
- "add", "list", "show", "cast", "done", "rm", "graph",
37
- ]);
38
-
39
- function validateName(name: string): void {
40
- if (!name) {
41
- throw new Error("Spell name must not be empty");
42
- }
43
- if (name.length > MAX_NAME_LENGTH) {
44
- throw new Error(`Spell name must be at most ${MAX_NAME_LENGTH} characters: "${name}"`);
45
- }
46
- if (!NAME_PATTERN.test(name)) {
47
- throw new Error(`Spell name must be kebab-case (lowercase letters, numbers, hyphens): "${name}"`);
48
- }
49
- if (RESERVED_NAMES.has(name)) {
50
- throw new Error(`Spell name "${name}" is reserved (conflicts with CLI subcommand)`);
51
- }
52
- }
53
-
54
- // ── Factory functions ────────────────────────────────────────────
55
-
56
- /**
57
- * Define a spell. Validates the name and freezes the object.
58
- */
59
- export function spell(def: SpellDefinition): SpellDefinition {
60
- validateName(def.name);
61
- if (!def.overview) {
62
- throw new Error(`Spell "${def.name}" must have a non-empty overview`);
63
- }
64
- if (!def.tasks || def.tasks.length === 0) {
65
- throw new Error(`Spell "${def.name}" must have at least one task`);
66
- }
67
- return Object.freeze({ ...def });
68
- }
69
-
70
- /**
71
- * Define a task within a spell.
72
- */
73
- export function task(description: string, opts?: { done?: boolean }): Task {
74
- return { description, done: opts?.done ?? false };
75
- }
76
-
77
- /**
78
- * File context item — contents inlined at cast time.
79
- */
80
- export function file(path: string): ContextItem {
81
- return { type: "file", value: path };
82
- }
83
-
84
- /**
85
- * Command context item — stdout inlined at cast time.
86
- */
87
- export function cmd(command: string): ContextItem {
88
- return { type: "cmd", value: command };
89
- }