-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: add instruction loader for template loading and change context #414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # instruction-loader Specification | ||
|
|
||
| ## Purpose | ||
| Load templates from schema directories and enrich them with change-specific context for guiding artifact creation. | ||
|
|
||
| ## ADDED Requirements | ||
|
|
||
| ### Requirement: Template Loading | ||
| The system SHALL load templates from schema directories. | ||
|
|
||
| #### Scenario: Load template from schema directory | ||
| - **WHEN** `loadTemplate(schemaName, templatePath)` is called | ||
| - **THEN** the system loads the template from `schemas/<schemaName>/templates/<templatePath>` | ||
|
|
||
| #### Scenario: Template file not found | ||
| - **WHEN** a template file does not exist in the schema's templates directory | ||
| - **THEN** the system throws an error with the template path | ||
|
|
||
| ### Requirement: Change Context Loading | ||
| The system SHALL load change context combining graph and completion state. | ||
|
|
||
| #### Scenario: Load context for existing change | ||
| - **WHEN** `loadChangeContext(projectRoot, changeName)` is called for an existing change | ||
| - **THEN** the system returns a context with graph, completed set, schema name, and change info | ||
|
|
||
| #### Scenario: Load context with custom schema | ||
| - **WHEN** `loadChangeContext(projectRoot, changeName, schemaName)` is called | ||
| - **THEN** the system uses the specified schema instead of default | ||
|
|
||
| #### Scenario: Load context for non-existent change directory | ||
| - **WHEN** `loadChangeContext` is called for a non-existent change directory | ||
| - **THEN** the system returns context with empty completed set | ||
|
|
||
| ### Requirement: Template Enrichment | ||
| The system SHALL enrich templates with change-specific context. | ||
|
|
||
| #### Scenario: Include artifact metadata | ||
| - **WHEN** instructions are generated for an artifact | ||
| - **THEN** the output includes change name, artifact ID, schema name, and output path | ||
|
|
||
| #### Scenario: Include dependency status | ||
| - **WHEN** an artifact has dependencies | ||
| - **THEN** the output shows each dependency with completion status (done/missing) | ||
|
|
||
| #### Scenario: Include unlocked artifacts | ||
| - **WHEN** instructions are generated | ||
| - **THEN** the output includes which artifacts become available after this one | ||
|
|
||
| #### Scenario: Root artifact indicator | ||
| - **WHEN** an artifact has no dependencies | ||
| - **THEN** the dependency section indicates this is a root artifact | ||
|
|
||
| ### Requirement: Status Formatting | ||
| The system SHALL format change status as readable output. | ||
|
|
||
| #### Scenario: All artifacts completed | ||
| - **WHEN** all artifacts are completed | ||
| - **THEN** status shows all artifacts as "done" | ||
|
|
||
| #### Scenario: Mixed completion status | ||
| - **WHEN** some artifacts are completed | ||
| - **THEN** status shows completed as "done", ready as "ready", blocked as "blocked" | ||
|
|
||
| #### Scenario: Blocked artifact details | ||
| - **WHEN** an artifact is blocked | ||
| - **THEN** status shows which dependencies are missing | ||
|
|
||
| #### Scenario: Include output paths | ||
| - **WHEN** status is formatted | ||
| - **THEN** each artifact shows its output path pattern |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Tasks | ||
|
|
||
| ## Implementation Tasks | ||
|
|
||
| - [x] Create `instruction-loader` spec in `openspec/specs/instruction-loader/spec.md` | ||
| - [x] Implement `loadTemplate` function to load templates from schema directories | ||
| - [x] Implement `loadChangeContext` function to combine graph and completion state | ||
| - [x] Implement `generateInstructions` function to enrich templates with change context | ||
| - [x] Implement `formatChangeStatus` function for readable status output | ||
| - [x] Export new functions from `src/core/artifact-graph/index.ts` | ||
| - [x] Add comprehensive tests in `test/core/artifact-graph/instruction-loader.test.ts` | ||
| - [x] Verify build passes | ||
| - [x] Verify all tests pass |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,13 +1,16 @@ | ||||||
| ## ADDED Requirements | ||||||
| # instruction-loader Specification | ||||||
|
|
||||||
| ## Purpose | ||||||
| TBD - created by archiving change add-instruction-loader. Update Purpose after archive. | ||||||
| ## Requirements | ||||||
|
||||||
| ## Requirements | |
| ## ADDED Requirements |
🤖 Prompt for AI Agents
In openspec/changes/add-instruction-loader/specs/instruction-loader/spec.md
around line 6, the header currently reads "## Requirements" but per spec-delta
guidelines it must be one of the delta types; update the header to "## ADDED
Requirements" (exact casing and spacing) so the file uses the required spec
delta header for newly introduced capabilities.
Uh oh!
There was an error while loading. Please reload this page.