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:
@@ -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,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user