sysprom 1.0.7 → 1.2.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 (113) hide show
  1. package/README.md +28 -28
  2. package/dist/src/canonical-json.d.ts +2 -0
  3. package/dist/src/cli/commands/add.d.ts +1 -1
  4. package/dist/src/cli/commands/add.js +2 -3
  5. package/dist/src/cli/commands/check.d.ts +6 -8
  6. package/dist/src/cli/commands/check.js +3 -8
  7. package/dist/src/cli/commands/graph.d.ts +3 -4
  8. package/dist/src/cli/commands/graph.js +3 -7
  9. package/dist/src/cli/commands/init.d.ts +15 -1
  10. package/dist/src/cli/commands/init.js +57 -27
  11. package/dist/src/cli/commands/plan.js +21 -39
  12. package/dist/src/cli/commands/query.js +10 -28
  13. package/dist/src/cli/commands/remove.d.ts +1 -1
  14. package/dist/src/cli/commands/remove.js +2 -3
  15. package/dist/src/cli/commands/rename.d.ts +1 -1
  16. package/dist/src/cli/commands/rename.js +2 -3
  17. package/dist/src/cli/commands/search.d.ts +1 -1
  18. package/dist/src/cli/commands/search.js +2 -3
  19. package/dist/src/cli/commands/stats.d.ts +6 -8
  20. package/dist/src/cli/commands/stats.js +3 -8
  21. package/dist/src/cli/commands/task.js +19 -24
  22. package/dist/src/cli/commands/update.js +6 -14
  23. package/dist/src/cli/commands/validate.d.ts +6 -8
  24. package/dist/src/cli/commands/validate.js +3 -8
  25. package/dist/src/cli/shared.d.ts +18 -3
  26. package/dist/src/cli/shared.js +100 -3
  27. package/dist/src/io.d.ts +5 -0
  28. package/dist/src/json-to-md.d.ts +1 -0
  29. package/dist/src/operations/add-node.d.ts +5 -0
  30. package/dist/src/operations/add-node.js +5 -0
  31. package/dist/src/operations/add-plan-task.d.ts +5 -0
  32. package/dist/src/operations/add-plan-task.js +5 -0
  33. package/dist/src/operations/add-relationship.d.ts +5 -0
  34. package/dist/src/operations/add-relationship.js +5 -0
  35. package/dist/src/operations/check.d.ts +5 -0
  36. package/dist/src/operations/check.js +5 -0
  37. package/dist/src/operations/define-operation.d.ts +31 -0
  38. package/dist/src/operations/define-operation.js +8 -0
  39. package/dist/src/operations/graph.d.ts +1 -0
  40. package/dist/src/operations/graph.js +1 -0
  41. package/dist/src/operations/init-document.d.ts +1 -0
  42. package/dist/src/operations/init-document.js +1 -0
  43. package/dist/src/operations/json-to-markdown.d.ts +1 -0
  44. package/dist/src/operations/json-to-markdown.js +1 -0
  45. package/dist/src/operations/mark-task-done.d.ts +5 -0
  46. package/dist/src/operations/mark-task-done.js +5 -0
  47. package/dist/src/operations/mark-task-undone.d.ts +5 -0
  48. package/dist/src/operations/mark-task-undone.js +5 -0
  49. package/dist/src/operations/markdown-to-json.d.ts +1 -0
  50. package/dist/src/operations/markdown-to-json.js +1 -0
  51. package/dist/src/operations/next-id.d.ts +6 -0
  52. package/dist/src/operations/next-id.js +6 -0
  53. package/dist/src/operations/node-history.d.ts +3 -0
  54. package/dist/src/operations/node-history.js +2 -0
  55. package/dist/src/operations/plan-add-task.d.ts +1 -0
  56. package/dist/src/operations/plan-add-task.js +1 -0
  57. package/dist/src/operations/plan-gate.d.ts +4 -0
  58. package/dist/src/operations/plan-gate.js +2 -0
  59. package/dist/src/operations/plan-init.d.ts +1 -0
  60. package/dist/src/operations/plan-init.js +1 -0
  61. package/dist/src/operations/plan-progress.d.ts +2 -0
  62. package/dist/src/operations/plan-progress.js +1 -0
  63. package/dist/src/operations/plan-status.d.ts +2 -0
  64. package/dist/src/operations/plan-status.js +1 -0
  65. package/dist/src/operations/query-node.d.ts +3 -0
  66. package/dist/src/operations/query-node.js +2 -0
  67. package/dist/src/operations/query-nodes.d.ts +1 -0
  68. package/dist/src/operations/query-nodes.js +1 -0
  69. package/dist/src/operations/query-relationships.d.ts +1 -0
  70. package/dist/src/operations/query-relationships.js +1 -0
  71. package/dist/src/operations/remove-node.d.ts +8 -0
  72. package/dist/src/operations/remove-node.js +7 -0
  73. package/dist/src/operations/remove-relationship.d.ts +5 -0
  74. package/dist/src/operations/remove-relationship.js +5 -0
  75. package/dist/src/operations/rename.d.ts +7 -0
  76. package/dist/src/operations/rename.js +7 -0
  77. package/dist/src/operations/search.d.ts +1 -0
  78. package/dist/src/operations/search.js +1 -0
  79. package/dist/src/operations/speckit-diff.d.ts +3 -0
  80. package/dist/src/operations/speckit-diff.js +2 -0
  81. package/dist/src/operations/speckit-export.d.ts +1 -0
  82. package/dist/src/operations/speckit-export.js +1 -0
  83. package/dist/src/operations/speckit-import.d.ts +1 -0
  84. package/dist/src/operations/speckit-import.js +1 -0
  85. package/dist/src/operations/speckit-sync.d.ts +3 -0
  86. package/dist/src/operations/speckit-sync.js +2 -0
  87. package/dist/src/operations/state-at.d.ts +3 -0
  88. package/dist/src/operations/state-at.js +2 -0
  89. package/dist/src/operations/stats.d.ts +3 -0
  90. package/dist/src/operations/stats.js +2 -0
  91. package/dist/src/operations/task-list.d.ts +6 -0
  92. package/dist/src/operations/task-list.js +6 -0
  93. package/dist/src/operations/timeline.d.ts +3 -0
  94. package/dist/src/operations/timeline.js +2 -0
  95. package/dist/src/operations/trace-from-node.d.ts +3 -0
  96. package/dist/src/operations/trace-from-node.js +2 -0
  97. package/dist/src/operations/update-metadata.d.ts +1 -0
  98. package/dist/src/operations/update-metadata.js +1 -0
  99. package/dist/src/operations/update-node.d.ts +5 -0
  100. package/dist/src/operations/update-node.js +5 -0
  101. package/dist/src/operations/update-plan-task.d.ts +5 -0
  102. package/dist/src/operations/update-plan-task.js +5 -0
  103. package/dist/src/operations/validate.d.ts +10 -0
  104. package/dist/src/operations/validate.js +9 -0
  105. package/dist/src/schema.d.ts +44 -0
  106. package/dist/src/schema.js +31 -0
  107. package/dist/src/speckit/generate.d.ts +6 -0
  108. package/dist/src/speckit/generate.js +6 -0
  109. package/dist/src/speckit/parse.d.ts +9 -0
  110. package/dist/src/speckit/parse.js +6 -0
  111. package/dist/src/speckit/plan.d.ts +5 -0
  112. package/dist/src/speckit/project.d.ts +6 -0
  113. package/package.json +1 -1
