Accept story 36: Enforce Front Matter on All Story Files

Add POST /workflow/stories/create endpoint that auto-assigns story
numbers, generates correct front matter, and writes to upcoming/.
Add slugify_name and next_story_number helpers with full test coverage.
Add frontend createStory API method and types.
Update README to recommend creation API for agents.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dave
2026-02-19 18:02:48 +00:00
parent 5e5cdd9b2f
commit c94b3d4450
4 changed files with 477 additions and 8 deletions

View File

@@ -66,6 +66,7 @@ export interface StoryTodosResponse {
story_id: string;
story_name: string | null;
todos: string[];
error: string | null;
}
export interface TodoListResponse {
@@ -75,12 +76,33 @@ export interface TodoListResponse {
export interface UpcomingStory {
story_id: string;
name: string | null;
error: string | null;
}
export interface UpcomingStoriesResponse {
stories: UpcomingStory[];
}
export interface StoryValidationResult {
story_id: string;
valid: boolean;
error: string | null;
}
export interface ValidateStoriesResponse {
stories: StoryValidationResult[];
}
export interface CreateStoryPayload {
name: string;
user_story?: string | null;
acceptance_criteria?: string[] | null;
}
export interface CreateStoryResponse {
story_id: string;
}
const DEFAULT_API_BASE = "/api";
function buildApiUrl(path: string, baseUrl = DEFAULT_API_BASE): string {
@@ -160,4 +182,18 @@ export const workflowApi = {
getStoryTodos(baseUrl?: string) {
return requestJson<TodoListResponse>("/workflow/todos", {}, baseUrl);
},
validateStories(baseUrl?: string) {
return requestJson<ValidateStoriesResponse>(
"/workflow/stories/validate",
{},
baseUrl,
);
},
createStory(payload: CreateStoryPayload, baseUrl?: string) {
return requestJson<CreateStoryResponse>(
"/workflow/stories/create",
{ method: "POST", body: JSON.stringify(payload) },
baseUrl,
);
},
};