Skip to content

Commit 93edf7e

Browse files
committed
docs(speckit): add JSDoc and replace inline comments with doc comments
1 parent 891ec05 commit 93edf7e

4 files changed

Lines changed: 30 additions & 4 deletions

File tree

src/speckit/generate.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ function formatStatus(status?: string): string {
103103
// generate Constitution
104104
// ============================================================================
105105

106+
/** Generate a Spec-Kit constitution file from a SysProM document's principles and invariants. */
106107
export function generateConstitution(
107108
doc: SysProMDocument,
108109
prefix: string,
@@ -191,6 +192,7 @@ export function generateConstitution(
191192
// generateSpec
192193
// ============================================================================
193194

195+
/** Generate a Spec-Kit specification file from a SysProM document's user stories, FRs, and acceptance criteria. */
194196
export function generateSpec(doc: SysProMDocument, prefix: string): string {
195197
const specId = `${prefix}-SPEC`;
196198
const spec = findNode(doc, specId);
@@ -330,6 +332,7 @@ export function generateSpec(doc: SysProMDocument, prefix: string): string {
330332
// generatePlan
331333
// ============================================================================
332334

335+
/** Generate a Spec-Kit plan file from a SysProM document's phases and milestones. */
333336
export function generatePlan(doc: SysProMDocument, prefix: string): string {
334337
const implProtocolId = `${prefix}-PROT-IMPL`;
335338
const protocol = findNode(doc, implProtocolId);
@@ -387,6 +390,7 @@ export function generatePlan(doc: SysProMDocument, prefix: string): string {
387390
// generateTasks
388391
// ============================================================================
389392

393+
/** Generate a Spec-Kit tasks file from a SysProM document's change nodes. */
390394
export function generateTasks(doc: SysProMDocument, prefix: string): string {
391395
const implProtocolId = `${prefix}-PROT-IMPL`;
392396
const protocol = findNode(doc, implProtocolId);
@@ -576,6 +580,7 @@ export function generateTasks(doc: SysProMDocument, prefix: string): string {
576580
// generateChecklist
577581
// ============================================================================
578582

583+
/** Generate a Spec-Kit checklist file from a SysProM document's gate nodes. */
579584
export function generateChecklist(
580585
doc: SysProMDocument,
581586
prefix: string,
@@ -643,6 +648,7 @@ export function generateChecklist(
643648
// generateSpecKitProject
644649
// ============================================================================
645650

651+
/** Generate a complete Spec-Kit project directory from a SysProM document — constitution, spec, plan, tasks, and checklist files. */
646652
export function generateSpecKitProject(
647653
doc: SysProMDocument,
648654
outputDir: string,

src/speckit/parse.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ interface Section {
1818
children: Section[];
1919
}
2020

21+
/** Result of parsing a Spec-Kit file — extracted nodes and relationships. */
2122
export interface ParseResult {
23+
/** Nodes extracted from the parsed content. */
2224
nodes: Node[];
25+
/** Relationships extracted from the parsed content. */
2326
relationships: Relationship[];
2427
}
2528

@@ -187,6 +190,7 @@ function extractValue(body: string, key: string): string | undefined {
187190
// constitution.md parser
188191
// ---------------------------------------------------------------------------
189192

193+
/** Parse a Spec-Kit constitution file into SysProM nodes (principles and invariants) and relationships. */
190194
export function parseConstitution(
191195
content: string,
192196
idPrefix: string,
@@ -296,6 +300,7 @@ export function parseConstitution(
296300
// spec.md parser
297301
// ---------------------------------------------------------------------------
298302

303+
/** Parse a Spec-Kit specification file into SysProM nodes (user stories, functional requirements, acceptance criteria). */
299304
export function parseSpec(content: string, idPrefix: string): ParseResult {
300305
const sections = parseSections(content);
301306
const allSections = flattenSections(sections);
@@ -508,6 +513,7 @@ export function parseSpec(content: string, idPrefix: string): ParseResult {
508513
// plan.md parser
509514
// ---------------------------------------------------------------------------
510515

516+
/** Parse a Spec-Kit plan file into SysProM nodes (phases, milestones) and relationships. */
511517
export function parsePlan(content: string, idPrefix: string): ParseResult {
512518
const sections = parseSections(content);
513519
const allSections = flattenSections(sections);
@@ -613,6 +619,7 @@ export function parsePlan(content: string, idPrefix: string): ParseResult {
613619
// tasks.md parser
614620
// ---------------------------------------------------------------------------
615621

622+
/** Parse a Spec-Kit tasks file into SysProM change nodes with task plans. */
616623
export function parseTasks(content: string, idPrefix: string): ParseResult {
617624
const sections = parseSections(content);
618625
const allSections = flattenSections(sections);
@@ -739,6 +746,7 @@ export function parseTasks(content: string, idPrefix: string): ParseResult {
739746
// checklist.md parser
740747
// ---------------------------------------------------------------------------
741748

749+
/** Parse a Spec-Kit checklist file into SysProM gate nodes with task plans. */
742750
export function parseChecklist(content: string, idPrefix: string): ParseResult {
743751
const sections = parseSections(content);
744752
const allSections = flattenSections(sections);
@@ -799,6 +807,7 @@ export function parseChecklist(content: string, idPrefix: string): ParseResult {
799807
// Full feature directory parser
800808
// ---------------------------------------------------------------------------
801809

810+
/** Parse an entire Spec-Kit feature directory into a SysProM document, combining constitution, spec, plan, tasks, and checklist. */
802811
export function parseSpecKitFeature(
803812
featureDir: string,
804813
idPrefix: string,

src/speckit/plan.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { textToString } from "../text.js";
55
// Types
66
// ============================================================================
77

8+
/** Comprehensive status of all plan components — constitution, spec, plan, tasks, checklist, and next step. */
89
export interface PlanStatus {
910
constitution: { defined: boolean; principleCount: number };
1011
spec: {
@@ -18,6 +19,7 @@ export interface PlanStatus {
1819
nextStep: string;
1920
}
2021

22+
/** Per-phase progress metrics — task counts and completion percentage. */
2123
export interface PhaseProgress {
2224
phase: number;
2325
name: string;
@@ -26,18 +28,21 @@ export interface PhaseProgress {
2628
percent: number;
2729
}
2830

31+
/** A specific issue preventing gate entry — incomplete tasks, missing acceptance criteria, or unlinked requirements. */
2932
export type GateIssue =
3033
| { kind: "previous_tasks_incomplete"; phase: number; remaining: number }
3134
| { kind: "user_story_no_change"; storyId: string }
3235
| { kind: "user_story_no_acceptance_criteria"; storyId: string }
3336
| { kind: "fr_no_change"; frId: string };
3437

38+
/** Result of a gate check — phase number, readiness flag, and any blocking issues. */
3539
export interface GateResult {
3640
phase: number;
3741
ready: boolean;
3842
issues: GateIssue[];
3943
}
4044

45+
/** Task completion counts — total and done. */
4146
export interface TaskCount {
4247
total: number;
4348
done: number;

src/speckit/project.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import { existsSync, readdirSync, statSync } from "node:fs";
22
import { join } from "node:path";
33

4+
/** Detected Spec-Kit project structure — root directory and paths to key directories and files. */
45
export interface SpecKitProject {
5-
root: string; // project root directory
6-
specifyDir: string | null; // path to .specify/ if found
7-
specsDir: string | null; // path to specs/ if found
8-
constitutionPath: string | null; // path to constitution.md
6+
/** Project root directory. */
7+
root: string;
8+
/** Path to `.specify/` directory, or null if not found. */
9+
specifyDir: string | null;
10+
/** Path to `specs/` directory, or null if not found. */
11+
specsDir: string | null;
12+
/** Path to `constitution.md`, or null if not found. */
13+
constitutionPath: string | null;
914
}
1015

16+
/** A single Spec-Kit feature with its metadata and file paths. */
1117
export interface SpecKitFeature {
1218
id: string; // e.g., "001-feature-name"
1319
number: number; // e.g., 1

0 commit comments

Comments
 (0)