@@ -1,14 +1,45 @@
1
1
  import * as z from "zod";
2
+ /**
3
+ * Definition of a SysProM operation — a named, typed function with Zod schemas
4
+ * for input validation and output description.
5
+ *
6
+ * @typeParam TInput - Zod schema type for the operation's input.
7
+ * @typeParam TOutput - Zod schema type for the operation's output.
8
+ */
2
9
  export interface OperationDef<TInput extends z.ZodType = z.ZodType, TOutput extends z.ZodType = z.ZodType> {
10
+ /** Machine-readable operation name (e.g. `"addNode"`). */
3
11
  name: string;
12
+ /** Human-readable description of what the operation does. */
4
13
  description: string;
14
+ /** Zod schema used to validate the operation's input. */
5
15
  input: TInput;
16
+ /** Zod schema describing the operation's output shape. */
6
17
  output: TOutput;
18
+ /** The implementation function. */
7
19
  fn: (input: z.infer<TInput>) => z.infer<TOutput>;
8
20
  }
21
+ /**
22
+ * A callable operation with attached metadata. Can be invoked directly as a
23
+ * function, and also exposes `.def`, `.inputSchema`, and `.outputSchema` for
24
+ * introspection.
25
+ *
26
+ * @typeParam TInput - Zod schema type for the operation's input.
27
+ * @typeParam TOutput - Zod schema type for the operation's output.
28
+ */
9
29
  export type DefinedOperation<TInput extends z.ZodType = z.ZodType, TOutput extends z.ZodType = z.ZodType> = ((input: z.infer<TInput>) => z.infer<TOutput>) & {
30
+ /** The full operation definition including name, description, and schemas. */
10
31
  def: OperationDef<TInput, TOutput>;
32
+ /** Zod schema for validating input before execution. */
11
33
  inputSchema: TInput;
34
+ /** Zod schema describing the output shape. */
12
35
  outputSchema: TOutput;
13
36
  };
