quantix-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of quantix-mcp might be problematic. Click here for more details.
- package/.github/agents/copilot-instructions.md +32 -0
- package/.github/agents/speckit.analyze.agent.md +184 -0
- package/.github/agents/speckit.checklist.agent.md +294 -0
- package/.github/agents/speckit.clarify.agent.md +181 -0
- package/.github/agents/speckit.constitution.agent.md +82 -0
- package/.github/agents/speckit.implement.agent.md +135 -0
- package/.github/agents/speckit.plan.agent.md +89 -0
- package/.github/agents/speckit.specify.agent.md +258 -0
- package/.github/agents/speckit.tasks.agent.md +137 -0
- package/.github/agents/speckit.taskstoissues.agent.md +30 -0
- package/.github/copilot-instructions.md +17 -0
- package/.github/prompts/speckit.analyze.prompt.md +3 -0
- package/.github/prompts/speckit.checklist.prompt.md +3 -0
- package/.github/prompts/speckit.clarify.prompt.md +3 -0
- package/.github/prompts/speckit.constitution.prompt.md +3 -0
- package/.github/prompts/speckit.implement.prompt.md +3 -0
- package/.github/prompts/speckit.plan.prompt.md +3 -0
- package/.github/prompts/speckit.specify.prompt.md +3 -0
- package/.github/prompts/speckit.tasks.prompt.md +3 -0
- package/.github/prompts/speckit.taskstoissues.prompt.md +3 -0
- package/.github/workflows/publish.yaml +28 -0
- package/.opencode/command/speckit.analyze.md +184 -0
- package/.opencode/command/speckit.checklist.md +294 -0
- package/.opencode/command/speckit.clarify.md +181 -0
- package/.opencode/command/speckit.constitution.md +84 -0
- package/.opencode/command/speckit.implement.md +135 -0
- package/.opencode/command/speckit.plan.md +89 -0
- package/.opencode/command/speckit.specify.md +258 -0
- package/.opencode/command/speckit.tasks.md +137 -0
- package/.opencode/command/speckit.taskstoissues.md +30 -0
- package/.specify/memory/constitution.md +58 -0
- package/.specify/scripts/powershell/check-prerequisites.ps1 +148 -0
- package/.specify/scripts/powershell/common.ps1 +137 -0
- package/.specify/scripts/powershell/create-new-feature.ps1 +283 -0
- package/.specify/scripts/powershell/setup-plan.ps1 +61 -0
- package/.specify/scripts/powershell/update-agent-context.ps1 +448 -0
- package/.specify/templates/agent-file-template.md +28 -0
- package/.specify/templates/checklist-template.md +40 -0
- package/.specify/templates/constitution-template.md +50 -0
- package/.specify/templates/plan-template.md +104 -0
- package/.specify/templates/spec-template.md +115 -0
- package/.specify/templates/tasks-template.md +251 -0
- package/.vscode/launch.json +14 -0
- package/.vscode/settings.json +14 -0
- package/.vscode/tasks.json +15 -0
- package/README.md +151 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +31 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/services/apiClient.d.ts +14 -0
- package/dist/services/apiClient.d.ts.map +1 -0
- package/dist/services/apiClient.js +41 -0
- package/dist/services/apiClient.js.map +1 -0
- package/dist/tools/accounts.d.ts +3 -0
- package/dist/tools/accounts.d.ts.map +1 -0
- package/dist/tools/accounts.js +77 -0
- package/dist/tools/accounts.js.map +1 -0
- package/dist/tools/categories.d.ts +3 -0
- package/dist/tools/categories.d.ts.map +1 -0
- package/dist/tools/categories.js +57 -0
- package/dist/tools/categories.js.map +1 -0
- package/dist/tools/credit-cards.d.ts +3 -0
- package/dist/tools/credit-cards.d.ts.map +1 -0
- package/dist/tools/credit-cards.js +93 -0
- package/dist/tools/credit-cards.js.map +1 -0
- package/dist/tools/settings.d.ts +3 -0
- package/dist/tools/settings.d.ts.map +1 -0
- package/dist/tools/settings.js +37 -0
- package/dist/tools/settings.js.map +1 -0
- package/dist/tools/summary.d.ts +3 -0
- package/dist/tools/summary.d.ts.map +1 -0
- package/dist/tools/summary.js +16 -0
- package/dist/tools/summary.js.map +1 -0
- package/dist/tools/transactions.d.ts +3 -0
- package/dist/tools/transactions.d.ts.map +1 -0
- package/dist/tools/transactions.js +84 -0
- package/dist/tools/transactions.js.map +1 -0
- package/dist/types/schemas.d.ts +288 -0
- package/dist/types/schemas.d.ts.map +1 -0
- package/dist/types/schemas.js +170 -0
- package/dist/types/schemas.js.map +1 -0
- package/openapi.yaml +1443 -0
- package/package.json +41 -0
- package/specs/001-mcp-api-integration/checklists/requirements.md +34 -0
- package/specs/001-mcp-api-integration/contracts/openapi.yaml +636 -0
- package/specs/001-mcp-api-integration/data-model.md +106 -0
- package/specs/001-mcp-api-integration/plan.md +73 -0
- package/specs/001-mcp-api-integration/quickstart.md +74 -0
- package/specs/001-mcp-api-integration/research.md +58 -0
- package/specs/001-mcp-api-integration/spec.md +119 -0
- package/specs/001-mcp-api-integration/tasks.md +64 -0
- package/src/config.ts +36 -0
- package/src/index.ts +60 -0
- package/src/services/apiClient.ts +49 -0
- package/src/tools/accounts.ts +111 -0
- package/src/tools/categories.ts +81 -0
- package/src/tools/credit-cards.ts +132 -0
- package/src/tools/settings.ts +51 -0
- package/src/tools/summary.ts +20 -0
- package/src/tools/transactions.ts +118 -0
- package/src/types/schemas.ts +193 -0
- package/tests/benchmark.test.d.ts +2 -0
- package/tests/benchmark.test.d.ts.map +1 -0
- package/tests/benchmark.test.js +33 -0
- package/tests/benchmark.test.js.map +1 -0
- package/tests/benchmark.test.ts +38 -0
- package/tests/server.test.d.ts +2 -0
- package/tests/server.test.d.ts.map +1 -0
- package/tests/server.test.js +13 -0
- package/tests/server.test.js.map +1 -0
- package/tests/server.test.ts +14 -0
- package/tests/setup.d.ts +4 -0
- package/tests/setup.d.ts.map +1 -0
- package/tests/setup.js +17 -0
- package/tests/setup.js.map +1 -0
- package/tests/setup.ts +20 -0
- package/tests/tools/accounts.test.ts +118 -0
- package/tests/tools/categories.test.d.ts +2 -0
- package/tests/tools/categories.test.d.ts.map +1 -0
- package/tests/tools/categories.test.js +63 -0
- package/tests/tools/categories.test.js.map +1 -0
- package/tests/tools/categories.test.ts +78 -0
- package/tests/tools/credit-cards.test.d.ts +2 -0
- package/tests/tools/credit-cards.test.d.ts.map +1 -0
- package/tests/tools/credit-cards.test.js +71 -0
- package/tests/tools/credit-cards.test.js.map +1 -0
- package/tests/tools/credit-cards.test.ts +89 -0
- package/tests/tools/summary.test.d.ts +2 -0
- package/tests/tools/summary.test.d.ts.map +1 -0
- package/tests/tools/summary.test.js +36 -0
- package/tests/tools/summary.test.js.map +1 -0
- package/tests/tools/summary.test.ts +42 -0
- package/tests/tools/transactions.test.d.ts +2 -0
- package/tests/tools/transactions.test.d.ts.map +1 -0
- package/tests/tools/transactions.test.js +67 -0
- package/tests/tools/transactions.test.js.map +1 -0
- package/tests/tools/transactions.test.ts +82 -0
- package/tsconfig.json +52 -0
- package/vitest.config.d.ts +3 -0
- package/vitest.config.d.ts.map +1 -0
- package/vitest.config.js +14 -0
- package/vitest.config.js.map +1 -0
- package/vitest.config.ts +14 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts.
|
|
3
|
+
handoffs:
|
|
4
|
+
- label: Analyze For Consistency
|
|
5
|
+
agent: speckit.analyze
|
|
6
|
+
prompt: Run a project analysis for consistency
|
|
7
|
+
send: true
|
|
8
|
+
- label: Implement Project
|
|
9
|
+
agent: speckit.implement
|
|
10
|
+
prompt: Start the implementation in phases
|
|
11
|
+
send: true
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## User Input
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
$ARGUMENTS
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
You **MUST** consider the user input before proceeding (if not empty).
|
|
21
|
+
|
|
22
|
+
## Outline
|
|
23
|
+
|
|
24
|
+
1. **Setup**: Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
|
|
25
|
+
|
|
26
|
+
2. **Load design documents**: Read from FEATURE_DIR:
|
|
27
|
+
- **Required**: plan.md (tech stack, libraries, structure), spec.md (user stories with priorities)
|
|
28
|
+
- **Optional**: data-model.md (entities), contracts/ (API endpoints), research.md (decisions), quickstart.md (test scenarios)
|
|
29
|
+
- Note: Not all projects have all documents. Generate tasks based on what's available.
|
|
30
|
+
|
|
31
|
+
3. **Execute task generation workflow**:
|
|
32
|
+
- Load plan.md and extract tech stack, libraries, project structure
|
|
33
|
+
- Load spec.md and extract user stories with their priorities (P1, P2, P3, etc.)
|
|
34
|
+
- If data-model.md exists: Extract entities and map to user stories
|
|
35
|
+
- If contracts/ exists: Map endpoints to user stories
|
|
36
|
+
- If research.md exists: Extract decisions for setup tasks
|
|
37
|
+
- Generate tasks organized by user story (see Task Generation Rules below)
|
|
38
|
+
- Generate dependency graph showing user story completion order
|
|
39
|
+
- Create parallel execution examples per user story
|
|
40
|
+
- Validate task completeness (each user story has all needed tasks, independently testable)
|
|
41
|
+
|
|
42
|
+
4. **Generate tasks.md**: Use `.specify/templates/tasks-template.md` as structure, fill with:
|
|
43
|
+
- Correct feature name from plan.md
|
|
44
|
+
- Phase 1: Setup tasks (project initialization)
|
|
45
|
+
- Phase 2: Foundational tasks (blocking prerequisites for all user stories)
|
|
46
|
+
- Phase 3+: One phase per user story (in priority order from spec.md)
|
|
47
|
+
- Each phase includes: story goal, independent test criteria, tests (if requested), implementation tasks
|
|
48
|
+
- Final Phase: Polish & cross-cutting concerns
|
|
49
|
+
- All tasks must follow the strict checklist format (see Task Generation Rules below)
|
|
50
|
+
- Clear file paths for each task
|
|
51
|
+
- Dependencies section showing story completion order
|
|
52
|
+
- Parallel execution examples per story
|
|
53
|
+
- Implementation strategy section (MVP first, incremental delivery)
|
|
54
|
+
|
|
55
|
+
5. **Report**: Output path to generated tasks.md and summary:
|
|
56
|
+
- Total task count
|
|
57
|
+
- Task count per user story
|
|
58
|
+
- Parallel opportunities identified
|
|
59
|
+
- Independent test criteria for each story
|
|
60
|
+
- Suggested MVP scope (typically just User Story 1)
|
|
61
|
+
- Format validation: Confirm ALL tasks follow the checklist format (checkbox, ID, labels, file paths)
|
|
62
|
+
|
|
63
|
+
Context for task generation: $ARGUMENTS
|
|
64
|
+
|
|
65
|
+
The tasks.md should be immediately executable - each task must be specific enough that an LLM can complete it without additional context.
|
|
66
|
+
|
|
67
|
+
## Task Generation Rules
|
|
68
|
+
|
|
69
|
+
**CRITICAL**: Tasks MUST be organized by user story to enable independent implementation and testing.
|
|
70
|
+
|
|
71
|
+
**Tests are OPTIONAL**: Only generate test tasks if explicitly requested in the feature specification or if user requests TDD approach.
|
|
72
|
+
|
|
73
|
+
### Checklist Format (REQUIRED)
|
|
74
|
+
|
|
75
|
+
Every task MUST strictly follow this format:
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
- [ ] [TaskID] [P?] [Story?] Description with file path
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Format Components**:
|
|
82
|
+
|
|
83
|
+
1. **Checkbox**: ALWAYS start with `- [ ]` (markdown checkbox)
|
|
84
|
+
2. **Task ID**: Sequential number (T001, T002, T003...) in execution order
|
|
85
|
+
3. **[P] marker**: Include ONLY if task is parallelizable (different files, no dependencies on incomplete tasks)
|
|
86
|
+
4. **[Story] label**: REQUIRED for user story phase tasks only
|
|
87
|
+
- Format: [US1], [US2], [US3], etc. (maps to user stories from spec.md)
|
|
88
|
+
- Setup phase: NO story label
|
|
89
|
+
- Foundational phase: NO story label
|
|
90
|
+
- User Story phases: MUST have story label
|
|
91
|
+
- Polish phase: NO story label
|
|
92
|
+
5. **Description**: Clear action with exact file path
|
|
93
|
+
|
|
94
|
+
**Examples**:
|
|
95
|
+
|
|
96
|
+
- ✅ CORRECT: `- [ ] T001 Create project structure per implementation plan`
|
|
97
|
+
- ✅ CORRECT: `- [ ] T005 [P] Implement authentication middleware in src/middleware/auth.py`
|
|
98
|
+
- ✅ CORRECT: `- [ ] T012 [P] [US1] Create User model in src/models/user.py`
|
|
99
|
+
- ✅ CORRECT: `- [ ] T014 [US1] Implement UserService in src/services/user_service.py`
|
|
100
|
+
- ❌ WRONG: `- [ ] Create User model` (missing ID and Story label)
|
|
101
|
+
- ❌ WRONG: `T001 [US1] Create model` (missing checkbox)
|
|
102
|
+
- ❌ WRONG: `- [ ] [US1] Create User model` (missing Task ID)
|
|
103
|
+
- ❌ WRONG: `- [ ] T001 [US1] Create model` (missing file path)
|
|
104
|
+
|
|
105
|
+
### Task Organization
|
|
106
|
+
|
|
107
|
+
1. **From User Stories (spec.md)** - PRIMARY ORGANIZATION:
|
|
108
|
+
- Each user story (P1, P2, P3...) gets its own phase
|
|
109
|
+
- Map all related components to their story:
|
|
110
|
+
- Models needed for that story
|
|
111
|
+
- Services needed for that story
|
|
112
|
+
- Endpoints/UI needed for that story
|
|
113
|
+
- If tests requested: Tests specific to that story
|
|
114
|
+
- Mark story dependencies (most stories should be independent)
|
|
115
|
+
|
|
116
|
+
2. **From Contracts**:
|
|
117
|
+
- Map each contract/endpoint → to the user story it serves
|
|
118
|
+
- If tests requested: Each contract → contract test task [P] before implementation in that story's phase
|
|
119
|
+
|
|
120
|
+
3. **From Data Model**:
|
|
121
|
+
- Map each entity to the user story(ies) that need it
|
|
122
|
+
- If entity serves multiple stories: Put in earliest story or Setup phase
|
|
123
|
+
- Relationships → service layer tasks in appropriate story phase
|
|
124
|
+
|
|
125
|
+
4. **From Setup/Infrastructure**:
|
|
126
|
+
- Shared infrastructure → Setup phase (Phase 1)
|
|
127
|
+
- Foundational/blocking tasks → Foundational phase (Phase 2)
|
|
128
|
+
- Story-specific setup → within that story's phase
|
|
129
|
+
|
|
130
|
+
### Phase Structure
|
|
131
|
+
|
|
132
|
+
- **Phase 1**: Setup (project initialization)
|
|
133
|
+
- **Phase 2**: Foundational (blocking prerequisites - MUST complete before user stories)
|
|
134
|
+
- **Phase 3+**: User Stories in priority order (P1, P2, P3...)
|
|
135
|
+
- Within each story: Tests (if requested) → Models → Services → Endpoints → Integration
|
|
136
|
+
- Each phase should be a complete, independently testable increment
|
|
137
|
+
- **Final Phase**: Polish & Cross-Cutting Concerns
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Convert existing tasks into actionable, dependency-ordered GitHub issues for the feature based on available design artifacts.
|
|
3
|
+
tools: ['github/github-mcp-server/issue_write']
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## User Input
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
$ARGUMENTS
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
You **MUST** consider the user input before proceeding (if not empty).
|
|
13
|
+
|
|
14
|
+
## Outline
|
|
15
|
+
|
|
16
|
+
1. Run `.specify/scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
|
|
17
|
+
1. From the executed script, extract the path to **tasks**.
|
|
18
|
+
1. Get the Git remote by running:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
git config --get remote.origin.url
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
> [!CAUTION]
|
|
25
|
+
> ONLY PROCEED TO NEXT STEPS IF THE REMOTE IS A GITHUB URL
|
|
26
|
+
|
|
27
|
+
1. For each task in the list, use the GitHub MCP server to create a new issue in the repository that is representative of the Git remote.
|
|
28
|
+
|
|
29
|
+
> [!CAUTION]
|
|
30
|
+
> UNDER NO CIRCUMSTANCES EVER CREATE ISSUES IN REPOSITORIES THAT DO NOT MATCH THE REMOTE URL
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SYNC IMPACT REPORT
|
|
3
|
+
Version Change: 0.0.0 (New) -> 1.0.0
|
|
4
|
+
Modified Principles: All (Initial Definition)
|
|
5
|
+
Added Sections: All
|
|
6
|
+
Removed Sections: None
|
|
7
|
+
Templates Requiring Updates: ✅ None (Templates are generic enough)
|
|
8
|
+
Follow-up:
|
|
9
|
+
- Verify ratification date is acceptable as today.
|
|
10
|
+
-->
|
|
11
|
+
# Morpheus MCP Constitution
|
|
12
|
+
|
|
13
|
+
## Core Principles
|
|
14
|
+
|
|
15
|
+
### I. Library-First
|
|
16
|
+
Every feature or tool set should be implemented as a standalone module or library within the `src/tools/` or `src/lib/` structure. Avoid monolithic `index.ts` files. Modules must be self-contained, independently testable, and have a single clear responsibility.
|
|
17
|
+
|
|
18
|
+
### II. Standard Interface
|
|
19
|
+
All tools must expose functionality via the Model Context Protocol (MCP) standard. Inputs must be strictly defined using Zod schemas to ensure type safety and validation at the boundary.
|
|
20
|
+
|
|
21
|
+
### III. Test-First (NON-NEGOTIABLE)
|
|
22
|
+
Test-Driven Development (TDD) is mandatory for core logic. Write tests that define the expected behavior before implementing the functionality. Ensure a Red-Green-Refactor cycle.
|
|
23
|
+
|
|
24
|
+
### IV. Integration Testing
|
|
25
|
+
Given the nature of MCP servers as API proxies, integration tests are critical. Usage of mocking frameworks to simulate external API responses is required to verify contract adherence without flakiness from external services.
|
|
26
|
+
|
|
27
|
+
### V. Simplicity & Robustness
|
|
28
|
+
Keep code simple and readable. Avoid over-engineering. Handle errors gracefully and provide meaningful error messages to the LLM/Client. Strict typing is required throughout to prevent runtime surprises.
|
|
29
|
+
|
|
30
|
+
## Security & Compliance
|
|
31
|
+
|
|
32
|
+
### Authentication Management
|
|
33
|
+
API keys and secrets must never be hardcoded. They must be loaded from environment variables (e.g., `QUANTIX_API_KEY`). The server should validate the presence of required configuration at startup.
|
|
34
|
+
|
|
35
|
+
### Data Privacy
|
|
36
|
+
Do not log sensitive user data or full API keys. Logs should be structured and sanitized.
|
|
37
|
+
|
|
38
|
+
## Development Workflow
|
|
39
|
+
|
|
40
|
+
### Code Review Gates
|
|
41
|
+
All Pull Requests must pass the automated build and test suite. Code reviews should verify adherence to the Library-First and Test-First principles.
|
|
42
|
+
|
|
43
|
+
### Documentation
|
|
44
|
+
Every tool must have a clear description and argument documentation suitable for LLM consumption. `README.md` must be kept up-to-date with usage instructions.
|
|
45
|
+
|
|
46
|
+
## Governance
|
|
47
|
+
|
|
48
|
+
This constitution serves as the primary source of truth for engineering practices within the Morpheus MCP project.
|
|
49
|
+
|
|
50
|
+
### Amendments
|
|
51
|
+
Any changes to this constitution must be made via a Pull Request to `.specify/memory/constitution.md`.
|
|
52
|
+
* Major changes (altering core principles) require a Consensus Review.
|
|
53
|
+
* Minor changes (clarifications, new sections) require standard Maintainer Review.
|
|
54
|
+
|
|
55
|
+
### Compliance
|
|
56
|
+
All new feature plans (Phase 0/1) must include a "Constitution Check" to verify alignment with these principles.
|
|
57
|
+
|
|
58
|
+
**Version**: 1.0.0 | **Ratified**: 2026-01-31 | **Last Amended**: 2026-01-31
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
|
|
3
|
+
# Consolidated prerequisite checking script (PowerShell)
|
|
4
|
+
#
|
|
5
|
+
# This script provides unified prerequisite checking for Spec-Driven Development workflow.
|
|
6
|
+
# It replaces the functionality previously spread across multiple scripts.
|
|
7
|
+
#
|
|
8
|
+
# Usage: ./check-prerequisites.ps1 [OPTIONS]
|
|
9
|
+
#
|
|
10
|
+
# OPTIONS:
|
|
11
|
+
# -Json Output in JSON format
|
|
12
|
+
# -RequireTasks Require tasks.md to exist (for implementation phase)
|
|
13
|
+
# -IncludeTasks Include tasks.md in AVAILABLE_DOCS list
|
|
14
|
+
# -PathsOnly Only output path variables (no validation)
|
|
15
|
+
# -Help, -h Show help message
|
|
16
|
+
|
|
17
|
+
[CmdletBinding()]
|
|
18
|
+
param(
|
|
19
|
+
[switch]$Json,
|
|
20
|
+
[switch]$RequireTasks,
|
|
21
|
+
[switch]$IncludeTasks,
|
|
22
|
+
[switch]$PathsOnly,
|
|
23
|
+
[switch]$Help
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
$ErrorActionPreference = 'Stop'
|
|
27
|
+
|
|
28
|
+
# Show help if requested
|
|
29
|
+
if ($Help) {
|
|
30
|
+
Write-Output @"
|
|
31
|
+
Usage: check-prerequisites.ps1 [OPTIONS]
|
|
32
|
+
|
|
33
|
+
Consolidated prerequisite checking for Spec-Driven Development workflow.
|
|
34
|
+
|
|
35
|
+
OPTIONS:
|
|
36
|
+
-Json Output in JSON format
|
|
37
|
+
-RequireTasks Require tasks.md to exist (for implementation phase)
|
|
38
|
+
-IncludeTasks Include tasks.md in AVAILABLE_DOCS list
|
|
39
|
+
-PathsOnly Only output path variables (no prerequisite validation)
|
|
40
|
+
-Help, -h Show this help message
|
|
41
|
+
|
|
42
|
+
EXAMPLES:
|
|
43
|
+
# Check task prerequisites (plan.md required)
|
|
44
|
+
.\check-prerequisites.ps1 -Json
|
|
45
|
+
|
|
46
|
+
# Check implementation prerequisites (plan.md + tasks.md required)
|
|
47
|
+
.\check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks
|
|
48
|
+
|
|
49
|
+
# Get feature paths only (no validation)
|
|
50
|
+
.\check-prerequisites.ps1 -PathsOnly
|
|
51
|
+
|
|
52
|
+
"@
|
|
53
|
+
exit 0
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
# Source common functions
|
|
57
|
+
. "$PSScriptRoot/common.ps1"
|
|
58
|
+
|
|
59
|
+
# Get feature paths and validate branch
|
|
60
|
+
$paths = Get-FeaturePathsEnv
|
|
61
|
+
|
|
62
|
+
if (-not (Test-FeatureBranch -Branch $paths.CURRENT_BRANCH -HasGit:$paths.HAS_GIT)) {
|
|
63
|
+
exit 1
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
# If paths-only mode, output paths and exit (support combined -Json -PathsOnly)
|
|
67
|
+
if ($PathsOnly) {
|
|
68
|
+
if ($Json) {
|
|
69
|
+
[PSCustomObject]@{
|
|
70
|
+
REPO_ROOT = $paths.REPO_ROOT
|
|
71
|
+
BRANCH = $paths.CURRENT_BRANCH
|
|
72
|
+
FEATURE_DIR = $paths.FEATURE_DIR
|
|
73
|
+
FEATURE_SPEC = $paths.FEATURE_SPEC
|
|
74
|
+
IMPL_PLAN = $paths.IMPL_PLAN
|
|
75
|
+
TASKS = $paths.TASKS
|
|
76
|
+
} | ConvertTo-Json -Compress
|
|
77
|
+
} else {
|
|
78
|
+
Write-Output "REPO_ROOT: $($paths.REPO_ROOT)"
|
|
79
|
+
Write-Output "BRANCH: $($paths.CURRENT_BRANCH)"
|
|
80
|
+
Write-Output "FEATURE_DIR: $($paths.FEATURE_DIR)"
|
|
81
|
+
Write-Output "FEATURE_SPEC: $($paths.FEATURE_SPEC)"
|
|
82
|
+
Write-Output "IMPL_PLAN: $($paths.IMPL_PLAN)"
|
|
83
|
+
Write-Output "TASKS: $($paths.TASKS)"
|
|
84
|
+
}
|
|
85
|
+
exit 0
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
# Validate required directories and files
|
|
89
|
+
if (-not (Test-Path $paths.FEATURE_DIR -PathType Container)) {
|
|
90
|
+
Write-Output "ERROR: Feature directory not found: $($paths.FEATURE_DIR)"
|
|
91
|
+
Write-Output "Run /speckit.specify first to create the feature structure."
|
|
92
|
+
exit 1
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (-not (Test-Path $paths.IMPL_PLAN -PathType Leaf)) {
|
|
96
|
+
Write-Output "ERROR: plan.md not found in $($paths.FEATURE_DIR)"
|
|
97
|
+
Write-Output "Run /speckit.plan first to create the implementation plan."
|
|
98
|
+
exit 1
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
# Check for tasks.md if required
|
|
102
|
+
if ($RequireTasks -and -not (Test-Path $paths.TASKS -PathType Leaf)) {
|
|
103
|
+
Write-Output "ERROR: tasks.md not found in $($paths.FEATURE_DIR)"
|
|
104
|
+
Write-Output "Run /speckit.tasks first to create the task list."
|
|
105
|
+
exit 1
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
# Build list of available documents
|
|
109
|
+
$docs = @()
|
|
110
|
+
|
|
111
|
+
# Always check these optional docs
|
|
112
|
+
if (Test-Path $paths.RESEARCH) { $docs += 'research.md' }
|
|
113
|
+
if (Test-Path $paths.DATA_MODEL) { $docs += 'data-model.md' }
|
|
114
|
+
|
|
115
|
+
# Check contracts directory (only if it exists and has files)
|
|
116
|
+
if ((Test-Path $paths.CONTRACTS_DIR) -and (Get-ChildItem -Path $paths.CONTRACTS_DIR -ErrorAction SilentlyContinue | Select-Object -First 1)) {
|
|
117
|
+
$docs += 'contracts/'
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (Test-Path $paths.QUICKSTART) { $docs += 'quickstart.md' }
|
|
121
|
+
|
|
122
|
+
# Include tasks.md if requested and it exists
|
|
123
|
+
if ($IncludeTasks -and (Test-Path $paths.TASKS)) {
|
|
124
|
+
$docs += 'tasks.md'
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
# Output results
|
|
128
|
+
if ($Json) {
|
|
129
|
+
# JSON output
|
|
130
|
+
[PSCustomObject]@{
|
|
131
|
+
FEATURE_DIR = $paths.FEATURE_DIR
|
|
132
|
+
AVAILABLE_DOCS = $docs
|
|
133
|
+
} | ConvertTo-Json -Compress
|
|
134
|
+
} else {
|
|
135
|
+
# Text output
|
|
136
|
+
Write-Output "FEATURE_DIR:$($paths.FEATURE_DIR)"
|
|
137
|
+
Write-Output "AVAILABLE_DOCS:"
|
|
138
|
+
|
|
139
|
+
# Show status of each potential document
|
|
140
|
+
Test-FileExists -Path $paths.RESEARCH -Description 'research.md' | Out-Null
|
|
141
|
+
Test-FileExists -Path $paths.DATA_MODEL -Description 'data-model.md' | Out-Null
|
|
142
|
+
Test-DirHasFiles -Path $paths.CONTRACTS_DIR -Description 'contracts/' | Out-Null
|
|
143
|
+
Test-FileExists -Path $paths.QUICKSTART -Description 'quickstart.md' | Out-Null
|
|
144
|
+
|
|
145
|
+
if ($IncludeTasks) {
|
|
146
|
+
Test-FileExists -Path $paths.TASKS -Description 'tasks.md' | Out-Null
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
# Common PowerShell functions analogous to common.sh
|
|
3
|
+
|
|
4
|
+
function Get-RepoRoot {
|
|
5
|
+
try {
|
|
6
|
+
$result = git rev-parse --show-toplevel 2>$null
|
|
7
|
+
if ($LASTEXITCODE -eq 0) {
|
|
8
|
+
return $result
|
|
9
|
+
}
|
|
10
|
+
} catch {
|
|
11
|
+
# Git command failed
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
# Fall back to script location for non-git repos
|
|
15
|
+
return (Resolve-Path (Join-Path $PSScriptRoot "../../..")).Path
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function Get-CurrentBranch {
|
|
19
|
+
# First check if SPECIFY_FEATURE environment variable is set
|
|
20
|
+
if ($env:SPECIFY_FEATURE) {
|
|
21
|
+
return $env:SPECIFY_FEATURE
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
# Then check git if available
|
|
25
|
+
try {
|
|
26
|
+
$result = git rev-parse --abbrev-ref HEAD 2>$null
|
|
27
|
+
if ($LASTEXITCODE -eq 0) {
|
|
28
|
+
return $result
|
|
29
|
+
}
|
|
30
|
+
} catch {
|
|
31
|
+
# Git command failed
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
# For non-git repos, try to find the latest feature directory
|
|
35
|
+
$repoRoot = Get-RepoRoot
|
|
36
|
+
$specsDir = Join-Path $repoRoot "specs"
|
|
37
|
+
|
|
38
|
+
if (Test-Path $specsDir) {
|
|
39
|
+
$latestFeature = ""
|
|
40
|
+
$highest = 0
|
|
41
|
+
|
|
42
|
+
Get-ChildItem -Path $specsDir -Directory | ForEach-Object {
|
|
43
|
+
if ($_.Name -match '^(\d{3})-') {
|
|
44
|
+
$num = [int]$matches[1]
|
|
45
|
+
if ($num -gt $highest) {
|
|
46
|
+
$highest = $num
|
|
47
|
+
$latestFeature = $_.Name
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if ($latestFeature) {
|
|
53
|
+
return $latestFeature
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
# Final fallback
|
|
58
|
+
return "main"
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function Test-HasGit {
|
|
62
|
+
try {
|
|
63
|
+
git rev-parse --show-toplevel 2>$null | Out-Null
|
|
64
|
+
return ($LASTEXITCODE -eq 0)
|
|
65
|
+
} catch {
|
|
66
|
+
return $false
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function Test-FeatureBranch {
|
|
71
|
+
param(
|
|
72
|
+
[string]$Branch,
|
|
73
|
+
[bool]$HasGit = $true
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
# For non-git repos, we can't enforce branch naming but still provide output
|
|
77
|
+
if (-not $HasGit) {
|
|
78
|
+
Write-Warning "[specify] Warning: Git repository not detected; skipped branch validation"
|
|
79
|
+
return $true
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if ($Branch -notmatch '^[0-9]{3}-') {
|
|
83
|
+
Write-Output "ERROR: Not on a feature branch. Current branch: $Branch"
|
|
84
|
+
Write-Output "Feature branches should be named like: 001-feature-name"
|
|
85
|
+
return $false
|
|
86
|
+
}
|
|
87
|
+
return $true
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function Get-FeatureDir {
|
|
91
|
+
param([string]$RepoRoot, [string]$Branch)
|
|
92
|
+
Join-Path $RepoRoot "specs/$Branch"
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function Get-FeaturePathsEnv {
|
|
96
|
+
$repoRoot = Get-RepoRoot
|
|
97
|
+
$currentBranch = Get-CurrentBranch
|
|
98
|
+
$hasGit = Test-HasGit
|
|
99
|
+
$featureDir = Get-FeatureDir -RepoRoot $repoRoot -Branch $currentBranch
|
|
100
|
+
|
|
101
|
+
[PSCustomObject]@{
|
|
102
|
+
REPO_ROOT = $repoRoot
|
|
103
|
+
CURRENT_BRANCH = $currentBranch
|
|
104
|
+
HAS_GIT = $hasGit
|
|
105
|
+
FEATURE_DIR = $featureDir
|
|
106
|
+
FEATURE_SPEC = Join-Path $featureDir 'spec.md'
|
|
107
|
+
IMPL_PLAN = Join-Path $featureDir 'plan.md'
|
|
108
|
+
TASKS = Join-Path $featureDir 'tasks.md'
|
|
109
|
+
RESEARCH = Join-Path $featureDir 'research.md'
|
|
110
|
+
DATA_MODEL = Join-Path $featureDir 'data-model.md'
|
|
111
|
+
QUICKSTART = Join-Path $featureDir 'quickstart.md'
|
|
112
|
+
CONTRACTS_DIR = Join-Path $featureDir 'contracts'
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function Test-FileExists {
|
|
117
|
+
param([string]$Path, [string]$Description)
|
|
118
|
+
if (Test-Path -Path $Path -PathType Leaf) {
|
|
119
|
+
Write-Output " ✓ $Description"
|
|
120
|
+
return $true
|
|
121
|
+
} else {
|
|
122
|
+
Write-Output " ✗ $Description"
|
|
123
|
+
return $false
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function Test-DirHasFiles {
|
|
128
|
+
param([string]$Path, [string]$Description)
|
|
129
|
+
if ((Test-Path -Path $Path -PathType Container) -and (Get-ChildItem -Path $Path -ErrorAction SilentlyContinue | Where-Object { -not $_.PSIsContainer } | Select-Object -First 1)) {
|
|
130
|
+
Write-Output " ✓ $Description"
|
|
131
|
+
return $true
|
|
132
|
+
} else {
|
|
133
|
+
Write-Output " ✗ $Description"
|
|
134
|
+
return $false
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|