Merge branch '001-schedule-tools'
# Conflicts: # README.md
This commit is contained in:
184
.claude/commands/speckit.analyze.md
Normal file
184
.claude/commands/speckit.analyze.md
Normal file
@@ -0,0 +1,184 @@
|
||||
---
|
||||
description: Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task generation.
|
||||
---
|
||||
|
||||
## User Input
|
||||
|
||||
```text
|
||||
$ARGUMENTS
|
||||
```
|
||||
|
||||
You **MUST** consider the user input before proceeding (if not empty).
|
||||
|
||||
## Goal
|
||||
|
||||
Identify inconsistencies, duplications, ambiguities, and underspecified items across the three core artifacts (`spec.md`, `plan.md`, `tasks.md`) before implementation. This command MUST run only after `/speckit.tasks` has successfully produced a complete `tasks.md`.
|
||||
|
||||
## Operating Constraints
|
||||
|
||||
**STRICTLY READ-ONLY**: Do **not** modify any files. Output a structured analysis report. Offer an optional remediation plan (user must explicitly approve before any follow-up editing commands would be invoked manually).
|
||||
|
||||
**Constitution Authority**: The project constitution (`.specify/memory/constitution.md`) is **non-negotiable** within this analysis scope. Constitution conflicts are automatically CRITICAL and require adjustment of the spec, plan, or tasks—not dilution, reinterpretation, or silent ignoring of the principle. If a principle itself needs to change, that must occur in a separate, explicit constitution update outside `/speckit.analyze`.
|
||||
|
||||
## Execution Steps
|
||||
|
||||
### 1. Initialize Analysis Context
|
||||
|
||||
Run `.specify/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks` once from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS. Derive absolute paths:
|
||||
|
||||
- SPEC = FEATURE_DIR/spec.md
|
||||
- PLAN = FEATURE_DIR/plan.md
|
||||
- TASKS = FEATURE_DIR/tasks.md
|
||||
|
||||
Abort with an error message if any required file is missing (instruct the user to run missing prerequisite command).
|
||||
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").
|
||||
|
||||
### 2. Load Artifacts (Progressive Disclosure)
|
||||
|
||||
Load only the minimal necessary context from each artifact:
|
||||
|
||||
**From spec.md:**
|
||||
|
||||
- Overview/Context
|
||||
- Functional Requirements
|
||||
- Non-Functional Requirements
|
||||
- User Stories
|
||||
- Edge Cases (if present)
|
||||
|
||||
**From plan.md:**
|
||||
|
||||
- Architecture/stack choices
|
||||
- Data Model references
|
||||
- Phases
|
||||
- Technical constraints
|
||||
|
||||
**From tasks.md:**
|
||||
|
||||
- Task IDs
|
||||
- Descriptions
|
||||
- Phase grouping
|
||||
- Parallel markers [P]
|
||||
- Referenced file paths
|
||||
|
||||
**From constitution:**
|
||||
|
||||
- Load `.specify/memory/constitution.md` for principle validation
|
||||
|
||||
### 3. Build Semantic Models
|
||||
|
||||
Create internal representations (do not include raw artifacts in output):
|
||||
|
||||
- **Requirements inventory**: Each functional + non-functional requirement with a stable key (derive slug based on imperative phrase; e.g., "User can upload file" → `user-can-upload-file`)
|
||||
- **User story/action inventory**: Discrete user actions with acceptance criteria
|
||||
- **Task coverage mapping**: Map each task to one or more requirements or stories (inference by keyword / explicit reference patterns like IDs or key phrases)
|
||||
- **Constitution rule set**: Extract principle names and MUST/SHOULD normative statements
|
||||
|
||||
### 4. Detection Passes (Token-Efficient Analysis)
|
||||
|
||||
Focus on high-signal findings. Limit to 50 findings total; aggregate remainder in overflow summary.
|
||||
|
||||
#### A. Duplication Detection
|
||||
|
||||
- Identify near-duplicate requirements
|
||||
- Mark lower-quality phrasing for consolidation
|
||||
|
||||
#### B. Ambiguity Detection
|
||||
|
||||
- Flag vague adjectives (fast, scalable, secure, intuitive, robust) lacking measurable criteria
|
||||
- Flag unresolved placeholders (TODO, TKTK, ???, `<placeholder>`, etc.)
|
||||
|
||||
#### C. Underspecification
|
||||
|
||||
- Requirements with verbs but missing object or measurable outcome
|
||||
- User stories missing acceptance criteria alignment
|
||||
- Tasks referencing files or components not defined in spec/plan
|
||||
|
||||
#### D. Constitution Alignment
|
||||
|
||||
- Any requirement or plan element conflicting with a MUST principle
|
||||
- Missing mandated sections or quality gates from constitution
|
||||
|
||||
#### E. Coverage Gaps
|
||||
|
||||
- Requirements with zero associated tasks
|
||||
- Tasks with no mapped requirement/story
|
||||
- Non-functional requirements not reflected in tasks (e.g., performance, security)
|
||||
|
||||
#### F. Inconsistency
|
||||
|
||||
- Terminology drift (same concept named differently across files)
|
||||
- Data entities referenced in plan but absent in spec (or vice versa)
|
||||
- Task ordering contradictions (e.g., integration tasks before foundational setup tasks without dependency note)
|
||||
- Conflicting requirements (e.g., one requires Next.js while other specifies Vue)
|
||||
|
||||
### 5. Severity Assignment
|
||||
|
||||
Use this heuristic to prioritize findings:
|
||||
|
||||
- **CRITICAL**: Violates constitution MUST, missing core spec artifact, or requirement with zero coverage that blocks baseline functionality
|
||||
- **HIGH**: Duplicate or conflicting requirement, ambiguous security/performance attribute, untestable acceptance criterion
|
||||
- **MEDIUM**: Terminology drift, missing non-functional task coverage, underspecified edge case
|
||||
- **LOW**: Style/wording improvements, minor redundancy not affecting execution order
|
||||
|
||||
### 6. Produce Compact Analysis Report
|
||||
|
||||
Output a Markdown report (no file writes) with the following structure:
|
||||
|
||||
## Specification Analysis Report
|
||||
|
||||
| ID | Category | Severity | Location(s) | Summary | Recommendation |
|
||||
|----|----------|----------|-------------|---------|----------------|
|
||||
| A1 | Duplication | HIGH | spec.md:L120-134 | Two similar requirements ... | Merge phrasing; keep clearer version |
|
||||
|
||||
(Add one row per finding; generate stable IDs prefixed by category initial.)
|
||||
|
||||
**Coverage Summary Table:**
|
||||
|
||||
| Requirement Key | Has Task? | Task IDs | Notes |
|
||||
|-----------------|-----------|----------|-------|
|
||||
|
||||
**Constitution Alignment Issues:** (if any)
|
||||
|
||||
**Unmapped Tasks:** (if any)
|
||||
|
||||
**Metrics:**
|
||||
|
||||
- Total Requirements
|
||||
- Total Tasks
|
||||
- Coverage % (requirements with >=1 task)
|
||||
- Ambiguity Count
|
||||
- Duplication Count
|
||||
- Critical Issues Count
|
||||
|
||||
### 7. Provide Next Actions
|
||||
|
||||
At end of report, output a concise Next Actions block:
|
||||
|
||||
- If CRITICAL issues exist: Recommend resolving before `/speckit.implement`
|
||||
- If only LOW/MEDIUM: User may proceed, but provide improvement suggestions
|
||||
- Provide explicit command suggestions: e.g., "Run /speckit.specify with refinement", "Run /speckit.plan to adjust architecture", "Manually edit tasks.md to add coverage for 'performance-metrics'"
|
||||
|
||||
### 8. Offer Remediation
|
||||
|
||||
Ask the user: "Would you like me to suggest concrete remediation edits for the top N issues?" (Do NOT apply them automatically.)
|
||||
|
||||
## Operating Principles
|
||||
|
||||
### Context Efficiency
|
||||
|
||||
- **Minimal high-signal tokens**: Focus on actionable findings, not exhaustive documentation
|
||||
- **Progressive disclosure**: Load artifacts incrementally; don't dump all content into analysis
|
||||
- **Token-efficient output**: Limit findings table to 50 rows; summarize overflow
|
||||
- **Deterministic results**: Rerunning without changes should produce consistent IDs and counts
|
||||
|
||||
### Analysis Guidelines
|
||||
|
||||
- **NEVER modify files** (this is read-only analysis)
|
||||
- **NEVER hallucinate missing sections** (if absent, report them accurately)
|
||||
- **Prioritize constitution violations** (these are always CRITICAL)
|
||||
- **Use examples over exhaustive rules** (cite specific instances, not generic patterns)
|
||||
- **Report zero issues gracefully** (emit success report with coverage statistics)
|
||||
|
||||
## Context
|
||||
|
||||
$ARGUMENTS
|
||||
294
.claude/commands/speckit.checklist.md
Normal file
294
.claude/commands/speckit.checklist.md
Normal file
@@ -0,0 +1,294 @@
|
||||
---
|
||||
description: Generate a custom checklist for the current feature based on user requirements.
|
||||
---
|
||||
|
||||
## Checklist Purpose: "Unit Tests for English"
|
||||
|
||||
**CRITICAL CONCEPT**: Checklists are **UNIT TESTS FOR REQUIREMENTS WRITING** - they validate the quality, clarity, and completeness of requirements in a given domain.
|
||||
|
||||
**NOT for verification/testing**:
|
||||
|
||||
- ❌ NOT "Verify the button clicks correctly"
|
||||
- ❌ NOT "Test error handling works"
|
||||
- ❌ NOT "Confirm the API returns 200"
|
||||
- ❌ NOT checking if code/implementation matches the spec
|
||||
|
||||
**FOR requirements quality validation**:
|
||||
|
||||
- ✅ "Are visual hierarchy requirements defined for all card types?" (completeness)
|
||||
- ✅ "Is 'prominent display' quantified with specific sizing/positioning?" (clarity)
|
||||
- ✅ "Are hover state requirements consistent across all interactive elements?" (consistency)
|
||||
- ✅ "Are accessibility requirements defined for keyboard navigation?" (coverage)
|
||||
- ✅ "Does the spec define what happens when logo image fails to load?" (edge cases)
|
||||
|
||||
**Metaphor**: If your spec is code written in English, the checklist is its unit test suite. You're testing whether the requirements are well-written, complete, unambiguous, and ready for implementation - NOT whether the implementation works.
|
||||
|
||||
## User Input
|
||||
|
||||
```text
|
||||
$ARGUMENTS
|
||||
```
|
||||
|
||||
You **MUST** consider the user input before proceeding (if not empty).
|
||||
|
||||
## Execution Steps
|
||||
|
||||
1. **Setup**: Run `.specify/scripts/bash/check-prerequisites.sh --json` from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS list.
|
||||
- All file 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").
|
||||
|
||||
2. **Clarify intent (dynamic)**: Derive up to THREE initial contextual clarifying questions (no pre-baked catalog). They MUST:
|
||||
- Be generated from the user's phrasing + extracted signals from spec/plan/tasks
|
||||
- Only ask about information that materially changes checklist content
|
||||
- Be skipped individually if already unambiguous in `$ARGUMENTS`
|
||||
- Prefer precision over breadth
|
||||
|
||||
Generation algorithm:
|
||||
1. Extract signals: feature domain keywords (e.g., auth, latency, UX, API), risk indicators ("critical", "must", "compliance"), stakeholder hints ("QA", "review", "security team"), and explicit deliverables ("a11y", "rollback", "contracts").
|
||||
2. Cluster signals into candidate focus areas (max 4) ranked by relevance.
|
||||
3. Identify probable audience & timing (author, reviewer, QA, release) if not explicit.
|
||||
4. Detect missing dimensions: scope breadth, depth/rigor, risk emphasis, exclusion boundaries, measurable acceptance criteria.
|
||||
5. Formulate questions chosen from these archetypes:
|
||||
- Scope refinement (e.g., "Should this include integration touchpoints with X and Y or stay limited to local module correctness?")
|
||||
- Risk prioritization (e.g., "Which of these potential risk areas should receive mandatory gating checks?")
|
||||
- Depth calibration (e.g., "Is this a lightweight pre-commit sanity list or a formal release gate?")
|
||||
- Audience framing (e.g., "Will this be used by the author only or peers during PR review?")
|
||||
- Boundary exclusion (e.g., "Should we explicitly exclude performance tuning items this round?")
|
||||
- Scenario class gap (e.g., "No recovery flows detected—are rollback / partial failure paths in scope?")
|
||||
|
||||
Question formatting rules:
|
||||
- If presenting options, generate a compact table with columns: Option | Candidate | Why It Matters
|
||||
- Limit to A–E options maximum; omit table if a free-form answer is clearer
|
||||
- Never ask the user to restate what they already said
|
||||
- Avoid speculative categories (no hallucination). If uncertain, ask explicitly: "Confirm whether X belongs in scope."
|
||||
|
||||
Defaults when interaction impossible:
|
||||
- Depth: Standard
|
||||
- Audience: Reviewer (PR) if code-related; Author otherwise
|
||||
- Focus: Top 2 relevance clusters
|
||||
|
||||
Output the questions (label Q1/Q2/Q3). After answers: if ≥2 scenario classes (Alternate / Exception / Recovery / Non-Functional domain) remain unclear, you MAY ask up to TWO more targeted follow‑ups (Q4/Q5) with a one-line justification each (e.g., "Unresolved recovery path risk"). Do not exceed five total questions. Skip escalation if user explicitly declines more.
|
||||
|
||||
3. **Understand user request**: Combine `$ARGUMENTS` + clarifying answers:
|
||||
- Derive checklist theme (e.g., security, review, deploy, ux)
|
||||
- Consolidate explicit must-have items mentioned by user
|
||||
- Map focus selections to category scaffolding
|
||||
- Infer any missing context from spec/plan/tasks (do NOT hallucinate)
|
||||
|
||||
4. **Load feature context**: Read from FEATURE_DIR:
|
||||
- spec.md: Feature requirements and scope
|
||||
- plan.md (if exists): Technical details, dependencies
|
||||
- tasks.md (if exists): Implementation tasks
|
||||
|
||||
**Context Loading Strategy**:
|
||||
- Load only necessary portions relevant to active focus areas (avoid full-file dumping)
|
||||
- Prefer summarizing long sections into concise scenario/requirement bullets
|
||||
- Use progressive disclosure: add follow-on retrieval only if gaps detected
|
||||
- If source docs are large, generate interim summary items instead of embedding raw text
|
||||
|
||||
5. **Generate checklist** - Create "Unit Tests for Requirements":
|
||||
- Create `FEATURE_DIR/checklists/` directory if it doesn't exist
|
||||
- Generate unique checklist filename:
|
||||
- Use short, descriptive name based on domain (e.g., `ux.md`, `api.md`, `security.md`)
|
||||
- Format: `[domain].md`
|
||||
- If file exists, append to existing file
|
||||
- Number items sequentially starting from CHK001
|
||||
- Each `/speckit.checklist` run creates a NEW file (never overwrites existing checklists)
|
||||
|
||||
**CORE PRINCIPLE - Test the Requirements, Not the Implementation**:
|
||||
Every checklist item MUST evaluate the REQUIREMENTS THEMSELVES for:
|
||||
- **Completeness**: Are all necessary requirements present?
|
||||
- **Clarity**: Are requirements unambiguous and specific?
|
||||
- **Consistency**: Do requirements align with each other?
|
||||
- **Measurability**: Can requirements be objectively verified?
|
||||
- **Coverage**: Are all scenarios/edge cases addressed?
|
||||
|
||||
**Category Structure** - Group items by requirement quality dimensions:
|
||||
- **Requirement Completeness** (Are all necessary requirements documented?)
|
||||
- **Requirement Clarity** (Are requirements specific and unambiguous?)
|
||||
- **Requirement Consistency** (Do requirements align without conflicts?)
|
||||
- **Acceptance Criteria Quality** (Are success criteria measurable?)
|
||||
- **Scenario Coverage** (Are all flows/cases addressed?)
|
||||
- **Edge Case Coverage** (Are boundary conditions defined?)
|
||||
- **Non-Functional Requirements** (Performance, Security, Accessibility, etc. - are they specified?)
|
||||
- **Dependencies & Assumptions** (Are they documented and validated?)
|
||||
- **Ambiguities & Conflicts** (What needs clarification?)
|
||||
|
||||
**HOW TO WRITE CHECKLIST ITEMS - "Unit Tests for English"**:
|
||||
|
||||
❌ **WRONG** (Testing implementation):
|
||||
- "Verify landing page displays 3 episode cards"
|
||||
- "Test hover states work on desktop"
|
||||
- "Confirm logo click navigates home"
|
||||
|
||||
✅ **CORRECT** (Testing requirements quality):
|
||||
- "Are the exact number and layout of featured episodes specified?" [Completeness]
|
||||
- "Is 'prominent display' quantified with specific sizing/positioning?" [Clarity]
|
||||
- "Are hover state requirements consistent across all interactive elements?" [Consistency]
|
||||
- "Are keyboard navigation requirements defined for all interactive UI?" [Coverage]
|
||||
- "Is the fallback behavior specified when logo image fails to load?" [Edge Cases]
|
||||
- "Are loading states defined for asynchronous episode data?" [Completeness]
|
||||
- "Does the spec define visual hierarchy for competing UI elements?" [Clarity]
|
||||
|
||||
**ITEM STRUCTURE**:
|
||||
Each item should follow this pattern:
|
||||
- Question format asking about requirement quality
|
||||
- Focus on what's WRITTEN (or not written) in the spec/plan
|
||||
- Include quality dimension in brackets [Completeness/Clarity/Consistency/etc.]
|
||||
- Reference spec section `[Spec §X.Y]` when checking existing requirements
|
||||
- Use `[Gap]` marker when checking for missing requirements
|
||||
|
||||
**EXAMPLES BY QUALITY DIMENSION**:
|
||||
|
||||
Completeness:
|
||||
- "Are error handling requirements defined for all API failure modes? [Gap]"
|
||||
- "Are accessibility requirements specified for all interactive elements? [Completeness]"
|
||||
- "Are mobile breakpoint requirements defined for responsive layouts? [Gap]"
|
||||
|
||||
Clarity:
|
||||
- "Is 'fast loading' quantified with specific timing thresholds? [Clarity, Spec §NFR-2]"
|
||||
- "Are 'related episodes' selection criteria explicitly defined? [Clarity, Spec §FR-5]"
|
||||
- "Is 'prominent' defined with measurable visual properties? [Ambiguity, Spec §FR-4]"
|
||||
|
||||
Consistency:
|
||||
- "Do navigation requirements align across all pages? [Consistency, Spec §FR-10]"
|
||||
- "Are card component requirements consistent between landing and detail pages? [Consistency]"
|
||||
|
||||
Coverage:
|
||||
- "Are requirements defined for zero-state scenarios (no episodes)? [Coverage, Edge Case]"
|
||||
- "Are concurrent user interaction scenarios addressed? [Coverage, Gap]"
|
||||
- "Are requirements specified for partial data loading failures? [Coverage, Exception Flow]"
|
||||
|
||||
Measurability:
|
||||
- "Are visual hierarchy requirements measurable/testable? [Acceptance Criteria, Spec §FR-1]"
|
||||
- "Can 'balanced visual weight' be objectively verified? [Measurability, Spec §FR-2]"
|
||||
|
||||
**Scenario Classification & Coverage** (Requirements Quality Focus):
|
||||
- Check if requirements exist for: Primary, Alternate, Exception/Error, Recovery, Non-Functional scenarios
|
||||
- For each scenario class, ask: "Are [scenario type] requirements complete, clear, and consistent?"
|
||||
- If scenario class missing: "Are [scenario type] requirements intentionally excluded or missing? [Gap]"
|
||||
- Include resilience/rollback when state mutation occurs: "Are rollback requirements defined for migration failures? [Gap]"
|
||||
|
||||
**Traceability Requirements**:
|
||||
- MINIMUM: ≥80% of items MUST include at least one traceability reference
|
||||
- Each item should reference: spec section `[Spec §X.Y]`, or use markers: `[Gap]`, `[Ambiguity]`, `[Conflict]`, `[Assumption]`
|
||||
- If no ID system exists: "Is a requirement & acceptance criteria ID scheme established? [Traceability]"
|
||||
|
||||
**Surface & Resolve Issues** (Requirements Quality Problems):
|
||||
Ask questions about the requirements themselves:
|
||||
- Ambiguities: "Is the term 'fast' quantified with specific metrics? [Ambiguity, Spec §NFR-1]"
|
||||
- Conflicts: "Do navigation requirements conflict between §FR-10 and §FR-10a? [Conflict]"
|
||||
- Assumptions: "Is the assumption of 'always available podcast API' validated? [Assumption]"
|
||||
- Dependencies: "Are external podcast API requirements documented? [Dependency, Gap]"
|
||||
- Missing definitions: "Is 'visual hierarchy' defined with measurable criteria? [Gap]"
|
||||
|
||||
**Content Consolidation**:
|
||||
- Soft cap: If raw candidate items > 40, prioritize by risk/impact
|
||||
- Merge near-duplicates checking the same requirement aspect
|
||||
- If >5 low-impact edge cases, create one item: "Are edge cases X, Y, Z addressed in requirements? [Coverage]"
|
||||
|
||||
**🚫 ABSOLUTELY PROHIBITED** - These make it an implementation test, not a requirements test:
|
||||
- ❌ Any item starting with "Verify", "Test", "Confirm", "Check" + implementation behavior
|
||||
- ❌ References to code execution, user actions, system behavior
|
||||
- ❌ "Displays correctly", "works properly", "functions as expected"
|
||||
- ❌ "Click", "navigate", "render", "load", "execute"
|
||||
- ❌ Test cases, test plans, QA procedures
|
||||
- ❌ Implementation details (frameworks, APIs, algorithms)
|
||||
|
||||
**✅ REQUIRED PATTERNS** - These test requirements quality:
|
||||
- ✅ "Are [requirement type] defined/specified/documented for [scenario]?"
|
||||
- ✅ "Is [vague term] quantified/clarified with specific criteria?"
|
||||
- ✅ "Are requirements consistent between [section A] and [section B]?"
|
||||
- ✅ "Can [requirement] be objectively measured/verified?"
|
||||
- ✅ "Are [edge cases/scenarios] addressed in requirements?"
|
||||
- ✅ "Does the spec define [missing aspect]?"
|
||||
|
||||
6. **Structure Reference**: Generate the checklist following the canonical template in `.specify/templates/checklist-template.md` for title, meta section, category headings, and ID formatting. If template is unavailable, use: H1 title, purpose/created meta lines, `##` category sections containing `- [ ] CHK### <requirement item>` lines with globally incrementing IDs starting at CHK001.
|
||||
|
||||
7. **Report**: Output full path to created checklist, item count, and remind user that each run creates a new file. Summarize:
|
||||
- Focus areas selected
|
||||
- Depth level
|
||||
- Actor/timing
|
||||
- Any explicit user-specified must-have items incorporated
|
||||
|
||||
**Important**: Each `/speckit.checklist` command invocation creates a checklist file using short, descriptive names unless file already exists. This allows:
|
||||
|
||||
- Multiple checklists of different types (e.g., `ux.md`, `test.md`, `security.md`)
|
||||
- Simple, memorable filenames that indicate checklist purpose
|
||||
- Easy identification and navigation in the `checklists/` folder
|
||||
|
||||
To avoid clutter, use descriptive types and clean up obsolete checklists when done.
|
||||
|
||||
## Example Checklist Types & Sample Items
|
||||
|
||||
**UX Requirements Quality:** `ux.md`
|
||||
|
||||
Sample items (testing the requirements, NOT the implementation):
|
||||
|
||||
- "Are visual hierarchy requirements defined with measurable criteria? [Clarity, Spec §FR-1]"
|
||||
- "Is the number and positioning of UI elements explicitly specified? [Completeness, Spec §FR-1]"
|
||||
- "Are interaction state requirements (hover, focus, active) consistently defined? [Consistency]"
|
||||
- "Are accessibility requirements specified for all interactive elements? [Coverage, Gap]"
|
||||
- "Is fallback behavior defined when images fail to load? [Edge Case, Gap]"
|
||||
- "Can 'prominent display' be objectively measured? [Measurability, Spec §FR-4]"
|
||||
|
||||
**API Requirements Quality:** `api.md`
|
||||
|
||||
Sample items:
|
||||
|
||||
- "Are error response formats specified for all failure scenarios? [Completeness]"
|
||||
- "Are rate limiting requirements quantified with specific thresholds? [Clarity]"
|
||||
- "Are authentication requirements consistent across all endpoints? [Consistency]"
|
||||
- "Are retry/timeout requirements defined for external dependencies? [Coverage, Gap]"
|
||||
- "Is versioning strategy documented in requirements? [Gap]"
|
||||
|
||||
**Performance Requirements Quality:** `performance.md`
|
||||
|
||||
Sample items:
|
||||
|
||||
- "Are performance requirements quantified with specific metrics? [Clarity]"
|
||||
- "Are performance targets defined for all critical user journeys? [Coverage]"
|
||||
- "Are performance requirements under different load conditions specified? [Completeness]"
|
||||
- "Can performance requirements be objectively measured? [Measurability]"
|
||||
- "Are degradation requirements defined for high-load scenarios? [Edge Case, Gap]"
|
||||
|
||||
**Security Requirements Quality:** `security.md`
|
||||
|
||||
Sample items:
|
||||
|
||||
- "Are authentication requirements specified for all protected resources? [Coverage]"
|
||||
- "Are data protection requirements defined for sensitive information? [Completeness]"
|
||||
- "Is the threat model documented and requirements aligned to it? [Traceability]"
|
||||
- "Are security requirements consistent with compliance obligations? [Consistency]"
|
||||
- "Are security failure/breach response requirements defined? [Gap, Exception Flow]"
|
||||
|
||||
## Anti-Examples: What NOT To Do
|
||||
|
||||
**❌ WRONG - These test implementation, not requirements:**
|
||||
|
||||
```markdown
|
||||
- [ ] CHK001 - Verify landing page displays 3 episode cards [Spec §FR-001]
|
||||
- [ ] CHK002 - Test hover states work correctly on desktop [Spec §FR-003]
|
||||
- [ ] CHK003 - Confirm logo click navigates to home page [Spec §FR-010]
|
||||
- [ ] CHK004 - Check that related episodes section shows 3-5 items [Spec §FR-005]
|
||||
```
|
||||
|
||||
**✅ CORRECT - These test requirements quality:**
|
||||
|
||||
```markdown
|
||||
- [ ] CHK001 - Are the number and layout of featured episodes explicitly specified? [Completeness, Spec §FR-001]
|
||||
- [ ] CHK002 - Are hover state requirements consistently defined for all interactive elements? [Consistency, Spec §FR-003]
|
||||
- [ ] CHK003 - Are navigation requirements clear for all clickable brand elements? [Clarity, Spec §FR-010]
|
||||
- [ ] CHK004 - Is the selection criteria for related episodes documented? [Gap, Spec §FR-005]
|
||||
- [ ] CHK005 - Are loading state requirements defined for asynchronous episode data? [Gap]
|
||||
- [ ] CHK006 - Can "visual hierarchy" requirements be objectively measured? [Measurability, Spec §FR-001]
|
||||
```
|
||||
|
||||
**Key Differences:**
|
||||
|
||||
- Wrong: Tests if the system works correctly
|
||||
- Correct: Tests if the requirements are written correctly
|
||||
- Wrong: Verification of behavior
|
||||
- Correct: Validation of requirement quality
|
||||
- Wrong: "Does it do X?"
|
||||
- Correct: "Is X clearly specified?"
|
||||
181
.claude/commands/speckit.clarify.md
Normal file
181
.claude/commands/speckit.clarify.md
Normal file
@@ -0,0 +1,181 @@
|
||||
---
|
||||
description: Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding answers back into the spec.
|
||||
handoffs:
|
||||
- label: Build Technical Plan
|
||||
agent: speckit.plan
|
||||
prompt: Create a plan for the spec. I am building with...
|
||||
---
|
||||
|
||||
## User Input
|
||||
|
||||
```text
|
||||
$ARGUMENTS
|
||||
```
|
||||
|
||||
You **MUST** consider the user input before proceeding (if not empty).
|
||||
|
||||
## Outline
|
||||
|
||||
Goal: Detect and reduce ambiguity or missing decision points in the active feature specification and record the clarifications directly in the spec file.
|
||||
|
||||
Note: This clarification workflow is expected to run (and be completed) BEFORE invoking `/speckit.plan`. If the user explicitly states they are skipping clarification (e.g., exploratory spike), you may proceed, but must warn that downstream rework risk increases.
|
||||
|
||||
Execution steps:
|
||||
|
||||
1. Run `.specify/scripts/bash/check-prerequisites.sh --json --paths-only` from repo root **once** (combined `--json --paths-only` mode / `-Json -PathsOnly`). Parse minimal JSON payload fields:
|
||||
- `FEATURE_DIR`
|
||||
- `FEATURE_SPEC`
|
||||
- (Optionally capture `IMPL_PLAN`, `TASKS` for future chained flows.)
|
||||
- If JSON parsing fails, abort and instruct user to re-run `/speckit.specify` or verify feature branch environment.
|
||||
- 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").
|
||||
|
||||
2. Load the current spec file. Perform a structured ambiguity & coverage scan using this taxonomy. For each category, mark status: Clear / Partial / Missing. Produce an internal coverage map used for prioritization (do not output raw map unless no questions will be asked).
|
||||
|
||||
Functional Scope & Behavior:
|
||||
- Core user goals & success criteria
|
||||
- Explicit out-of-scope declarations
|
||||
- User roles / personas differentiation
|
||||
|
||||
Domain & Data Model:
|
||||
- Entities, attributes, relationships
|
||||
- Identity & uniqueness rules
|
||||
- Lifecycle/state transitions
|
||||
- Data volume / scale assumptions
|
||||
|
||||
Interaction & UX Flow:
|
||||
- Critical user journeys / sequences
|
||||
- Error/empty/loading states
|
||||
- Accessibility or localization notes
|
||||
|
||||
Non-Functional Quality Attributes:
|
||||
- Performance (latency, throughput targets)
|
||||
- Scalability (horizontal/vertical, limits)
|
||||
- Reliability & availability (uptime, recovery expectations)
|
||||
- Observability (logging, metrics, tracing signals)
|
||||
- Security & privacy (authN/Z, data protection, threat assumptions)
|
||||
- Compliance / regulatory constraints (if any)
|
||||
|
||||
Integration & External Dependencies:
|
||||
- External services/APIs and failure modes
|
||||
- Data import/export formats
|
||||
- Protocol/versioning assumptions
|
||||
|
||||
Edge Cases & Failure Handling:
|
||||
- Negative scenarios
|
||||
- Rate limiting / throttling
|
||||
- Conflict resolution (e.g., concurrent edits)
|
||||
|
||||
Constraints & Tradeoffs:
|
||||
- Technical constraints (language, storage, hosting)
|
||||
- Explicit tradeoffs or rejected alternatives
|
||||
|
||||
Terminology & Consistency:
|
||||
- Canonical glossary terms
|
||||
- Avoided synonyms / deprecated terms
|
||||
|
||||
Completion Signals:
|
||||
- Acceptance criteria testability
|
||||
- Measurable Definition of Done style indicators
|
||||
|
||||
Misc / Placeholders:
|
||||
- TODO markers / unresolved decisions
|
||||
- Ambiguous adjectives ("robust", "intuitive") lacking quantification
|
||||
|
||||
For each category with Partial or Missing status, add a candidate question opportunity unless:
|
||||
- Clarification would not materially change implementation or validation strategy
|
||||
- Information is better deferred to planning phase (note internally)
|
||||
|
||||
3. Generate (internally) a prioritized queue of candidate clarification questions (maximum 5). Do NOT output them all at once. Apply these constraints:
|
||||
- Maximum of 10 total questions across the whole session.
|
||||
- Each question must be answerable with EITHER:
|
||||
- A short multiple‑choice selection (2–5 distinct, mutually exclusive options), OR
|
||||
- A one-word / short‑phrase answer (explicitly constrain: "Answer in <=5 words").
|
||||
- Only include questions whose answers materially impact architecture, data modeling, task decomposition, test design, UX behavior, operational readiness, or compliance validation.
|
||||
- Ensure category coverage balance: attempt to cover the highest impact unresolved categories first; avoid asking two low-impact questions when a single high-impact area (e.g., security posture) is unresolved.
|
||||
- Exclude questions already answered, trivial stylistic preferences, or plan-level execution details (unless blocking correctness).
|
||||
- Favor clarifications that reduce downstream rework risk or prevent misaligned acceptance tests.
|
||||
- If more than 5 categories remain unresolved, select the top 5 by (Impact * Uncertainty) heuristic.
|
||||
|
||||
4. Sequential questioning loop (interactive):
|
||||
- Present EXACTLY ONE question at a time.
|
||||
- For multiple‑choice questions:
|
||||
- **Analyze all options** and determine the **most suitable option** based on:
|
||||
- Best practices for the project type
|
||||
- Common patterns in similar implementations
|
||||
- Risk reduction (security, performance, maintainability)
|
||||
- Alignment with any explicit project goals or constraints visible in the spec
|
||||
- Present your **recommended option prominently** at the top with clear reasoning (1-2 sentences explaining why this is the best choice).
|
||||
- Format as: `**Recommended:** Option [X] - <reasoning>`
|
||||
- Then render all options as a Markdown table:
|
||||
|
||||
| Option | Description |
|
||||
|--------|-------------|
|
||||
| A | <Option A description> |
|
||||
| B | <Option B description> |
|
||||
| C | <Option C description> (add D/E as needed up to 5) |
|
||||
| Short | Provide a different short answer (<=5 words) (Include only if free-form alternative is appropriate) |
|
||||
|
||||
- After the table, add: `You can reply with the option letter (e.g., "A"), accept the recommendation by saying "yes" or "recommended", or provide your own short answer.`
|
||||
- For short‑answer style (no meaningful discrete options):
|
||||
- Provide your **suggested answer** based on best practices and context.
|
||||
- Format as: `**Suggested:** <your proposed answer> - <brief reasoning>`
|
||||
- Then output: `Format: Short answer (<=5 words). You can accept the suggestion by saying "yes" or "suggested", or provide your own answer.`
|
||||
- After the user answers:
|
||||
- If the user replies with "yes", "recommended", or "suggested", use your previously stated recommendation/suggestion as the answer.
|
||||
- Otherwise, validate the answer maps to one option or fits the <=5 word constraint.
|
||||
- If ambiguous, ask for a quick disambiguation (count still belongs to same question; do not advance).
|
||||
- Once satisfactory, record it in working memory (do not yet write to disk) and move to the next queued question.
|
||||
- Stop asking further questions when:
|
||||
- All critical ambiguities resolved early (remaining queued items become unnecessary), OR
|
||||
- User signals completion ("done", "good", "no more"), OR
|
||||
- You reach 5 asked questions.
|
||||
- Never reveal future queued questions in advance.
|
||||
- If no valid questions exist at start, immediately report no critical ambiguities.
|
||||
|
||||
5. Integration after EACH accepted answer (incremental update approach):
|
||||
- Maintain in-memory representation of the spec (loaded once at start) plus the raw file contents.
|
||||
- For the first integrated answer in this session:
|
||||
- Ensure a `## Clarifications` section exists (create it just after the highest-level contextual/overview section per the spec template if missing).
|
||||
- Under it, create (if not present) a `### Session YYYY-MM-DD` subheading for today.
|
||||
- Append a bullet line immediately after acceptance: `- Q: <question> → A: <final answer>`.
|
||||
- Then immediately apply the clarification to the most appropriate section(s):
|
||||
- Functional ambiguity → Update or add a bullet in Functional Requirements.
|
||||
- User interaction / actor distinction → Update User Stories or Actors subsection (if present) with clarified role, constraint, or scenario.
|
||||
- Data shape / entities → Update Data Model (add fields, types, relationships) preserving ordering; note added constraints succinctly.
|
||||
- Non-functional constraint → Add/modify measurable criteria in Non-Functional / Quality Attributes section (convert vague adjective to metric or explicit target).
|
||||
- Edge case / negative flow → Add a new bullet under Edge Cases / Error Handling (or create such subsection if template provides placeholder for it).
|
||||
- Terminology conflict → Normalize term across spec; retain original only if necessary by adding `(formerly referred to as "X")` once.
|
||||
- If the clarification invalidates an earlier ambiguous statement, replace that statement instead of duplicating; leave no obsolete contradictory text.
|
||||
- Save the spec file AFTER each integration to minimize risk of context loss (atomic overwrite).
|
||||
- Preserve formatting: do not reorder unrelated sections; keep heading hierarchy intact.
|
||||
- Keep each inserted clarification minimal and testable (avoid narrative drift).
|
||||
|
||||
6. Validation (performed after EACH write plus final pass):
|
||||
- Clarifications session contains exactly one bullet per accepted answer (no duplicates).
|
||||
- Total asked (accepted) questions ≤ 5.
|
||||
- Updated sections contain no lingering vague placeholders the new answer was meant to resolve.
|
||||
- No contradictory earlier statement remains (scan for now-invalid alternative choices removed).
|
||||
- Markdown structure valid; only allowed new headings: `## Clarifications`, `### Session YYYY-MM-DD`.
|
||||
- Terminology consistency: same canonical term used across all updated sections.
|
||||
|
||||
7. Write the updated spec back to `FEATURE_SPEC`.
|
||||
|
||||
8. Report completion (after questioning loop ends or early termination):
|
||||
- Number of questions asked & answered.
|
||||
- Path to updated spec.
|
||||
- Sections touched (list names).
|
||||
- Coverage summary table listing each taxonomy category with Status: Resolved (was Partial/Missing and addressed), Deferred (exceeds question quota or better suited for planning), Clear (already sufficient), Outstanding (still Partial/Missing but low impact).
|
||||
- If any Outstanding or Deferred remain, recommend whether to proceed to `/speckit.plan` or run `/speckit.clarify` again later post-plan.
|
||||
- Suggested next command.
|
||||
|
||||
Behavior rules:
|
||||
|
||||
- If no meaningful ambiguities found (or all potential questions would be low-impact), respond: "No critical ambiguities detected worth formal clarification." and suggest proceeding.
|
||||
- If spec file missing, instruct user to run `/speckit.specify` first (do not create a new spec here).
|
||||
- Never exceed 5 total asked questions (clarification retries for a single question do not count as new questions).
|
||||
- Avoid speculative tech stack questions unless the absence blocks functional clarity.
|
||||
- Respect user early termination signals ("stop", "done", "proceed").
|
||||
- If no questions asked due to full coverage, output a compact coverage summary (all categories Clear) then suggest advancing.
|
||||
- If quota reached with unresolved high-impact categories remaining, explicitly flag them under Deferred with rationale.
|
||||
|
||||
Context for prioritization: $ARGUMENTS
|
||||
82
.claude/commands/speckit.constitution.md
Normal file
82
.claude/commands/speckit.constitution.md
Normal file
@@ -0,0 +1,82 @@
|
||||
---
|
||||
description: Create or update the project constitution from interactive or provided principle inputs, ensuring all dependent templates stay in sync.
|
||||
handoffs:
|
||||
- label: Build Specification
|
||||
agent: speckit.specify
|
||||
prompt: Implement the feature specification based on the updated constitution. I want to build...
|
||||
---
|
||||
|
||||
## User Input
|
||||
|
||||
```text
|
||||
$ARGUMENTS
|
||||
```
|
||||
|
||||
You **MUST** consider the user input before proceeding (if not empty).
|
||||
|
||||
## Outline
|
||||
|
||||
You are updating the project constitution at `.specify/memory/constitution.md`. This file is a TEMPLATE containing placeholder tokens in square brackets (e.g. `[PROJECT_NAME]`, `[PRINCIPLE_1_NAME]`). Your job is to (a) collect/derive concrete values, (b) fill the template precisely, and (c) propagate any amendments across dependent artifacts.
|
||||
|
||||
Follow this execution flow:
|
||||
|
||||
1. Load the existing constitution template at `.specify/memory/constitution.md`.
|
||||
- Identify every placeholder token of the form `[ALL_CAPS_IDENTIFIER]`.
|
||||
**IMPORTANT**: The user might require less or more principles than the ones used in the template. If a number is specified, respect that - follow the general template. You will update the doc accordingly.
|
||||
|
||||
2. Collect/derive values for placeholders:
|
||||
- If user input (conversation) supplies a value, use it.
|
||||
- Otherwise infer from existing repo context (README, docs, prior constitution versions if embedded).
|
||||
- For governance dates: `RATIFICATION_DATE` is the original adoption date (if unknown ask or mark TODO), `LAST_AMENDED_DATE` is today if changes are made, otherwise keep previous.
|
||||
- `CONSTITUTION_VERSION` must increment according to semantic versioning rules:
|
||||
- MAJOR: Backward incompatible governance/principle removals or redefinitions.
|
||||
- MINOR: New principle/section added or materially expanded guidance.
|
||||
- PATCH: Clarifications, wording, typo fixes, non-semantic refinements.
|
||||
- If version bump type ambiguous, propose reasoning before finalizing.
|
||||
|
||||
3. Draft the updated constitution content:
|
||||
- Replace every placeholder with concrete text (no bracketed tokens left except intentionally retained template slots that the project has chosen not to define yet—explicitly justify any left).
|
||||
- Preserve heading hierarchy and comments can be removed once replaced unless they still add clarifying guidance.
|
||||
- Ensure each Principle section: succinct name line, paragraph (or bullet list) capturing non‑negotiable rules, explicit rationale if not obvious.
|
||||
- Ensure Governance section lists amendment procedure, versioning policy, and compliance review expectations.
|
||||
|
||||
4. Consistency propagation checklist (convert prior checklist into active validations):
|
||||
- Read `.specify/templates/plan-template.md` and ensure any "Constitution Check" or rules align with updated principles.
|
||||
- Read `.specify/templates/spec-template.md` for scope/requirements alignment—update if constitution adds/removes mandatory sections or constraints.
|
||||
- Read `.specify/templates/tasks-template.md` and ensure task categorization reflects new or removed principle-driven task types (e.g., observability, versioning, testing discipline).
|
||||
- Read each command file in `.specify/templates/commands/*.md` (including this one) to verify no outdated references (agent-specific names like CLAUDE only) remain when generic guidance is required.
|
||||
- Read any runtime guidance docs (e.g., `README.md`, `docs/quickstart.md`, or agent-specific guidance files if present). Update references to principles changed.
|
||||
|
||||
5. Produce a Sync Impact Report (prepend as an HTML comment at top of the constitution file after update):
|
||||
- Version change: old → new
|
||||
- List of modified principles (old title → new title if renamed)
|
||||
- Added sections
|
||||
- Removed sections
|
||||
- Templates requiring updates (✅ updated / ⚠ pending) with file paths
|
||||
- Follow-up TODOs if any placeholders intentionally deferred.
|
||||
|
||||
6. Validation before final output:
|
||||
- No remaining unexplained bracket tokens.
|
||||
- Version line matches report.
|
||||
- Dates ISO format YYYY-MM-DD.
|
||||
- Principles are declarative, testable, and free of vague language ("should" → replace with MUST/SHOULD rationale where appropriate).
|
||||
|
||||
7. Write the completed constitution back to `.specify/memory/constitution.md` (overwrite).
|
||||
|
||||
8. Output a final summary to the user with:
|
||||
- New version and bump rationale.
|
||||
- Any files flagged for manual follow-up.
|
||||
- Suggested commit message (e.g., `docs: amend constitution to vX.Y.Z (principle additions + governance update)`).
|
||||
|
||||
Formatting & Style Requirements:
|
||||
|
||||
- Use Markdown headings exactly as in the template (do not demote/promote levels).
|
||||
- Wrap long rationale lines to keep readability (<100 chars ideally) but do not hard enforce with awkward breaks.
|
||||
- Keep a single blank line between sections.
|
||||
- Avoid trailing whitespace.
|
||||
|
||||
If the user supplies partial updates (e.g., only one principle revision), still perform validation and version decision steps.
|
||||
|
||||
If critical info missing (e.g., ratification date truly unknown), insert `TODO(<FIELD_NAME>): explanation` and include in the Sync Impact Report under deferred items.
|
||||
|
||||
Do not create a new template; always operate on the existing `.specify/memory/constitution.md` file.
|
||||
135
.claude/commands/speckit.implement.md
Normal file
135
.claude/commands/speckit.implement.md
Normal file
@@ -0,0 +1,135 @@
|
||||
---
|
||||
description: Execute the implementation plan by processing and executing all tasks defined in tasks.md
|
||||
---
|
||||
|
||||
## User Input
|
||||
|
||||
```text
|
||||
$ARGUMENTS
|
||||
```
|
||||
|
||||
You **MUST** consider the user input before proceeding (if not empty).
|
||||
|
||||
## Outline
|
||||
|
||||
1. Run `.specify/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks` 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").
|
||||
|
||||
2. **Check checklists status** (if FEATURE_DIR/checklists/ exists):
|
||||
- Scan all checklist files in the checklists/ directory
|
||||
- For each checklist, count:
|
||||
- Total items: All lines matching `- [ ]` or `- [X]` or `- [x]`
|
||||
- Completed items: Lines matching `- [X]` or `- [x]`
|
||||
- Incomplete items: Lines matching `- [ ]`
|
||||
- Create a status table:
|
||||
|
||||
```text
|
||||
| Checklist | Total | Completed | Incomplete | Status |
|
||||
|-----------|-------|-----------|------------|--------|
|
||||
| ux.md | 12 | 12 | 0 | ✓ PASS |
|
||||
| test.md | 8 | 5 | 3 | ✗ FAIL |
|
||||
| security.md | 6 | 6 | 0 | ✓ PASS |
|
||||
```
|
||||
|
||||
- Calculate overall status:
|
||||
- **PASS**: All checklists have 0 incomplete items
|
||||
- **FAIL**: One or more checklists have incomplete items
|
||||
|
||||
- **If any checklist is incomplete**:
|
||||
- Display the table with incomplete item counts
|
||||
- **STOP** and ask: "Some checklists are incomplete. Do you want to proceed with implementation anyway? (yes/no)"
|
||||
- Wait for user response before continuing
|
||||
- If user says "no" or "wait" or "stop", halt execution
|
||||
- If user says "yes" or "proceed" or "continue", proceed to step 3
|
||||
|
||||
- **If all checklists are complete**:
|
||||
- Display the table showing all checklists passed
|
||||
- Automatically proceed to step 3
|
||||
|
||||
3. Load and analyze the implementation context:
|
||||
- **REQUIRED**: Read tasks.md for the complete task list and execution plan
|
||||
- **REQUIRED**: Read plan.md for tech stack, architecture, and file structure
|
||||
- **IF EXISTS**: Read data-model.md for entities and relationships
|
||||
- **IF EXISTS**: Read contracts/ for API specifications and test requirements
|
||||
- **IF EXISTS**: Read research.md for technical decisions and constraints
|
||||
- **IF EXISTS**: Read quickstart.md for integration scenarios
|
||||
|
||||
4. **Project Setup Verification**:
|
||||
- **REQUIRED**: Create/verify ignore files based on actual project setup:
|
||||
|
||||
**Detection & Creation Logic**:
|
||||
- Check if the following command succeeds to determine if the repository is a git repo (create/verify .gitignore if so):
|
||||
|
||||
```sh
|
||||
git rev-parse --git-dir 2>/dev/null
|
||||
```
|
||||
|
||||
- Check if Dockerfile* exists or Docker in plan.md → create/verify .dockerignore
|
||||
- Check if .eslintrc* exists → create/verify .eslintignore
|
||||
- Check if eslint.config.* exists → ensure the config's `ignores` entries cover required patterns
|
||||
- Check if .prettierrc* exists → create/verify .prettierignore
|
||||
- Check if .npmrc or package.json exists → create/verify .npmignore (if publishing)
|
||||
- Check if terraform files (*.tf) exist → create/verify .terraformignore
|
||||
- Check if .helmignore needed (helm charts present) → create/verify .helmignore
|
||||
|
||||
**If ignore file already exists**: Verify it contains essential patterns, append missing critical patterns only
|
||||
**If ignore file missing**: Create with full pattern set for detected technology
|
||||
|
||||
**Common Patterns by Technology** (from plan.md tech stack):
|
||||
- **Node.js/JavaScript/TypeScript**: `node_modules/`, `dist/`, `build/`, `*.log`, `.env*`
|
||||
- **Python**: `__pycache__/`, `*.pyc`, `.venv/`, `venv/`, `dist/`, `*.egg-info/`
|
||||
- **Java**: `target/`, `*.class`, `*.jar`, `.gradle/`, `build/`
|
||||
- **C#/.NET**: `bin/`, `obj/`, `*.user`, `*.suo`, `packages/`
|
||||
- **Go**: `*.exe`, `*.test`, `vendor/`, `*.out`
|
||||
- **Ruby**: `.bundle/`, `log/`, `tmp/`, `*.gem`, `vendor/bundle/`
|
||||
- **PHP**: `vendor/`, `*.log`, `*.cache`, `*.env`
|
||||
- **Rust**: `target/`, `debug/`, `release/`, `*.rs.bk`, `*.rlib`, `*.prof*`, `.idea/`, `*.log`, `.env*`
|
||||
- **Kotlin**: `build/`, `out/`, `.gradle/`, `.idea/`, `*.class`, `*.jar`, `*.iml`, `*.log`, `.env*`
|
||||
- **C++**: `build/`, `bin/`, `obj/`, `out/`, `*.o`, `*.so`, `*.a`, `*.exe`, `*.dll`, `.idea/`, `*.log`, `.env*`
|
||||
- **C**: `build/`, `bin/`, `obj/`, `out/`, `*.o`, `*.a`, `*.so`, `*.exe`, `Makefile`, `config.log`, `.idea/`, `*.log`, `.env*`
|
||||
- **Swift**: `.build/`, `DerivedData/`, `*.swiftpm/`, `Packages/`
|
||||
- **R**: `.Rproj.user/`, `.Rhistory`, `.RData`, `.Ruserdata`, `*.Rproj`, `packrat/`, `renv/`
|
||||
- **Universal**: `.DS_Store`, `Thumbs.db`, `*.tmp`, `*.swp`, `.vscode/`, `.idea/`
|
||||
|
||||
**Tool-Specific Patterns**:
|
||||
- **Docker**: `node_modules/`, `.git/`, `Dockerfile*`, `.dockerignore`, `*.log*`, `.env*`, `coverage/`
|
||||
- **ESLint**: `node_modules/`, `dist/`, `build/`, `coverage/`, `*.min.js`
|
||||
- **Prettier**: `node_modules/`, `dist/`, `build/`, `coverage/`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`
|
||||
- **Terraform**: `.terraform/`, `*.tfstate*`, `*.tfvars`, `.terraform.lock.hcl`
|
||||
- **Kubernetes/k8s**: `*.secret.yaml`, `secrets/`, `.kube/`, `kubeconfig*`, `*.key`, `*.crt`
|
||||
|
||||
5. Parse tasks.md structure and extract:
|
||||
- **Task phases**: Setup, Tests, Core, Integration, Polish
|
||||
- **Task dependencies**: Sequential vs parallel execution rules
|
||||
- **Task details**: ID, description, file paths, parallel markers [P]
|
||||
- **Execution flow**: Order and dependency requirements
|
||||
|
||||
6. Execute implementation following the task plan:
|
||||
- **Phase-by-phase execution**: Complete each phase before moving to the next
|
||||
- **Respect dependencies**: Run sequential tasks in order, parallel tasks [P] can run together
|
||||
- **Follow TDD approach**: Execute test tasks before their corresponding implementation tasks
|
||||
- **File-based coordination**: Tasks affecting the same files must run sequentially
|
||||
- **Validation checkpoints**: Verify each phase completion before proceeding
|
||||
|
||||
7. Implementation execution rules:
|
||||
- **Setup first**: Initialize project structure, dependencies, configuration
|
||||
- **Tests before code**: If you need to write tests for contracts, entities, and integration scenarios
|
||||
- **Core development**: Implement models, services, CLI commands, endpoints
|
||||
- **Integration work**: Database connections, middleware, logging, external services
|
||||
- **Polish and validation**: Unit tests, performance optimization, documentation
|
||||
|
||||
8. Progress tracking and error handling:
|
||||
- Report progress after each completed task
|
||||
- Halt execution if any non-parallel task fails
|
||||
- For parallel tasks [P], continue with successful tasks, report failed ones
|
||||
- Provide clear error messages with context for debugging
|
||||
- Suggest next steps if implementation cannot proceed
|
||||
- **IMPORTANT** For completed tasks, make sure to mark the task off as [X] in the tasks file.
|
||||
|
||||
9. Completion validation:
|
||||
- Verify all required tasks are completed
|
||||
- Check that implemented features match the original specification
|
||||
- Validate that tests pass and coverage meets requirements
|
||||
- Confirm the implementation follows the technical plan
|
||||
- Report final status with summary of completed work
|
||||
|
||||
Note: This command assumes a complete task breakdown exists in tasks.md. If tasks are incomplete or missing, suggest running `/speckit.tasks` first to regenerate the task list.
|
||||
89
.claude/commands/speckit.plan.md
Normal file
89
.claude/commands/speckit.plan.md
Normal file
@@ -0,0 +1,89 @@
|
||||
---
|
||||
description: Execute the implementation planning workflow using the plan template to generate design artifacts.
|
||||
handoffs:
|
||||
- label: Create Tasks
|
||||
agent: speckit.tasks
|
||||
prompt: Break the plan into tasks
|
||||
send: true
|
||||
- label: Create Checklist
|
||||
agent: speckit.checklist
|
||||
prompt: Create a checklist for the following domain...
|
||||
---
|
||||
|
||||
## User Input
|
||||
|
||||
```text
|
||||
$ARGUMENTS
|
||||
```
|
||||
|
||||
You **MUST** consider the user input before proceeding (if not empty).
|
||||
|
||||
## Outline
|
||||
|
||||
1. **Setup**: Run `.specify/scripts/bash/setup-plan.sh --json` from repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH. 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").
|
||||
|
||||
2. **Load context**: Read FEATURE_SPEC and `.specify/memory/constitution.md`. Load IMPL_PLAN template (already copied).
|
||||
|
||||
3. **Execute plan workflow**: Follow the structure in IMPL_PLAN template to:
|
||||
- Fill Technical Context (mark unknowns as "NEEDS CLARIFICATION")
|
||||
- Fill Constitution Check section from constitution
|
||||
- Evaluate gates (ERROR if violations unjustified)
|
||||
- Phase 0: Generate research.md (resolve all NEEDS CLARIFICATION)
|
||||
- Phase 1: Generate data-model.md, contracts/, quickstart.md
|
||||
- Phase 1: Update agent context by running the agent script
|
||||
- Re-evaluate Constitution Check post-design
|
||||
|
||||
4. **Stop and report**: Command ends after Phase 2 planning. Report branch, IMPL_PLAN path, and generated artifacts.
|
||||
|
||||
## Phases
|
||||
|
||||
### Phase 0: Outline & Research
|
||||
|
||||
1. **Extract unknowns from Technical Context** above:
|
||||
- For each NEEDS CLARIFICATION → research task
|
||||
- For each dependency → best practices task
|
||||
- For each integration → patterns task
|
||||
|
||||
2. **Generate and dispatch research agents**:
|
||||
|
||||
```text
|
||||
For each unknown in Technical Context:
|
||||
Task: "Research {unknown} for {feature context}"
|
||||
For each technology choice:
|
||||
Task: "Find best practices for {tech} in {domain}"
|
||||
```
|
||||
|
||||
3. **Consolidate findings** in `research.md` using format:
|
||||
- Decision: [what was chosen]
|
||||
- Rationale: [why chosen]
|
||||
- Alternatives considered: [what else evaluated]
|
||||
|
||||
**Output**: research.md with all NEEDS CLARIFICATION resolved
|
||||
|
||||
### Phase 1: Design & Contracts
|
||||
|
||||
**Prerequisites:** `research.md` complete
|
||||
|
||||
1. **Extract entities from feature spec** → `data-model.md`:
|
||||
- Entity name, fields, relationships
|
||||
- Validation rules from requirements
|
||||
- State transitions if applicable
|
||||
|
||||
2. **Generate API contracts** from functional requirements:
|
||||
- For each user action → endpoint
|
||||
- Use standard REST/GraphQL patterns
|
||||
- Output OpenAPI/GraphQL schema to `/contracts/`
|
||||
|
||||
3. **Agent context update**:
|
||||
- Run `.specify/scripts/bash/update-agent-context.sh claude`
|
||||
- These scripts detect which AI agent is in use
|
||||
- Update the appropriate agent-specific context file
|
||||
- Add only new technology from current plan
|
||||
- Preserve manual additions between markers
|
||||
|
||||
**Output**: data-model.md, /contracts/*, quickstart.md, agent-specific file
|
||||
|
||||
## Key rules
|
||||
|
||||
- Use absolute paths
|
||||
- ERROR on gate failures or unresolved clarifications
|
||||
258
.claude/commands/speckit.specify.md
Normal file
258
.claude/commands/speckit.specify.md
Normal file
@@ -0,0 +1,258 @@
|
||||
---
|
||||
description: Create or update the feature specification from a natural language feature description.
|
||||
handoffs:
|
||||
- label: Build Technical Plan
|
||||
agent: speckit.plan
|
||||
prompt: Create a plan for the spec. I am building with...
|
||||
- label: Clarify Spec Requirements
|
||||
agent: speckit.clarify
|
||||
prompt: Clarify specification requirements
|
||||
send: true
|
||||
---
|
||||
|
||||
## User Input
|
||||
|
||||
```text
|
||||
$ARGUMENTS
|
||||
```
|
||||
|
||||
You **MUST** consider the user input before proceeding (if not empty).
|
||||
|
||||
## Outline
|
||||
|
||||
The text the user typed after `/speckit.specify` in the triggering message **is** the feature description. Assume you always have it available in this conversation even if `$ARGUMENTS` appears literally below. Do not ask the user to repeat it unless they provided an empty command.
|
||||
|
||||
Given that feature description, do this:
|
||||
|
||||
1. **Generate a concise short name** (2-4 words) for the branch:
|
||||
- Analyze the feature description and extract the most meaningful keywords
|
||||
- Create a 2-4 word short name that captures the essence of the feature
|
||||
- Use action-noun format when possible (e.g., "add-user-auth", "fix-payment-bug")
|
||||
- Preserve technical terms and acronyms (OAuth2, API, JWT, etc.)
|
||||
- Keep it concise but descriptive enough to understand the feature at a glance
|
||||
- Examples:
|
||||
- "I want to add user authentication" → "user-auth"
|
||||
- "Implement OAuth2 integration for the API" → "oauth2-api-integration"
|
||||
- "Create a dashboard for analytics" → "analytics-dashboard"
|
||||
- "Fix payment processing timeout bug" → "fix-payment-timeout"
|
||||
|
||||
2. **Check for existing branches before creating new one**:
|
||||
|
||||
a. First, fetch all remote branches to ensure we have the latest information:
|
||||
|
||||
```bash
|
||||
git fetch --all --prune
|
||||
```
|
||||
|
||||
b. Find the highest feature number across all sources for the short-name:
|
||||
- Remote branches: `git ls-remote --heads origin | grep -E 'refs/heads/[0-9]+-<short-name>$'`
|
||||
- Local branches: `git branch | grep -E '^[* ]*[0-9]+-<short-name>$'`
|
||||
- Specs directories: Check for directories matching `specs/[0-9]+-<short-name>`
|
||||
|
||||
c. Determine the next available number:
|
||||
- Extract all numbers from all three sources
|
||||
- Find the highest number N
|
||||
- Use N+1 for the new branch number
|
||||
|
||||
d. Run the script `.specify/scripts/bash/create-new-feature.sh --json "$ARGUMENTS"` with the calculated number and short-name:
|
||||
- Pass `--number N+1` and `--short-name "your-short-name"` along with the feature description
|
||||
- Bash example: `.specify/scripts/bash/create-new-feature.sh --json "$ARGUMENTS" --json --number 5 --short-name "user-auth" "Add user authentication"`
|
||||
- PowerShell example: `.specify/scripts/bash/create-new-feature.sh --json "$ARGUMENTS" -Json -Number 5 -ShortName "user-auth" "Add user authentication"`
|
||||
|
||||
**IMPORTANT**:
|
||||
- Check all three sources (remote branches, local branches, specs directories) to find the highest number
|
||||
- Only match branches/directories with the exact short-name pattern
|
||||
- If no existing branches/directories found with this short-name, start with number 1
|
||||
- You must only ever run this script once per feature
|
||||
- The JSON is provided in the terminal as output - always refer to it to get the actual content you're looking for
|
||||
- The JSON output will contain BRANCH_NAME and SPEC_FILE paths
|
||||
- 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")
|
||||
|
||||
3. Load `.specify/templates/spec-template.md` to understand required sections.
|
||||
|
||||
4. Follow this execution flow:
|
||||
|
||||
1. Parse user description from Input
|
||||
If empty: ERROR "No feature description provided"
|
||||
2. Extract key concepts from description
|
||||
Identify: actors, actions, data, constraints
|
||||
3. For unclear aspects:
|
||||
- Make informed guesses based on context and industry standards
|
||||
- Only mark with [NEEDS CLARIFICATION: specific question] if:
|
||||
- The choice significantly impacts feature scope or user experience
|
||||
- Multiple reasonable interpretations exist with different implications
|
||||
- No reasonable default exists
|
||||
- **LIMIT: Maximum 3 [NEEDS CLARIFICATION] markers total**
|
||||
- Prioritize clarifications by impact: scope > security/privacy > user experience > technical details
|
||||
4. Fill User Scenarios & Testing section
|
||||
If no clear user flow: ERROR "Cannot determine user scenarios"
|
||||
5. Generate Functional Requirements
|
||||
Each requirement must be testable
|
||||
Use reasonable defaults for unspecified details (document assumptions in Assumptions section)
|
||||
6. Define Success Criteria
|
||||
Create measurable, technology-agnostic outcomes
|
||||
Include both quantitative metrics (time, performance, volume) and qualitative measures (user satisfaction, task completion)
|
||||
Each criterion must be verifiable without implementation details
|
||||
7. Identify Key Entities (if data involved)
|
||||
8. Return: SUCCESS (spec ready for planning)
|
||||
|
||||
5. Write the specification to SPEC_FILE using the template structure, replacing placeholders with concrete details derived from the feature description (arguments) while preserving section order and headings.
|
||||
|
||||
6. **Specification Quality Validation**: After writing the initial spec, validate it against quality criteria:
|
||||
|
||||
a. **Create Spec Quality Checklist**: Generate a checklist file at `FEATURE_DIR/checklists/requirements.md` using the checklist template structure with these validation items:
|
||||
|
||||
```markdown
|
||||
# Specification Quality Checklist: [FEATURE NAME]
|
||||
|
||||
**Purpose**: Validate specification completeness and quality before proceeding to planning
|
||||
**Created**: [DATE]
|
||||
**Feature**: [Link to spec.md]
|
||||
|
||||
## Content Quality
|
||||
|
||||
- [ ] No implementation details (languages, frameworks, APIs)
|
||||
- [ ] Focused on user value and business needs
|
||||
- [ ] Written for non-technical stakeholders
|
||||
- [ ] All mandatory sections completed
|
||||
|
||||
## Requirement Completeness
|
||||
|
||||
- [ ] No [NEEDS CLARIFICATION] markers remain
|
||||
- [ ] Requirements are testable and unambiguous
|
||||
- [ ] Success criteria are measurable
|
||||
- [ ] Success criteria are technology-agnostic (no implementation details)
|
||||
- [ ] All acceptance scenarios are defined
|
||||
- [ ] Edge cases are identified
|
||||
- [ ] Scope is clearly bounded
|
||||
- [ ] Dependencies and assumptions identified
|
||||
|
||||
## Feature Readiness
|
||||
|
||||
- [ ] All functional requirements have clear acceptance criteria
|
||||
- [ ] User scenarios cover primary flows
|
||||
- [ ] Feature meets measurable outcomes defined in Success Criteria
|
||||
- [ ] No implementation details leak into specification
|
||||
|
||||
## Notes
|
||||
|
||||
- Items marked incomplete require spec updates before `/speckit.clarify` or `/speckit.plan`
|
||||
```
|
||||
|
||||
b. **Run Validation Check**: Review the spec against each checklist item:
|
||||
- For each item, determine if it passes or fails
|
||||
- Document specific issues found (quote relevant spec sections)
|
||||
|
||||
c. **Handle Validation Results**:
|
||||
|
||||
- **If all items pass**: Mark checklist complete and proceed to step 6
|
||||
|
||||
- **If items fail (excluding [NEEDS CLARIFICATION])**:
|
||||
1. List the failing items and specific issues
|
||||
2. Update the spec to address each issue
|
||||
3. Re-run validation until all items pass (max 3 iterations)
|
||||
4. If still failing after 3 iterations, document remaining issues in checklist notes and warn user
|
||||
|
||||
- **If [NEEDS CLARIFICATION] markers remain**:
|
||||
1. Extract all [NEEDS CLARIFICATION: ...] markers from the spec
|
||||
2. **LIMIT CHECK**: If more than 3 markers exist, keep only the 3 most critical (by scope/security/UX impact) and make informed guesses for the rest
|
||||
3. For each clarification needed (max 3), present options to user in this format:
|
||||
|
||||
```markdown
|
||||
## Question [N]: [Topic]
|
||||
|
||||
**Context**: [Quote relevant spec section]
|
||||
|
||||
**What we need to know**: [Specific question from NEEDS CLARIFICATION marker]
|
||||
|
||||
**Suggested Answers**:
|
||||
|
||||
| Option | Answer | Implications |
|
||||
|--------|--------|--------------|
|
||||
| A | [First suggested answer] | [What this means for the feature] |
|
||||
| B | [Second suggested answer] | [What this means for the feature] |
|
||||
| C | [Third suggested answer] | [What this means for the feature] |
|
||||
| Custom | Provide your own answer | [Explain how to provide custom input] |
|
||||
|
||||
**Your choice**: _[Wait for user response]_
|
||||
```
|
||||
|
||||
4. **CRITICAL - Table Formatting**: Ensure markdown tables are properly formatted:
|
||||
- Use consistent spacing with pipes aligned
|
||||
- Each cell should have spaces around content: `| Content |` not `|Content|`
|
||||
- Header separator must have at least 3 dashes: `|--------|`
|
||||
- Test that the table renders correctly in markdown preview
|
||||
5. Number questions sequentially (Q1, Q2, Q3 - max 3 total)
|
||||
6. Present all questions together before waiting for responses
|
||||
7. Wait for user to respond with their choices for all questions (e.g., "Q1: A, Q2: Custom - [details], Q3: B")
|
||||
8. Update the spec by replacing each [NEEDS CLARIFICATION] marker with the user's selected or provided answer
|
||||
9. Re-run validation after all clarifications are resolved
|
||||
|
||||
d. **Update Checklist**: After each validation iteration, update the checklist file with current pass/fail status
|
||||
|
||||
7. Report completion with branch name, spec file path, checklist results, and readiness for the next phase (`/speckit.clarify` or `/speckit.plan`).
|
||||
|
||||
**NOTE:** The script creates and checks out the new branch and initializes the spec file before writing.
|
||||
|
||||
## General Guidelines
|
||||
|
||||
## Quick Guidelines
|
||||
|
||||
- Focus on **WHAT** users need and **WHY**.
|
||||
- Avoid HOW to implement (no tech stack, APIs, code structure).
|
||||
- Written for business stakeholders, not developers.
|
||||
- DO NOT create any checklists that are embedded in the spec. That will be a separate command.
|
||||
|
||||
### Section Requirements
|
||||
|
||||
- **Mandatory sections**: Must be completed for every feature
|
||||
- **Optional sections**: Include only when relevant to the feature
|
||||
- When a section doesn't apply, remove it entirely (don't leave as "N/A")
|
||||
|
||||
### For AI Generation
|
||||
|
||||
When creating this spec from a user prompt:
|
||||
|
||||
1. **Make informed guesses**: Use context, industry standards, and common patterns to fill gaps
|
||||
2. **Document assumptions**: Record reasonable defaults in the Assumptions section
|
||||
3. **Limit clarifications**: Maximum 3 [NEEDS CLARIFICATION] markers - use only for critical decisions that:
|
||||
- Significantly impact feature scope or user experience
|
||||
- Have multiple reasonable interpretations with different implications
|
||||
- Lack any reasonable default
|
||||
4. **Prioritize clarifications**: scope > security/privacy > user experience > technical details
|
||||
5. **Think like a tester**: Every vague requirement should fail the "testable and unambiguous" checklist item
|
||||
6. **Common areas needing clarification** (only if no reasonable default exists):
|
||||
- Feature scope and boundaries (include/exclude specific use cases)
|
||||
- User types and permissions (if multiple conflicting interpretations possible)
|
||||
- Security/compliance requirements (when legally/financially significant)
|
||||
|
||||
**Examples of reasonable defaults** (don't ask about these):
|
||||
|
||||
- Data retention: Industry-standard practices for the domain
|
||||
- Performance targets: Standard web/mobile app expectations unless specified
|
||||
- Error handling: User-friendly messages with appropriate fallbacks
|
||||
- Authentication method: Standard session-based or OAuth2 for web apps
|
||||
- Integration patterns: RESTful APIs unless specified otherwise
|
||||
|
||||
### Success Criteria Guidelines
|
||||
|
||||
Success criteria must be:
|
||||
|
||||
1. **Measurable**: Include specific metrics (time, percentage, count, rate)
|
||||
2. **Technology-agnostic**: No mention of frameworks, languages, databases, or tools
|
||||
3. **User-focused**: Describe outcomes from user/business perspective, not system internals
|
||||
4. **Verifiable**: Can be tested/validated without knowing implementation details
|
||||
|
||||
**Good examples**:
|
||||
|
||||
- "Users can complete checkout in under 3 minutes"
|
||||
- "System supports 10,000 concurrent users"
|
||||
- "95% of searches return results in under 1 second"
|
||||
- "Task completion rate improves by 40%"
|
||||
|
||||
**Bad examples** (implementation-focused):
|
||||
|
||||
- "API response time is under 200ms" (too technical, use "Users see results instantly")
|
||||
- "Database can handle 1000 TPS" (implementation detail, use user-facing metric)
|
||||
- "React components render efficiently" (framework-specific)
|
||||
- "Redis cache hit rate above 80%" (technology-specific)
|
||||
137
.claude/commands/speckit.tasks.md
Normal file
137
.claude/commands/speckit.tasks.md
Normal file
@@ -0,0 +1,137 @@
|
||||
---
|
||||
description: Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts.
|
||||
handoffs:
|
||||
- label: Analyze For Consistency
|
||||
agent: speckit.analyze
|
||||
prompt: Run a project analysis for consistency
|
||||
send: true
|
||||
- label: Implement Project
|
||||
agent: speckit.implement
|
||||
prompt: Start the implementation in phases
|
||||
send: true
|
||||
---
|
||||
|
||||
## User Input
|
||||
|
||||
```text
|
||||
$ARGUMENTS
|
||||
```
|
||||
|
||||
You **MUST** consider the user input before proceeding (if not empty).
|
||||
|
||||
## Outline
|
||||
|
||||
1. **Setup**: Run `.specify/scripts/bash/check-prerequisites.sh --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").
|
||||
|
||||
2. **Load design documents**: Read from FEATURE_DIR:
|
||||
- **Required**: plan.md (tech stack, libraries, structure), spec.md (user stories with priorities)
|
||||
- **Optional**: data-model.md (entities), contracts/ (API endpoints), research.md (decisions), quickstart.md (test scenarios)
|
||||
- Note: Not all projects have all documents. Generate tasks based on what's available.
|
||||
|
||||
3. **Execute task generation workflow**:
|
||||
- Load plan.md and extract tech stack, libraries, project structure
|
||||
- Load spec.md and extract user stories with their priorities (P1, P2, P3, etc.)
|
||||
- If data-model.md exists: Extract entities and map to user stories
|
||||
- If contracts/ exists: Map endpoints to user stories
|
||||
- If research.md exists: Extract decisions for setup tasks
|
||||
- Generate tasks organized by user story (see Task Generation Rules below)
|
||||
- Generate dependency graph showing user story completion order
|
||||
- Create parallel execution examples per user story
|
||||
- Validate task completeness (each user story has all needed tasks, independently testable)
|
||||
|
||||
4. **Generate tasks.md**: Use `.specify/templates/tasks-template.md` as structure, fill with:
|
||||
- Correct feature name from plan.md
|
||||
- Phase 1: Setup tasks (project initialization)
|
||||
- Phase 2: Foundational tasks (blocking prerequisites for all user stories)
|
||||
- Phase 3+: One phase per user story (in priority order from spec.md)
|
||||
- Each phase includes: story goal, independent test criteria, tests (if requested), implementation tasks
|
||||
- Final Phase: Polish & cross-cutting concerns
|
||||
- All tasks must follow the strict checklist format (see Task Generation Rules below)
|
||||
- Clear file paths for each task
|
||||
- Dependencies section showing story completion order
|
||||
- Parallel execution examples per story
|
||||
- Implementation strategy section (MVP first, incremental delivery)
|
||||
|
||||
5. **Report**: Output path to generated tasks.md and summary:
|
||||
- Total task count
|
||||
- Task count per user story
|
||||
- Parallel opportunities identified
|
||||
- Independent test criteria for each story
|
||||
- Suggested MVP scope (typically just User Story 1)
|
||||
- Format validation: Confirm ALL tasks follow the checklist format (checkbox, ID, labels, file paths)
|
||||
|
||||
Context for task generation: $ARGUMENTS
|
||||
|
||||
The tasks.md should be immediately executable - each task must be specific enough that an LLM can complete it without additional context.
|
||||
|
||||
## Task Generation Rules
|
||||
|
||||
**CRITICAL**: Tasks MUST be organized by user story to enable independent implementation and testing.
|
||||
|
||||
**Tests are OPTIONAL**: Only generate test tasks if explicitly requested in the feature specification or if user requests TDD approach.
|
||||
|
||||
### Checklist Format (REQUIRED)
|
||||
|
||||
Every task MUST strictly follow this format:
|
||||
|
||||
```text
|
||||
- [ ] [TaskID] [P?] [Story?] Description with file path
|
||||
```
|
||||
|
||||
**Format Components**:
|
||||
|
||||
1. **Checkbox**: ALWAYS start with `- [ ]` (markdown checkbox)
|
||||
2. **Task ID**: Sequential number (T001, T002, T003...) in execution order
|
||||
3. **[P] marker**: Include ONLY if task is parallelizable (different files, no dependencies on incomplete tasks)
|
||||
4. **[Story] label**: REQUIRED for user story phase tasks only
|
||||
- Format: [US1], [US2], [US3], etc. (maps to user stories from spec.md)
|
||||
- Setup phase: NO story label
|
||||
- Foundational phase: NO story label
|
||||
- User Story phases: MUST have story label
|
||||
- Polish phase: NO story label
|
||||
5. **Description**: Clear action with exact file path
|
||||
|
||||
**Examples**:
|
||||
|
||||
- ✅ CORRECT: `- [ ] T001 Create project structure per implementation plan`
|
||||
- ✅ CORRECT: `- [ ] T005 [P] Implement authentication middleware in src/middleware/auth.py`
|
||||
- ✅ CORRECT: `- [ ] T012 [P] [US1] Create User model in src/models/user.py`
|
||||
- ✅ CORRECT: `- [ ] T014 [US1] Implement UserService in src/services/user_service.py`
|
||||
- ❌ WRONG: `- [ ] Create User model` (missing ID and Story label)
|
||||
- ❌ WRONG: `T001 [US1] Create model` (missing checkbox)
|
||||
- ❌ WRONG: `- [ ] [US1] Create User model` (missing Task ID)
|
||||
- ❌ WRONG: `- [ ] T001 [US1] Create model` (missing file path)
|
||||
|
||||
### Task Organization
|
||||
|
||||
1. **From User Stories (spec.md)** - PRIMARY ORGANIZATION:
|
||||
- Each user story (P1, P2, P3...) gets its own phase
|
||||
- Map all related components to their story:
|
||||
- Models needed for that story
|
||||
- Services needed for that story
|
||||
- Endpoints/UI needed for that story
|
||||
- If tests requested: Tests specific to that story
|
||||
- Mark story dependencies (most stories should be independent)
|
||||
|
||||
2. **From Contracts**:
|
||||
- Map each contract/endpoint → to the user story it serves
|
||||
- If tests requested: Each contract → contract test task [P] before implementation in that story's phase
|
||||
|
||||
3. **From Data Model**:
|
||||
- Map each entity to the user story(ies) that need it
|
||||
- If entity serves multiple stories: Put in earliest story or Setup phase
|
||||
- Relationships → service layer tasks in appropriate story phase
|
||||
|
||||
4. **From Setup/Infrastructure**:
|
||||
- Shared infrastructure → Setup phase (Phase 1)
|
||||
- Foundational/blocking tasks → Foundational phase (Phase 2)
|
||||
- Story-specific setup → within that story's phase
|
||||
|
||||
### Phase Structure
|
||||
|
||||
- **Phase 1**: Setup (project initialization)
|
||||
- **Phase 2**: Foundational (blocking prerequisites - MUST complete before user stories)
|
||||
- **Phase 3+**: User Stories in priority order (P1, P2, P3...)
|
||||
- Within each story: Tests (if requested) → Models → Services → Endpoints → Integration
|
||||
- Each phase should be a complete, independently testable increment
|
||||
- **Final Phase**: Polish & Cross-Cutting Concerns
|
||||
30
.claude/commands/speckit.taskstoissues.md
Normal file
30
.claude/commands/speckit.taskstoissues.md
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
description: Convert existing tasks into actionable, dependency-ordered GitHub issues for the feature based on available design artifacts.
|
||||
tools: ['github/github-mcp-server/issue_write']
|
||||
---
|
||||
|
||||
## User Input
|
||||
|
||||
```text
|
||||
$ARGUMENTS
|
||||
```
|
||||
|
||||
You **MUST** consider the user input before proceeding (if not empty).
|
||||
|
||||
## Outline
|
||||
|
||||
1. Run `.specify/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks` 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").
|
||||
1. From the executed script, extract the path to **tasks**.
|
||||
1. Get the Git remote by running:
|
||||
|
||||
```bash
|
||||
git config --get remote.origin.url
|
||||
```
|
||||
|
||||
> [!CAUTION]
|
||||
> ONLY PROCEED TO NEXT STEPS IF THE REMOTE IS A GITHUB URL
|
||||
|
||||
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.
|
||||
|
||||
> [!CAUTION]
|
||||
> UNDER NO CIRCUMSTANCES EVER CREATE ISSUES IN REPOSITORIES THAT DO NOT MATCH THE REMOTE URL
|
||||
49
.gitignore
vendored
Normal file
49
.gitignore
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# Virtual environments
|
||||
.venv/
|
||||
venv/
|
||||
ENV/
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
.vscode/
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# Testing
|
||||
.pytest_cache/
|
||||
.coverage
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
|
||||
# Schedule files
|
||||
schedules/
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
|
||||
.claude/skills/
|
||||
8
.mcp.json
Normal file
8
.mcp.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"xer-mcp": {
|
||||
"command": "uv",
|
||||
"args": ["run", "python", "-m", "xer_mcp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
1
.python-version
Normal file
1
.python-version
Normal file
@@ -0,0 +1 @@
|
||||
3.14
|
||||
133
.specify/memory/constitution.md
Normal file
133
.specify/memory/constitution.md
Normal file
@@ -0,0 +1,133 @@
|
||||
<!--
|
||||
SYNC IMPACT REPORT
|
||||
==================
|
||||
Version change: 1.0.0 → 1.0.1 (Technical standards update)
|
||||
|
||||
Modified principles: None
|
||||
|
||||
Modified sections:
|
||||
- Technical Standards: Python version 3.11+ → 3.14
|
||||
|
||||
Added sections: None
|
||||
Removed sections: None
|
||||
|
||||
Templates requiring updates:
|
||||
- .specify/templates/plan-template.md: ✅ No update needed
|
||||
- .specify/templates/spec-template.md: ✅ No update needed
|
||||
- .specify/templates/tasks-template.md: ✅ No update needed
|
||||
- .specify/templates/checklist-template.md: ✅ No update needed
|
||||
|
||||
Follow-up TODOs: None
|
||||
-->
|
||||
|
||||
# XER MCP Server Constitution
|
||||
|
||||
## Core Principles
|
||||
|
||||
### I. Test-First Development (NON-NEGOTIABLE)
|
||||
|
||||
Test-Driven Development is mandatory for all feature implementation. Tests MUST be written and verified to fail before any implementation code is written.
|
||||
|
||||
**Requirements**:
|
||||
- Red-Green-Refactor cycle strictly enforced
|
||||
- Tests MUST fail before implementation begins
|
||||
- No feature is complete until tests pass
|
||||
- Contract tests required for all MCP tool endpoints
|
||||
- Integration tests required for XER parsing workflows
|
||||
|
||||
**Rationale**: TDD ensures correctness, documents behavior, and prevents regressions. For an MCP server handling complex XER data, test coverage is essential to maintain reliability.
|
||||
|
||||
### II. Extensibility Architecture
|
||||
|
||||
The system MUST be designed for extension through well-defined interfaces and plugin points. Future capabilities MUST be addable without modifying core components.
|
||||
|
||||
**Requirements**:
|
||||
- Core parsing logic separated from MCP transport layer
|
||||
- XER table handlers MUST be pluggable
|
||||
- New MCP tools MUST be addable without core changes
|
||||
- Configuration MUST support extension points
|
||||
- Abstract base classes MUST define extension contracts
|
||||
|
||||
**Rationale**: XER files contain many table types, and the MCP protocol evolves. Extensibility ensures the server can grow to handle new requirements without architectural rewrites.
|
||||
|
||||
### III. MCP Protocol Compliance
|
||||
|
||||
All MCP server implementations MUST strictly comply with the Model Context Protocol specification. Non-compliant behavior is a blocking defect.
|
||||
|
||||
**Requirements**:
|
||||
- All tool definitions MUST include complete JSON schemas
|
||||
- Error responses MUST follow MCP error format
|
||||
- Resource URIs MUST follow MCP conventions
|
||||
- Transport layer MUST handle all MCP message types
|
||||
- Capability negotiation MUST be implemented correctly
|
||||
|
||||
**Rationale**: MCP clients expect compliant servers. Protocol deviations cause integration failures and break the fundamental contract with AI assistants.
|
||||
|
||||
### IV. XER Format Fidelity
|
||||
|
||||
XER file parsing MUST preserve data integrity and accurately represent Primavera P6 project data. No data loss or corruption is acceptable.
|
||||
|
||||
**Requirements**:
|
||||
- All standard XER table types MUST be recognized
|
||||
- Field mappings MUST match P6 export specifications
|
||||
- Date/time values MUST preserve timezone information
|
||||
- Numeric precision MUST be maintained
|
||||
- Unknown tables MUST be preserved, not discarded
|
||||
|
||||
**Rationale**: XER files represent critical project schedules. Data loss or misinterpretation can have serious business consequences for construction and engineering projects.
|
||||
|
||||
### V. Semantic Versioning
|
||||
|
||||
All releases MUST follow Semantic Versioning (MAJOR.MINOR.PATCH). Breaking changes MUST increment MAJOR version and include migration guidance.
|
||||
|
||||
**Requirements**:
|
||||
- MAJOR: Breaking API changes, removed MCP tools, incompatible schema changes
|
||||
- MINOR: New features, new MCP tools, backward-compatible additions
|
||||
- PATCH: Bug fixes, documentation, non-functional improvements
|
||||
- Breaking changes MUST be documented with migration paths
|
||||
- Deprecations MUST be announced one MINOR version before removal
|
||||
|
||||
**Rationale**: Consumers of MCP servers need predictable upgrade paths. SemVer provides clear expectations about compatibility and change impact.
|
||||
|
||||
## Technical Standards
|
||||
|
||||
**Language**: Python 3.14
|
||||
**Type Checking**: Type hints MUST be used throughout; mypy or equivalent MUST pass
|
||||
**Formatting**: Code MUST conform to project linter/formatter (e.g., ruff, black)
|
||||
**Dependencies**: MUST be pinned to specific versions in requirements files
|
||||
**Logging**: Console logging for debugging; structured format preferred
|
||||
|
||||
## Development Workflow
|
||||
|
||||
**Branch Strategy**: Feature branches MUST be created for all non-trivial changes
|
||||
**Code Review**: All changes MUST be reviewed before merge to main
|
||||
**Testing Gates**:
|
||||
- Unit tests MUST pass
|
||||
- Contract tests MUST pass for MCP tools
|
||||
- Integration tests MUST pass for XER parsing
|
||||
|
||||
**Documentation**:
|
||||
- Public APIs MUST have docstrings
|
||||
- MCP tools MUST have usage examples
|
||||
- Breaking changes MUST update migration docs
|
||||
|
||||
## Governance
|
||||
|
||||
This constitution supersedes all other development practices for the XER MCP Server project. When conflicts arise, this document takes precedence.
|
||||
|
||||
**Amendment Process**:
|
||||
1. Proposed amendments MUST be documented with rationale
|
||||
2. Amendments MUST be reviewed and approved
|
||||
3. Version MUST be incremented according to change type:
|
||||
- MAJOR: Principle removal or fundamental redefinition
|
||||
- MINOR: New principle or significant expansion
|
||||
- PATCH: Clarifications and wording improvements
|
||||
4. All dependent templates MUST be reviewed for consistency
|
||||
|
||||
**Compliance Review**:
|
||||
- All PRs MUST verify compliance with core principles
|
||||
- TDD violations are blocking defects
|
||||
- MCP protocol deviations are blocking defects
|
||||
- Constitution Check in plan.md MUST be completed before implementation
|
||||
|
||||
**Version**: 1.0.1 | **Ratified**: 2026-01-06 | **Last Amended**: 2026-01-06
|
||||
166
.specify/scripts/bash/check-prerequisites.sh
Executable file
166
.specify/scripts/bash/check-prerequisites.sh
Executable file
@@ -0,0 +1,166 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Consolidated prerequisite checking script
|
||||
#
|
||||
# This script provides unified prerequisite checking for Spec-Driven Development workflow.
|
||||
# It replaces the functionality previously spread across multiple scripts.
|
||||
#
|
||||
# Usage: ./check-prerequisites.sh [OPTIONS]
|
||||
#
|
||||
# OPTIONS:
|
||||
# --json Output in JSON format
|
||||
# --require-tasks Require tasks.md to exist (for implementation phase)
|
||||
# --include-tasks Include tasks.md in AVAILABLE_DOCS list
|
||||
# --paths-only Only output path variables (no validation)
|
||||
# --help, -h Show help message
|
||||
#
|
||||
# OUTPUTS:
|
||||
# JSON mode: {"FEATURE_DIR":"...", "AVAILABLE_DOCS":["..."]}
|
||||
# Text mode: FEATURE_DIR:... \n AVAILABLE_DOCS: \n ✓/✗ file.md
|
||||
# Paths only: REPO_ROOT: ... \n BRANCH: ... \n FEATURE_DIR: ... etc.
|
||||
|
||||
set -e
|
||||
|
||||
# Parse command line arguments
|
||||
JSON_MODE=false
|
||||
REQUIRE_TASKS=false
|
||||
INCLUDE_TASKS=false
|
||||
PATHS_ONLY=false
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--json)
|
||||
JSON_MODE=true
|
||||
;;
|
||||
--require-tasks)
|
||||
REQUIRE_TASKS=true
|
||||
;;
|
||||
--include-tasks)
|
||||
INCLUDE_TASKS=true
|
||||
;;
|
||||
--paths-only)
|
||||
PATHS_ONLY=true
|
||||
;;
|
||||
--help|-h)
|
||||
cat << 'EOF'
|
||||
Usage: check-prerequisites.sh [OPTIONS]
|
||||
|
||||
Consolidated prerequisite checking for Spec-Driven Development workflow.
|
||||
|
||||
OPTIONS:
|
||||
--json Output in JSON format
|
||||
--require-tasks Require tasks.md to exist (for implementation phase)
|
||||
--include-tasks Include tasks.md in AVAILABLE_DOCS list
|
||||
--paths-only Only output path variables (no prerequisite validation)
|
||||
--help, -h Show this help message
|
||||
|
||||
EXAMPLES:
|
||||
# Check task prerequisites (plan.md required)
|
||||
./check-prerequisites.sh --json
|
||||
|
||||
# Check implementation prerequisites (plan.md + tasks.md required)
|
||||
./check-prerequisites.sh --json --require-tasks --include-tasks
|
||||
|
||||
# Get feature paths only (no validation)
|
||||
./check-prerequisites.sh --paths-only
|
||||
|
||||
EOF
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Unknown option '$arg'. Use --help for usage information." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Source common functions
|
||||
SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/common.sh"
|
||||
|
||||
# Get feature paths and validate branch
|
||||
eval $(get_feature_paths)
|
||||
check_feature_branch "$CURRENT_BRANCH" "$HAS_GIT" || exit 1
|
||||
|
||||
# If paths-only mode, output paths and exit (support JSON + paths-only combined)
|
||||
if $PATHS_ONLY; then
|
||||
if $JSON_MODE; then
|
||||
# Minimal JSON paths payload (no validation performed)
|
||||
printf '{"REPO_ROOT":"%s","BRANCH":"%s","FEATURE_DIR":"%s","FEATURE_SPEC":"%s","IMPL_PLAN":"%s","TASKS":"%s"}\n' \
|
||||
"$REPO_ROOT" "$CURRENT_BRANCH" "$FEATURE_DIR" "$FEATURE_SPEC" "$IMPL_PLAN" "$TASKS"
|
||||
else
|
||||
echo "REPO_ROOT: $REPO_ROOT"
|
||||
echo "BRANCH: $CURRENT_BRANCH"
|
||||
echo "FEATURE_DIR: $FEATURE_DIR"
|
||||
echo "FEATURE_SPEC: $FEATURE_SPEC"
|
||||
echo "IMPL_PLAN: $IMPL_PLAN"
|
||||
echo "TASKS: $TASKS"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Validate required directories and files
|
||||
if [[ ! -d "$FEATURE_DIR" ]]; then
|
||||
echo "ERROR: Feature directory not found: $FEATURE_DIR" >&2
|
||||
echo "Run /speckit.specify first to create the feature structure." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$IMPL_PLAN" ]]; then
|
||||
echo "ERROR: plan.md not found in $FEATURE_DIR" >&2
|
||||
echo "Run /speckit.plan first to create the implementation plan." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for tasks.md if required
|
||||
if $REQUIRE_TASKS && [[ ! -f "$TASKS" ]]; then
|
||||
echo "ERROR: tasks.md not found in $FEATURE_DIR" >&2
|
||||
echo "Run /speckit.tasks first to create the task list." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build list of available documents
|
||||
docs=()
|
||||
|
||||
# Always check these optional docs
|
||||
[[ -f "$RESEARCH" ]] && docs+=("research.md")
|
||||
[[ -f "$DATA_MODEL" ]] && docs+=("data-model.md")
|
||||
|
||||
# Check contracts directory (only if it exists and has files)
|
||||
if [[ -d "$CONTRACTS_DIR" ]] && [[ -n "$(ls -A "$CONTRACTS_DIR" 2>/dev/null)" ]]; then
|
||||
docs+=("contracts/")
|
||||
fi
|
||||
|
||||
[[ -f "$QUICKSTART" ]] && docs+=("quickstart.md")
|
||||
|
||||
# Include tasks.md if requested and it exists
|
||||
if $INCLUDE_TASKS && [[ -f "$TASKS" ]]; then
|
||||
docs+=("tasks.md")
|
||||
fi
|
||||
|
||||
# Output results
|
||||
if $JSON_MODE; then
|
||||
# Build JSON array of documents
|
||||
if [[ ${#docs[@]} -eq 0 ]]; then
|
||||
json_docs="[]"
|
||||
else
|
||||
json_docs=$(printf '"%s",' "${docs[@]}")
|
||||
json_docs="[${json_docs%,}]"
|
||||
fi
|
||||
|
||||
printf '{"FEATURE_DIR":"%s","AVAILABLE_DOCS":%s}\n' "$FEATURE_DIR" "$json_docs"
|
||||
else
|
||||
# Text output
|
||||
echo "FEATURE_DIR:$FEATURE_DIR"
|
||||
echo "AVAILABLE_DOCS:"
|
||||
|
||||
# Show status of each potential document
|
||||
check_file "$RESEARCH" "research.md"
|
||||
check_file "$DATA_MODEL" "data-model.md"
|
||||
check_dir "$CONTRACTS_DIR" "contracts/"
|
||||
check_file "$QUICKSTART" "quickstart.md"
|
||||
|
||||
if $INCLUDE_TASKS; then
|
||||
check_file "$TASKS" "tasks.md"
|
||||
fi
|
||||
fi
|
||||
156
.specify/scripts/bash/common.sh
Executable file
156
.specify/scripts/bash/common.sh
Executable file
@@ -0,0 +1,156 @@
|
||||
#!/usr/bin/env bash
|
||||
# Common functions and variables for all scripts
|
||||
|
||||
# Get repository root, with fallback for non-git repositories
|
||||
get_repo_root() {
|
||||
if git rev-parse --show-toplevel >/dev/null 2>&1; then
|
||||
git rev-parse --show-toplevel
|
||||
else
|
||||
# Fall back to script location for non-git repos
|
||||
local script_dir="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
(cd "$script_dir/../../.." && pwd)
|
||||
fi
|
||||
}
|
||||
|
||||
# Get current branch, with fallback for non-git repositories
|
||||
get_current_branch() {
|
||||
# First check if SPECIFY_FEATURE environment variable is set
|
||||
if [[ -n "${SPECIFY_FEATURE:-}" ]]; then
|
||||
echo "$SPECIFY_FEATURE"
|
||||
return
|
||||
fi
|
||||
|
||||
# Then check git if available
|
||||
if git rev-parse --abbrev-ref HEAD >/dev/null 2>&1; then
|
||||
git rev-parse --abbrev-ref HEAD
|
||||
return
|
||||
fi
|
||||
|
||||
# For non-git repos, try to find the latest feature directory
|
||||
local repo_root=$(get_repo_root)
|
||||
local specs_dir="$repo_root/specs"
|
||||
|
||||
if [[ -d "$specs_dir" ]]; then
|
||||
local latest_feature=""
|
||||
local highest=0
|
||||
|
||||
for dir in "$specs_dir"/*; do
|
||||
if [[ -d "$dir" ]]; then
|
||||
local dirname=$(basename "$dir")
|
||||
if [[ "$dirname" =~ ^([0-9]{3})- ]]; then
|
||||
local number=${BASH_REMATCH[1]}
|
||||
number=$((10#$number))
|
||||
if [[ "$number" -gt "$highest" ]]; then
|
||||
highest=$number
|
||||
latest_feature=$dirname
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -n "$latest_feature" ]]; then
|
||||
echo "$latest_feature"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "main" # Final fallback
|
||||
}
|
||||
|
||||
# Check if we have git available
|
||||
has_git() {
|
||||
git rev-parse --show-toplevel >/dev/null 2>&1
|
||||
}
|
||||
|
||||
check_feature_branch() {
|
||||
local branch="$1"
|
||||
local has_git_repo="$2"
|
||||
|
||||
# For non-git repos, we can't enforce branch naming but still provide output
|
||||
if [[ "$has_git_repo" != "true" ]]; then
|
||||
echo "[specify] Warning: Git repository not detected; skipped branch validation" >&2
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ ! "$branch" =~ ^[0-9]{3}- ]]; then
|
||||
echo "ERROR: Not on a feature branch. Current branch: $branch" >&2
|
||||
echo "Feature branches should be named like: 001-feature-name" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
get_feature_dir() { echo "$1/specs/$2"; }
|
||||
|
||||
# Find feature directory by numeric prefix instead of exact branch match
|
||||
# This allows multiple branches to work on the same spec (e.g., 004-fix-bug, 004-add-feature)
|
||||
find_feature_dir_by_prefix() {
|
||||
local repo_root="$1"
|
||||
local branch_name="$2"
|
||||
local specs_dir="$repo_root/specs"
|
||||
|
||||
# Extract numeric prefix from branch (e.g., "004" from "004-whatever")
|
||||
if [[ ! "$branch_name" =~ ^([0-9]{3})- ]]; then
|
||||
# If branch doesn't have numeric prefix, fall back to exact match
|
||||
echo "$specs_dir/$branch_name"
|
||||
return
|
||||
fi
|
||||
|
||||
local prefix="${BASH_REMATCH[1]}"
|
||||
|
||||
# Search for directories in specs/ that start with this prefix
|
||||
local matches=()
|
||||
if [[ -d "$specs_dir" ]]; then
|
||||
for dir in "$specs_dir"/"$prefix"-*; do
|
||||
if [[ -d "$dir" ]]; then
|
||||
matches+=("$(basename "$dir")")
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Handle results
|
||||
if [[ ${#matches[@]} -eq 0 ]]; then
|
||||
# No match found - return the branch name path (will fail later with clear error)
|
||||
echo "$specs_dir/$branch_name"
|
||||
elif [[ ${#matches[@]} -eq 1 ]]; then
|
||||
# Exactly one match - perfect!
|
||||
echo "$specs_dir/${matches[0]}"
|
||||
else
|
||||
# Multiple matches - this shouldn't happen with proper naming convention
|
||||
echo "ERROR: Multiple spec directories found with prefix '$prefix': ${matches[*]}" >&2
|
||||
echo "Please ensure only one spec directory exists per numeric prefix." >&2
|
||||
echo "$specs_dir/$branch_name" # Return something to avoid breaking the script
|
||||
fi
|
||||
}
|
||||
|
||||
get_feature_paths() {
|
||||
local repo_root=$(get_repo_root)
|
||||
local current_branch=$(get_current_branch)
|
||||
local has_git_repo="false"
|
||||
|
||||
if has_git; then
|
||||
has_git_repo="true"
|
||||
fi
|
||||
|
||||
# Use prefix-based lookup to support multiple branches per spec
|
||||
local feature_dir=$(find_feature_dir_by_prefix "$repo_root" "$current_branch")
|
||||
|
||||
cat <<EOF
|
||||
REPO_ROOT='$repo_root'
|
||||
CURRENT_BRANCH='$current_branch'
|
||||
HAS_GIT='$has_git_repo'
|
||||
FEATURE_DIR='$feature_dir'
|
||||
FEATURE_SPEC='$feature_dir/spec.md'
|
||||
IMPL_PLAN='$feature_dir/plan.md'
|
||||
TASKS='$feature_dir/tasks.md'
|
||||
RESEARCH='$feature_dir/research.md'
|
||||
DATA_MODEL='$feature_dir/data-model.md'
|
||||
QUICKSTART='$feature_dir/quickstart.md'
|
||||
CONTRACTS_DIR='$feature_dir/contracts'
|
||||
EOF
|
||||
}
|
||||
|
||||
check_file() { [[ -f "$1" ]] && echo " ✓ $2" || echo " ✗ $2"; }
|
||||
check_dir() { [[ -d "$1" && -n $(ls -A "$1" 2>/dev/null) ]] && echo " ✓ $2" || echo " ✗ $2"; }
|
||||
|
||||
297
.specify/scripts/bash/create-new-feature.sh
Executable file
297
.specify/scripts/bash/create-new-feature.sh
Executable file
@@ -0,0 +1,297 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
JSON_MODE=false
|
||||
SHORT_NAME=""
|
||||
BRANCH_NUMBER=""
|
||||
ARGS=()
|
||||
i=1
|
||||
while [ $i -le $# ]; do
|
||||
arg="${!i}"
|
||||
case "$arg" in
|
||||
--json)
|
||||
JSON_MODE=true
|
||||
;;
|
||||
--short-name)
|
||||
if [ $((i + 1)) -gt $# ]; then
|
||||
echo 'Error: --short-name requires a value' >&2
|
||||
exit 1
|
||||
fi
|
||||
i=$((i + 1))
|
||||
next_arg="${!i}"
|
||||
# Check if the next argument is another option (starts with --)
|
||||
if [[ "$next_arg" == --* ]]; then
|
||||
echo 'Error: --short-name requires a value' >&2
|
||||
exit 1
|
||||
fi
|
||||
SHORT_NAME="$next_arg"
|
||||
;;
|
||||
--number)
|
||||
if [ $((i + 1)) -gt $# ]; then
|
||||
echo 'Error: --number requires a value' >&2
|
||||
exit 1
|
||||
fi
|
||||
i=$((i + 1))
|
||||
next_arg="${!i}"
|
||||
if [[ "$next_arg" == --* ]]; then
|
||||
echo 'Error: --number requires a value' >&2
|
||||
exit 1
|
||||
fi
|
||||
BRANCH_NUMBER="$next_arg"
|
||||
;;
|
||||
--help|-h)
|
||||
echo "Usage: $0 [--json] [--short-name <name>] [--number N] <feature_description>"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --json Output in JSON format"
|
||||
echo " --short-name <name> Provide a custom short name (2-4 words) for the branch"
|
||||
echo " --number N Specify branch number manually (overrides auto-detection)"
|
||||
echo " --help, -h Show this help message"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 'Add user authentication system' --short-name 'user-auth'"
|
||||
echo " $0 'Implement OAuth2 integration for API' --number 5"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
ARGS+=("$arg")
|
||||
;;
|
||||
esac
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
FEATURE_DESCRIPTION="${ARGS[*]}"
|
||||
if [ -z "$FEATURE_DESCRIPTION" ]; then
|
||||
echo "Usage: $0 [--json] [--short-name <name>] [--number N] <feature_description>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Function to find the repository root by searching for existing project markers
|
||||
find_repo_root() {
|
||||
local dir="$1"
|
||||
while [ "$dir" != "/" ]; do
|
||||
if [ -d "$dir/.git" ] || [ -d "$dir/.specify" ]; then
|
||||
echo "$dir"
|
||||
return 0
|
||||
fi
|
||||
dir="$(dirname "$dir")"
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# Function to get highest number from specs directory
|
||||
get_highest_from_specs() {
|
||||
local specs_dir="$1"
|
||||
local highest=0
|
||||
|
||||
if [ -d "$specs_dir" ]; then
|
||||
for dir in "$specs_dir"/*; do
|
||||
[ -d "$dir" ] || continue
|
||||
dirname=$(basename "$dir")
|
||||
number=$(echo "$dirname" | grep -o '^[0-9]\+' || echo "0")
|
||||
number=$((10#$number))
|
||||
if [ "$number" -gt "$highest" ]; then
|
||||
highest=$number
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
echo "$highest"
|
||||
}
|
||||
|
||||
# Function to get highest number from git branches
|
||||
get_highest_from_branches() {
|
||||
local highest=0
|
||||
|
||||
# Get all branches (local and remote)
|
||||
branches=$(git branch -a 2>/dev/null || echo "")
|
||||
|
||||
if [ -n "$branches" ]; then
|
||||
while IFS= read -r branch; do
|
||||
# Clean branch name: remove leading markers and remote prefixes
|
||||
clean_branch=$(echo "$branch" | sed 's/^[* ]*//; s|^remotes/[^/]*/||')
|
||||
|
||||
# Extract feature number if branch matches pattern ###-*
|
||||
if echo "$clean_branch" | grep -q '^[0-9]\{3\}-'; then
|
||||
number=$(echo "$clean_branch" | grep -o '^[0-9]\{3\}' || echo "0")
|
||||
number=$((10#$number))
|
||||
if [ "$number" -gt "$highest" ]; then
|
||||
highest=$number
|
||||
fi
|
||||
fi
|
||||
done <<< "$branches"
|
||||
fi
|
||||
|
||||
echo "$highest"
|
||||
}
|
||||
|
||||
# Function to check existing branches (local and remote) and return next available number
|
||||
check_existing_branches() {
|
||||
local specs_dir="$1"
|
||||
|
||||
# Fetch all remotes to get latest branch info (suppress errors if no remotes)
|
||||
git fetch --all --prune 2>/dev/null || true
|
||||
|
||||
# Get highest number from ALL branches (not just matching short name)
|
||||
local highest_branch=$(get_highest_from_branches)
|
||||
|
||||
# Get highest number from ALL specs (not just matching short name)
|
||||
local highest_spec=$(get_highest_from_specs "$specs_dir")
|
||||
|
||||
# Take the maximum of both
|
||||
local max_num=$highest_branch
|
||||
if [ "$highest_spec" -gt "$max_num" ]; then
|
||||
max_num=$highest_spec
|
||||
fi
|
||||
|
||||
# Return next number
|
||||
echo $((max_num + 1))
|
||||
}
|
||||
|
||||
# Function to clean and format a branch name
|
||||
clean_branch_name() {
|
||||
local name="$1"
|
||||
echo "$name" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/-\+/-/g' | sed 's/^-//' | sed 's/-$//'
|
||||
}
|
||||
|
||||
# Resolve repository root. Prefer git information when available, but fall back
|
||||
# to searching for repository markers so the workflow still functions in repositories that
|
||||
# were initialised with --no-git.
|
||||
SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
if git rev-parse --show-toplevel >/dev/null 2>&1; then
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
HAS_GIT=true
|
||||
else
|
||||
REPO_ROOT="$(find_repo_root "$SCRIPT_DIR")"
|
||||
if [ -z "$REPO_ROOT" ]; then
|
||||
echo "Error: Could not determine repository root. Please run this script from within the repository." >&2
|
||||
exit 1
|
||||
fi
|
||||
HAS_GIT=false
|
||||
fi
|
||||
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
SPECS_DIR="$REPO_ROOT/specs"
|
||||
mkdir -p "$SPECS_DIR"
|
||||
|
||||
# Function to generate branch name with stop word filtering and length filtering
|
||||
generate_branch_name() {
|
||||
local description="$1"
|
||||
|
||||
# Common stop words to filter out
|
||||
local stop_words="^(i|a|an|the|to|for|of|in|on|at|by|with|from|is|are|was|were|be|been|being|have|has|had|do|does|did|will|would|should|could|can|may|might|must|shall|this|that|these|those|my|your|our|their|want|need|add|get|set)$"
|
||||
|
||||
# Convert to lowercase and split into words
|
||||
local clean_name=$(echo "$description" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/ /g')
|
||||
|
||||
# Filter words: remove stop words and words shorter than 3 chars (unless they're uppercase acronyms in original)
|
||||
local meaningful_words=()
|
||||
for word in $clean_name; do
|
||||
# Skip empty words
|
||||
[ -z "$word" ] && continue
|
||||
|
||||
# Keep words that are NOT stop words AND (length >= 3 OR are potential acronyms)
|
||||
if ! echo "$word" | grep -qiE "$stop_words"; then
|
||||
if [ ${#word} -ge 3 ]; then
|
||||
meaningful_words+=("$word")
|
||||
elif echo "$description" | grep -q "\b${word^^}\b"; then
|
||||
# Keep short words if they appear as uppercase in original (likely acronyms)
|
||||
meaningful_words+=("$word")
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# If we have meaningful words, use first 3-4 of them
|
||||
if [ ${#meaningful_words[@]} -gt 0 ]; then
|
||||
local max_words=3
|
||||
if [ ${#meaningful_words[@]} -eq 4 ]; then max_words=4; fi
|
||||
|
||||
local result=""
|
||||
local count=0
|
||||
for word in "${meaningful_words[@]}"; do
|
||||
if [ $count -ge $max_words ]; then break; fi
|
||||
if [ -n "$result" ]; then result="$result-"; fi
|
||||
result="$result$word"
|
||||
count=$((count + 1))
|
||||
done
|
||||
echo "$result"
|
||||
else
|
||||
# Fallback to original logic if no meaningful words found
|
||||
local cleaned=$(clean_branch_name "$description")
|
||||
echo "$cleaned" | tr '-' '\n' | grep -v '^$' | head -3 | tr '\n' '-' | sed 's/-$//'
|
||||
fi
|
||||
}
|
||||
|
||||
# Generate branch name
|
||||
if [ -n "$SHORT_NAME" ]; then
|
||||
# Use provided short name, just clean it up
|
||||
BRANCH_SUFFIX=$(clean_branch_name "$SHORT_NAME")
|
||||
else
|
||||
# Generate from description with smart filtering
|
||||
BRANCH_SUFFIX=$(generate_branch_name "$FEATURE_DESCRIPTION")
|
||||
fi
|
||||
|
||||
# Determine branch number
|
||||
if [ -z "$BRANCH_NUMBER" ]; then
|
||||
if [ "$HAS_GIT" = true ]; then
|
||||
# Check existing branches on remotes
|
||||
BRANCH_NUMBER=$(check_existing_branches "$SPECS_DIR")
|
||||
else
|
||||
# Fall back to local directory check
|
||||
HIGHEST=$(get_highest_from_specs "$SPECS_DIR")
|
||||
BRANCH_NUMBER=$((HIGHEST + 1))
|
||||
fi
|
||||
fi
|
||||
|
||||
# Force base-10 interpretation to prevent octal conversion (e.g., 010 → 8 in octal, but should be 10 in decimal)
|
||||
FEATURE_NUM=$(printf "%03d" "$((10#$BRANCH_NUMBER))")
|
||||
BRANCH_NAME="${FEATURE_NUM}-${BRANCH_SUFFIX}"
|
||||
|
||||
# GitHub enforces a 244-byte limit on branch names
|
||||
# Validate and truncate if necessary
|
||||
MAX_BRANCH_LENGTH=244
|
||||
if [ ${#BRANCH_NAME} -gt $MAX_BRANCH_LENGTH ]; then
|
||||
# Calculate how much we need to trim from suffix
|
||||
# Account for: feature number (3) + hyphen (1) = 4 chars
|
||||
MAX_SUFFIX_LENGTH=$((MAX_BRANCH_LENGTH - 4))
|
||||
|
||||
# Truncate suffix at word boundary if possible
|
||||
TRUNCATED_SUFFIX=$(echo "$BRANCH_SUFFIX" | cut -c1-$MAX_SUFFIX_LENGTH)
|
||||
# Remove trailing hyphen if truncation created one
|
||||
TRUNCATED_SUFFIX=$(echo "$TRUNCATED_SUFFIX" | sed 's/-$//')
|
||||
|
||||
ORIGINAL_BRANCH_NAME="$BRANCH_NAME"
|
||||
BRANCH_NAME="${FEATURE_NUM}-${TRUNCATED_SUFFIX}"
|
||||
|
||||
>&2 echo "[specify] Warning: Branch name exceeded GitHub's 244-byte limit"
|
||||
>&2 echo "[specify] Original: $ORIGINAL_BRANCH_NAME (${#ORIGINAL_BRANCH_NAME} bytes)"
|
||||
>&2 echo "[specify] Truncated to: $BRANCH_NAME (${#BRANCH_NAME} bytes)"
|
||||
fi
|
||||
|
||||
if [ "$HAS_GIT" = true ]; then
|
||||
git checkout -b "$BRANCH_NAME"
|
||||
else
|
||||
>&2 echo "[specify] Warning: Git repository not detected; skipped branch creation for $BRANCH_NAME"
|
||||
fi
|
||||
|
||||
FEATURE_DIR="$SPECS_DIR/$BRANCH_NAME"
|
||||
mkdir -p "$FEATURE_DIR"
|
||||
|
||||
TEMPLATE="$REPO_ROOT/.specify/templates/spec-template.md"
|
||||
SPEC_FILE="$FEATURE_DIR/spec.md"
|
||||
if [ -f "$TEMPLATE" ]; then cp "$TEMPLATE" "$SPEC_FILE"; else touch "$SPEC_FILE"; fi
|
||||
|
||||
# Set the SPECIFY_FEATURE environment variable for the current session
|
||||
export SPECIFY_FEATURE="$BRANCH_NAME"
|
||||
|
||||
if $JSON_MODE; then
|
||||
printf '{"BRANCH_NAME":"%s","SPEC_FILE":"%s","FEATURE_NUM":"%s"}\n' "$BRANCH_NAME" "$SPEC_FILE" "$FEATURE_NUM"
|
||||
else
|
||||
echo "BRANCH_NAME: $BRANCH_NAME"
|
||||
echo "SPEC_FILE: $SPEC_FILE"
|
||||
echo "FEATURE_NUM: $FEATURE_NUM"
|
||||
echo "SPECIFY_FEATURE environment variable set to: $BRANCH_NAME"
|
||||
fi
|
||||
61
.specify/scripts/bash/setup-plan.sh
Executable file
61
.specify/scripts/bash/setup-plan.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
# Parse command line arguments
|
||||
JSON_MODE=false
|
||||
ARGS=()
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--json)
|
||||
JSON_MODE=true
|
||||
;;
|
||||
--help|-h)
|
||||
echo "Usage: $0 [--json]"
|
||||
echo " --json Output results in JSON format"
|
||||
echo " --help Show this help message"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
ARGS+=("$arg")
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Get script directory and load common functions
|
||||
SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/common.sh"
|
||||
|
||||
# Get all paths and variables from common functions
|
||||
eval $(get_feature_paths)
|
||||
|
||||
# Check if we're on a proper feature branch (only for git repos)
|
||||
check_feature_branch "$CURRENT_BRANCH" "$HAS_GIT" || exit 1
|
||||
|
||||
# Ensure the feature directory exists
|
||||
mkdir -p "$FEATURE_DIR"
|
||||
|
||||
# Copy plan template if it exists
|
||||
TEMPLATE="$REPO_ROOT/.specify/templates/plan-template.md"
|
||||
if [[ -f "$TEMPLATE" ]]; then
|
||||
cp "$TEMPLATE" "$IMPL_PLAN"
|
||||
echo "Copied plan template to $IMPL_PLAN"
|
||||
else
|
||||
echo "Warning: Plan template not found at $TEMPLATE"
|
||||
# Create a basic plan file if template doesn't exist
|
||||
touch "$IMPL_PLAN"
|
||||
fi
|
||||
|
||||
# Output results
|
||||
if $JSON_MODE; then
|
||||
printf '{"FEATURE_SPEC":"%s","IMPL_PLAN":"%s","SPECS_DIR":"%s","BRANCH":"%s","HAS_GIT":"%s"}\n' \
|
||||
"$FEATURE_SPEC" "$IMPL_PLAN" "$FEATURE_DIR" "$CURRENT_BRANCH" "$HAS_GIT"
|
||||
else
|
||||
echo "FEATURE_SPEC: $FEATURE_SPEC"
|
||||
echo "IMPL_PLAN: $IMPL_PLAN"
|
||||
echo "SPECS_DIR: $FEATURE_DIR"
|
||||
echo "BRANCH: $CURRENT_BRANCH"
|
||||
echo "HAS_GIT: $HAS_GIT"
|
||||
fi
|
||||
|
||||
799
.specify/scripts/bash/update-agent-context.sh
Executable file
799
.specify/scripts/bash/update-agent-context.sh
Executable file
@@ -0,0 +1,799 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Update agent context files with information from plan.md
|
||||
#
|
||||
# This script maintains AI agent context files by parsing feature specifications
|
||||
# and updating agent-specific configuration files with project information.
|
||||
#
|
||||
# MAIN FUNCTIONS:
|
||||
# 1. Environment Validation
|
||||
# - Verifies git repository structure and branch information
|
||||
# - Checks for required plan.md files and templates
|
||||
# - Validates file permissions and accessibility
|
||||
#
|
||||
# 2. Plan Data Extraction
|
||||
# - Parses plan.md files to extract project metadata
|
||||
# - Identifies language/version, frameworks, databases, and project types
|
||||
# - Handles missing or incomplete specification data gracefully
|
||||
#
|
||||
# 3. Agent File Management
|
||||
# - Creates new agent context files from templates when needed
|
||||
# - Updates existing agent files with new project information
|
||||
# - Preserves manual additions and custom configurations
|
||||
# - Supports multiple AI agent formats and directory structures
|
||||
#
|
||||
# 4. Content Generation
|
||||
# - Generates language-specific build/test commands
|
||||
# - Creates appropriate project directory structures
|
||||
# - Updates technology stacks and recent changes sections
|
||||
# - Maintains consistent formatting and timestamps
|
||||
#
|
||||
# 5. Multi-Agent Support
|
||||
# - Handles agent-specific file paths and naming conventions
|
||||
# - Supports: Claude, Gemini, Copilot, Cursor, Qwen, opencode, Codex, Windsurf, Kilo Code, Auggie CLI, Roo Code, CodeBuddy CLI, Qoder CLI, Amp, SHAI, or Amazon Q Developer CLI
|
||||
# - Can update single agents or all existing agent files
|
||||
# - Creates default Claude file if no agent files exist
|
||||
#
|
||||
# Usage: ./update-agent-context.sh [agent_type]
|
||||
# Agent types: claude|gemini|copilot|cursor-agent|qwen|opencode|codex|windsurf|kilocode|auggie|shai|q|bob|qoder
|
||||
# Leave empty to update all existing agent files
|
||||
|
||||
set -e
|
||||
|
||||
# Enable strict error handling
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
#==============================================================================
|
||||
# Configuration and Global Variables
|
||||
#==============================================================================
|
||||
|
||||
# Get script directory and load common functions
|
||||
SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/common.sh"
|
||||
|
||||
# Get all paths and variables from common functions
|
||||
eval $(get_feature_paths)
|
||||
|
||||
NEW_PLAN="$IMPL_PLAN" # Alias for compatibility with existing code
|
||||
AGENT_TYPE="${1:-}"
|
||||
|
||||
# Agent-specific file paths
|
||||
CLAUDE_FILE="$REPO_ROOT/CLAUDE.md"
|
||||
GEMINI_FILE="$REPO_ROOT/GEMINI.md"
|
||||
COPILOT_FILE="$REPO_ROOT/.github/agents/copilot-instructions.md"
|
||||
CURSOR_FILE="$REPO_ROOT/.cursor/rules/specify-rules.mdc"
|
||||
QWEN_FILE="$REPO_ROOT/QWEN.md"
|
||||
AGENTS_FILE="$REPO_ROOT/AGENTS.md"
|
||||
WINDSURF_FILE="$REPO_ROOT/.windsurf/rules/specify-rules.md"
|
||||
KILOCODE_FILE="$REPO_ROOT/.kilocode/rules/specify-rules.md"
|
||||
AUGGIE_FILE="$REPO_ROOT/.augment/rules/specify-rules.md"
|
||||
ROO_FILE="$REPO_ROOT/.roo/rules/specify-rules.md"
|
||||
CODEBUDDY_FILE="$REPO_ROOT/CODEBUDDY.md"
|
||||
QODER_FILE="$REPO_ROOT/QODER.md"
|
||||
AMP_FILE="$REPO_ROOT/AGENTS.md"
|
||||
SHAI_FILE="$REPO_ROOT/SHAI.md"
|
||||
Q_FILE="$REPO_ROOT/AGENTS.md"
|
||||
BOB_FILE="$REPO_ROOT/AGENTS.md"
|
||||
|
||||
# Template file
|
||||
TEMPLATE_FILE="$REPO_ROOT/.specify/templates/agent-file-template.md"
|
||||
|
||||
# Global variables for parsed plan data
|
||||
NEW_LANG=""
|
||||
NEW_FRAMEWORK=""
|
||||
NEW_DB=""
|
||||
NEW_PROJECT_TYPE=""
|
||||
|
||||
#==============================================================================
|
||||
# Utility Functions
|
||||
#==============================================================================
|
||||
|
||||
log_info() {
|
||||
echo "INFO: $1"
|
||||
}
|
||||
|
||||
log_success() {
|
||||
echo "✓ $1"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
echo "ERROR: $1" >&2
|
||||
}
|
||||
|
||||
log_warning() {
|
||||
echo "WARNING: $1" >&2
|
||||
}
|
||||
|
||||
# Cleanup function for temporary files
|
||||
cleanup() {
|
||||
local exit_code=$?
|
||||
rm -f /tmp/agent_update_*_$$
|
||||
rm -f /tmp/manual_additions_$$
|
||||
exit $exit_code
|
||||
}
|
||||
|
||||
# Set up cleanup trap
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
#==============================================================================
|
||||
# Validation Functions
|
||||
#==============================================================================
|
||||
|
||||
validate_environment() {
|
||||
# Check if we have a current branch/feature (git or non-git)
|
||||
if [[ -z "$CURRENT_BRANCH" ]]; then
|
||||
log_error "Unable to determine current feature"
|
||||
if [[ "$HAS_GIT" == "true" ]]; then
|
||||
log_info "Make sure you're on a feature branch"
|
||||
else
|
||||
log_info "Set SPECIFY_FEATURE environment variable or create a feature first"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if plan.md exists
|
||||
if [[ ! -f "$NEW_PLAN" ]]; then
|
||||
log_error "No plan.md found at $NEW_PLAN"
|
||||
log_info "Make sure you're working on a feature with a corresponding spec directory"
|
||||
if [[ "$HAS_GIT" != "true" ]]; then
|
||||
log_info "Use: export SPECIFY_FEATURE=your-feature-name or create a new feature first"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if template exists (needed for new files)
|
||||
if [[ ! -f "$TEMPLATE_FILE" ]]; then
|
||||
log_warning "Template file not found at $TEMPLATE_FILE"
|
||||
log_warning "Creating new agent files will fail"
|
||||
fi
|
||||
}
|
||||
|
||||
#==============================================================================
|
||||
# Plan Parsing Functions
|
||||
#==============================================================================
|
||||
|
||||
extract_plan_field() {
|
||||
local field_pattern="$1"
|
||||
local plan_file="$2"
|
||||
|
||||
grep "^\*\*${field_pattern}\*\*: " "$plan_file" 2>/dev/null | \
|
||||
head -1 | \
|
||||
sed "s|^\*\*${field_pattern}\*\*: ||" | \
|
||||
sed 's/^[ \t]*//;s/[ \t]*$//' | \
|
||||
grep -v "NEEDS CLARIFICATION" | \
|
||||
grep -v "^N/A$" || echo ""
|
||||
}
|
||||
|
||||
parse_plan_data() {
|
||||
local plan_file="$1"
|
||||
|
||||
if [[ ! -f "$plan_file" ]]; then
|
||||
log_error "Plan file not found: $plan_file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! -r "$plan_file" ]]; then
|
||||
log_error "Plan file is not readable: $plan_file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log_info "Parsing plan data from $plan_file"
|
||||
|
||||
NEW_LANG=$(extract_plan_field "Language/Version" "$plan_file")
|
||||
NEW_FRAMEWORK=$(extract_plan_field "Primary Dependencies" "$plan_file")
|
||||
NEW_DB=$(extract_plan_field "Storage" "$plan_file")
|
||||
NEW_PROJECT_TYPE=$(extract_plan_field "Project Type" "$plan_file")
|
||||
|
||||
# Log what we found
|
||||
if [[ -n "$NEW_LANG" ]]; then
|
||||
log_info "Found language: $NEW_LANG"
|
||||
else
|
||||
log_warning "No language information found in plan"
|
||||
fi
|
||||
|
||||
if [[ -n "$NEW_FRAMEWORK" ]]; then
|
||||
log_info "Found framework: $NEW_FRAMEWORK"
|
||||
fi
|
||||
|
||||
if [[ -n "$NEW_DB" ]] && [[ "$NEW_DB" != "N/A" ]]; then
|
||||
log_info "Found database: $NEW_DB"
|
||||
fi
|
||||
|
||||
if [[ -n "$NEW_PROJECT_TYPE" ]]; then
|
||||
log_info "Found project type: $NEW_PROJECT_TYPE"
|
||||
fi
|
||||
}
|
||||
|
||||
format_technology_stack() {
|
||||
local lang="$1"
|
||||
local framework="$2"
|
||||
local parts=()
|
||||
|
||||
# Add non-empty parts
|
||||
[[ -n "$lang" && "$lang" != "NEEDS CLARIFICATION" ]] && parts+=("$lang")
|
||||
[[ -n "$framework" && "$framework" != "NEEDS CLARIFICATION" && "$framework" != "N/A" ]] && parts+=("$framework")
|
||||
|
||||
# Join with proper formatting
|
||||
if [[ ${#parts[@]} -eq 0 ]]; then
|
||||
echo ""
|
||||
elif [[ ${#parts[@]} -eq 1 ]]; then
|
||||
echo "${parts[0]}"
|
||||
else
|
||||
# Join multiple parts with " + "
|
||||
local result="${parts[0]}"
|
||||
for ((i=1; i<${#parts[@]}; i++)); do
|
||||
result="$result + ${parts[i]}"
|
||||
done
|
||||
echo "$result"
|
||||
fi
|
||||
}
|
||||
|
||||
#==============================================================================
|
||||
# Template and Content Generation Functions
|
||||
#==============================================================================
|
||||
|
||||
get_project_structure() {
|
||||
local project_type="$1"
|
||||
|
||||
if [[ "$project_type" == *"web"* ]]; then
|
||||
echo "backend/\\nfrontend/\\ntests/"
|
||||
else
|
||||
echo "src/\\ntests/"
|
||||
fi
|
||||
}
|
||||
|
||||
get_commands_for_language() {
|
||||
local lang="$1"
|
||||
|
||||
case "$lang" in
|
||||
*"Python"*)
|
||||
echo "cd src && pytest && ruff check ."
|
||||
;;
|
||||
*"Rust"*)
|
||||
echo "cargo test && cargo clippy"
|
||||
;;
|
||||
*"JavaScript"*|*"TypeScript"*)
|
||||
echo "npm test \\&\\& npm run lint"
|
||||
;;
|
||||
*)
|
||||
echo "# Add commands for $lang"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_language_conventions() {
|
||||
local lang="$1"
|
||||
echo "$lang: Follow standard conventions"
|
||||
}
|
||||
|
||||
create_new_agent_file() {
|
||||
local target_file="$1"
|
||||
local temp_file="$2"
|
||||
local project_name="$3"
|
||||
local current_date="$4"
|
||||
|
||||
if [[ ! -f "$TEMPLATE_FILE" ]]; then
|
||||
log_error "Template not found at $TEMPLATE_FILE"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! -r "$TEMPLATE_FILE" ]]; then
|
||||
log_error "Template file is not readable: $TEMPLATE_FILE"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log_info "Creating new agent context file from template..."
|
||||
|
||||
if ! cp "$TEMPLATE_FILE" "$temp_file"; then
|
||||
log_error "Failed to copy template file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Replace template placeholders
|
||||
local project_structure
|
||||
project_structure=$(get_project_structure "$NEW_PROJECT_TYPE")
|
||||
|
||||
local commands
|
||||
commands=$(get_commands_for_language "$NEW_LANG")
|
||||
|
||||
local language_conventions
|
||||
language_conventions=$(get_language_conventions "$NEW_LANG")
|
||||
|
||||
# Perform substitutions with error checking using safer approach
|
||||
# Escape special characters for sed by using a different delimiter or escaping
|
||||
local escaped_lang=$(printf '%s\n' "$NEW_LANG" | sed 's/[\[\.*^$()+{}|]/\\&/g')
|
||||
local escaped_framework=$(printf '%s\n' "$NEW_FRAMEWORK" | sed 's/[\[\.*^$()+{}|]/\\&/g')
|
||||
local escaped_branch=$(printf '%s\n' "$CURRENT_BRANCH" | sed 's/[\[\.*^$()+{}|]/\\&/g')
|
||||
|
||||
# Build technology stack and recent change strings conditionally
|
||||
local tech_stack
|
||||
if [[ -n "$escaped_lang" && -n "$escaped_framework" ]]; then
|
||||
tech_stack="- $escaped_lang + $escaped_framework ($escaped_branch)"
|
||||
elif [[ -n "$escaped_lang" ]]; then
|
||||
tech_stack="- $escaped_lang ($escaped_branch)"
|
||||
elif [[ -n "$escaped_framework" ]]; then
|
||||
tech_stack="- $escaped_framework ($escaped_branch)"
|
||||
else
|
||||
tech_stack="- ($escaped_branch)"
|
||||
fi
|
||||
|
||||
local recent_change
|
||||
if [[ -n "$escaped_lang" && -n "$escaped_framework" ]]; then
|
||||
recent_change="- $escaped_branch: Added $escaped_lang + $escaped_framework"
|
||||
elif [[ -n "$escaped_lang" ]]; then
|
||||
recent_change="- $escaped_branch: Added $escaped_lang"
|
||||
elif [[ -n "$escaped_framework" ]]; then
|
||||
recent_change="- $escaped_branch: Added $escaped_framework"
|
||||
else
|
||||
recent_change="- $escaped_branch: Added"
|
||||
fi
|
||||
|
||||
local substitutions=(
|
||||
"s|\[PROJECT NAME\]|$project_name|"
|
||||
"s|\[DATE\]|$current_date|"
|
||||
"s|\[EXTRACTED FROM ALL PLAN.MD FILES\]|$tech_stack|"
|
||||
"s|\[ACTUAL STRUCTURE FROM PLANS\]|$project_structure|g"
|
||||
"s|\[ONLY COMMANDS FOR ACTIVE TECHNOLOGIES\]|$commands|"
|
||||
"s|\[LANGUAGE-SPECIFIC, ONLY FOR LANGUAGES IN USE\]|$language_conventions|"
|
||||
"s|\[LAST 3 FEATURES AND WHAT THEY ADDED\]|$recent_change|"
|
||||
)
|
||||
|
||||
for substitution in "${substitutions[@]}"; do
|
||||
if ! sed -i.bak -e "$substitution" "$temp_file"; then
|
||||
log_error "Failed to perform substitution: $substitution"
|
||||
rm -f "$temp_file" "$temp_file.bak"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Convert \n sequences to actual newlines
|
||||
newline=$(printf '\n')
|
||||
sed -i.bak2 "s/\\\\n/${newline}/g" "$temp_file"
|
||||
|
||||
# Clean up backup files
|
||||
rm -f "$temp_file.bak" "$temp_file.bak2"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
update_existing_agent_file() {
|
||||
local target_file="$1"
|
||||
local current_date="$2"
|
||||
|
||||
log_info "Updating existing agent context file..."
|
||||
|
||||
# Use a single temporary file for atomic update
|
||||
local temp_file
|
||||
temp_file=$(mktemp) || {
|
||||
log_error "Failed to create temporary file"
|
||||
return 1
|
||||
}
|
||||
|
||||
# Process the file in one pass
|
||||
local tech_stack=$(format_technology_stack "$NEW_LANG" "$NEW_FRAMEWORK")
|
||||
local new_tech_entries=()
|
||||
local new_change_entry=""
|
||||
|
||||
# Prepare new technology entries
|
||||
if [[ -n "$tech_stack" ]] && ! grep -q "$tech_stack" "$target_file"; then
|
||||
new_tech_entries+=("- $tech_stack ($CURRENT_BRANCH)")
|
||||
fi
|
||||
|
||||
if [[ -n "$NEW_DB" ]] && [[ "$NEW_DB" != "N/A" ]] && [[ "$NEW_DB" != "NEEDS CLARIFICATION" ]] && ! grep -q "$NEW_DB" "$target_file"; then
|
||||
new_tech_entries+=("- $NEW_DB ($CURRENT_BRANCH)")
|
||||
fi
|
||||
|
||||
# Prepare new change entry
|
||||
if [[ -n "$tech_stack" ]]; then
|
||||
new_change_entry="- $CURRENT_BRANCH: Added $tech_stack"
|
||||
elif [[ -n "$NEW_DB" ]] && [[ "$NEW_DB" != "N/A" ]] && [[ "$NEW_DB" != "NEEDS CLARIFICATION" ]]; then
|
||||
new_change_entry="- $CURRENT_BRANCH: Added $NEW_DB"
|
||||
fi
|
||||
|
||||
# Check if sections exist in the file
|
||||
local has_active_technologies=0
|
||||
local has_recent_changes=0
|
||||
|
||||
if grep -q "^## Active Technologies" "$target_file" 2>/dev/null; then
|
||||
has_active_technologies=1
|
||||
fi
|
||||
|
||||
if grep -q "^## Recent Changes" "$target_file" 2>/dev/null; then
|
||||
has_recent_changes=1
|
||||
fi
|
||||
|
||||
# Process file line by line
|
||||
local in_tech_section=false
|
||||
local in_changes_section=false
|
||||
local tech_entries_added=false
|
||||
local changes_entries_added=false
|
||||
local existing_changes_count=0
|
||||
local file_ended=false
|
||||
|
||||
while IFS= read -r line || [[ -n "$line" ]]; do
|
||||
# Handle Active Technologies section
|
||||
if [[ "$line" == "## Active Technologies" ]]; then
|
||||
echo "$line" >> "$temp_file"
|
||||
in_tech_section=true
|
||||
continue
|
||||
elif [[ $in_tech_section == true ]] && [[ "$line" =~ ^##[[:space:]] ]]; then
|
||||
# Add new tech entries before closing the section
|
||||
if [[ $tech_entries_added == false ]] && [[ ${#new_tech_entries[@]} -gt 0 ]]; then
|
||||
printf '%s\n' "${new_tech_entries[@]}" >> "$temp_file"
|
||||
tech_entries_added=true
|
||||
fi
|
||||
echo "$line" >> "$temp_file"
|
||||
in_tech_section=false
|
||||
continue
|
||||
elif [[ $in_tech_section == true ]] && [[ -z "$line" ]]; then
|
||||
# Add new tech entries before empty line in tech section
|
||||
if [[ $tech_entries_added == false ]] && [[ ${#new_tech_entries[@]} -gt 0 ]]; then
|
||||
printf '%s\n' "${new_tech_entries[@]}" >> "$temp_file"
|
||||
tech_entries_added=true
|
||||
fi
|
||||
echo "$line" >> "$temp_file"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Handle Recent Changes section
|
||||
if [[ "$line" == "## Recent Changes" ]]; then
|
||||
echo "$line" >> "$temp_file"
|
||||
# Add new change entry right after the heading
|
||||
if [[ -n "$new_change_entry" ]]; then
|
||||
echo "$new_change_entry" >> "$temp_file"
|
||||
fi
|
||||
in_changes_section=true
|
||||
changes_entries_added=true
|
||||
continue
|
||||
elif [[ $in_changes_section == true ]] && [[ "$line" =~ ^##[[:space:]] ]]; then
|
||||
echo "$line" >> "$temp_file"
|
||||
in_changes_section=false
|
||||
continue
|
||||
elif [[ $in_changes_section == true ]] && [[ "$line" == "- "* ]]; then
|
||||
# Keep only first 2 existing changes
|
||||
if [[ $existing_changes_count -lt 2 ]]; then
|
||||
echo "$line" >> "$temp_file"
|
||||
((existing_changes_count++))
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
# Update timestamp
|
||||
if [[ "$line" =~ \*\*Last\ updated\*\*:.*[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] ]]; then
|
||||
echo "$line" | sed "s/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]/$current_date/" >> "$temp_file"
|
||||
else
|
||||
echo "$line" >> "$temp_file"
|
||||
fi
|
||||
done < "$target_file"
|
||||
|
||||
# Post-loop check: if we're still in the Active Technologies section and haven't added new entries
|
||||
if [[ $in_tech_section == true ]] && [[ $tech_entries_added == false ]] && [[ ${#new_tech_entries[@]} -gt 0 ]]; then
|
||||
printf '%s\n' "${new_tech_entries[@]}" >> "$temp_file"
|
||||
tech_entries_added=true
|
||||
fi
|
||||
|
||||
# If sections don't exist, add them at the end of the file
|
||||
if [[ $has_active_technologies -eq 0 ]] && [[ ${#new_tech_entries[@]} -gt 0 ]]; then
|
||||
echo "" >> "$temp_file"
|
||||
echo "## Active Technologies" >> "$temp_file"
|
||||
printf '%s\n' "${new_tech_entries[@]}" >> "$temp_file"
|
||||
tech_entries_added=true
|
||||
fi
|
||||
|
||||
if [[ $has_recent_changes -eq 0 ]] && [[ -n "$new_change_entry" ]]; then
|
||||
echo "" >> "$temp_file"
|
||||
echo "## Recent Changes" >> "$temp_file"
|
||||
echo "$new_change_entry" >> "$temp_file"
|
||||
changes_entries_added=true
|
||||
fi
|
||||
|
||||
# Move temp file to target atomically
|
||||
if ! mv "$temp_file" "$target_file"; then
|
||||
log_error "Failed to update target file"
|
||||
rm -f "$temp_file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
#==============================================================================
|
||||
# Main Agent File Update Function
|
||||
#==============================================================================
|
||||
|
||||
update_agent_file() {
|
||||
local target_file="$1"
|
||||
local agent_name="$2"
|
||||
|
||||
if [[ -z "$target_file" ]] || [[ -z "$agent_name" ]]; then
|
||||
log_error "update_agent_file requires target_file and agent_name parameters"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log_info "Updating $agent_name context file: $target_file"
|
||||
|
||||
local project_name
|
||||
project_name=$(basename "$REPO_ROOT")
|
||||
local current_date
|
||||
current_date=$(date +%Y-%m-%d)
|
||||
|
||||
# Create directory if it doesn't exist
|
||||
local target_dir
|
||||
target_dir=$(dirname "$target_file")
|
||||
if [[ ! -d "$target_dir" ]]; then
|
||||
if ! mkdir -p "$target_dir"; then
|
||||
log_error "Failed to create directory: $target_dir"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -f "$target_file" ]]; then
|
||||
# Create new file from template
|
||||
local temp_file
|
||||
temp_file=$(mktemp) || {
|
||||
log_error "Failed to create temporary file"
|
||||
return 1
|
||||
}
|
||||
|
||||
if create_new_agent_file "$target_file" "$temp_file" "$project_name" "$current_date"; then
|
||||
if mv "$temp_file" "$target_file"; then
|
||||
log_success "Created new $agent_name context file"
|
||||
else
|
||||
log_error "Failed to move temporary file to $target_file"
|
||||
rm -f "$temp_file"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
log_error "Failed to create new agent file"
|
||||
rm -f "$temp_file"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
# Update existing file
|
||||
if [[ ! -r "$target_file" ]]; then
|
||||
log_error "Cannot read existing file: $target_file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! -w "$target_file" ]]; then
|
||||
log_error "Cannot write to existing file: $target_file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if update_existing_agent_file "$target_file" "$current_date"; then
|
||||
log_success "Updated existing $agent_name context file"
|
||||
else
|
||||
log_error "Failed to update existing agent file"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
#==============================================================================
|
||||
# Agent Selection and Processing
|
||||
#==============================================================================
|
||||
|
||||
update_specific_agent() {
|
||||
local agent_type="$1"
|
||||
|
||||
case "$agent_type" in
|
||||
claude)
|
||||
update_agent_file "$CLAUDE_FILE" "Claude Code"
|
||||
;;
|
||||
gemini)
|
||||
update_agent_file "$GEMINI_FILE" "Gemini CLI"
|
||||
;;
|
||||
copilot)
|
||||
update_agent_file "$COPILOT_FILE" "GitHub Copilot"
|
||||
;;
|
||||
cursor-agent)
|
||||
update_agent_file "$CURSOR_FILE" "Cursor IDE"
|
||||
;;
|
||||
qwen)
|
||||
update_agent_file "$QWEN_FILE" "Qwen Code"
|
||||
;;
|
||||
opencode)
|
||||
update_agent_file "$AGENTS_FILE" "opencode"
|
||||
;;
|
||||
codex)
|
||||
update_agent_file "$AGENTS_FILE" "Codex CLI"
|
||||
;;
|
||||
windsurf)
|
||||
update_agent_file "$WINDSURF_FILE" "Windsurf"
|
||||
;;
|
||||
kilocode)
|
||||
update_agent_file "$KILOCODE_FILE" "Kilo Code"
|
||||
;;
|
||||
auggie)
|
||||
update_agent_file "$AUGGIE_FILE" "Auggie CLI"
|
||||
;;
|
||||
roo)
|
||||
update_agent_file "$ROO_FILE" "Roo Code"
|
||||
;;
|
||||
codebuddy)
|
||||
update_agent_file "$CODEBUDDY_FILE" "CodeBuddy CLI"
|
||||
;;
|
||||
qoder)
|
||||
update_agent_file "$QODER_FILE" "Qoder CLI"
|
||||
;;
|
||||
amp)
|
||||
update_agent_file "$AMP_FILE" "Amp"
|
||||
;;
|
||||
shai)
|
||||
update_agent_file "$SHAI_FILE" "SHAI"
|
||||
;;
|
||||
q)
|
||||
update_agent_file "$Q_FILE" "Amazon Q Developer CLI"
|
||||
;;
|
||||
bob)
|
||||
update_agent_file "$BOB_FILE" "IBM Bob"
|
||||
;;
|
||||
*)
|
||||
log_error "Unknown agent type '$agent_type'"
|
||||
log_error "Expected: claude|gemini|copilot|cursor-agent|qwen|opencode|codex|windsurf|kilocode|auggie|roo|amp|shai|q|bob|qoder"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
update_all_existing_agents() {
|
||||
local found_agent=false
|
||||
|
||||
# Check each possible agent file and update if it exists
|
||||
if [[ -f "$CLAUDE_FILE" ]]; then
|
||||
update_agent_file "$CLAUDE_FILE" "Claude Code"
|
||||
found_agent=true
|
||||
fi
|
||||
|
||||
if [[ -f "$GEMINI_FILE" ]]; then
|
||||
update_agent_file "$GEMINI_FILE" "Gemini CLI"
|
||||
found_agent=true
|
||||
fi
|
||||
|
||||
if [[ -f "$COPILOT_FILE" ]]; then
|
||||
update_agent_file "$COPILOT_FILE" "GitHub Copilot"
|
||||
found_agent=true
|
||||
fi
|
||||
|
||||
if [[ -f "$CURSOR_FILE" ]]; then
|
||||
update_agent_file "$CURSOR_FILE" "Cursor IDE"
|
||||
found_agent=true
|
||||
fi
|
||||
|
||||
if [[ -f "$QWEN_FILE" ]]; then
|
||||
update_agent_file "$QWEN_FILE" "Qwen Code"
|
||||
found_agent=true
|
||||
fi
|
||||
|
||||
if [[ -f "$AGENTS_FILE" ]]; then
|
||||
update_agent_file "$AGENTS_FILE" "Codex/opencode"
|
||||
found_agent=true
|
||||
fi
|
||||
|
||||
if [[ -f "$WINDSURF_FILE" ]]; then
|
||||
update_agent_file "$WINDSURF_FILE" "Windsurf"
|
||||
found_agent=true
|
||||
fi
|
||||
|
||||
if [[ -f "$KILOCODE_FILE" ]]; then
|
||||
update_agent_file "$KILOCODE_FILE" "Kilo Code"
|
||||
found_agent=true
|
||||
fi
|
||||
|
||||
if [[ -f "$AUGGIE_FILE" ]]; then
|
||||
update_agent_file "$AUGGIE_FILE" "Auggie CLI"
|
||||
found_agent=true
|
||||
fi
|
||||
|
||||
if [[ -f "$ROO_FILE" ]]; then
|
||||
update_agent_file "$ROO_FILE" "Roo Code"
|
||||
found_agent=true
|
||||
fi
|
||||
|
||||
if [[ -f "$CODEBUDDY_FILE" ]]; then
|
||||
update_agent_file "$CODEBUDDY_FILE" "CodeBuddy CLI"
|
||||
found_agent=true
|
||||
fi
|
||||
|
||||
if [[ -f "$SHAI_FILE" ]]; then
|
||||
update_agent_file "$SHAI_FILE" "SHAI"
|
||||
found_agent=true
|
||||
fi
|
||||
|
||||
if [[ -f "$QODER_FILE" ]]; then
|
||||
update_agent_file "$QODER_FILE" "Qoder CLI"
|
||||
found_agent=true
|
||||
fi
|
||||
|
||||
if [[ -f "$Q_FILE" ]]; then
|
||||
update_agent_file "$Q_FILE" "Amazon Q Developer CLI"
|
||||
found_agent=true
|
||||
fi
|
||||
|
||||
if [[ -f "$BOB_FILE" ]]; then
|
||||
update_agent_file "$BOB_FILE" "IBM Bob"
|
||||
found_agent=true
|
||||
fi
|
||||
|
||||
# If no agent files exist, create a default Claude file
|
||||
if [[ "$found_agent" == false ]]; then
|
||||
log_info "No existing agent files found, creating default Claude file..."
|
||||
update_agent_file "$CLAUDE_FILE" "Claude Code"
|
||||
fi
|
||||
}
|
||||
print_summary() {
|
||||
echo
|
||||
log_info "Summary of changes:"
|
||||
|
||||
if [[ -n "$NEW_LANG" ]]; then
|
||||
echo " - Added language: $NEW_LANG"
|
||||
fi
|
||||
|
||||
if [[ -n "$NEW_FRAMEWORK" ]]; then
|
||||
echo " - Added framework: $NEW_FRAMEWORK"
|
||||
fi
|
||||
|
||||
if [[ -n "$NEW_DB" ]] && [[ "$NEW_DB" != "N/A" ]]; then
|
||||
echo " - Added database: $NEW_DB"
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
log_info "Usage: $0 [claude|gemini|copilot|cursor-agent|qwen|opencode|codex|windsurf|kilocode|auggie|codebuddy|shai|q|bob|qoder]"
|
||||
}
|
||||
|
||||
#==============================================================================
|
||||
# Main Execution
|
||||
#==============================================================================
|
||||
|
||||
main() {
|
||||
# Validate environment before proceeding
|
||||
validate_environment
|
||||
|
||||
log_info "=== Updating agent context files for feature $CURRENT_BRANCH ==="
|
||||
|
||||
# Parse the plan file to extract project information
|
||||
if ! parse_plan_data "$NEW_PLAN"; then
|
||||
log_error "Failed to parse plan data"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Process based on agent type argument
|
||||
local success=true
|
||||
|
||||
if [[ -z "$AGENT_TYPE" ]]; then
|
||||
# No specific agent provided - update all existing agent files
|
||||
log_info "No agent specified, updating all existing agent files..."
|
||||
if ! update_all_existing_agents; then
|
||||
success=false
|
||||
fi
|
||||
else
|
||||
# Specific agent provided - update only that agent
|
||||
log_info "Updating specific agent: $AGENT_TYPE"
|
||||
if ! update_specific_agent "$AGENT_TYPE"; then
|
||||
success=false
|
||||
fi
|
||||
fi
|
||||
|
||||
# Print summary
|
||||
print_summary
|
||||
|
||||
if [[ "$success" == true ]]; then
|
||||
log_success "Agent context update completed successfully"
|
||||
exit 0
|
||||
else
|
||||
log_error "Agent context update completed with errors"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Execute main function if script is run directly
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
main "$@"
|
||||
fi
|
||||
|
||||
28
.specify/templates/agent-file-template.md
Normal file
28
.specify/templates/agent-file-template.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# [PROJECT NAME] Development Guidelines
|
||||
|
||||
Auto-generated from all feature plans. Last updated: [DATE]
|
||||
|
||||
## Active Technologies
|
||||
|
||||
[EXTRACTED FROM ALL PLAN.MD FILES]
|
||||
|
||||
## Project Structure
|
||||
|
||||
```text
|
||||
[ACTUAL STRUCTURE FROM PLANS]
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
[ONLY COMMANDS FOR ACTIVE TECHNOLOGIES]
|
||||
|
||||
## Code Style
|
||||
|
||||
[LANGUAGE-SPECIFIC, ONLY FOR LANGUAGES IN USE]
|
||||
|
||||
## Recent Changes
|
||||
|
||||
[LAST 3 FEATURES AND WHAT THEY ADDED]
|
||||
|
||||
<!-- MANUAL ADDITIONS START -->
|
||||
<!-- MANUAL ADDITIONS END -->
|
||||
40
.specify/templates/checklist-template.md
Normal file
40
.specify/templates/checklist-template.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# [CHECKLIST TYPE] Checklist: [FEATURE NAME]
|
||||
|
||||
**Purpose**: [Brief description of what this checklist covers]
|
||||
**Created**: [DATE]
|
||||
**Feature**: [Link to spec.md or relevant documentation]
|
||||
|
||||
**Note**: This checklist is generated by the `/speckit.checklist` command based on feature context and requirements.
|
||||
|
||||
<!--
|
||||
============================================================================
|
||||
IMPORTANT: The checklist items below are SAMPLE ITEMS for illustration only.
|
||||
|
||||
The /speckit.checklist command MUST replace these with actual items based on:
|
||||
- User's specific checklist request
|
||||
- Feature requirements from spec.md
|
||||
- Technical context from plan.md
|
||||
- Implementation details from tasks.md
|
||||
|
||||
DO NOT keep these sample items in the generated checklist file.
|
||||
============================================================================
|
||||
-->
|
||||
|
||||
## [Category 1]
|
||||
|
||||
- [ ] CHK001 First checklist item with clear action
|
||||
- [ ] CHK002 Second checklist item
|
||||
- [ ] CHK003 Third checklist item
|
||||
|
||||
## [Category 2]
|
||||
|
||||
- [ ] CHK004 Another category item
|
||||
- [ ] CHK005 Item with specific criteria
|
||||
- [ ] CHK006 Final item in this category
|
||||
|
||||
## Notes
|
||||
|
||||
- Check items off as completed: `[x]`
|
||||
- Add comments or findings inline
|
||||
- Link to relevant resources or documentation
|
||||
- Items are numbered sequentially for easy reference
|
||||
104
.specify/templates/plan-template.md
Normal file
104
.specify/templates/plan-template.md
Normal file
@@ -0,0 +1,104 @@
|
||||
# Implementation Plan: [FEATURE]
|
||||
|
||||
**Branch**: `[###-feature-name]` | **Date**: [DATE] | **Spec**: [link]
|
||||
**Input**: Feature specification from `/specs/[###-feature-name]/spec.md`
|
||||
|
||||
**Note**: This template is filled in by the `/speckit.plan` command. See `.specify/templates/commands/plan.md` for the execution workflow.
|
||||
|
||||
## Summary
|
||||
|
||||
[Extract from feature spec: primary requirement + technical approach from research]
|
||||
|
||||
## Technical Context
|
||||
|
||||
<!--
|
||||
ACTION REQUIRED: Replace the content in this section with the technical details
|
||||
for the project. The structure here is presented in advisory capacity to guide
|
||||
the iteration process.
|
||||
-->
|
||||
|
||||
**Language/Version**: [e.g., Python 3.11, Swift 5.9, Rust 1.75 or NEEDS CLARIFICATION]
|
||||
**Primary Dependencies**: [e.g., FastAPI, UIKit, LLVM or NEEDS CLARIFICATION]
|
||||
**Storage**: [if applicable, e.g., PostgreSQL, CoreData, files or N/A]
|
||||
**Testing**: [e.g., pytest, XCTest, cargo test or NEEDS CLARIFICATION]
|
||||
**Target Platform**: [e.g., Linux server, iOS 15+, WASM or NEEDS CLARIFICATION]
|
||||
**Project Type**: [single/web/mobile - determines source structure]
|
||||
**Performance Goals**: [domain-specific, e.g., 1000 req/s, 10k lines/sec, 60 fps or NEEDS CLARIFICATION]
|
||||
**Constraints**: [domain-specific, e.g., <200ms p95, <100MB memory, offline-capable or NEEDS CLARIFICATION]
|
||||
**Scale/Scope**: [domain-specific, e.g., 10k users, 1M LOC, 50 screens or NEEDS CLARIFICATION]
|
||||
|
||||
## Constitution Check
|
||||
|
||||
*GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.*
|
||||
|
||||
[Gates determined based on constitution file]
|
||||
|
||||
## Project Structure
|
||||
|
||||
### Documentation (this feature)
|
||||
|
||||
```text
|
||||
specs/[###-feature]/
|
||||
├── plan.md # This file (/speckit.plan command output)
|
||||
├── research.md # Phase 0 output (/speckit.plan command)
|
||||
├── data-model.md # Phase 1 output (/speckit.plan command)
|
||||
├── quickstart.md # Phase 1 output (/speckit.plan command)
|
||||
├── contracts/ # Phase 1 output (/speckit.plan command)
|
||||
└── tasks.md # Phase 2 output (/speckit.tasks command - NOT created by /speckit.plan)
|
||||
```
|
||||
|
||||
### Source Code (repository root)
|
||||
<!--
|
||||
ACTION REQUIRED: Replace the placeholder tree below with the concrete layout
|
||||
for this feature. Delete unused options and expand the chosen structure with
|
||||
real paths (e.g., apps/admin, packages/something). The delivered plan must
|
||||
not include Option labels.
|
||||
-->
|
||||
|
||||
```text
|
||||
# [REMOVE IF UNUSED] Option 1: Single project (DEFAULT)
|
||||
src/
|
||||
├── models/
|
||||
├── services/
|
||||
├── cli/
|
||||
└── lib/
|
||||
|
||||
tests/
|
||||
├── contract/
|
||||
├── integration/
|
||||
└── unit/
|
||||
|
||||
# [REMOVE IF UNUSED] Option 2: Web application (when "frontend" + "backend" detected)
|
||||
backend/
|
||||
├── src/
|
||||
│ ├── models/
|
||||
│ ├── services/
|
||||
│ └── api/
|
||||
└── tests/
|
||||
|
||||
frontend/
|
||||
├── src/
|
||||
│ ├── components/
|
||||
│ ├── pages/
|
||||
│ └── services/
|
||||
└── tests/
|
||||
|
||||
# [REMOVE IF UNUSED] Option 3: Mobile + API (when "iOS/Android" detected)
|
||||
api/
|
||||
└── [same as backend above]
|
||||
|
||||
ios/ or android/
|
||||
└── [platform-specific structure: feature modules, UI flows, platform tests]
|
||||
```
|
||||
|
||||
**Structure Decision**: [Document the selected structure and reference the real
|
||||
directories captured above]
|
||||
|
||||
## Complexity Tracking
|
||||
|
||||
> **Fill ONLY if Constitution Check has violations that must be justified**
|
||||
|
||||
| Violation | Why Needed | Simpler Alternative Rejected Because |
|
||||
|-----------|------------|-------------------------------------|
|
||||
| [e.g., 4th project] | [current need] | [why 3 projects insufficient] |
|
||||
| [e.g., Repository pattern] | [specific problem] | [why direct DB access insufficient] |
|
||||
115
.specify/templates/spec-template.md
Normal file
115
.specify/templates/spec-template.md
Normal file
@@ -0,0 +1,115 @@
|
||||
# Feature Specification: [FEATURE NAME]
|
||||
|
||||
**Feature Branch**: `[###-feature-name]`
|
||||
**Created**: [DATE]
|
||||
**Status**: Draft
|
||||
**Input**: User description: "$ARGUMENTS"
|
||||
|
||||
## User Scenarios & Testing *(mandatory)*
|
||||
|
||||
<!--
|
||||
IMPORTANT: User stories should be PRIORITIZED as user journeys ordered by importance.
|
||||
Each user story/journey must be INDEPENDENTLY TESTABLE - meaning if you implement just ONE of them,
|
||||
you should still have a viable MVP (Minimum Viable Product) that delivers value.
|
||||
|
||||
Assign priorities (P1, P2, P3, etc.) to each story, where P1 is the most critical.
|
||||
Think of each story as a standalone slice of functionality that can be:
|
||||
- Developed independently
|
||||
- Tested independently
|
||||
- Deployed independently
|
||||
- Demonstrated to users independently
|
||||
-->
|
||||
|
||||
### User Story 1 - [Brief Title] (Priority: P1)
|
||||
|
||||
[Describe this user journey in plain language]
|
||||
|
||||
**Why this priority**: [Explain the value and why it has this priority level]
|
||||
|
||||
**Independent Test**: [Describe how this can be tested independently - e.g., "Can be fully tested by [specific action] and delivers [specific value]"]
|
||||
|
||||
**Acceptance Scenarios**:
|
||||
|
||||
1. **Given** [initial state], **When** [action], **Then** [expected outcome]
|
||||
2. **Given** [initial state], **When** [action], **Then** [expected outcome]
|
||||
|
||||
---
|
||||
|
||||
### User Story 2 - [Brief Title] (Priority: P2)
|
||||
|
||||
[Describe this user journey in plain language]
|
||||
|
||||
**Why this priority**: [Explain the value and why it has this priority level]
|
||||
|
||||
**Independent Test**: [Describe how this can be tested independently]
|
||||
|
||||
**Acceptance Scenarios**:
|
||||
|
||||
1. **Given** [initial state], **When** [action], **Then** [expected outcome]
|
||||
|
||||
---
|
||||
|
||||
### User Story 3 - [Brief Title] (Priority: P3)
|
||||
|
||||
[Describe this user journey in plain language]
|
||||
|
||||
**Why this priority**: [Explain the value and why it has this priority level]
|
||||
|
||||
**Independent Test**: [Describe how this can be tested independently]
|
||||
|
||||
**Acceptance Scenarios**:
|
||||
|
||||
1. **Given** [initial state], **When** [action], **Then** [expected outcome]
|
||||
|
||||
---
|
||||
|
||||
[Add more user stories as needed, each with an assigned priority]
|
||||
|
||||
### Edge Cases
|
||||
|
||||
<!--
|
||||
ACTION REQUIRED: The content in this section represents placeholders.
|
||||
Fill them out with the right edge cases.
|
||||
-->
|
||||
|
||||
- What happens when [boundary condition]?
|
||||
- How does system handle [error scenario]?
|
||||
|
||||
## Requirements *(mandatory)*
|
||||
|
||||
<!--
|
||||
ACTION REQUIRED: The content in this section represents placeholders.
|
||||
Fill them out with the right functional requirements.
|
||||
-->
|
||||
|
||||
### Functional Requirements
|
||||
|
||||
- **FR-001**: System MUST [specific capability, e.g., "allow users to create accounts"]
|
||||
- **FR-002**: System MUST [specific capability, e.g., "validate email addresses"]
|
||||
- **FR-003**: Users MUST be able to [key interaction, e.g., "reset their password"]
|
||||
- **FR-004**: System MUST [data requirement, e.g., "persist user preferences"]
|
||||
- **FR-005**: System MUST [behavior, e.g., "log all security events"]
|
||||
|
||||
*Example of marking unclear requirements:*
|
||||
|
||||
- **FR-006**: System MUST authenticate users via [NEEDS CLARIFICATION: auth method not specified - email/password, SSO, OAuth?]
|
||||
- **FR-007**: System MUST retain user data for [NEEDS CLARIFICATION: retention period not specified]
|
||||
|
||||
### Key Entities *(include if feature involves data)*
|
||||
|
||||
- **[Entity 1]**: [What it represents, key attributes without implementation]
|
||||
- **[Entity 2]**: [What it represents, relationships to other entities]
|
||||
|
||||
## Success Criteria *(mandatory)*
|
||||
|
||||
<!--
|
||||
ACTION REQUIRED: Define measurable success criteria.
|
||||
These must be technology-agnostic and measurable.
|
||||
-->
|
||||
|
||||
### Measurable Outcomes
|
||||
|
||||
- **SC-001**: [Measurable metric, e.g., "Users can complete account creation in under 2 minutes"]
|
||||
- **SC-002**: [Measurable metric, e.g., "System handles 1000 concurrent users without degradation"]
|
||||
- **SC-003**: [User satisfaction metric, e.g., "90% of users successfully complete primary task on first attempt"]
|
||||
- **SC-004**: [Business metric, e.g., "Reduce support tickets related to [X] by 50%"]
|
||||
251
.specify/templates/tasks-template.md
Normal file
251
.specify/templates/tasks-template.md
Normal file
@@ -0,0 +1,251 @@
|
||||
---
|
||||
|
||||
description: "Task list template for feature implementation"
|
||||
---
|
||||
|
||||
# Tasks: [FEATURE NAME]
|
||||
|
||||
**Input**: Design documents from `/specs/[###-feature-name]/`
|
||||
**Prerequisites**: plan.md (required), spec.md (required for user stories), research.md, data-model.md, contracts/
|
||||
|
||||
**Tests**: The examples below include test tasks. Tests are OPTIONAL - only include them if explicitly requested in the feature specification.
|
||||
|
||||
**Organization**: Tasks are grouped by user story to enable independent implementation and testing of each story.
|
||||
|
||||
## Format: `[ID] [P?] [Story] Description`
|
||||
|
||||
- **[P]**: Can run in parallel (different files, no dependencies)
|
||||
- **[Story]**: Which user story this task belongs to (e.g., US1, US2, US3)
|
||||
- Include exact file paths in descriptions
|
||||
|
||||
## Path Conventions
|
||||
|
||||
- **Single project**: `src/`, `tests/` at repository root
|
||||
- **Web app**: `backend/src/`, `frontend/src/`
|
||||
- **Mobile**: `api/src/`, `ios/src/` or `android/src/`
|
||||
- Paths shown below assume single project - adjust based on plan.md structure
|
||||
|
||||
<!--
|
||||
============================================================================
|
||||
IMPORTANT: The tasks below are SAMPLE TASKS for illustration purposes only.
|
||||
|
||||
The /speckit.tasks command MUST replace these with actual tasks based on:
|
||||
- User stories from spec.md (with their priorities P1, P2, P3...)
|
||||
- Feature requirements from plan.md
|
||||
- Entities from data-model.md
|
||||
- Endpoints from contracts/
|
||||
|
||||
Tasks MUST be organized by user story so each story can be:
|
||||
- Implemented independently
|
||||
- Tested independently
|
||||
- Delivered as an MVP increment
|
||||
|
||||
DO NOT keep these sample tasks in the generated tasks.md file.
|
||||
============================================================================
|
||||
-->
|
||||
|
||||
## Phase 1: Setup (Shared Infrastructure)
|
||||
|
||||
**Purpose**: Project initialization and basic structure
|
||||
|
||||
- [ ] T001 Create project structure per implementation plan
|
||||
- [ ] T002 Initialize [language] project with [framework] dependencies
|
||||
- [ ] T003 [P] Configure linting and formatting tools
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Foundational (Blocking Prerequisites)
|
||||
|
||||
**Purpose**: Core infrastructure that MUST be complete before ANY user story can be implemented
|
||||
|
||||
**⚠️ CRITICAL**: No user story work can begin until this phase is complete
|
||||
|
||||
Examples of foundational tasks (adjust based on your project):
|
||||
|
||||
- [ ] T004 Setup database schema and migrations framework
|
||||
- [ ] T005 [P] Implement authentication/authorization framework
|
||||
- [ ] T006 [P] Setup API routing and middleware structure
|
||||
- [ ] T007 Create base models/entities that all stories depend on
|
||||
- [ ] T008 Configure error handling and logging infrastructure
|
||||
- [ ] T009 Setup environment configuration management
|
||||
|
||||
**Checkpoint**: Foundation ready - user story implementation can now begin in parallel
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: User Story 1 - [Title] (Priority: P1) 🎯 MVP
|
||||
|
||||
**Goal**: [Brief description of what this story delivers]
|
||||
|
||||
**Independent Test**: [How to verify this story works on its own]
|
||||
|
||||
### Tests for User Story 1 (OPTIONAL - only if tests requested) ⚠️
|
||||
|
||||
> **NOTE: Write these tests FIRST, ensure they FAIL before implementation**
|
||||
|
||||
- [ ] T010 [P] [US1] Contract test for [endpoint] in tests/contract/test_[name].py
|
||||
- [ ] T011 [P] [US1] Integration test for [user journey] in tests/integration/test_[name].py
|
||||
|
||||
### Implementation for User Story 1
|
||||
|
||||
- [ ] T012 [P] [US1] Create [Entity1] model in src/models/[entity1].py
|
||||
- [ ] T013 [P] [US1] Create [Entity2] model in src/models/[entity2].py
|
||||
- [ ] T014 [US1] Implement [Service] in src/services/[service].py (depends on T012, T013)
|
||||
- [ ] T015 [US1] Implement [endpoint/feature] in src/[location]/[file].py
|
||||
- [ ] T016 [US1] Add validation and error handling
|
||||
- [ ] T017 [US1] Add logging for user story 1 operations
|
||||
|
||||
**Checkpoint**: At this point, User Story 1 should be fully functional and testable independently
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: User Story 2 - [Title] (Priority: P2)
|
||||
|
||||
**Goal**: [Brief description of what this story delivers]
|
||||
|
||||
**Independent Test**: [How to verify this story works on its own]
|
||||
|
||||
### Tests for User Story 2 (OPTIONAL - only if tests requested) ⚠️
|
||||
|
||||
- [ ] T018 [P] [US2] Contract test for [endpoint] in tests/contract/test_[name].py
|
||||
- [ ] T019 [P] [US2] Integration test for [user journey] in tests/integration/test_[name].py
|
||||
|
||||
### Implementation for User Story 2
|
||||
|
||||
- [ ] T020 [P] [US2] Create [Entity] model in src/models/[entity].py
|
||||
- [ ] T021 [US2] Implement [Service] in src/services/[service].py
|
||||
- [ ] T022 [US2] Implement [endpoint/feature] in src/[location]/[file].py
|
||||
- [ ] T023 [US2] Integrate with User Story 1 components (if needed)
|
||||
|
||||
**Checkpoint**: At this point, User Stories 1 AND 2 should both work independently
|
||||
|
||||
---
|
||||
|
||||
## Phase 5: User Story 3 - [Title] (Priority: P3)
|
||||
|
||||
**Goal**: [Brief description of what this story delivers]
|
||||
|
||||
**Independent Test**: [How to verify this story works on its own]
|
||||
|
||||
### Tests for User Story 3 (OPTIONAL - only if tests requested) ⚠️
|
||||
|
||||
- [ ] T024 [P] [US3] Contract test for [endpoint] in tests/contract/test_[name].py
|
||||
- [ ] T025 [P] [US3] Integration test for [user journey] in tests/integration/test_[name].py
|
||||
|
||||
### Implementation for User Story 3
|
||||
|
||||
- [ ] T026 [P] [US3] Create [Entity] model in src/models/[entity].py
|
||||
- [ ] T027 [US3] Implement [Service] in src/services/[service].py
|
||||
- [ ] T028 [US3] Implement [endpoint/feature] in src/[location]/[file].py
|
||||
|
||||
**Checkpoint**: All user stories should now be independently functional
|
||||
|
||||
---
|
||||
|
||||
[Add more user story phases as needed, following the same pattern]
|
||||
|
||||
---
|
||||
|
||||
## Phase N: Polish & Cross-Cutting Concerns
|
||||
|
||||
**Purpose**: Improvements that affect multiple user stories
|
||||
|
||||
- [ ] TXXX [P] Documentation updates in docs/
|
||||
- [ ] TXXX Code cleanup and refactoring
|
||||
- [ ] TXXX Performance optimization across all stories
|
||||
- [ ] TXXX [P] Additional unit tests (if requested) in tests/unit/
|
||||
- [ ] TXXX Security hardening
|
||||
- [ ] TXXX Run quickstart.md validation
|
||||
|
||||
---
|
||||
|
||||
## Dependencies & Execution Order
|
||||
|
||||
### Phase Dependencies
|
||||
|
||||
- **Setup (Phase 1)**: No dependencies - can start immediately
|
||||
- **Foundational (Phase 2)**: Depends on Setup completion - BLOCKS all user stories
|
||||
- **User Stories (Phase 3+)**: All depend on Foundational phase completion
|
||||
- User stories can then proceed in parallel (if staffed)
|
||||
- Or sequentially in priority order (P1 → P2 → P3)
|
||||
- **Polish (Final Phase)**: Depends on all desired user stories being complete
|
||||
|
||||
### User Story Dependencies
|
||||
|
||||
- **User Story 1 (P1)**: Can start after Foundational (Phase 2) - No dependencies on other stories
|
||||
- **User Story 2 (P2)**: Can start after Foundational (Phase 2) - May integrate with US1 but should be independently testable
|
||||
- **User Story 3 (P3)**: Can start after Foundational (Phase 2) - May integrate with US1/US2 but should be independently testable
|
||||
|
||||
### Within Each User Story
|
||||
|
||||
- Tests (if included) MUST be written and FAIL before implementation
|
||||
- Models before services
|
||||
- Services before endpoints
|
||||
- Core implementation before integration
|
||||
- Story complete before moving to next priority
|
||||
|
||||
### Parallel Opportunities
|
||||
|
||||
- All Setup tasks marked [P] can run in parallel
|
||||
- All Foundational tasks marked [P] can run in parallel (within Phase 2)
|
||||
- Once Foundational phase completes, all user stories can start in parallel (if team capacity allows)
|
||||
- All tests for a user story marked [P] can run in parallel
|
||||
- Models within a story marked [P] can run in parallel
|
||||
- Different user stories can be worked on in parallel by different team members
|
||||
|
||||
---
|
||||
|
||||
## Parallel Example: User Story 1
|
||||
|
||||
```bash
|
||||
# Launch all tests for User Story 1 together (if tests requested):
|
||||
Task: "Contract test for [endpoint] in tests/contract/test_[name].py"
|
||||
Task: "Integration test for [user journey] in tests/integration/test_[name].py"
|
||||
|
||||
# Launch all models for User Story 1 together:
|
||||
Task: "Create [Entity1] model in src/models/[entity1].py"
|
||||
Task: "Create [Entity2] model in src/models/[entity2].py"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Implementation Strategy
|
||||
|
||||
### MVP First (User Story 1 Only)
|
||||
|
||||
1. Complete Phase 1: Setup
|
||||
2. Complete Phase 2: Foundational (CRITICAL - blocks all stories)
|
||||
3. Complete Phase 3: User Story 1
|
||||
4. **STOP and VALIDATE**: Test User Story 1 independently
|
||||
5. Deploy/demo if ready
|
||||
|
||||
### Incremental Delivery
|
||||
|
||||
1. Complete Setup + Foundational → Foundation ready
|
||||
2. Add User Story 1 → Test independently → Deploy/Demo (MVP!)
|
||||
3. Add User Story 2 → Test independently → Deploy/Demo
|
||||
4. Add User Story 3 → Test independently → Deploy/Demo
|
||||
5. Each story adds value without breaking previous stories
|
||||
|
||||
### Parallel Team Strategy
|
||||
|
||||
With multiple developers:
|
||||
|
||||
1. Team completes Setup + Foundational together
|
||||
2. Once Foundational is done:
|
||||
- Developer A: User Story 1
|
||||
- Developer B: User Story 2
|
||||
- Developer C: User Story 3
|
||||
3. Stories complete and integrate independently
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
|
||||
- [P] tasks = different files, no dependencies
|
||||
- [Story] label maps task to specific user story for traceability
|
||||
- Each user story should be independently completable and testable
|
||||
- Verify tests fail before implementing
|
||||
- Commit after each task or logical group
|
||||
- Stop at any checkpoint to validate story independently
|
||||
- Avoid: vague tasks, same file conflicts, cross-story dependencies that break independence
|
||||
34
CLAUDE.md
Normal file
34
CLAUDE.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# xer-mcp Development Guidelines
|
||||
|
||||
Auto-generated from all feature plans. Last updated: 2026-01-06
|
||||
|
||||
## Active Technologies
|
||||
- SQLite in-memory database (001-schedule-tools)
|
||||
- Python 3.14 + mcp>=1.0.0 (MCP SDK), sqlite3 (stdlib) (001-schedule-tools)
|
||||
- In-memory SQLite database (populated from XER files at runtime) (001-schedule-tools)
|
||||
|
||||
- Python 3.14 + mcp (MCP SDK), sqlite3 (stdlib) (001-schedule-tools)
|
||||
|
||||
## Project Structure
|
||||
|
||||
```text
|
||||
src/
|
||||
tests/
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
cd src [ONLY COMMANDS FOR ACTIVE TECHNOLOGIES][ONLY COMMANDS FOR ACTIVE TECHNOLOGIES] pytest [ONLY COMMANDS FOR ACTIVE TECHNOLOGIES][ONLY COMMANDS FOR ACTIVE TECHNOLOGIES] ruff check .
|
||||
|
||||
## Code Style
|
||||
|
||||
Python 3.14: Follow standard conventions
|
||||
|
||||
## Recent Changes
|
||||
- 001-schedule-tools: Added Python 3.14 + mcp>=1.0.0 (MCP SDK), sqlite3 (stdlib)
|
||||
- 001-schedule-tools: Added Python 3.14 + mcp (MCP SDK), sqlite3 (stdlib)
|
||||
|
||||
- 001-schedule-tools: Added Python 3.14 + mcp (MCP SDK), sqlite3 (stdlib)
|
||||
|
||||
<!-- MANUAL ADDITIONS START -->
|
||||
<!-- MANUAL ADDITIONS END -->
|
||||
221
README.md
221
README.md
@@ -1,3 +1,220 @@
|
||||
# xer-mcp
|
||||
# XER MCP Server
|
||||
|
||||
MCP server for parsing Primavera P6 XER files and exposing schedule data through MCP tools
|
||||
An MCP (Model Context Protocol) server for parsing Primavera P6 XER files and exposing schedule data to AI assistants.
|
||||
|
||||
## Features
|
||||
|
||||
- Parse Primavera P6 XER export files
|
||||
- Query activities, relationships, milestones, and critical path
|
||||
- Pagination support with configurable limits
|
||||
- Multi-project file support
|
||||
- In-memory SQLite database for fast queries
|
||||
|
||||
## Installation
|
||||
|
||||
Requires Python 3.12+
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone https://git.prettyhefty.com/Bill/xer-mcp.git
|
||||
cd xer-mcp
|
||||
|
||||
# Install with uv
|
||||
uv sync
|
||||
|
||||
# Or install with pip
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Claude Desktop
|
||||
|
||||
Add to your Claude Desktop configuration (`~/.config/claude/claude_desktop_config.json` on Linux, `~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"xer-mcp": {
|
||||
"command": "uv",
|
||||
"args": ["run", "--directory", "/path/to/xer-mcp", "python", "-m", "xer_mcp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Other MCP Clients
|
||||
|
||||
Run the server directly:
|
||||
|
||||
```bash
|
||||
uv run python -m xer_mcp
|
||||
```
|
||||
|
||||
The server communicates via stdio using the MCP protocol.
|
||||
|
||||
## Available Tools
|
||||
|
||||
### load_xer
|
||||
|
||||
Load a Primavera P6 XER file for querying.
|
||||
|
||||
**Parameters:**
|
||||
- `file_path` (required): Absolute path to the XER file
|
||||
- `project_id` (optional): Project ID to select (required for multi-project files)
|
||||
|
||||
**Example:**
|
||||
```json
|
||||
{
|
||||
"file_path": "/path/to/schedule.xer"
|
||||
}
|
||||
```
|
||||
|
||||
### list_activities
|
||||
|
||||
List activities with optional filtering and pagination.
|
||||
|
||||
**Parameters:**
|
||||
- `start_date` (optional): Filter activities starting on or after (YYYY-MM-DD)
|
||||
- `end_date` (optional): Filter activities ending on or before (YYYY-MM-DD)
|
||||
- `wbs_id` (optional): Filter by WBS element ID
|
||||
- `activity_type` (optional): Filter by type (TT_Task, TT_Mile, TT_LOE, TT_WBS, TT_Rsrc)
|
||||
- `limit` (optional): Maximum results (default: 100, max: 1000)
|
||||
- `offset` (optional): Number of results to skip (default: 0)
|
||||
|
||||
**Returns:** List of activities with pagination metadata
|
||||
|
||||
### get_activity
|
||||
|
||||
Get detailed information for a specific activity.
|
||||
|
||||
**Parameters:**
|
||||
- `activity_id` (required): The task_id of the activity
|
||||
|
||||
**Returns:** Activity details including WBS name and relationship counts
|
||||
|
||||
### list_relationships
|
||||
|
||||
List all activity relationships (dependencies) with pagination.
|
||||
|
||||
**Parameters:**
|
||||
- `limit` (optional): Maximum results (default: 100, max: 1000)
|
||||
- `offset` (optional): Number of results to skip (default: 0)
|
||||
|
||||
**Returns:** List of relationships with predecessor/successor info
|
||||
|
||||
### get_predecessors
|
||||
|
||||
Get predecessor activities for a given activity.
|
||||
|
||||
**Parameters:**
|
||||
- `activity_id` (required): The task_id of the activity
|
||||
|
||||
**Returns:** List of predecessor activities with relationship type and lag
|
||||
|
||||
### get_successors
|
||||
|
||||
Get successor activities for a given activity.
|
||||
|
||||
**Parameters:**
|
||||
- `activity_id` (required): The task_id of the activity
|
||||
|
||||
**Returns:** List of successor activities with relationship type and lag
|
||||
|
||||
### get_project_summary
|
||||
|
||||
Get a summary of the loaded project.
|
||||
|
||||
**Parameters:** None
|
||||
|
||||
**Returns:**
|
||||
- `project_name`: Name of the project
|
||||
- `plan_start_date`: Planned start date
|
||||
- `plan_end_date`: Planned end date
|
||||
- `activity_count`: Total number of activities
|
||||
- `milestone_count`: Number of milestones
|
||||
- `critical_activity_count`: Number of activities on critical path
|
||||
|
||||
### list_milestones
|
||||
|
||||
List all milestone activities in the project.
|
||||
|
||||
**Parameters:** None
|
||||
|
||||
**Returns:** List of milestone activities with dates and status
|
||||
|
||||
### get_critical_path
|
||||
|
||||
Get all activities on the critical path.
|
||||
|
||||
**Parameters:** None
|
||||
|
||||
**Returns:** List of critical path activities ordered by start date
|
||||
|
||||
## Usage Example
|
||||
|
||||
1. First, load an XER file:
|
||||
```
|
||||
Use the load_xer tool with file_path: "/path/to/my-schedule.xer"
|
||||
```
|
||||
|
||||
2. Get a project overview:
|
||||
```
|
||||
Use the get_project_summary tool
|
||||
```
|
||||
|
||||
3. List upcoming milestones:
|
||||
```
|
||||
Use the list_milestones tool
|
||||
```
|
||||
|
||||
4. View critical path:
|
||||
```
|
||||
Use the get_critical_path tool
|
||||
```
|
||||
|
||||
5. Query specific activities:
|
||||
```
|
||||
Use list_activities with start_date: "2026-01-01" and end_date: "2026-03-31"
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
All query tools return a `NO_FILE_LOADED` error if called before loading an XER file:
|
||||
|
||||
```json
|
||||
{
|
||||
"error": {
|
||||
"code": "NO_FILE_LOADED",
|
||||
"message": "No XER file is loaded. Use the load_xer tool first."
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Relationship Types
|
||||
|
||||
The server supports all P6 relationship types:
|
||||
- **FS** (Finish-to-Start): Successor starts after predecessor finishes
|
||||
- **SS** (Start-to-Start): Successor starts when predecessor starts
|
||||
- **FF** (Finish-to-Finish): Successor finishes when predecessor finishes
|
||||
- **SF** (Start-to-Finish): Successor finishes when predecessor starts
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
# Run tests
|
||||
uv run pytest
|
||||
|
||||
# Run with coverage
|
||||
uv run pytest --cov=xer_mcp
|
||||
|
||||
# Lint
|
||||
uv run ruff check src/ tests/
|
||||
|
||||
# Format
|
||||
uv run ruff format src/ tests/
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
50
pyproject.toml
Normal file
50
pyproject.toml
Normal file
@@ -0,0 +1,50 @@
|
||||
[project]
|
||||
name = "xer-mcp"
|
||||
version = "0.1.0"
|
||||
description = "MCP server for querying Primavera P6 XER schedule data"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.14"
|
||||
dependencies = [
|
||||
"mcp>=1.0.0",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
"pytest>=8.0.0",
|
||||
"pytest-asyncio>=0.24.0",
|
||||
"ruff>=0.8.0",
|
||||
]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["src/xer_mcp"]
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 100
|
||||
target-version = "py314"
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = [
|
||||
"E", # pycodestyle errors
|
||||
"W", # pycodestyle warnings
|
||||
"F", # Pyflakes
|
||||
"I", # isort
|
||||
"B", # flake8-bugbear
|
||||
"C4", # flake8-comprehensions
|
||||
"UP", # pyupgrade
|
||||
]
|
||||
ignore = [
|
||||
"E501", # line too long (handled by formatter)
|
||||
]
|
||||
|
||||
[tool.ruff.format]
|
||||
quote-style = "double"
|
||||
indent-style = "space"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
asyncio_mode = "auto"
|
||||
testpaths = ["tests"]
|
||||
pythonpath = ["src"]
|
||||
42
specs/001-schedule-tools/checklists/requirements.md
Normal file
42
specs/001-schedule-tools/checklists/requirements.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# Specification Quality Checklist: Project Schedule Tools
|
||||
|
||||
**Purpose**: Validate specification completeness and quality before proceeding to planning
|
||||
**Created**: 2026-01-06
|
||||
**Feature**: [spec.md](../spec.md)
|
||||
|
||||
## Content Quality
|
||||
|
||||
- [x] No implementation details (languages, frameworks, APIs)
|
||||
- [x] Focused on user value and business needs
|
||||
- [x] Written for non-technical stakeholders
|
||||
- [x] All mandatory sections completed
|
||||
|
||||
## Requirement Completeness
|
||||
|
||||
- [x] No [NEEDS CLARIFICATION] markers remain
|
||||
- [x] Requirements are testable and unambiguous
|
||||
- [x] Success criteria are measurable
|
||||
- [x] Success criteria are technology-agnostic (no implementation details)
|
||||
- [x] All acceptance scenarios are defined
|
||||
- [x] Edge cases are identified
|
||||
- [x] Scope is clearly bounded
|
||||
- [x] Dependencies and assumptions identified
|
||||
|
||||
## Feature Readiness
|
||||
|
||||
- [x] All functional requirements have clear acceptance criteria
|
||||
- [x] User scenarios cover primary flows
|
||||
- [x] Feature meets measurable outcomes defined in Success Criteria
|
||||
- [x] No implementation details leak into specification
|
||||
|
||||
## Notes
|
||||
|
||||
- Specification passed all validation checks
|
||||
- Clarification session completed 2026-01-06 (4 questions resolved)
|
||||
- Ready for `/speckit.plan`
|
||||
- 4 user stories defined (2 P1, 1 P2, 1 P3)
|
||||
- 14 functional requirements specified (added FR-013, FR-014 for pagination)
|
||||
- 7 measurable success criteria defined
|
||||
- 5 edge cases documented
|
||||
- Pagination limits (100 default) added to User Stories 2 and 3
|
||||
- Multi-project handling clarified in User Story 1
|
||||
374
specs/001-schedule-tools/contracts/mcp-tools.json
Normal file
374
specs/001-schedule-tools/contracts/mcp-tools.json
Normal file
@@ -0,0 +1,374 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"title": "XER MCP Server Tools",
|
||||
"description": "MCP tool definitions for Primavera P6 XER file analysis",
|
||||
"version": "0.1.0",
|
||||
"tools": [
|
||||
{
|
||||
"name": "load_xer",
|
||||
"description": "Load a Primavera P6 XER file and parse its schedule data. For multi-project files, specify project_id to select a project.",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"file_path": {
|
||||
"type": "string",
|
||||
"description": "Absolute path to the XER file"
|
||||
},
|
||||
"project_id": {
|
||||
"type": "string",
|
||||
"description": "Project ID to select (required for multi-project files)"
|
||||
}
|
||||
},
|
||||
"required": ["file_path"]
|
||||
},
|
||||
"outputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": { "type": "boolean" },
|
||||
"project": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"proj_id": { "type": "string" },
|
||||
"proj_short_name": { "type": "string" },
|
||||
"plan_start_date": { "type": "string", "format": "date-time" },
|
||||
"plan_end_date": { "type": "string", "format": "date-time" }
|
||||
}
|
||||
},
|
||||
"activity_count": { "type": "integer" },
|
||||
"relationship_count": { "type": "integer" },
|
||||
"available_projects": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"proj_id": { "type": "string" },
|
||||
"proj_short_name": { "type": "string" }
|
||||
}
|
||||
},
|
||||
"description": "Only present for multi-project files without selection"
|
||||
},
|
||||
"warnings": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "list_activities",
|
||||
"description": "List activities from the loaded XER file with optional filtering and pagination.",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"start_date": {
|
||||
"type": "string",
|
||||
"format": "date",
|
||||
"description": "Filter activities starting on or after this date (YYYY-MM-DD)"
|
||||
},
|
||||
"end_date": {
|
||||
"type": "string",
|
||||
"format": "date",
|
||||
"description": "Filter activities ending on or before this date (YYYY-MM-DD)"
|
||||
},
|
||||
"wbs_id": {
|
||||
"type": "string",
|
||||
"description": "Filter by WBS element ID"
|
||||
},
|
||||
"activity_type": {
|
||||
"type": "string",
|
||||
"enum": ["TT_Task", "TT_Mile", "TT_LOE", "TT_WBS", "TT_Rsrc"],
|
||||
"description": "Filter by activity type"
|
||||
},
|
||||
"limit": {
|
||||
"type": "integer",
|
||||
"default": 100,
|
||||
"minimum": 1,
|
||||
"maximum": 1000,
|
||||
"description": "Maximum number of activities to return"
|
||||
},
|
||||
"offset": {
|
||||
"type": "integer",
|
||||
"default": 0,
|
||||
"minimum": 0,
|
||||
"description": "Number of activities to skip"
|
||||
}
|
||||
}
|
||||
},
|
||||
"outputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"activities": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/ActivitySummary"
|
||||
}
|
||||
},
|
||||
"pagination": { "$ref": "#/$defs/Pagination" }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "get_activity",
|
||||
"description": "Get detailed information for a specific activity by ID.",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"activity_id": {
|
||||
"type": "string",
|
||||
"description": "The task_id of the activity"
|
||||
}
|
||||
},
|
||||
"required": ["activity_id"]
|
||||
},
|
||||
"outputSchema": {
|
||||
"$ref": "#/$defs/ActivityDetail"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "list_relationships",
|
||||
"description": "List all relationships (dependencies) with pagination.",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"limit": {
|
||||
"type": "integer",
|
||||
"default": 100,
|
||||
"minimum": 1,
|
||||
"maximum": 1000
|
||||
},
|
||||
"offset": {
|
||||
"type": "integer",
|
||||
"default": 0,
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"outputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"relationships": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "#/$defs/Relationship" }
|
||||
},
|
||||
"pagination": { "$ref": "#/$defs/Pagination" }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "get_predecessors",
|
||||
"description": "Get all predecessor activities for a given activity.",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"activity_id": {
|
||||
"type": "string",
|
||||
"description": "The task_id of the activity"
|
||||
}
|
||||
},
|
||||
"required": ["activity_id"]
|
||||
},
|
||||
"outputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"activity_id": { "type": "string" },
|
||||
"predecessors": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "#/$defs/RelatedActivity" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "get_successors",
|
||||
"description": "Get all successor activities for a given activity.",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"activity_id": {
|
||||
"type": "string",
|
||||
"description": "The task_id of the activity"
|
||||
}
|
||||
},
|
||||
"required": ["activity_id"]
|
||||
},
|
||||
"outputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"activity_id": { "type": "string" },
|
||||
"successors": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "#/$defs/RelatedActivity" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "get_project_summary",
|
||||
"description": "Get high-level summary of the loaded project.",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
},
|
||||
"outputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"project": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"proj_id": { "type": "string" },
|
||||
"proj_short_name": { "type": "string" },
|
||||
"plan_start_date": { "type": "string", "format": "date-time" },
|
||||
"plan_end_date": { "type": "string", "format": "date-time" }
|
||||
}
|
||||
},
|
||||
"activity_count": { "type": "integer" },
|
||||
"milestone_count": { "type": "integer" },
|
||||
"relationship_count": { "type": "integer" },
|
||||
"wbs_element_count": { "type": "integer" },
|
||||
"critical_activity_count": { "type": "integer" }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "list_milestones",
|
||||
"description": "List all milestone activities with pagination.",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"limit": {
|
||||
"type": "integer",
|
||||
"default": 100,
|
||||
"minimum": 1,
|
||||
"maximum": 1000
|
||||
},
|
||||
"offset": {
|
||||
"type": "integer",
|
||||
"default": 0,
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"outputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"milestones": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "#/$defs/ActivitySummary" }
|
||||
},
|
||||
"pagination": { "$ref": "#/$defs/Pagination" }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "get_critical_path",
|
||||
"description": "Get activities on the critical path (using P6's stored critical flags).",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"limit": {
|
||||
"type": "integer",
|
||||
"default": 100,
|
||||
"minimum": 1,
|
||||
"maximum": 1000
|
||||
},
|
||||
"offset": {
|
||||
"type": "integer",
|
||||
"default": 0,
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"outputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"critical_activities": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "#/$defs/ActivitySummary" }
|
||||
},
|
||||
"pagination": { "$ref": "#/$defs/Pagination" }
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"$defs": {
|
||||
"ActivitySummary": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"task_id": { "type": "string" },
|
||||
"task_code": { "type": "string" },
|
||||
"task_name": { "type": "string" },
|
||||
"task_type": { "type": "string" },
|
||||
"target_start_date": { "type": "string", "format": "date-time" },
|
||||
"target_end_date": { "type": "string", "format": "date-time" },
|
||||
"status_code": { "type": "string" },
|
||||
"driving_path_flag": { "type": "boolean" },
|
||||
"milestone_type": { "type": "string", "enum": ["start", "finish", null], "description": "Type of milestone: 'start' for start milestones, 'finish' for finish milestones, null for non-milestones" }
|
||||
}
|
||||
},
|
||||
"ActivityDetail": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"task_id": { "type": "string" },
|
||||
"task_code": { "type": "string" },
|
||||
"task_name": { "type": "string" },
|
||||
"task_type": { "type": "string" },
|
||||
"wbs_id": { "type": "string" },
|
||||
"wbs_name": { "type": "string" },
|
||||
"target_start_date": { "type": "string", "format": "date-time" },
|
||||
"target_end_date": { "type": "string", "format": "date-time" },
|
||||
"act_start_date": { "type": "string", "format": "date-time" },
|
||||
"act_end_date": { "type": "string", "format": "date-time" },
|
||||
"total_float_hr_cnt": { "type": "number" },
|
||||
"status_code": { "type": "string" },
|
||||
"driving_path_flag": { "type": "boolean" },
|
||||
"predecessor_count": { "type": "integer" },
|
||||
"successor_count": { "type": "integer" }
|
||||
}
|
||||
},
|
||||
"Relationship": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"task_pred_id": { "type": "string" },
|
||||
"task_id": { "type": "string" },
|
||||
"task_name": { "type": "string" },
|
||||
"pred_task_id": { "type": "string" },
|
||||
"pred_task_name": { "type": "string" },
|
||||
"pred_type": {
|
||||
"type": "string",
|
||||
"enum": ["FS", "SS", "FF", "SF"]
|
||||
},
|
||||
"lag_hr_cnt": { "type": "number" },
|
||||
"driving": {
|
||||
"type": "boolean",
|
||||
"description": "True if this relationship drives the successor's early start date"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RelatedActivity": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"task_id": { "type": "string" },
|
||||
"task_code": { "type": "string" },
|
||||
"task_name": { "type": "string" },
|
||||
"relationship_type": {
|
||||
"type": "string",
|
||||
"enum": ["FS", "SS", "FF", "SF"]
|
||||
},
|
||||
"lag_hr_cnt": { "type": "number" },
|
||||
"driving": {
|
||||
"type": "boolean",
|
||||
"description": "True if this relationship drives the successor's early start date"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Pagination": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"total_count": { "type": "integer" },
|
||||
"offset": { "type": "integer" },
|
||||
"limit": { "type": "integer" },
|
||||
"has_more": { "type": "boolean" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
253
specs/001-schedule-tools/data-model.md
Normal file
253
specs/001-schedule-tools/data-model.md
Normal file
@@ -0,0 +1,253 @@
|
||||
# Data Model: Project Schedule Tools
|
||||
|
||||
**Date**: 2026-01-06
|
||||
**Branch**: `001-schedule-tools`
|
||||
|
||||
## Entity Overview
|
||||
|
||||
```
|
||||
┌─────────────┐ ┌─────────────┐
|
||||
│ Project │───────│ WBS │
|
||||
└─────────────┘ └─────────────┘
|
||||
│ │
|
||||
│ │
|
||||
▼ ▼
|
||||
┌─────────────┐ ┌─────────────┐
|
||||
│ Activity │◄──────│ Relationship│
|
||||
└─────────────┘ └─────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────┐
|
||||
│ Calendar │ (internal only)
|
||||
└─────────────┘
|
||||
```
|
||||
|
||||
## Entities
|
||||
|
||||
### Project
|
||||
|
||||
Top-level container representing a P6 project.
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| proj_id | string | Yes | Unique project identifier from P6 |
|
||||
| proj_short_name | string | Yes | Short display name |
|
||||
| plan_start_date | datetime | No | Planned start date |
|
||||
| plan_end_date | datetime | No | Planned end date |
|
||||
| loaded_at | datetime | Yes | When file was loaded into server |
|
||||
|
||||
**XER Source**: `PROJECT` table
|
||||
|
||||
**Validation Rules**:
|
||||
- proj_id must be unique within loaded data
|
||||
- proj_short_name must not be empty
|
||||
|
||||
### Activity
|
||||
|
||||
A unit of work in the schedule.
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| task_id | string | Yes | Unique activity identifier |
|
||||
| proj_id | string | Yes | Parent project reference |
|
||||
| wbs_id | string | No | WBS element reference |
|
||||
| task_code | string | Yes | User-visible activity code |
|
||||
| task_name | string | Yes | Activity description |
|
||||
| task_type | enum | Yes | TT_Task, TT_Mile, TT_LOE, TT_WBS, TT_Rsrc |
|
||||
| milestone_type | enum | No | 'start' for start milestones, 'finish' for finish milestones, null for non-milestones |
|
||||
| target_start_date | datetime | No | Planned start |
|
||||
| target_end_date | datetime | No | Planned finish |
|
||||
| early_start_date | datetime | No | Calculated early start (for driving computation) |
|
||||
| early_end_date | datetime | No | Calculated early finish (for driving computation) |
|
||||
| act_start_date | datetime | No | Actual start |
|
||||
| act_end_date | datetime | No | Actual finish |
|
||||
| total_float_hr_cnt | float | No | Total float in hours |
|
||||
| driving_path_flag | boolean | No | True if on critical path |
|
||||
| status_code | enum | No | TK_NotStart, TK_Active, TK_Complete |
|
||||
|
||||
**XER Source**: `TASK` table
|
||||
|
||||
**Validation Rules**:
|
||||
- task_id must be unique
|
||||
- task_code must not be empty
|
||||
- task_name must not be empty
|
||||
- If act_start_date exists, target_start_date should exist
|
||||
- If act_end_date exists, act_start_date must exist
|
||||
|
||||
**State Transitions**:
|
||||
```
|
||||
TK_NotStart ──[actual start recorded]──► TK_Active
|
||||
TK_Active ──[actual finish recorded]──► TK_Complete
|
||||
```
|
||||
|
||||
### Relationship
|
||||
|
||||
A dependency link between two activities.
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| task_pred_id | string | Yes | Unique relationship identifier |
|
||||
| task_id | string | Yes | Successor activity (the one being constrained) |
|
||||
| pred_task_id | string | Yes | Predecessor activity (the one constraining) |
|
||||
| pred_type | enum | Yes | PR_FS, PR_SS, PR_FF, PR_SF |
|
||||
| lag_hr_cnt | float | No | Lag time in hours (can be negative) |
|
||||
| driving | boolean | No | **Computed** - True if this relationship determines successor's early dates |
|
||||
|
||||
**XER Source**: `TASKPRED` table
|
||||
|
||||
**Driving Flag Computation** (not stored, computed at query time):
|
||||
|
||||
The `driving` flag indicates whether this predecessor relationship constrains the successor activity's early start date. It is computed by comparing dates:
|
||||
|
||||
```python
|
||||
# For FS (Finish-to-Start) relationships:
|
||||
driving = (predecessor.early_end_date + lag_hr_cnt ≈ successor.early_start_date)
|
||||
|
||||
# With 1-hour tolerance for floating point arithmetic
|
||||
```
|
||||
|
||||
This requires JOIN on activity dates when querying relationships.
|
||||
|
||||
**Relationship Types**:
|
||||
| Code | Name | Meaning |
|
||||
|------|------|---------|
|
||||
| PR_FS | Finish-to-Start | Successor starts after predecessor finishes |
|
||||
| PR_SS | Start-to-Start | Successor starts after predecessor starts |
|
||||
| PR_FF | Finish-to-Finish | Successor finishes after predecessor finishes |
|
||||
| PR_SF | Start-to-Finish | Successor finishes after predecessor starts |
|
||||
|
||||
**Validation Rules**:
|
||||
- task_id and pred_task_id must reference existing activities
|
||||
- task_id must not equal pred_task_id (no self-reference)
|
||||
- pred_type must be one of the four valid types
|
||||
|
||||
### WBS (Work Breakdown Structure)
|
||||
|
||||
Hierarchical organization of activities.
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| wbs_id | string | Yes | Unique WBS identifier |
|
||||
| proj_id | string | Yes | Parent project reference |
|
||||
| parent_wbs_id | string | No | Parent WBS element (null for root) |
|
||||
| wbs_short_name | string | Yes | Short code |
|
||||
| wbs_name | string | No | Full description |
|
||||
| wbs_level | integer | No | Hierarchy depth (0 = root) |
|
||||
|
||||
**XER Source**: `PROJWBS` table
|
||||
|
||||
**Validation Rules**:
|
||||
- wbs_id must be unique
|
||||
- parent_wbs_id must reference existing WBS or be null
|
||||
- No circular parent references
|
||||
|
||||
### Calendar (Internal)
|
||||
|
||||
Work schedule definition. Not exposed via MCP tools.
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| clndr_id | string | Yes | Unique calendar identifier |
|
||||
| clndr_name | string | Yes | Calendar name |
|
||||
| day_hr_cnt | float | No | Hours per work day |
|
||||
| week_hr_cnt | float | No | Hours per work week |
|
||||
|
||||
**XER Source**: `CALENDAR` table
|
||||
|
||||
**Note**: Parsed and stored but not exposed as queryable. Used internally if duration calculations are needed in future.
|
||||
|
||||
### PaginationMetadata
|
||||
|
||||
Response wrapper for paginated queries.
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| total_count | integer | Yes | Total items matching query |
|
||||
| offset | integer | Yes | Current offset (0-based) |
|
||||
| limit | integer | Yes | Items per page |
|
||||
| has_more | boolean | Yes | True if more items exist |
|
||||
|
||||
## SQLite Schema
|
||||
|
||||
```sql
|
||||
-- Projects
|
||||
CREATE TABLE projects (
|
||||
proj_id TEXT PRIMARY KEY,
|
||||
proj_short_name TEXT NOT NULL,
|
||||
plan_start_date TEXT,
|
||||
plan_end_date TEXT,
|
||||
loaded_at TEXT NOT NULL DEFAULT (datetime('now'))
|
||||
);
|
||||
|
||||
-- Activities
|
||||
CREATE TABLE activities (
|
||||
task_id TEXT PRIMARY KEY,
|
||||
proj_id TEXT NOT NULL,
|
||||
wbs_id TEXT,
|
||||
task_code TEXT NOT NULL,
|
||||
task_name TEXT NOT NULL,
|
||||
task_type TEXT NOT NULL,
|
||||
target_start_date TEXT,
|
||||
target_end_date TEXT,
|
||||
early_start_date TEXT, -- Used for driving relationship computation
|
||||
early_end_date TEXT, -- Used for driving relationship computation
|
||||
act_start_date TEXT,
|
||||
act_end_date TEXT,
|
||||
total_float_hr_cnt REAL,
|
||||
driving_path_flag INTEGER DEFAULT 0,
|
||||
status_code TEXT,
|
||||
FOREIGN KEY (proj_id) REFERENCES projects(proj_id),
|
||||
FOREIGN KEY (wbs_id) REFERENCES wbs(wbs_id)
|
||||
);
|
||||
|
||||
-- Relationships
|
||||
CREATE TABLE relationships (
|
||||
task_pred_id TEXT PRIMARY KEY,
|
||||
task_id TEXT NOT NULL,
|
||||
pred_task_id TEXT NOT NULL,
|
||||
pred_type TEXT NOT NULL,
|
||||
lag_hr_cnt REAL DEFAULT 0,
|
||||
FOREIGN KEY (task_id) REFERENCES activities(task_id),
|
||||
FOREIGN KEY (pred_task_id) REFERENCES activities(task_id)
|
||||
);
|
||||
|
||||
-- WBS
|
||||
CREATE TABLE wbs (
|
||||
wbs_id TEXT PRIMARY KEY,
|
||||
proj_id TEXT NOT NULL,
|
||||
parent_wbs_id TEXT,
|
||||
wbs_short_name TEXT NOT NULL,
|
||||
wbs_name TEXT,
|
||||
FOREIGN KEY (proj_id) REFERENCES projects(proj_id),
|
||||
FOREIGN KEY (parent_wbs_id) REFERENCES wbs(wbs_id)
|
||||
);
|
||||
|
||||
-- Calendars (internal)
|
||||
CREATE TABLE calendars (
|
||||
clndr_id TEXT PRIMARY KEY,
|
||||
clndr_name TEXT NOT NULL,
|
||||
day_hr_cnt REAL,
|
||||
week_hr_cnt REAL
|
||||
);
|
||||
|
||||
-- Indexes
|
||||
CREATE INDEX idx_activities_proj ON activities(proj_id);
|
||||
CREATE INDEX idx_activities_wbs ON activities(wbs_id);
|
||||
CREATE INDEX idx_activities_type ON activities(task_type);
|
||||
CREATE INDEX idx_activities_critical ON activities(driving_path_flag) WHERE driving_path_flag = 1;
|
||||
CREATE INDEX idx_activities_dates ON activities(target_start_date, target_end_date);
|
||||
CREATE INDEX idx_relationships_task ON relationships(task_id);
|
||||
CREATE INDEX idx_relationships_pred ON relationships(pred_task_id);
|
||||
CREATE INDEX idx_wbs_parent ON wbs(parent_wbs_id);
|
||||
CREATE INDEX idx_wbs_proj ON wbs(proj_id);
|
||||
```
|
||||
|
||||
## Date Handling
|
||||
|
||||
All dates stored as ISO8601 strings in SQLite for portability:
|
||||
- Format: `YYYY-MM-DDTHH:MM:SS`
|
||||
- Timezone: Preserved from XER if present, otherwise naive
|
||||
- Comparisons: String comparison works correctly with ISO8601
|
||||
|
||||
XER date format: `YYYY-MM-DD HH:MM` (space-separated, no seconds)
|
||||
Conversion on import: Add `:00` for seconds, replace space with `T`
|
||||
155
specs/001-schedule-tools/plan.md
Normal file
155
specs/001-schedule-tools/plan.md
Normal file
@@ -0,0 +1,155 @@
|
||||
# Implementation Plan: Project Schedule Tools
|
||||
|
||||
**Branch**: `001-schedule-tools` | **Date**: 2026-01-08 | **Spec**: [spec.md](./spec.md)
|
||||
**Input**: Feature specification from `/specs/001-schedule-tools/spec.md`
|
||||
|
||||
## Summary
|
||||
|
||||
Build an MCP server that provides 9 tools for querying Primavera P6 XER schedule data. The server parses XER files into an in-memory SQLite database and exposes tools for loading files, querying activities, relationships, milestones, critical path, and project summary. Uses Python 3.14 with the MCP SDK and follows TDD practices per the project constitution.
|
||||
|
||||
## Technical Context
|
||||
|
||||
**Language/Version**: Python 3.14
|
||||
**Primary Dependencies**: mcp>=1.0.0 (MCP SDK), sqlite3 (stdlib)
|
||||
**Storage**: In-memory SQLite database (populated from XER files at runtime)
|
||||
**Testing**: pytest>=8.0.0, pytest-asyncio>=0.24.0
|
||||
**Target Platform**: Local server (Linux/macOS/Windows with file system access)
|
||||
**Project Type**: Single project
|
||||
**Performance Goals**: Load + query XER files ≤5 seconds for 10,000 activities; query response <1 second
|
||||
**Constraints**: Memory sufficient for 50,000 activities; single-user operation
|
||||
**Scale/Scope**: MCP server with 9 tools; handles typical P6 project files (up to 50,000 activities)
|
||||
|
||||
## Constitution Check
|
||||
|
||||
*GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.*
|
||||
|
||||
| Principle | Requirement | Status | Notes |
|
||||
|-----------|-------------|--------|-------|
|
||||
| **I. Test-First Development** | TDD mandatory; tests fail before implementation | ✅ PASS | Contract tests for all 9 MCP tools; integration tests for XER parsing |
|
||||
| **II. Extensibility Architecture** | Core parsing separate from MCP transport; pluggable handlers | ✅ PASS | Table handlers are pluggable (`parser/table_handlers/`); tools are modular (`tools/`) |
|
||||
| **III. MCP Protocol Compliance** | Complete JSON schemas; MCP error format; compliant transport | ✅ PASS | Using official MCP SDK; tool definitions include JSON schemas |
|
||||
| **IV. XER Format Fidelity** | No data loss; preserve precision; handle all standard tables | ✅ PASS | Parsing TASK, TASKPRED, PROJECT, PROJWBS, CALENDAR; dates preserve precision |
|
||||
| **V. Semantic Versioning** | SemVer for releases; breaking changes documented | ✅ PASS | Version 0.1.0; initial development phase |
|
||||
| **Technical Standards** | Python 3.14; type hints; ruff formatting | ✅ PASS | pyproject.toml configured for Python 3.14, ruff, pytest |
|
||||
|
||||
**Gate Result**: PASS - All constitution principles satisfied. Proceed to Phase 0.
|
||||
|
||||
## Project Structure
|
||||
|
||||
### Documentation (this feature)
|
||||
|
||||
```text
|
||||
specs/001-schedule-tools/
|
||||
├── spec.md # Feature specification
|
||||
├── plan.md # This file (/speckit.plan command output)
|
||||
├── research.md # Phase 0 output (/speckit.plan command)
|
||||
├── data-model.md # Phase 1 output (/speckit.plan command)
|
||||
├── quickstart.md # Phase 1 output (/speckit.plan command)
|
||||
├── contracts/ # Phase 1 output (/speckit.plan command)
|
||||
└── tasks.md # Phase 2 output (/speckit.tasks command - NOT created by /speckit.plan)
|
||||
```
|
||||
|
||||
### Source Code (repository root)
|
||||
|
||||
```text
|
||||
src/xer_mcp/
|
||||
├── __init__.py
|
||||
├── __main__.py # Entry point
|
||||
├── server.py # MCP server setup and tool registration
|
||||
├── errors.py # Error types
|
||||
├── models/ # Data models (dataclasses)
|
||||
│ ├── __init__.py
|
||||
│ ├── project.py
|
||||
│ ├── activity.py
|
||||
│ ├── relationship.py
|
||||
│ ├── wbs.py
|
||||
│ ├── calendar.py
|
||||
│ └── pagination.py
|
||||
├── parser/ # XER file parsing
|
||||
│ ├── __init__.py
|
||||
│ ├── xer_parser.py # Main parser
|
||||
│ └── table_handlers/ # Pluggable table handlers
|
||||
│ ├── __init__.py
|
||||
│ ├── base.py
|
||||
│ ├── project.py
|
||||
│ ├── task.py
|
||||
│ ├── taskpred.py
|
||||
│ ├── projwbs.py
|
||||
│ └── calendar.py
|
||||
├── db/ # SQLite database layer
|
||||
│ ├── __init__.py
|
||||
│ ├── schema.py # Table definitions
|
||||
│ ├── loader.py # Data loading
|
||||
│ └── queries.py # Query functions
|
||||
└── tools/ # MCP tool implementations
|
||||
├── __init__.py
|
||||
├── load_xer.py
|
||||
├── list_activities.py
|
||||
├── get_activity.py
|
||||
├── list_relationships.py
|
||||
├── get_predecessors.py
|
||||
├── get_successors.py
|
||||
├── get_project_summary.py
|
||||
├── list_milestones.py
|
||||
└── get_critical_path.py
|
||||
|
||||
tests/
|
||||
├── __init__.py
|
||||
├── conftest.py # Shared fixtures
|
||||
├── contract/ # MCP tool contract tests
|
||||
│ ├── __init__.py
|
||||
│ ├── test_load_xer.py
|
||||
│ ├── test_list_activities.py
|
||||
│ ├── test_get_activity.py
|
||||
│ ├── test_list_relationships.py
|
||||
│ ├── test_get_predecessors.py
|
||||
│ ├── test_get_successors.py
|
||||
│ ├── test_get_project_summary.py
|
||||
│ ├── test_list_milestones.py
|
||||
│ └── test_get_critical_path.py
|
||||
├── integration/ # XER parsing integration tests
|
||||
│ ├── __init__.py
|
||||
│ └── test_xer_parsing.py
|
||||
└── unit/ # Unit tests
|
||||
├── __init__.py
|
||||
├── test_parser.py
|
||||
├── test_table_handlers.py
|
||||
└── test_db_queries.py
|
||||
```
|
||||
|
||||
**Structure Decision**: Single project structure with domain-specific organization: `models/` for data structures, `parser/` for XER file handling with pluggable table handlers, `db/` for SQLite storage layer, and `tools/` for MCP tool implementations. Tests follow contract/integration/unit hierarchy per constitution requirements.
|
||||
|
||||
## Complexity Tracking
|
||||
|
||||
> **Fill ONLY if Constitution Check has violations that must be justified**
|
||||
|
||||
No violations. All constitution principles satisfied.
|
||||
|
||||
## Post-Design Constitution Re-Check
|
||||
|
||||
*Re-evaluation after Phase 1 design artifacts are complete.*
|
||||
|
||||
| Principle | Status | Verification |
|
||||
|-----------|--------|--------------|
|
||||
| **I. Test-First Development** | ✅ PASS | Contract tests defined in `tests/contract/` for all 9 tools; integration tests in `tests/integration/` |
|
||||
| **II. Extensibility Architecture** | ✅ PASS | Table handlers pluggable via registry pattern; tools are modular functions; schema separates concerns |
|
||||
| **III. MCP Protocol Compliance** | ✅ PASS | `contracts/mcp-tools.json` defines complete JSON schemas for all tools with input/output schemas |
|
||||
| **IV. XER Format Fidelity** | ✅ PASS | Data model preserves all date precision; handles all 5 standard tables; driving flag computed accurately |
|
||||
| **V. Semantic Versioning** | ✅ PASS | Version 0.1.0 in contract schema; following SemVer |
|
||||
| **Technical Standards** | ✅ PASS | Type hints throughout models; ruff configured; pytest async mode enabled |
|
||||
|
||||
**Post-Design Gate Result**: PASS - Design artifacts align with constitution. Ready for task generation.
|
||||
|
||||
## Generated Artifacts
|
||||
|
||||
| Artifact | Path | Description |
|
||||
|----------|------|-------------|
|
||||
| Research | `specs/001-schedule-tools/research.md` | Technology decisions, XER format analysis, driving flag computation |
|
||||
| Data Model | `specs/001-schedule-tools/data-model.md` | Entity definitions, SQLite schema, validation rules |
|
||||
| Contracts | `specs/001-schedule-tools/contracts/mcp-tools.json` | MCP tool JSON schemas (input/output) |
|
||||
| Quickstart | `specs/001-schedule-tools/quickstart.md` | Usage guide with examples |
|
||||
| Agent Context | `CLAUDE.md` | Updated with Python 3.14, MCP SDK, SQLite |
|
||||
|
||||
## Next Steps
|
||||
|
||||
Run `/speckit.tasks` to generate implementation tasks from this plan.
|
||||
302
specs/001-schedule-tools/quickstart.md
Normal file
302
specs/001-schedule-tools/quickstart.md
Normal file
@@ -0,0 +1,302 @@
|
||||
# Quickstart: XER MCP Server
|
||||
|
||||
This guide shows how to set up and use the XER MCP Server for querying Primavera P6 schedule data.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Python 3.14+
|
||||
- uv package manager
|
||||
- An XER file exported from Primavera P6
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone <repo-url>
|
||||
cd xer-mcp
|
||||
|
||||
# Install dependencies with uv
|
||||
uv sync
|
||||
|
||||
# Verify installation
|
||||
uv run python -m xer_mcp --help
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Add the server to your MCP client configuration (e.g., Claude Desktop):
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"xer-mcp": {
|
||||
"command": "uv",
|
||||
"args": ["run", "python", "-m", "xer_mcp"],
|
||||
"cwd": "/path/to/xer-mcp"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Basic Usage
|
||||
|
||||
### 1. Load an XER File
|
||||
|
||||
```
|
||||
Use the load_xer tool with file_path="/path/to/schedule.xer"
|
||||
```
|
||||
|
||||
**Response** (single project):
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"project": {
|
||||
"proj_id": "P001",
|
||||
"proj_short_name": "Construction Phase 1",
|
||||
"plan_start_date": "2026-01-15T00:00:00",
|
||||
"plan_end_date": "2026-06-30T00:00:00"
|
||||
},
|
||||
"activity_count": 450,
|
||||
"relationship_count": 520
|
||||
}
|
||||
```
|
||||
|
||||
**Response** (multi-project, no selection):
|
||||
```json
|
||||
{
|
||||
"success": false,
|
||||
"available_projects": [
|
||||
{"proj_id": "P001", "proj_short_name": "Phase 1"},
|
||||
{"proj_id": "P002", "proj_short_name": "Phase 2"}
|
||||
],
|
||||
"message": "Multiple projects found. Please specify project_id."
|
||||
}
|
||||
```
|
||||
|
||||
### 2. List Activities
|
||||
|
||||
```
|
||||
Use the list_activities tool
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```json
|
||||
{
|
||||
"activities": [
|
||||
{
|
||||
"task_id": "A1000",
|
||||
"task_code": "A1000",
|
||||
"task_name": "Site Preparation",
|
||||
"task_type": "TT_Task",
|
||||
"target_start_date": "2026-01-15T08:00:00",
|
||||
"target_end_date": "2026-01-22T17:00:00",
|
||||
"status_code": "TK_NotStart",
|
||||
"driving_path_flag": true
|
||||
}
|
||||
],
|
||||
"pagination": {
|
||||
"total_count": 450,
|
||||
"offset": 0,
|
||||
"limit": 100,
|
||||
"has_more": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Filter Activities by Date Range
|
||||
|
||||
```
|
||||
Use the list_activities tool with start_date="2026-02-01" and end_date="2026-02-28"
|
||||
```
|
||||
|
||||
### 4. Get Activity Details
|
||||
|
||||
```
|
||||
Use the get_activity tool with activity_id="A1000"
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```json
|
||||
{
|
||||
"task_id": "A1000",
|
||||
"task_code": "A1000",
|
||||
"task_name": "Site Preparation",
|
||||
"task_type": "TT_Task",
|
||||
"wbs_id": "WBS001",
|
||||
"wbs_name": "Pre-Construction",
|
||||
"target_start_date": "2026-01-15T08:00:00",
|
||||
"target_end_date": "2026-01-22T17:00:00",
|
||||
"act_start_date": null,
|
||||
"act_end_date": null,
|
||||
"total_float_hr_cnt": 0,
|
||||
"status_code": "TK_NotStart",
|
||||
"driving_path_flag": true,
|
||||
"predecessor_count": 0,
|
||||
"successor_count": 5
|
||||
}
|
||||
```
|
||||
|
||||
### 5. Query Predecessors/Successors
|
||||
|
||||
```
|
||||
Use the get_predecessors tool with activity_id="A1050"
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```json
|
||||
{
|
||||
"activity_id": "A1050",
|
||||
"predecessors": [
|
||||
{
|
||||
"task_id": "A1000",
|
||||
"task_code": "A1000",
|
||||
"task_name": "Site Preparation",
|
||||
"relationship_type": "FS",
|
||||
"lag_hr_cnt": 0,
|
||||
"driving": true
|
||||
},
|
||||
{
|
||||
"task_id": "A1010",
|
||||
"task_code": "A1010",
|
||||
"task_name": "Permits Approved",
|
||||
"relationship_type": "FS",
|
||||
"lag_hr_cnt": 8,
|
||||
"driving": false
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The `driving` flag indicates which predecessor relationship constrains the successor's early start date. A driving relationship is one where the predecessor's completion (plus lag) determines when the successor can begin.
|
||||
|
||||
### 6. Get Project Summary
|
||||
|
||||
```
|
||||
Use the get_project_summary tool
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```json
|
||||
{
|
||||
"project": {
|
||||
"proj_id": "P001",
|
||||
"proj_short_name": "Construction Phase 1",
|
||||
"plan_start_date": "2026-01-15T00:00:00",
|
||||
"plan_end_date": "2026-06-30T00:00:00"
|
||||
},
|
||||
"activity_count": 450,
|
||||
"milestone_count": 25,
|
||||
"relationship_count": 520,
|
||||
"wbs_element_count": 30,
|
||||
"critical_activity_count": 85
|
||||
}
|
||||
```
|
||||
|
||||
### 7. Get Critical Path
|
||||
|
||||
```
|
||||
Use the get_critical_path tool
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```json
|
||||
{
|
||||
"critical_activities": [
|
||||
{
|
||||
"task_id": "A1000",
|
||||
"task_code": "A1000",
|
||||
"task_name": "Site Preparation",
|
||||
"task_type": "TT_Task",
|
||||
"target_start_date": "2026-01-15T08:00:00",
|
||||
"target_end_date": "2026-01-22T17:00:00"
|
||||
}
|
||||
],
|
||||
"pagination": {
|
||||
"total_count": 85,
|
||||
"offset": 0,
|
||||
"limit": 100,
|
||||
"has_more": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 8. List Milestones
|
||||
|
||||
```
|
||||
Use the list_milestones tool
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```json
|
||||
{
|
||||
"milestones": [
|
||||
{
|
||||
"task_id": "M001",
|
||||
"task_code": "MS-START",
|
||||
"task_name": "Project Start",
|
||||
"target_start_date": "2026-01-15T08:00:00",
|
||||
"target_end_date": "2026-01-15T08:00:00",
|
||||
"status_code": "TK_Complete",
|
||||
"milestone_type": "start"
|
||||
},
|
||||
{
|
||||
"task_id": "M025",
|
||||
"task_code": "MS-END",
|
||||
"task_name": "Project Complete",
|
||||
"target_start_date": "2026-06-30T17:00:00",
|
||||
"target_end_date": "2026-06-30T17:00:00",
|
||||
"status_code": "TK_NotStart",
|
||||
"milestone_type": "finish"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The `milestone_type` field indicates whether the milestone is a Start Milestone (`"start"`) or a Finish Milestone (`"finish"`).
|
||||
|
||||
## Pagination
|
||||
|
||||
All list operations support pagination:
|
||||
|
||||
```
|
||||
Use the list_activities tool with limit=50 and offset=100
|
||||
```
|
||||
|
||||
This returns activities 101-150 (0-indexed).
|
||||
|
||||
## Error Handling
|
||||
|
||||
| Error | Meaning | Solution |
|
||||
|-------|---------|----------|
|
||||
| FILE_NOT_FOUND | XER file path doesn't exist | Check file path |
|
||||
| PARSE_ERROR | XER file is malformed | Verify file is valid P6 export |
|
||||
| NO_FILE_LOADED | Query before load_xer | Call load_xer first |
|
||||
| PROJECT_SELECTION_REQUIRED | Multi-project file | Specify project_id in load_xer |
|
||||
| ACTIVITY_NOT_FOUND | Invalid activity_id | Check activity exists |
|
||||
|
||||
## Relationship Types
|
||||
|
||||
| Code | Name | Meaning |
|
||||
|------|------|---------|
|
||||
| FS | Finish-to-Start | B starts after A finishes |
|
||||
| SS | Start-to-Start | B starts after A starts |
|
||||
| FF | Finish-to-Finish | B finishes after A finishes |
|
||||
| SF | Start-to-Finish | B finishes after A starts |
|
||||
|
||||
## Activity Types
|
||||
|
||||
| Code | Name | Description |
|
||||
|------|------|-------------|
|
||||
| TT_Task | Task | Normal work activity with duration |
|
||||
| TT_Mile | Milestone | Zero-duration marker |
|
||||
| TT_LOE | Level of Effort | Duration spans linked activities |
|
||||
| TT_WBS | WBS Summary | Summary of child activities |
|
||||
| TT_Rsrc | Resource Dependent | Duration from resource assignment |
|
||||
|
||||
## Tips for AI Assistants
|
||||
|
||||
1. **Start with summary**: Call `get_project_summary` first to understand scope
|
||||
2. **Use pagination**: Large schedules may have thousands of activities
|
||||
3. **Filter early**: Use date ranges and WBS filters to reduce results
|
||||
4. **Check critical path**: `get_critical_path` identifies schedule-driving work
|
||||
5. **Follow relationships**: Use `get_predecessors`/`get_successors` to trace dependencies
|
||||
277
specs/001-schedule-tools/research.md
Normal file
277
specs/001-schedule-tools/research.md
Normal file
@@ -0,0 +1,277 @@
|
||||
# Research: Project Schedule Tools
|
||||
|
||||
**Date**: 2026-01-06
|
||||
**Branch**: `001-schedule-tools`
|
||||
|
||||
## XER File Format
|
||||
|
||||
### Decision: Parse tab-delimited format with %T table headers
|
||||
|
||||
**Rationale**: XER is Primavera P6's native export format. It uses a simple text-based structure that's straightforward to parse without external libraries.
|
||||
|
||||
**Format Structure**:
|
||||
```
|
||||
ERMHDR ...header info...
|
||||
%T TABLE_NAME
|
||||
%F field1 field2 field3 ...
|
||||
%R value1 value2 value3 ...
|
||||
%R value1 value2 value3 ...
|
||||
%T NEXT_TABLE
|
||||
...
|
||||
%E
|
||||
```
|
||||
|
||||
**Key Tables for Schedule Tools**:
|
||||
| Table | Purpose | Key Fields |
|
||||
|-------|---------|------------|
|
||||
| PROJECT | Project metadata | proj_id, proj_short_name, plan_start_date, plan_end_date |
|
||||
| TASK | Activities | task_id, task_code, task_name, task_type, target_start_date, target_end_date, act_start_date, act_end_date, driving_path_flag |
|
||||
| TASKPRED | Relationships | task_pred_id, task_id, pred_task_id, pred_type, lag_hr_cnt |
|
||||
| PROJWBS | WBS structure | wbs_id, wbs_short_name, wbs_name, parent_wbs_id, proj_id |
|
||||
| CALENDAR | Work calendars | clndr_id, clndr_name, day_hr_cnt |
|
||||
|
||||
**Alternatives Considered**:
|
||||
- XML export: More complex to parse, larger file sizes
|
||||
- Database direct access: Requires P6 installation, not portable
|
||||
|
||||
## MCP Python SDK
|
||||
|
||||
### Decision: Use `mcp` package with stdio transport
|
||||
|
||||
**Rationale**: The official MCP Python SDK provides a clean async interface for building MCP servers. Stdio transport is simplest for local tools.
|
||||
|
||||
**Implementation Pattern**:
|
||||
```python
|
||||
from mcp.server import Server
|
||||
from mcp.server.stdio import stdio_server
|
||||
|
||||
server = Server("xer-mcp")
|
||||
|
||||
@server.tool()
|
||||
async def load_xer(file_path: str, project_id: str | None = None) -> dict:
|
||||
"""Load an XER file and optionally select a project."""
|
||||
...
|
||||
|
||||
async def main():
|
||||
async with stdio_server() as (read_stream, write_stream):
|
||||
await server.run(read_stream, write_stream, server.create_initialization_options())
|
||||
```
|
||||
|
||||
**Key Considerations**:
|
||||
- All tools are async functions decorated with `@server.tool()`
|
||||
- Tool parameters use Python type hints for JSON schema generation
|
||||
- Return values are automatically serialized to JSON
|
||||
- Errors should raise `McpError` with appropriate error codes
|
||||
|
||||
**Alternatives Considered**:
|
||||
- SSE transport: Adds complexity, not needed for local use
|
||||
- Custom protocol: Would break MCP compatibility
|
||||
|
||||
## SQLite Schema Design
|
||||
|
||||
### Decision: In-memory SQLite with normalized tables
|
||||
|
||||
**Rationale**: SQLite in-memory mode provides fast queries without file I/O overhead. Normalized tables map directly to XER structure while enabling efficient JOINs for relationship queries.
|
||||
|
||||
**Schema Design**:
|
||||
```sql
|
||||
-- Project table
|
||||
CREATE TABLE projects (
|
||||
proj_id TEXT PRIMARY KEY,
|
||||
proj_short_name TEXT NOT NULL,
|
||||
plan_start_date TEXT, -- ISO8601
|
||||
plan_end_date TEXT,
|
||||
loaded_at TEXT NOT NULL
|
||||
);
|
||||
|
||||
-- Activities table
|
||||
CREATE TABLE activities (
|
||||
task_id TEXT PRIMARY KEY,
|
||||
proj_id TEXT NOT NULL REFERENCES projects(proj_id),
|
||||
wbs_id TEXT,
|
||||
task_code TEXT NOT NULL,
|
||||
task_name TEXT NOT NULL,
|
||||
task_type TEXT, -- TT_Task, TT_Mile, TT_LOE, etc.
|
||||
target_start_date TEXT,
|
||||
target_end_date TEXT,
|
||||
act_start_date TEXT,
|
||||
act_end_date TEXT,
|
||||
total_float_hr_cnt REAL,
|
||||
driving_path_flag TEXT, -- 'Y' or 'N'
|
||||
status_code TEXT
|
||||
);
|
||||
|
||||
-- Relationships table
|
||||
CREATE TABLE relationships (
|
||||
task_pred_id TEXT PRIMARY KEY,
|
||||
task_id TEXT NOT NULL REFERENCES activities(task_id),
|
||||
pred_task_id TEXT NOT NULL REFERENCES activities(task_id),
|
||||
pred_type TEXT NOT NULL, -- PR_FS, PR_SS, PR_FF, PR_SF
|
||||
lag_hr_cnt REAL DEFAULT 0
|
||||
);
|
||||
|
||||
-- WBS table
|
||||
CREATE TABLE wbs (
|
||||
wbs_id TEXT PRIMARY KEY,
|
||||
proj_id TEXT NOT NULL REFERENCES projects(proj_id),
|
||||
parent_wbs_id TEXT REFERENCES wbs(wbs_id),
|
||||
wbs_short_name TEXT NOT NULL,
|
||||
wbs_name TEXT
|
||||
);
|
||||
|
||||
-- Indexes for common queries
|
||||
CREATE INDEX idx_activities_proj ON activities(proj_id);
|
||||
CREATE INDEX idx_activities_wbs ON activities(wbs_id);
|
||||
CREATE INDEX idx_activities_type ON activities(task_type);
|
||||
CREATE INDEX idx_activities_dates ON activities(target_start_date, target_end_date);
|
||||
CREATE INDEX idx_relationships_task ON relationships(task_id);
|
||||
CREATE INDEX idx_relationships_pred ON relationships(pred_task_id);
|
||||
CREATE INDEX idx_wbs_parent ON wbs(parent_wbs_id);
|
||||
```
|
||||
|
||||
**Query Patterns**:
|
||||
- Pagination: `LIMIT ? OFFSET ?` with `COUNT(*)` for total
|
||||
- Date filtering: `WHERE target_start_date >= ? AND target_end_date <= ?`
|
||||
- Critical path: `WHERE driving_path_flag = 'Y'`
|
||||
- Predecessors: `SELECT * FROM relationships WHERE task_id = ?`
|
||||
- Successors: `SELECT * FROM relationships WHERE pred_task_id = ?`
|
||||
|
||||
**Alternatives Considered**:
|
||||
- File-based SQLite: Adds complexity for file management, not needed for single-session use
|
||||
- In-memory dictionaries: Would require custom indexing for efficient queries
|
||||
- DuckDB: Overkill for this use case, larger dependency
|
||||
|
||||
## XER Parsing Strategy
|
||||
|
||||
### Decision: Streaming line-by-line parser with table handler registry
|
||||
|
||||
**Rationale**: XER files can be large (50K+ activities). Streaming avoids loading entire file into memory. Table handler registry enables extensibility per constitution.
|
||||
|
||||
**Implementation Approach**:
|
||||
1. Read file line by line
|
||||
2. Track current table context (%T lines)
|
||||
3. Parse %F lines as field headers
|
||||
4. Parse %R lines as records using current field map
|
||||
5. Dispatch to registered table handler
|
||||
6. Handler converts to model and inserts into SQLite
|
||||
|
||||
**Encoding Handling**:
|
||||
- XER files use Windows-1252 encoding by default
|
||||
- Attempt UTF-8 first, fallback to Windows-1252
|
||||
- Log encoding detection result
|
||||
|
||||
## Pagination Implementation
|
||||
|
||||
### Decision: Offset-based pagination with metadata
|
||||
|
||||
**Rationale**: Simple to implement with SQLite's LIMIT/OFFSET. Metadata enables clients to navigate results.
|
||||
|
||||
**Response Format**:
|
||||
```python
|
||||
@dataclass
|
||||
class PaginatedResponse:
|
||||
items: list[dict]
|
||||
pagination: PaginationMetadata
|
||||
|
||||
@dataclass
|
||||
class PaginationMetadata:
|
||||
total_count: int
|
||||
offset: int
|
||||
limit: int
|
||||
has_more: bool
|
||||
```
|
||||
|
||||
**Default Limit**: 100 items (per spec clarification)
|
||||
|
||||
## Error Handling
|
||||
|
||||
### Decision: Structured MCP errors with codes
|
||||
|
||||
**Rationale**: MCP protocol defines error format. Consistent error codes help clients handle failures.
|
||||
|
||||
**Error Codes**:
|
||||
| Code | Name | When Used |
|
||||
|------|------|-----------|
|
||||
| -32001 | FILE_NOT_FOUND | XER file path doesn't exist |
|
||||
| -32002 | PARSE_ERROR | XER file is malformed |
|
||||
| -32003 | NO_FILE_LOADED | Query attempted before load |
|
||||
| -32004 | PROJECT_SELECTION_REQUIRED | Multi-project file without selection |
|
||||
| -32005 | ACTIVITY_NOT_FOUND | Requested activity ID doesn't exist |
|
||||
| -32006 | INVALID_PARAMETER | Bad filter/pagination parameters |
|
||||
|
||||
## Driving Relationship Flag
|
||||
|
||||
**Research Date**: 2026-01-06
|
||||
|
||||
### Question: What field in the XER TASKPRED table contains the driving relationship flag?
|
||||
|
||||
**Finding**: The TASKPRED table in P6 XER files does NOT contain a direct `driving_flag` field.
|
||||
|
||||
**Evidence**: Analysis of sample XER file (S48019R - Proposal Schedule):
|
||||
```
|
||||
%F task_pred_id task_id pred_task_id proj_id pred_proj_id pred_type lag_hr_cnt comments float_path aref arls
|
||||
```
|
||||
|
||||
Fields available:
|
||||
- `task_pred_id` - Unique relationship identifier
|
||||
- `task_id` - Successor activity ID
|
||||
- `pred_task_id` - Predecessor activity ID
|
||||
- `proj_id` / `pred_proj_id` - Project identifiers
|
||||
- `pred_type` - Relationship type (PR_FS, PR_SS, PR_FF, PR_SF)
|
||||
- `lag_hr_cnt` - Lag duration in hours
|
||||
- `comments` - User comments
|
||||
- `float_path` - Float path indicator (contains dates, not boolean)
|
||||
- `aref` / `arls` - Activity reference dates
|
||||
|
||||
### Question: Where is driving/critical path information stored in P6 XER files?
|
||||
|
||||
**Finding**: The `driving_path_flag` is stored at the ACTIVITY level on the TASK table, not on individual relationships.
|
||||
|
||||
**Evidence**:
|
||||
```
|
||||
TASK table includes: driving_path_flag (Y/N)
|
||||
```
|
||||
|
||||
This flag indicates whether an activity is on the driving/critical path, but does not indicate which specific predecessor relationship is driving that activity's dates.
|
||||
|
||||
### Question: Can driving relationships be derived from available data?
|
||||
|
||||
**Finding**: Yes, driving relationships can be computed using schedule date comparison logic.
|
||||
|
||||
A relationship is "driving" when the successor activity's early start is constrained by the predecessor's completion. For a Finish-to-Start (FS) relationship:
|
||||
|
||||
```
|
||||
driving = (predecessor.early_end_date + lag_hours ≈ successor.early_start_date)
|
||||
```
|
||||
|
||||
### Decision: Compute driving flag at query time using early dates
|
||||
|
||||
**Rationale**:
|
||||
1. P6 does not export a pre-computed driving flag per relationship
|
||||
2. The driving relationship determination can be computed from activity dates
|
||||
3. This matches how P6 itself determines driving relationships in the UI
|
||||
|
||||
**Implementation Approach**:
|
||||
1. Early dates (`early_start_date`, `early_end_date`) are already parsed from TASK table
|
||||
2. When querying relationships, compute `driving` by comparing dates
|
||||
3. For FS: Compare `pred.early_end_date + lag` to `succ.early_start_date`
|
||||
4. Use 1-hour tolerance for floating point date arithmetic
|
||||
|
||||
**Alternatives Considered**:
|
||||
1. **Static flag from XER**: Not available in standard exports
|
||||
2. **Always false**: Would not provide value to users
|
||||
3. **Require user to specify**: Adds complexity, not aligned with P6 behavior
|
||||
|
||||
### Schema Impact
|
||||
|
||||
No schema changes needed for relationships table. Required activity date columns are already present:
|
||||
- `activities.early_start_date` - Already in schema ✓
|
||||
- `activities.early_end_date` - Already in schema ✓
|
||||
|
||||
The driving flag will be computed at query time via JOIN on activity dates.
|
||||
|
||||
### Validation Plan
|
||||
|
||||
- [ ] Verify early_start_date and early_end_date are parsed correctly from TASK table
|
||||
- [ ] Test driving computation against known P6 schedules
|
||||
- [ ] Confirm results match P6 "show driving" feature where possible
|
||||
152
specs/001-schedule-tools/spec.md
Normal file
152
specs/001-schedule-tools/spec.md
Normal file
@@ -0,0 +1,152 @@
|
||||
# Feature Specification: Project Schedule Tools
|
||||
|
||||
**Feature Branch**: `001-schedule-tools`
|
||||
**Created**: 2026-01-06
|
||||
**Status**: Draft
|
||||
**Input**: User description: "MCP tools to query activities, relationships, and schedules from XER data"
|
||||
|
||||
## User Scenarios & Testing *(mandatory)*
|
||||
|
||||
### User Story 1 - Load XER File (Priority: P1)
|
||||
|
||||
As an AI assistant user, I want to load an XER file into the MCP server so that I can query its schedule data.
|
||||
|
||||
**Why this priority**: This is a prerequisite for all other functionality - no queries are possible without first loading data.
|
||||
|
||||
**Independent Test**: Can be tested by providing a file path and verifying the file is successfully parsed and available for queries.
|
||||
|
||||
**Acceptance Scenarios**:
|
||||
|
||||
1. **Given** a valid XER file path with a single project, **When** I request to load the file, **Then** the file is parsed, the project is auto-selected, and a success confirmation is returned with basic file info (project name, activity count)
|
||||
2. **Given** a valid XER file path with multiple projects, **When** I request to load the file without specifying a project, **Then** I receive a list of available projects and a prompt to select one
|
||||
3. **Given** a valid XER file path with multiple projects, **When** I request to load the file with a specific project ID, **Then** that project is selected and loaded
|
||||
4. **Given** an invalid file path, **When** I request to load the file, **Then** I receive a clear error message indicating the file was not found
|
||||
5. **Given** a corrupted or invalid XER file, **When** I request to load the file, **Then** I receive a clear error message describing the parsing failure
|
||||
6. **Given** a file is already loaded, **When** I load a new file, **Then** the previous data is replaced with the new file's data
|
||||
|
||||
---
|
||||
|
||||
### User Story 2 - Query Project Activities (Priority: P1)
|
||||
|
||||
As an AI assistant user, I want to query activities from a loaded XER file so that I can understand what work is planned in the project schedule.
|
||||
|
||||
**Why this priority**: Activities are the fundamental building blocks of any P6 schedule. Without the ability to query activities, no other schedule analysis is possible.
|
||||
|
||||
**Independent Test**: Can be fully tested by loading an XER file and querying for activities. Delivers immediate value by exposing schedule data to AI assistants.
|
||||
|
||||
**Acceptance Scenarios**:
|
||||
|
||||
1. **Given** an XER file is loaded, **When** I request all activities, **Then** I receive a list of activities with their names, IDs, and dates (limited to 100 by default)
|
||||
2. **Given** an XER file is loaded, **When** I request activities filtered by date range, **Then** I receive only activities that fall within that range (limited to 100 by default)
|
||||
3. **Given** an XER file is loaded, **When** I request a specific activity by ID, **Then** I receive the complete details for that activity
|
||||
4. **Given** no XER file is loaded, **When** I request activities, **Then** I receive a clear error message indicating no file is loaded
|
||||
5. **Given** an XER file with more than 100 activities, **When** I request activities without specifying a limit, **Then** I receive the first 100 activities plus pagination metadata (total count, has_more flag)
|
||||
6. **Given** an XER file is loaded, **When** I request activities with offset and limit parameters, **Then** I receive the specified page of results
|
||||
|
||||
---
|
||||
|
||||
### User Story 3 - Query Activity Relationships (Priority: P2)
|
||||
|
||||
As an AI assistant user, I want to query the relationships (dependencies) between activities so that I can understand the logical sequence of work and identify critical paths.
|
||||
|
||||
**Why this priority**: Relationships define the logical flow of work and are essential for schedule analysis, but require activities to be queryable first.
|
||||
|
||||
**Independent Test**: Can be tested by loading an XER file and querying predecessor/successor relationships for any activity.
|
||||
|
||||
**Acceptance Scenarios**:
|
||||
|
||||
1. **Given** an XER file is loaded, **When** I request predecessors for an activity, **Then** I receive a list of predecessor activities with their relationship types (FS, SS, FF, SF), lag values, and driving flag
|
||||
2. **Given** an XER file is loaded, **When** I request successors for an activity, **Then** I receive a list of successor activities with their relationship types, lag values, and driving flag
|
||||
3. **Given** an activity has no predecessors, **When** I request its predecessors, **Then** I receive an empty list (not an error)
|
||||
4. **Given** an XER file is loaded, **When** I request all relationships, **Then** I receive the dependency network with relationship types, lag values, and driving flags (limited to 100 by default) with pagination metadata
|
||||
5. **Given** an XER file is loaded, **When** I request relationships with offset and limit parameters, **Then** I receive the specified page of results
|
||||
6. **Given** no XER file is loaded, **When** I request relationships or predecessors/successors, **Then** I receive a clear error message indicating no file is loaded
|
||||
|
||||
---
|
||||
|
||||
### User Story 4 - Query Project Summary (Priority: P3)
|
||||
|
||||
As an AI assistant user, I want to get a high-level summary of the project schedule so that I can quickly understand project scope, timeline, and key milestones.
|
||||
|
||||
**Why this priority**: Provides valuable context for AI analysis but depends on activity and relationship data being accessible first.
|
||||
|
||||
**Independent Test**: Can be tested by loading an XER file and requesting project summary information.
|
||||
|
||||
**Acceptance Scenarios**:
|
||||
|
||||
1. **Given** an XER file is loaded, **When** I request the project summary, **Then** I receive project name, data date, start date, finish date, and total activity count
|
||||
2. **Given** an XER file with milestones, **When** I request milestones, **Then** I receive a list of all milestone activities (both Start Milestones and Finish Milestones) with their target dates and milestone type
|
||||
3. **Given** an XER file is loaded, **When** I request the critical path, **Then** I receive the sequence of activities that determine the project end date
|
||||
4. **Given** no XER file is loaded, **When** I request project summary, milestones, or critical path, **Then** I receive a clear error message indicating no file is loaded
|
||||
|
||||
---
|
||||
|
||||
### Edge Cases
|
||||
|
||||
- What happens when an XER file contains no activities? Return empty results with a clear indication that the file has no schedule data.
|
||||
- What happens when activity IDs are duplicated in the XER file? Use the last occurrence and log a warning.
|
||||
- What happens when relationship references point to non-existent activities? Skip invalid relationships and include them in a warnings list.
|
||||
- What happens when date fields are missing or malformed? Use null values for missing dates and report parsing warnings.
|
||||
- What happens when the XER file uses an unsupported version format? Attempt best-effort parsing and report version compatibility warnings.
|
||||
|
||||
## Requirements *(mandatory)*
|
||||
|
||||
### Functional Requirements
|
||||
|
||||
- **FR-001**: System MUST parse standard Primavera P6 XER file format and extract schedule data
|
||||
- **FR-002**: System MUST expose an MCP tool to load an XER file from a specified file path
|
||||
- **FR-003**: System MUST expose an MCP tool to list all activities with filtering options (by date range, by WBS, by activity type)
|
||||
- **FR-004**: System MUST expose an MCP tool to retrieve detailed information for a specific activity by ID
|
||||
- **FR-005**: System MUST expose an MCP tool to query predecessor and successor relationships for any activity, including relationship type, lag value, and driving flag
|
||||
- **FR-006**: System MUST expose an MCP tool to retrieve project summary information (name, data date, plan dates, activity count)
|
||||
- **FR-007**: System MUST expose an MCP tool to list milestone activities, including both Start Milestones (TT_Mile with task_type='TT_Mile' and milestone_type='start') and Finish Milestones (task_type='TT_Mile' and milestone_type='finish')
|
||||
- **FR-008**: System MUST expose an MCP tool to identify the critical path
|
||||
- **FR-009**: System MUST return structured data that AI assistants can process and present to users
|
||||
- **FR-010**: System MUST provide clear, actionable error messages when operations fail
|
||||
- **FR-011**: System MUST preserve all date/time precision from the original XER file
|
||||
- **FR-012**: System MUST handle XER files with multiple projects by requiring explicit project selection; single-project files auto-select the only project
|
||||
- **FR-013**: System MUST implement pagination for list queries with a default limit of 100 items, supporting offset and limit parameters
|
||||
- **FR-014**: System MUST return pagination metadata (total_count, has_more, offset, limit) with all paginated responses
|
||||
- **FR-015**: System MUST return an informative error (NO_FILE_LOADED) when any query tool is invoked before an XER file has been successfully loaded
|
||||
|
||||
### Key Entities
|
||||
|
||||
- **Project**: The top-level container representing a P6 project with name, ID, start/finish dates, and calendar assignments
|
||||
- **Activity**: A unit of work with ID, name, type (task/milestone/LOE), milestone_type (start/finish for milestones, null otherwise), planned dates, actual dates, duration, and status
|
||||
- **Relationship**: A dependency link between two activities with type (FS/SS/FF/SF), lag value, and driving flag
|
||||
- **WBS (Work Breakdown Structure)**: Hierarchical organization of activities with ID, name, parent reference, and level
|
||||
- **Calendar**: Work schedule definition that determines working days and hours for activities (internal use only; not exposed as queryable entity)
|
||||
- **Resource**: Labor, equipment, or material assigned to activities (exposed for future resource analysis features)
|
||||
|
||||
## Success Criteria *(mandatory)*
|
||||
|
||||
### Measurable Outcomes
|
||||
|
||||
- **SC-001**: Users can load and query an XER file within 5 seconds for files up to 10,000 activities
|
||||
- **SC-002**: Users can retrieve activity details in under 1 second after file is loaded
|
||||
- **SC-003**: All standard XER table types used in schedule analysis are correctly parsed (TASK, TASKPRED, PROJECT, PROJWBS, CALENDAR)
|
||||
- **SC-004**: 100% of valid relationship types (FS, SS, FF, SF) are correctly identified and queryable
|
||||
- **SC-005**: Users receive actionable error messages that identify the specific issue when operations fail
|
||||
- **SC-006**: Critical path identification uses P6's stored critical flags, ensuring exact match with P6's own critical path
|
||||
- **SC-007**: AI assistants can successfully integrate with the MCP server and execute all exposed tools
|
||||
|
||||
## Clarifications
|
||||
|
||||
### Session 2026-01-06
|
||||
|
||||
- Q: What should be the default result limit for activity/relationship queries? → A: 100 items default limit per query
|
||||
- Q: How should critical path be determined? → A: Use P6's stored critical flags from XER data
|
||||
- Q: How should multi-project XER files be handled? → A: Require explicit project selection if multiple exist
|
||||
- Q: Should calendar data be exposed as queryable? → A: Internal use only (not exposed as queryable)
|
||||
- Q: What happens when any query tool is called without a file loaded? → A: Return informative error indicating no XER file is loaded; applies to all tools except load_xer
|
||||
- Q: Should project summary include the data date? → A: Yes, include the data date (schedule "as-of" date) in project summary response
|
||||
- Q: Should relationship queries return the driving flag? → A: Yes, include the driving property in all relationship responses (predecessors, successors, list relationships)
|
||||
- Q: Which milestone types should be included in milestone queries? → A: Include both Start Milestones and Finish Milestones
|
||||
|
||||
## Assumptions
|
||||
|
||||
- XER files follow the standard Primavera P6 export format (tab-delimited with %T headers)
|
||||
- The MCP server runs locally and has file system access to read XER files
|
||||
- Users have valid XER files exported from P6 (versions 6.0 through current)
|
||||
- Single-user operation - no concurrent access handling required for MVP
|
||||
- Memory is sufficient to hold parsed schedule data for typical project sizes (up to 50,000 activities)
|
||||
255
specs/001-schedule-tools/tasks.md
Normal file
255
specs/001-schedule-tools/tasks.md
Normal file
@@ -0,0 +1,255 @@
|
||||
# Tasks: Add Milestone Type to List Milestones Tool
|
||||
|
||||
**Input**: Design documents from `/specs/001-schedule-tools/`
|
||||
**Prerequisites**: plan.md (required), spec.md (required), research.md, data-model.md, contracts/
|
||||
|
||||
**Tests**: TDD is mandated by constitution - tests MUST be written and fail before implementation.
|
||||
|
||||
**Scope**: Enhancement to existing implementation - add `milestone_type` (start/finish) to milestone query responses per spec clarification.
|
||||
|
||||
**Change Summary**: The spec was updated to require that the `list_milestones` tool return both Start Milestones and Finish Milestones with their `milestone_type` field (start/finish for milestones, null otherwise).
|
||||
|
||||
## Format: `[ID] [P?] [Story] Description`
|
||||
|
||||
- **[P]**: Can run in parallel (different files, no dependencies)
|
||||
- **[Story]**: Which user story this task belongs to (US4 = Query Project Summary)
|
||||
- Include exact file paths in descriptions
|
||||
|
||||
## Path Conventions
|
||||
|
||||
- **Source**: `src/xer_mcp/`
|
||||
- **Tests**: `tests/`
|
||||
- **Config**: `pyproject.toml`
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Setup (Schema Enhancement)
|
||||
|
||||
**Purpose**: Add milestone_type column needed for distinguishing start vs finish milestones
|
||||
|
||||
- [x] T001 Update activities table schema to add milestone_type column in src/xer_mcp/db/schema.py
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Foundational (Parser Enhancement)
|
||||
|
||||
**Purpose**: Parse milestone_type from TASK table and store in database
|
||||
|
||||
**⚠️ CRITICAL**: Must complete before milestone queries can return the type
|
||||
|
||||
### Tests
|
||||
|
||||
- [x] T002 [P] Unit test for TASK handler parsing milestone_type in tests/unit/test_table_handlers.py (verify milestone_type extracted for TT_Mile activities)
|
||||
|
||||
### Implementation
|
||||
|
||||
- [x] T003 Update TASK table handler to parse milestone_type field in src/xer_mcp/parser/table_handlers/task.py
|
||||
- [x] T004 Update database loader to store milestone_type when inserting activities in src/xer_mcp/db/loader.py
|
||||
|
||||
**Checkpoint**: milestone_type is now parsed and stored - queries can begin
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: User Story 4 - Add Milestone Type to Queries (Priority: P3)
|
||||
|
||||
**Goal**: Return `milestone_type` field in milestone query responses
|
||||
|
||||
**Independent Test**: Load XER file, query milestones, verify milestone_type is present and correctly identifies start vs finish milestones
|
||||
|
||||
### Tests for User Story 4
|
||||
|
||||
> **NOTE: Write these tests FIRST, ensure they FAIL before implementation**
|
||||
|
||||
- [x] T005 [P] [US4] Update contract test to verify milestone_type field in list_milestones response in tests/contract/test_list_milestones.py
|
||||
- [x] T006 [P] [US4] Add test case verifying both start and finish milestones are returned with correct types in tests/contract/test_list_milestones.py
|
||||
|
||||
### Implementation for User Story 4
|
||||
|
||||
- [x] T007 [US4] Update query_milestones function to SELECT and return milestone_type in src/xer_mcp/db/queries.py
|
||||
- [x] T008 [US4] Update list_milestones tool docstring to document milestone_type field in src/xer_mcp/tools/list_milestones.py
|
||||
|
||||
**Checkpoint**: milestone_type now included in milestone responses
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: Documentation & Contracts
|
||||
|
||||
**Purpose**: Update contracts and documentation to reflect the new field
|
||||
|
||||
- [x] T009 [P] Update ActivitySummary schema to include optional milestone_type field in specs/001-schedule-tools/contracts/mcp-tools.json
|
||||
- [x] T010 [P] Update Activity entity in data-model.md to include milestone_type field in specs/001-schedule-tools/data-model.md
|
||||
- [x] T011 Update quickstart.md milestone example to show milestone_type in output in specs/001-schedule-tools/quickstart.md
|
||||
|
||||
---
|
||||
|
||||
## Phase 5: Polish & Validation
|
||||
|
||||
**Purpose**: Verify integration and ensure no regressions
|
||||
|
||||
- [x] T012 Run all tests to verify no regressions: uv run pytest tests/
|
||||
- [x] T013 Run ruff check and fix any linting issues: uv run ruff check src/
|
||||
- [x] T014 Validate list_milestones output matches updated contract schema
|
||||
|
||||
---
|
||||
|
||||
## Dependencies & Execution Order
|
||||
|
||||
### Phase Dependencies
|
||||
|
||||
```
|
||||
Phase 1 (Schema)
|
||||
│
|
||||
▼
|
||||
Phase 2 (Parser)
|
||||
│
|
||||
▼
|
||||
Phase 3 (Queries) ← MAIN WORK
|
||||
│
|
||||
▼
|
||||
Phase 4 (Docs) ← Can run in parallel with Phase 3
|
||||
│
|
||||
▼
|
||||
Phase 5 (Polish)
|
||||
```
|
||||
|
||||
### Task Dependencies Within Phases
|
||||
|
||||
```
|
||||
T001 (Schema)
|
||||
│
|
||||
├── T002 (Parser test)
|
||||
│
|
||||
▼
|
||||
T003 (Parser impl) ← depends on T001
|
||||
│
|
||||
▼
|
||||
T004 (Loader) ← depends on T003
|
||||
│
|
||||
├── T005, T006 (Contract tests)
|
||||
│
|
||||
▼
|
||||
T007 (Query impl) ← depends on T004
|
||||
│
|
||||
▼
|
||||
T008 (Tool docs)
|
||||
```
|
||||
|
||||
### Parallel Opportunities
|
||||
|
||||
**Phase 2 Tests + Phase 3 Tests** (can write all tests in parallel):
|
||||
```bash
|
||||
Task T002: "Unit test for TASK handler parsing milestone_type"
|
||||
Task T005: "Update contract test for list_milestones"
|
||||
Task T006: "Add test for start/finish milestone types"
|
||||
```
|
||||
|
||||
**Phase 4 Documentation** (can run in parallel):
|
||||
```bash
|
||||
Task T009: "Update ActivitySummary schema"
|
||||
Task T010: "Update Activity entity in data-model.md"
|
||||
Task T011: "Update quickstart.md example"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Implementation Details
|
||||
|
||||
### Milestone Type Determination
|
||||
|
||||
In Primavera P6, milestones are identified by `task_type = 'TT_Mile'`. The distinction between Start and Finish milestones is typically:
|
||||
|
||||
1. **XER Field**: Check for `milestone_type` field in TASK table (values: `MS_Start`, `MS_Finish`)
|
||||
2. **Fallback**: If field not present, can infer from dates:
|
||||
- Start milestone: Has only `target_start_date` (or start = end)
|
||||
- Finish milestone: Has only `target_end_date` (or represents completion)
|
||||
|
||||
### Schema Change
|
||||
|
||||
```sql
|
||||
-- Add to activities table
|
||||
milestone_type TEXT -- 'start', 'finish', or NULL for non-milestones
|
||||
```
|
||||
|
||||
### Query Change
|
||||
|
||||
```sql
|
||||
SELECT task_id, task_code, task_name,
|
||||
target_start_date, target_end_date,
|
||||
status_code, milestone_type
|
||||
FROM activities
|
||||
WHERE task_type = 'TT_Mile'
|
||||
ORDER BY target_start_date, task_code
|
||||
```
|
||||
|
||||
### Response Format
|
||||
|
||||
```json
|
||||
{
|
||||
"milestones": [
|
||||
{
|
||||
"task_id": "M001",
|
||||
"task_code": "MS-START",
|
||||
"task_name": "Project Start",
|
||||
"milestone_type": "start",
|
||||
"target_start_date": "2026-01-15T08:00:00",
|
||||
"target_end_date": "2026-01-15T08:00:00",
|
||||
"status_code": "TK_Complete"
|
||||
},
|
||||
{
|
||||
"task_id": "M002",
|
||||
"task_code": "MS-END",
|
||||
"task_name": "Project Complete",
|
||||
"milestone_type": "finish",
|
||||
"target_start_date": "2026-06-30T17:00:00",
|
||||
"target_end_date": "2026-06-30T17:00:00",
|
||||
"status_code": "TK_NotStart"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
| Phase | Tasks | Focus |
|
||||
|-------|-------|-------|
|
||||
| Setup | 1 | Schema update |
|
||||
| Foundational | 3 | Parser enhancement |
|
||||
| US4 Implementation | 4 | Milestone type in queries |
|
||||
| Documentation | 3 | Contracts & docs |
|
||||
| Polish | 3 | Validation |
|
||||
| **Total** | **14** | |
|
||||
|
||||
### Task Distribution by Type
|
||||
|
||||
| Type | Count | IDs |
|
||||
|------|-------|-----|
|
||||
| Schema | 1 | T001 |
|
||||
| Tests | 3 | T002, T005, T006 |
|
||||
| Implementation | 4 | T003, T004, T007, T008 |
|
||||
| Documentation | 3 | T009, T010, T011 |
|
||||
| Validation | 3 | T012, T013, T014 |
|
||||
|
||||
### Independent Test Criteria
|
||||
|
||||
| Verification | How to Test |
|
||||
|--------------|-------------|
|
||||
| milestone_type parsed | Unit test: parse XER with milestones, verify milestone_type extracted |
|
||||
| milestone_type in response | Contract test: call list_milestones, verify milestone_type field present |
|
||||
| Start/Finish distinction | Contract test: verify "Project Start" has type="start", "Project Complete" has type="finish" |
|
||||
|
||||
### MVP Scope
|
||||
|
||||
Complete through T008 for minimal viable milestone_type implementation.
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
|
||||
- [P] tasks = different files, no dependencies on incomplete tasks
|
||||
- [US4] = User Story 4 (Query Project Summary - milestones)
|
||||
- Constitution mandates TDD: write tests first, verify they fail, then implement
|
||||
- milestone_type is stored in database, not computed at query time
|
||||
- For non-milestone activities, milestone_type should be NULL
|
||||
- Commit after each task or logical group
|
||||
3
src/xer_mcp/__init__.py
Normal file
3
src/xer_mcp/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
"""XER MCP Server - MCP tools for querying Primavera P6 XER schedule data."""
|
||||
|
||||
__version__ = "0.1.0"
|
||||
14
src/xer_mcp/__main__.py
Normal file
14
src/xer_mcp/__main__.py
Normal file
@@ -0,0 +1,14 @@
|
||||
"""Main entry point for the XER MCP Server."""
|
||||
|
||||
import asyncio
|
||||
|
||||
from xer_mcp.server import run_server
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""Run the XER MCP Server."""
|
||||
asyncio.run(run_server())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
66
src/xer_mcp/db/__init__.py
Normal file
66
src/xer_mcp/db/__init__.py
Normal file
@@ -0,0 +1,66 @@
|
||||
"""Database connection management for XER MCP Server."""
|
||||
|
||||
import sqlite3
|
||||
from collections.abc import Generator
|
||||
from contextlib import contextmanager
|
||||
|
||||
from xer_mcp.db.schema import get_schema
|
||||
|
||||
|
||||
class DatabaseManager:
|
||||
"""Manages SQLite database connections and schema initialization."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Initialize database manager with in-memory database."""
|
||||
self._connection: sqlite3.Connection | None = None
|
||||
|
||||
def initialize(self) -> None:
|
||||
"""Initialize the in-memory database with schema."""
|
||||
self._connection = sqlite3.connect(":memory:", check_same_thread=False)
|
||||
self._connection.row_factory = sqlite3.Row
|
||||
self._connection.executescript(get_schema())
|
||||
|
||||
def clear(self) -> None:
|
||||
"""Clear all data from the database."""
|
||||
if self._connection is None:
|
||||
return
|
||||
|
||||
tables = ["relationships", "activities", "wbs", "calendars", "projects"]
|
||||
for table in tables:
|
||||
self._connection.execute(f"DELETE FROM {table}") # noqa: S608
|
||||
self._connection.commit()
|
||||
|
||||
@property
|
||||
def connection(self) -> sqlite3.Connection:
|
||||
"""Get the database connection."""
|
||||
if self._connection is None:
|
||||
raise RuntimeError("Database not initialized. Call initialize() first.")
|
||||
return self._connection
|
||||
|
||||
@contextmanager
|
||||
def cursor(self) -> Generator[sqlite3.Cursor]:
|
||||
"""Get a cursor for executing queries."""
|
||||
cur = self.connection.cursor()
|
||||
try:
|
||||
yield cur
|
||||
finally:
|
||||
cur.close()
|
||||
|
||||
def commit(self) -> None:
|
||||
"""Commit the current transaction."""
|
||||
self.connection.commit()
|
||||
|
||||
def close(self) -> None:
|
||||
"""Close the database connection."""
|
||||
if self._connection is not None:
|
||||
self._connection.close()
|
||||
self._connection = None
|
||||
|
||||
@property
|
||||
def is_initialized(self) -> bool:
|
||||
"""Check if the database is initialized."""
|
||||
return self._connection is not None
|
||||
|
||||
|
||||
# Global database manager instance
|
||||
db = DatabaseManager()
|
||||
145
src/xer_mcp/db/loader.py
Normal file
145
src/xer_mcp/db/loader.py
Normal file
@@ -0,0 +1,145 @@
|
||||
"""Database loader for parsed XER data."""
|
||||
|
||||
from xer_mcp.db import db
|
||||
from xer_mcp.parser.xer_parser import ParsedXer
|
||||
|
||||
|
||||
def load_parsed_data(parsed: ParsedXer, project_id: str) -> None:
|
||||
"""Load parsed XER data into the database.
|
||||
|
||||
Only loads data for the specified project.
|
||||
|
||||
Args:
|
||||
parsed: Parsed XER data
|
||||
project_id: ID of the project to load
|
||||
"""
|
||||
# Find the project
|
||||
project = next((p for p in parsed.projects if p["proj_id"] == project_id), None)
|
||||
if project is None:
|
||||
raise ValueError(f"Project {project_id} not found in parsed data")
|
||||
|
||||
# Clear existing data
|
||||
db.clear()
|
||||
|
||||
with db.cursor() as cur:
|
||||
# Insert project
|
||||
cur.execute(
|
||||
"""
|
||||
INSERT INTO projects (proj_id, proj_short_name, plan_start_date, plan_end_date, last_recalc_date)
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
""",
|
||||
(
|
||||
project["proj_id"],
|
||||
project["proj_short_name"],
|
||||
project["plan_start_date"],
|
||||
project["plan_end_date"],
|
||||
project.get("last_recalc_date"),
|
||||
),
|
||||
)
|
||||
|
||||
# Insert WBS elements for this project
|
||||
for wbs in parsed.projwbs:
|
||||
if wbs["proj_id"] == project_id:
|
||||
cur.execute(
|
||||
"""
|
||||
INSERT INTO wbs (wbs_id, proj_id, parent_wbs_id, wbs_short_name, wbs_name)
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
""",
|
||||
(
|
||||
wbs["wbs_id"],
|
||||
wbs["proj_id"],
|
||||
wbs["parent_wbs_id"] or None,
|
||||
wbs["wbs_short_name"],
|
||||
wbs["wbs_name"],
|
||||
),
|
||||
)
|
||||
|
||||
# Insert calendars (all calendars, they may be shared)
|
||||
for cal in parsed.calendars:
|
||||
cur.execute(
|
||||
"""
|
||||
INSERT OR IGNORE INTO calendars (clndr_id, clndr_name, day_hr_cnt, week_hr_cnt)
|
||||
VALUES (?, ?, ?, ?)
|
||||
""",
|
||||
(
|
||||
cal["clndr_id"],
|
||||
cal["clndr_name"],
|
||||
cal["day_hr_cnt"],
|
||||
cal["week_hr_cnt"],
|
||||
),
|
||||
)
|
||||
|
||||
# Insert activities for this project
|
||||
for task in parsed.tasks:
|
||||
if task["proj_id"] == project_id:
|
||||
cur.execute(
|
||||
"""
|
||||
INSERT INTO activities (
|
||||
task_id, proj_id, wbs_id, task_code, task_name, task_type,
|
||||
target_start_date, target_end_date, early_start_date, early_end_date,
|
||||
act_start_date, act_end_date,
|
||||
total_float_hr_cnt, driving_path_flag, status_code, milestone_type
|
||||
)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
""",
|
||||
(
|
||||
task["task_id"],
|
||||
task["proj_id"],
|
||||
task["wbs_id"],
|
||||
task["task_code"],
|
||||
task["task_name"],
|
||||
task["task_type"],
|
||||
task["target_start_date"],
|
||||
task["target_end_date"],
|
||||
task.get("early_start_date"),
|
||||
task.get("early_end_date"),
|
||||
task["act_start_date"],
|
||||
task["act_end_date"],
|
||||
task["total_float_hr_cnt"],
|
||||
1 if task["driving_path_flag"] else 0,
|
||||
task["status_code"],
|
||||
task.get("milestone_type"),
|
||||
),
|
||||
)
|
||||
|
||||
# Build set of task IDs in this project
|
||||
project_task_ids = {t["task_id"] for t in parsed.tasks if t["proj_id"] == project_id}
|
||||
|
||||
# Insert relationships where both tasks are in this project
|
||||
for rel in parsed.taskpreds:
|
||||
if (
|
||||
rel.get("proj_id") == project_id
|
||||
and rel["task_id"] in project_task_ids
|
||||
and rel["pred_task_id"] in project_task_ids
|
||||
):
|
||||
cur.execute(
|
||||
"""
|
||||
INSERT INTO relationships (
|
||||
task_pred_id, task_id, pred_task_id, pred_type, lag_hr_cnt
|
||||
)
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
""",
|
||||
(
|
||||
rel["task_pred_id"],
|
||||
rel["task_id"],
|
||||
rel["pred_task_id"],
|
||||
rel["pred_type"],
|
||||
rel["lag_hr_cnt"],
|
||||
),
|
||||
)
|
||||
|
||||
db.commit()
|
||||
|
||||
|
||||
def get_activity_count() -> int:
|
||||
"""Get the count of activities in the database."""
|
||||
with db.cursor() as cur:
|
||||
cur.execute("SELECT COUNT(*) FROM activities")
|
||||
return cur.fetchone()[0]
|
||||
|
||||
|
||||
def get_relationship_count() -> int:
|
||||
"""Get the count of relationships in the database."""
|
||||
with db.cursor() as cur:
|
||||
cur.execute("SELECT COUNT(*) FROM relationships")
|
||||
return cur.fetchone()[0]
|
||||
484
src/xer_mcp/db/queries.py
Normal file
484
src/xer_mcp/db/queries.py
Normal file
@@ -0,0 +1,484 @@
|
||||
"""Database query functions for XER data."""
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from xer_mcp.db import db
|
||||
|
||||
|
||||
def is_driving_relationship(
|
||||
pred_early_end: str | None,
|
||||
succ_early_start: str | None,
|
||||
lag_hours: float,
|
||||
pred_type: str,
|
||||
) -> bool:
|
||||
"""Determine if a relationship is driving the successor's early start.
|
||||
|
||||
A relationship is "driving" when the predecessor's completion (plus lag)
|
||||
determines the successor's early start date. This is computed by comparing
|
||||
dates with a tolerance for overnight gaps and calendar differences.
|
||||
|
||||
Args:
|
||||
pred_early_end: Predecessor's early end date (ISO format)
|
||||
succ_early_start: Successor's early start date (ISO format)
|
||||
lag_hours: Lag duration in hours (can be negative)
|
||||
pred_type: Relationship type (FS, SS, FF, SF)
|
||||
|
||||
Returns:
|
||||
True if the relationship is driving, False otherwise
|
||||
"""
|
||||
if pred_early_end is None or succ_early_start is None:
|
||||
return False
|
||||
|
||||
try:
|
||||
pred_end = datetime.fromisoformat(pred_early_end)
|
||||
succ_start = datetime.fromisoformat(succ_early_start)
|
||||
except (ValueError, TypeError):
|
||||
return False
|
||||
|
||||
# For FS (Finish-to-Start): pred_end + lag should equal succ_start
|
||||
if pred_type == "FS":
|
||||
expected_start = pred_end + timedelta(hours=lag_hours)
|
||||
# Allow tolerance of 24 hours for overnight gaps and calendar differences
|
||||
diff = abs((succ_start - expected_start).total_seconds())
|
||||
return diff <= 24 * 3600 # 24 hours tolerance
|
||||
|
||||
# For SS (Start-to-Start): would need pred_early_start, not implemented
|
||||
# For FF (Finish-to-Finish): would need succ_early_end, not implemented
|
||||
# For SF (Start-to-Finish): complex case, not implemented
|
||||
# Default to False for non-FS relationships for now
|
||||
return False
|
||||
|
||||
|
||||
def query_activities(
|
||||
limit: int = 100,
|
||||
offset: int = 0,
|
||||
start_date: str | None = None,
|
||||
end_date: str | None = None,
|
||||
wbs_id: str | None = None,
|
||||
activity_type: str | None = None,
|
||||
) -> tuple[list[dict], int]:
|
||||
"""Query activities with pagination and filtering.
|
||||
|
||||
Args:
|
||||
limit: Maximum number of results to return
|
||||
offset: Number of results to skip
|
||||
start_date: Filter activities starting on or after this date (YYYY-MM-DD)
|
||||
end_date: Filter activities ending on or before this date (YYYY-MM-DD)
|
||||
wbs_id: Filter by WBS ID
|
||||
activity_type: Filter by task type (TT_Task, TT_Mile, etc.)
|
||||
|
||||
Returns:
|
||||
Tuple of (list of activity dicts, total count matching filters)
|
||||
"""
|
||||
# Build WHERE clause
|
||||
conditions = []
|
||||
params: list = []
|
||||
|
||||
if start_date:
|
||||
conditions.append("target_start_date >= ?")
|
||||
params.append(f"{start_date}T00:00:00")
|
||||
|
||||
if end_date:
|
||||
conditions.append("target_end_date <= ?")
|
||||
params.append(f"{end_date}T23:59:59")
|
||||
|
||||
if wbs_id:
|
||||
conditions.append("wbs_id = ?")
|
||||
params.append(wbs_id)
|
||||
|
||||
if activity_type:
|
||||
conditions.append("task_type = ?")
|
||||
params.append(activity_type)
|
||||
|
||||
where_clause = " AND ".join(conditions) if conditions else "1=1"
|
||||
|
||||
# Get total count
|
||||
with db.cursor() as cur:
|
||||
cur.execute(f"SELECT COUNT(*) FROM activities WHERE {where_clause}", params) # noqa: S608
|
||||
total = cur.fetchone()[0]
|
||||
|
||||
# Get paginated results
|
||||
query = f"""
|
||||
SELECT task_id, task_code, task_name, task_type,
|
||||
target_start_date, target_end_date, status_code,
|
||||
driving_path_flag, wbs_id, total_float_hr_cnt
|
||||
FROM activities
|
||||
WHERE {where_clause}
|
||||
ORDER BY target_start_date, task_code
|
||||
LIMIT ? OFFSET ?
|
||||
""" # noqa: S608
|
||||
|
||||
with db.cursor() as cur:
|
||||
cur.execute(query, [*params, limit, offset])
|
||||
rows = cur.fetchall()
|
||||
|
||||
activities = [
|
||||
{
|
||||
"task_id": row[0],
|
||||
"task_code": row[1],
|
||||
"task_name": row[2],
|
||||
"task_type": row[3],
|
||||
"target_start_date": row[4],
|
||||
"target_end_date": row[5],
|
||||
"status_code": row[6],
|
||||
"driving_path_flag": bool(row[7]),
|
||||
}
|
||||
for row in rows
|
||||
]
|
||||
|
||||
return activities, total
|
||||
|
||||
|
||||
def get_activity_by_id(activity_id: str) -> dict | None:
|
||||
"""Get a single activity by ID with full details.
|
||||
|
||||
Args:
|
||||
activity_id: The task_id to look up
|
||||
|
||||
Returns:
|
||||
Activity dict with all fields, or None if not found
|
||||
"""
|
||||
query = """
|
||||
SELECT a.task_id, a.task_code, a.task_name, a.task_type,
|
||||
a.wbs_id, w.wbs_name,
|
||||
a.target_start_date, a.target_end_date,
|
||||
a.act_start_date, a.act_end_date,
|
||||
a.total_float_hr_cnt, a.status_code, a.driving_path_flag
|
||||
FROM activities a
|
||||
LEFT JOIN wbs w ON a.wbs_id = w.wbs_id
|
||||
WHERE a.task_id = ?
|
||||
"""
|
||||
|
||||
with db.cursor() as cur:
|
||||
cur.execute(query, (activity_id,))
|
||||
row = cur.fetchone()
|
||||
|
||||
if row is None:
|
||||
return None
|
||||
|
||||
# Count predecessors and successors
|
||||
with db.cursor() as cur:
|
||||
cur.execute(
|
||||
"SELECT COUNT(*) FROM relationships WHERE task_id = ?",
|
||||
(activity_id,),
|
||||
)
|
||||
predecessor_count = cur.fetchone()[0]
|
||||
|
||||
cur.execute(
|
||||
"SELECT COUNT(*) FROM relationships WHERE pred_task_id = ?",
|
||||
(activity_id,),
|
||||
)
|
||||
successor_count = cur.fetchone()[0]
|
||||
|
||||
return {
|
||||
"task_id": row[0],
|
||||
"task_code": row[1],
|
||||
"task_name": row[2],
|
||||
"task_type": row[3],
|
||||
"wbs_id": row[4],
|
||||
"wbs_name": row[5],
|
||||
"target_start_date": row[6],
|
||||
"target_end_date": row[7],
|
||||
"act_start_date": row[8],
|
||||
"act_end_date": row[9],
|
||||
"total_float_hr_cnt": row[10],
|
||||
"status_code": row[11],
|
||||
"driving_path_flag": bool(row[12]),
|
||||
"predecessor_count": predecessor_count,
|
||||
"successor_count": successor_count,
|
||||
}
|
||||
|
||||
|
||||
def query_relationships(
|
||||
limit: int = 100,
|
||||
offset: int = 0,
|
||||
) -> tuple[list[dict], int]:
|
||||
"""Query relationships with pagination.
|
||||
|
||||
Args:
|
||||
limit: Maximum number of results to return
|
||||
offset: Number of results to skip
|
||||
|
||||
Returns:
|
||||
Tuple of (list of relationship dicts, total count)
|
||||
"""
|
||||
# Get total count
|
||||
with db.cursor() as cur:
|
||||
cur.execute("SELECT COUNT(*) FROM relationships")
|
||||
total = cur.fetchone()[0]
|
||||
|
||||
# Get paginated results with activity names and early dates for driving computation
|
||||
query = """
|
||||
SELECT r.task_pred_id, r.task_id, succ.task_name,
|
||||
r.pred_task_id, pred.task_name,
|
||||
r.pred_type, r.lag_hr_cnt,
|
||||
pred.early_end_date, succ.early_start_date
|
||||
FROM relationships r
|
||||
LEFT JOIN activities succ ON r.task_id = succ.task_id
|
||||
LEFT JOIN activities pred ON r.pred_task_id = pred.task_id
|
||||
ORDER BY r.task_pred_id
|
||||
LIMIT ? OFFSET ?
|
||||
"""
|
||||
|
||||
with db.cursor() as cur:
|
||||
cur.execute(query, (limit, offset))
|
||||
rows = cur.fetchall()
|
||||
|
||||
# Convert pred_type from internal format (PR_FS) to API format (FS)
|
||||
def format_pred_type(pred_type: str) -> str:
|
||||
if pred_type.startswith("PR_"):
|
||||
return pred_type[3:]
|
||||
return pred_type
|
||||
|
||||
relationships = []
|
||||
for row in rows:
|
||||
pred_type = format_pred_type(row[5])
|
||||
driving = is_driving_relationship(
|
||||
pred_early_end=row[7],
|
||||
succ_early_start=row[8],
|
||||
lag_hours=row[6] or 0.0,
|
||||
pred_type=pred_type,
|
||||
)
|
||||
relationships.append({
|
||||
"task_pred_id": row[0],
|
||||
"task_id": row[1],
|
||||
"task_name": row[2],
|
||||
"pred_task_id": row[3],
|
||||
"pred_task_name": row[4],
|
||||
"pred_type": pred_type,
|
||||
"lag_hr_cnt": row[6],
|
||||
"driving": driving,
|
||||
})
|
||||
|
||||
return relationships, total
|
||||
|
||||
|
||||
def get_predecessors(activity_id: str) -> list[dict]:
|
||||
"""Get predecessor activities for a given activity.
|
||||
|
||||
Args:
|
||||
activity_id: The task_id to find predecessors for
|
||||
|
||||
Returns:
|
||||
List of predecessor activity dicts with relationship info and driving flag
|
||||
"""
|
||||
# Get successor's early start for driving calculation
|
||||
with db.cursor() as cur:
|
||||
cur.execute(
|
||||
"SELECT early_start_date FROM activities WHERE task_id = ?",
|
||||
(activity_id,),
|
||||
)
|
||||
succ_row = cur.fetchone()
|
||||
succ_early_start = succ_row[0] if succ_row else None
|
||||
|
||||
query = """
|
||||
SELECT pred.task_id, pred.task_code, pred.task_name,
|
||||
r.pred_type, r.lag_hr_cnt, pred.early_end_date
|
||||
FROM relationships r
|
||||
JOIN activities pred ON r.pred_task_id = pred.task_id
|
||||
WHERE r.task_id = ?
|
||||
ORDER BY pred.task_code
|
||||
"""
|
||||
|
||||
with db.cursor() as cur:
|
||||
cur.execute(query, (activity_id,))
|
||||
rows = cur.fetchall()
|
||||
|
||||
def format_pred_type(pred_type: str) -> str:
|
||||
if pred_type.startswith("PR_"):
|
||||
return pred_type[3:]
|
||||
return pred_type
|
||||
|
||||
result = []
|
||||
for row in rows:
|
||||
pred_type = format_pred_type(row[3])
|
||||
driving = is_driving_relationship(
|
||||
pred_early_end=row[5],
|
||||
succ_early_start=succ_early_start,
|
||||
lag_hours=row[4] or 0.0,
|
||||
pred_type=pred_type,
|
||||
)
|
||||
result.append({
|
||||
"task_id": row[0],
|
||||
"task_code": row[1],
|
||||
"task_name": row[2],
|
||||
"relationship_type": pred_type,
|
||||
"lag_hr_cnt": row[4],
|
||||
"driving": driving,
|
||||
})
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def get_successors(activity_id: str) -> list[dict]:
|
||||
"""Get successor activities for a given activity.
|
||||
|
||||
Args:
|
||||
activity_id: The task_id to find successors for
|
||||
|
||||
Returns:
|
||||
List of successor activity dicts with relationship info and driving flag
|
||||
"""
|
||||
# Get predecessor's early end for driving calculation
|
||||
with db.cursor() as cur:
|
||||
cur.execute(
|
||||
"SELECT early_end_date FROM activities WHERE task_id = ?",
|
||||
(activity_id,),
|
||||
)
|
||||
pred_row = cur.fetchone()
|
||||
pred_early_end = pred_row[0] if pred_row else None
|
||||
|
||||
query = """
|
||||
SELECT succ.task_id, succ.task_code, succ.task_name,
|
||||
r.pred_type, r.lag_hr_cnt, succ.early_start_date
|
||||
FROM relationships r
|
||||
JOIN activities succ ON r.task_id = succ.task_id
|
||||
WHERE r.pred_task_id = ?
|
||||
ORDER BY succ.task_code
|
||||
"""
|
||||
|
||||
with db.cursor() as cur:
|
||||
cur.execute(query, (activity_id,))
|
||||
rows = cur.fetchall()
|
||||
|
||||
def format_pred_type(pred_type: str) -> str:
|
||||
if pred_type.startswith("PR_"):
|
||||
return pred_type[3:]
|
||||
return pred_type
|
||||
|
||||
result = []
|
||||
for row in rows:
|
||||
pred_type = format_pred_type(row[3])
|
||||
driving = is_driving_relationship(
|
||||
pred_early_end=pred_early_end,
|
||||
succ_early_start=row[5],
|
||||
lag_hours=row[4] or 0.0,
|
||||
pred_type=pred_type,
|
||||
)
|
||||
result.append({
|
||||
"task_id": row[0],
|
||||
"task_code": row[1],
|
||||
"task_name": row[2],
|
||||
"relationship_type": pred_type,
|
||||
"lag_hr_cnt": row[4],
|
||||
"driving": driving,
|
||||
})
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def get_project_summary(project_id: str) -> dict | None:
|
||||
"""Get project summary information.
|
||||
|
||||
Args:
|
||||
project_id: The project ID to get summary for
|
||||
|
||||
Returns:
|
||||
Dictionary with project summary or None if not found
|
||||
"""
|
||||
# Get project info
|
||||
with db.cursor() as cur:
|
||||
cur.execute(
|
||||
"""
|
||||
SELECT proj_id, proj_short_name, plan_start_date, plan_end_date, last_recalc_date
|
||||
FROM projects
|
||||
WHERE proj_id = ?
|
||||
""",
|
||||
(project_id,),
|
||||
)
|
||||
project_row = cur.fetchone()
|
||||
|
||||
if project_row is None:
|
||||
return None
|
||||
|
||||
# Get activity count
|
||||
with db.cursor() as cur:
|
||||
cur.execute("SELECT COUNT(*) FROM activities")
|
||||
activity_count = cur.fetchone()[0]
|
||||
|
||||
# Get milestone count (both start and finish milestones)
|
||||
with db.cursor() as cur:
|
||||
cur.execute("SELECT COUNT(*) FROM activities WHERE task_type IN ('TT_Mile', 'TT_FinMile')")
|
||||
milestone_count = cur.fetchone()[0]
|
||||
|
||||
# Get critical activity count
|
||||
with db.cursor() as cur:
|
||||
cur.execute("SELECT COUNT(*) FROM activities WHERE driving_path_flag = 1")
|
||||
critical_count = cur.fetchone()[0]
|
||||
|
||||
return {
|
||||
"project_id": project_row[0],
|
||||
"project_name": project_row[1],
|
||||
"data_date": project_row[4],
|
||||
"plan_start_date": project_row[2],
|
||||
"plan_end_date": project_row[3],
|
||||
"activity_count": activity_count,
|
||||
"milestone_count": milestone_count,
|
||||
"critical_activity_count": critical_count,
|
||||
}
|
||||
|
||||
|
||||
def query_milestones() -> list[dict]:
|
||||
"""Query all milestone activities (both start and finish milestones).
|
||||
|
||||
Returns:
|
||||
List of milestone activity dicts with milestone_type (start/finish)
|
||||
"""
|
||||
query = """
|
||||
SELECT task_id, task_code, task_name,
|
||||
target_start_date, target_end_date, status_code, milestone_type
|
||||
FROM activities
|
||||
WHERE task_type IN ('TT_Mile', 'TT_FinMile')
|
||||
ORDER BY target_start_date, task_code
|
||||
"""
|
||||
|
||||
with db.cursor() as cur:
|
||||
cur.execute(query)
|
||||
rows = cur.fetchall()
|
||||
|
||||
return [
|
||||
{
|
||||
"task_id": row[0],
|
||||
"task_code": row[1],
|
||||
"task_name": row[2],
|
||||
"target_start_date": row[3],
|
||||
"target_end_date": row[4],
|
||||
"status_code": row[5],
|
||||
"milestone_type": row[6],
|
||||
}
|
||||
for row in rows
|
||||
]
|
||||
|
||||
|
||||
def query_critical_path() -> list[dict]:
|
||||
"""Query all activities on the critical path.
|
||||
|
||||
Returns:
|
||||
List of critical path activity dicts ordered by start date
|
||||
"""
|
||||
query = """
|
||||
SELECT task_id, task_code, task_name, task_type,
|
||||
target_start_date, target_end_date,
|
||||
total_float_hr_cnt, status_code
|
||||
FROM activities
|
||||
WHERE driving_path_flag = 1
|
||||
ORDER BY target_start_date, task_code
|
||||
"""
|
||||
|
||||
with db.cursor() as cur:
|
||||
cur.execute(query)
|
||||
rows = cur.fetchall()
|
||||
|
||||
return [
|
||||
{
|
||||
"task_id": row[0],
|
||||
"task_code": row[1],
|
||||
"task_name": row[2],
|
||||
"task_type": row[3],
|
||||
"target_start_date": row[4],
|
||||
"target_end_date": row[5],
|
||||
"total_float_hr_cnt": row[6],
|
||||
"status_code": row[7],
|
||||
}
|
||||
for row in rows
|
||||
]
|
||||
81
src/xer_mcp/db/schema.py
Normal file
81
src/xer_mcp/db/schema.py
Normal file
@@ -0,0 +1,81 @@
|
||||
"""SQLite database schema for XER MCP Server."""
|
||||
|
||||
SCHEMA_SQL = """
|
||||
-- Projects
|
||||
CREATE TABLE IF NOT EXISTS projects (
|
||||
proj_id TEXT PRIMARY KEY,
|
||||
proj_short_name TEXT NOT NULL,
|
||||
plan_start_date TEXT,
|
||||
plan_end_date TEXT,
|
||||
last_recalc_date TEXT,
|
||||
loaded_at TEXT NOT NULL DEFAULT (datetime('now'))
|
||||
);
|
||||
|
||||
-- Activities
|
||||
CREATE TABLE IF NOT EXISTS activities (
|
||||
task_id TEXT PRIMARY KEY,
|
||||
proj_id TEXT NOT NULL,
|
||||
wbs_id TEXT,
|
||||
task_code TEXT NOT NULL,
|
||||
task_name TEXT NOT NULL,
|
||||
task_type TEXT NOT NULL,
|
||||
target_start_date TEXT,
|
||||
target_end_date TEXT,
|
||||
early_start_date TEXT,
|
||||
early_end_date TEXT,
|
||||
act_start_date TEXT,
|
||||
act_end_date TEXT,
|
||||
total_float_hr_cnt REAL,
|
||||
driving_path_flag INTEGER DEFAULT 0,
|
||||
status_code TEXT,
|
||||
milestone_type TEXT,
|
||||
FOREIGN KEY (proj_id) REFERENCES projects(proj_id)
|
||||
);
|
||||
|
||||
-- Relationships
|
||||
CREATE TABLE IF NOT EXISTS relationships (
|
||||
task_pred_id TEXT PRIMARY KEY,
|
||||
task_id TEXT NOT NULL,
|
||||
pred_task_id TEXT NOT NULL,
|
||||
pred_type TEXT NOT NULL,
|
||||
lag_hr_cnt REAL DEFAULT 0,
|
||||
FOREIGN KEY (task_id) REFERENCES activities(task_id),
|
||||
FOREIGN KEY (pred_task_id) REFERENCES activities(task_id)
|
||||
);
|
||||
|
||||
-- WBS (Work Breakdown Structure)
|
||||
CREATE TABLE IF NOT EXISTS wbs (
|
||||
wbs_id TEXT PRIMARY KEY,
|
||||
proj_id TEXT NOT NULL,
|
||||
parent_wbs_id TEXT,
|
||||
wbs_short_name TEXT NOT NULL,
|
||||
wbs_name TEXT,
|
||||
FOREIGN KEY (proj_id) REFERENCES projects(proj_id),
|
||||
FOREIGN KEY (parent_wbs_id) REFERENCES wbs(wbs_id)
|
||||
);
|
||||
|
||||
-- Calendars (internal use only)
|
||||
CREATE TABLE IF NOT EXISTS calendars (
|
||||
clndr_id TEXT PRIMARY KEY,
|
||||
clndr_name TEXT NOT NULL,
|
||||
day_hr_cnt REAL,
|
||||
week_hr_cnt REAL
|
||||
);
|
||||
|
||||
-- Indexes for performance
|
||||
CREATE INDEX IF NOT EXISTS idx_activities_proj ON activities(proj_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_activities_wbs ON activities(wbs_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_activities_type ON activities(task_type);
|
||||
CREATE INDEX IF NOT EXISTS idx_activities_critical ON activities(driving_path_flag)
|
||||
WHERE driving_path_flag = 1;
|
||||
CREATE INDEX IF NOT EXISTS idx_activities_dates ON activities(target_start_date, target_end_date);
|
||||
CREATE INDEX IF NOT EXISTS idx_relationships_task ON relationships(task_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_relationships_pred ON relationships(pred_task_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_wbs_parent ON wbs(parent_wbs_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_wbs_proj ON wbs(proj_id);
|
||||
"""
|
||||
|
||||
|
||||
def get_schema() -> str:
|
||||
"""Return the complete SQLite schema."""
|
||||
return SCHEMA_SQL
|
||||
58
src/xer_mcp/errors.py
Normal file
58
src/xer_mcp/errors.py
Normal file
@@ -0,0 +1,58 @@
|
||||
"""Error types for XER MCP Server."""
|
||||
|
||||
|
||||
class XerMcpError(Exception):
|
||||
"""Base exception for XER MCP Server."""
|
||||
|
||||
def __init__(self, code: str, message: str) -> None:
|
||||
self.code = code
|
||||
self.message = message
|
||||
super().__init__(f"{code}: {message}")
|
||||
|
||||
|
||||
class FileNotFoundError(XerMcpError):
|
||||
"""Raised when the specified XER file does not exist."""
|
||||
|
||||
def __init__(self, file_path: str) -> None:
|
||||
super().__init__(
|
||||
"FILE_NOT_FOUND",
|
||||
f"XER file not found: {file_path}",
|
||||
)
|
||||
|
||||
|
||||
class ParseError(XerMcpError):
|
||||
"""Raised when the XER file cannot be parsed."""
|
||||
|
||||
def __init__(self, message: str) -> None:
|
||||
super().__init__("PARSE_ERROR", message)
|
||||
|
||||
|
||||
class NoFileLoadedError(XerMcpError):
|
||||
"""Raised when a query is attempted before loading an XER file."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__(
|
||||
"NO_FILE_LOADED",
|
||||
"No XER file is loaded. Use the load_xer tool first.",
|
||||
)
|
||||
|
||||
|
||||
class ProjectSelectionRequiredError(XerMcpError):
|
||||
"""Raised when a multi-project file requires explicit project selection."""
|
||||
|
||||
def __init__(self, available_projects: list[dict]) -> None:
|
||||
self.available_projects = available_projects
|
||||
super().__init__(
|
||||
"PROJECT_SELECTION_REQUIRED",
|
||||
"Multiple projects found. Please specify project_id.",
|
||||
)
|
||||
|
||||
|
||||
class ActivityNotFoundError(XerMcpError):
|
||||
"""Raised when the specified activity does not exist."""
|
||||
|
||||
def __init__(self, activity_id: str) -> None:
|
||||
super().__init__(
|
||||
"ACTIVITY_NOT_FOUND",
|
||||
f"Activity not found: {activity_id}",
|
||||
)
|
||||
17
src/xer_mcp/models/__init__.py
Normal file
17
src/xer_mcp/models/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
||||
"""Data models for XER MCP Server."""
|
||||
|
||||
from xer_mcp.models.activity import Activity
|
||||
from xer_mcp.models.calendar import Calendar
|
||||
from xer_mcp.models.pagination import PaginationMetadata
|
||||
from xer_mcp.models.project import Project
|
||||
from xer_mcp.models.relationship import Relationship
|
||||
from xer_mcp.models.wbs import WBS
|
||||
|
||||
__all__ = [
|
||||
"Activity",
|
||||
"Calendar",
|
||||
"PaginationMetadata",
|
||||
"Project",
|
||||
"Relationship",
|
||||
"WBS",
|
||||
]
|
||||
23
src/xer_mcp/models/activity.py
Normal file
23
src/xer_mcp/models/activity.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""Activity data model."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
@dataclass
|
||||
class Activity:
|
||||
"""A unit of work in the schedule."""
|
||||
|
||||
task_id: str
|
||||
proj_id: str
|
||||
task_code: str
|
||||
task_name: str
|
||||
task_type: str
|
||||
wbs_id: str | None = None
|
||||
target_start_date: datetime | None = None
|
||||
target_end_date: datetime | None = None
|
||||
act_start_date: datetime | None = None
|
||||
act_end_date: datetime | None = None
|
||||
total_float_hr_cnt: float | None = None
|
||||
driving_path_flag: bool = False
|
||||
status_code: str | None = None
|
||||
13
src/xer_mcp/models/calendar.py
Normal file
13
src/xer_mcp/models/calendar.py
Normal file
@@ -0,0 +1,13 @@
|
||||
"""Calendar data model (internal use only)."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass
|
||||
class Calendar:
|
||||
"""Work schedule definition. Not exposed via MCP tools."""
|
||||
|
||||
clndr_id: str
|
||||
clndr_name: str
|
||||
day_hr_cnt: float | None = None
|
||||
week_hr_cnt: float | None = None
|
||||
13
src/xer_mcp/models/pagination.py
Normal file
13
src/xer_mcp/models/pagination.py
Normal file
@@ -0,0 +1,13 @@
|
||||
"""Pagination metadata model."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass
|
||||
class PaginationMetadata:
|
||||
"""Response wrapper for paginated queries."""
|
||||
|
||||
total_count: int
|
||||
offset: int
|
||||
limit: int
|
||||
has_more: bool
|
||||
15
src/xer_mcp/models/project.py
Normal file
15
src/xer_mcp/models/project.py
Normal file
@@ -0,0 +1,15 @@
|
||||
"""Project data model."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
@dataclass
|
||||
class Project:
|
||||
"""Top-level container representing a P6 project."""
|
||||
|
||||
proj_id: str
|
||||
proj_short_name: str
|
||||
plan_start_date: datetime | None = None
|
||||
plan_end_date: datetime | None = None
|
||||
loaded_at: datetime | None = None
|
||||
14
src/xer_mcp/models/relationship.py
Normal file
14
src/xer_mcp/models/relationship.py
Normal file
@@ -0,0 +1,14 @@
|
||||
"""Relationship data model."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass
|
||||
class Relationship:
|
||||
"""A dependency link between two activities."""
|
||||
|
||||
task_pred_id: str
|
||||
task_id: str
|
||||
pred_task_id: str
|
||||
pred_type: str
|
||||
lag_hr_cnt: float = 0.0
|
||||
14
src/xer_mcp/models/wbs.py
Normal file
14
src/xer_mcp/models/wbs.py
Normal file
@@ -0,0 +1,14 @@
|
||||
"""Work Breakdown Structure (WBS) data model."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass
|
||||
class WBS:
|
||||
"""Hierarchical organization of activities."""
|
||||
|
||||
wbs_id: str
|
||||
proj_id: str
|
||||
wbs_short_name: str
|
||||
parent_wbs_id: str | None = None
|
||||
wbs_name: str | None = None
|
||||
1
src/xer_mcp/parser/__init__.py
Normal file
1
src/xer_mcp/parser/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""XER file parser module."""
|
||||
27
src/xer_mcp/parser/table_handlers/__init__.py
Normal file
27
src/xer_mcp/parser/table_handlers/__init__.py
Normal file
@@ -0,0 +1,27 @@
|
||||
"""XER table handlers module."""
|
||||
|
||||
from xer_mcp.parser.table_handlers.base import TableHandler
|
||||
from xer_mcp.parser.table_handlers.calendar import CalendarHandler
|
||||
from xer_mcp.parser.table_handlers.project import ProjectHandler
|
||||
from xer_mcp.parser.table_handlers.projwbs import ProjwbsHandler
|
||||
from xer_mcp.parser.table_handlers.task import TaskHandler
|
||||
from xer_mcp.parser.table_handlers.taskpred import TaskpredHandler
|
||||
|
||||
# Registry mapping table names to handlers
|
||||
TABLE_HANDLERS: dict[str, type[TableHandler]] = {
|
||||
"PROJECT": ProjectHandler,
|
||||
"TASK": TaskHandler,
|
||||
"TASKPRED": TaskpredHandler,
|
||||
"PROJWBS": ProjwbsHandler,
|
||||
"CALENDAR": CalendarHandler,
|
||||
}
|
||||
|
||||
__all__ = [
|
||||
"CalendarHandler",
|
||||
"ProjectHandler",
|
||||
"ProjwbsHandler",
|
||||
"TABLE_HANDLERS",
|
||||
"TableHandler",
|
||||
"TaskHandler",
|
||||
"TaskpredHandler",
|
||||
]
|
||||
30
src/xer_mcp/parser/table_handlers/base.py
Normal file
30
src/xer_mcp/parser/table_handlers/base.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""Base class for XER table handlers."""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
class TableHandler(ABC):
|
||||
"""Abstract base class for XER table handlers.
|
||||
|
||||
Each handler is responsible for parsing a specific table type
|
||||
from the XER file and returning structured data.
|
||||
"""
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def table_name(self) -> str:
|
||||
"""Return the XER table name this handler processes (e.g., 'PROJECT', 'TASK')."""
|
||||
...
|
||||
|
||||
@abstractmethod
|
||||
def parse_row(self, fields: list[str], values: list[str]) -> dict | None:
|
||||
"""Parse a single row of data from the XER file.
|
||||
|
||||
Args:
|
||||
fields: List of column names from the %F line
|
||||
values: List of values from the %R line
|
||||
|
||||
Returns:
|
||||
Dictionary of parsed data, or None if the row should be skipped
|
||||
"""
|
||||
...
|
||||
32
src/xer_mcp/parser/table_handlers/calendar.py
Normal file
32
src/xer_mcp/parser/table_handlers/calendar.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""CALENDAR table handler."""
|
||||
|
||||
from xer_mcp.parser.table_handlers.base import TableHandler
|
||||
|
||||
|
||||
class CalendarHandler(TableHandler):
|
||||
"""Handler for CALENDAR table in XER files."""
|
||||
|
||||
@property
|
||||
def table_name(self) -> str:
|
||||
return "CALENDAR"
|
||||
|
||||
def parse_row(self, fields: list[str], values: list[str]) -> dict | None:
|
||||
"""Parse a CALENDAR row."""
|
||||
if len(values) < len(fields):
|
||||
values = values + [""] * (len(fields) - len(values))
|
||||
|
||||
data = dict(zip(fields, values, strict=False))
|
||||
|
||||
# Parse numeric fields
|
||||
day_hr_str = data.get("day_hr_cnt", "")
|
||||
day_hr = float(day_hr_str) if day_hr_str else None
|
||||
|
||||
week_hr_str = data.get("week_hr_cnt", "")
|
||||
week_hr = float(week_hr_str) if week_hr_str else None
|
||||
|
||||
return {
|
||||
"clndr_id": data.get("clndr_id", ""),
|
||||
"clndr_name": data.get("clndr_name", ""),
|
||||
"day_hr_cnt": day_hr,
|
||||
"week_hr_cnt": week_hr,
|
||||
}
|
||||
39
src/xer_mcp/parser/table_handlers/project.py
Normal file
39
src/xer_mcp/parser/table_handlers/project.py
Normal file
@@ -0,0 +1,39 @@
|
||||
"""PROJECT table handler."""
|
||||
|
||||
from xer_mcp.parser.table_handlers.base import TableHandler
|
||||
|
||||
|
||||
def convert_date(date_str: str | None) -> str | None:
|
||||
"""Convert XER date format to ISO8601.
|
||||
|
||||
XER format: "YYYY-MM-DD HH:MM"
|
||||
ISO8601 format: "YYYY-MM-DDTHH:MM:SS"
|
||||
"""
|
||||
if not date_str or date_str.strip() == "":
|
||||
return None
|
||||
# Replace space with T and add seconds
|
||||
return date_str.replace(" ", "T") + ":00"
|
||||
|
||||
|
||||
class ProjectHandler(TableHandler):
|
||||
"""Handler for PROJECT table in XER files."""
|
||||
|
||||
@property
|
||||
def table_name(self) -> str:
|
||||
return "PROJECT"
|
||||
|
||||
def parse_row(self, fields: list[str], values: list[str]) -> dict | None:
|
||||
"""Parse a PROJECT row."""
|
||||
if len(values) < len(fields):
|
||||
# Pad with empty strings if needed
|
||||
values = values + [""] * (len(fields) - len(values))
|
||||
|
||||
data = dict(zip(fields, values, strict=False))
|
||||
|
||||
return {
|
||||
"proj_id": data.get("proj_id", ""),
|
||||
"proj_short_name": data.get("proj_short_name", ""),
|
||||
"plan_start_date": convert_date(data.get("plan_start_date")),
|
||||
"plan_end_date": convert_date(data.get("plan_end_date")),
|
||||
"last_recalc_date": convert_date(data.get("last_recalc_date")),
|
||||
}
|
||||
26
src/xer_mcp/parser/table_handlers/projwbs.py
Normal file
26
src/xer_mcp/parser/table_handlers/projwbs.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""PROJWBS table handler."""
|
||||
|
||||
from xer_mcp.parser.table_handlers.base import TableHandler
|
||||
|
||||
|
||||
class ProjwbsHandler(TableHandler):
|
||||
"""Handler for PROJWBS (WBS) table in XER files."""
|
||||
|
||||
@property
|
||||
def table_name(self) -> str:
|
||||
return "PROJWBS"
|
||||
|
||||
def parse_row(self, fields: list[str], values: list[str]) -> dict | None:
|
||||
"""Parse a PROJWBS row."""
|
||||
if len(values) < len(fields):
|
||||
values = values + [""] * (len(fields) - len(values))
|
||||
|
||||
data = dict(zip(fields, values, strict=False))
|
||||
|
||||
return {
|
||||
"wbs_id": data.get("wbs_id", ""),
|
||||
"proj_id": data.get("proj_id", ""),
|
||||
"parent_wbs_id": data.get("parent_wbs_id", ""),
|
||||
"wbs_short_name": data.get("wbs_short_name", ""),
|
||||
"wbs_name": data.get("wbs_name") or None,
|
||||
}
|
||||
62
src/xer_mcp/parser/table_handlers/task.py
Normal file
62
src/xer_mcp/parser/table_handlers/task.py
Normal file
@@ -0,0 +1,62 @@
|
||||
"""TASK table handler."""
|
||||
|
||||
from xer_mcp.parser.table_handlers.base import TableHandler
|
||||
from xer_mcp.parser.table_handlers.project import convert_date
|
||||
|
||||
|
||||
class TaskHandler(TableHandler):
|
||||
"""Handler for TASK table in XER files."""
|
||||
|
||||
@property
|
||||
def table_name(self) -> str:
|
||||
return "TASK"
|
||||
|
||||
def parse_row(self, fields: list[str], values: list[str]) -> dict | None:
|
||||
"""Parse a TASK row."""
|
||||
if len(values) < len(fields):
|
||||
values = values + [""] * (len(fields) - len(values))
|
||||
|
||||
data = dict(zip(fields, values, strict=False))
|
||||
|
||||
# Parse driving_path_flag (Y/N -> bool)
|
||||
driving_flag = data.get("driving_path_flag", "N")
|
||||
driving_path = driving_flag.upper() == "Y" if driving_flag else False
|
||||
|
||||
# Parse total_float_hr_cnt
|
||||
float_str = data.get("total_float_hr_cnt", "")
|
||||
total_float = float(float_str) if float_str else None
|
||||
|
||||
# Parse milestone_type
|
||||
# First check explicit milestone_type field (MS_Start -> 'start', MS_Finish -> 'finish')
|
||||
# Then derive from task_type (TT_Mile -> 'start', TT_FinMile -> 'finish')
|
||||
raw_milestone_type = data.get("milestone_type", "")
|
||||
task_type = data.get("task_type", "")
|
||||
milestone_type = None
|
||||
if raw_milestone_type:
|
||||
if raw_milestone_type == "MS_Start":
|
||||
milestone_type = "start"
|
||||
elif raw_milestone_type == "MS_Finish":
|
||||
milestone_type = "finish"
|
||||
elif task_type == "TT_Mile":
|
||||
milestone_type = "start"
|
||||
elif task_type == "TT_FinMile":
|
||||
milestone_type = "finish"
|
||||
|
||||
return {
|
||||
"task_id": data.get("task_id", ""),
|
||||
"proj_id": data.get("proj_id", ""),
|
||||
"wbs_id": data.get("wbs_id") or None,
|
||||
"task_code": data.get("task_code", ""),
|
||||
"task_name": data.get("task_name", ""),
|
||||
"task_type": data.get("task_type", ""),
|
||||
"status_code": data.get("status_code") or None,
|
||||
"target_start_date": convert_date(data.get("target_start_date")),
|
||||
"target_end_date": convert_date(data.get("target_end_date")),
|
||||
"early_start_date": convert_date(data.get("early_start_date")),
|
||||
"early_end_date": convert_date(data.get("early_end_date")),
|
||||
"act_start_date": convert_date(data.get("act_start_date")),
|
||||
"act_end_date": convert_date(data.get("act_end_date")),
|
||||
"total_float_hr_cnt": total_float,
|
||||
"driving_path_flag": driving_path,
|
||||
"milestone_type": milestone_type,
|
||||
}
|
||||
31
src/xer_mcp/parser/table_handlers/taskpred.py
Normal file
31
src/xer_mcp/parser/table_handlers/taskpred.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""TASKPRED table handler."""
|
||||
|
||||
from xer_mcp.parser.table_handlers.base import TableHandler
|
||||
|
||||
|
||||
class TaskpredHandler(TableHandler):
|
||||
"""Handler for TASKPRED (relationships) table in XER files."""
|
||||
|
||||
@property
|
||||
def table_name(self) -> str:
|
||||
return "TASKPRED"
|
||||
|
||||
def parse_row(self, fields: list[str], values: list[str]) -> dict | None:
|
||||
"""Parse a TASKPRED row."""
|
||||
if len(values) < len(fields):
|
||||
values = values + [""] * (len(fields) - len(values))
|
||||
|
||||
data = dict(zip(fields, values, strict=False))
|
||||
|
||||
# Parse lag_hr_cnt
|
||||
lag_str = data.get("lag_hr_cnt", "0")
|
||||
lag_hr = float(lag_str) if lag_str else 0.0
|
||||
|
||||
return {
|
||||
"task_pred_id": data.get("task_pred_id", ""),
|
||||
"task_id": data.get("task_id", ""),
|
||||
"pred_task_id": data.get("pred_task_id", ""),
|
||||
"proj_id": data.get("proj_id", ""),
|
||||
"pred_type": data.get("pred_type", ""),
|
||||
"lag_hr_cnt": lag_hr,
|
||||
}
|
||||
127
src/xer_mcp/parser/xer_parser.py
Normal file
127
src/xer_mcp/parser/xer_parser.py
Normal file
@@ -0,0 +1,127 @@
|
||||
"""XER file parser."""
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
|
||||
from xer_mcp.errors import FileNotFoundError, ParseError
|
||||
from xer_mcp.parser.table_handlers import TABLE_HANDLERS
|
||||
|
||||
|
||||
@dataclass
|
||||
class ParsedXer:
|
||||
"""Container for parsed XER data."""
|
||||
|
||||
projects: list[dict] = field(default_factory=list)
|
||||
tasks: list[dict] = field(default_factory=list)
|
||||
taskpreds: list[dict] = field(default_factory=list)
|
||||
projwbs: list[dict] = field(default_factory=list)
|
||||
calendars: list[dict] = field(default_factory=list)
|
||||
|
||||
|
||||
class XerParser:
|
||||
"""Parser for Primavera P6 XER files.
|
||||
|
||||
XER files are tab-delimited with the following structure:
|
||||
- ERMHDR line: header with version info
|
||||
- %T lines: table name declarations
|
||||
- %F lines: field (column) names
|
||||
- %R lines: data rows
|
||||
"""
|
||||
|
||||
def parse(self, file_path: Path | str) -> ParsedXer:
|
||||
"""Parse an XER file and return structured data.
|
||||
|
||||
Args:
|
||||
file_path: Path to the XER file
|
||||
|
||||
Returns:
|
||||
ParsedXer containing all parsed tables
|
||||
|
||||
Raises:
|
||||
FileNotFoundError: If file doesn't exist
|
||||
ParseError: If file is invalid or cannot be parsed
|
||||
"""
|
||||
path = Path(file_path)
|
||||
if not path.exists():
|
||||
raise FileNotFoundError(str(path))
|
||||
|
||||
try:
|
||||
content = path.read_text(encoding="utf-8", errors="replace")
|
||||
except OSError as e:
|
||||
raise ParseError(f"Cannot read file: {e}") from e
|
||||
|
||||
return self._parse_content(content)
|
||||
|
||||
def _parse_content(self, content: str) -> ParsedXer:
|
||||
"""Parse XER content string."""
|
||||
lines = content.split("\n")
|
||||
if not lines:
|
||||
raise ParseError("Empty file")
|
||||
|
||||
# Check for ERMHDR line
|
||||
first_line = lines[0].strip()
|
||||
if not first_line.startswith("ERMHDR"):
|
||||
raise ParseError("Invalid XER file: missing ERMHDR header")
|
||||
|
||||
result = ParsedXer()
|
||||
current_table: str | None = None
|
||||
current_fields: list[str] = []
|
||||
|
||||
for line in lines[1:]:
|
||||
line = line.rstrip("\r\n")
|
||||
if not line:
|
||||
continue
|
||||
|
||||
parts = line.split("\t")
|
||||
if not parts:
|
||||
continue
|
||||
|
||||
marker = parts[0]
|
||||
|
||||
if marker == "%T":
|
||||
# Table declaration
|
||||
if len(parts) < 2:
|
||||
continue
|
||||
current_table = parts[1]
|
||||
current_fields = []
|
||||
|
||||
elif marker == "%F":
|
||||
# Field names
|
||||
current_fields = parts[1:]
|
||||
|
||||
elif marker == "%R":
|
||||
# Data row
|
||||
if current_table and current_fields:
|
||||
values = parts[1:]
|
||||
row_data = self._parse_row(current_table, current_fields, values)
|
||||
if row_data:
|
||||
self._add_to_result(result, current_table, row_data)
|
||||
|
||||
# Validate we got at least some data
|
||||
if not result.projects:
|
||||
raise ParseError("No PROJECT data found in XER file")
|
||||
|
||||
return result
|
||||
|
||||
def _parse_row(self, table_name: str, fields: list[str], values: list[str]) -> dict | None:
|
||||
"""Parse a single data row using the appropriate handler."""
|
||||
handler_class = TABLE_HANDLERS.get(table_name)
|
||||
if handler_class is None:
|
||||
# Unknown table, skip
|
||||
return None
|
||||
|
||||
handler = handler_class()
|
||||
return handler.parse_row(fields, values)
|
||||
|
||||
def _add_to_result(self, result: ParsedXer, table_name: str, row_data: dict) -> None:
|
||||
"""Add parsed row to the appropriate result list."""
|
||||
if table_name == "PROJECT":
|
||||
result.projects.append(row_data)
|
||||
elif table_name == "TASK":
|
||||
result.tasks.append(row_data)
|
||||
elif table_name == "TASKPRED":
|
||||
result.taskpreds.append(row_data)
|
||||
elif table_name == "PROJWBS":
|
||||
result.projwbs.append(row_data)
|
||||
elif table_name == "CALENDAR":
|
||||
result.calendars.append(row_data)
|
||||
273
src/xer_mcp/server.py
Normal file
273
src/xer_mcp/server.py
Normal file
@@ -0,0 +1,273 @@
|
||||
"""MCP Server for XER file analysis."""
|
||||
|
||||
from mcp.server import Server
|
||||
from mcp.server.stdio import stdio_server
|
||||
from mcp.types import TextContent, Tool
|
||||
|
||||
from xer_mcp.db import db
|
||||
|
||||
# Create MCP server instance
|
||||
server = Server("xer-mcp")
|
||||
|
||||
# Server state
|
||||
_file_loaded: bool = False
|
||||
_current_project_id: str | None = None
|
||||
|
||||
|
||||
def is_file_loaded() -> bool:
|
||||
"""Check if an XER file has been loaded."""
|
||||
return _file_loaded
|
||||
|
||||
|
||||
def get_current_project_id() -> str | None:
|
||||
"""Get the currently selected project ID."""
|
||||
return _current_project_id
|
||||
|
||||
|
||||
def set_file_loaded(loaded: bool, project_id: str | None = None) -> None:
|
||||
"""Set the file loaded state."""
|
||||
global _file_loaded, _current_project_id
|
||||
_file_loaded = loaded
|
||||
_current_project_id = project_id
|
||||
|
||||
|
||||
@server.list_tools()
|
||||
async def list_tools() -> list[Tool]:
|
||||
"""List available MCP tools."""
|
||||
return [
|
||||
Tool(
|
||||
name="load_xer",
|
||||
description="Load a Primavera P6 XER file and parse its schedule data. "
|
||||
"For multi-project files, specify project_id to select a project.",
|
||||
inputSchema={
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"file_path": {
|
||||
"type": "string",
|
||||
"description": "Absolute path to the XER file",
|
||||
},
|
||||
"project_id": {
|
||||
"type": "string",
|
||||
"description": "Project ID to select (required for multi-project files)",
|
||||
},
|
||||
},
|
||||
"required": ["file_path"],
|
||||
},
|
||||
),
|
||||
Tool(
|
||||
name="list_activities",
|
||||
description="List activities from the loaded XER file with optional filtering and pagination.",
|
||||
inputSchema={
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"start_date": {
|
||||
"type": "string",
|
||||
"format": "date",
|
||||
"description": "Filter activities starting on or after this date (YYYY-MM-DD)",
|
||||
},
|
||||
"end_date": {
|
||||
"type": "string",
|
||||
"format": "date",
|
||||
"description": "Filter activities ending on or before this date (YYYY-MM-DD)",
|
||||
},
|
||||
"wbs_id": {
|
||||
"type": "string",
|
||||
"description": "Filter by WBS element ID",
|
||||
},
|
||||
"activity_type": {
|
||||
"type": "string",
|
||||
"enum": ["TT_Task", "TT_Mile", "TT_LOE", "TT_WBS", "TT_Rsrc"],
|
||||
"description": "Filter by activity type",
|
||||
},
|
||||
"limit": {
|
||||
"type": "integer",
|
||||
"default": 100,
|
||||
"minimum": 1,
|
||||
"maximum": 1000,
|
||||
"description": "Maximum number of activities to return",
|
||||
},
|
||||
"offset": {
|
||||
"type": "integer",
|
||||
"default": 0,
|
||||
"minimum": 0,
|
||||
"description": "Number of activities to skip",
|
||||
},
|
||||
},
|
||||
},
|
||||
),
|
||||
Tool(
|
||||
name="get_activity",
|
||||
description="Get detailed information for a specific activity by ID.",
|
||||
inputSchema={
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"activity_id": {
|
||||
"type": "string",
|
||||
"description": "The task_id of the activity",
|
||||
},
|
||||
},
|
||||
"required": ["activity_id"],
|
||||
},
|
||||
),
|
||||
Tool(
|
||||
name="list_relationships",
|
||||
description="List all activity relationships (dependencies) with pagination.",
|
||||
inputSchema={
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"limit": {
|
||||
"type": "integer",
|
||||
"default": 100,
|
||||
"minimum": 1,
|
||||
"maximum": 1000,
|
||||
"description": "Maximum number of relationships to return",
|
||||
},
|
||||
"offset": {
|
||||
"type": "integer",
|
||||
"default": 0,
|
||||
"minimum": 0,
|
||||
"description": "Number of relationships to skip",
|
||||
},
|
||||
},
|
||||
},
|
||||
),
|
||||
Tool(
|
||||
name="get_predecessors",
|
||||
description="Get all predecessor activities for a given activity.",
|
||||
inputSchema={
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"activity_id": {
|
||||
"type": "string",
|
||||
"description": "The task_id of the activity",
|
||||
},
|
||||
},
|
||||
"required": ["activity_id"],
|
||||
},
|
||||
),
|
||||
Tool(
|
||||
name="get_successors",
|
||||
description="Get all successor activities for a given activity.",
|
||||
inputSchema={
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"activity_id": {
|
||||
"type": "string",
|
||||
"description": "The task_id of the activity",
|
||||
},
|
||||
},
|
||||
"required": ["activity_id"],
|
||||
},
|
||||
),
|
||||
Tool(
|
||||
name="get_project_summary",
|
||||
description="Get a summary of the loaded project including dates and activity counts.",
|
||||
inputSchema={
|
||||
"type": "object",
|
||||
"properties": {},
|
||||
},
|
||||
),
|
||||
Tool(
|
||||
name="list_milestones",
|
||||
description="List all milestone activities in the loaded project.",
|
||||
inputSchema={
|
||||
"type": "object",
|
||||
"properties": {},
|
||||
},
|
||||
),
|
||||
Tool(
|
||||
name="get_critical_path",
|
||||
description="Get all activities on the critical path that determine project duration.",
|
||||
inputSchema={
|
||||
"type": "object",
|
||||
"properties": {},
|
||||
},
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
@server.call_tool()
|
||||
async def call_tool(name: str, arguments: dict) -> list[TextContent]:
|
||||
"""Handle MCP tool calls."""
|
||||
import json
|
||||
|
||||
if name == "load_xer":
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
result = await load_xer(
|
||||
file_path=arguments["file_path"],
|
||||
project_id=arguments.get("project_id"),
|
||||
)
|
||||
return [TextContent(type="text", text=json.dumps(result, indent=2))]
|
||||
|
||||
if name == "list_activities":
|
||||
from xer_mcp.tools.list_activities import list_activities
|
||||
|
||||
result = await list_activities(
|
||||
start_date=arguments.get("start_date"),
|
||||
end_date=arguments.get("end_date"),
|
||||
wbs_id=arguments.get("wbs_id"),
|
||||
activity_type=arguments.get("activity_type"),
|
||||
limit=arguments.get("limit", 100),
|
||||
offset=arguments.get("offset", 0),
|
||||
)
|
||||
return [TextContent(type="text", text=json.dumps(result, indent=2))]
|
||||
|
||||
if name == "get_activity":
|
||||
from xer_mcp.tools.get_activity import get_activity
|
||||
|
||||
result = await get_activity(activity_id=arguments["activity_id"])
|
||||
return [TextContent(type="text", text=json.dumps(result, indent=2))]
|
||||
|
||||
if name == "list_relationships":
|
||||
from xer_mcp.tools.list_relationships import list_relationships
|
||||
|
||||
result = await list_relationships(
|
||||
limit=arguments.get("limit", 100),
|
||||
offset=arguments.get("offset", 0),
|
||||
)
|
||||
return [TextContent(type="text", text=json.dumps(result, indent=2))]
|
||||
|
||||
if name == "get_predecessors":
|
||||
from xer_mcp.tools.get_predecessors import get_predecessors
|
||||
|
||||
result = await get_predecessors(activity_id=arguments["activity_id"])
|
||||
return [TextContent(type="text", text=json.dumps(result, indent=2))]
|
||||
|
||||
if name == "get_successors":
|
||||
from xer_mcp.tools.get_successors import get_successors
|
||||
|
||||
result = await get_successors(activity_id=arguments["activity_id"])
|
||||
return [TextContent(type="text", text=json.dumps(result, indent=2))]
|
||||
|
||||
if name == "get_project_summary":
|
||||
from xer_mcp.tools.get_project_summary import get_project_summary
|
||||
|
||||
result = await get_project_summary()
|
||||
return [TextContent(type="text", text=json.dumps(result, indent=2))]
|
||||
|
||||
if name == "list_milestones":
|
||||
from xer_mcp.tools.list_milestones import list_milestones
|
||||
|
||||
result = await list_milestones()
|
||||
return [TextContent(type="text", text=json.dumps(result, indent=2))]
|
||||
|
||||
if name == "get_critical_path":
|
||||
from xer_mcp.tools.get_critical_path import get_critical_path
|
||||
|
||||
result = await get_critical_path()
|
||||
return [TextContent(type="text", text=json.dumps(result, indent=2))]
|
||||
|
||||
raise ValueError(f"Unknown tool: {name}")
|
||||
|
||||
|
||||
async def run_server() -> None:
|
||||
"""Run the MCP server with stdio transport."""
|
||||
db.initialize()
|
||||
|
||||
async with stdio_server() as (read_stream, write_stream):
|
||||
await server.run(
|
||||
read_stream,
|
||||
write_stream,
|
||||
server.create_initialization_options(),
|
||||
)
|
||||
1
src/xer_mcp/tools/__init__.py
Normal file
1
src/xer_mcp/tools/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""MCP tools for XER file analysis."""
|
||||
34
src/xer_mcp/tools/get_activity.py
Normal file
34
src/xer_mcp/tools/get_activity.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""get_activity MCP tool implementation."""
|
||||
|
||||
from xer_mcp.db.queries import get_activity_by_id
|
||||
from xer_mcp.server import is_file_loaded
|
||||
|
||||
|
||||
async def get_activity(activity_id: str) -> dict:
|
||||
"""Get detailed information for a specific activity by ID.
|
||||
|
||||
Args:
|
||||
activity_id: The task_id of the activity
|
||||
|
||||
Returns:
|
||||
Dictionary with complete activity details or error
|
||||
"""
|
||||
if not is_file_loaded():
|
||||
return {
|
||||
"error": {
|
||||
"code": "NO_FILE_LOADED",
|
||||
"message": "No XER file is loaded. Use the load_xer tool first.",
|
||||
}
|
||||
}
|
||||
|
||||
activity = get_activity_by_id(activity_id)
|
||||
|
||||
if activity is None:
|
||||
return {
|
||||
"error": {
|
||||
"code": "ACTIVITY_NOT_FOUND",
|
||||
"message": f"Activity not found: {activity_id}",
|
||||
}
|
||||
}
|
||||
|
||||
return activity
|
||||
36
src/xer_mcp/tools/get_critical_path.py
Normal file
36
src/xer_mcp/tools/get_critical_path.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""get_critical_path MCP tool implementation."""
|
||||
|
||||
from xer_mcp.db.queries import query_critical_path
|
||||
from xer_mcp.server import is_file_loaded
|
||||
|
||||
|
||||
async def get_critical_path() -> dict:
|
||||
"""Get all activities on the critical path.
|
||||
|
||||
Returns activities where driving_path_flag is set, ordered by target start date.
|
||||
The critical path determines the minimum project duration.
|
||||
|
||||
Returns:
|
||||
Dictionary with list of critical path activities, each containing:
|
||||
- task_id: Activity ID
|
||||
- task_code: Activity code
|
||||
- task_name: Activity name
|
||||
- task_type: Activity type (TT_Task, TT_Mile, etc.)
|
||||
- target_start_date: Target start date
|
||||
- target_end_date: Target end date
|
||||
- total_float_hr_cnt: Total float in hours
|
||||
- status_code: Activity status
|
||||
"""
|
||||
if not is_file_loaded():
|
||||
return {
|
||||
"error": {
|
||||
"code": "NO_FILE_LOADED",
|
||||
"message": "No XER file is loaded. Use the load_xer tool first.",
|
||||
}
|
||||
}
|
||||
|
||||
critical_activities = query_critical_path()
|
||||
|
||||
return {
|
||||
"critical_activities": critical_activities,
|
||||
}
|
||||
29
src/xer_mcp/tools/get_predecessors.py
Normal file
29
src/xer_mcp/tools/get_predecessors.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""get_predecessors MCP tool implementation."""
|
||||
|
||||
from xer_mcp.db.queries import get_predecessors as query_predecessors
|
||||
from xer_mcp.server import is_file_loaded
|
||||
|
||||
|
||||
async def get_predecessors(activity_id: str) -> dict:
|
||||
"""Get predecessor activities for a given activity.
|
||||
|
||||
Args:
|
||||
activity_id: The task_id to find predecessors for
|
||||
|
||||
Returns:
|
||||
Dictionary with activity_id and list of predecessor activities
|
||||
"""
|
||||
if not is_file_loaded():
|
||||
return {
|
||||
"error": {
|
||||
"code": "NO_FILE_LOADED",
|
||||
"message": "No XER file is loaded. Use the load_xer tool first.",
|
||||
}
|
||||
}
|
||||
|
||||
predecessors = query_predecessors(activity_id)
|
||||
|
||||
return {
|
||||
"activity_id": activity_id,
|
||||
"predecessors": predecessors,
|
||||
}
|
||||
45
src/xer_mcp/tools/get_project_summary.py
Normal file
45
src/xer_mcp/tools/get_project_summary.py
Normal file
@@ -0,0 +1,45 @@
|
||||
"""get_project_summary MCP tool implementation."""
|
||||
|
||||
from xer_mcp.db.queries import get_project_summary as query_project_summary
|
||||
from xer_mcp.server import get_current_project_id, is_file_loaded
|
||||
|
||||
|
||||
async def get_project_summary() -> dict:
|
||||
"""Get a summary of the loaded project.
|
||||
|
||||
Returns:
|
||||
Dictionary with project summary information including:
|
||||
- project_name: Name of the project
|
||||
- plan_start_date: Planned start date
|
||||
- plan_end_date: Planned end date
|
||||
- activity_count: Total number of activities
|
||||
- milestone_count: Number of milestone activities
|
||||
- critical_activity_count: Number of activities on critical path
|
||||
"""
|
||||
if not is_file_loaded():
|
||||
return {
|
||||
"error": {
|
||||
"code": "NO_FILE_LOADED",
|
||||
"message": "No XER file is loaded. Use the load_xer tool first.",
|
||||
}
|
||||
}
|
||||
|
||||
project_id = get_current_project_id()
|
||||
if project_id is None:
|
||||
return {
|
||||
"error": {
|
||||
"code": "NO_PROJECT_SELECTED",
|
||||
"message": "No project is selected.",
|
||||
}
|
||||
}
|
||||
|
||||
summary = query_project_summary(project_id)
|
||||
if summary is None:
|
||||
return {
|
||||
"error": {
|
||||
"code": "PROJECT_NOT_FOUND",
|
||||
"message": f"Project with ID {project_id} not found.",
|
||||
}
|
||||
}
|
||||
|
||||
return summary
|
||||
29
src/xer_mcp/tools/get_successors.py
Normal file
29
src/xer_mcp/tools/get_successors.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""get_successors MCP tool implementation."""
|
||||
|
||||
from xer_mcp.db.queries import get_successors as query_successors
|
||||
from xer_mcp.server import is_file_loaded
|
||||
|
||||
|
||||
async def get_successors(activity_id: str) -> dict:
|
||||
"""Get successor activities for a given activity.
|
||||
|
||||
Args:
|
||||
activity_id: The task_id to find successors for
|
||||
|
||||
Returns:
|
||||
Dictionary with activity_id and list of successor activities
|
||||
"""
|
||||
if not is_file_loaded():
|
||||
return {
|
||||
"error": {
|
||||
"code": "NO_FILE_LOADED",
|
||||
"message": "No XER file is loaded. Use the load_xer tool first.",
|
||||
}
|
||||
}
|
||||
|
||||
successors = query_successors(activity_id)
|
||||
|
||||
return {
|
||||
"activity_id": activity_id,
|
||||
"successors": successors,
|
||||
}
|
||||
55
src/xer_mcp/tools/list_activities.py
Normal file
55
src/xer_mcp/tools/list_activities.py
Normal file
@@ -0,0 +1,55 @@
|
||||
"""list_activities MCP tool implementation."""
|
||||
|
||||
from xer_mcp.db.queries import query_activities
|
||||
from xer_mcp.server import is_file_loaded
|
||||
|
||||
|
||||
async def list_activities(
|
||||
start_date: str | None = None,
|
||||
end_date: str | None = None,
|
||||
wbs_id: str | None = None,
|
||||
activity_type: str | None = None,
|
||||
limit: int = 100,
|
||||
offset: int = 0,
|
||||
) -> dict:
|
||||
"""List activities from the loaded XER file with optional filtering.
|
||||
|
||||
Args:
|
||||
start_date: Filter activities starting on or after this date (YYYY-MM-DD)
|
||||
end_date: Filter activities ending on or before this date (YYYY-MM-DD)
|
||||
wbs_id: Filter by WBS element ID
|
||||
activity_type: Filter by activity type (TT_Task, TT_Mile, etc.)
|
||||
limit: Maximum number of activities to return (default 100)
|
||||
offset: Number of activities to skip (default 0)
|
||||
|
||||
Returns:
|
||||
Dictionary with activities list and pagination metadata
|
||||
"""
|
||||
if not is_file_loaded():
|
||||
return {
|
||||
"error": {
|
||||
"code": "NO_FILE_LOADED",
|
||||
"message": "No XER file is loaded. Use the load_xer tool first.",
|
||||
}
|
||||
}
|
||||
|
||||
activities, total_count = query_activities(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
start_date=start_date,
|
||||
end_date=end_date,
|
||||
wbs_id=wbs_id,
|
||||
activity_type=activity_type,
|
||||
)
|
||||
|
||||
has_more = (offset + len(activities)) < total_count
|
||||
|
||||
return {
|
||||
"activities": activities,
|
||||
"pagination": {
|
||||
"total_count": total_count,
|
||||
"offset": offset,
|
||||
"limit": limit,
|
||||
"has_more": has_more,
|
||||
},
|
||||
}
|
||||
34
src/xer_mcp/tools/list_milestones.py
Normal file
34
src/xer_mcp/tools/list_milestones.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""list_milestones MCP tool implementation."""
|
||||
|
||||
from xer_mcp.db.queries import query_milestones
|
||||
from xer_mcp.server import is_file_loaded
|
||||
|
||||
|
||||
async def list_milestones() -> dict:
|
||||
"""List all milestone activities in the loaded project.
|
||||
|
||||
Returns both Start Milestones and Finish Milestones with their milestone_type.
|
||||
|
||||
Returns:
|
||||
Dictionary with list of milestones, each containing:
|
||||
- task_id: Activity ID
|
||||
- task_code: Activity code
|
||||
- task_name: Activity name
|
||||
- target_start_date: Target start date
|
||||
- target_end_date: Target end date
|
||||
- status_code: Activity status
|
||||
- milestone_type: 'start' for start milestones, 'finish' for finish milestones
|
||||
"""
|
||||
if not is_file_loaded():
|
||||
return {
|
||||
"error": {
|
||||
"code": "NO_FILE_LOADED",
|
||||
"message": "No XER file is loaded. Use the load_xer tool first.",
|
||||
}
|
||||
}
|
||||
|
||||
milestones = query_milestones()
|
||||
|
||||
return {
|
||||
"milestones": milestones,
|
||||
}
|
||||
40
src/xer_mcp/tools/list_relationships.py
Normal file
40
src/xer_mcp/tools/list_relationships.py
Normal file
@@ -0,0 +1,40 @@
|
||||
"""list_relationships MCP tool implementation."""
|
||||
|
||||
from xer_mcp.db.queries import query_relationships
|
||||
from xer_mcp.server import is_file_loaded
|
||||
|
||||
|
||||
async def list_relationships(
|
||||
limit: int = 100,
|
||||
offset: int = 0,
|
||||
) -> dict:
|
||||
"""List all relationships (dependencies) with pagination.
|
||||
|
||||
Args:
|
||||
limit: Maximum number of relationships to return (default 100)
|
||||
offset: Number of relationships to skip (default 0)
|
||||
|
||||
Returns:
|
||||
Dictionary with relationships list and pagination metadata
|
||||
"""
|
||||
if not is_file_loaded():
|
||||
return {
|
||||
"error": {
|
||||
"code": "NO_FILE_LOADED",
|
||||
"message": "No XER file is loaded. Use the load_xer tool first.",
|
||||
}
|
||||
}
|
||||
|
||||
relationships, total_count = query_relationships(limit=limit, offset=offset)
|
||||
|
||||
has_more = (offset + len(relationships)) < total_count
|
||||
|
||||
return {
|
||||
"relationships": relationships,
|
||||
"pagination": {
|
||||
"total_count": total_count,
|
||||
"offset": offset,
|
||||
"limit": limit,
|
||||
"has_more": has_more,
|
||||
},
|
||||
}
|
||||
86
src/xer_mcp/tools/load_xer.py
Normal file
86
src/xer_mcp/tools/load_xer.py
Normal file
@@ -0,0 +1,86 @@
|
||||
"""load_xer MCP tool implementation."""
|
||||
|
||||
from xer_mcp.db import db
|
||||
from xer_mcp.db.loader import get_activity_count, get_relationship_count, load_parsed_data
|
||||
from xer_mcp.errors import FileNotFoundError, ParseError
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
from xer_mcp.server import set_file_loaded
|
||||
|
||||
|
||||
async def load_xer(file_path: str, project_id: str | None = None) -> dict:
|
||||
"""Load a Primavera P6 XER file and parse its schedule data.
|
||||
|
||||
Args:
|
||||
file_path: Absolute path to the XER file
|
||||
project_id: Project ID to select (required for multi-project files)
|
||||
|
||||
Returns:
|
||||
Dictionary with success status and project info or error details
|
||||
"""
|
||||
# Ensure database is initialized
|
||||
if not db.is_initialized:
|
||||
db.initialize()
|
||||
|
||||
parser = XerParser()
|
||||
|
||||
try:
|
||||
parsed = parser.parse(file_path)
|
||||
except FileNotFoundError as e:
|
||||
return {
|
||||
"success": False,
|
||||
"error": {"code": e.code, "message": e.message},
|
||||
}
|
||||
except ParseError as e:
|
||||
return {
|
||||
"success": False,
|
||||
"error": {"code": e.code, "message": e.message},
|
||||
}
|
||||
|
||||
# Handle multi-project files
|
||||
if len(parsed.projects) > 1 and project_id is None:
|
||||
available = [
|
||||
{"proj_id": p["proj_id"], "proj_short_name": p["proj_short_name"]}
|
||||
for p in parsed.projects
|
||||
]
|
||||
return {
|
||||
"success": False,
|
||||
"available_projects": available,
|
||||
"message": "Multiple projects found. Please specify project_id.",
|
||||
}
|
||||
|
||||
# Auto-select if single project
|
||||
if project_id is None:
|
||||
project_id = parsed.projects[0]["proj_id"]
|
||||
|
||||
# Find the selected project
|
||||
project = next((p for p in parsed.projects if p["proj_id"] == project_id), None)
|
||||
if project is None:
|
||||
return {
|
||||
"success": False,
|
||||
"error": {
|
||||
"code": "PROJECT_NOT_FOUND",
|
||||
"message": f"Project {project_id} not found in file",
|
||||
},
|
||||
}
|
||||
|
||||
# Load data into database
|
||||
load_parsed_data(parsed, project_id)
|
||||
|
||||
# Mark file as loaded
|
||||
set_file_loaded(True, project_id)
|
||||
|
||||
# Get counts
|
||||
activity_count = get_activity_count()
|
||||
relationship_count = get_relationship_count()
|
||||
|
||||
return {
|
||||
"success": True,
|
||||
"project": {
|
||||
"proj_id": project["proj_id"],
|
||||
"proj_short_name": project["proj_short_name"],
|
||||
"plan_start_date": project["plan_start_date"],
|
||||
"plan_end_date": project["plan_end_date"],
|
||||
},
|
||||
"activity_count": activity_count,
|
||||
"relationship_count": relationship_count,
|
||||
}
|
||||
1
tests/__init__.py
Normal file
1
tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""XER MCP Server tests."""
|
||||
129
tests/conftest.py
Normal file
129
tests/conftest.py
Normal file
@@ -0,0 +1,129 @@
|
||||
"""Pytest configuration and fixtures for XER MCP Server tests."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
# Sample XER content for testing - minimal but complete
|
||||
SAMPLE_XER_SINGLE_PROJECT = """\
|
||||
ERMHDR\t21.12\t2026-01-06\tProject\tADMIN\ttestuser\tdbTest\tProject Management\tUSD
|
||||
%T\tPROJECT
|
||||
%F\tproj_id\tfy_start_month_num\trsrc_self_add_flag\tallow_complete_flag\trsrc_multi_assign_flag\tcheckout_flag\tproject_flag\tstep_complete_flag\tcost_qty_recalc_flag\tbatch_sum_flag\tname_sep_char\tdef_complete_pct_type\tproj_short_name\tacct_id\torig_proj_id\tsource_proj_id\tbase_type_id\tclndr_id\tsum_base_proj_id\ttask_code_base\ttask_code_step\tpriority_num\twbs_max_sum_level\tstrgy_priority_num\tlast_checksum\tcritical_drtn_hr_cnt\tdef_cost_per_qty\tlast_recalc_date\tplan_start_date\tplan_end_date\tscd_end_date\tadd_date\tlast_tasksum_date\tfcst_start_date\tdef_duration_type\ttask_code_prefix\tguid\tdef_qty_type\tadd_by_name\tweb_local_root_path\tproj_url\tdef_rate_type\tadd_act_remain_flag\tact_this_per_link_flag\tdef_task_type\tact_pct_link_flag\tcritical_path_type\ttask_code_prefix_flag\tdef_rollup_dates_flag\tuse_project_baseline_flag\trem_target_link_flag\treset_planned_flag\tallow_neg_act_flag\tsum_assign_level\tlast_fin_dates_id\tfintmpl_id\tlast_baseline_update_date\tcr_external_key\tapply_actuals_date\tlocation_id\tloaded_scope_level\texport_flag\tnew_fin_dates_id\tbaselines_to_export\tbaseline_names_to_export\tnext_data_date\tclose_period_flag\tsum_refresh_date\ttrsrcsum_loaded\tsumtask_loaded
|
||||
%R\t1001\t1\tY\tY\tY\tN\tY\tN\tN\tY\t.\tCP_Drtn\tTest Project\t\t\t\t\t1\t\t1000\t10\t10\t2\t500\t\t0\t0.0000\t2026-01-06 00:00\t2026-01-01 00:00\t2026-06-30 00:00\t2026-06-30 00:00\t2026-01-06 00:00\t\t\tDT_FixedDUR2\tA\ttest-guid-1\tQT_Hour\tADMIN\t\t\tCOST_PER_QTY\tN\tY\tTT_Task\tY\tCT_TotFloat\tY\tY\tY\tY\tN\tN\tSL_Taskrsrc\t\t1\t\t\t\t\t7\tY\t\t\t\t\t\t\t
|
||||
%T\tCALENDAR
|
||||
%F\tclndr_id\tdefault_flag\tclndr_name\tproj_id\tbase_clndr_id\tlast_chng_date\tclndr_type\tday_hr_cnt\tweek_hr_cnt\tmonth_hr_cnt\tyear_hr_cnt\trsrc_private\tclndr_data
|
||||
%R\t1\tY\tStandard 5 Day\t\t\t2026-01-06 00:00\tCA_Base\t8\t40\t160\t2080\tN\t
|
||||
%T\tPROJWBS
|
||||
%F\twbs_id\tproj_id\tobs_id\tseq_num\test_wt\tproj_node_flag\tsum_data_flag\tstatus_code\twbs_short_name\twbs_name\tphase_id\tparent_wbs_id\tev_user_pct\tev_etc_user_value\torig_cost\tindep_remain_total_cost\tann_dscnt_rate_pct\tdscnt_period_type\tindep_remain_work_qty\tanticip_start_date\tanticip_end_date\tev_compute_type\tev_etc_compute_type\tguid\ttmpl_guid\tplan_open_state
|
||||
%R\t100\t1001\t\t1\t1\tY\tN\tWS_Open\tROOT\tTest Project\t\t\t6\t0.88\t0.0000\t0.0000\t\t\t\t\t\tEC_Cmp_pct\tEE_Rem_hr\twbs-guid-1\t\t
|
||||
%R\t101\t1001\t\t1\t1\tN\tN\tWS_Open\tPH1\tPhase 1\t\t100\t6\t0.88\t0.0000\t0.0000\t\t\t\t\t\tEC_Cmp_pct\tEE_Rem_hr\twbs-guid-2\t\t
|
||||
%R\t102\t1001\t\t2\t1\tN\tN\tWS_Open\tPH2\tPhase 2\t\t100\t6\t0.88\t0.0000\t0.0000\t\t\t\t\t\tEC_Cmp_pct\tEE_Rem_hr\twbs-guid-3\t\t
|
||||
%T\tTASK
|
||||
%F\ttask_id\tproj_id\twbs_id\tclndr_id\tphys_complete_pct\trev_fdbk_flag\test_wt\tlock_plan_flag\tauto_compute_act_flag\tcomplete_pct_type\ttask_type\tduration_type\tstatus_code\ttask_code\ttask_name\trsrc_id\ttotal_float_hr_cnt\tfree_float_hr_cnt\tremain_drtn_hr_cnt\tact_work_qty\tremain_work_qty\ttarget_work_qty\ttarget_drtn_hr_cnt\ttarget_equip_qty\tact_equip_qty\tremain_equip_qty\tcstr_date\tact_start_date\tact_end_date\tlate_start_date\tlate_end_date\texpect_end_date\tearly_start_date\tearly_end_date\trestart_date\treend_date\ttarget_start_date\ttarget_end_date\trem_late_start_date\trem_late_end_date\tcstr_type\tpriority_type\tsuspend_date\tresume_date\tfloat_path\tfloat_path_order\tguid\ttmpl_guid\tcstr_date2\tcstr_type2\tdriving_path_flag\tact_this_per_work_qty\tact_this_per_equip_qty\texternal_early_start_date\texternal_late_end_date\tcreate_date\tupdate_date\tcreate_user\tupdate_user\tlocation_id\tcrt_path_num\tmilestone_type
|
||||
%R\t2001\t1001\t101\t1\t0\tN\t1\tN\tN\tCP_Drtn\tTT_Mile\tDT_FixedDrtn\tTK_NotStart\tA1000\tProject Start\t\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t\t\t\t2026-01-01 07:00\t2026-01-01 07:00\t\t2026-01-01 07:00\t2026-01-01 07:00\t2026-01-01 07:00\t2026-01-01 07:00\t2026-01-01 07:00\t2026-01-01 07:00\t2026-01-01 07:00\t2026-01-01 07:00\t\tPT_Normal\t\t\t1\t1\ttask-guid-1\t\t\t\tY\t0\t0\t\t\t2026-01-06 00:00\t2026-01-06 00:00\tADMIN\tADMIN\t\t\tMS_Start
|
||||
%R\t2002\t1001\t101\t1\t0\tN\t1\tN\tN\tCP_Drtn\tTT_Task\tDT_FixedDUR2\tTK_NotStart\tA1010\tSite Preparation\t\t0\t0\t40\t0\t0\t0\t40\t0\t0\t0\t\t\t\t2026-01-02 07:00\t2026-01-08 15:00\t\t2026-01-02 07:00\t2026-01-08 15:00\t2026-01-02 07:00\t2026-01-08 15:00\t2026-01-02 07:00\t2026-01-08 15:00\t2026-01-02 07:00\t2026-01-08 15:00\t\tPT_Normal\t\t\t1\t2\ttask-guid-2\t\t\t\tY\t0\t0\t\t\t2026-01-06 00:00\t2026-01-06 00:00\tADMIN\tADMIN\t\t\t
|
||||
%R\t2003\t1001\t101\t1\t0\tN\t1\tN\tN\tCP_Drtn\tTT_Task\tDT_FixedDUR2\tTK_NotStart\tA1020\tFoundation Work\t\t80\t0\t80\t0\t0\t0\t80\t0\t0\t0\t\t\t\t2026-01-09 07:00\t2026-01-22 15:00\t\t2026-01-09 07:00\t2026-01-22 15:00\t2026-01-09 07:00\t2026-01-22 15:00\t2026-01-09 07:00\t2026-01-22 15:00\t2026-01-09 07:00\t2026-01-22 15:00\t\tPT_Normal\t\t\t1\t3\ttask-guid-3\t\t\t\tN\t0\t0\t\t\t2026-01-06 00:00\t2026-01-06 00:00\tADMIN\tADMIN\t\t\t
|
||||
%R\t2004\t1001\t102\t1\t0\tN\t1\tN\tN\tCP_Drtn\tTT_Task\tDT_FixedDUR2\tTK_NotStart\tA1030\tStructural Work\t\t0\t0\t160\t0\t0\t0\t160\t0\t0\t0\t\t\t\t2026-01-23 07:00\t2026-02-19 15:00\t\t2026-01-23 07:00\t2026-02-19 15:00\t2026-01-23 07:00\t2026-02-19 15:00\t2026-01-23 07:00\t2026-02-19 15:00\t2026-01-23 07:00\t2026-02-19 15:00\t\tPT_Normal\t\t\t1\t4\ttask-guid-4\t\t\t\tY\t0\t0\t\t\t2026-01-06 00:00\t2026-01-06 00:00\tADMIN\tADMIN\t\t\t
|
||||
%R\t2005\t1001\t102\t1\t0\tN\t1\tN\tN\tCP_Drtn\tTT_Mile\tDT_FixedDrtn\tTK_NotStart\tA1040\tProject Complete\t\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t\t\t\t2026-02-20 07:00\t2026-02-20 07:00\t\t2026-02-20 07:00\t2026-02-20 07:00\t2026-02-20 07:00\t2026-02-20 07:00\t2026-02-20 07:00\t2026-02-20 07:00\t2026-02-20 07:00\t2026-02-20 07:00\t\tPT_Normal\t\t\t1\t5\ttask-guid-5\t\t\t\tY\t0\t0\t\t\t2026-01-06 00:00\t2026-01-06 00:00\tADMIN\tADMIN\t\t\tMS_Finish
|
||||
%T\tTASKPRED
|
||||
%F\ttask_pred_id\ttask_id\tpred_task_id\tproj_id\tpred_proj_id\tpred_type\tlag_hr_cnt\tcomments\tfloat_path\taref\tarls
|
||||
%R\t3001\t2002\t2001\t1001\t1001\tPR_FS\t0\t\t\t2026-01-01 07:00\t2026-01-02 07:00
|
||||
%R\t3002\t2003\t2002\t1001\t1001\tPR_FS\t0\t\t\t2026-01-08 15:00\t2026-01-09 07:00
|
||||
%R\t3003\t2004\t2003\t1001\t1001\tPR_FS\t0\t\t\t2026-01-22 15:00\t2026-01-23 07:00
|
||||
%R\t3004\t2005\t2004\t1001\t1001\tPR_FS\t0\t\t\t2026-02-19 15:00\t2026-02-20 07:00
|
||||
%R\t3005\t2004\t2002\t1001\t1001\tPR_SS\t40\t\t\t2026-01-02 07:00\t2026-01-08 07:00
|
||||
%T\tEND
|
||||
"""
|
||||
|
||||
SAMPLE_XER_MULTI_PROJECT = """\
|
||||
ERMHDR\t21.12\t2026-01-06\tProject\tADMIN\ttestuser\tdbTest\tProject Management\tUSD
|
||||
%T\tPROJECT
|
||||
%F\tproj_id\tfy_start_month_num\trsrc_self_add_flag\tallow_complete_flag\trsrc_multi_assign_flag\tcheckout_flag\tproject_flag\tstep_complete_flag\tcost_qty_recalc_flag\tbatch_sum_flag\tname_sep_char\tdef_complete_pct_type\tproj_short_name\tacct_id\torig_proj_id\tsource_proj_id\tbase_type_id\tclndr_id\tsum_base_proj_id\ttask_code_base\ttask_code_step\tpriority_num\twbs_max_sum_level\tstrgy_priority_num\tlast_checksum\tcritical_drtn_hr_cnt\tdef_cost_per_qty\tlast_recalc_date\tplan_start_date\tplan_end_date\tscd_end_date\tadd_date\tlast_tasksum_date\tfcst_start_date\tdef_duration_type\ttask_code_prefix\tguid\tdef_qty_type\tadd_by_name\tweb_local_root_path\tproj_url\tdef_rate_type\tadd_act_remain_flag\tact_this_per_link_flag\tdef_task_type\tact_pct_link_flag\tcritical_path_type\ttask_code_prefix_flag\tdef_rollup_dates_flag\tuse_project_baseline_flag\trem_target_link_flag\treset_planned_flag\tallow_neg_act_flag\tsum_assign_level\tlast_fin_dates_id\tfintmpl_id\tlast_baseline_update_date\tcr_external_key\tapply_actuals_date\tlocation_id\tloaded_scope_level\texport_flag\tnew_fin_dates_id\tbaselines_to_export\tbaseline_names_to_export\tnext_data_date\tclose_period_flag\tsum_refresh_date\ttrsrcsum_loaded\tsumtask_loaded
|
||||
%R\t1001\t1\tY\tY\tY\tN\tY\tN\tN\tY\t.\tCP_Drtn\tProject Alpha\t\t\t\t\t1\t\t1000\t10\t10\t2\t500\t\t0\t0.0000\t2026-01-06 00:00\t2026-01-01 00:00\t2026-03-31 00:00\t2026-03-31 00:00\t2026-01-06 00:00\t\t\tDT_FixedDUR2\tA\ttest-guid-1\tQT_Hour\tADMIN\t\t\tCOST_PER_QTY\tN\tY\tTT_Task\tY\tCT_TotFloat\tY\tY\tY\tY\tN\tN\tSL_Taskrsrc\t\t1\t\t\t\t\t7\tY\t\t\t\t\t\t\t
|
||||
%R\t1002\t1\tY\tY\tY\tN\tY\tN\tN\tY\t.\tCP_Drtn\tProject Beta\t\t\t\t\t1\t\t1000\t10\t10\t2\t500\t\t0\t0.0000\t2026-01-06 00:00\t2026-04-01 00:00\t2026-06-30 00:00\t2026-06-30 00:00\t2026-01-06 00:00\t\t\tDT_FixedDUR2\tB\ttest-guid-2\tQT_Hour\tADMIN\t\t\tCOST_PER_QTY\tN\tY\tTT_Task\tY\tCT_TotFloat\tY\tY\tY\tY\tN\tN\tSL_Taskrsrc\t\t1\t\t\t\t\t7\tY\t\t\t\t\t\t\t
|
||||
%T\tCALENDAR
|
||||
%F\tclndr_id\tdefault_flag\tclndr_name\tproj_id\tbase_clndr_id\tlast_chng_date\tclndr_type\tday_hr_cnt\tweek_hr_cnt\tmonth_hr_cnt\tyear_hr_cnt\trsrc_private\tclndr_data
|
||||
%R\t1\tY\tStandard 5 Day\t\t\t2026-01-06 00:00\tCA_Base\t8\t40\t160\t2080\tN\t
|
||||
%T\tPROJWBS
|
||||
%F\twbs_id\tproj_id\tobs_id\tseq_num\test_wt\tproj_node_flag\tsum_data_flag\tstatus_code\twbs_short_name\twbs_name\tphase_id\tparent_wbs_id\tev_user_pct\tev_etc_user_value\torig_cost\tindep_remain_total_cost\tann_dscnt_rate_pct\tdscnt_period_type\tindep_remain_work_qty\tanticip_start_date\tanticip_end_date\tev_compute_type\tev_etc_compute_type\tguid\ttmpl_guid\tplan_open_state
|
||||
%R\t100\t1001\t\t1\t1\tY\tN\tWS_Open\tALPHA\tProject Alpha\t\t\t6\t0.88\t0.0000\t0.0000\t\t\t\t\t\tEC_Cmp_pct\tEE_Rem_hr\twbs-guid-1\t\t
|
||||
%R\t200\t1002\t\t1\t1\tY\tN\tWS_Open\tBETA\tProject Beta\t\t\t6\t0.88\t0.0000\t0.0000\t\t\t\t\t\tEC_Cmp_pct\tEE_Rem_hr\twbs-guid-2\t\t
|
||||
%T\tTASK
|
||||
%F\ttask_id\tproj_id\twbs_id\tclndr_id\tphys_complete_pct\trev_fdbk_flag\test_wt\tlock_plan_flag\tauto_compute_act_flag\tcomplete_pct_type\ttask_type\tduration_type\tstatus_code\ttask_code\ttask_name\trsrc_id\ttotal_float_hr_cnt\tfree_float_hr_cnt\tremain_drtn_hr_cnt\tact_work_qty\tremain_work_qty\ttarget_work_qty\ttarget_drtn_hr_cnt\ttarget_equip_qty\tact_equip_qty\tremain_equip_qty\tcstr_date\tact_start_date\tact_end_date\tlate_start_date\tlate_end_date\texpect_end_date\tearly_start_date\tearly_end_date\trestart_date\treend_date\ttarget_start_date\ttarget_end_date\trem_late_start_date\trem_late_end_date\tcstr_type\tpriority_type\tsuspend_date\tresume_date\tfloat_path\tfloat_path_order\tguid\ttmpl_guid\tcstr_date2\tcstr_type2\tdriving_path_flag\tact_this_per_work_qty\tact_this_per_equip_qty\texternal_early_start_date\texternal_late_end_date\tcreate_date\tupdate_date\tcreate_user\tupdate_user\tlocation_id\tcrt_path_num
|
||||
%R\t2001\t1001\t100\t1\t0\tN\t1\tN\tN\tCP_Drtn\tTT_Task\tDT_FixedDUR2\tTK_NotStart\tA1000\tAlpha Task 1\t\t0\t0\t40\t0\t0\t0\t40\t0\t0\t0\t\t\t\t2026-01-01 07:00\t2026-01-08 15:00\t\t2026-01-01 07:00\t2026-01-08 15:00\t2026-01-01 07:00\t2026-01-08 15:00\t2026-01-01 07:00\t2026-01-08 15:00\t2026-01-01 07:00\t2026-01-08 15:00\t\tPT_Normal\t\t\t\t\ttask-guid-1\t\t\t\tY\t0\t0\t\t\t2026-01-06 00:00\t2026-01-06 00:00\tADMIN\tADMIN\t\t
|
||||
%R\t2002\t1002\t200\t1\t0\tN\t1\tN\tN\tCP_Drtn\tTT_Task\tDT_FixedDUR2\tTK_NotStart\tB1000\tBeta Task 1\t\t0\t0\t40\t0\t0\t0\t40\t0\t0\t0\t\t\t\t2026-04-01 07:00\t2026-04-08 15:00\t\t2026-04-01 07:00\t2026-04-08 15:00\t2026-04-01 07:00\t2026-04-08 15:00\t2026-04-01 07:00\t2026-04-08 15:00\t2026-04-01 07:00\t2026-04-08 15:00\t\tPT_Normal\t\t\t\t\ttask-guid-2\t\t\t\tY\t0\t0\t\t\t2026-01-06 00:00\t2026-01-06 00:00\tADMIN\tADMIN\t\t
|
||||
%T\tTASKPRED
|
||||
%F\ttask_pred_id\ttask_id\tpred_task_id\tproj_id\tpred_proj_id\tpred_type\tlag_hr_cnt\tcomments\tfloat_path\taref\tarls
|
||||
%T\tEND
|
||||
"""
|
||||
|
||||
SAMPLE_XER_EMPTY = """\
|
||||
ERMHDR\t21.12\t2026-01-06\tProject\tADMIN\ttestuser\tdbTest\tProject Management\tUSD
|
||||
%T\tPROJECT
|
||||
%F\tproj_id\tfy_start_month_num\trsrc_self_add_flag\tallow_complete_flag\trsrc_multi_assign_flag\tcheckout_flag\tproject_flag\tstep_complete_flag\tcost_qty_recalc_flag\tbatch_sum_flag\tname_sep_char\tdef_complete_pct_type\tproj_short_name\tacct_id\torig_proj_id\tsource_proj_id\tbase_type_id\tclndr_id\tsum_base_proj_id\ttask_code_base\ttask_code_step\tpriority_num\twbs_max_sum_level\tstrgy_priority_num\tlast_checksum\tcritical_drtn_hr_cnt\tdef_cost_per_qty\tlast_recalc_date\tplan_start_date\tplan_end_date\tscd_end_date\tadd_date\tlast_tasksum_date\tfcst_start_date\tdef_duration_type\ttask_code_prefix\tguid\tdef_qty_type\tadd_by_name\tweb_local_root_path\tproj_url\tdef_rate_type\tadd_act_remain_flag\tact_this_per_link_flag\tdef_task_type\tact_pct_link_flag\tcritical_path_type\ttask_code_prefix_flag\tdef_rollup_dates_flag\tuse_project_baseline_flag\trem_target_link_flag\treset_planned_flag\tallow_neg_act_flag\tsum_assign_level\tlast_fin_dates_id\tfintmpl_id\tlast_baseline_update_date\tcr_external_key\tapply_actuals_date\tlocation_id\tloaded_scope_level\texport_flag\tnew_fin_dates_id\tbaselines_to_export\tbaseline_names_to_export\tnext_data_date\tclose_period_flag\tsum_refresh_date\ttrsrcsum_loaded\tsumtask_loaded
|
||||
%R\t1001\t1\tY\tY\tY\tN\tY\tN\tN\tY\t.\tCP_Drtn\tEmpty Project\t\t\t\t\t1\t\t1000\t10\t10\t2\t500\t\t0\t0.0000\t2026-01-06 00:00\t2026-01-01 00:00\t2026-06-30 00:00\t2026-06-30 00:00\t2026-01-06 00:00\t\t\tDT_FixedDUR2\tA\ttest-guid-1\tQT_Hour\tADMIN\t\t\tCOST_PER_QTY\tN\tY\tTT_Task\tY\tCT_TotFloat\tY\tY\tY\tY\tN\tN\tSL_Taskrsrc\t\t1\t\t\t\t\t7\tY\t\t\t\t\t\t\t
|
||||
%T\tCALENDAR
|
||||
%F\tclndr_id\tdefault_flag\tclndr_name\tproj_id\tbase_clndr_id\tlast_chng_date\tclndr_type\tday_hr_cnt\tweek_hr_cnt\tmonth_hr_cnt\tyear_hr_cnt\trsrc_private\tclndr_data
|
||||
%R\t1\tY\tStandard 5 Day\t\t\t2026-01-06 00:00\tCA_Base\t8\t40\t160\t2080\tN\t
|
||||
%T\tPROJWBS
|
||||
%F\twbs_id\tproj_id\tobs_id\tseq_num\test_wt\tproj_node_flag\tsum_data_flag\tstatus_code\twbs_short_name\twbs_name\tphase_id\tparent_wbs_id\tev_user_pct\tev_etc_user_value\torig_cost\tindep_remain_total_cost\tann_dscnt_rate_pct\tdscnt_period_type\tindep_remain_work_qty\tanticip_start_date\tanticip_end_date\tev_compute_type\tev_etc_compute_type\tguid\ttmpl_guid\tplan_open_state
|
||||
%R\t100\t1001\t\t1\t1\tY\tN\tWS_Open\tROOT\tEmpty Project\t\t\t6\t0.88\t0.0000\t0.0000\t\t\t\t\t\tEC_Cmp_pct\tEE_Rem_hr\twbs-guid-1\t\t
|
||||
%T\tTASK
|
||||
%F\ttask_id\tproj_id\twbs_id\tclndr_id\tphys_complete_pct\trev_fdbk_flag\test_wt\tlock_plan_flag\tauto_compute_act_flag\tcomplete_pct_type\ttask_type\tduration_type\tstatus_code\ttask_code\ttask_name\trsrc_id\ttotal_float_hr_cnt\tfree_float_hr_cnt\tremain_drtn_hr_cnt\tact_work_qty\tremain_work_qty\ttarget_work_qty\ttarget_drtn_hr_cnt\ttarget_equip_qty\tact_equip_qty\tremain_equip_qty\tcstr_date\tact_start_date\tact_end_date\tlate_start_date\tlate_end_date\texpect_end_date\tearly_start_date\tearly_end_date\trestart_date\treend_date\ttarget_start_date\ttarget_end_date\trem_late_start_date\trem_late_end_date\tcstr_type\tpriority_type\tsuspend_date\tresume_date\tfloat_path\tfloat_path_order\tguid\ttmpl_guid\tcstr_date2\tcstr_type2\tdriving_path_flag\tact_this_per_work_qty\tact_this_per_equip_qty\texternal_early_start_date\texternal_late_end_date\tcreate_date\tupdate_date\tcreate_user\tupdate_user\tlocation_id\tcrt_path_num
|
||||
%T\tTASKPRED
|
||||
%F\ttask_pred_id\ttask_id\tpred_task_id\tproj_id\tpred_proj_id\tpred_type\tlag_hr_cnt\tcomments\tfloat_path\taref\tarls
|
||||
%T\tEND
|
||||
"""
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sample_xer_single_project(tmp_path: Path) -> Path:
|
||||
"""Create a temporary XER file with a single project."""
|
||||
xer_file = tmp_path / "single_project.xer"
|
||||
xer_file.write_text(SAMPLE_XER_SINGLE_PROJECT)
|
||||
return xer_file
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sample_xer_multi_project(tmp_path: Path) -> Path:
|
||||
"""Create a temporary XER file with multiple projects."""
|
||||
xer_file = tmp_path / "multi_project.xer"
|
||||
xer_file.write_text(SAMPLE_XER_MULTI_PROJECT)
|
||||
return xer_file
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sample_xer_empty(tmp_path: Path) -> Path:
|
||||
"""Create a temporary XER file with no activities."""
|
||||
xer_file = tmp_path / "empty_project.xer"
|
||||
xer_file.write_text(SAMPLE_XER_EMPTY)
|
||||
return xer_file
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def nonexistent_xer_path(tmp_path: Path) -> Path:
|
||||
"""Return a path to a non-existent XER file."""
|
||||
return tmp_path / "does_not_exist.xer"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def invalid_xer_file(tmp_path: Path) -> Path:
|
||||
"""Create a temporary file with invalid XER content."""
|
||||
xer_file = tmp_path / "invalid.xer"
|
||||
xer_file.write_text("This is not a valid XER file\nJust some random text")
|
||||
return xer_file
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def real_xer_file() -> Path | None:
|
||||
"""Return the path to the real XER file if it exists.
|
||||
|
||||
This fixture provides access to the actual XER file in the repository
|
||||
for integration testing with real data.
|
||||
"""
|
||||
real_file = Path(
|
||||
"/home/bill/xer-mcp/S48019R - Proposal Schedule - E-J Electric Installation.xer"
|
||||
)
|
||||
if real_file.exists():
|
||||
return real_file
|
||||
return None
|
||||
1
tests/contract/__init__.py
Normal file
1
tests/contract/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Contract tests for MCP tool interfaces."""
|
||||
89
tests/contract/test_get_activity.py
Normal file
89
tests/contract/test_get_activity.py
Normal file
@@ -0,0 +1,89 @@
|
||||
"""Contract tests for get_activity MCP tool."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from xer_mcp.db import db
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup_db():
|
||||
"""Initialize and clear database for each test."""
|
||||
db.initialize()
|
||||
yield
|
||||
db.clear()
|
||||
|
||||
|
||||
class TestGetActivityContract:
|
||||
"""Contract tests verifying get_activity tool interface matches spec."""
|
||||
|
||||
async def test_get_activity_returns_details(self, sample_xer_single_project: Path) -> None:
|
||||
"""get_activity returns complete activity details."""
|
||||
from xer_mcp.tools.get_activity import get_activity
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await get_activity(activity_id="2002")
|
||||
|
||||
assert result["task_id"] == "2002"
|
||||
assert result["task_code"] == "A1010"
|
||||
assert result["task_name"] == "Site Preparation"
|
||||
assert result["task_type"] == "TT_Task"
|
||||
assert "target_start_date" in result
|
||||
assert "target_end_date" in result
|
||||
assert "wbs_id" in result
|
||||
assert "predecessor_count" in result
|
||||
assert "successor_count" in result
|
||||
|
||||
async def test_get_activity_includes_wbs_name(self, sample_xer_single_project: Path) -> None:
|
||||
"""get_activity includes WBS name from lookup."""
|
||||
from xer_mcp.tools.get_activity import get_activity
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await get_activity(activity_id="2002")
|
||||
|
||||
assert "wbs_name" in result
|
||||
|
||||
async def test_get_activity_includes_relationship_counts(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""get_activity includes predecessor and successor counts."""
|
||||
from xer_mcp.tools.get_activity import get_activity
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
# A1010 (2002) has 1 predecessor (A1000) and 2 successors (A1020, A1030)
|
||||
result = await get_activity(activity_id="2002")
|
||||
|
||||
assert result["predecessor_count"] == 1
|
||||
assert result["successor_count"] == 2
|
||||
|
||||
async def test_get_activity_not_found_returns_error(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""get_activity with invalid ID returns ACTIVITY_NOT_FOUND error."""
|
||||
from xer_mcp.tools.get_activity import get_activity
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await get_activity(activity_id="nonexistent")
|
||||
|
||||
assert "error" in result
|
||||
assert result["error"]["code"] == "ACTIVITY_NOT_FOUND"
|
||||
|
||||
async def test_get_activity_no_file_loaded_returns_error(self) -> None:
|
||||
"""get_activity without loaded file returns NO_FILE_LOADED error."""
|
||||
from xer_mcp.server import set_file_loaded
|
||||
from xer_mcp.tools.get_activity import get_activity
|
||||
|
||||
set_file_loaded(False)
|
||||
result = await get_activity(activity_id="2002")
|
||||
|
||||
assert "error" in result
|
||||
assert result["error"]["code"] == "NO_FILE_LOADED"
|
||||
91
tests/contract/test_get_critical_path.py
Normal file
91
tests/contract/test_get_critical_path.py
Normal file
@@ -0,0 +1,91 @@
|
||||
"""Contract tests for get_critical_path MCP tool."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from xer_mcp.db import db
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup_db():
|
||||
"""Initialize and clear database for each test."""
|
||||
db.initialize()
|
||||
yield
|
||||
db.clear()
|
||||
|
||||
|
||||
class TestGetCriticalPathContract:
|
||||
"""Contract tests verifying get_critical_path tool interface."""
|
||||
|
||||
async def test_get_critical_path_returns_critical_activities(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""get_critical_path returns activities with driving_path_flag set."""
|
||||
from xer_mcp.tools.get_critical_path import get_critical_path
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await get_critical_path()
|
||||
|
||||
assert "critical_activities" in result
|
||||
assert len(result["critical_activities"]) == 4
|
||||
|
||||
async def test_get_critical_path_includes_expected_fields(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""get_critical_path returns activities with required fields."""
|
||||
from xer_mcp.tools.get_critical_path import get_critical_path
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await get_critical_path()
|
||||
|
||||
activity = result["critical_activities"][0]
|
||||
assert "task_id" in activity
|
||||
assert "task_code" in activity
|
||||
assert "task_name" in activity
|
||||
assert "target_start_date" in activity
|
||||
assert "target_end_date" in activity
|
||||
assert "total_float_hr_cnt" in activity
|
||||
|
||||
async def test_get_critical_path_ordered_by_date(self, sample_xer_single_project: Path) -> None:
|
||||
"""get_critical_path returns activities ordered by start date."""
|
||||
from xer_mcp.tools.get_critical_path import get_critical_path
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await get_critical_path()
|
||||
|
||||
activities = result["critical_activities"]
|
||||
for i in range(len(activities) - 1):
|
||||
assert activities[i]["target_start_date"] <= activities[i + 1]["target_start_date"]
|
||||
|
||||
async def test_get_critical_path_excludes_non_critical(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""get_critical_path excludes activities not on critical path."""
|
||||
from xer_mcp.tools.get_critical_path import get_critical_path
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await get_critical_path()
|
||||
|
||||
# A1020 "Foundation Work" has driving_path_flag = N
|
||||
activity_names = [a["task_name"] for a in result["critical_activities"]]
|
||||
assert "Foundation Work" not in activity_names
|
||||
|
||||
async def test_get_critical_path_no_file_loaded_returns_error(self) -> None:
|
||||
"""get_critical_path without loaded file returns NO_FILE_LOADED error."""
|
||||
from xer_mcp.server import set_file_loaded
|
||||
from xer_mcp.tools.get_critical_path import get_critical_path
|
||||
|
||||
set_file_loaded(False)
|
||||
result = await get_critical_path()
|
||||
|
||||
assert "error" in result
|
||||
assert result["error"]["code"] == "NO_FILE_LOADED"
|
||||
96
tests/contract/test_get_predecessors.py
Normal file
96
tests/contract/test_get_predecessors.py
Normal file
@@ -0,0 +1,96 @@
|
||||
"""Contract tests for get_predecessors MCP tool."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from xer_mcp.db import db
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup_db():
|
||||
"""Initialize and clear database for each test."""
|
||||
db.initialize()
|
||||
yield
|
||||
db.clear()
|
||||
|
||||
|
||||
class TestGetPredecessorsContract:
|
||||
"""Contract tests verifying get_predecessors tool interface."""
|
||||
|
||||
async def test_get_predecessors_returns_list(self, sample_xer_single_project: Path) -> None:
|
||||
"""get_predecessors returns predecessor activities."""
|
||||
from xer_mcp.tools.get_predecessors import get_predecessors
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
# A1010 (2002) has one predecessor: A1000 (2001)
|
||||
result = await get_predecessors(activity_id="2002")
|
||||
|
||||
assert "activity_id" in result
|
||||
assert result["activity_id"] == "2002"
|
||||
assert "predecessors" in result
|
||||
assert len(result["predecessors"]) == 1
|
||||
assert result["predecessors"][0]["task_id"] == "2001"
|
||||
|
||||
async def test_get_predecessors_includes_relationship_details(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""get_predecessors includes relationship type and lag."""
|
||||
from xer_mcp.tools.get_predecessors import get_predecessors
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await get_predecessors(activity_id="2002")
|
||||
|
||||
pred = result["predecessors"][0]
|
||||
assert "relationship_type" in pred
|
||||
assert "lag_hr_cnt" in pred
|
||||
assert pred["relationship_type"] in ["FS", "SS", "FF", "SF"]
|
||||
|
||||
async def test_get_predecessors_empty_list_for_no_predecessors(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""get_predecessors returns empty list when no predecessors exist."""
|
||||
from xer_mcp.tools.get_predecessors import get_predecessors
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
# A1000 (2001) has no predecessors
|
||||
result = await get_predecessors(activity_id="2001")
|
||||
|
||||
assert "predecessors" in result
|
||||
assert len(result["predecessors"]) == 0
|
||||
|
||||
async def test_get_predecessors_no_file_loaded_returns_error(self) -> None:
|
||||
"""get_predecessors without loaded file returns NO_FILE_LOADED error."""
|
||||
from xer_mcp.server import set_file_loaded
|
||||
from xer_mcp.tools.get_predecessors import get_predecessors
|
||||
|
||||
set_file_loaded(False)
|
||||
result = await get_predecessors(activity_id="2002")
|
||||
|
||||
assert "error" in result
|
||||
assert result["error"]["code"] == "NO_FILE_LOADED"
|
||||
|
||||
async def test_get_predecessors_includes_driving_flag(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""get_predecessors includes driving flag for each predecessor."""
|
||||
from xer_mcp.tools.get_predecessors import get_predecessors
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
# A1010 (2002) has one predecessor: A1000 (2001)
|
||||
result = await get_predecessors(activity_id="2002")
|
||||
|
||||
assert "predecessors" in result
|
||||
assert len(result["predecessors"]) >= 1
|
||||
# All predecessors should have a driving flag
|
||||
for pred in result["predecessors"]:
|
||||
assert "driving" in pred
|
||||
assert isinstance(pred["driving"], bool)
|
||||
89
tests/contract/test_get_project_summary.py
Normal file
89
tests/contract/test_get_project_summary.py
Normal file
@@ -0,0 +1,89 @@
|
||||
"""Contract tests for get_project_summary MCP tool."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from xer_mcp.db import db
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup_db():
|
||||
"""Initialize and clear database for each test."""
|
||||
db.initialize()
|
||||
yield
|
||||
db.clear()
|
||||
|
||||
|
||||
class TestGetProjectSummaryContract:
|
||||
"""Contract tests verifying get_project_summary tool interface."""
|
||||
|
||||
async def test_get_project_summary_returns_basic_info(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""get_project_summary returns project name, dates, and activity count."""
|
||||
from xer_mcp.tools.get_project_summary import get_project_summary
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await get_project_summary()
|
||||
|
||||
assert "project_name" in result
|
||||
assert "data_date" in result
|
||||
assert "plan_start_date" in result
|
||||
assert "plan_end_date" in result
|
||||
assert "activity_count" in result
|
||||
|
||||
async def test_get_project_summary_returns_correct_values(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""get_project_summary returns correct project values from loaded XER."""
|
||||
from xer_mcp.tools.get_project_summary import get_project_summary
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await get_project_summary()
|
||||
|
||||
assert result["project_name"] == "Test Project"
|
||||
assert result["activity_count"] == 5
|
||||
|
||||
async def test_get_project_summary_includes_milestone_count(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""get_project_summary includes count of milestones."""
|
||||
from xer_mcp.tools.get_project_summary import get_project_summary
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await get_project_summary()
|
||||
|
||||
assert "milestone_count" in result
|
||||
assert result["milestone_count"] == 2
|
||||
|
||||
async def test_get_project_summary_includes_critical_count(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""get_project_summary includes count of critical path activities."""
|
||||
from xer_mcp.tools.get_project_summary import get_project_summary
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await get_project_summary()
|
||||
|
||||
assert "critical_activity_count" in result
|
||||
assert result["critical_activity_count"] == 4
|
||||
|
||||
async def test_get_project_summary_no_file_loaded_returns_error(self) -> None:
|
||||
"""get_project_summary without loaded file returns NO_FILE_LOADED error."""
|
||||
from xer_mcp.server import set_file_loaded
|
||||
from xer_mcp.tools.get_project_summary import get_project_summary
|
||||
|
||||
set_file_loaded(False)
|
||||
result = await get_project_summary()
|
||||
|
||||
assert "error" in result
|
||||
assert result["error"]["code"] == "NO_FILE_LOADED"
|
||||
95
tests/contract/test_get_successors.py
Normal file
95
tests/contract/test_get_successors.py
Normal file
@@ -0,0 +1,95 @@
|
||||
"""Contract tests for get_successors MCP tool."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from xer_mcp.db import db
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup_db():
|
||||
"""Initialize and clear database for each test."""
|
||||
db.initialize()
|
||||
yield
|
||||
db.clear()
|
||||
|
||||
|
||||
class TestGetSuccessorsContract:
|
||||
"""Contract tests verifying get_successors tool interface."""
|
||||
|
||||
async def test_get_successors_returns_list(self, sample_xer_single_project: Path) -> None:
|
||||
"""get_successors returns successor activities."""
|
||||
from xer_mcp.tools.get_successors import get_successors
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
# A1010 (2002) has two successors: A1020 (2003) and A1030 (2004)
|
||||
result = await get_successors(activity_id="2002")
|
||||
|
||||
assert "activity_id" in result
|
||||
assert result["activity_id"] == "2002"
|
||||
assert "successors" in result
|
||||
assert len(result["successors"]) == 2
|
||||
|
||||
async def test_get_successors_includes_relationship_details(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""get_successors includes relationship type and lag."""
|
||||
from xer_mcp.tools.get_successors import get_successors
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await get_successors(activity_id="2001")
|
||||
|
||||
succ = result["successors"][0]
|
||||
assert "relationship_type" in succ
|
||||
assert "lag_hr_cnt" in succ
|
||||
assert succ["relationship_type"] in ["FS", "SS", "FF", "SF"]
|
||||
|
||||
async def test_get_successors_empty_list_for_no_successors(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""get_successors returns empty list when no successors exist."""
|
||||
from xer_mcp.tools.get_successors import get_successors
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
# A1040 (2005) has no successors
|
||||
result = await get_successors(activity_id="2005")
|
||||
|
||||
assert "successors" in result
|
||||
assert len(result["successors"]) == 0
|
||||
|
||||
async def test_get_successors_no_file_loaded_returns_error(self) -> None:
|
||||
"""get_successors without loaded file returns NO_FILE_LOADED error."""
|
||||
from xer_mcp.server import set_file_loaded
|
||||
from xer_mcp.tools.get_successors import get_successors
|
||||
|
||||
set_file_loaded(False)
|
||||
result = await get_successors(activity_id="2002")
|
||||
|
||||
assert "error" in result
|
||||
assert result["error"]["code"] == "NO_FILE_LOADED"
|
||||
|
||||
async def test_get_successors_includes_driving_flag(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""get_successors includes driving flag for each successor."""
|
||||
from xer_mcp.tools.get_successors import get_successors
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
# A1000 (2001) has one successor: A1010 (2002)
|
||||
result = await get_successors(activity_id="2001")
|
||||
|
||||
assert "successors" in result
|
||||
assert len(result["successors"]) >= 1
|
||||
# All successors should have a driving flag
|
||||
for succ in result["successors"]:
|
||||
assert "driving" in succ
|
||||
assert isinstance(succ["driving"], bool)
|
||||
138
tests/contract/test_list_activities.py
Normal file
138
tests/contract/test_list_activities.py
Normal file
@@ -0,0 +1,138 @@
|
||||
"""Contract tests for list_activities MCP tool."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from xer_mcp.db import db
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup_db():
|
||||
"""Initialize and clear database for each test."""
|
||||
db.initialize()
|
||||
yield
|
||||
db.clear()
|
||||
|
||||
|
||||
class TestListActivitiesContract:
|
||||
"""Contract tests verifying list_activities tool interface matches spec."""
|
||||
|
||||
async def test_list_activities_returns_paginated_results(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""list_activities returns activities with pagination metadata."""
|
||||
from xer_mcp.tools.list_activities import list_activities
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await list_activities()
|
||||
|
||||
assert "activities" in result
|
||||
assert "pagination" in result
|
||||
assert len(result["activities"]) == 5
|
||||
assert result["pagination"]["total_count"] == 5
|
||||
assert result["pagination"]["offset"] == 0
|
||||
assert result["pagination"]["limit"] == 100
|
||||
assert result["pagination"]["has_more"] is False
|
||||
|
||||
async def test_list_activities_with_limit(self, sample_xer_single_project: Path) -> None:
|
||||
"""list_activities respects limit parameter."""
|
||||
from xer_mcp.tools.list_activities import list_activities
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await list_activities(limit=2)
|
||||
|
||||
assert len(result["activities"]) == 2
|
||||
assert result["pagination"]["limit"] == 2
|
||||
assert result["pagination"]["has_more"] is True
|
||||
|
||||
async def test_list_activities_with_offset(self, sample_xer_single_project: Path) -> None:
|
||||
"""list_activities respects offset parameter."""
|
||||
from xer_mcp.tools.list_activities import list_activities
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await list_activities(offset=2, limit=2)
|
||||
|
||||
assert len(result["activities"]) == 2
|
||||
assert result["pagination"]["offset"] == 2
|
||||
|
||||
async def test_list_activities_filter_by_date_range(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""list_activities filters by date range."""
|
||||
from xer_mcp.tools.list_activities import list_activities
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
# Filter to January only
|
||||
result = await list_activities(start_date="2026-01-01", end_date="2026-01-31")
|
||||
|
||||
# Should include activities in January
|
||||
for activity in result["activities"]:
|
||||
assert "2026-01" in activity["target_start_date"]
|
||||
|
||||
async def test_list_activities_filter_by_activity_type(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""list_activities filters by activity type."""
|
||||
from xer_mcp.tools.list_activities import list_activities
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await list_activities(activity_type="TT_Mile")
|
||||
|
||||
assert len(result["activities"]) == 2
|
||||
for activity in result["activities"]:
|
||||
assert activity["task_type"] == "TT_Mile"
|
||||
|
||||
async def test_list_activities_filter_by_wbs(self, sample_xer_single_project: Path) -> None:
|
||||
"""list_activities filters by WBS ID."""
|
||||
from xer_mcp.tools.list_activities import list_activities
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await list_activities(wbs_id="101")
|
||||
|
||||
# WBS 101 has 3 activities in the fixture
|
||||
assert len(result["activities"]) == 3
|
||||
|
||||
async def test_list_activities_no_file_loaded_returns_error(self) -> None:
|
||||
"""list_activities without loaded file returns NO_FILE_LOADED error."""
|
||||
from xer_mcp.server import set_file_loaded
|
||||
from xer_mcp.tools.list_activities import list_activities
|
||||
|
||||
set_file_loaded(False)
|
||||
result = await list_activities()
|
||||
|
||||
assert "error" in result
|
||||
assert result["error"]["code"] == "NO_FILE_LOADED"
|
||||
|
||||
async def test_list_activities_returns_expected_fields(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""list_activities returns activities with all expected fields."""
|
||||
from xer_mcp.tools.list_activities import list_activities
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await list_activities()
|
||||
|
||||
activity = result["activities"][0]
|
||||
assert "task_id" in activity
|
||||
assert "task_code" in activity
|
||||
assert "task_name" in activity
|
||||
assert "task_type" in activity
|
||||
assert "target_start_date" in activity
|
||||
assert "target_end_date" in activity
|
||||
assert "status_code" in activity
|
||||
assert "driving_path_flag" in activity
|
||||
124
tests/contract/test_list_milestones.py
Normal file
124
tests/contract/test_list_milestones.py
Normal file
@@ -0,0 +1,124 @@
|
||||
"""Contract tests for list_milestones MCP tool."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from xer_mcp.db import db
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup_db():
|
||||
"""Initialize and clear database for each test."""
|
||||
db.initialize()
|
||||
yield
|
||||
db.clear()
|
||||
|
||||
|
||||
class TestListMilestonesContract:
|
||||
"""Contract tests verifying list_milestones tool interface."""
|
||||
|
||||
async def test_list_milestones_returns_milestone_activities(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""list_milestones returns only milestone type activities."""
|
||||
from xer_mcp.tools.list_milestones import list_milestones
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await list_milestones()
|
||||
|
||||
assert "milestones" in result
|
||||
assert len(result["milestones"]) == 2
|
||||
|
||||
async def test_list_milestones_includes_expected_fields(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""list_milestones returns milestones with required fields."""
|
||||
from xer_mcp.tools.list_milestones import list_milestones
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await list_milestones()
|
||||
|
||||
milestone = result["milestones"][0]
|
||||
assert "task_id" in milestone
|
||||
assert "task_code" in milestone
|
||||
assert "task_name" in milestone
|
||||
assert "target_start_date" in milestone
|
||||
assert "target_end_date" in milestone
|
||||
|
||||
async def test_list_milestones_returns_correct_activities(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""list_milestones returns the expected milestone activities."""
|
||||
from xer_mcp.tools.list_milestones import list_milestones
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await list_milestones()
|
||||
|
||||
milestone_names = [m["task_name"] for m in result["milestones"]]
|
||||
assert "Project Start" in milestone_names
|
||||
assert "Project Complete" in milestone_names
|
||||
|
||||
async def test_list_milestones_empty_when_no_milestones(self, sample_xer_empty: Path) -> None:
|
||||
"""list_milestones returns empty list when no milestones exist."""
|
||||
from xer_mcp.tools.list_milestones import list_milestones
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_empty))
|
||||
|
||||
result = await list_milestones()
|
||||
|
||||
assert "milestones" in result
|
||||
assert len(result["milestones"]) == 0
|
||||
|
||||
async def test_list_milestones_no_file_loaded_returns_error(self) -> None:
|
||||
"""list_milestones without loaded file returns NO_FILE_LOADED error."""
|
||||
from xer_mcp.server import set_file_loaded
|
||||
from xer_mcp.tools.list_milestones import list_milestones
|
||||
|
||||
set_file_loaded(False)
|
||||
result = await list_milestones()
|
||||
|
||||
assert "error" in result
|
||||
assert result["error"]["code"] == "NO_FILE_LOADED"
|
||||
|
||||
async def test_list_milestones_includes_milestone_type_field(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""list_milestones returns milestones with milestone_type field."""
|
||||
from xer_mcp.tools.list_milestones import list_milestones
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await list_milestones()
|
||||
|
||||
# All milestones should have milestone_type field
|
||||
for milestone in result["milestones"]:
|
||||
assert "milestone_type" in milestone
|
||||
|
||||
async def test_list_milestones_returns_start_and_finish_types(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""list_milestones returns milestones with correct start/finish types."""
|
||||
from xer_mcp.tools.list_milestones import list_milestones
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await list_milestones()
|
||||
|
||||
# Find milestones by name and verify their types
|
||||
milestones_by_name = {m["task_name"]: m for m in result["milestones"]}
|
||||
|
||||
# "Project Start" should be a start milestone
|
||||
assert milestones_by_name["Project Start"]["milestone_type"] == "start"
|
||||
|
||||
# "Project Complete" should be a finish milestone
|
||||
assert milestones_by_name["Project Complete"]["milestone_type"] == "finish"
|
||||
96
tests/contract/test_list_relationships.py
Normal file
96
tests/contract/test_list_relationships.py
Normal file
@@ -0,0 +1,96 @@
|
||||
"""Contract tests for list_relationships MCP tool."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from xer_mcp.db import db
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup_db():
|
||||
"""Initialize and clear database for each test."""
|
||||
db.initialize()
|
||||
yield
|
||||
db.clear()
|
||||
|
||||
|
||||
class TestListRelationshipsContract:
|
||||
"""Contract tests verifying list_relationships tool interface."""
|
||||
|
||||
async def test_list_relationships_returns_paginated_results(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""list_relationships returns relationships with pagination metadata."""
|
||||
from xer_mcp.tools.list_relationships import list_relationships
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await list_relationships()
|
||||
|
||||
assert "relationships" in result
|
||||
assert "pagination" in result
|
||||
assert len(result["relationships"]) == 5
|
||||
assert result["pagination"]["total_count"] == 5
|
||||
|
||||
async def test_list_relationships_with_pagination(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""list_relationships respects limit and offset parameters."""
|
||||
from xer_mcp.tools.list_relationships import list_relationships
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await list_relationships(limit=2, offset=0)
|
||||
|
||||
assert len(result["relationships"]) == 2
|
||||
assert result["pagination"]["has_more"] is True
|
||||
|
||||
async def test_list_relationships_includes_expected_fields(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""list_relationships returns relationships with all expected fields."""
|
||||
from xer_mcp.tools.list_relationships import list_relationships
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await list_relationships()
|
||||
|
||||
rel = result["relationships"][0]
|
||||
assert "task_pred_id" in rel
|
||||
assert "task_id" in rel
|
||||
assert "pred_task_id" in rel
|
||||
assert "pred_type" in rel
|
||||
assert "lag_hr_cnt" in rel
|
||||
|
||||
async def test_list_relationships_no_file_loaded_returns_error(self) -> None:
|
||||
"""list_relationships without loaded file returns NO_FILE_LOADED error."""
|
||||
from xer_mcp.server import set_file_loaded
|
||||
from xer_mcp.tools.list_relationships import list_relationships
|
||||
|
||||
set_file_loaded(False)
|
||||
result = await list_relationships()
|
||||
|
||||
assert "error" in result
|
||||
assert result["error"]["code"] == "NO_FILE_LOADED"
|
||||
|
||||
async def test_list_relationships_includes_driving_flag(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""list_relationships returns relationships with driving flag."""
|
||||
from xer_mcp.tools.list_relationships import list_relationships
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
result = await list_relationships()
|
||||
|
||||
assert "relationships" in result
|
||||
assert len(result["relationships"]) > 0
|
||||
# All relationships should have a driving flag
|
||||
for rel in result["relationships"]:
|
||||
assert "driving" in rel
|
||||
assert isinstance(rel["driving"], bool)
|
||||
107
tests/contract/test_load_xer.py
Normal file
107
tests/contract/test_load_xer.py
Normal file
@@ -0,0 +1,107 @@
|
||||
"""Contract tests for load_xer MCP tool."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from xer_mcp.db import db
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup_db():
|
||||
"""Initialize and clear database for each test."""
|
||||
db.initialize()
|
||||
yield
|
||||
db.clear()
|
||||
|
||||
|
||||
class TestLoadXerContract:
|
||||
"""Contract tests verifying load_xer tool interface matches spec."""
|
||||
|
||||
async def test_load_single_project_returns_success(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""load_xer with single-project file returns success and project info."""
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
result = await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
assert result["success"] is True
|
||||
assert "project" in result
|
||||
assert result["project"]["proj_id"] == "1001"
|
||||
assert result["project"]["proj_short_name"] == "Test Project"
|
||||
assert "activity_count" in result
|
||||
assert result["activity_count"] == 5
|
||||
assert "relationship_count" in result
|
||||
assert result["relationship_count"] == 5
|
||||
|
||||
async def test_load_multi_project_without_selection_returns_list(
|
||||
self, sample_xer_multi_project: Path
|
||||
) -> None:
|
||||
"""load_xer with multi-project file without project_id returns available projects."""
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
result = await load_xer(file_path=str(sample_xer_multi_project))
|
||||
|
||||
assert result["success"] is False
|
||||
assert "available_projects" in result
|
||||
assert len(result["available_projects"]) == 2
|
||||
assert "message" in result
|
||||
assert "project_id" in result["message"].lower()
|
||||
|
||||
async def test_load_multi_project_with_selection_returns_success(
|
||||
self, sample_xer_multi_project: Path
|
||||
) -> None:
|
||||
"""load_xer with multi-project file and project_id returns selected project."""
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
result = await load_xer(file_path=str(sample_xer_multi_project), project_id="1001")
|
||||
|
||||
assert result["success"] is True
|
||||
assert result["project"]["proj_id"] == "1001"
|
||||
assert result["project"]["proj_short_name"] == "Project Alpha"
|
||||
|
||||
async def test_load_nonexistent_file_returns_error(self, nonexistent_xer_path: Path) -> None:
|
||||
"""load_xer with missing file returns FILE_NOT_FOUND error."""
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
result = await load_xer(file_path=str(nonexistent_xer_path))
|
||||
|
||||
assert result["success"] is False
|
||||
assert "error" in result
|
||||
assert result["error"]["code"] == "FILE_NOT_FOUND"
|
||||
|
||||
async def test_load_invalid_file_returns_error(self, invalid_xer_file: Path) -> None:
|
||||
"""load_xer with invalid file returns PARSE_ERROR error."""
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
result = await load_xer(file_path=str(invalid_xer_file))
|
||||
|
||||
assert result["success"] is False
|
||||
assert "error" in result
|
||||
assert result["error"]["code"] == "PARSE_ERROR"
|
||||
|
||||
async def test_load_replaces_previous_file(
|
||||
self, sample_xer_single_project: Path, sample_xer_empty: Path
|
||||
) -> None:
|
||||
"""Loading a new file replaces the previous file's data."""
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
# Load first file
|
||||
result1 = await load_xer(file_path=str(sample_xer_single_project))
|
||||
assert result1["activity_count"] == 5
|
||||
|
||||
# Load second file (empty)
|
||||
result2 = await load_xer(file_path=str(sample_xer_empty))
|
||||
assert result2["activity_count"] == 0
|
||||
|
||||
async def test_load_returns_plan_dates(self, sample_xer_single_project: Path) -> None:
|
||||
"""load_xer returns project plan start and end dates."""
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
result = await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
assert "plan_start_date" in result["project"]
|
||||
assert "plan_end_date" in result["project"]
|
||||
# Dates should be ISO8601 format
|
||||
assert "T" in result["project"]["plan_start_date"]
|
||||
1
tests/integration/__init__.py
Normal file
1
tests/integration/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Integration tests for XER MCP Server."""
|
||||
154
tests/integration/test_xer_parsing.py
Normal file
154
tests/integration/test_xer_parsing.py
Normal file
@@ -0,0 +1,154 @@
|
||||
"""Integration tests for XER parsing and database loading."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from xer_mcp.db import db
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup_db():
|
||||
"""Initialize and clear database for each test."""
|
||||
db.initialize()
|
||||
yield
|
||||
db.clear()
|
||||
|
||||
|
||||
class TestXerParsing:
|
||||
"""Integration tests for parsing XER files and loading into database."""
|
||||
|
||||
def test_load_single_project_xer(self, sample_xer_single_project: Path) -> None:
|
||||
"""Should parse XER and load data into SQLite database."""
|
||||
from xer_mcp.db.loader import load_parsed_data
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
parsed = parser.parse(sample_xer_single_project)
|
||||
|
||||
# Load all data for the single project
|
||||
load_parsed_data(parsed, project_id="1001")
|
||||
|
||||
# Verify data in database
|
||||
with db.cursor() as cur:
|
||||
cur.execute("SELECT COUNT(*) FROM projects")
|
||||
assert cur.fetchone()[0] == 1
|
||||
|
||||
cur.execute("SELECT COUNT(*) FROM activities")
|
||||
assert cur.fetchone()[0] == 5
|
||||
|
||||
cur.execute("SELECT COUNT(*) FROM relationships")
|
||||
assert cur.fetchone()[0] == 5
|
||||
|
||||
cur.execute("SELECT COUNT(*) FROM wbs")
|
||||
assert cur.fetchone()[0] == 3
|
||||
|
||||
def test_load_preserves_date_precision(self, sample_xer_single_project: Path) -> None:
|
||||
"""Should preserve date/time precision from XER file."""
|
||||
from xer_mcp.db.loader import load_parsed_data
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
parsed = parser.parse(sample_xer_single_project)
|
||||
load_parsed_data(parsed, project_id="1001")
|
||||
|
||||
with db.cursor() as cur:
|
||||
cur.execute("SELECT target_start_date FROM activities WHERE task_code = ?", ("A1010",))
|
||||
date_str = cur.fetchone()[0]
|
||||
# Should be ISO8601 with time component
|
||||
assert "T" in date_str
|
||||
assert "07:00" in date_str
|
||||
|
||||
def test_load_activities_indexed_by_type(self, sample_xer_single_project: Path) -> None:
|
||||
"""Should be able to efficiently query activities by type."""
|
||||
from xer_mcp.db.loader import load_parsed_data
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
parsed = parser.parse(sample_xer_single_project)
|
||||
load_parsed_data(parsed, project_id="1001")
|
||||
|
||||
with db.cursor() as cur:
|
||||
# Query milestones
|
||||
cur.execute("SELECT COUNT(*) FROM activities WHERE task_type = ?", ("TT_Mile",))
|
||||
milestone_count = cur.fetchone()[0]
|
||||
assert milestone_count == 2
|
||||
|
||||
# Query tasks
|
||||
cur.execute("SELECT COUNT(*) FROM activities WHERE task_type = ?", ("TT_Task",))
|
||||
task_count = cur.fetchone()[0]
|
||||
assert task_count == 3
|
||||
|
||||
def test_load_critical_path_activities(self, sample_xer_single_project: Path) -> None:
|
||||
"""Should be able to query critical path activities via index."""
|
||||
from xer_mcp.db.loader import load_parsed_data
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
parsed = parser.parse(sample_xer_single_project)
|
||||
load_parsed_data(parsed, project_id="1001")
|
||||
|
||||
with db.cursor() as cur:
|
||||
cur.execute("SELECT COUNT(*) FROM activities WHERE driving_path_flag = 1")
|
||||
critical_count = cur.fetchone()[0]
|
||||
# Activities A1000, A1010, A1030, A1040 are on critical path
|
||||
assert critical_count == 4
|
||||
|
||||
def test_load_replaces_previous_data(self, sample_xer_single_project: Path) -> None:
|
||||
"""Loading a new file should replace previous data."""
|
||||
from xer_mcp.db.loader import load_parsed_data
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
parsed = parser.parse(sample_xer_single_project)
|
||||
|
||||
# Load first time
|
||||
load_parsed_data(parsed, project_id="1001")
|
||||
|
||||
with db.cursor() as cur:
|
||||
cur.execute("SELECT COUNT(*) FROM activities")
|
||||
first_count = cur.fetchone()[0]
|
||||
|
||||
# Clear and load again
|
||||
db.clear()
|
||||
load_parsed_data(parsed, project_id="1001")
|
||||
|
||||
with db.cursor() as cur:
|
||||
cur.execute("SELECT COUNT(*) FROM activities")
|
||||
second_count = cur.fetchone()[0]
|
||||
|
||||
assert first_count == second_count
|
||||
|
||||
|
||||
class TestMultiProjectHandling:
|
||||
"""Integration tests for multi-project XER file handling."""
|
||||
|
||||
def test_load_selected_project_from_multi(self, sample_xer_multi_project: Path) -> None:
|
||||
"""Should load only the selected project from multi-project file."""
|
||||
from xer_mcp.db.loader import load_parsed_data
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
parsed = parser.parse(sample_xer_multi_project)
|
||||
|
||||
# Load only Project Alpha
|
||||
load_parsed_data(parsed, project_id="1001")
|
||||
|
||||
with db.cursor() as cur:
|
||||
cur.execute("SELECT proj_short_name FROM projects")
|
||||
names = [row[0] for row in cur.fetchall()]
|
||||
assert names == ["Project Alpha"]
|
||||
|
||||
cur.execute("SELECT COUNT(*) FROM activities WHERE proj_id = ?", ("1001",))
|
||||
assert cur.fetchone()[0] == 1
|
||||
|
||||
def test_multi_project_list_available(self, sample_xer_multi_project: Path) -> None:
|
||||
"""Parser should report all available projects."""
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
parsed = parser.parse(sample_xer_multi_project)
|
||||
|
||||
assert len(parsed.projects) == 2
|
||||
proj_ids = {p["proj_id"] for p in parsed.projects}
|
||||
assert proj_ids == {"1001", "1002"}
|
||||
1
tests/unit/__init__.py
Normal file
1
tests/unit/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Unit tests for XER MCP Server."""
|
||||
176
tests/unit/test_db_queries.py
Normal file
176
tests/unit/test_db_queries.py
Normal file
@@ -0,0 +1,176 @@
|
||||
"""Unit tests for database query functions."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from xer_mcp.db import db
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup_db():
|
||||
"""Initialize and clear database for each test."""
|
||||
db.initialize()
|
||||
yield
|
||||
db.clear()
|
||||
|
||||
|
||||
class TestActivityQueries:
|
||||
"""Tests for activity query functions."""
|
||||
|
||||
def test_query_activities_with_pagination(self, sample_xer_single_project: Path) -> None:
|
||||
"""Should return paginated activity results."""
|
||||
from xer_mcp.db.loader import load_parsed_data
|
||||
from xer_mcp.db.queries import query_activities
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
parsed = parser.parse(sample_xer_single_project)
|
||||
load_parsed_data(parsed, project_id="1001")
|
||||
|
||||
activities, total = query_activities(limit=2, offset=0)
|
||||
|
||||
assert len(activities) == 2
|
||||
assert total == 5
|
||||
|
||||
def test_query_activities_filter_by_type(self, sample_xer_single_project: Path) -> None:
|
||||
"""Should filter activities by task type."""
|
||||
from xer_mcp.db.loader import load_parsed_data
|
||||
from xer_mcp.db.queries import query_activities
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
parsed = parser.parse(sample_xer_single_project)
|
||||
load_parsed_data(parsed, project_id="1001")
|
||||
|
||||
activities, total = query_activities(activity_type="TT_Mile")
|
||||
|
||||
assert total == 2
|
||||
for act in activities:
|
||||
assert act["task_type"] == "TT_Mile"
|
||||
|
||||
def test_query_activities_filter_by_date_range(self, sample_xer_single_project: Path) -> None:
|
||||
"""Should filter activities by date range."""
|
||||
from xer_mcp.db.loader import load_parsed_data
|
||||
from xer_mcp.db.queries import query_activities
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
parsed = parser.parse(sample_xer_single_project)
|
||||
load_parsed_data(parsed, project_id="1001")
|
||||
|
||||
# Filter to very narrow range
|
||||
activities, total = query_activities(start_date="2026-01-01", end_date="2026-01-01")
|
||||
|
||||
# Only activities starting on 2026-01-01
|
||||
for act in activities:
|
||||
assert "2026-01-01" in act["target_start_date"]
|
||||
|
||||
def test_query_activities_filter_by_wbs(self, sample_xer_single_project: Path) -> None:
|
||||
"""Should filter activities by WBS ID."""
|
||||
from xer_mcp.db.loader import load_parsed_data
|
||||
from xer_mcp.db.queries import query_activities
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
parsed = parser.parse(sample_xer_single_project)
|
||||
load_parsed_data(parsed, project_id="1001")
|
||||
|
||||
activities, total = query_activities(wbs_id="102")
|
||||
|
||||
# WBS 102 has 2 activities
|
||||
assert total == 2
|
||||
|
||||
def test_get_activity_by_id(self, sample_xer_single_project: Path) -> None:
|
||||
"""Should return single activity by ID."""
|
||||
from xer_mcp.db.loader import load_parsed_data
|
||||
from xer_mcp.db.queries import get_activity_by_id
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
parsed = parser.parse(sample_xer_single_project)
|
||||
load_parsed_data(parsed, project_id="1001")
|
||||
|
||||
activity = get_activity_by_id("2002")
|
||||
|
||||
assert activity is not None
|
||||
assert activity["task_code"] == "A1010"
|
||||
|
||||
def test_get_activity_by_id_not_found(self, sample_xer_single_project: Path) -> None:
|
||||
"""Should return None for non-existent activity."""
|
||||
from xer_mcp.db.loader import load_parsed_data
|
||||
from xer_mcp.db.queries import get_activity_by_id
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
parsed = parser.parse(sample_xer_single_project)
|
||||
load_parsed_data(parsed, project_id="1001")
|
||||
|
||||
activity = get_activity_by_id("nonexistent")
|
||||
|
||||
assert activity is None
|
||||
|
||||
|
||||
class TestDrivingRelationship:
|
||||
"""Tests for driving relationship computation."""
|
||||
|
||||
def test_is_driving_relationship_fs_driving(self) -> None:
|
||||
"""FS relationship is driving when pred_end + lag = succ_start."""
|
||||
from xer_mcp.db.queries import is_driving_relationship
|
||||
|
||||
# Pred ends at 2026-01-08T15:00, succ starts at 2026-01-09T07:00
|
||||
# With 0 lag and overnight gap, this is driving
|
||||
result = is_driving_relationship(
|
||||
pred_early_end="2026-01-08T15:00:00",
|
||||
succ_early_start="2026-01-09T07:00:00",
|
||||
lag_hours=0.0,
|
||||
pred_type="FS",
|
||||
)
|
||||
assert result is True
|
||||
|
||||
def test_is_driving_relationship_fs_not_driving(self) -> None:
|
||||
"""FS relationship is not driving when there's float."""
|
||||
from xer_mcp.db.queries import is_driving_relationship
|
||||
|
||||
# Pred ends much earlier than succ starts (has float)
|
||||
result = is_driving_relationship(
|
||||
pred_early_end="2026-01-01T15:00:00",
|
||||
succ_early_start="2026-01-10T07:00:00",
|
||||
lag_hours=0.0,
|
||||
pred_type="FS",
|
||||
)
|
||||
assert result is False
|
||||
|
||||
def test_is_driving_relationship_with_lag(self) -> None:
|
||||
"""FS relationship with lag is driving when pred_end + lag = succ_start."""
|
||||
from xer_mcp.db.queries import is_driving_relationship
|
||||
|
||||
# Pred ends at 2026-01-08T15:00, 16hr lag, succ starts at 2026-01-09T07:00
|
||||
# 15:00 + 16hrs = next day 07:00 (exactly matches)
|
||||
result = is_driving_relationship(
|
||||
pred_early_end="2026-01-08T15:00:00",
|
||||
succ_early_start="2026-01-09T07:00:00",
|
||||
lag_hours=16.0,
|
||||
pred_type="FS",
|
||||
)
|
||||
assert result is True
|
||||
|
||||
def test_is_driving_relationship_missing_dates(self) -> None:
|
||||
"""Relationship is not driving when dates are missing."""
|
||||
from xer_mcp.db.queries import is_driving_relationship
|
||||
|
||||
result = is_driving_relationship(
|
||||
pred_early_end=None,
|
||||
succ_early_start="2026-01-09T07:00:00",
|
||||
lag_hours=0.0,
|
||||
pred_type="FS",
|
||||
)
|
||||
assert result is False
|
||||
|
||||
result = is_driving_relationship(
|
||||
pred_early_end="2026-01-08T15:00:00",
|
||||
succ_early_start=None,
|
||||
lag_hours=0.0,
|
||||
pred_type="FS",
|
||||
)
|
||||
assert result is False
|
||||
146
tests/unit/test_parser.py
Normal file
146
tests/unit/test_parser.py
Normal file
@@ -0,0 +1,146 @@
|
||||
"""Unit tests for XER parser."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
class TestXerParser:
|
||||
"""Tests for the XER file parser."""
|
||||
|
||||
def test_parse_single_project_file(self, sample_xer_single_project: Path) -> None:
|
||||
"""Parser should extract project data from single-project XER file."""
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
result = parser.parse(sample_xer_single_project)
|
||||
|
||||
assert len(result.projects) == 1
|
||||
assert result.projects[0]["proj_id"] == "1001"
|
||||
assert result.projects[0]["proj_short_name"] == "Test Project"
|
||||
|
||||
def test_parse_multi_project_file(self, sample_xer_multi_project: Path) -> None:
|
||||
"""Parser should extract all projects from multi-project XER file."""
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
result = parser.parse(sample_xer_multi_project)
|
||||
|
||||
assert len(result.projects) == 2
|
||||
project_names = {p["proj_short_name"] for p in result.projects}
|
||||
assert project_names == {"Project Alpha", "Project Beta"}
|
||||
|
||||
def test_parse_activities(self, sample_xer_single_project: Path) -> None:
|
||||
"""Parser should extract activities from XER file."""
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
result = parser.parse(sample_xer_single_project)
|
||||
|
||||
# Single project fixture has 5 activities
|
||||
assert len(result.tasks) == 5
|
||||
|
||||
# Check first milestone
|
||||
milestone = next(t for t in result.tasks if t["task_code"] == "A1000")
|
||||
assert milestone["task_name"] == "Project Start"
|
||||
assert milestone["task_type"] == "TT_Mile"
|
||||
|
||||
def test_parse_relationships(self, sample_xer_single_project: Path) -> None:
|
||||
"""Parser should extract relationships from XER file."""
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
result = parser.parse(sample_xer_single_project)
|
||||
|
||||
# Single project fixture has 5 relationships
|
||||
assert len(result.taskpreds) == 5
|
||||
|
||||
# Check a FS relationship
|
||||
fs_rel = next(r for r in result.taskpreds if r["pred_type"] == "PR_FS")
|
||||
assert fs_rel["lag_hr_cnt"] == 0
|
||||
|
||||
# Check a SS relationship
|
||||
ss_rel = next(r for r in result.taskpreds if r["pred_type"] == "PR_SS")
|
||||
assert ss_rel["lag_hr_cnt"] == 40
|
||||
|
||||
def test_parse_wbs(self, sample_xer_single_project: Path) -> None:
|
||||
"""Parser should extract WBS hierarchy from XER file."""
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
result = parser.parse(sample_xer_single_project)
|
||||
|
||||
# Single project fixture has 3 WBS elements
|
||||
assert len(result.projwbs) == 3
|
||||
|
||||
# Check root WBS
|
||||
root = next(w for w in result.projwbs if w["wbs_short_name"] == "ROOT")
|
||||
assert root["parent_wbs_id"] is None or root["parent_wbs_id"] == ""
|
||||
|
||||
def test_parse_calendars(self, sample_xer_single_project: Path) -> None:
|
||||
"""Parser should extract calendars from XER file."""
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
result = parser.parse(sample_xer_single_project)
|
||||
|
||||
# Single project fixture has 1 calendar
|
||||
assert len(result.calendars) == 1
|
||||
cal = result.calendars[0]
|
||||
assert cal["clndr_name"] == "Standard 5 Day"
|
||||
assert cal["day_hr_cnt"] == 8
|
||||
|
||||
def test_parse_empty_project(self, sample_xer_empty: Path) -> None:
|
||||
"""Parser should handle XER file with no activities."""
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
result = parser.parse(sample_xer_empty)
|
||||
|
||||
assert len(result.projects) == 1
|
||||
assert len(result.tasks) == 0
|
||||
assert len(result.taskpreds) == 0
|
||||
|
||||
def test_parse_invalid_file_raises_error(self, invalid_xer_file: Path) -> None:
|
||||
"""Parser should raise ParseError for invalid XER content."""
|
||||
from xer_mcp.errors import ParseError
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
with pytest.raises(ParseError):
|
||||
parser.parse(invalid_xer_file)
|
||||
|
||||
def test_parse_nonexistent_file_raises_error(self, nonexistent_xer_path: Path) -> None:
|
||||
"""Parser should raise FileNotFoundError for missing file."""
|
||||
from xer_mcp.errors import FileNotFoundError
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
with pytest.raises(FileNotFoundError):
|
||||
parser.parse(nonexistent_xer_path)
|
||||
|
||||
def test_parse_dates_converted_to_iso8601(self, sample_xer_single_project: Path) -> None:
|
||||
"""Parser should convert XER dates to ISO8601 format."""
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
result = parser.parse(sample_xer_single_project)
|
||||
|
||||
# Check date conversion (XER: "2026-01-01 07:00" -> ISO: "2026-01-01T07:00:00")
|
||||
task = next(t for t in result.tasks if t["task_code"] == "A1000")
|
||||
assert "T" in task["target_start_date"]
|
||||
|
||||
def test_parse_driving_path_flag(self, sample_xer_single_project: Path) -> None:
|
||||
"""Parser should correctly parse driving_path_flag as boolean."""
|
||||
from xer_mcp.parser.xer_parser import XerParser
|
||||
|
||||
parser = XerParser()
|
||||
result = parser.parse(sample_xer_single_project)
|
||||
|
||||
# A1000 has driving_path_flag = Y
|
||||
critical_task = next(t for t in result.tasks if t["task_code"] == "A1000")
|
||||
assert critical_task["driving_path_flag"] is True
|
||||
|
||||
# A1020 has driving_path_flag = N
|
||||
non_critical = next(t for t in result.tasks if t["task_code"] == "A1020")
|
||||
assert non_critical["driving_path_flag"] is False
|
||||
403
tests/unit/test_table_handlers.py
Normal file
403
tests/unit/test_table_handlers.py
Normal file
@@ -0,0 +1,403 @@
|
||||
"""Unit tests for XER table handlers."""
|
||||
|
||||
|
||||
class TestProjectHandler:
|
||||
"""Tests for PROJECT table handler."""
|
||||
|
||||
def test_parse_project_row(self) -> None:
|
||||
"""Handler should parse PROJECT row correctly."""
|
||||
from xer_mcp.parser.table_handlers.project import ProjectHandler
|
||||
|
||||
handler = ProjectHandler()
|
||||
|
||||
# Minimal PROJECT fields
|
||||
fields = [
|
||||
"proj_id",
|
||||
"proj_short_name",
|
||||
"plan_start_date",
|
||||
"plan_end_date",
|
||||
]
|
||||
values = ["1001", "Test Project", "2026-01-01 00:00", "2026-06-30 00:00"]
|
||||
|
||||
result = handler.parse_row(fields, values)
|
||||
|
||||
assert result is not None
|
||||
assert result["proj_id"] == "1001"
|
||||
assert result["proj_short_name"] == "Test Project"
|
||||
assert result["plan_start_date"] == "2026-01-01T00:00:00"
|
||||
assert result["plan_end_date"] == "2026-06-30T00:00:00"
|
||||
|
||||
def test_table_name(self) -> None:
|
||||
"""Handler should report correct table name."""
|
||||
from xer_mcp.parser.table_handlers.project import ProjectHandler
|
||||
|
||||
handler = ProjectHandler()
|
||||
assert handler.table_name == "PROJECT"
|
||||
|
||||
|
||||
class TestTaskHandler:
|
||||
"""Tests for TASK table handler."""
|
||||
|
||||
def test_parse_task_row(self) -> None:
|
||||
"""Handler should parse TASK row correctly."""
|
||||
from xer_mcp.parser.table_handlers.task import TaskHandler
|
||||
|
||||
handler = TaskHandler()
|
||||
|
||||
fields = [
|
||||
"task_id",
|
||||
"proj_id",
|
||||
"wbs_id",
|
||||
"task_code",
|
||||
"task_name",
|
||||
"task_type",
|
||||
"status_code",
|
||||
"target_start_date",
|
||||
"target_end_date",
|
||||
"total_float_hr_cnt",
|
||||
"driving_path_flag",
|
||||
]
|
||||
values = [
|
||||
"2001",
|
||||
"1001",
|
||||
"100",
|
||||
"A1000",
|
||||
"Site Prep",
|
||||
"TT_Task",
|
||||
"TK_NotStart",
|
||||
"2026-01-02 07:00",
|
||||
"2026-01-08 15:00",
|
||||
"0",
|
||||
"Y",
|
||||
]
|
||||
|
||||
result = handler.parse_row(fields, values)
|
||||
|
||||
assert result is not None
|
||||
assert result["task_id"] == "2001"
|
||||
assert result["task_code"] == "A1000"
|
||||
assert result["task_type"] == "TT_Task"
|
||||
assert result["driving_path_flag"] is True
|
||||
assert result["total_float_hr_cnt"] == 0.0
|
||||
|
||||
def test_table_name(self) -> None:
|
||||
"""Handler should report correct table name."""
|
||||
from xer_mcp.parser.table_handlers.task import TaskHandler
|
||||
|
||||
handler = TaskHandler()
|
||||
assert handler.table_name == "TASK"
|
||||
|
||||
def test_parse_early_dates(self) -> None:
|
||||
"""Handler should parse early_start_date and early_end_date from TASK row."""
|
||||
from xer_mcp.parser.table_handlers.task import TaskHandler
|
||||
|
||||
handler = TaskHandler()
|
||||
|
||||
fields = [
|
||||
"task_id",
|
||||
"proj_id",
|
||||
"wbs_id",
|
||||
"task_code",
|
||||
"task_name",
|
||||
"task_type",
|
||||
"status_code",
|
||||
"target_start_date",
|
||||
"target_end_date",
|
||||
"early_start_date",
|
||||
"early_end_date",
|
||||
"total_float_hr_cnt",
|
||||
"driving_path_flag",
|
||||
]
|
||||
values = [
|
||||
"2001",
|
||||
"1001",
|
||||
"100",
|
||||
"A1000",
|
||||
"Site Prep",
|
||||
"TT_Task",
|
||||
"TK_NotStart",
|
||||
"2026-01-02 07:00",
|
||||
"2026-01-08 15:00",
|
||||
"2026-01-02 07:00",
|
||||
"2026-01-08 15:00",
|
||||
"0",
|
||||
"Y",
|
||||
]
|
||||
|
||||
result = handler.parse_row(fields, values)
|
||||
|
||||
assert result is not None
|
||||
assert result["early_start_date"] == "2026-01-02T07:00:00"
|
||||
assert result["early_end_date"] == "2026-01-08T15:00:00"
|
||||
|
||||
def test_parse_missing_early_dates(self) -> None:
|
||||
"""Handler should handle missing early dates gracefully."""
|
||||
from xer_mcp.parser.table_handlers.task import TaskHandler
|
||||
|
||||
handler = TaskHandler()
|
||||
|
||||
fields = [
|
||||
"task_id",
|
||||
"proj_id",
|
||||
"task_code",
|
||||
"task_name",
|
||||
"task_type",
|
||||
]
|
||||
values = [
|
||||
"2001",
|
||||
"1001",
|
||||
"A1000",
|
||||
"Site Prep",
|
||||
"TT_Task",
|
||||
]
|
||||
|
||||
result = handler.parse_row(fields, values)
|
||||
|
||||
assert result is not None
|
||||
assert result["early_start_date"] is None
|
||||
assert result["early_end_date"] is None
|
||||
|
||||
def test_parse_milestone_type_start(self) -> None:
|
||||
"""Handler should parse milestone_type='start' for start milestones."""
|
||||
from xer_mcp.parser.table_handlers.task import TaskHandler
|
||||
|
||||
handler = TaskHandler()
|
||||
|
||||
fields = [
|
||||
"task_id",
|
||||
"proj_id",
|
||||
"task_code",
|
||||
"task_name",
|
||||
"task_type",
|
||||
"milestone_type",
|
||||
]
|
||||
values = [
|
||||
"2001",
|
||||
"1001",
|
||||
"MS-START",
|
||||
"Project Start",
|
||||
"TT_Mile",
|
||||
"MS_Start",
|
||||
]
|
||||
|
||||
result = handler.parse_row(fields, values)
|
||||
|
||||
assert result is not None
|
||||
assert result["task_type"] == "TT_Mile"
|
||||
assert result["milestone_type"] == "start"
|
||||
|
||||
def test_parse_milestone_type_finish(self) -> None:
|
||||
"""Handler should parse milestone_type='finish' for finish milestones."""
|
||||
from xer_mcp.parser.table_handlers.task import TaskHandler
|
||||
|
||||
handler = TaskHandler()
|
||||
|
||||
fields = [
|
||||
"task_id",
|
||||
"proj_id",
|
||||
"task_code",
|
||||
"task_name",
|
||||
"task_type",
|
||||
"milestone_type",
|
||||
]
|
||||
values = [
|
||||
"2002",
|
||||
"1001",
|
||||
"MS-END",
|
||||
"Project Complete",
|
||||
"TT_Mile",
|
||||
"MS_Finish",
|
||||
]
|
||||
|
||||
result = handler.parse_row(fields, values)
|
||||
|
||||
assert result is not None
|
||||
assert result["task_type"] == "TT_Mile"
|
||||
assert result["milestone_type"] == "finish"
|
||||
|
||||
def test_parse_milestone_type_null_for_non_milestones(self) -> None:
|
||||
"""Handler should return None for milestone_type on non-milestone activities."""
|
||||
from xer_mcp.parser.table_handlers.task import TaskHandler
|
||||
|
||||
handler = TaskHandler()
|
||||
|
||||
fields = [
|
||||
"task_id",
|
||||
"proj_id",
|
||||
"task_code",
|
||||
"task_name",
|
||||
"task_type",
|
||||
]
|
||||
values = [
|
||||
"2003",
|
||||
"1001",
|
||||
"A1000",
|
||||
"Regular Task",
|
||||
"TT_Task",
|
||||
]
|
||||
|
||||
result = handler.parse_row(fields, values)
|
||||
|
||||
assert result is not None
|
||||
assert result["task_type"] == "TT_Task"
|
||||
assert result["milestone_type"] is None
|
||||
|
||||
def test_parse_milestone_type_derived_from_tt_mile(self) -> None:
|
||||
"""Handler should derive milestone_type='start' from task_type TT_Mile."""
|
||||
from xer_mcp.parser.table_handlers.task import TaskHandler
|
||||
|
||||
handler = TaskHandler()
|
||||
|
||||
# No explicit milestone_type field - derive from task_type
|
||||
fields = [
|
||||
"task_id",
|
||||
"proj_id",
|
||||
"task_code",
|
||||
"task_name",
|
||||
"task_type",
|
||||
]
|
||||
values = [
|
||||
"2001",
|
||||
"1001",
|
||||
"MS-START",
|
||||
"Project Start",
|
||||
"TT_Mile",
|
||||
]
|
||||
|
||||
result = handler.parse_row(fields, values)
|
||||
|
||||
assert result is not None
|
||||
assert result["task_type"] == "TT_Mile"
|
||||
assert result["milestone_type"] == "start"
|
||||
|
||||
def test_parse_milestone_type_derived_from_tt_finmile(self) -> None:
|
||||
"""Handler should derive milestone_type='finish' from task_type TT_FinMile."""
|
||||
from xer_mcp.parser.table_handlers.task import TaskHandler
|
||||
|
||||
handler = TaskHandler()
|
||||
|
||||
# TT_FinMile is a finish milestone
|
||||
fields = [
|
||||
"task_id",
|
||||
"proj_id",
|
||||
"task_code",
|
||||
"task_name",
|
||||
"task_type",
|
||||
]
|
||||
values = [
|
||||
"2002",
|
||||
"1001",
|
||||
"MS-END",
|
||||
"Project Complete",
|
||||
"TT_FinMile",
|
||||
]
|
||||
|
||||
result = handler.parse_row(fields, values)
|
||||
|
||||
assert result is not None
|
||||
assert result["task_type"] == "TT_FinMile"
|
||||
assert result["milestone_type"] == "finish"
|
||||
|
||||
|
||||
class TestTaskpredHandler:
|
||||
"""Tests for TASKPRED table handler."""
|
||||
|
||||
def test_parse_relationship_row(self) -> None:
|
||||
"""Handler should parse TASKPRED row correctly."""
|
||||
from xer_mcp.parser.table_handlers.taskpred import TaskpredHandler
|
||||
|
||||
handler = TaskpredHandler()
|
||||
|
||||
fields = [
|
||||
"task_pred_id",
|
||||
"task_id",
|
||||
"pred_task_id",
|
||||
"proj_id",
|
||||
"pred_proj_id",
|
||||
"pred_type",
|
||||
"lag_hr_cnt",
|
||||
]
|
||||
values = ["3001", "2002", "2001", "1001", "1001", "PR_FS", "8"]
|
||||
|
||||
result = handler.parse_row(fields, values)
|
||||
|
||||
assert result is not None
|
||||
assert result["task_pred_id"] == "3001"
|
||||
assert result["task_id"] == "2002"
|
||||
assert result["pred_task_id"] == "2001"
|
||||
assert result["pred_type"] == "PR_FS"
|
||||
assert result["lag_hr_cnt"] == 8.0
|
||||
|
||||
def test_table_name(self) -> None:
|
||||
"""Handler should report correct table name."""
|
||||
from xer_mcp.parser.table_handlers.taskpred import TaskpredHandler
|
||||
|
||||
handler = TaskpredHandler()
|
||||
assert handler.table_name == "TASKPRED"
|
||||
|
||||
|
||||
class TestProjwbsHandler:
|
||||
"""Tests for PROJWBS table handler."""
|
||||
|
||||
def test_parse_wbs_row(self) -> None:
|
||||
"""Handler should parse PROJWBS row correctly."""
|
||||
from xer_mcp.parser.table_handlers.projwbs import ProjwbsHandler
|
||||
|
||||
handler = ProjwbsHandler()
|
||||
|
||||
fields = [
|
||||
"wbs_id",
|
||||
"proj_id",
|
||||
"parent_wbs_id",
|
||||
"wbs_short_name",
|
||||
"wbs_name",
|
||||
]
|
||||
values = ["100", "1001", "", "ROOT", "Project Root"]
|
||||
|
||||
result = handler.parse_row(fields, values)
|
||||
|
||||
assert result is not None
|
||||
assert result["wbs_id"] == "100"
|
||||
assert result["proj_id"] == "1001"
|
||||
assert result["parent_wbs_id"] == ""
|
||||
assert result["wbs_short_name"] == "ROOT"
|
||||
|
||||
def test_table_name(self) -> None:
|
||||
"""Handler should report correct table name."""
|
||||
from xer_mcp.parser.table_handlers.projwbs import ProjwbsHandler
|
||||
|
||||
handler = ProjwbsHandler()
|
||||
assert handler.table_name == "PROJWBS"
|
||||
|
||||
|
||||
class TestCalendarHandler:
|
||||
"""Tests for CALENDAR table handler."""
|
||||
|
||||
def test_parse_calendar_row(self) -> None:
|
||||
"""Handler should parse CALENDAR row correctly."""
|
||||
from xer_mcp.parser.table_handlers.calendar import CalendarHandler
|
||||
|
||||
handler = CalendarHandler()
|
||||
|
||||
fields = [
|
||||
"clndr_id",
|
||||
"clndr_name",
|
||||
"day_hr_cnt",
|
||||
"week_hr_cnt",
|
||||
]
|
||||
values = ["1", "Standard 5 Day", "8", "40"]
|
||||
|
||||
result = handler.parse_row(fields, values)
|
||||
|
||||
assert result is not None
|
||||
assert result["clndr_id"] == "1"
|
||||
assert result["clndr_name"] == "Standard 5 Day"
|
||||
assert result["day_hr_cnt"] == 8.0
|
||||
assert result["week_hr_cnt"] == 40.0
|
||||
|
||||
def test_table_name(self) -> None:
|
||||
"""Handler should report correct table name."""
|
||||
from xer_mcp.parser.table_handlers.calendar import CalendarHandler
|
||||
|
||||
handler = CalendarHandler()
|
||||
assert handler.table_name == "CALENDAR"
|
||||
601
uv.lock
generated
Normal file
601
uv.lock
generated
Normal file
@@ -0,0 +1,601 @@
|
||||
version = 1
|
||||
revision = 3
|
||||
requires-python = ">=3.14"
|
||||
|
||||
[[package]]
|
||||
name = "annotated-types"
|
||||
version = "0.7.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ee/67/531ea369ba64dcff5ec9c3402f9f51bf748cec26dde048a2f973a4eea7f5/annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89", size = 16081, upload-time = "2024-05-20T21:33:25.928Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643, upload-time = "2024-05-20T21:33:24.1Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyio"
|
||||
version = "4.12.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "idna" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/96/f0/5eb65b2bb0d09ac6776f2eb54adee6abe8228ea05b20a5ad0e4945de8aac/anyio-4.12.1.tar.gz", hash = "sha256:41cfcc3a4c85d3f05c932da7c26d0201ac36f72abd4435ba90d0464a3ffed703", size = 228685, upload-time = "2026-01-06T11:45:21.246Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/38/0e/27be9fdef66e72d64c0cdc3cc2823101b80585f8119b5c112c2e8f5f7dab/anyio-4.12.1-py3-none-any.whl", hash = "sha256:d405828884fc140aa80a3c667b8beed277f1dfedec42ba031bd6ac3db606ab6c", size = 113592, upload-time = "2026-01-06T11:45:19.497Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "attrs"
|
||||
version = "25.4.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/6b/5c/685e6633917e101e5dcb62b9dd76946cbb57c26e133bae9e0cd36033c0a9/attrs-25.4.0.tar.gz", hash = "sha256:16d5969b87f0859ef33a48b35d55ac1be6e42ae49d5e853b597db70c35c57e11", size = 934251, upload-time = "2025-10-06T13:54:44.725Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/3a/2a/7cc015f5b9f5db42b7d48157e23356022889fc354a2813c15934b7cb5c0e/attrs-25.4.0-py3-none-any.whl", hash = "sha256:adcf7e2a1fb3b36ac48d97835bb6d8ade15b8dcce26aba8bf1d14847b57a3373", size = 67615, upload-time = "2025-10-06T13:54:43.17Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "certifi"
|
||||
version = "2026.1.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/e0/2d/a891ca51311197f6ad14a7ef42e2399f36cf2f9bd44752b3dc4eab60fdc5/certifi-2026.1.4.tar.gz", hash = "sha256:ac726dd470482006e014ad384921ed6438c457018f4b3d204aea4281258b2120", size = 154268, upload-time = "2026-01-04T02:42:41.825Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e6/ad/3cc14f097111b4de0040c83a525973216457bbeeb63739ef1ed275c1c021/certifi-2026.1.4-py3-none-any.whl", hash = "sha256:9943707519e4add1115f44c2bc244f782c0249876bf51b6599fee1ffbedd685c", size = 152900, upload-time = "2026-01-04T02:42:40.15Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cffi"
|
||||
version = "2.0.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "pycparser", marker = "implementation_name != 'PyPy'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/eb/56/b1ba7935a17738ae8453301356628e8147c79dbb825bcbc73dc7401f9846/cffi-2.0.0.tar.gz", hash = "sha256:44d1b5909021139fe36001ae048dbdde8214afa20200eda0f64c068cac5d5529", size = 523588, upload-time = "2025-09-08T23:24:04.541Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/92/c4/3ce07396253a83250ee98564f8d7e9789fab8e58858f35d07a9a2c78de9f/cffi-2.0.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:fc33c5141b55ed366cfaad382df24fe7dcbc686de5be719b207bb248e3053dc5", size = 185320, upload-time = "2025-09-08T23:23:18.087Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/59/dd/27e9fa567a23931c838c6b02d0764611c62290062a6d4e8ff7863daf9730/cffi-2.0.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:c654de545946e0db659b3400168c9ad31b5d29593291482c43e3564effbcee13", size = 181487, upload-time = "2025-09-08T23:23:19.622Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d6/43/0e822876f87ea8a4ef95442c3d766a06a51fc5298823f884ef87aaad168c/cffi-2.0.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:24b6f81f1983e6df8db3adc38562c83f7d4a0c36162885ec7f7b77c7dcbec97b", size = 220049, upload-time = "2025-09-08T23:23:20.853Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b4/89/76799151d9c2d2d1ead63c2429da9ea9d7aac304603de0c6e8764e6e8e70/cffi-2.0.0-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:12873ca6cb9b0f0d3a0da705d6086fe911591737a59f28b7936bdfed27c0d47c", size = 207793, upload-time = "2025-09-08T23:23:22.08Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/bb/dd/3465b14bb9e24ee24cb88c9e3730f6de63111fffe513492bf8c808a3547e/cffi-2.0.0-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:d9b97165e8aed9272a6bb17c01e3cc5871a594a446ebedc996e2397a1c1ea8ef", size = 206300, upload-time = "2025-09-08T23:23:23.314Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/47/d9/d83e293854571c877a92da46fdec39158f8d7e68da75bf73581225d28e90/cffi-2.0.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:afb8db5439b81cf9c9d0c80404b60c3cc9c3add93e114dcae767f1477cb53775", size = 219244, upload-time = "2025-09-08T23:23:24.541Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2b/0f/1f177e3683aead2bb00f7679a16451d302c436b5cbf2505f0ea8146ef59e/cffi-2.0.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:737fe7d37e1a1bffe70bd5754ea763a62a066dc5913ca57e957824b72a85e205", size = 222828, upload-time = "2025-09-08T23:23:26.143Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c6/0f/cafacebd4b040e3119dcb32fed8bdef8dfe94da653155f9d0b9dc660166e/cffi-2.0.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:38100abb9d1b1435bc4cc340bb4489635dc2f0da7456590877030c9b3d40b0c1", size = 220926, upload-time = "2025-09-08T23:23:27.873Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3e/aa/df335faa45b395396fcbc03de2dfcab242cd61a9900e914fe682a59170b1/cffi-2.0.0-cp314-cp314-win32.whl", hash = "sha256:087067fa8953339c723661eda6b54bc98c5625757ea62e95eb4898ad5e776e9f", size = 175328, upload-time = "2025-09-08T23:23:44.61Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/bb/92/882c2d30831744296ce713f0feb4c1cd30f346ef747b530b5318715cc367/cffi-2.0.0-cp314-cp314-win_amd64.whl", hash = "sha256:203a48d1fb583fc7d78a4c6655692963b860a417c0528492a6bc21f1aaefab25", size = 185650, upload-time = "2025-09-08T23:23:45.848Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9f/2c/98ece204b9d35a7366b5b2c6539c350313ca13932143e79dc133ba757104/cffi-2.0.0-cp314-cp314-win_arm64.whl", hash = "sha256:dbd5c7a25a7cb98f5ca55d258b103a2054f859a46ae11aaf23134f9cc0d356ad", size = 180687, upload-time = "2025-09-08T23:23:47.105Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3e/61/c768e4d548bfa607abcda77423448df8c471f25dbe64fb2ef6d555eae006/cffi-2.0.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:9a67fc9e8eb39039280526379fb3a70023d77caec1852002b4da7e8b270c4dd9", size = 188773, upload-time = "2025-09-08T23:23:29.347Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2c/ea/5f76bce7cf6fcd0ab1a1058b5af899bfbef198bea4d5686da88471ea0336/cffi-2.0.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:7a66c7204d8869299919db4d5069a82f1561581af12b11b3c9f48c584eb8743d", size = 185013, upload-time = "2025-09-08T23:23:30.63Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/be/b4/c56878d0d1755cf9caa54ba71e5d049479c52f9e4afc230f06822162ab2f/cffi-2.0.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:7cc09976e8b56f8cebd752f7113ad07752461f48a58cbba644139015ac24954c", size = 221593, upload-time = "2025-09-08T23:23:31.91Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e0/0d/eb704606dfe8033e7128df5e90fee946bbcb64a04fcdaa97321309004000/cffi-2.0.0-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:92b68146a71df78564e4ef48af17551a5ddd142e5190cdf2c5624d0c3ff5b2e8", size = 209354, upload-time = "2025-09-08T23:23:33.214Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d8/19/3c435d727b368ca475fb8742ab97c9cb13a0de600ce86f62eab7fa3eea60/cffi-2.0.0-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:b1e74d11748e7e98e2f426ab176d4ed720a64412b6a15054378afdb71e0f37dc", size = 208480, upload-time = "2025-09-08T23:23:34.495Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d0/44/681604464ed9541673e486521497406fadcc15b5217c3e326b061696899a/cffi-2.0.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:28a3a209b96630bca57cce802da70c266eb08c6e97e5afd61a75611ee6c64592", size = 221584, upload-time = "2025-09-08T23:23:36.096Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/25/8e/342a504ff018a2825d395d44d63a767dd8ebc927ebda557fecdaca3ac33a/cffi-2.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:7553fb2090d71822f02c629afe6042c299edf91ba1bf94951165613553984512", size = 224443, upload-time = "2025-09-08T23:23:37.328Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e1/5e/b666bacbbc60fbf415ba9988324a132c9a7a0448a9a8f125074671c0f2c3/cffi-2.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:6c6c373cfc5c83a975506110d17457138c8c63016b563cc9ed6e056a82f13ce4", size = 223437, upload-time = "2025-09-08T23:23:38.945Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a0/1d/ec1a60bd1a10daa292d3cd6bb0b359a81607154fb8165f3ec95fe003b85c/cffi-2.0.0-cp314-cp314t-win32.whl", hash = "sha256:1fc9ea04857caf665289b7a75923f2c6ed559b8298a1b8c49e59f7dd95c8481e", size = 180487, upload-time = "2025-09-08T23:23:40.423Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/bf/41/4c1168c74fac325c0c8156f04b6749c8b6a8f405bbf91413ba088359f60d/cffi-2.0.0-cp314-cp314t-win_amd64.whl", hash = "sha256:d68b6cef7827e8641e8ef16f4494edda8b36104d79773a334beaa1e3521430f6", size = 191726, upload-time = "2025-09-08T23:23:41.742Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ae/3a/dbeec9d1ee0844c679f6bb5d6ad4e9f198b1224f4e7a32825f47f6192b0c/cffi-2.0.0-cp314-cp314t-win_arm64.whl", hash = "sha256:0a1527a803f0a659de1af2e1fd700213caba79377e27e4693648c2923da066f9", size = 184195, upload-time = "2025-09-08T23:23:43.004Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "click"
|
||||
version = "8.3.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/3d/fa/656b739db8587d7b5dfa22e22ed02566950fbfbcdc20311993483657a5c0/click-8.3.1.tar.gz", hash = "sha256:12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a", size = 295065, upload-time = "2025-11-15T20:45:42.706Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/98/78/01c019cdb5d6498122777c1a43056ebb3ebfeef2076d9d026bfe15583b2b/click-8.3.1-py3-none-any.whl", hash = "sha256:981153a64e25f12d547d3426c367a4857371575ee7ad18df2a6183ab0545b2a6", size = 108274, upload-time = "2025-11-15T20:45:41.139Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "colorama"
|
||||
version = "0.4.6"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cryptography"
|
||||
version = "46.0.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "cffi", marker = "platform_python_implementation != 'PyPy'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/9f/33/c00162f49c0e2fe8064a62cb92b93e50c74a72bc370ab92f86112b33ff62/cryptography-46.0.3.tar.gz", hash = "sha256:a8b17438104fed022ce745b362294d9ce35b4c2e45c1d958ad4a4b019285f4a1", size = 749258, upload-time = "2025-10-15T23:18:31.74Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/1d/42/9c391dd801d6cf0d561b5890549d4b27bafcc53b39c31a817e69d87c625b/cryptography-46.0.3-cp311-abi3-macosx_10_9_universal2.whl", hash = "sha256:109d4ddfadf17e8e7779c39f9b18111a09efb969a301a31e987416a0191ed93a", size = 7225004, upload-time = "2025-10-15T23:16:52.239Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/1c/67/38769ca6b65f07461eb200e85fc1639b438bdc667be02cf7f2cd6a64601c/cryptography-46.0.3-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:09859af8466b69bc3c27bdf4f5d84a665e0f7ab5088412e9e2ec49758eca5cbc", size = 4296667, upload-time = "2025-10-15T23:16:54.369Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5c/49/498c86566a1d80e978b42f0d702795f69887005548c041636df6ae1ca64c/cryptography-46.0.3-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:01ca9ff2885f3acc98c29f1860552e37f6d7c7d013d7334ff2a9de43a449315d", size = 4450807, upload-time = "2025-10-15T23:16:56.414Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4b/0a/863a3604112174c8624a2ac3c038662d9e59970c7f926acdcfaed8d61142/cryptography-46.0.3-cp311-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:6eae65d4c3d33da080cff9c4ab1f711b15c1d9760809dad6ea763f3812d254cb", size = 4299615, upload-time = "2025-10-15T23:16:58.442Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/64/02/b73a533f6b64a69f3cd3872acb6ebc12aef924d8d103133bb3ea750dc703/cryptography-46.0.3-cp311-abi3-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:e5bf0ed4490068a2e72ac03d786693adeb909981cc596425d09032d372bcc849", size = 4016800, upload-time = "2025-10-15T23:17:00.378Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/25/d5/16e41afbfa450cde85a3b7ec599bebefaef16b5c6ba4ec49a3532336ed72/cryptography-46.0.3-cp311-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:5ecfccd2329e37e9b7112a888e76d9feca2347f12f37918facbb893d7bb88ee8", size = 4984707, upload-time = "2025-10-15T23:17:01.98Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c9/56/e7e69b427c3878352c2fb9b450bd0e19ed552753491d39d7d0a2f5226d41/cryptography-46.0.3-cp311-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:a2c0cd47381a3229c403062f764160d57d4d175e022c1df84e168c6251a22eec", size = 4482541, upload-time = "2025-10-15T23:17:04.078Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/78/f6/50736d40d97e8483172f1bb6e698895b92a223dba513b0ca6f06b2365339/cryptography-46.0.3-cp311-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:549e234ff32571b1f4076ac269fcce7a808d3bf98b76c8dd560e42dbc66d7d91", size = 4299464, upload-time = "2025-10-15T23:17:05.483Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/00/de/d8e26b1a855f19d9994a19c702fa2e93b0456beccbcfe437eda00e0701f2/cryptography-46.0.3-cp311-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:c0a7bb1a68a5d3471880e264621346c48665b3bf1c3759d682fc0864c540bd9e", size = 4950838, upload-time = "2025-10-15T23:17:07.425Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8f/29/798fc4ec461a1c9e9f735f2fc58741b0daae30688f41b2497dcbc9ed1355/cryptography-46.0.3-cp311-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:10b01676fc208c3e6feeb25a8b83d81767e8059e1fe86e1dc62d10a3018fa926", size = 4481596, upload-time = "2025-10-15T23:17:09.343Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/15/8d/03cd48b20a573adfff7652b76271078e3045b9f49387920e7f1f631d125e/cryptography-46.0.3-cp311-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:0abf1ffd6e57c67e92af68330d05760b7b7efb243aab8377e583284dbab72c71", size = 4426782, upload-time = "2025-10-15T23:17:11.22Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fa/b1/ebacbfe53317d55cf33165bda24c86523497a6881f339f9aae5c2e13e57b/cryptography-46.0.3-cp311-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:a04bee9ab6a4da801eb9b51f1b708a1b5b5c9eb48c03f74198464c66f0d344ac", size = 4698381, upload-time = "2025-10-15T23:17:12.829Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/96/92/8a6a9525893325fc057a01f654d7efc2c64b9de90413adcf605a85744ff4/cryptography-46.0.3-cp311-abi3-win32.whl", hash = "sha256:f260d0d41e9b4da1ed1e0f1ce571f97fe370b152ab18778e9e8f67d6af432018", size = 3055988, upload-time = "2025-10-15T23:17:14.65Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7e/bf/80fbf45253ea585a1e492a6a17efcb93467701fa79e71550a430c5e60df0/cryptography-46.0.3-cp311-abi3-win_amd64.whl", hash = "sha256:a9a3008438615669153eb86b26b61e09993921ebdd75385ddd748702c5adfddb", size = 3514451, upload-time = "2025-10-15T23:17:16.142Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2e/af/9b302da4c87b0beb9db4e756386a7c6c5b8003cd0e742277888d352ae91d/cryptography-46.0.3-cp311-abi3-win_arm64.whl", hash = "sha256:5d7f93296ee28f68447397bf5198428c9aeeab45705a55d53a6343455dcb2c3c", size = 2928007, upload-time = "2025-10-15T23:17:18.04Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f5/e2/a510aa736755bffa9d2f75029c229111a1d02f8ecd5de03078f4c18d91a3/cryptography-46.0.3-cp314-cp314t-macosx_10_9_universal2.whl", hash = "sha256:00a5e7e87938e5ff9ff5447ab086a5706a957137e6e433841e9d24f38a065217", size = 7158012, upload-time = "2025-10-15T23:17:19.982Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/73/dc/9aa866fbdbb95b02e7f9d086f1fccfeebf8953509b87e3f28fff927ff8a0/cryptography-46.0.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:c8daeb2d2174beb4575b77482320303f3d39b8e81153da4f0fb08eb5fe86a6c5", size = 4288728, upload-time = "2025-10-15T23:17:21.527Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c5/fd/bc1daf8230eaa075184cbbf5f8cd00ba9db4fd32d63fb83da4671b72ed8a/cryptography-46.0.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:39b6755623145ad5eff1dab323f4eae2a32a77a7abef2c5089a04a3d04366715", size = 4435078, upload-time = "2025-10-15T23:17:23.042Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/82/98/d3bd5407ce4c60017f8ff9e63ffee4200ab3e23fe05b765cab805a7db008/cryptography-46.0.3-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:db391fa7c66df6762ee3f00c95a89e6d428f4d60e7abc8328f4fe155b5ac6e54", size = 4293460, upload-time = "2025-10-15T23:17:24.885Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/26/e9/e23e7900983c2b8af7a08098db406cf989d7f09caea7897e347598d4cd5b/cryptography-46.0.3-cp314-cp314t-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:78a97cf6a8839a48c49271cdcbd5cf37ca2c1d6b7fdd86cc864f302b5e9bf459", size = 3995237, upload-time = "2025-10-15T23:17:26.449Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/91/15/af68c509d4a138cfe299d0d7ddb14afba15233223ebd933b4bbdbc7155d3/cryptography-46.0.3-cp314-cp314t-manylinux_2_28_ppc64le.whl", hash = "sha256:dfb781ff7eaa91a6f7fd41776ec37c5853c795d3b358d4896fdbb5df168af422", size = 4967344, upload-time = "2025-10-15T23:17:28.06Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ca/e3/8643d077c53868b681af077edf6b3cb58288b5423610f21c62aadcbe99f4/cryptography-46.0.3-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:6f61efb26e76c45c4a227835ddeae96d83624fb0d29eb5df5b96e14ed1a0afb7", size = 4466564, upload-time = "2025-10-15T23:17:29.665Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/0e/43/c1e8726fa59c236ff477ff2b5dc071e54b21e5a1e51aa2cee1676f1c986f/cryptography-46.0.3-cp314-cp314t-manylinux_2_34_aarch64.whl", hash = "sha256:23b1a8f26e43f47ceb6d6a43115f33a5a37d57df4ea0ca295b780ae8546e8044", size = 4292415, upload-time = "2025-10-15T23:17:31.686Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/42/f9/2f8fefdb1aee8a8e3256a0568cffc4e6d517b256a2fe97a029b3f1b9fe7e/cryptography-46.0.3-cp314-cp314t-manylinux_2_34_ppc64le.whl", hash = "sha256:b419ae593c86b87014b9be7396b385491ad7f320bde96826d0dd174459e54665", size = 4931457, upload-time = "2025-10-15T23:17:33.478Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/79/30/9b54127a9a778ccd6d27c3da7563e9f2d341826075ceab89ae3b41bf5be2/cryptography-46.0.3-cp314-cp314t-manylinux_2_34_x86_64.whl", hash = "sha256:50fc3343ac490c6b08c0cf0d704e881d0d660be923fd3076db3e932007e726e3", size = 4466074, upload-time = "2025-10-15T23:17:35.158Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ac/68/b4f4a10928e26c941b1b6a179143af9f4d27d88fe84a6a3c53592d2e76bf/cryptography-46.0.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:22d7e97932f511d6b0b04f2bfd818d73dcd5928db509460aaf48384778eb6d20", size = 4420569, upload-time = "2025-10-15T23:17:37.188Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a3/49/3746dab4c0d1979888f125226357d3262a6dd40e114ac29e3d2abdf1ec55/cryptography-46.0.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:d55f3dffadd674514ad19451161118fd010988540cee43d8bc20675e775925de", size = 4681941, upload-time = "2025-10-15T23:17:39.236Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fd/30/27654c1dbaf7e4a3531fa1fc77986d04aefa4d6d78259a62c9dc13d7ad36/cryptography-46.0.3-cp314-cp314t-win32.whl", hash = "sha256:8a6e050cb6164d3f830453754094c086ff2d0b2f3a897a1d9820f6139a1f0914", size = 3022339, upload-time = "2025-10-15T23:17:40.888Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f6/30/640f34ccd4d2a1bc88367b54b926b781b5a018d65f404d409aba76a84b1c/cryptography-46.0.3-cp314-cp314t-win_amd64.whl", hash = "sha256:760f83faa07f8b64e9c33fc963d790a2edb24efb479e3520c14a45741cd9b2db", size = 3494315, upload-time = "2025-10-15T23:17:42.769Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ba/8b/88cc7e3bd0a8e7b861f26981f7b820e1f46aa9d26cc482d0feba0ecb4919/cryptography-46.0.3-cp314-cp314t-win_arm64.whl", hash = "sha256:516ea134e703e9fe26bcd1277a4b59ad30586ea90c365a87781d7887a646fe21", size = 2919331, upload-time = "2025-10-15T23:17:44.468Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fd/23/45fe7f376a7df8daf6da3556603b36f53475a99ce4faacb6ba2cf3d82021/cryptography-46.0.3-cp38-abi3-macosx_10_9_universal2.whl", hash = "sha256:cb3d760a6117f621261d662bccc8ef5bc32ca673e037c83fbe565324f5c46936", size = 7218248, upload-time = "2025-10-15T23:17:46.294Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/27/32/b68d27471372737054cbd34c84981f9edbc24fe67ca225d389799614e27f/cryptography-46.0.3-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:4b7387121ac7d15e550f5cb4a43aef2559ed759c35df7336c402bb8275ac9683", size = 4294089, upload-time = "2025-10-15T23:17:48.269Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/26/42/fa8389d4478368743e24e61eea78846a0006caffaf72ea24a15159215a14/cryptography-46.0.3-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:15ab9b093e8f09daab0f2159bb7e47532596075139dd74365da52ecc9cb46c5d", size = 4440029, upload-time = "2025-10-15T23:17:49.837Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5f/eb/f483db0ec5ac040824f269e93dd2bd8a21ecd1027e77ad7bdf6914f2fd80/cryptography-46.0.3-cp38-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:46acf53b40ea38f9c6c229599a4a13f0d46a6c3fa9ef19fc1a124d62e338dfa0", size = 4297222, upload-time = "2025-10-15T23:17:51.357Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fd/cf/da9502c4e1912cb1da3807ea3618a6829bee8207456fbbeebc361ec38ba3/cryptography-46.0.3-cp38-abi3-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:10ca84c4668d066a9878890047f03546f3ae0a6b8b39b697457b7757aaf18dbc", size = 4012280, upload-time = "2025-10-15T23:17:52.964Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6b/8f/9adb86b93330e0df8b3dcf03eae67c33ba89958fc2e03862ef1ac2b42465/cryptography-46.0.3-cp38-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:36e627112085bb3b81b19fed209c05ce2a52ee8b15d161b7c643a7d5a88491f3", size = 4978958, upload-time = "2025-10-15T23:17:54.965Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d1/a0/5fa77988289c34bdb9f913f5606ecc9ada1adb5ae870bd0d1054a7021cc4/cryptography-46.0.3-cp38-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:1000713389b75c449a6e979ffc7dcc8ac90b437048766cef052d4d30b8220971", size = 4473714, upload-time = "2025-10-15T23:17:56.754Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/14/e5/fc82d72a58d41c393697aa18c9abe5ae1214ff6f2a5c18ac470f92777895/cryptography-46.0.3-cp38-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:b02cf04496f6576afffef5ddd04a0cb7d49cf6be16a9059d793a30b035f6b6ac", size = 4296970, upload-time = "2025-10-15T23:17:58.588Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/78/06/5663ed35438d0b09056973994f1aec467492b33bd31da36e468b01ec1097/cryptography-46.0.3-cp38-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:71e842ec9bc7abf543b47cf86b9a743baa95f4677d22baa4c7d5c69e49e9bc04", size = 4940236, upload-time = "2025-10-15T23:18:00.897Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fc/59/873633f3f2dcd8a053b8dd1d38f783043b5fce589c0f6988bf55ef57e43e/cryptography-46.0.3-cp38-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:402b58fc32614f00980b66d6e56a5b4118e6cb362ae8f3fda141ba4689bd4506", size = 4472642, upload-time = "2025-10-15T23:18:02.749Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3d/39/8e71f3930e40f6877737d6f69248cf74d4e34b886a3967d32f919cc50d3b/cryptography-46.0.3-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:ef639cb3372f69ec44915fafcd6698b6cc78fbe0c2ea41be867f6ed612811963", size = 4423126, upload-time = "2025-10-15T23:18:04.85Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/cd/c7/f65027c2810e14c3e7268353b1681932b87e5a48e65505d8cc17c99e36ae/cryptography-46.0.3-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:3b51b8ca4f1c6453d8829e1eb7299499ca7f313900dd4d89a24b8b87c0a780d4", size = 4686573, upload-time = "2025-10-15T23:18:06.908Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/0a/6e/1c8331ddf91ca4730ab3086a0f1be19c65510a33b5a441cb334e7a2d2560/cryptography-46.0.3-cp38-abi3-win32.whl", hash = "sha256:6276eb85ef938dc035d59b87c8a7dc559a232f954962520137529d77b18ff1df", size = 3036695, upload-time = "2025-10-15T23:18:08.672Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/90/45/b0d691df20633eff80955a0fc7695ff9051ffce8b69741444bd9ed7bd0db/cryptography-46.0.3-cp38-abi3-win_amd64.whl", hash = "sha256:416260257577718c05135c55958b674000baef9a1c7d9e8f306ec60d71db850f", size = 3501720, upload-time = "2025-10-15T23:18:10.632Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e8/cb/2da4cc83f5edb9c3257d09e1e7ab7b23f049c7962cae8d842bbef0a9cec9/cryptography-46.0.3-cp38-abi3-win_arm64.whl", hash = "sha256:d89c3468de4cdc4f08a57e214384d0471911a3830fcdaf7a8cc587e42a866372", size = 2918740, upload-time = "2025-10-15T23:18:12.277Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "h11"
|
||||
version = "0.16.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/01/ee/02a2c011bdab74c6fb3c75474d40b3052059d95df7e73351460c8588d963/h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1", size = 101250, upload-time = "2025-04-24T03:35:25.427Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515, upload-time = "2025-04-24T03:35:24.344Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "httpcore"
|
||||
version = "1.0.9"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "certifi" },
|
||||
{ name = "h11" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/06/94/82699a10bca87a5556c9c59b5963f2d039dbd239f25bc2a63907a05a14cb/httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8", size = 85484, upload-time = "2025-04-24T22:06:22.219Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/7e/f5/f66802a942d491edb555dd61e3a9961140fd64c90bce1eafd741609d334d/httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55", size = 78784, upload-time = "2025-04-24T22:06:20.566Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "httpx"
|
||||
version = "0.28.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "anyio" },
|
||||
{ name = "certifi" },
|
||||
{ name = "httpcore" },
|
||||
{ name = "idna" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/b1/df/48c586a5fe32a0f01324ee087459e112ebb7224f646c0b5023f5e79e9956/httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc", size = 141406, upload-time = "2024-12-06T15:37:23.222Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517, upload-time = "2024-12-06T15:37:21.509Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "httpx-sse"
|
||||
version = "0.4.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/0f/4c/751061ffa58615a32c31b2d82e8482be8dd4a89154f003147acee90f2be9/httpx_sse-0.4.3.tar.gz", hash = "sha256:9b1ed0127459a66014aec3c56bebd93da3c1bc8bb6618c8082039a44889a755d", size = 15943, upload-time = "2025-10-10T21:48:22.271Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d2/fd/6668e5aec43ab844de6fc74927e155a3b37bf40d7c3790e49fc0406b6578/httpx_sse-0.4.3-py3-none-any.whl", hash = "sha256:0ac1c9fe3c0afad2e0ebb25a934a59f4c7823b60792691f779fad2c5568830fc", size = 8960, upload-time = "2025-10-10T21:48:21.158Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "3.11"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/6f/6d/0703ccc57f3a7233505399edb88de3cbd678da106337b9fcde432b65ed60/idna-3.11.tar.gz", hash = "sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902", size = 194582, upload-time = "2025-10-12T14:55:20.501Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/0e/61/66938bbb5fc52dbdf84594873d5b51fb1f7c7794e9c0f5bd885f30bc507b/idna-3.11-py3-none-any.whl", hash = "sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea", size = 71008, upload-time = "2025-10-12T14:55:18.883Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iniconfig"
|
||||
version = "2.3.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/72/34/14ca021ce8e5dfedc35312d08ba8bf51fdd999c576889fc2c24cb97f4f10/iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730", size = 20503, upload-time = "2025-10-18T21:55:43.219Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12", size = 7484, upload-time = "2025-10-18T21:55:41.639Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jsonschema"
|
||||
version = "4.25.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "attrs" },
|
||||
{ name = "jsonschema-specifications" },
|
||||
{ name = "referencing" },
|
||||
{ name = "rpds-py" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/74/69/f7185de793a29082a9f3c7728268ffb31cb5095131a9c139a74078e27336/jsonschema-4.25.1.tar.gz", hash = "sha256:e4a9655ce0da0c0b67a085847e00a3a51449e1157f4f75e9fb5aa545e122eb85", size = 357342, upload-time = "2025-08-18T17:03:50.038Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/bf/9c/8c95d856233c1f82500c2450b8c68576b4cf1c871db3afac5c34ff84e6fd/jsonschema-4.25.1-py3-none-any.whl", hash = "sha256:3fba0169e345c7175110351d456342c364814cfcf3b964ba4587f22915230a63", size = 90040, upload-time = "2025-08-18T17:03:48.373Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jsonschema-specifications"
|
||||
version = "2025.9.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "referencing" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/19/74/a633ee74eb36c44aa6d1095e7cc5569bebf04342ee146178e2d36600708b/jsonschema_specifications-2025.9.1.tar.gz", hash = "sha256:b540987f239e745613c7a9176f3edb72b832a4ac465cf02712288397832b5e8d", size = 32855, upload-time = "2025-09-08T01:34:59.186Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/41/45/1a4ed80516f02155c51f51e8cedb3c1902296743db0bbc66608a0db2814f/jsonschema_specifications-2025.9.1-py3-none-any.whl", hash = "sha256:98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe", size = 18437, upload-time = "2025-09-08T01:34:57.871Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mcp"
|
||||
version = "1.25.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "anyio" },
|
||||
{ name = "httpx" },
|
||||
{ name = "httpx-sse" },
|
||||
{ name = "jsonschema" },
|
||||
{ name = "pydantic" },
|
||||
{ name = "pydantic-settings" },
|
||||
{ name = "pyjwt", extra = ["crypto"] },
|
||||
{ name = "python-multipart" },
|
||||
{ name = "pywin32", marker = "sys_platform == 'win32'" },
|
||||
{ name = "sse-starlette" },
|
||||
{ name = "starlette" },
|
||||
{ name = "typing-extensions" },
|
||||
{ name = "typing-inspection" },
|
||||
{ name = "uvicorn", marker = "sys_platform != 'emscripten'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d5/2d/649d80a0ecf6a1f82632ca44bec21c0461a9d9fc8934d38cb5b319f2db5e/mcp-1.25.0.tar.gz", hash = "sha256:56310361ebf0364e2d438e5b45f7668cbb124e158bb358333cd06e49e83a6802", size = 605387, upload-time = "2025-12-19T10:19:56.985Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e2/fc/6dc7659c2ae5ddf280477011f4213a74f806862856b796ef08f028e664bf/mcp-1.25.0-py3-none-any.whl", hash = "sha256:b37c38144a666add0862614cc79ec276e97d72aa8ca26d622818d4e278b9721a", size = 233076, upload-time = "2025-12-19T10:19:55.416Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "packaging"
|
||||
version = "25.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/a1/d4/1fc4078c65507b51b96ca8f8c3ba19e6a61c8253c72794544580a7b6c24d/packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f", size = 165727, upload-time = "2025-04-19T11:48:59.673Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", size = 66469, upload-time = "2025-04-19T11:48:57.875Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pluggy"
|
||||
version = "1.6.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412, upload-time = "2025-05-15T12:30:07.975Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538, upload-time = "2025-05-15T12:30:06.134Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pycparser"
|
||||
version = "2.23"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/fe/cf/d2d3b9f5699fb1e4615c8e32ff220203e43b248e1dfcc6736ad9057731ca/pycparser-2.23.tar.gz", hash = "sha256:78816d4f24add8f10a06d6f05b4d424ad9e96cfebf68a4ddc99c65c0720d00c2", size = 173734, upload-time = "2025-09-09T13:23:47.91Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/a0/e3/59cd50310fc9b59512193629e1984c1f95e5c8ae6e5d8c69532ccc65a7fe/pycparser-2.23-py3-none-any.whl", hash = "sha256:e5c6e8d3fbad53479cab09ac03729e0a9faf2bee3db8208a550daf5af81a5934", size = 118140, upload-time = "2025-09-09T13:23:46.651Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic"
|
||||
version = "2.12.5"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "annotated-types" },
|
||||
{ name = "pydantic-core" },
|
||||
{ name = "typing-extensions" },
|
||||
{ name = "typing-inspection" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/69/44/36f1a6e523abc58ae5f928898e4aca2e0ea509b5aa6f6f392a5d882be928/pydantic-2.12.5.tar.gz", hash = "sha256:4d351024c75c0f085a9febbb665ce8c0c6ec5d30e903bdb6394b7ede26aebb49", size = 821591, upload-time = "2025-11-26T15:11:46.471Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/5a/87/b70ad306ebb6f9b585f114d0ac2137d792b48be34d732d60e597c2f8465a/pydantic-2.12.5-py3-none-any.whl", hash = "sha256:e561593fccf61e8a20fc46dfc2dfe075b8be7d0188df33f221ad1f0139180f9d", size = 463580, upload-time = "2025-11-26T15:11:44.605Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic-core"
|
||||
version = "2.41.5"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/71/70/23b021c950c2addd24ec408e9ab05d59b035b39d97cdc1130e1bce647bb6/pydantic_core-2.41.5.tar.gz", hash = "sha256:08daa51ea16ad373ffd5e7606252cc32f07bc72b28284b6bc9c6df804816476e", size = 460952, upload-time = "2025-11-04T13:43:49.098Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/ea/28/46b7c5c9635ae96ea0fbb779e271a38129df2550f763937659ee6c5dbc65/pydantic_core-2.41.5-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:3f37a19d7ebcdd20b96485056ba9e8b304e27d9904d233d7b1015db320e51f0a", size = 2119622, upload-time = "2025-11-04T13:40:56.68Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/74/1a/145646e5687e8d9a1e8d09acb278c8535ebe9e972e1f162ed338a622f193/pydantic_core-2.41.5-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1d1d9764366c73f996edd17abb6d9d7649a7eb690006ab6adbda117717099b14", size = 1891725, upload-time = "2025-11-04T13:40:58.807Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/23/04/e89c29e267b8060b40dca97bfc64a19b2a3cf99018167ea1677d96368273/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:25e1c2af0fce638d5f1988b686f3b3ea8cd7de5f244ca147c777769e798a9cd1", size = 1915040, upload-time = "2025-11-04T13:41:00.853Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/84/a3/15a82ac7bd97992a82257f777b3583d3e84bdb06ba6858f745daa2ec8a85/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:506d766a8727beef16b7adaeb8ee6217c64fc813646b424d0804d67c16eddb66", size = 2063691, upload-time = "2025-11-04T13:41:03.504Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/74/9b/0046701313c6ef08c0c1cf0e028c67c770a4e1275ca73131563c5f2a310a/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4819fa52133c9aa3c387b3328f25c1facc356491e6135b459f1de698ff64d869", size = 2213897, upload-time = "2025-11-04T13:41:05.804Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8a/cd/6bac76ecd1b27e75a95ca3a9a559c643b3afcd2dd62086d4b7a32a18b169/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2b761d210c9ea91feda40d25b4efe82a1707da2ef62901466a42492c028553a2", size = 2333302, upload-time = "2025-11-04T13:41:07.809Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4c/d2/ef2074dc020dd6e109611a8be4449b98cd25e1b9b8a303c2f0fca2f2bcf7/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:22f0fb8c1c583a3b6f24df2470833b40207e907b90c928cc8d3594b76f874375", size = 2064877, upload-time = "2025-11-04T13:41:09.827Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/18/66/e9db17a9a763d72f03de903883c057b2592c09509ccfe468187f2a2eef29/pydantic_core-2.41.5-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2782c870e99878c634505236d81e5443092fba820f0373997ff75f90f68cd553", size = 2180680, upload-time = "2025-11-04T13:41:12.379Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d3/9e/3ce66cebb929f3ced22be85d4c2399b8e85b622db77dad36b73c5387f8f8/pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:0177272f88ab8312479336e1d777f6b124537d47f2123f89cb37e0accea97f90", size = 2138960, upload-time = "2025-11-04T13:41:14.627Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a6/62/205a998f4327d2079326b01abee48e502ea739d174f0a89295c481a2272e/pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_armv7l.whl", hash = "sha256:63510af5e38f8955b8ee5687740d6ebf7c2a0886d15a6d65c32814613681bc07", size = 2339102, upload-time = "2025-11-04T13:41:16.868Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3c/0d/f05e79471e889d74d3d88f5bd20d0ed189ad94c2423d81ff8d0000aab4ff/pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:e56ba91f47764cc14f1daacd723e3e82d1a89d783f0f5afe9c364b8bb491ccdb", size = 2326039, upload-time = "2025-11-04T13:41:18.934Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ec/e1/e08a6208bb100da7e0c4b288eed624a703f4d129bde2da475721a80cab32/pydantic_core-2.41.5-cp314-cp314-win32.whl", hash = "sha256:aec5cf2fd867b4ff45b9959f8b20ea3993fc93e63c7363fe6851424c8a7e7c23", size = 1995126, upload-time = "2025-11-04T13:41:21.418Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/48/5d/56ba7b24e9557f99c9237e29f5c09913c81eeb2f3217e40e922353668092/pydantic_core-2.41.5-cp314-cp314-win_amd64.whl", hash = "sha256:8e7c86f27c585ef37c35e56a96363ab8de4e549a95512445b85c96d3e2f7c1bf", size = 2015489, upload-time = "2025-11-04T13:41:24.076Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4e/bb/f7a190991ec9e3e0ba22e4993d8755bbc4a32925c0b5b42775c03e8148f9/pydantic_core-2.41.5-cp314-cp314-win_arm64.whl", hash = "sha256:e672ba74fbc2dc8eea59fb6d4aed6845e6905fc2a8afe93175d94a83ba2a01a0", size = 1977288, upload-time = "2025-11-04T13:41:26.33Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/92/ed/77542d0c51538e32e15afe7899d79efce4b81eee631d99850edc2f5e9349/pydantic_core-2.41.5-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:8566def80554c3faa0e65ac30ab0932b9e3a5cd7f8323764303d468e5c37595a", size = 2120255, upload-time = "2025-11-04T13:41:28.569Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/bb/3d/6913dde84d5be21e284439676168b28d8bbba5600d838b9dca99de0fad71/pydantic_core-2.41.5-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:b80aa5095cd3109962a298ce14110ae16b8c1aece8b72f9dafe81cf597ad80b3", size = 1863760, upload-time = "2025-11-04T13:41:31.055Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5a/f0/e5e6b99d4191da102f2b0eb9687aaa7f5bea5d9964071a84effc3e40f997/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3006c3dd9ba34b0c094c544c6006cc79e87d8612999f1a5d43b769b89181f23c", size = 1878092, upload-time = "2025-11-04T13:41:33.21Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/71/48/36fb760642d568925953bcc8116455513d6e34c4beaa37544118c36aba6d/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:72f6c8b11857a856bcfa48c86f5368439f74453563f951e473514579d44aa612", size = 2053385, upload-time = "2025-11-04T13:41:35.508Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/20/25/92dc684dd8eb75a234bc1c764b4210cf2646479d54b47bf46061657292a8/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5cb1b2f9742240e4bb26b652a5aeb840aa4b417c7748b6f8387927bc6e45e40d", size = 2218832, upload-time = "2025-11-04T13:41:37.732Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e2/09/f53e0b05023d3e30357d82eb35835d0f6340ca344720a4599cd663dca599/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bd3d54f38609ff308209bd43acea66061494157703364ae40c951f83ba99a1a9", size = 2327585, upload-time = "2025-11-04T13:41:40Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/aa/4e/2ae1aa85d6af35a39b236b1b1641de73f5a6ac4d5a7509f77b814885760c/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2ff4321e56e879ee8d2a879501c8e469414d948f4aba74a2d4593184eb326660", size = 2041078, upload-time = "2025-11-04T13:41:42.323Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/cd/13/2e215f17f0ef326fc72afe94776edb77525142c693767fc347ed6288728d/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d0d2568a8c11bf8225044aa94409e21da0cb09dcdafe9ecd10250b2baad531a9", size = 2173914, upload-time = "2025-11-04T13:41:45.221Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/02/7a/f999a6dcbcd0e5660bc348a3991c8915ce6599f4f2c6ac22f01d7a10816c/pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:a39455728aabd58ceabb03c90e12f71fd30fa69615760a075b9fec596456ccc3", size = 2129560, upload-time = "2025-11-04T13:41:47.474Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3a/b1/6c990ac65e3b4c079a4fb9f5b05f5b013afa0f4ed6780a3dd236d2cbdc64/pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_armv7l.whl", hash = "sha256:239edca560d05757817c13dc17c50766136d21f7cd0fac50295499ae24f90fdf", size = 2329244, upload-time = "2025-11-04T13:41:49.992Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d9/02/3c562f3a51afd4d88fff8dffb1771b30cfdfd79befd9883ee094f5b6c0d8/pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:2a5e06546e19f24c6a96a129142a75cee553cc018ffee48a460059b1185f4470", size = 2331955, upload-time = "2025-11-04T13:41:54.079Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5c/96/5fb7d8c3c17bc8c62fdb031c47d77a1af698f1d7a406b0f79aaa1338f9ad/pydantic_core-2.41.5-cp314-cp314t-win32.whl", hash = "sha256:b4ececa40ac28afa90871c2cc2b9ffd2ff0bf749380fbdf57d165fd23da353aa", size = 1988906, upload-time = "2025-11-04T13:41:56.606Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/22/ed/182129d83032702912c2e2d8bbe33c036f342cc735737064668585dac28f/pydantic_core-2.41.5-cp314-cp314t-win_amd64.whl", hash = "sha256:80aa89cad80b32a912a65332f64a4450ed00966111b6615ca6816153d3585a8c", size = 1981607, upload-time = "2025-11-04T13:41:58.889Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9f/ed/068e41660b832bb0b1aa5b58011dea2a3fe0ba7861ff38c4d4904c1c1a99/pydantic_core-2.41.5-cp314-cp314t-win_arm64.whl", hash = "sha256:35b44f37a3199f771c3eaa53051bc8a70cd7b54f333531c59e29fd4db5d15008", size = 1974769, upload-time = "2025-11-04T13:42:01.186Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic-settings"
|
||||
version = "2.12.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "pydantic" },
|
||||
{ name = "python-dotenv" },
|
||||
{ name = "typing-inspection" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/43/4b/ac7e0aae12027748076d72a8764ff1c9d82ca75a7a52622e67ed3f765c54/pydantic_settings-2.12.0.tar.gz", hash = "sha256:005538ef951e3c2a68e1c08b292b5f2e71490def8589d4221b95dab00dafcfd0", size = 194184, upload-time = "2025-11-10T14:25:47.013Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/c1/60/5d4751ba3f4a40a6891f24eec885f51afd78d208498268c734e256fb13c4/pydantic_settings-2.12.0-py3-none-any.whl", hash = "sha256:fddb9fd99a5b18da837b29710391e945b1e30c135477f484084ee513adb93809", size = 51880, upload-time = "2025-11-10T14:25:45.546Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pygments"
|
||||
version = "2.19.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/b0/77/a5b8c569bf593b0140bde72ea885a803b82086995367bf2037de0159d924/pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887", size = 4968631, upload-time = "2025-06-21T13:39:12.283Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b", size = 1225217, upload-time = "2025-06-21T13:39:07.939Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pyjwt"
|
||||
version = "2.10.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/e7/46/bd74733ff231675599650d3e47f361794b22ef3e3770998dda30d3b63726/pyjwt-2.10.1.tar.gz", hash = "sha256:3cc5772eb20009233caf06e9d8a0577824723b44e6648ee0a2aedb6cf9381953", size = 87785, upload-time = "2024-11-28T03:43:29.933Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/61/ad/689f02752eeec26aed679477e80e632ef1b682313be70793d798c1d5fc8f/PyJWT-2.10.1-py3-none-any.whl", hash = "sha256:dcdd193e30abefd5debf142f9adfcdd2b58004e644f25406ffaebd50bd98dacb", size = 22997, upload-time = "2024-11-28T03:43:27.893Z" },
|
||||
]
|
||||
|
||||
[package.optional-dependencies]
|
||||
crypto = [
|
||||
{ name = "cryptography" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pytest"
|
||||
version = "9.0.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
||||
{ name = "iniconfig" },
|
||||
{ name = "packaging" },
|
||||
{ name = "pluggy" },
|
||||
{ name = "pygments" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d1/db/7ef3487e0fb0049ddb5ce41d3a49c235bf9ad299b6a25d5780a89f19230f/pytest-9.0.2.tar.gz", hash = "sha256:75186651a92bd89611d1d9fc20f0b4345fd827c41ccd5c299a868a05d70edf11", size = 1568901, upload-time = "2025-12-06T21:30:51.014Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/3b/ab/b3226f0bd7cdcf710fbede2b3548584366da3b19b5021e74f5bde2a8fa3f/pytest-9.0.2-py3-none-any.whl", hash = "sha256:711ffd45bf766d5264d487b917733b453d917afd2b0ad65223959f59089f875b", size = 374801, upload-time = "2025-12-06T21:30:49.154Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pytest-asyncio"
|
||||
version = "1.3.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "pytest" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/90/2c/8af215c0f776415f3590cac4f9086ccefd6fd463befeae41cd4d3f193e5a/pytest_asyncio-1.3.0.tar.gz", hash = "sha256:d7f52f36d231b80ee124cd216ffb19369aa168fc10095013c6b014a34d3ee9e5", size = 50087, upload-time = "2025-11-10T16:07:47.256Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e5/35/f8b19922b6a25bc0880171a2f1a003eaeb93657475193ab516fd87cac9da/pytest_asyncio-1.3.0-py3-none-any.whl", hash = "sha256:611e26147c7f77640e6d0a92a38ed17c3e9848063698d5c93d5aa7aa11cebff5", size = 15075, upload-time = "2025-11-10T16:07:45.537Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "python-dotenv"
|
||||
version = "1.2.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f0/26/19cadc79a718c5edbec86fd4919a6b6d3f681039a2f6d66d14be94e75fb9/python_dotenv-1.2.1.tar.gz", hash = "sha256:42667e897e16ab0d66954af0e60a9caa94f0fd4ecf3aaf6d2d260eec1aa36ad6", size = 44221, upload-time = "2025-10-26T15:12:10.434Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/14/1b/a298b06749107c305e1fe0f814c6c74aea7b2f1e10989cb30f544a1b3253/python_dotenv-1.2.1-py3-none-any.whl", hash = "sha256:b81ee9561e9ca4004139c6cbba3a238c32b03e4894671e181b671e8cb8425d61", size = 21230, upload-time = "2025-10-26T15:12:09.109Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "python-multipart"
|
||||
version = "0.0.21"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/78/96/804520d0850c7db98e5ccb70282e29208723f0964e88ffd9d0da2f52ea09/python_multipart-0.0.21.tar.gz", hash = "sha256:7137ebd4d3bbf70ea1622998f902b97a29434a9e8dc40eb203bbcf7c2a2cba92", size = 37196, upload-time = "2025-12-17T09:24:22.446Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/aa/76/03af049af4dcee5d27442f71b6924f01f3efb5d2bd34f23fcd563f2cc5f5/python_multipart-0.0.21-py3-none-any.whl", hash = "sha256:cf7a6713e01c87aa35387f4774e812c4361150938d20d232800f75ffcf266090", size = 24541, upload-time = "2025-12-17T09:24:21.153Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pywin32"
|
||||
version = "311"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/c9/31/097f2e132c4f16d99a22bfb777e0fd88bd8e1c634304e102f313af69ace5/pywin32-311-cp314-cp314-win32.whl", hash = "sha256:b7a2c10b93f8986666d0c803ee19b5990885872a7de910fc460f9b0c2fbf92ee", size = 8840714, upload-time = "2025-07-14T20:13:32.449Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/90/4b/07c77d8ba0e01349358082713400435347df8426208171ce297da32c313d/pywin32-311-cp314-cp314-win_amd64.whl", hash = "sha256:3aca44c046bd2ed8c90de9cb8427f581c479e594e99b5c0bb19b29c10fd6cb87", size = 9656800, upload-time = "2025-07-14T20:13:34.312Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c0/d2/21af5c535501a7233e734b8af901574572da66fcc254cb35d0609c9080dd/pywin32-311-cp314-cp314-win_arm64.whl", hash = "sha256:a508e2d9025764a8270f93111a970e1d0fbfc33f4153b388bb649b7eec4f9b42", size = 8932540, upload-time = "2025-07-14T20:13:36.379Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "referencing"
|
||||
version = "0.37.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "attrs" },
|
||||
{ name = "rpds-py" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/22/f5/df4e9027acead3ecc63e50fe1e36aca1523e1719559c499951bb4b53188f/referencing-0.37.0.tar.gz", hash = "sha256:44aefc3142c5b842538163acb373e24cce6632bd54bdb01b21ad5863489f50d8", size = 78036, upload-time = "2025-10-13T15:30:48.871Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/2c/58/ca301544e1fa93ed4f80d724bf5b194f6e4b945841c5bfd555878eea9fcb/referencing-0.37.0-py3-none-any.whl", hash = "sha256:381329a9f99628c9069361716891d34ad94af76e461dcb0335825aecc7692231", size = 26766, upload-time = "2025-10-13T15:30:47.625Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rpds-py"
|
||||
version = "0.30.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/20/af/3f2f423103f1113b36230496629986e0ef7e199d2aa8392452b484b38ced/rpds_py-0.30.0.tar.gz", hash = "sha256:dd8ff7cf90014af0c0f787eea34794ebf6415242ee1d6fa91eaba725cc441e84", size = 69469, upload-time = "2025-11-30T20:24:38.837Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/86/81/dad16382ebbd3d0e0328776d8fd7ca94220e4fa0798d1dc5e7da48cb3201/rpds_py-0.30.0-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:68f19c879420aa08f61203801423f6cd5ac5f0ac4ac82a2368a9fcd6a9a075e0", size = 362099, upload-time = "2025-11-30T20:23:27.316Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2b/60/19f7884db5d5603edf3c6bce35408f45ad3e97e10007df0e17dd57af18f8/rpds_py-0.30.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:ec7c4490c672c1a0389d319b3a9cfcd098dcdc4783991553c332a15acf7249be", size = 353192, upload-time = "2025-11-30T20:23:29.151Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/bf/c4/76eb0e1e72d1a9c4703c69607cec123c29028bff28ce41588792417098ac/rpds_py-0.30.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f251c812357a3fed308d684a5079ddfb9d933860fc6de89f2b7ab00da481e65f", size = 384080, upload-time = "2025-11-30T20:23:30.785Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/72/87/87ea665e92f3298d1b26d78814721dc39ed8d2c74b86e83348d6b48a6f31/rpds_py-0.30.0-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ac98b175585ecf4c0348fd7b29c3864bda53b805c773cbf7bfdaffc8070c976f", size = 394841, upload-time = "2025-11-30T20:23:32.209Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/77/ad/7783a89ca0587c15dcbf139b4a8364a872a25f861bdb88ed99f9b0dec985/rpds_py-0.30.0-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3e62880792319dbeb7eb866547f2e35973289e7d5696c6e295476448f5b63c87", size = 516670, upload-time = "2025-11-30T20:23:33.742Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5b/3c/2882bdac942bd2172f3da574eab16f309ae10a3925644e969536553cb4ee/rpds_py-0.30.0-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4e7fc54e0900ab35d041b0601431b0a0eb495f0851a0639b6ef90f7741b39a18", size = 408005, upload-time = "2025-11-30T20:23:35.253Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ce/81/9a91c0111ce1758c92516a3e44776920b579d9a7c09b2b06b642d4de3f0f/rpds_py-0.30.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47e77dc9822d3ad616c3d5759ea5631a75e5809d5a28707744ef79d7a1bcfcad", size = 382112, upload-time = "2025-11-30T20:23:36.842Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/cf/8e/1da49d4a107027e5fbc64daeab96a0706361a2918da10cb41769244b805d/rpds_py-0.30.0-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:b4dc1a6ff022ff85ecafef7979a2c6eb423430e05f1165d6688234e62ba99a07", size = 399049, upload-time = "2025-11-30T20:23:38.343Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/df/5a/7ee239b1aa48a127570ec03becbb29c9d5a9eb092febbd1699d567cae859/rpds_py-0.30.0-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4559c972db3a360808309e06a74628b95eaccbf961c335c8fe0d590cf587456f", size = 415661, upload-time = "2025-11-30T20:23:40.263Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/70/ea/caa143cf6b772f823bc7929a45da1fa83569ee49b11d18d0ada7f5ee6fd6/rpds_py-0.30.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:0ed177ed9bded28f8deb6ab40c183cd1192aa0de40c12f38be4d59cd33cb5c65", size = 565606, upload-time = "2025-11-30T20:23:42.186Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/64/91/ac20ba2d69303f961ad8cf55bf7dbdb4763f627291ba3d0d7d67333cced9/rpds_py-0.30.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:ad1fa8db769b76ea911cb4e10f049d80bf518c104f15b3edb2371cc65375c46f", size = 591126, upload-time = "2025-11-30T20:23:44.086Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/21/20/7ff5f3c8b00c8a95f75985128c26ba44503fb35b8e0259d812766ea966c7/rpds_py-0.30.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:46e83c697b1f1c72b50e5ee5adb4353eef7406fb3f2043d64c33f20ad1c2fc53", size = 553371, upload-time = "2025-11-30T20:23:46.004Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/72/c7/81dadd7b27c8ee391c132a6b192111ca58d866577ce2d9b0ca157552cce0/rpds_py-0.30.0-cp314-cp314-win32.whl", hash = "sha256:ee454b2a007d57363c2dfd5b6ca4a5d7e2c518938f8ed3b706e37e5d470801ed", size = 215298, upload-time = "2025-11-30T20:23:47.696Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3e/d2/1aaac33287e8cfb07aab2e6b8ac1deca62f6f65411344f1433c55e6f3eb8/rpds_py-0.30.0-cp314-cp314-win_amd64.whl", hash = "sha256:95f0802447ac2d10bcc69f6dc28fe95fdf17940367b21d34e34c737870758950", size = 228604, upload-time = "2025-11-30T20:23:49.501Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e8/95/ab005315818cc519ad074cb7784dae60d939163108bd2b394e60dc7b5461/rpds_py-0.30.0-cp314-cp314-win_arm64.whl", hash = "sha256:613aa4771c99f03346e54c3f038e4cc574ac09a3ddfb0e8878487335e96dead6", size = 222391, upload-time = "2025-11-30T20:23:50.96Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9e/68/154fe0194d83b973cdedcdcc88947a2752411165930182ae41d983dcefa6/rpds_py-0.30.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:7e6ecfcb62edfd632e56983964e6884851786443739dbfe3582947e87274f7cb", size = 364868, upload-time = "2025-11-30T20:23:52.494Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/83/69/8bbc8b07ec854d92a8b75668c24d2abcb1719ebf890f5604c61c9369a16f/rpds_py-0.30.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:a1d0bc22a7cdc173fedebb73ef81e07faef93692b8c1ad3733b67e31e1b6e1b8", size = 353747, upload-time = "2025-11-30T20:23:54.036Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ab/00/ba2e50183dbd9abcce9497fa5149c62b4ff3e22d338a30d690f9af970561/rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0d08f00679177226c4cb8c5265012eea897c8ca3b93f429e546600c971bcbae7", size = 383795, upload-time = "2025-11-30T20:23:55.556Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/05/6f/86f0272b84926bcb0e4c972262f54223e8ecc556b3224d281e6598fc9268/rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5965af57d5848192c13534f90f9dd16464f3c37aaf166cc1da1cae1fd5a34898", size = 393330, upload-time = "2025-11-30T20:23:57.033Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/cb/e9/0e02bb2e6dc63d212641da45df2b0bf29699d01715913e0d0f017ee29438/rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9a4e86e34e9ab6b667c27f3211ca48f73dba7cd3d90f8d5b11be56e5dbc3fb4e", size = 518194, upload-time = "2025-11-30T20:23:58.637Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ee/ca/be7bca14cf21513bdf9c0606aba17d1f389ea2b6987035eb4f62bd923f25/rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e5d3e6b26f2c785d65cc25ef1e5267ccbe1b069c5c21b8cc724efee290554419", size = 408340, upload-time = "2025-11-30T20:24:00.2Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c2/c7/736e00ebf39ed81d75544c0da6ef7b0998f8201b369acf842f9a90dc8fce/rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:626a7433c34566535b6e56a1b39a7b17ba961e97ce3b80ec62e6f1312c025551", size = 383765, upload-time = "2025-11-30T20:24:01.759Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4a/3f/da50dfde9956aaf365c4adc9533b100008ed31aea635f2b8d7b627e25b49/rpds_py-0.30.0-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:acd7eb3f4471577b9b5a41baf02a978e8bdeb08b4b355273994f8b87032000a8", size = 396834, upload-time = "2025-11-30T20:24:03.687Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4e/00/34bcc2565b6020eab2623349efbdec810676ad571995911f1abdae62a3a0/rpds_py-0.30.0-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:fe5fa731a1fa8a0a56b0977413f8cacac1768dad38d16b3a296712709476fbd5", size = 415470, upload-time = "2025-11-30T20:24:05.232Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8c/28/882e72b5b3e6f718d5453bd4d0d9cf8df36fddeb4ddbbab17869d5868616/rpds_py-0.30.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:74a3243a411126362712ee1524dfc90c650a503502f135d54d1b352bd01f2404", size = 565630, upload-time = "2025-11-30T20:24:06.878Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3b/97/04a65539c17692de5b85c6e293520fd01317fd878ea1995f0367d4532fb1/rpds_py-0.30.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:3e8eeb0544f2eb0d2581774be4c3410356eba189529a6b3e36bbbf9696175856", size = 591148, upload-time = "2025-11-30T20:24:08.445Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/85/70/92482ccffb96f5441aab93e26c4d66489eb599efdcf96fad90c14bbfb976/rpds_py-0.30.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:dbd936cde57abfee19ab3213cf9c26be06d60750e60a8e4dd85d1ab12c8b1f40", size = 556030, upload-time = "2025-11-30T20:24:10.956Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/20/53/7c7e784abfa500a2b6b583b147ee4bb5a2b3747a9166bab52fec4b5b5e7d/rpds_py-0.30.0-cp314-cp314t-win32.whl", hash = "sha256:dc824125c72246d924f7f796b4f63c1e9dc810c7d9e2355864b3c3a73d59ade0", size = 211570, upload-time = "2025-11-30T20:24:12.735Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d0/02/fa464cdfbe6b26e0600b62c528b72d8608f5cc49f96b8d6e38c95d60c676/rpds_py-0.30.0-cp314-cp314t-win_amd64.whl", hash = "sha256:27f4b0e92de5bfbc6f86e43959e6edd1425c33b5e69aab0984a72047f2bcf1e3", size = 226532, upload-time = "2025-11-30T20:24:14.634Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ruff"
|
||||
version = "0.14.10"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/57/08/52232a877978dd8f9cf2aeddce3e611b40a63287dfca29b6b8da791f5e8d/ruff-0.14.10.tar.gz", hash = "sha256:9a2e830f075d1a42cd28420d7809ace390832a490ed0966fe373ba288e77aaf4", size = 5859763, upload-time = "2025-12-18T19:28:57.98Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/60/01/933704d69f3f05ee16ef11406b78881733c186fe14b6a46b05cfcaf6d3b2/ruff-0.14.10-py3-none-linux_armv6l.whl", hash = "sha256:7a3ce585f2ade3e1f29ec1b92df13e3da262178df8c8bdf876f48fa0e8316c49", size = 13527080, upload-time = "2025-12-18T19:29:25.642Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/df/58/a0349197a7dfa603ffb7f5b0470391efa79ddc327c1e29c4851e85b09cc5/ruff-0.14.10-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:674f9be9372907f7257c51f1d4fc902cb7cf014b9980152b802794317941f08f", size = 13797320, upload-time = "2025-12-18T19:29:02.571Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7b/82/36be59f00a6082e38c23536df4e71cdbc6af8d7c707eade97fcad5c98235/ruff-0.14.10-py3-none-macosx_11_0_arm64.whl", hash = "sha256:d85713d522348837ef9df8efca33ccb8bd6fcfc86a2cde3ccb4bc9d28a18003d", size = 12918434, upload-time = "2025-12-18T19:28:51.202Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a6/00/45c62a7f7e34da92a25804f813ebe05c88aa9e0c25e5cb5a7d23dd7450e3/ruff-0.14.10-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6987ebe0501ae4f4308d7d24e2d0fe3d7a98430f5adfd0f1fead050a740a3a77", size = 13371961, upload-time = "2025-12-18T19:29:04.991Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/40/31/a5906d60f0405f7e57045a70f2d57084a93ca7425f22e1d66904769d1628/ruff-0.14.10-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:16a01dfb7b9e4eee556fbfd5392806b1b8550c9b4a9f6acd3dbe6812b193c70a", size = 13275629, upload-time = "2025-12-18T19:29:21.381Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3e/60/61c0087df21894cf9d928dc04bcd4fb10e8b2e8dca7b1a276ba2155b2002/ruff-0.14.10-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7165d31a925b7a294465fa81be8c12a0e9b60fb02bf177e79067c867e71f8b1f", size = 14029234, upload-time = "2025-12-18T19:29:00.132Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/44/84/77d911bee3b92348b6e5dab5a0c898d87084ea03ac5dc708f46d88407def/ruff-0.14.10-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:c561695675b972effb0c0a45db233f2c816ff3da8dcfbe7dfc7eed625f218935", size = 15449890, upload-time = "2025-12-18T19:28:53.573Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e9/36/480206eaefa24a7ec321582dda580443a8f0671fdbf6b1c80e9c3e93a16a/ruff-0.14.10-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4bb98fcbbc61725968893682fd4df8966a34611239c9fd07a1f6a07e7103d08e", size = 15123172, upload-time = "2025-12-18T19:29:23.453Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5c/38/68e414156015ba80cef5473d57919d27dfb62ec804b96180bafdeaf0e090/ruff-0.14.10-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f24b47993a9d8cb858429e97bdf8544c78029f09b520af615c1d261bf827001d", size = 14460260, upload-time = "2025-12-18T19:29:27.808Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b3/19/9e050c0dca8aba824d67cc0db69fb459c28d8cd3f6855b1405b3f29cc91d/ruff-0.14.10-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:59aabd2e2c4fd614d2862e7939c34a532c04f1084476d6833dddef4afab87e9f", size = 14229978, upload-time = "2025-12-18T19:29:11.32Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/51/eb/e8dd1dd6e05b9e695aa9dd420f4577debdd0f87a5ff2fedda33c09e9be8c/ruff-0.14.10-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:213db2b2e44be8625002dbea33bb9c60c66ea2c07c084a00d55732689d697a7f", size = 14338036, upload-time = "2025-12-18T19:29:09.184Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6a/12/f3e3a505db7c19303b70af370d137795fcfec136d670d5de5391e295c134/ruff-0.14.10-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:b914c40ab64865a17a9a5b67911d14df72346a634527240039eb3bd650e5979d", size = 13264051, upload-time = "2025-12-18T19:29:13.431Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/08/64/8c3a47eaccfef8ac20e0484e68e0772013eb85802f8a9f7603ca751eb166/ruff-0.14.10-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:1484983559f026788e3a5c07c81ef7d1e97c1c78ed03041a18f75df104c45405", size = 13283998, upload-time = "2025-12-18T19:29:06.994Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/12/84/534a5506f4074e5cc0529e5cd96cfc01bb480e460c7edf5af70d2bcae55e/ruff-0.14.10-py3-none-musllinux_1_2_i686.whl", hash = "sha256:c70427132db492d25f982fffc8d6c7535cc2fd2c83fc8888f05caaa248521e60", size = 13601891, upload-time = "2025-12-18T19:28:55.811Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/0d/1e/14c916087d8598917dbad9b2921d340f7884824ad6e9c55de948a93b106d/ruff-0.14.10-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:5bcf45b681e9f1ee6445d317ce1fa9d6cba9a6049542d1c3d5b5958986be8830", size = 14336660, upload-time = "2025-12-18T19:29:16.531Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f2/1c/d7b67ab43f30013b47c12b42d1acd354c195351a3f7a1d67f59e54227ede/ruff-0.14.10-py3-none-win32.whl", hash = "sha256:104c49fc7ab73f3f3a758039adea978869a918f31b73280db175b43a2d9b51d6", size = 13196187, upload-time = "2025-12-18T19:29:19.006Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fb/9c/896c862e13886fae2af961bef3e6312db9ebc6adc2b156fe95e615dee8c1/ruff-0.14.10-py3-none-win_amd64.whl", hash = "sha256:466297bd73638c6bdf06485683e812db1c00c7ac96d4ddd0294a338c62fdc154", size = 14661283, upload-time = "2025-12-18T19:29:30.16Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/74/31/b0e29d572670dca3674eeee78e418f20bdf97fa8aa9ea71380885e175ca0/ruff-0.14.10-py3-none-win_arm64.whl", hash = "sha256:e51d046cf6dda98a4633b8a8a771451107413b0f07183b2bef03f075599e44e6", size = 13729839, upload-time = "2025-12-18T19:28:48.636Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sse-starlette"
|
||||
version = "3.1.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "anyio" },
|
||||
{ name = "starlette" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/da/34/f5df66cb383efdbf4f2db23cabb27f51b1dcb737efaf8a558f6f1d195134/sse_starlette-3.1.2.tar.gz", hash = "sha256:55eff034207a83a0eb86de9a68099bd0157838f0b8b999a1b742005c71e33618", size = 26303, upload-time = "2025-12-31T08:02:20.023Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/b7/95/8c4b76eec9ae574474e5d2997557cebf764bcd3586458956c30631ae08f4/sse_starlette-3.1.2-py3-none-any.whl", hash = "sha256:cd800dd349f4521b317b9391d3796fa97b71748a4da9b9e00aafab32dda375c8", size = 12484, upload-time = "2025-12-31T08:02:18.894Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "starlette"
|
||||
version = "0.50.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "anyio" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ba/b8/73a0e6a6e079a9d9cfa64113d771e421640b6f679a52eeb9b32f72d871a1/starlette-0.50.0.tar.gz", hash = "sha256:a2a17b22203254bcbc2e1f926d2d55f3f9497f769416b3190768befe598fa3ca", size = 2646985, upload-time = "2025-11-01T15:25:27.516Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d9/52/1064f510b141bd54025f9b55105e26d1fa970b9be67ad766380a3c9b74b0/starlette-0.50.0-py3-none-any.whl", hash = "sha256:9e5391843ec9b6e472eed1365a78c8098cfceb7a74bfd4d6b1c0c0095efb3bca", size = 74033, upload-time = "2025-11-01T15:25:25.461Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typing-extensions"
|
||||
version = "4.15.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/72/94/1a15dd82efb362ac84269196e94cf00f187f7ed21c242792a923cdb1c61f/typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466", size = 109391, upload-time = "2025-08-25T13:49:26.313Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/18/67/36e9267722cc04a6b9f15c7f3441c2363321a3ea07da7ae0c0707beb2a9c/typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548", size = 44614, upload-time = "2025-08-25T13:49:24.86Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typing-inspection"
|
||||
version = "0.4.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/55/e3/70399cb7dd41c10ac53367ae42139cf4b1ca5f36bb3dc6c9d33acdb43655/typing_inspection-0.4.2.tar.gz", hash = "sha256:ba561c48a67c5958007083d386c3295464928b01faa735ab8547c5692e87f464", size = 75949, upload-time = "2025-10-01T02:14:41.687Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/dc/9b/47798a6c91d8bdb567fe2698fe81e0c6b7cb7ef4d13da4114b41d239f65d/typing_inspection-0.4.2-py3-none-any.whl", hash = "sha256:4ed1cacbdc298c220f1bd249ed5287caa16f34d44ef4e9c3d0cbad5b521545e7", size = 14611, upload-time = "2025-10-01T02:14:40.154Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uvicorn"
|
||||
version = "0.40.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "click" },
|
||||
{ name = "h11" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/c3/d1/8f3c683c9561a4e6689dd3b1d345c815f10f86acd044ee1fb9a4dcd0b8c5/uvicorn-0.40.0.tar.gz", hash = "sha256:839676675e87e73694518b5574fd0f24c9d97b46bea16df7b8c05ea1a51071ea", size = 81761, upload-time = "2025-12-21T14:16:22.45Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/3d/d8/2083a1daa7439a66f3a48589a57d576aa117726762618f6bb09fe3798796/uvicorn-0.40.0-py3-none-any.whl", hash = "sha256:c6c8f55bc8bf13eb6fa9ff87ad62308bbbc33d0b67f84293151efe87e0d5f2ee", size = 68502, upload-time = "2025-12-21T14:16:21.041Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xer-mcp"
|
||||
version = "0.1.0"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "mcp" },
|
||||
]
|
||||
|
||||
[package.optional-dependencies]
|
||||
dev = [
|
||||
{ name = "pytest" },
|
||||
{ name = "pytest-asyncio" },
|
||||
{ name = "ruff" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "mcp", specifier = ">=1.0.0" },
|
||||
{ name = "pytest", marker = "extra == 'dev'", specifier = ">=8.0.0" },
|
||||
{ name = "pytest-asyncio", marker = "extra == 'dev'", specifier = ">=0.24.0" },
|
||||
{ name = "ruff", marker = "extra == 'dev'", specifier = ">=0.8.0" },
|
||||
]
|
||||
provides-extras = ["dev"]
|
||||
Reference in New Issue
Block a user