37
+ /**
38
+ * Create a callable operation from a definition. The returned function validates
39
+ * input against the Zod schema before delegating to the implementation.
40
+ *
41
+ * @param def - The operation definition with name, schemas, and implementation.
42
+ * @returns A callable function with `.def`, `.inputSchema`, and `.outputSchema` attached.
43
+ * @throws If the input fails Zod validation.
44
+ */
14
45
  export declare function defineOperation<TInput extends z.ZodType, TOutput extends z.ZodType>(def: OperationDef<TInput, TOutput>): DefinedOperation<TInput, TOutput>;
@@ -1,6 +1,14 @@
1
1
  // ---------------------------------------------------------------------------
2
2
  // defineOperation — creates a callable operation with attached metadata
3
3
  // ---------------------------------------------------------------------------
4
+ /**
5
+ * Create a callable operation from a definition. The returned function validates
6
+ * input against the Zod schema before delegating to the implementation.
7
+ *
8
+ * @param def - The operation definition with name, schemas, and implementation.
9
+ * @returns A callable function with `.def`, `.inputSchema`, and `.outputSchema` attached.
10
+ * @throws If the input fails Zod validation.
11
+ */
4
12
  export function defineOperation(def) {
5
13
  function execute(input) {
6
14
  const parsed = def.input.safeParse(input);
@@ -1,4 +1,5 @@
1
1
  import * as z from "zod";
2
+ /** Generate a graph of a SysProM document in Mermaid or DOT format, with optional filtering by relationship type. */
2
3
  export declare const graphOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
3
4
  doc: z.ZodObject<{
4
5
  $schema: z.ZodOptional<z.ZodString>;
@@ -56,6 +56,7 @@ function generateGraph(doc, format, typeFilter) {
56
56
  }
57
57
  return generateMermaid(doc, rels);
58
58
  }
59
+ /** Generate a graph of a SysProM document in Mermaid or DOT format, with optional filtering by relationship type. */
59
60
  export const graphOp = defineOperation({
60
61
  name: "graph",
61
62
  description: "Generate a graph of the SysProM document in Mermaid or DOT format, with optional filtering by relationship type.",
@@ -1,4 +1,5 @@
1
1
  import * as z from "zod";
2
+ /** Create a new empty SysProM document with metadata, ready for nodes and relationships to be added. */
2
3
  export declare const initDocumentOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
3
4
  title: z.ZodDefault<z.ZodOptional<z.ZodString>>;
4
5
  scope: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -1,6 +1,7 @@
1
1
  import * as z from "zod";
2
2
  import { defineOperation } from "./define-operation.js";
3
3
  import { SysProMDocument } from "../schema.js";
4
+ /** Create a new empty SysProM document with metadata, ready for nodes and relationships to be added. */
4
5
  export const initDocumentOp = defineOperation({
5
6
  name: "initDocument",
6
7
  description: "Create a new empty SysProM document with metadata.",
@@ -1,4 +1,5 @@
1
1
  import * as z from "zod";
2
+ /** Convert a SysProM document to single-file Markdown representation. */
2
3
  export declare const jsonToMarkdownOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
3
4
  doc: z.ZodObject<{
4
5
  $schema: z.ZodOptional<z.ZodString>;
@@ -2,6 +2,7 @@ import * as z from "zod";
2
2
  import { defineOperation } from "./define-operation.js";
3
3
  import { SysProMDocument } from "../schema.js";
4
4
  import { jsonToMarkdownSingle } from "../json-to-md.js";
5
+ /** Convert a SysProM document to single-file Markdown representation. */
5
6
  export const jsonToMarkdownOp = defineOperation({
6
7
  name: "jsonToMarkdown",
7
8
  description: "Convert a SysProM document to single-file Markdown",
@@ -1,4 +1,9 @@
1
1
  import * as z from "zod";
2
+ /**
3
+ * Mark a task as done within a change node's plan.
4
+ *
5
+ * @throws If the change node is not found or the task index is out of range.
6
+ */
2
7
  export declare const markTaskDoneOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
3
8
  doc: z.ZodObject<{
4
9
  $schema: z.ZodOptional<z.ZodString>;
@@ -1,6 +1,11 @@
1
1
  import * as z from "zod";
2
2
  import { defineOperation } from "./define-operation.js";
3
3
  import { SysProMDocument } from "../schema.js";
4
+ /**
5
+ * Mark a task as done within a change node's plan.
6
+ *
7
+ * @throws If the change node is not found or the task index is out of range.
8
+ */
4
9
  export const markTaskDoneOp = defineOperation({
5
10
  name: "markTaskDone",
6
11
  description: "Mark a task as done",
@@ -1,4 +1,9 @@
1
1
  import * as z from "zod";
2
+ /**
3
+ * Mark a task as undone (incomplete) within a change node's plan.
4
+ *
5
+ * @throws If the change node is not found or the task index is out of range.
6
+ */
2
7
  export declare const markTaskUndoneOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
3
8
  doc: z.ZodObject<{
4
9
  $schema: z.ZodOptional<z.ZodString>;
@@ -1,6 +1,11 @@
1
1
  import * as z from "zod";
2
2
  import { defineOperation } from "./define-operation.js";
3
3
  import { SysProMDocument } from "../schema.js";
4
+ /**
5
+ * Mark a task as undone (incomplete) within a change node's plan.
6
+ *
7
+ * @throws If the change node is not found or the task index is out of range.
8
+ */
4
9
  export const markTaskUndoneOp = defineOperation({
5
10
  name: "markTaskUndone",
6
11
  description: "Mark a task as undone",
@@ -1,4 +1,5 @@
1
1
  import * as z from "zod";
2
+ /** Parse single-file Markdown content into a SysProM document. */
2
3
  export declare const markdownToJsonOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
3
4
  content: z.ZodString;
4
5
  }, z.core.$strip>, z.ZodObject<{
@@ -2,6 +2,7 @@ import * as z from "zod";
2
2
  import { defineOperation } from "./define-operation.js";
3
3
  import { SysProMDocument } from "../schema.js";
4
4
  import { markdownSingleToJson } from "../md-to-json.js";
5
+ /** Parse single-file Markdown content into a SysProM document. */
5
6
  export const markdownToJsonOp = defineOperation({
6
7
  name: "markdownToJson",
7
8
  description: "Parse Markdown content into a SysProM document",
@@ -1,4 +1,10 @@
1
1
  import * as z from "zod";
2
+ /**
3
+ * Generate the next available ID for a given node type. Scans existing node IDs
4
+ * matching the type's conventional prefix and returns `prefix + (max + 1)`.
5
+ *
6
+ * @throws If no ID prefix is defined for the given node type.
7
+ */
2
8
  export declare const nextIdOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
3
9
  doc: z.ZodObject<{
4
10
  $schema: z.ZodOptional<z.ZodString>;
@@ -1,6 +1,12 @@
1
1
  import * as z from "zod";
2
2
  import { defineOperation } from "./define-operation.js";
3
3
  import { SysProMDocument, NodeType, NODE_ID_PREFIX } from "../schema.js";
4
+ /**
5
+ * Generate the next available ID for a given node type. Scans existing node IDs
6
+ * matching the type's conventional prefix and returns `prefix + (max + 1)`.
7
+ *
8
+ * @throws If no ID prefix is defined for the given node type.
9
+ */
4
10
  export const nextIdOp = defineOperation({
5
11
  name: "nextId",
6
12
  description: "Generate the next available ID for a given node type. Scans existing node IDs matching the type's prefix and returns prefix + (max + 1).",
@@ -1,4 +1,5 @@
1
1
  import * as z from "zod";
2
+ /** Zod schema for a timestamped lifecycle event of a specific node. */
2
3
  export declare const TimelineEvent: z.ZodObject<{
3
4
  nodeId: z.ZodString;
4
5
  nodeName: z.ZodString;
@@ -6,7 +7,9 @@ export declare const TimelineEvent: z.ZodObject<{
6
7
  state: z.ZodString;
7
8
  timestamp: z.ZodString;
8
9
  }, z.core.$strip>;
10
+ /** A timestamped lifecycle event of a specific node. */
9
11
  export type TimelineEvent = z.infer<typeof TimelineEvent>;
12
+ /** Extract the lifecycle history of a specific node, sorted chronologically. Searches recursively into subsystems. Returns an empty array if the node is not found. */
10
13
  export declare const nodeHistoryOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
11
14
  doc: z.ZodObject<{
12
15
  $schema: z.ZodOptional<z.ZodString>;
@@ -1,6 +1,7 @@
1
1
  import * as z from "zod";
2
2
  import { defineOperation } from "./define-operation.js";
3
3
  import { SysProMDocument } from "../schema.js";
4
+ /** Zod schema for a timestamped lifecycle event of a specific node. */
4
5
  export const TimelineEvent = z.object({
5
6
  nodeId: z.string(),
6
7
  nodeName: z.string(),
@@ -8,6 +9,7 @@ export const TimelineEvent = z.object({
8
9
  state: z.string(),
9
10
  timestamp: z.string(),
10
11
  });
12
+ /** Extract the lifecycle history of a specific node, sorted chronologically. Searches recursively into subsystems. Returns an empty array if the node is not found. */
11
13
  export const nodeHistoryOp = defineOperation({
12
14
  name: "node-history",
13
15
  description: "Extract the lifecycle history of a specific node, sorted chronologically",
@@ -1,4 +1,5 @@
1
1
  import * as z from "zod";
2
+ /** Add a task (change node) to a plan's implementation protocol. Optionally specify a parent task for nesting. */
2
3
  export declare const planAddTaskOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
3
4
  doc: z.ZodObject<{
4
5
  $schema: z.ZodOptional<z.ZodString>;
@@ -2,6 +2,7 @@ import * as z from "zod";
2
2
  import { defineOperation } from "./define-operation.js";
3
3
  import { SysProMDocument } from "../schema.js";
4
4
  import { addTask } from "../speckit/plan.js";
5
+ /** Add a task (change node) to a plan's implementation protocol. Optionally specify a parent task for nesting. */
5
6
  export const planAddTaskOp = defineOperation({
6
7
  name: "planAddTask",
7
8
  description: "Add a task (change node) to a plan's implementation protocol",
@@ -13,7 +13,9 @@ export declare const GateIssueSchema: z.ZodUnion<readonly [z.ZodObject<{
13
13
  kind: z.ZodLiteral<"fr_no_change">;
14
14
  frId: z.ZodString;
15
15
  }, z.core.$strip>]>;
16
+ /** A specific issue preventing gate entry — incomplete tasks, missing acceptance criteria, or unlinked requirements. */
16
17
  export type GateIssueResult = z.infer<typeof GateIssueSchema>;
18
+ /** Zod schema for the gate check result — phase number, readiness flag, and issues. */
17
19
  export declare const GateResultSchema: z.ZodObject<{
18
20
  phase: z.ZodNumber;
19
21
  ready: z.ZodBoolean;
@@ -32,7 +34,9 @@ export declare const GateResultSchema: z.ZodObject<{
32
34
  frId: z.ZodString;
33
35
  }, z.core.$strip>]>>;
34
36
  }, z.core.$strip>;
37
+ /** Result of a gate check: phase number, readiness flag, and any blocking issues. */
35
38
  export type GateResultOutput = z.infer<typeof GateResultSchema>;
39
+ /** Check gate criteria for phase entry — validates that previous tasks are complete and requirements are linked. */
36
40
  export declare const planGateOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
37
41
  doc: z.ZodObject<{
38
42
  $schema: z.ZodOptional<z.ZodString>;
@@ -21,11 +21,13 @@ export const GateIssueSchema = z.union([
21
21
  frId: z.string(),
22
22
  }),
23
23
  ]);
24
+ /** Zod schema for the gate check result — phase number, readiness flag, and issues. */
24
25
  export const GateResultSchema = z.object({
25
26
  phase: z.number(),
26
27
  ready: z.boolean(),
27
28
  issues: z.array(GateIssueSchema),
28
29
  });
30
+ /** Check gate criteria for phase entry — validates that previous tasks are complete and requirements are linked. */
29
31
  export const planGateOp = defineOperation({
30
32
  name: "planGate",
31
33
  description: "Check gate criteria for phase entry",
@@ -1,4 +1,5 @@
1
1
  import * as z from "zod";
2
+ /** Initialise a new SysProM plan document with standard structure (constitution, specification, implementation protocol, checklist). */
2
3
  export declare const planInitOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
3
4
  prefix: z.ZodString;
4
5
  name: z.ZodOptional<z.ZodString>;
@@ -2,6 +2,7 @@ import * as z from "zod";
2
2
  import { defineOperation } from "./define-operation.js";
3
3
  import { SysProMDocument } from "../schema.js";
4
4
  import { initDocument } from "../speckit/plan.js";
5
+ /** Initialise a new SysProM plan document with standard structure (constitution, specification, implementation protocol, checklist). */
5
6
  export const planInitOp = defineOperation({
6
7
  name: "planInit",
7
8
  description: "Initialise a new SysProM plan document with standard structure",
@@ -6,7 +6,9 @@ export declare const PhaseProgressSchema: z.ZodObject<{
6
6
  total: z.ZodNumber;
7
7
  percent: z.ZodNumber;
8
8
  }, z.core.$strip>;
9
+ /** Per-phase progress metrics: task counts and completion percentage. */
9
10
  export type PhaseProgressResult = z.infer<typeof PhaseProgressSchema>;
11
+ /** Compute per-phase progress breakdown for a plan — task completion counts and percentages for each phase. */
10
12
  export declare const planProgressOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
11
13
  doc: z.ZodObject<{
12
14
  $schema: z.ZodOptional<z.ZodString>;
@@ -9,6 +9,7 @@ export const PhaseProgressSchema = z.object({
9
9
  total: z.number(),
10
10
  percent: z.number(),
11
11
  });
12
+ /** Compute per-phase progress breakdown for a plan — task completion counts and percentages for each phase. */
12
13
  export const planProgressOp = defineOperation({
13
14
  name: "planProgress",
14
15
  description: "Get per-phase progress breakdown",
@@ -24,7 +24,9 @@ export declare const PlanStatusSchema: z.ZodObject<{
24
24
  }, z.core.$strip>;
25
25
  nextStep: z.ZodString;
26
26
  }, z.core.$strip>;
27
+ /** Comprehensive status of all plan components — constitution, spec, plan, tasks, checklist, and next step. */
27
28
  export type PlanStatusResult = z.infer<typeof PlanStatusSchema>;
29
+ /** Get the comprehensive status of all plan components in a single operation. */
28
30
  export declare const planStatusOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
29
31
  doc: z.ZodObject<{
30
32
  $schema: z.ZodOptional<z.ZodString>;
@@ -27,6 +27,7 @@ export const PlanStatusSchema = z.object({
27
27
  }),
28
28
  nextStep: z.string(),
29
29
  });
30
+ /** Get the comprehensive status of all plan components in a single operation. */
30
31
  export const planStatusOp = defineOperation({
31
32
  name: "planStatus",
32
33
  description: "Get the status of all plan components",
@@ -1,4 +1,5 @@
1
1
  import * as z from "zod";
2
+ /** Zod schema for a node with its incoming and outgoing relationships, or null if not found. */
2
3
  export declare const NodeDetail: z.ZodNullable<z.ZodObject<{
3
4
  node: z.ZodObject<{
4
5
  id: z.ZodString;
@@ -382,7 +383,9 @@ export declare const NodeDetail: z.ZodNullable<z.ZodObject<{
382
383
  };
383
384
  }>;
384
385
  }, z.core.$strip>>;
386
+ /** A node with its incoming and outgoing relationships, or null if the node was not found. */
385
387
  export type NodeDetail = z.infer<typeof NodeDetail>;
388
+ /** Query a single node by ID, returning it with its incoming and outgoing relationships. Returns null if the node does not exist. */
386
389
  export declare const queryNodeOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
387
390
  doc: z.ZodObject<{
388
391
  $schema: z.ZodOptional<z.ZodString>;
@@ -1,6 +1,7 @@
1
1
  import * as z from "zod";
2
2
  import { defineOperation } from "./define-operation.js";
3
3
  import { Node, Relationship, SysProMDocument } from "../schema.js";
4
+ /** Zod schema for a node with its incoming and outgoing relationships, or null if not found. */
4
5
  export const NodeDetail = z
5
6
  .object({
6
7
  node: Node,
@@ -8,6 +9,7 @@ export const NodeDetail = z
8
9
  incoming: z.array(Relationship),
9
10
  })
10
11
  .nullable();
12
+ /** Query a single node by ID, returning it with its incoming and outgoing relationships. Returns null if the node does not exist. */
11
13
  export const queryNodeOp = defineOperation({
12
14
  name: "query-node",
13
15
  description: "Query a single node by ID with its incoming and outgoing relationships",
@@ -1,4 +1,5 @@
1
1
  import * as z from "zod";
2
+ /** Query nodes from a SysProM document with optional filters for type and status. */
2
3
  export declare const queryNodesOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
3
4
  doc: z.ZodObject<{
4
5
  $schema: z.ZodOptional<z.ZodString>;
@@ -1,6 +1,7 @@
1
1
  import * as z from "zod";
2
2
  import { defineOperation } from "./define-operation.js";
3
3
  import { Node, SysProMDocument } from "../schema.js";
4
+ /** Query nodes from a SysProM document with optional filters for type and status. */
4
5
  export const queryNodesOp = defineOperation({
5
6
  name: "query-nodes",
6
7
  description: "Query nodes with optional filters for type and status",
@@ -1,4 +1,5 @@
1
1
  import * as z from "zod";
2
+ /** Query relationships from a SysProM document with optional filters for from, to, and type. */
2
3
  export declare const queryRelationshipsOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
3
4
  doc: z.ZodObject<{
4
5
  $schema: z.ZodOptional<z.ZodString>;
@@ -1,6 +1,7 @@
1
1
  import * as z from "zod";
2
2
  import { defineOperation } from "./define-operation.js";
3
3
  import { Relationship, SysProMDocument } from "../schema.js";
4
+ /** Query relationships from a SysProM document with optional filters for from, to, and type. */
4
5
  export const queryRelationshipsOp = defineOperation({
5
6
  name: "query-relationships",
6
7
  description: "Query relationships with optional filters for from, to, and type",
@@ -1,4 +1,5 @@
1
1
  import * as z from "zod";
2
+ /** Zod schema for the result of removing a node — the updated document plus any warnings. */
2
3
  export declare const RemoveResult: z.ZodObject<{
3
4
  doc: z.ZodObject<{
4
5
  $schema: z.ZodOptional<z.ZodString>;
@@ -297,7 +298,14 @@ export declare const RemoveResult: z.ZodObject<{
297
298
  };
298
299
  warnings: z.ZodArray<z.ZodString>;
299
300
  }, z.core.$strip>;
301
+ /** Result of removing a node: the updated document and any warnings about lingering references. */
300
302
  export type RemoveResult = z.infer<typeof RemoveResult>;
303
+ /**
304
+ * Remove a node and all relationships involving it. Also removes the node from
305
+ * view includes and external references. Warns if scope or operation references remain.
306
+ *
307
+ * @throws If the node ID is not found.
308
+ */
301
309
  export declare const removeNodeOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
302
310
  doc: z.ZodObject<{
303
311
  $schema: z.ZodOptional<z.ZodString>;
@@ -1,10 +1,17 @@
1
1
  import * as z from "zod";
2
2
  import { defineOperation } from "./define-operation.js";
3
3
  import { SysProMDocument } from "../schema.js";
4
+ /** Zod schema for the result of removing a node — the updated document plus any warnings. */
4
5
  export const RemoveResult = z.object({
5
6
  doc: SysProMDocument,
6
7
  warnings: z.array(z.string()),
7
8
  });
9
+ /**
10
+ * Remove a node and all relationships involving it. Also removes the node from
11
+ * view includes and external references. Warns if scope or operation references remain.
12
+ *
13
+ * @throws If the node ID is not found.
14
+ */
8
15
  export const removeNodeOp = defineOperation({
9
16
  name: "removeNode",
10
17
  description: "Remove a node and all relationships involving it. Also removes the node from view includes and external references.",
@@ -1,4 +1,9 @@
1
1
  import * as z from "zod";
2
+ /**
3
+ * Remove a relationship matching from, type, and to. Returns a new document without it.
4
+ *
5
+ * @throws If no matching relationship is found.
6
+ */
2
7
  export declare const removeRelationshipOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
3
8
  doc: z.ZodObject<{
4
9
  $schema: z.ZodOptional<z.ZodString>;
@@ -1,6 +1,11 @@
1
1
  import * as z from "zod";
2
2
  import { defineOperation } from "./define-operation.js";
3
3
  import { SysProMDocument, RelationshipType } from "../schema.js";
4
+ /**
5
+ * Remove a relationship matching from, type, and to. Returns a new document without it.
6
+ *
7
+ * @throws If no matching relationship is found.
8
+ */
4
9
  export const removeRelationshipOp = defineOperation({
5
10
  name: "removeRelationship",
6
11
  description: "Remove a relationship matching from, type, and to. Throws if the relationship is not found.",
@@ -1,4 +1,11 @@
1
1
  import * as z from "zod";
2
+ /**
3
+ * Rename a node ID across all references in the document — the node itself,
4
+ * relationships, scope, includes, operation targets, external references, and
5
+ * recursively into subsystems.
6
+ *
7
+ * @throws If the old ID is not found or the new ID already exists.
8
+ */
2
9
  export declare const renameOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
3
10
  doc: z.ZodObject<{
4
11
  $schema: z.ZodOptional<z.ZodString>;
@@ -89,6 +89,13 @@ function renameNodeId(doc, oldId, newId) {
89
89
  external_references: external_references.length > 0 ? external_references : undefined,
90
90
  };
91
91
  }
92
+ /**
93
+ * Rename a node ID across all references in the document — the node itself,
94
+ * relationships, scope, includes, operation targets, external references, and
95
+ * recursively into subsystems.
96
+ *
97
+ * @throws If the old ID is not found or the new ID already exists.
98
+ */
92
99
  export const renameOp = defineOperation({
93
100
  name: "rename",
94
101
  description: "Rename a node ID across all references in the document. Updates the node's own ID, relationships, scope, includes, operations targets, external references, and recursively into subsystems.",
@@ -1,4 +1,5 @@
1
1
  import * as z from "zod";
2
+ /** Search for nodes by text (case-insensitive) across id, name, description, context, and rationale fields. Recursively searches into subsystems. */
2
3
  export declare const searchOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
3
4
  doc: z.ZodObject<{
4
5
  $schema: z.ZodOptional<z.ZodString>;
@@ -2,6 +2,7 @@ import * as z from "zod";
2
2
  import { defineOperation } from "./define-operation.js";
3
3
  import { SysProMDocument, Node } from "../schema.js";
4
4
  import { textToString } from "../text.js";
5
+ /** Search for nodes by text (case-insensitive) across id, name, description, context, and rationale fields. Recursively searches into subsystems. */
5
6
  export const searchOp = defineOperation({
6
7
  name: "search",
7
8
  description: "Search for nodes in a SysProM document by text across id, name, description, context, and rationale fields. Recursively searches into subsystems.",
@@ -1,5 +1,7 @@
1
1
  import * as z from "zod";
2
+ /** Concise difference result — added, modified, and removed nodes with their IDs and names. */
2
3
  export type DiffResult = z.infer<typeof DiffResult>;
4
+ /** Zod schema for the diff result. */
3
5
  export declare const DiffResult: z.ZodObject<{
4
6
  added: z.ZodArray<z.ZodObject<{
5
7
  id: z.ZodString;
@@ -15,6 +17,7 @@ export declare const DiffResult: z.ZodObject<{
15
17
  name: z.ZodString;
16
18
  }, z.core.$strip>>;
17
19
  }, z.core.$strip>;
20
+ /** Show differences between a SysProM document and a Spec-Kit directory — added, modified, and removed nodes. */
18
21
  export declare const speckitDiffOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
19
22
  doc: z.ZodObject<{
20
23
  $schema: z.ZodOptional<z.ZodString>;
@@ -28,6 +28,7 @@ function compareDocuments(oldDoc, newDoc) {
28
28
  }
29
29
  return { added, modified, removed };
30
30
  }
31
+ /** Zod schema for the diff result. */
31
32
  export const DiffResult = z.object({
32
33
  added: z.array(z.object({
33
34
  id: z.string(),
@@ -43,6 +44,7 @@ export const DiffResult = z.object({
43
44
  name: z.string(),
44
45
  })),
45
46
  });
47
+ /** Show differences between a SysProM document and a Spec-Kit directory — added, modified, and removed nodes. */
46
48
  export const speckitDiffOp = defineOperation({
47
49
  name: "speckitDiff",
48
50
  description: "Show differences between a SysProM document and a Spec-Kit directory",
@@ -1,4 +1,5 @@
1
1
  import * as z from "zod";
2
+ /** Export a SysProM document to Spec-Kit format, writing specification files to the output directory. Only nodes matching the given ID prefix are exported. */
2
3
  export declare const speckitExportOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
3
4
  doc: z.ZodObject<{
4
5
  $schema: z.ZodOptional<z.ZodString>;
@@ -2,6 +2,7 @@ import * as z from "zod";
2
2
  import { defineOperation } from "./define-operation.js";
3
3
  import { SysProMDocument } from "../schema.js";
4
4
  import { generateSpecKitProject } from "../speckit/generate.js";
5
+ /** Export a SysProM document to Spec-Kit format, writing specification files to the output directory. Only nodes matching the given ID prefix are exported. */
5
6
  export const speckitExportOp = defineOperation({
6
7
  name: "speckitExport",
7
8
  description: "Export a SysProM document to Spec-Kit format",
@@ -1,4 +1,5 @@
1
1
  import * as z from "zod";
2
+ /** Import a Spec-Kit feature directory into a SysProM document. Automatically detects the project's constitution file by searching parent directories. */
2
3
  export declare const speckitImportOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
3
4
  speckitDir: z.ZodString;
4
5
  prefix: z.ZodOptional<z.ZodString>;
@@ -4,6 +4,7 @@ import { defineOperation } from "./define-operation.js";
4
4
  import { SysProMDocument } from "../schema.js";
5
5
  import { parseSpecKitFeature } from "../speckit/parse.js";
6
6
  import { detectSpecKitProject } from "../speckit/project.js";
7
+ /** Import a Spec-Kit feature directory into a SysProM document. Automatically detects the project's constitution file by searching parent directories. */
7
8
  export const speckitImportOp = defineOperation({
8
9
  name: "speckitImport",
9
10
  description: "Import a Spec-Kit feature directory into a SysProM document",
@@ -1,5 +1,7 @@
1
1
  import * as z from "zod";
2
+ /** Result of synchronising a SysProM document with a Spec-Kit directory — the merged document and change counts. */
2
3
  export type SyncResult = z.infer<typeof SyncResult>;
4
+ /** Zod schema for the sync result. */
3
5
  export declare const SyncResult: z.ZodObject<{
4
6
  doc: z.ZodObject<{
5
7
  $schema: z.ZodOptional<z.ZodString>;
@@ -300,6 +302,7 @@ export declare const SyncResult: z.ZodObject<{
300
302
  modified: z.ZodNumber;
301
303
  removed: z.ZodNumber;
302
304
  }, z.core.$strip>;
305
+ /** Synchronise a SysProM document with a Spec-Kit directory. Spec-Kit content wins for descriptions and status; SysProM structure (relationships, hierarchies) is preserved. Regenerates the Spec-Kit directory from the merged document. */
303
306
  export declare const speckitSyncOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
304
307
  doc: z.ZodObject<{
305
308
  $schema: z.ZodOptional<z.ZodString>;
@@ -29,12 +29,14 @@ function compareDocuments(oldDoc, newDoc) {
29
29
  }
30
30
  return { added, modified, removed };
31
31
  }
32
+ /** Zod schema for the sync result. */
32
33
  export const SyncResult = z.object({
33
34
  doc: SysProMDocument,
34
35
  added: z.number(),
35
36
  modified: z.number(),
36
37
  removed: z.number(),
37
38
  });
39
+ /** Synchronise a SysProM document with a Spec-Kit directory. Spec-Kit content wins for descriptions and status; SysProM structure (relationships, hierarchies) is preserved. Regenerates the Spec-Kit directory from the merged document. */
38
40
  export const speckitSyncOp = defineOperation({
39
41
  name: "speckitSync",
40
42
  description: "Synchronise a SysProM document with a Spec-Kit directory",