feat(tests): implement proper group member sequencing and cleanup deprecated skills
**Test Group Member Management:** - Refactor member data structure from simple ID array to object array with sequence numbers - Update member objects to include both TestSiteID and Member (sequence) fields - Fix addMember() to assign sequential Member numbers automatically - Fix removeMember() to re-sequence remaining members after removal - Fix moveMember() to properly swap and re-sequence members - Add sorting by sequence number in members list display - Update payload builder in tests.js to use proper object structure for API - Update TestFormModal.svelte member mapping for edit mode **Documentation:** - Add TypeScript Types section to AGENTS.md with TestType and TestSummary examples - Reorganize TODO.md with new test type categories and backend notes **Cleanup:** - Remove deprecated OpenSpec skills from .opencode/ directory: - opsx-apply.md, opsx-archive.md, opsx-explore.md, opsx-propose.md - openspec-apply-change/SKILL.md, openspec-archive-change/SKILL.md - openspec-explore/SKILL.md, openspec-propose/SKILL.md **New Files:** - Add .serena/memories/ for code style conventions and task tracking
This commit is contained in:
parent
09bfe6fb3e
commit
695ee3de91
@ -1,149 +0,0 @@
|
|||||||
---
|
|
||||||
description: Implement tasks from an OpenSpec change (Experimental)
|
|
||||||
---
|
|
||||||
|
|
||||||
Implement tasks from an OpenSpec change.
|
|
||||||
|
|
||||||
**Input**: Optionally specify a change name (e.g., `/opsx-apply add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
||||||
|
|
||||||
**Steps**
|
|
||||||
|
|
||||||
1. **Select the change**
|
|
||||||
|
|
||||||
If a name is provided, use it. Otherwise:
|
|
||||||
- Infer from conversation context if the user mentioned a change
|
|
||||||
- Auto-select if only one active change exists
|
|
||||||
- If ambiguous, run `openspec list --json` to get available changes and use the **AskUserQuestion tool** to let the user select
|
|
||||||
|
|
||||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx-apply <other>`).
|
|
||||||
|
|
||||||
2. **Check status to understand the schema**
|
|
||||||
```bash
|
|
||||||
openspec status --change "<name>" --json
|
|
||||||
```
|
|
||||||
Parse the JSON to understand:
|
|
||||||
- `schemaName`: The workflow being used (e.g., "spec-driven")
|
|
||||||
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
|
|
||||||
|
|
||||||
3. **Get apply instructions**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
openspec instructions apply --change "<name>" --json
|
|
||||||
```
|
|
||||||
|
|
||||||
This returns:
|
|
||||||
- Context file paths (varies by schema)
|
|
||||||
- Progress (total, complete, remaining)
|
|
||||||
- Task list with status
|
|
||||||
- Dynamic instruction based on current state
|
|
||||||
|
|
||||||
**Handle states:**
|
|
||||||
- If `state: "blocked"` (missing artifacts): show message, suggest using `/opsx-continue`
|
|
||||||
- If `state: "all_done"`: congratulate, suggest archive
|
|
||||||
- Otherwise: proceed to implementation
|
|
||||||
|
|
||||||
4. **Read context files**
|
|
||||||
|
|
||||||
Read the files listed in `contextFiles` from the apply instructions output.
|
|
||||||
The files depend on the schema being used:
|
|
||||||
- **spec-driven**: proposal, specs, design, tasks
|
|
||||||
- Other schemas: follow the contextFiles from CLI output
|
|
||||||
|
|
||||||
5. **Show current progress**
|
|
||||||
|
|
||||||
Display:
|
|
||||||
- Schema being used
|
|
||||||
- Progress: "N/M tasks complete"
|
|
||||||
- Remaining tasks overview
|
|
||||||
- Dynamic instruction from CLI
|
|
||||||
|
|
||||||
6. **Implement tasks (loop until done or blocked)**
|
|
||||||
|
|
||||||
For each pending task:
|
|
||||||
- Show which task is being worked on
|
|
||||||
- Make the code changes required
|
|
||||||
- Keep changes minimal and focused
|
|
||||||
- Mark task complete in the tasks file: `- [ ]` → `- [x]`
|
|
||||||
- Continue to next task
|
|
||||||
|
|
||||||
**Pause if:**
|
|
||||||
- Task is unclear → ask for clarification
|
|
||||||
- Implementation reveals a design issue → suggest updating artifacts
|
|
||||||
- Error or blocker encountered → report and wait for guidance
|
|
||||||
- User interrupts
|
|
||||||
|
|
||||||
7. **On completion or pause, show status**
|
|
||||||
|
|
||||||
Display:
|
|
||||||
- Tasks completed this session
|
|
||||||
- Overall progress: "N/M tasks complete"
|
|
||||||
- If all done: suggest archive
|
|
||||||
- If paused: explain why and wait for guidance
|
|
||||||
|
|
||||||
**Output During Implementation**
|
|
||||||
|
|
||||||
```
|
|
||||||
## Implementing: <change-name> (schema: <schema-name>)
|
|
||||||
|
|
||||||
Working on task 3/7: <task description>
|
|
||||||
[...implementation happening...]
|
|
||||||
✓ Task complete
|
|
||||||
|
|
||||||
Working on task 4/7: <task description>
|
|
||||||
[...implementation happening...]
|
|
||||||
✓ Task complete
|
|
||||||
```
|
|
||||||
|
|
||||||
**Output On Completion**
|
|
||||||
|
|
||||||
```
|
|
||||||
## Implementation Complete
|
|
||||||
|
|
||||||
**Change:** <change-name>
|
|
||||||
**Schema:** <schema-name>
|
|
||||||
**Progress:** 7/7 tasks complete ✓
|
|
||||||
|
|
||||||
### Completed This Session
|
|
||||||
- [x] Task 1
|
|
||||||
- [x] Task 2
|
|
||||||
...
|
|
||||||
|
|
||||||
All tasks complete! You can archive this change with `/opsx-archive`.
|
|
||||||
```
|
|
||||||
|
|
||||||
**Output On Pause (Issue Encountered)**
|
|
||||||
|
|
||||||
```
|
|
||||||
## Implementation Paused
|
|
||||||
|
|
||||||
**Change:** <change-name>
|
|
||||||
**Schema:** <schema-name>
|
|
||||||
**Progress:** 4/7 tasks complete
|
|
||||||
|
|
||||||
### Issue Encountered
|
|
||||||
<description of the issue>
|
|
||||||
|
|
||||||
**Options:**
|
|
||||||
1. <option 1>
|
|
||||||
2. <option 2>
|
|
||||||
3. Other approach
|
|
||||||
|
|
||||||
What would you like to do?
|
|
||||||
```
|
|
||||||
|
|
||||||
**Guardrails**
|
|
||||||
- Keep going through tasks until done or blocked
|
|
||||||
- Always read context files before starting (from the apply instructions output)
|
|
||||||
- If task is ambiguous, pause and ask before implementing
|
|
||||||
- If implementation reveals issues, pause and suggest artifact updates
|
|
||||||
- Keep code changes minimal and scoped to each task
|
|
||||||
- Update task checkbox immediately after completing each task
|
|
||||||
- Pause on errors, blockers, or unclear requirements - don't guess
|
|
||||||
- Use contextFiles from CLI output, don't assume specific file names
|
|
||||||
|
|
||||||
**Fluid Workflow Integration**
|
|
||||||
|
|
||||||
This skill supports the "actions on a change" model:
|
|
||||||
|
|
||||||
- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
|
|
||||||
- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
|
|
||||||
@ -1,154 +0,0 @@
|
|||||||
---
|
|
||||||
description: Archive a completed change in the experimental workflow
|
|
||||||
---
|
|
||||||
|
|
||||||
Archive a completed change in the experimental workflow.
|
|
||||||
|
|
||||||
**Input**: Optionally specify a change name after `/opsx-archive` (e.g., `/opsx-archive add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
||||||
|
|
||||||
**Steps**
|
|
||||||
|
|
||||||
1. **If no change name provided, prompt for selection**
|
|
||||||
|
|
||||||
Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
|
|
||||||
|
|
||||||
Show only active changes (not already archived).
|
|
||||||
Include the schema used for each change if available.
|
|
||||||
|
|
||||||
**IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
|
|
||||||
|
|
||||||
2. **Check artifact completion status**
|
|
||||||
|
|
||||||
Run `openspec status --change "<name>" --json` to check artifact completion.
|
|
||||||
|
|
||||||
Parse the JSON to understand:
|
|
||||||
- `schemaName`: The workflow being used
|
|
||||||
- `artifacts`: List of artifacts with their status (`done` or other)
|
|
||||||
|
|
||||||
**If any artifacts are not `done`:**
|
|
||||||
- Display warning listing incomplete artifacts
|
|
||||||
- Prompt user for confirmation to continue
|
|
||||||
- Proceed if user confirms
|
|
||||||
|
|
||||||
3. **Check task completion status**
|
|
||||||
|
|
||||||
Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
|
|
||||||
|
|
||||||
Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
|
|
||||||
|
|
||||||
**If incomplete tasks found:**
|
|
||||||
- Display warning showing count of incomplete tasks
|
|
||||||
- Prompt user for confirmation to continue
|
|
||||||
- Proceed if user confirms
|
|
||||||
|
|
||||||
**If no tasks file exists:** Proceed without task-related warning.
|
|
||||||
|
|
||||||
4. **Assess delta spec sync state**
|
|
||||||
|
|
||||||
Check for delta specs at `openspec/changes/<name>/specs/`. If none exist, proceed without sync prompt.
|
|
||||||
|
|
||||||
**If delta specs exist:**
|
|
||||||
- Compare each delta spec with its corresponding main spec at `openspec/specs/<capability>/spec.md`
|
|
||||||
- Determine what changes would be applied (adds, modifications, removals, renames)
|
|
||||||
- Show a combined summary before prompting
|
|
||||||
|
|
||||||
**Prompt options:**
|
|
||||||
- If changes needed: "Sync now (recommended)", "Archive without syncing"
|
|
||||||
- If already synced: "Archive now", "Sync anyway", "Cancel"
|
|
||||||
|
|
||||||
If user chooses sync, use Task tool (subagent_type: "general-purpose", prompt: "Use Skill tool to invoke openspec-sync-specs for change '<name>'. Delta spec analysis: <include the analyzed delta spec summary>"). Proceed to archive regardless of choice.
|
|
||||||
|
|
||||||
5. **Perform the archive**
|
|
||||||
|
|
||||||
Create the archive directory if it doesn't exist:
|
|
||||||
```bash
|
|
||||||
mkdir -p openspec/changes/archive
|
|
||||||
```
|
|
||||||
|
|
||||||
Generate target name using current date: `YYYY-MM-DD-<change-name>`
|
|
||||||
|
|
||||||
**Check if target already exists:**
|
|
||||||
- If yes: Fail with error, suggest renaming existing archive or using different date
|
|
||||||
- If no: Move the change directory to archive
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name>
|
|
||||||
```
|
|
||||||
|
|
||||||
6. **Display summary**
|
|
||||||
|
|
||||||
Show archive completion summary including:
|
|
||||||
- Change name
|
|
||||||
- Schema that was used
|
|
||||||
- Archive location
|
|
||||||
- Spec sync status (synced / sync skipped / no delta specs)
|
|
||||||
- Note about any warnings (incomplete artifacts/tasks)
|
|
||||||
|
|
||||||
**Output On Success**
|
|
||||||
|
|
||||||
```
|
|
||||||
## Archive Complete
|
|
||||||
|
|
||||||
**Change:** <change-name>
|
|
||||||
**Schema:** <schema-name>
|
|
||||||
**Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
|
|
||||||
**Specs:** ✓ Synced to main specs
|
|
||||||
|
|
||||||
All artifacts complete. All tasks complete.
|
|
||||||
```
|
|
||||||
|
|
||||||
**Output On Success (No Delta Specs)**
|
|
||||||
|
|
||||||
```
|
|
||||||
## Archive Complete
|
|
||||||
|
|
||||||
**Change:** <change-name>
|
|
||||||
**Schema:** <schema-name>
|
|
||||||
**Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
|
|
||||||
**Specs:** No delta specs
|
|
||||||
|
|
||||||
All artifacts complete. All tasks complete.
|
|
||||||
```
|
|
||||||
|
|
||||||
**Output On Success With Warnings**
|
|
||||||
|
|
||||||
```
|
|
||||||
## Archive Complete (with warnings)
|
|
||||||
|
|
||||||
**Change:** <change-name>
|
|
||||||
**Schema:** <schema-name>
|
|
||||||
**Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
|
|
||||||
**Specs:** Sync skipped (user chose to skip)
|
|
||||||
|
|
||||||
**Warnings:**
|
|
||||||
- Archived with 2 incomplete artifacts
|
|
||||||
- Archived with 3 incomplete tasks
|
|
||||||
- Delta spec sync was skipped (user chose to skip)
|
|
||||||
|
|
||||||
Review the archive if this was not intentional.
|
|
||||||
```
|
|
||||||
|
|
||||||
**Output On Error (Archive Exists)**
|
|
||||||
|
|
||||||
```
|
|
||||||
## Archive Failed
|
|
||||||
|
|
||||||
**Change:** <change-name>
|
|
||||||
**Target:** openspec/changes/archive/YYYY-MM-DD-<name>/
|
|
||||||
|
|
||||||
Target archive directory already exists.
|
|
||||||
|
|
||||||
**Options:**
|
|
||||||
1. Rename the existing archive
|
|
||||||
2. Delete the existing archive if it's a duplicate
|
|
||||||
3. Wait until a different date to archive
|
|
||||||
```
|
|
||||||
|
|
||||||
**Guardrails**
|
|
||||||
- Always prompt for change selection if not provided
|
|
||||||
- Use artifact graph (openspec status --json) for completion checking
|
|
||||||
- Don't block archive on warnings - just inform and confirm
|
|
||||||
- Preserve .openspec.yaml when moving to archive (it moves with the directory)
|
|
||||||
- Show clear summary of what happened
|
|
||||||
- If sync is requested, use the Skill tool to invoke `openspec-sync-specs` (agent-driven)
|
|
||||||
- If delta specs exist, always run the sync assessment and show the combined summary before prompting
|
|
||||||
@ -1,170 +0,0 @@
|
|||||||
---
|
|
||||||
description: Enter explore mode - think through ideas, investigate problems, clarify requirements
|
|
||||||
---
|
|
||||||
|
|
||||||
Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
|
|
||||||
|
|
||||||
**IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create OpenSpec artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing.
|
|
||||||
|
|
||||||
**This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
|
|
||||||
|
|
||||||
**Input**: The argument after `/opsx-explore` is whatever the user wants to think about. Could be:
|
|
||||||
- A vague idea: "real-time collaboration"
|
|
||||||
- A specific problem: "the auth system is getting unwieldy"
|
|
||||||
- A change name: "add-dark-mode" (to explore in context of that change)
|
|
||||||
- A comparison: "postgres vs sqlite for this"
|
|
||||||
- Nothing (just enter explore mode)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## The Stance
|
|
||||||
|
|
||||||
- **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
|
|
||||||
- **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
|
|
||||||
- **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
|
|
||||||
- **Adaptive** - Follow interesting threads, pivot when new information emerges
|
|
||||||
- **Patient** - Don't rush to conclusions, let the shape of the problem emerge
|
|
||||||
- **Grounded** - Explore the actual codebase when relevant, don't just theorize
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## What You Might Do
|
|
||||||
|
|
||||||
Depending on what the user brings, you might:
|
|
||||||
|
|
||||||
**Explore the problem space**
|
|
||||||
- Ask clarifying questions that emerge from what they said
|
|
||||||
- Challenge assumptions
|
|
||||||
- Reframe the problem
|
|
||||||
- Find analogies
|
|
||||||
|
|
||||||
**Investigate the codebase**
|
|
||||||
- Map existing architecture relevant to the discussion
|
|
||||||
- Find integration points
|
|
||||||
- Identify patterns already in use
|
|
||||||
- Surface hidden complexity
|
|
||||||
|
|
||||||
**Compare options**
|
|
||||||
- Brainstorm multiple approaches
|
|
||||||
- Build comparison tables
|
|
||||||
- Sketch tradeoffs
|
|
||||||
- Recommend a path (if asked)
|
|
||||||
|
|
||||||
**Visualize**
|
|
||||||
```
|
|
||||||
┌─────────────────────────────────────────┐
|
|
||||||
│ Use ASCII diagrams liberally │
|
|
||||||
├─────────────────────────────────────────┤
|
|
||||||
│ │
|
|
||||||
│ ┌────────┐ ┌────────┐ │
|
|
||||||
│ │ State │────────▶│ State │ │
|
|
||||||
│ │ A │ │ B │ │
|
|
||||||
│ └────────┘ └────────┘ │
|
|
||||||
│ │
|
|
||||||
│ System diagrams, state machines, │
|
|
||||||
│ data flows, architecture sketches, │
|
|
||||||
│ dependency graphs, comparison tables │
|
|
||||||
│ │
|
|
||||||
└─────────────────────────────────────────┘
|
|
||||||
```
|
|
||||||
|
|
||||||
**Surface risks and unknowns**
|
|
||||||
- Identify what could go wrong
|
|
||||||
- Find gaps in understanding
|
|
||||||
- Suggest spikes or investigations
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## OpenSpec Awareness
|
|
||||||
|
|
||||||
You have full context of the OpenSpec system. Use it naturally, don't force it.
|
|
||||||
|
|
||||||
### Check for context
|
|
||||||
|
|
||||||
At the start, quickly check what exists:
|
|
||||||
```bash
|
|
||||||
openspec list --json
|
|
||||||
```
|
|
||||||
|
|
||||||
This tells you:
|
|
||||||
- If there are active changes
|
|
||||||
- Their names, schemas, and status
|
|
||||||
- What the user might be working on
|
|
||||||
|
|
||||||
If the user mentioned a specific change name, read its artifacts for context.
|
|
||||||
|
|
||||||
### When no change exists
|
|
||||||
|
|
||||||
Think freely. When insights crystallize, you might offer:
|
|
||||||
|
|
||||||
- "This feels solid enough to start a change. Want me to create a proposal?"
|
|
||||||
- Or keep exploring - no pressure to formalize
|
|
||||||
|
|
||||||
### When a change exists
|
|
||||||
|
|
||||||
If the user mentions a change or you detect one is relevant:
|
|
||||||
|
|
||||||
1. **Read existing artifacts for context**
|
|
||||||
- `openspec/changes/<name>/proposal.md`
|
|
||||||
- `openspec/changes/<name>/design.md`
|
|
||||||
- `openspec/changes/<name>/tasks.md`
|
|
||||||
- etc.
|
|
||||||
|
|
||||||
2. **Reference them naturally in conversation**
|
|
||||||
- "Your design mentions using Redis, but we just realized SQLite fits better..."
|
|
||||||
- "The proposal scopes this to premium users, but we're now thinking everyone..."
|
|
||||||
|
|
||||||
3. **Offer to capture when decisions are made**
|
|
||||||
|
|
||||||
| Insight Type | Where to Capture |
|
|
||||||
|--------------|------------------|
|
|
||||||
| New requirement discovered | `specs/<capability>/spec.md` |
|
|
||||||
| Requirement changed | `specs/<capability>/spec.md` |
|
|
||||||
| Design decision made | `design.md` |
|
|
||||||
| Scope changed | `proposal.md` |
|
|
||||||
| New work identified | `tasks.md` |
|
|
||||||
| Assumption invalidated | Relevant artifact |
|
|
||||||
|
|
||||||
Example offers:
|
|
||||||
- "That's a design decision. Capture it in design.md?"
|
|
||||||
- "This is a new requirement. Add it to specs?"
|
|
||||||
- "This changes scope. Update the proposal?"
|
|
||||||
|
|
||||||
4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## What You Don't Have To Do
|
|
||||||
|
|
||||||
- Follow a script
|
|
||||||
- Ask the same questions every time
|
|
||||||
- Produce a specific artifact
|
|
||||||
- Reach a conclusion
|
|
||||||
- Stay on topic if a tangent is valuable
|
|
||||||
- Be brief (this is thinking time)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Ending Discovery
|
|
||||||
|
|
||||||
There's no required ending. Discovery might:
|
|
||||||
|
|
||||||
- **Flow into a proposal**: "Ready to start? I can create a change proposal."
|
|
||||||
- **Result in artifact updates**: "Updated design.md with these decisions"
|
|
||||||
- **Just provide clarity**: User has what they need, moves on
|
|
||||||
- **Continue later**: "We can pick this up anytime"
|
|
||||||
|
|
||||||
When things crystallize, you might offer a summary - but it's optional. Sometimes the thinking IS the value.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Guardrails
|
|
||||||
|
|
||||||
- **Don't implement** - Never write code or implement features. Creating OpenSpec artifacts is fine, writing application code is not.
|
|
||||||
- **Don't fake understanding** - If something is unclear, dig deeper
|
|
||||||
- **Don't rush** - Discovery is thinking time, not task time
|
|
||||||
- **Don't force structure** - Let patterns emerge naturally
|
|
||||||
- **Don't auto-capture** - Offer to save insights, don't just do it
|
|
||||||
- **Do visualize** - A good diagram is worth many paragraphs
|
|
||||||
- **Do explore the codebase** - Ground discussions in reality
|
|
||||||
- **Do question assumptions** - Including the user's and your own
|
|
||||||
@ -1,103 +0,0 @@
|
|||||||
---
|
|
||||||
description: Propose a new change - create it and generate all artifacts in one step
|
|
||||||
---
|
|
||||||
|
|
||||||
Propose a new change - create the change and generate all artifacts in one step.
|
|
||||||
|
|
||||||
I'll create a change with artifacts:
|
|
||||||
- proposal.md (what & why)
|
|
||||||
- design.md (how)
|
|
||||||
- tasks.md (implementation steps)
|
|
||||||
|
|
||||||
When ready to implement, run /opsx-apply
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Input**: The argument after `/opsx-propose` is the change name (kebab-case), OR a description of what the user wants to build.
|
|
||||||
|
|
||||||
**Steps**
|
|
||||||
|
|
||||||
1. **If no input provided, ask what they want to build**
|
|
||||||
|
|
||||||
Use the **AskUserQuestion tool** (open-ended, no preset options) to ask:
|
|
||||||
> "What change do you want to work on? Describe what you want to build or fix."
|
|
||||||
|
|
||||||
From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`).
|
|
||||||
|
|
||||||
**IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
|
|
||||||
|
|
||||||
2. **Create the change directory**
|
|
||||||
```bash
|
|
||||||
openspec new change "<name>"
|
|
||||||
```
|
|
||||||
This creates a scaffolded change at `openspec/changes/<name>/` with `.openspec.yaml`.
|
|
||||||
|
|
||||||
3. **Get the artifact build order**
|
|
||||||
```bash
|
|
||||||
openspec status --change "<name>" --json
|
|
||||||
```
|
|
||||||
Parse the JSON to get:
|
|
||||||
- `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
|
|
||||||
- `artifacts`: list of all artifacts with their status and dependencies
|
|
||||||
|
|
||||||
4. **Create artifacts in sequence until apply-ready**
|
|
||||||
|
|
||||||
Use the **TodoWrite tool** to track progress through the artifacts.
|
|
||||||
|
|
||||||
Loop through artifacts in dependency order (artifacts with no pending dependencies first):
|
|
||||||
|
|
||||||
a. **For each artifact that is `ready` (dependencies satisfied)**:
|
|
||||||
- Get instructions:
|
|
||||||
```bash
|
|
||||||
openspec instructions <artifact-id> --change "<name>" --json
|
|
||||||
```
|
|
||||||
- The instructions JSON includes:
|
|
||||||
- `context`: Project background (constraints for you - do NOT include in output)
|
|
||||||
- `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
|
|
||||||
- `template`: The structure to use for your output file
|
|
||||||
- `instruction`: Schema-specific guidance for this artifact type
|
|
||||||
- `outputPath`: Where to write the artifact
|
|
||||||
- `dependencies`: Completed artifacts to read for context
|
|
||||||
- Read any completed dependency files for context
|
|
||||||
- Create the artifact file using `template` as the structure
|
|
||||||
- Apply `context` and `rules` as constraints - but do NOT copy them into the file
|
|
||||||
- Show brief progress: "Created <artifact-id>"
|
|
||||||
|
|
||||||
b. **Continue until all `applyRequires` artifacts are complete**
|
|
||||||
- After creating each artifact, re-run `openspec status --change "<name>" --json`
|
|
||||||
- Check if every artifact ID in `applyRequires` has `status: "done"` in the artifacts array
|
|
||||||
- Stop when all `applyRequires` artifacts are done
|
|
||||||
|
|
||||||
c. **If an artifact requires user input** (unclear context):
|
|
||||||
- Use **AskUserQuestion tool** to clarify
|
|
||||||
- Then continue with creation
|
|
||||||
|
|
||||||
5. **Show final status**
|
|
||||||
```bash
|
|
||||||
openspec status --change "<name>"
|
|
||||||
```
|
|
||||||
|
|
||||||
**Output**
|
|
||||||
|
|
||||||
After completing all artifacts, summarize:
|
|
||||||
- Change name and location
|
|
||||||
- List of artifacts created with brief descriptions
|
|
||||||
- What's ready: "All artifacts created! Ready for implementation."
|
|
||||||
- Prompt: "Run `/opsx-apply` to start implementing."
|
|
||||||
|
|
||||||
**Artifact Creation Guidelines**
|
|
||||||
|
|
||||||
- Follow the `instruction` field from `openspec instructions` for each artifact type
|
|
||||||
- The schema defines what each artifact should contain - follow it
|
|
||||||
- Read dependency artifacts for context before creating new ones
|
|
||||||
- Use `template` as the structure for your output file - fill in its sections
|
|
||||||
- **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
|
|
||||||
- Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
|
|
||||||
- These guide what you write, but should never appear in the output
|
|
||||||
|
|
||||||
**Guardrails**
|
|
||||||
- Create ALL artifacts needed for implementation (as defined by schema's `apply.requires`)
|
|
||||||
- Always read dependency artifacts before creating a new one
|
|
||||||
- If context is critically unclear, ask the user - but prefer making reasonable decisions to keep momentum
|
|
||||||
- If a change with that name already exists, ask if user wants to continue it or create a new one
|
|
||||||
- Verify each artifact file exists after writing before proceeding to next
|
|
||||||
@ -1,156 +0,0 @@
|
|||||||
---
|
|
||||||
name: openspec-apply-change
|
|
||||||
description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.
|
|
||||||
license: MIT
|
|
||||||
compatibility: Requires openspec CLI.
|
|
||||||
metadata:
|
|
||||||
author: openspec
|
|
||||||
version: "1.0"
|
|
||||||
generatedBy: "1.2.0"
|
|
||||||
---
|
|
||||||
|
|
||||||
Implement tasks from an OpenSpec change.
|
|
||||||
|
|
||||||
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
||||||
|
|
||||||
**Steps**
|
|
||||||
|
|
||||||
1. **Select the change**
|
|
||||||
|
|
||||||
If a name is provided, use it. Otherwise:
|
|
||||||
- Infer from conversation context if the user mentioned a change
|
|
||||||
- Auto-select if only one active change exists
|
|
||||||
- If ambiguous, run `openspec list --json` to get available changes and use the **AskUserQuestion tool** to let the user select
|
|
||||||
|
|
||||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx-apply <other>`).
|
|
||||||
|
|
||||||
2. **Check status to understand the schema**
|
|
||||||
```bash
|
|
||||||
openspec status --change "<name>" --json
|
|
||||||
```
|
|
||||||
Parse the JSON to understand:
|
|
||||||
- `schemaName`: The workflow being used (e.g., "spec-driven")
|
|
||||||
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
|
|
||||||
|
|
||||||
3. **Get apply instructions**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
openspec instructions apply --change "<name>" --json
|
|
||||||
```
|
|
||||||
|
|
||||||
This returns:
|
|
||||||
- Context file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
|
|
||||||
- Progress (total, complete, remaining)
|
|
||||||
- Task list with status
|
|
||||||
- Dynamic instruction based on current state
|
|
||||||
|
|
||||||
**Handle states:**
|
|
||||||
- If `state: "blocked"` (missing artifacts): show message, suggest using openspec-continue-change
|
|
||||||
- If `state: "all_done"`: congratulate, suggest archive
|
|
||||||
- Otherwise: proceed to implementation
|
|
||||||
|
|
||||||
4. **Read context files**
|
|
||||||
|
|
||||||
Read the files listed in `contextFiles` from the apply instructions output.
|
|
||||||
The files depend on the schema being used:
|
|
||||||
- **spec-driven**: proposal, specs, design, tasks
|
|
||||||
- Other schemas: follow the contextFiles from CLI output
|
|
||||||
|
|
||||||
5. **Show current progress**
|
|
||||||
|
|
||||||
Display:
|
|
||||||
- Schema being used
|
|
||||||
- Progress: "N/M tasks complete"
|
|
||||||
- Remaining tasks overview
|
|
||||||
- Dynamic instruction from CLI
|
|
||||||
|
|
||||||
6. **Implement tasks (loop until done or blocked)**
|
|
||||||
|
|
||||||
For each pending task:
|
|
||||||
- Show which task is being worked on
|
|
||||||
- Make the code changes required
|
|
||||||
- Keep changes minimal and focused
|
|
||||||
- Mark task complete in the tasks file: `- [ ]` → `- [x]`
|
|
||||||
- Continue to next task
|
|
||||||
|
|
||||||
**Pause if:**
|
|
||||||
- Task is unclear → ask for clarification
|
|
||||||
- Implementation reveals a design issue → suggest updating artifacts
|
|
||||||
- Error or blocker encountered → report and wait for guidance
|
|
||||||
- User interrupts
|
|
||||||
|
|
||||||
7. **On completion or pause, show status**
|
|
||||||
|
|
||||||
Display:
|
|
||||||
- Tasks completed this session
|
|
||||||
- Overall progress: "N/M tasks complete"
|
|
||||||
- If all done: suggest archive
|
|
||||||
- If paused: explain why and wait for guidance
|
|
||||||
|
|
||||||
**Output During Implementation**
|
|
||||||
|
|
||||||
```
|
|
||||||
## Implementing: <change-name> (schema: <schema-name>)
|
|
||||||
|
|
||||||
Working on task 3/7: <task description>
|
|
||||||
[...implementation happening...]
|
|
||||||
✓ Task complete
|
|
||||||
|
|
||||||
Working on task 4/7: <task description>
|
|
||||||
[...implementation happening...]
|
|
||||||
✓ Task complete
|
|
||||||
```
|
|
||||||
|
|
||||||
**Output On Completion**
|
|
||||||
|
|
||||||
```
|
|
||||||
## Implementation Complete
|
|
||||||
|
|
||||||
**Change:** <change-name>
|
|
||||||
**Schema:** <schema-name>
|
|
||||||
**Progress:** 7/7 tasks complete ✓
|
|
||||||
|
|
||||||
### Completed This Session
|
|
||||||
- [x] Task 1
|
|
||||||
- [x] Task 2
|
|
||||||
...
|
|
||||||
|
|
||||||
All tasks complete! Ready to archive this change.
|
|
||||||
```
|
|
||||||
|
|
||||||
**Output On Pause (Issue Encountered)**
|
|
||||||
|
|
||||||
```
|
|
||||||
## Implementation Paused
|
|
||||||
|
|
||||||
**Change:** <change-name>
|
|
||||||
**Schema:** <schema-name>
|
|
||||||
**Progress:** 4/7 tasks complete
|
|
||||||
|
|
||||||
### Issue Encountered
|
|
||||||
<description of the issue>
|
|
||||||
|
|
||||||
**Options:**
|
|
||||||
1. <option 1>
|
|
||||||
2. <option 2>
|
|
||||||
3. Other approach
|
|
||||||
|
|
||||||
What would you like to do?
|
|
||||||
```
|
|
||||||
|
|
||||||
**Guardrails**
|
|
||||||
- Keep going through tasks until done or blocked
|
|
||||||
- Always read context files before starting (from the apply instructions output)
|
|
||||||
- If task is ambiguous, pause and ask before implementing
|
|
||||||
- If implementation reveals issues, pause and suggest artifact updates
|
|
||||||
- Keep code changes minimal and scoped to each task
|
|
||||||
- Update task checkbox immediately after completing each task
|
|
||||||
- Pause on errors, blockers, or unclear requirements - don't guess
|
|
||||||
- Use contextFiles from CLI output, don't assume specific file names
|
|
||||||
|
|
||||||
**Fluid Workflow Integration**
|
|
||||||
|
|
||||||
This skill supports the "actions on a change" model:
|
|
||||||
|
|
||||||
- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
|
|
||||||
- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
|
|
||||||
@ -1,114 +0,0 @@
|
|||||||
---
|
|
||||||
name: openspec-archive-change
|
|
||||||
description: Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
|
|
||||||
license: MIT
|
|
||||||
compatibility: Requires openspec CLI.
|
|
||||||
metadata:
|
|
||||||
author: openspec
|
|
||||||
version: "1.0"
|
|
||||||
generatedBy: "1.2.0"
|
|
||||||
---
|
|
||||||
|
|
||||||
Archive a completed change in the experimental workflow.
|
|
||||||
|
|
||||||
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
||||||
|
|
||||||
**Steps**
|
|
||||||
|
|
||||||
1. **If no change name provided, prompt for selection**
|
|
||||||
|
|
||||||
Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
|
|
||||||
|
|
||||||
Show only active changes (not already archived).
|
|
||||||
Include the schema used for each change if available.
|
|
||||||
|
|
||||||
**IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
|
|
||||||
|
|
||||||
2. **Check artifact completion status**
|
|
||||||
|
|
||||||
Run `openspec status --change "<name>" --json` to check artifact completion.
|
|
||||||
|
|
||||||
Parse the JSON to understand:
|
|
||||||
- `schemaName`: The workflow being used
|
|
||||||
- `artifacts`: List of artifacts with their status (`done` or other)
|
|
||||||
|
|
||||||
**If any artifacts are not `done`:**
|
|
||||||
- Display warning listing incomplete artifacts
|
|
||||||
- Use **AskUserQuestion tool** to confirm user wants to proceed
|
|
||||||
- Proceed if user confirms
|
|
||||||
|
|
||||||
3. **Check task completion status**
|
|
||||||
|
|
||||||
Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
|
|
||||||
|
|
||||||
Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
|
|
||||||
|
|
||||||
**If incomplete tasks found:**
|
|
||||||
- Display warning showing count of incomplete tasks
|
|
||||||
- Use **AskUserQuestion tool** to confirm user wants to proceed
|
|
||||||
- Proceed if user confirms
|
|
||||||
|
|
||||||
**If no tasks file exists:** Proceed without task-related warning.
|
|
||||||
|
|
||||||
4. **Assess delta spec sync state**
|
|
||||||
|
|
||||||
Check for delta specs at `openspec/changes/<name>/specs/`. If none exist, proceed without sync prompt.
|
|
||||||
|
|
||||||
**If delta specs exist:**
|
|
||||||
- Compare each delta spec with its corresponding main spec at `openspec/specs/<capability>/spec.md`
|
|
||||||
- Determine what changes would be applied (adds, modifications, removals, renames)
|
|
||||||
- Show a combined summary before prompting
|
|
||||||
|
|
||||||
**Prompt options:**
|
|
||||||
- If changes needed: "Sync now (recommended)", "Archive without syncing"
|
|
||||||
- If already synced: "Archive now", "Sync anyway", "Cancel"
|
|
||||||
|
|
||||||
If user chooses sync, use Task tool (subagent_type: "general-purpose", prompt: "Use Skill tool to invoke openspec-sync-specs for change '<name>'. Delta spec analysis: <include the analyzed delta spec summary>"). Proceed to archive regardless of choice.
|
|
||||||
|
|
||||||
5. **Perform the archive**
|
|
||||||
|
|
||||||
Create the archive directory if it doesn't exist:
|
|
||||||
```bash
|
|
||||||
mkdir -p openspec/changes/archive
|
|
||||||
```
|
|
||||||
|
|
||||||
Generate target name using current date: `YYYY-MM-DD-<change-name>`
|
|
||||||
|
|
||||||
**Check if target already exists:**
|
|
||||||
- If yes: Fail with error, suggest renaming existing archive or using different date
|
|
||||||
- If no: Move the change directory to archive
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name>
|
|
||||||
```
|
|
||||||
|
|
||||||
6. **Display summary**
|
|
||||||
|
|
||||||
Show archive completion summary including:
|
|
||||||
- Change name
|
|
||||||
- Schema that was used
|
|
||||||
- Archive location
|
|
||||||
- Whether specs were synced (if applicable)
|
|
||||||
- Note about any warnings (incomplete artifacts/tasks)
|
|
||||||
|
|
||||||
**Output On Success**
|
|
||||||
|
|
||||||
```
|
|
||||||
## Archive Complete
|
|
||||||
|
|
||||||
**Change:** <change-name>
|
|
||||||
**Schema:** <schema-name>
|
|
||||||
**Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
|
|
||||||
**Specs:** ✓ Synced to main specs (or "No delta specs" or "Sync skipped")
|
|
||||||
|
|
||||||
All artifacts complete. All tasks complete.
|
|
||||||
```
|
|
||||||
|
|
||||||
**Guardrails**
|
|
||||||
- Always prompt for change selection if not provided
|
|
||||||
- Use artifact graph (openspec status --json) for completion checking
|
|
||||||
- Don't block archive on warnings - just inform and confirm
|
|
||||||
- Preserve .openspec.yaml when moving to archive (it moves with the directory)
|
|
||||||
- Show clear summary of what happened
|
|
||||||
- If sync is requested, use openspec-sync-specs approach (agent-driven)
|
|
||||||
- If delta specs exist, always run the sync assessment and show the combined summary before prompting
|
|
||||||
@ -1,288 +0,0 @@
|
|||||||
---
|
|
||||||
name: openspec-explore
|
|
||||||
description: Enter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements. Use when the user wants to think through something before or during a change.
|
|
||||||
license: MIT
|
|
||||||
compatibility: Requires openspec CLI.
|
|
||||||
metadata:
|
|
||||||
author: openspec
|
|
||||||
version: "1.0"
|
|
||||||
generatedBy: "1.2.0"
|
|
||||||
---
|
|
||||||
|
|
||||||
Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
|
|
||||||
|
|
||||||
**IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create OpenSpec artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing.
|
|
||||||
|
|
||||||
**This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## The Stance
|
|
||||||
|
|
||||||
- **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
|
|
||||||
- **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
|
|
||||||
- **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
|
|
||||||
- **Adaptive** - Follow interesting threads, pivot when new information emerges
|
|
||||||
- **Patient** - Don't rush to conclusions, let the shape of the problem emerge
|
|
||||||
- **Grounded** - Explore the actual codebase when relevant, don't just theorize
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## What You Might Do
|
|
||||||
|
|
||||||
Depending on what the user brings, you might:
|
|
||||||
|
|
||||||
**Explore the problem space**
|
|
||||||
- Ask clarifying questions that emerge from what they said
|
|
||||||
- Challenge assumptions
|
|
||||||
- Reframe the problem
|
|
||||||
- Find analogies
|
|
||||||
|
|
||||||
**Investigate the codebase**
|
|
||||||
- Map existing architecture relevant to the discussion
|
|
||||||
- Find integration points
|
|
||||||
- Identify patterns already in use
|
|
||||||
- Surface hidden complexity
|
|
||||||
|
|
||||||
**Compare options**
|
|
||||||
- Brainstorm multiple approaches
|
|
||||||
- Build comparison tables
|
|
||||||
- Sketch tradeoffs
|
|
||||||
- Recommend a path (if asked)
|
|
||||||
|
|
||||||
**Visualize**
|
|
||||||
```
|
|
||||||
┌─────────────────────────────────────────┐
|
|
||||||
│ Use ASCII diagrams liberally │
|
|
||||||
├─────────────────────────────────────────┤
|
|
||||||
│ │
|
|
||||||
│ ┌────────┐ ┌────────┐ │
|
|
||||||
│ │ State │────────▶│ State │ │
|
|
||||||
│ │ A │ │ B │ │
|
|
||||||
│ └────────┘ └────────┘ │
|
|
||||||
│ │
|
|
||||||
│ System diagrams, state machines, │
|
|
||||||
│ data flows, architecture sketches, │
|
|
||||||
│ dependency graphs, comparison tables │
|
|
||||||
│ │
|
|
||||||
└─────────────────────────────────────────┘
|
|
||||||
```
|
|
||||||
|
|
||||||
**Surface risks and unknowns**
|
|
||||||
- Identify what could go wrong
|
|
||||||
- Find gaps in understanding
|
|
||||||
- Suggest spikes or investigations
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## OpenSpec Awareness
|
|
||||||
|
|
||||||
You have full context of the OpenSpec system. Use it naturally, don't force it.
|
|
||||||
|
|
||||||
### Check for context
|
|
||||||
|
|
||||||
At the start, quickly check what exists:
|
|
||||||
```bash
|
|
||||||
openspec list --json
|
|
||||||
```
|
|
||||||
|
|
||||||
This tells you:
|
|
||||||
- If there are active changes
|
|
||||||
- Their names, schemas, and status
|
|
||||||
- What the user might be working on
|
|
||||||
|
|
||||||
### When no change exists
|
|
||||||
|
|
||||||
Think freely. When insights crystallize, you might offer:
|
|
||||||
|
|
||||||
- "This feels solid enough to start a change. Want me to create a proposal?"
|
|
||||||
- Or keep exploring - no pressure to formalize
|
|
||||||
|
|
||||||
### When a change exists
|
|
||||||
|
|
||||||
If the user mentions a change or you detect one is relevant:
|
|
||||||
|
|
||||||
1. **Read existing artifacts for context**
|
|
||||||
- `openspec/changes/<name>/proposal.md`
|
|
||||||
- `openspec/changes/<name>/design.md`
|
|
||||||
- `openspec/changes/<name>/tasks.md`
|
|
||||||
- etc.
|
|
||||||
|
|
||||||
2. **Reference them naturally in conversation**
|
|
||||||
- "Your design mentions using Redis, but we just realized SQLite fits better..."
|
|
||||||
- "The proposal scopes this to premium users, but we're now thinking everyone..."
|
|
||||||
|
|
||||||
3. **Offer to capture when decisions are made**
|
|
||||||
|
|
||||||
| Insight Type | Where to Capture |
|
|
||||||
|--------------|------------------|
|
|
||||||
| New requirement discovered | `specs/<capability>/spec.md` |
|
|
||||||
| Requirement changed | `specs/<capability>/spec.md` |
|
|
||||||
| Design decision made | `design.md` |
|
|
||||||
| Scope changed | `proposal.md` |
|
|
||||||
| New work identified | `tasks.md` |
|
|
||||||
| Assumption invalidated | Relevant artifact |
|
|
||||||
|
|
||||||
Example offers:
|
|
||||||
- "That's a design decision. Capture it in design.md?"
|
|
||||||
- "This is a new requirement. Add it to specs?"
|
|
||||||
- "This changes scope. Update the proposal?"
|
|
||||||
|
|
||||||
4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## What You Don't Have To Do
|
|
||||||
|
|
||||||
- Follow a script
|
|
||||||
- Ask the same questions every time
|
|
||||||
- Produce a specific artifact
|
|
||||||
- Reach a conclusion
|
|
||||||
- Stay on topic if a tangent is valuable
|
|
||||||
- Be brief (this is thinking time)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Handling Different Entry Points
|
|
||||||
|
|
||||||
**User brings a vague idea:**
|
|
||||||
```
|
|
||||||
User: I'm thinking about adding real-time collaboration
|
|
||||||
|
|
||||||
You: Real-time collab is a big space. Let me think about this...
|
|
||||||
|
|
||||||
COLLABORATION SPECTRUM
|
|
||||||
════════════════════════════════════════════
|
|
||||||
|
|
||||||
Awareness Coordination Sync
|
|
||||||
│ │ │
|
|
||||||
▼ ▼ ▼
|
|
||||||
┌────────┐ ┌────────┐ ┌────────┐
|
|
||||||
│Presence│ │Cursors │ │ CRDT │
|
|
||||||
│ "3 │ │ Multi │ │Conflict│
|
|
||||||
│online" │ │ select │ │ free │
|
|
||||||
└────────┘ └────────┘ └────────┘
|
|
||||||
│ │ │
|
|
||||||
trivial moderate complex
|
|
||||||
|
|
||||||
Where's your head at?
|
|
||||||
```
|
|
||||||
|
|
||||||
**User brings a specific problem:**
|
|
||||||
```
|
|
||||||
User: The auth system is a mess
|
|
||||||
|
|
||||||
You: [reads codebase]
|
|
||||||
|
|
||||||
┌─────────────────────────────────────────────┐
|
|
||||||
│ CURRENT AUTH FLOW │
|
|
||||||
└─────────────────────────────────────────────┘
|
|
||||||
│
|
|
||||||
┌─────────────┼─────────────┐
|
|
||||||
▼ ▼ ▼
|
|
||||||
┌─────────┐ ┌─────────┐ ┌─────────┐
|
|
||||||
│ Google │ │ GitHub │ │ Email │
|
|
||||||
│ OAuth │ │ OAuth │ │ Magic │
|
|
||||||
└────┬────┘ └────┬────┘ └────┬────┘
|
|
||||||
│ │ │
|
|
||||||
└─────────────┼─────────────┘
|
|
||||||
▼
|
|
||||||
┌───────────┐
|
|
||||||
│ Session │
|
|
||||||
└─────┬─────┘
|
|
||||||
│
|
|
||||||
▼
|
|
||||||
┌───────────┐
|
|
||||||
│ Perms │
|
|
||||||
└───────────┘
|
|
||||||
|
|
||||||
I see three tangles. Which one's burning?
|
|
||||||
```
|
|
||||||
|
|
||||||
**User is stuck mid-implementation:**
|
|
||||||
```
|
|
||||||
User: /opsx-explore add-auth-system
|
|
||||||
The OAuth integration is more complex than expected
|
|
||||||
|
|
||||||
You: [reads change artifacts]
|
|
||||||
|
|
||||||
You're on task 4: "Implement OAuth flow"
|
|
||||||
|
|
||||||
Let me trace what's involved...
|
|
||||||
|
|
||||||
[draws diagram, explores options, suggests paths]
|
|
||||||
|
|
||||||
Want to update the design to reflect this?
|
|
||||||
Or add a spike task to investigate?
|
|
||||||
```
|
|
||||||
|
|
||||||
**User wants to compare options:**
|
|
||||||
```
|
|
||||||
User: Should we use Postgres or SQLite?
|
|
||||||
|
|
||||||
You: Generic answer is boring. What's the context?
|
|
||||||
|
|
||||||
User: A CLI tool that tracks local dev environments
|
|
||||||
|
|
||||||
You: That changes everything.
|
|
||||||
|
|
||||||
┌─────────────────────────────────────────────────┐
|
|
||||||
│ CLI TOOL DATA STORAGE │
|
|
||||||
└─────────────────────────────────────────────────┘
|
|
||||||
|
|
||||||
Key constraints:
|
|
||||||
• No daemon running
|
|
||||||
• Must work offline
|
|
||||||
• Single user
|
|
||||||
|
|
||||||
SQLite Postgres
|
|
||||||
Deployment embedded ✓ needs server ✗
|
|
||||||
Offline yes ✓ no ✗
|
|
||||||
Single file yes ✓ no ✗
|
|
||||||
|
|
||||||
SQLite. Not even close.
|
|
||||||
|
|
||||||
Unless... is there a sync component?
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Ending Discovery
|
|
||||||
|
|
||||||
There's no required ending. Discovery might:
|
|
||||||
|
|
||||||
- **Flow into a proposal**: "Ready to start? I can create a change proposal."
|
|
||||||
- **Result in artifact updates**: "Updated design.md with these decisions"
|
|
||||||
- **Just provide clarity**: User has what they need, moves on
|
|
||||||
- **Continue later**: "We can pick this up anytime"
|
|
||||||
|
|
||||||
When it feels like things are crystallizing, you might summarize:
|
|
||||||
|
|
||||||
```
|
|
||||||
## What We Figured Out
|
|
||||||
|
|
||||||
**The problem**: [crystallized understanding]
|
|
||||||
|
|
||||||
**The approach**: [if one emerged]
|
|
||||||
|
|
||||||
**Open questions**: [if any remain]
|
|
||||||
|
|
||||||
**Next steps** (if ready):
|
|
||||||
- Create a change proposal
|
|
||||||
- Keep exploring: just keep talking
|
|
||||||
```
|
|
||||||
|
|
||||||
But this summary is optional. Sometimes the thinking IS the value.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Guardrails
|
|
||||||
|
|
||||||
- **Don't implement** - Never write code or implement features. Creating OpenSpec artifacts is fine, writing application code is not.
|
|
||||||
- **Don't fake understanding** - If something is unclear, dig deeper
|
|
||||||
- **Don't rush** - Discovery is thinking time, not task time
|
|
||||||
- **Don't force structure** - Let patterns emerge naturally
|
|
||||||
- **Don't auto-capture** - Offer to save insights, don't just do it
|
|
||||||
- **Do visualize** - A good diagram is worth many paragraphs
|
|
||||||
- **Do explore the codebase** - Ground discussions in reality
|
|
||||||
- **Do question assumptions** - Including the user's and your own
|
|
||||||
@ -1,110 +0,0 @@
|
|||||||
---
|
|
||||||
name: openspec-propose
|
|
||||||
description: Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.
|
|
||||||
license: MIT
|
|
||||||
compatibility: Requires openspec CLI.
|
|
||||||
metadata:
|
|
||||||
author: openspec
|
|
||||||
version: "1.0"
|
|
||||||
generatedBy: "1.2.0"
|
|
||||||
---
|
|
||||||
|
|
||||||
Propose a new change - create the change and generate all artifacts in one step.
|
|
||||||
|
|
||||||
I'll create a change with artifacts:
|
|
||||||
- proposal.md (what & why)
|
|
||||||
- design.md (how)
|
|
||||||
- tasks.md (implementation steps)
|
|
||||||
|
|
||||||
When ready to implement, run /opsx-apply
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Input**: The user's request should include a change name (kebab-case) OR a description of what they want to build.
|
|
||||||
|
|
||||||
**Steps**
|
|
||||||
|
|
||||||
1. **If no clear input provided, ask what they want to build**
|
|
||||||
|
|
||||||
Use the **AskUserQuestion tool** (open-ended, no preset options) to ask:
|
|
||||||
> "What change do you want to work on? Describe what you want to build or fix."
|
|
||||||
|
|
||||||
From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`).
|
|
||||||
|
|
||||||
**IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
|
|
||||||
|
|
||||||
2. **Create the change directory**
|
|
||||||
```bash
|
|
||||||
openspec new change "<name>"
|
|
||||||
```
|
|
||||||
This creates a scaffolded change at `openspec/changes/<name>/` with `.openspec.yaml`.
|
|
||||||
|
|
||||||
3. **Get the artifact build order**
|
|
||||||
```bash
|
|
||||||
openspec status --change "<name>" --json
|
|
||||||
```
|
|
||||||
Parse the JSON to get:
|
|
||||||
- `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
|
|
||||||
- `artifacts`: list of all artifacts with their status and dependencies
|
|
||||||
|
|
||||||
4. **Create artifacts in sequence until apply-ready**
|
|
||||||
|
|
||||||
Use the **TodoWrite tool** to track progress through the artifacts.
|
|
||||||
|
|
||||||
Loop through artifacts in dependency order (artifacts with no pending dependencies first):
|
|
||||||
|
|
||||||
a. **For each artifact that is `ready` (dependencies satisfied)**:
|
|
||||||
- Get instructions:
|
|
||||||
```bash
|
|
||||||
openspec instructions <artifact-id> --change "<name>" --json
|
|
||||||
```
|
|
||||||
- The instructions JSON includes:
|
|
||||||
- `context`: Project background (constraints for you - do NOT include in output)
|
|
||||||
- `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
|
|
||||||
- `template`: The structure to use for your output file
|
|
||||||
- `instruction`: Schema-specific guidance for this artifact type
|
|
||||||
- `outputPath`: Where to write the artifact
|
|
||||||
- `dependencies`: Completed artifacts to read for context
|
|
||||||
- Read any completed dependency files for context
|
|
||||||
- Create the artifact file using `template` as the structure
|
|
||||||
- Apply `context` and `rules` as constraints - but do NOT copy them into the file
|
|
||||||
- Show brief progress: "Created <artifact-id>"
|
|
||||||
|
|
||||||
b. **Continue until all `applyRequires` artifacts are complete**
|
|
||||||
- After creating each artifact, re-run `openspec status --change "<name>" --json`
|
|
||||||
- Check if every artifact ID in `applyRequires` has `status: "done"` in the artifacts array
|
|
||||||
- Stop when all `applyRequires` artifacts are done
|
|
||||||
|
|
||||||
c. **If an artifact requires user input** (unclear context):
|
|
||||||
- Use **AskUserQuestion tool** to clarify
|
|
||||||
- Then continue with creation
|
|
||||||
|
|
||||||
5. **Show final status**
|
|
||||||
```bash
|
|
||||||
openspec status --change "<name>"
|
|
||||||
```
|
|
||||||
|
|
||||||
**Output**
|
|
||||||
|
|
||||||
After completing all artifacts, summarize:
|
|
||||||
- Change name and location
|
|
||||||
- List of artifacts created with brief descriptions
|
|
||||||
- What's ready: "All artifacts created! Ready for implementation."
|
|
||||||
- Prompt: "Run `/opsx-apply` or ask me to implement to start working on the tasks."
|
|
||||||
|
|
||||||
**Artifact Creation Guidelines**
|
|
||||||
|
|
||||||
- Follow the `instruction` field from `openspec instructions` for each artifact type
|
|
||||||
- The schema defines what each artifact should contain - follow it
|
|
||||||
- Read dependency artifacts for context before creating new ones
|
|
||||||
- Use `template` as the structure for your output file - fill in its sections
|
|
||||||
- **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
|
|
||||||
- Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
|
|
||||||
- These guide what you write, but should never appear in the output
|
|
||||||
|
|
||||||
**Guardrails**
|
|
||||||
- Create ALL artifacts needed for implementation (as defined by schema's `apply.requires`)
|
|
||||||
- Always read dependency artifacts before creating a new one
|
|
||||||
- If context is critically unclear, ask the user - but prefer making reasonable decisions to keep momentum
|
|
||||||
- If a change with that name already exists, ask if user wants to continue it or create a new one
|
|
||||||
- Verify each artifact file exists after writing before proceeding to next
|
|
||||||
189
.serena/memories/code_style_conventions.md
Normal file
189
.serena/memories/code_style_conventions.md
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
# CLQMS Frontend - Code Style & Conventions
|
||||||
|
|
||||||
|
## File Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
src/
|
||||||
|
lib/
|
||||||
|
api/ # API client and endpoints (per feature)
|
||||||
|
stores/ # Svelte stores (auth, config, valuesets)
|
||||||
|
components/ # Reusable components (DataTable, Modal, Sidebar)
|
||||||
|
utils/ # Utility functions (toast, helpers)
|
||||||
|
assets/ # Static assets (favicon, etc.)
|
||||||
|
routes/ # SvelteKit routes
|
||||||
|
(app)/ # Protected routes (authenticated users)
|
||||||
|
dashboard/
|
||||||
|
patients/
|
||||||
|
master-data/
|
||||||
|
login/ # Public routes
|
||||||
|
```
|
||||||
|
|
||||||
|
## Svelte Component Conventions
|
||||||
|
|
||||||
|
### Component Structure Order
|
||||||
|
1. Imports (Svelte, $app, $lib, external)
|
||||||
|
2. Props with `$bindable` for two-way binding
|
||||||
|
3. State (`$state`)
|
||||||
|
4. Derived state (`$derived`)
|
||||||
|
5. Effects (`$effect`)
|
||||||
|
6. Functions (prefix handlers with `handle`)
|
||||||
|
|
||||||
|
### Props and State
|
||||||
|
```svelte
|
||||||
|
let { open = $bindable(false), title = '', children, footer } = $props();
|
||||||
|
let loading = $state(false);
|
||||||
|
let error = $state('');
|
||||||
|
```
|
||||||
|
|
||||||
|
### Imports Order
|
||||||
|
1. Svelte imports (`svelte`, `$app/*`)
|
||||||
|
2. $lib aliases (`$lib/stores/*`, `$lib/api/*`, `$lib/components/*`, `$lib/utils/*`)
|
||||||
|
3. External libraries (`lucide-svelte`)
|
||||||
|
4. Relative imports (minimize, prefer `$lib`)
|
||||||
|
|
||||||
|
## Naming Conventions
|
||||||
|
|
||||||
|
- **Components**: PascalCase (`LoginForm.svelte`, `PatientFormModal.svelte`)
|
||||||
|
- **Files/Routes**: lowercase with hyphens (`+page.svelte`, `user-profile/`)
|
||||||
|
- **Variables**: camelCase (`isLoading`, `userName`)
|
||||||
|
- **Constants**: UPPER_SNAKE_CASE (`API_URL`, `STORAGE_KEY`)
|
||||||
|
- **Stores**: camelCase, descriptive (`auth`, `userStore`)
|
||||||
|
- **Event handlers**: prefix with `handle` (`handleSubmit`, `handleClick`)
|
||||||
|
- **Form state**: `formLoading`, `formError`, `deleteConfirmOpen`
|
||||||
|
|
||||||
|
## Code Style
|
||||||
|
|
||||||
|
- **ES Modules**: Always use `import`/`export`
|
||||||
|
- **Semicolons**: Use consistently
|
||||||
|
- **Quotes**: Use single quotes for strings
|
||||||
|
- **Indentation**: 2 spaces
|
||||||
|
- **Trailing commas**: Use in multi-line objects/arrays
|
||||||
|
- **JSDoc**: Document all exported functions with JSDoc comments
|
||||||
|
|
||||||
|
## Component Patterns
|
||||||
|
|
||||||
|
### Modal Pattern
|
||||||
|
```svelte
|
||||||
|
<dialog class="modal" class:modal-open={open}>
|
||||||
|
<div class="modal-box">
|
||||||
|
<button onclick={close}>X</button>
|
||||||
|
{@render children?.()}
|
||||||
|
</div>
|
||||||
|
<form method="dialog" class="modal-backdrop" onclick={handleBackdropClick}>
|
||||||
|
<button>close</button>
|
||||||
|
</form>
|
||||||
|
</dialog>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Form State with Validation
|
||||||
|
```javascript
|
||||||
|
let formLoading = $state(false);
|
||||||
|
let formError = $state('');
|
||||||
|
let formData = $state({ username: '', password: '' });
|
||||||
|
|
||||||
|
function validateForm() {
|
||||||
|
formError = '';
|
||||||
|
if (!formData.username.trim()) {
|
||||||
|
formError = 'Username is required';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleSubmit() {
|
||||||
|
if (!validateForm()) return;
|
||||||
|
formLoading = true;
|
||||||
|
try {
|
||||||
|
await api.submit(formData);
|
||||||
|
toastSuccess('Success');
|
||||||
|
} catch (err) {
|
||||||
|
formError = err.message;
|
||||||
|
} finally {
|
||||||
|
formLoading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## API Client Patterns
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// src/lib/api/client.js - Base client
|
||||||
|
import { apiClient, get, post, put, patch, del } from '$lib/api/client.js';
|
||||||
|
|
||||||
|
// src/lib/api/feature.js - Feature-specific endpoints with JSDoc
|
||||||
|
export async function fetchItems(params = {}) {
|
||||||
|
const query = new URLSearchParams(params).toString();
|
||||||
|
return get(query ? `/api/items?${query}` : '/api/items');
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function createItem(data) {
|
||||||
|
return post('/api/items', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function updateItem(data) {
|
||||||
|
return patch('/api/items', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function deleteItem(id) {
|
||||||
|
return del(`/api/items/${id}`);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Store Patterns
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Use writable for stores with localStorage persistence
|
||||||
|
import { writable } from 'svelte/store';
|
||||||
|
import { browser } from '$app/environment';
|
||||||
|
|
||||||
|
function createStore() {
|
||||||
|
const getInitialState = () => {
|
||||||
|
if (!browser) return { data: null };
|
||||||
|
return { data: JSON.parse(localStorage.getItem('key')) };
|
||||||
|
};
|
||||||
|
|
||||||
|
const { subscribe, set, update } = writable(getInitialState());
|
||||||
|
|
||||||
|
return {
|
||||||
|
subscribe,
|
||||||
|
setData: (data) => {
|
||||||
|
if (browser) localStorage.setItem('key', JSON.stringify(data));
|
||||||
|
set({ data });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Error Handling
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
try {
|
||||||
|
const result = await api.fetchData();
|
||||||
|
toastSuccess('Operation successful');
|
||||||
|
} catch (err) {
|
||||||
|
const message = err.message || 'An unexpected error occurred';
|
||||||
|
toastError(message);
|
||||||
|
console.error('Operation failed:', err);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Styling with Tailwind & DaisyUI
|
||||||
|
|
||||||
|
- DaisyUI components: `btn`, `card`, `alert`, `input`, `navbar`, `modal`, `dropdown`, `menu`
|
||||||
|
- Color scheme: `primary` (emerald), `secondary` (dark blue), `accent` (royal blue)
|
||||||
|
- Custom compact classes: `.compact-y`, `.compact-p`, `.compact-input`, `.compact-btn`, `.compact-card`
|
||||||
|
- Size modifiers: `.btn-sm`, `.input-sm`, `.select-sm` for compact forms
|
||||||
|
|
||||||
|
## LocalStorage
|
||||||
|
|
||||||
|
- Only access in browser: check `browser` from `$app/environment`
|
||||||
|
- Use descriptive keys: `clqms_username`, `clqms_remember`, `auth_token`
|
||||||
|
|
||||||
|
## Runtime Config Pattern
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { config } from '$lib/stores/config.js';
|
||||||
|
function getApiUrl() {
|
||||||
|
return config.getApiUrl() || import.meta.env.VITE_API_URL || '';
|
||||||
|
}
|
||||||
|
```
|
||||||
294
.serena/memories/plans/mvp-roadmap.md
Normal file
294
.serena/memories/plans/mvp-roadmap.md
Normal file
@ -0,0 +1,294 @@
|
|||||||
|
# CLQMS MVP Roadmap
|
||||||
|
|
||||||
|
## Executive Summary
|
||||||
|
|
||||||
|
**CLQMS (Clinical Laboratory Quality Management System)** - A comprehensive laboratory information system for clinical diagnostics.
|
||||||
|
|
||||||
|
### Current State
|
||||||
|
- ✅ Authentication & authorization
|
||||||
|
- ✅ Patient management (CRUD)
|
||||||
|
- ✅ Visit management with ADT tracking
|
||||||
|
- ✅ Order entry (create orders with specimens and tests)
|
||||||
|
- ✅ Master data management (contacts, locations, containers, organization, tests)
|
||||||
|
- ⚠️ Dashboard (static mock data)
|
||||||
|
- ❌ **Results management** (CRITICAL GAP)
|
||||||
|
- ❌ **Report viewing** (CRITICAL GAP)
|
||||||
|
|
||||||
|
### MVP Goal
|
||||||
|
Enable end-to-end laboratory workflow: Patient → Visit → Order → Results → Report
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 1: Core Laboratory Workflow (CRITICAL - Weeks 1-3)
|
||||||
|
|
||||||
|
### 1.1 Results Management System
|
||||||
|
**Priority: CRITICAL** - Without results, this is not a laboratory system
|
||||||
|
|
||||||
|
#### API Endpoints Available:
|
||||||
|
- `GET /api/results` - List results (with filters by order_id, patient_id)
|
||||||
|
- `GET /api/results/{id}` - Get single result detail
|
||||||
|
- `PATCH /api/results/{id}` - Update result with auto-validation
|
||||||
|
- `DELETE /api/results/{id}` - Soft delete result
|
||||||
|
|
||||||
|
#### Features:
|
||||||
|
1. **Results Entry Page**
|
||||||
|
- View results by order or patient
|
||||||
|
- Batch entry mode for efficient data input
|
||||||
|
- Auto-validation against reference ranges (L/H flags)
|
||||||
|
- Support for different result types: NMRIC, RANGE, TEXT, VSET
|
||||||
|
|
||||||
|
2. **Results Review & Verification**
|
||||||
|
- List results pending verification
|
||||||
|
- Bulk verify results
|
||||||
|
- Critical/high-low flag highlighting
|
||||||
|
|
||||||
|
3. **Results History**
|
||||||
|
- Cumulative patient results view
|
||||||
|
- Trend charts for numeric results
|
||||||
|
- Delta checking (compare with previous results)
|
||||||
|
|
||||||
|
#### UI Components Needed:
|
||||||
|
- ResultsEntryPage.svelte
|
||||||
|
- ResultInputModal.svelte (handles different result types)
|
||||||
|
- ResultsByOrderView.svelte
|
||||||
|
- ResultsByPatientView.svelte
|
||||||
|
- CriticalResultsAlert.svelte
|
||||||
|
|
||||||
|
#### API Client:
|
||||||
|
- `src/lib/api/results.js` (NEW)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 1.2 Report Generation & Viewing
|
||||||
|
**Priority: CRITICAL** - Final output of laboratory work
|
||||||
|
|
||||||
|
#### API Endpoints Available:
|
||||||
|
- `GET /api/reports/{orderID}` - Generate HTML lab report
|
||||||
|
|
||||||
|
#### Features:
|
||||||
|
1. **Report Viewer**
|
||||||
|
- View HTML reports in browser
|
||||||
|
- Print-friendly layout
|
||||||
|
- PDF export capability (browser print to PDF)
|
||||||
|
|
||||||
|
2. **Report Status Tracking**
|
||||||
|
- Track order status: ORD → SCH → ANA → VER → REV → REP
|
||||||
|
- Visual status indicators
|
||||||
|
|
||||||
|
#### UI Components Needed:
|
||||||
|
- ReportViewerModal.svelte
|
||||||
|
- ReportPrintView.svelte
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 1.3 Live Dashboard
|
||||||
|
**Priority: HIGH** - Replace static data with real metrics
|
||||||
|
|
||||||
|
#### Features:
|
||||||
|
1. **Real-time Metrics**
|
||||||
|
- Pending orders count (from orders API)
|
||||||
|
- Today's results count (from results API)
|
||||||
|
- Critical results count (filter results by flag)
|
||||||
|
- Active patients count (from patients API)
|
||||||
|
|
||||||
|
2. **Activity Feed**
|
||||||
|
- Recent orders created
|
||||||
|
- Recent results received
|
||||||
|
- Recent patients registered
|
||||||
|
|
||||||
|
#### Implementation:
|
||||||
|
- Update `src/routes/(app)/dashboard/+page.svelte`
|
||||||
|
- Add dashboard API endpoint if needed
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 2: Order Management Enhancement (Weeks 4-5)
|
||||||
|
|
||||||
|
### 2.1 Order Workflow Management
|
||||||
|
**Priority: HIGH**
|
||||||
|
|
||||||
|
#### Features:
|
||||||
|
1. **Order Status Tracking**
|
||||||
|
- Visual pipeline: Ordered → Scheduled → Analysis → Verified → Reviewed → Reported
|
||||||
|
- Bulk status updates
|
||||||
|
|
||||||
|
2. **Order Details Enhancement**
|
||||||
|
- View specimens associated with order
|
||||||
|
- View test results within order
|
||||||
|
- Direct link to results entry from order
|
||||||
|
|
||||||
|
#### API Endpoints:
|
||||||
|
- `POST /api/ordertest/status` - Update order status (already available)
|
||||||
|
- `GET /api/ordertest/{id}?include=details` - Get order with specimens/tests
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2.2 Specimen Tracking
|
||||||
|
**Priority: MEDIUM**
|
||||||
|
|
||||||
|
#### Features:
|
||||||
|
1. **Specimen Management**
|
||||||
|
- View specimens by order
|
||||||
|
- Update specimen status (collected, received, processed)
|
||||||
|
- Print specimen labels
|
||||||
|
|
||||||
|
#### API Endpoints Available:
|
||||||
|
- `GET /api/specimen` - List specimens
|
||||||
|
- `GET /api/specimen/{id}` - Get specimen details
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 3: Master Data & Configuration (Week 6)
|
||||||
|
|
||||||
|
### 3.1 Test Management Enhancement
|
||||||
|
**Priority: MEDIUM**
|
||||||
|
|
||||||
|
#### Features:
|
||||||
|
1. **Test Catalog Browser**
|
||||||
|
- Improved search and filtering
|
||||||
|
- View test details with reference ranges
|
||||||
|
- Test-to-container mappings
|
||||||
|
|
||||||
|
#### Already Implemented:
|
||||||
|
- Tests CRUD in master-data/tests
|
||||||
|
- Test mappings in master-data/testmap
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3.2 Reference Range Management
|
||||||
|
**Priority: LOW**
|
||||||
|
|
||||||
|
#### Features:
|
||||||
|
1. **Reference Range Setup**
|
||||||
|
- Manage numeric reference ranges (refnum)
|
||||||
|
- Manage text reference values (reftxt)
|
||||||
|
- Age and sex-specific ranges
|
||||||
|
|
||||||
|
#### API Note:
|
||||||
|
Reference ranges are managed through test definition endpoints
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 4: Quality & Compliance Features (Weeks 7-8)
|
||||||
|
|
||||||
|
### 4.1 Critical Results Management
|
||||||
|
**Priority: MEDIUM**
|
||||||
|
|
||||||
|
#### Features:
|
||||||
|
1. **Critical Results Alerting**
|
||||||
|
- Real-time critical result notifications
|
||||||
|
- Acknowledgment tracking
|
||||||
|
- Escalation workflow
|
||||||
|
|
||||||
|
#### API Endpoints:
|
||||||
|
- Use results API with flag filtering
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 4.2 Audit Trail
|
||||||
|
**Priority: LOW**
|
||||||
|
|
||||||
|
#### Features:
|
||||||
|
1. **Activity Logging**
|
||||||
|
- Track who modified results
|
||||||
|
- Track order status changes
|
||||||
|
- Patient data access logs
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Implementation Priority Matrix
|
||||||
|
|
||||||
|
| Feature | Priority | Effort | Impact | Phase |
|
||||||
|
|---------|----------|--------|--------|-------|
|
||||||
|
| Results Entry | CRITICAL | High | Critical | Phase 1 |
|
||||||
|
| Results Verification | CRITICAL | Medium | Critical | Phase 1 |
|
||||||
|
| Report Viewing | CRITICAL | Low | Critical | Phase 1 |
|
||||||
|
| Live Dashboard | HIGH | Medium | High | Phase 1 |
|
||||||
|
| Order Workflow | HIGH | Medium | High | Phase 2 |
|
||||||
|
| Specimen Tracking | MEDIUM | Medium | Medium | Phase 2 |
|
||||||
|
| Critical Results | MEDIUM | Medium | Medium | Phase 4 |
|
||||||
|
| Reference Ranges | LOW | Medium | Low | Phase 3 |
|
||||||
|
| Audit Trail | LOW | High | Low | Phase 4 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Technical Implementation Notes
|
||||||
|
|
||||||
|
### API Client Pattern
|
||||||
|
Following existing patterns in `src/lib/api/`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// src/lib/api/results.js
|
||||||
|
import { get, patch, del } from './client.js';
|
||||||
|
|
||||||
|
export async function fetchResults(params = {}) {
|
||||||
|
const query = new URLSearchParams(params).toString();
|
||||||
|
return get(query ? `/api/results?${query}` : '/api/results');
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchResultById(id) {
|
||||||
|
return get(`/api/results/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function updateResult(id, data) {
|
||||||
|
return patch(`/api/results/${id}`, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function deleteResult(id) {
|
||||||
|
return del(`/api/results/${id}`);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Route Structure
|
||||||
|
```
|
||||||
|
src/routes/(app)/
|
||||||
|
├── dashboard/ # Update with live data
|
||||||
|
├── patients/ # ✅ Exists
|
||||||
|
├── visits/ # ✅ Exists
|
||||||
|
├── orders/ # ✅ Exists (enhance)
|
||||||
|
├── results/ # NEW - Results management
|
||||||
|
│ ├── +page.svelte
|
||||||
|
│ ├── entry/
|
||||||
|
│ │ └── +page.svelte
|
||||||
|
│ └── verification/
|
||||||
|
│ └── +page.svelte
|
||||||
|
└── reports/ # NEW - Report viewing
|
||||||
|
└── +page.svelte
|
||||||
|
```
|
||||||
|
|
||||||
|
### Database Schema Relationships
|
||||||
|
```
|
||||||
|
Patient (1) → (N) Visits
|
||||||
|
Patient (1) → (N) Orders
|
||||||
|
Visit (1) → (N) Orders
|
||||||
|
Visit (1) → (N) ADT Records
|
||||||
|
Order (1) → (N) Specimens
|
||||||
|
Order (1) → (N) Results
|
||||||
|
Order (1) → (N) PatRes (test records)
|
||||||
|
Specimen (1) → (N) Results
|
||||||
|
Test Definition (1) → (N) Results
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Success Criteria for MVP
|
||||||
|
|
||||||
|
1. **End-to-end workflow works**: Can register patient → create visit → create order → enter results → view report
|
||||||
|
2. **Results validation**: System correctly flags high/low results based on reference ranges
|
||||||
|
3. **Order tracking**: Can track order status through the pipeline
|
||||||
|
4. **Dashboard**: Shows real metrics, not static data
|
||||||
|
5. **Reports**: Can generate and view HTML reports for orders
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Future Enhancements (Post-MVP)
|
||||||
|
|
||||||
|
1. **Instrument Integration** - Edge API for automated result import
|
||||||
|
2. **Barcoding/Labeling** - Specimen label printing
|
||||||
|
3. **QC Management** - Quality control charts and rules
|
||||||
|
4. **Billing Integration** - Connect to billing system
|
||||||
|
5. **External Lab Interface** - Send orders to reference labs
|
||||||
|
6. **Mobile App** - Phlebotomy collection app
|
||||||
|
7. **Patient Portal** - Patients can view their results
|
||||||
|
8. **Analytics** - Advanced reporting and statistics
|
||||||
|
|
||||||
52
.serena/memories/plans/testmap-dropdown-change.md
Normal file
52
.serena/memories/plans/testmap-dropdown-change.md
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# Plan: Change ID Text Inputs to Dropdowns
|
||||||
|
|
||||||
|
## Current State
|
||||||
|
In `src\routes\(app)\master-data\testmap\+page.svelte`, the filter section has:
|
||||||
|
- Host ID filter (lines 239-244): text input
|
||||||
|
- Client ID filter (lines 260-265): text input
|
||||||
|
|
||||||
|
## Changes Required
|
||||||
|
|
||||||
|
### 1. Add Derived State for Dropdown Options
|
||||||
|
Add after line 41 (after filter states):
|
||||||
|
```javascript
|
||||||
|
// Derived unique values for dropdowns
|
||||||
|
let uniqueHostIDs = $derived([...new Set(testMaps.map(m => m.HostID).filter(Boolean))].sort());
|
||||||
|
let uniqueClientIDs = $derived([...new Set(testMaps.map(m => m.ClientID).filter(Boolean))].sort());
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Replace Host ID Input with Dropdown
|
||||||
|
Replace lines 239-244 with:
|
||||||
|
```svelte
|
||||||
|
<select
|
||||||
|
class="select select-sm select-bordered w-full"
|
||||||
|
bind:value={filterHostID}
|
||||||
|
>
|
||||||
|
<option value="">All IDs</option>
|
||||||
|
{#each uniqueHostIDs as id}
|
||||||
|
<option value={id}>{id}</option>
|
||||||
|
{/each}
|
||||||
|
</select>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Replace Client ID Input with Dropdown
|
||||||
|
Replace lines 260-265 with:
|
||||||
|
```svelte
|
||||||
|
<select
|
||||||
|
class="select select-sm select-bordered w-full"
|
||||||
|
bind:value={filterClientID}
|
||||||
|
>
|
||||||
|
<option value="">All IDs</option>
|
||||||
|
{#each uniqueClientIDs as id}
|
||||||
|
<option value={id}>{id}</option>
|
||||||
|
{/each}
|
||||||
|
</select>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Benefits
|
||||||
|
- Users can select from existing IDs rather than typing
|
||||||
|
- Prevents typos in filter values
|
||||||
|
- Shows all available options at a glance
|
||||||
|
- Maintains exact matching instead of substring matching for IDs
|
||||||
|
|
||||||
|
Ready to implement?
|
||||||
89
.serena/memories/task_completion_checklist.md
Normal file
89
.serena/memories/task_completion_checklist.md
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
# CLQMS Frontend - Post-Task Checklist
|
||||||
|
|
||||||
|
## When a Task is Completed
|
||||||
|
|
||||||
|
### Verification Steps
|
||||||
|
|
||||||
|
1. **Build Check** (if changes are significant)
|
||||||
|
- Run `pnpm run build` to ensure the application builds successfully
|
||||||
|
- Check for build errors or warnings
|
||||||
|
|
||||||
|
2. **Manual Testing**
|
||||||
|
- Start dev server: `pnpm run dev`
|
||||||
|
- Test the feature/fix in the browser
|
||||||
|
- Verify no console errors
|
||||||
|
- Check that existing functionality is not broken
|
||||||
|
|
||||||
|
3. **Code Review Checklist**
|
||||||
|
- Follow code style conventions (see `code_style_conventions.md`)
|
||||||
|
- Imports are in correct order
|
||||||
|
- Components use Svelte 5 runes (`$props`, `$state`, `$derived`, `$effect`, `$bindable`)
|
||||||
|
- Event handlers prefixed with `handle`
|
||||||
|
- JSDoc comments on exported functions
|
||||||
|
- Proper error handling with try-catch
|
||||||
|
- Toast notifications for user feedback
|
||||||
|
|
||||||
|
### Code Style Verification
|
||||||
|
|
||||||
|
- ✅ Single quotes for strings
|
||||||
|
- ✅ Semicolons used consistently
|
||||||
|
- ✅ 2-space indentation
|
||||||
|
- ✅ Trailing commas in multi-line objects/arrays
|
||||||
|
- ✅ PascalCase for components
|
||||||
|
- ✅ camelCase for variables and functions
|
||||||
|
- ✅ Descriptive naming
|
||||||
|
|
||||||
|
### Svelte 5 Runes Verification
|
||||||
|
|
||||||
|
- ✅ Using `$props()` for component props
|
||||||
|
- ✅ Using `$state()` for reactive state
|
||||||
|
- ✅ Using `$derived()` for computed values
|
||||||
|
- ✅ Using `$effect()` for side effects
|
||||||
|
- ✅ Using `$bindable()` for two-way binding props
|
||||||
|
- ✅ Using `{@render snippet()}` for slots/content
|
||||||
|
|
||||||
|
### API Integration Verification
|
||||||
|
|
||||||
|
- ✅ Proper error handling with try-catch
|
||||||
|
- ✅ Toast notifications for success/error
|
||||||
|
- ✅ Loading states during async operations
|
||||||
|
- ✅ Form validation before submission
|
||||||
|
- ✅ API calls follow established patterns (get, post, put, patch, del from client.js)
|
||||||
|
|
||||||
|
### Accessibility Verification
|
||||||
|
|
||||||
|
- ✅ Semantic HTML elements
|
||||||
|
- ✅ ARIA labels where needed
|
||||||
|
- ✅ Keyboard navigation support
|
||||||
|
- ✅ Proper form labels and focus management
|
||||||
|
|
||||||
|
### Performance Considerations
|
||||||
|
|
||||||
|
- ✅ No unnecessary re-renders
|
||||||
|
- ✅ Proper use of `$derived` for computed values
|
||||||
|
- ✅ Efficient event handling (avoid inline functions in templates when possible)
|
||||||
|
|
||||||
|
### Browser Compatibility
|
||||||
|
|
||||||
|
- ✅ Check browser console for errors
|
||||||
|
- ✅ Test in Chrome/Firefox/Edge if possible
|
||||||
|
- ✅ Verify responsive design on different screen sizes
|
||||||
|
|
||||||
|
## NO Auto-Commit Policy
|
||||||
|
|
||||||
|
**IMPORTANT**: Do NOT commit changes automatically. Only commit when explicitly requested by the user.
|
||||||
|
|
||||||
|
If user asks to commit:
|
||||||
|
1. Run `git status` to see all untracked files
|
||||||
|
2. Run `git diff` to see changes
|
||||||
|
3. Run `git log` to see commit message style
|
||||||
|
4. Stage relevant files
|
||||||
|
5. Create commit with descriptive message
|
||||||
|
6. Run `git status` to verify
|
||||||
|
|
||||||
|
## Before Marking Task as Complete
|
||||||
|
|
||||||
|
- Ensure all verification steps are completed
|
||||||
|
- Confirm the application runs without errors
|
||||||
|
- If applicable, verify the feature works as expected
|
||||||
|
- Only confirm completion if you have tested the changes
|
||||||
17
AGENTS.md
17
AGENTS.md
@ -76,6 +76,23 @@ pnpm install # Install dependencies (use pnpm, not npm/yarn)
|
|||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## TypeScript Types
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// src/lib/types/ - Type definitions
|
||||||
|
export type TestType = 'TEST' | 'PARAM' | 'CALC' | 'GROUP' | 'TITLE';
|
||||||
|
|
||||||
|
export interface TestSummary {
|
||||||
|
TestSiteID: number;
|
||||||
|
TestSiteCode: string;
|
||||||
|
TestSiteName: string;
|
||||||
|
TestType: TestType;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use JSDoc for type imports in JS files
|
||||||
|
/** @typedef {import('$lib/types/test.types.js').TestSummary} TestSummary */
|
||||||
|
```
|
||||||
|
|
||||||
## API Patterns
|
## API Patterns
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
|||||||
10
TODO.md
10
TODO.md
@ -1,6 +1,14 @@
|
|||||||
# its MVP so Keep It Simple STUPID
|
# its MVP so Keep It Simple STUPID
|
||||||
|
|
||||||
### done
|
## todos
|
||||||
|
- test single
|
||||||
|
- test group
|
||||||
|
- test calc
|
||||||
|
- test param
|
||||||
|
### backend
|
||||||
|
- testgroup detail is wrong
|
||||||
|
|
||||||
|
## done
|
||||||
- patient page -> add edit patient button on patient list
|
- patient page -> add edit patient button on patient list
|
||||||
- patient page -> add view order modal
|
- patient page -> add view order modal
|
||||||
- visit page -> on visit modal, show visitid when create
|
- visit page -> on visit modal, show visitid when create
|
||||||
|
|||||||
@ -97,7 +97,10 @@ function buildPayload(formData, isUpdate = false) {
|
|||||||
// Add members for GROUP type
|
// Add members for GROUP type
|
||||||
if (type === 'GROUP' && formData.details?.members) {
|
if (type === 'GROUP' && formData.details?.members) {
|
||||||
payload.details = {
|
payload.details = {
|
||||||
members: formData.details.members
|
members: formData.details.members.map(m => ({
|
||||||
|
TestSiteID: m.TestSiteID,
|
||||||
|
Member: m.Member
|
||||||
|
}))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -187,7 +187,10 @@
|
|||||||
ExpectedTAT: test.ExpectedTAT || null,
|
ExpectedTAT: test.ExpectedTAT || null,
|
||||||
FormulaInput: test.FormulaInput || '',
|
FormulaInput: test.FormulaInput || '',
|
||||||
FormulaCode: test.FormulaCode || '',
|
FormulaCode: test.FormulaCode || '',
|
||||||
members: test.testdefgrp?.map(m => m.TestSiteID) || []
|
members: test.testdefgrp?.map(m => ({
|
||||||
|
TestSiteID: parseInt(m.TestSiteID),
|
||||||
|
Member: parseInt(m.Member)
|
||||||
|
})) || []
|
||||||
},
|
},
|
||||||
refnum: test.refnum || [],
|
refnum: test.refnum || [],
|
||||||
reftxt: test.reftxt || [],
|
reftxt: test.reftxt || [],
|
||||||
|
|||||||
@ -8,14 +8,20 @@
|
|||||||
let addMemberOpen = $state(false);
|
let addMemberOpen = $state(false);
|
||||||
|
|
||||||
const members = $derived.by(() => {
|
const members = $derived.by(() => {
|
||||||
return tests.filter(t => formData.details.members?.includes(t.TestSiteID))
|
const memberIds = formData.details.members?.map(m => Number(m.TestSiteID)) || [];
|
||||||
.map(t => ({ ...t, seq: formData.details.members.indexOf(t.TestSiteID) }));
|
return tests.filter(t => memberIds.includes(Number(t.TestSiteID)))
|
||||||
|
.map(t => {
|
||||||
|
const memberObj = formData.details.members?.find(m => Number(m.TestSiteID) === Number(t.TestSiteID));
|
||||||
|
return { ...t, seq: memberObj?.Member || 0 };
|
||||||
|
})
|
||||||
|
.sort((a, b) => a.seq - b.seq);
|
||||||
});
|
});
|
||||||
|
|
||||||
const availableOptions = $derived.by(() => {
|
const availableOptions = $derived.by(() => {
|
||||||
|
const memberIds = formData.details.members?.map(m => Number(m.TestSiteID)) || [];
|
||||||
return tests.filter(t =>
|
return tests.filter(t =>
|
||||||
t.TestSiteID !== formData.TestSiteID &&
|
Number(t.TestSiteID) !== Number(formData.TestSiteID) &&
|
||||||
!formData.details.members?.includes(t.TestSiteID) &&
|
!memberIds.includes(Number(t.TestSiteID)) &&
|
||||||
t.IsActive !== '0' &&
|
t.IsActive !== '0' &&
|
||||||
t.IsActive !== 0
|
t.IsActive !== 0
|
||||||
).map(t => ({
|
).map(t => ({
|
||||||
@ -32,15 +38,23 @@
|
|||||||
function addMember() {
|
function addMember() {
|
||||||
if (!selectedTestId) return;
|
if (!selectedTestId) return;
|
||||||
|
|
||||||
const newMembers = [...(formData.details.members || []), parseInt(selectedTestId)];
|
const currentMembers = formData.details.members || [];
|
||||||
formData.details.members = newMembers;
|
const newMember = {
|
||||||
|
TestSiteID: parseInt(selectedTestId),
|
||||||
|
Member: currentMembers.length + 1
|
||||||
|
};
|
||||||
|
formData.details.members = [...currentMembers, newMember];
|
||||||
selectedTestId = '';
|
selectedTestId = '';
|
||||||
handleFieldChange();
|
handleFieldChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeMember(testId) {
|
function removeMember(testId) {
|
||||||
const newMembers = formData.details.members?.filter(id => id !== testId) || [];
|
const remainingMembers = formData.details.members?.filter(m => Number(m.TestSiteID) !== Number(testId)) || [];
|
||||||
formData.details.members = newMembers;
|
// Re-sequence the remaining members
|
||||||
|
formData.details.members = remainingMembers.map((m, idx) => ({
|
||||||
|
...m,
|
||||||
|
Member: idx + 1
|
||||||
|
}));
|
||||||
handleFieldChange();
|
handleFieldChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,8 +63,13 @@
|
|||||||
const newIndex = index + direction;
|
const newIndex = index + direction;
|
||||||
|
|
||||||
if (newIndex >= 0 && newIndex < members.length) {
|
if (newIndex >= 0 && newIndex < members.length) {
|
||||||
|
// Swap the members
|
||||||
[members[index], members[newIndex]] = [members[newIndex], members[index]];
|
[members[index], members[newIndex]] = [members[newIndex], members[index]];
|
||||||
formData.details.members = members;
|
// Update sequence numbers
|
||||||
|
formData.details.members = members.map((m, idx) => ({
|
||||||
|
...m,
|
||||||
|
Member: idx + 1
|
||||||
|
}));
|
||||||
handleFieldChange();
|
handleFieldChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user