agentme 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/.github/agents/speckit.analyze.agent.md +184 -0
  2. package/.github/agents/speckit.checklist.agent.md +295 -0
  3. package/.github/agents/speckit.clarify.agent.md +181 -0
  4. package/.github/agents/speckit.constitution.agent.md +84 -0
  5. package/.github/agents/speckit.implement.agent.md +198 -0
  6. package/.github/agents/speckit.plan.agent.md +90 -0
  7. package/.github/agents/speckit.specify.agent.md +237 -0
  8. package/.github/agents/speckit.tasks.agent.md +200 -0
  9. package/.github/agents/speckit.taskstoissues.agent.md +30 -0
  10. package/.github/prompts/speckit.analyze.prompt.md +3 -0
  11. package/.github/prompts/speckit.checklist.prompt.md +3 -0
  12. package/.github/prompts/speckit.clarify.prompt.md +3 -0
  13. package/.github/prompts/speckit.constitution.prompt.md +3 -0
  14. package/.github/prompts/speckit.implement.prompt.md +3 -0
  15. package/.github/prompts/speckit.plan.prompt.md +3 -0
  16. package/.github/prompts/speckit.specify.prompt.md +3 -0
  17. package/.github/prompts/speckit.tasks.prompt.md +3 -0
  18. package/.github/prompts/speckit.taskstoissues.prompt.md +3 -0
  19. package/.specify/memory/constitution.md +119 -0
  20. package/.specify/scripts/bash/check-prerequisites.sh +190 -0
  21. package/.specify/scripts/bash/common.sh +253 -0
  22. package/.specify/scripts/bash/create-new-feature.sh +333 -0
  23. package/.specify/scripts/bash/setup-plan.sh +73 -0
  24. package/.specify/scripts/bash/update-agent-context.sh +808 -0
  25. package/.specify/templates/agent-file-template.md +28 -0
  26. package/.specify/templates/checklist-template.md +40 -0
  27. package/.specify/templates/constitution-template.md +50 -0
  28. package/.specify/templates/plan-template.md +110 -0
  29. package/.specify/templates/spec-template.md +115 -0
  30. package/.specify/templates/tasks-template.md +251 -0
  31. package/.vscode/settings.json +14 -0
  32. package/.xdrs/agentme/edrs/application/003-javascript-project-tooling.md +89 -0
  33. package/.xdrs/agentme/edrs/application/010-golang-project-tooling.md +141 -0
  34. package/.xdrs/agentme/edrs/application/skills/001-create-javascript-project/SKILL.md +360 -0
  35. package/.xdrs/agentme/edrs/application/skills/003-create-golang-project/SKILL.md +311 -0
  36. package/.xdrs/agentme/edrs/devops/005-monorepo-structure.md +104 -0
  37. package/.xdrs/agentme/edrs/devops/006-github-pipelines.md +170 -0
  38. package/.xdrs/agentme/edrs/devops/008-common-targets.md +207 -0
  39. package/.xdrs/agentme/edrs/devops/skills/002-monorepo-setup/SKILL.md +270 -0
  40. package/.xdrs/agentme/edrs/index.md +41 -0
  41. package/.xdrs/agentme/edrs/observability/011-service-health-check-endpoint.md +78 -0
  42. package/.xdrs/agentme/edrs/principles/002-coding-best-practices.md +110 -0
  43. package/.xdrs/agentme/edrs/principles/004-unit-test-requirements.md +97 -0
  44. package/.xdrs/agentme/edrs/principles/007-project-quality-standards.md +156 -0
  45. package/.xdrs/agentme/edrs/principles/009-error-handling.md +327 -0
  46. package/.xdrs/index.md +32 -0
  47. package/README.md +119 -0
  48. package/bin/npmdata.js +3 -0
  49. package/package.json +102 -0
@@ -0,0 +1,200 @@
1
+ ---
2
+ description: Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts.
3
+ handoffs:
4
+ - label: Analyze For Consistency
5
+ agent: speckit.analyze
6
+ prompt: Run a project analysis for consistency
7
+ send: true
8
+ - label: Implement Project
9
+ agent: speckit.implement
10
+ prompt: Start the implementation in phases
11
+ send: true
12
+ ---
13
+
14
+ ## User Input
15
+
16
+ ```text
17
+ $ARGUMENTS
18
+ ```
19
+
20
+ You **MUST** consider the user input before proceeding (if not empty).
21
+
22
+ ## Pre-Execution Checks
23
+
24
+ **Check for extension hooks (before tasks generation)**:
25
+ - Check if `.specify/extensions.yml` exists in the project root.
26
+ - If it exists, read it and look for entries under the `hooks.before_tasks` key
27
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
28
+ - Filter to only hooks where `enabled: true`
29
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
30
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
31
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
32
+ - For each executable hook, output the following based on its `optional` flag:
33
+ - **Optional hook** (`optional: true`):
34
+ ```
35
+ ## Extension Hooks
36
+
37
+ **Optional Pre-Hook**: {extension}
38
+ Command: `/{command}`
39
+ Description: {description}
40
+
41
+ Prompt: {prompt}
42
+ To execute: `/{command}`
43
+ ```
44
+ - **Mandatory hook** (`optional: false`):
45
+ ```
46
+ ## Extension Hooks
47
+
48
+ **Automatic Pre-Hook**: {extension}
49
+ Executing: `/{command}`
50
+ EXECUTE_COMMAND: {command}
51
+
52
+ Wait for the result of the hook command before proceeding to the Outline.
53
+ ```
54
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
55
+
56
+ ## Outline
57
+
58
+ 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").
59
+
60
+ 2. **Load design documents**: Read from FEATURE_DIR:
61
+ - **Required**: plan.md (tech stack, libraries, structure), spec.md (user stories with priorities)
62
+ - **Optional**: data-model.md (entities), contracts/ (interface contracts), research.md (decisions), quickstart.md (test scenarios)
63
+ - Note: Not all projects have all documents. Generate tasks based on what's available.
64
+
65
+ 3. **Execute task generation workflow**:
66
+ - Load plan.md and extract tech stack, libraries, project structure
67
+ - Load spec.md and extract user stories with their priorities (P1, P2, P3, etc.)
68
+ - If data-model.md exists: Extract entities and map to user stories
69
+ - If contracts/ exists: Map interface contracts to user stories
70
+ - If research.md exists: Extract decisions for setup tasks
71
+ - Generate tasks organized by user story (see Task Generation Rules below)
72
+ - Generate dependency graph showing user story completion order
73
+ - Create parallel execution examples per user story
74
+ - Validate task completeness (each user story has all needed tasks, independently testable)
75
+
76
+ 4. **Generate tasks.md**: Use `.specify/templates/tasks-template.md` as structure, fill with:
77
+ - Correct feature name from plan.md
78
+ - Phase 1: Setup tasks (project initialization)
79
+ - Phase 2: Foundational tasks (blocking prerequisites for all user stories)
80
+ - Phase 3+: One phase per user story (in priority order from spec.md)
81
+ - Each phase includes: story goal, independent test criteria, tests (if requested), implementation tasks
82
+ - Final Phase: Polish & cross-cutting concerns
83
+ - All tasks must follow the strict checklist format (see Task Generation Rules below)
84
+ - Clear file paths for each task
85
+ - Dependencies section showing story completion order
86
+ - Parallel execution examples per story
87
+ - Implementation strategy section (MVP first, incremental delivery)
88
+
89
+ 5. **Report**: Output path to generated tasks.md and summary:
90
+ - Total task count
91
+ - Task count per user story
92
+ - Parallel opportunities identified
93
+ - Independent test criteria for each story
94
+ - Suggested MVP scope (typically just User Story 1)
95
+ - Format validation: Confirm ALL tasks follow the checklist format (checkbox, ID, labels, file paths)
96
+
97
+ 6. **Check for extension hooks**: After tasks.md is generated, check if `.specify/extensions.yml` exists in the project root.
98
+ - If it exists, read it and look for entries under the `hooks.after_tasks` key
99
+ - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
100
+ - Filter to only hooks where `enabled: true`
101
+ - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
102
+ - If the hook has no `condition` field, or it is null/empty, treat the hook as executable
103
+ - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
104
+ - For each executable hook, output the following based on its `optional` flag:
105
+ - **Optional hook** (`optional: true`):
106
+ ```
107
+ ## Extension Hooks
108
+
109
+ **Optional Hook**: {extension}
110
+ Command: `/{command}`
111
+ Description: {description}
112
+
113
+ Prompt: {prompt}
114
+ To execute: `/{command}`
115
+ ```
116
+ - **Mandatory hook** (`optional: false`):
117
+ ```
118
+ ## Extension Hooks
119
+
120
+ **Automatic Hook**: {extension}
121
+ Executing: `/{command}`
122
+ EXECUTE_COMMAND: {command}
123
+ ```
124
+ - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
125
+
126
+ Context for task generation: $ARGUMENTS
127
+
128
+ The tasks.md should be immediately executable - each task must be specific enough that an LLM can complete it without additional context.
129
+
130
+ ## Task Generation Rules
131
+
132
+ **CRITICAL**: Tasks MUST be organized by user story to enable independent implementation and testing.
133
+
134
+ **Tests are OPTIONAL**: Only generate test tasks if explicitly requested in the feature specification or if user requests TDD approach.
135
+
136
+ ### Checklist Format (REQUIRED)
137
+
138
+ Every task MUST strictly follow this format:
139
+
140
+ ```text
141
+ - [ ] [TaskID] [P?] [Story?] Description with file path
142
+ ```
143
+
144
+ **Format Components**:
145
+
146
+ 1. **Checkbox**: ALWAYS start with `- [ ]` (markdown checkbox)
147
+ 2. **Task ID**: Sequential number (T001, T002, T003...) in execution order
148
+ 3. **[P] marker**: Include ONLY if task is parallelizable (different files, no dependencies on incomplete tasks)
149
+ 4. **[Story] label**: REQUIRED for user story phase tasks only
150
+ - Format: [US1], [US2], [US3], etc. (maps to user stories from spec.md)
151
+ - Setup phase: NO story label
152
+ - Foundational phase: NO story label
153
+ - User Story phases: MUST have story label
154
+ - Polish phase: NO story label
155
+ 5. **Description**: Clear action with exact file path
156
+
157
+ **Examples**:
158
+
159
+ - ✅ CORRECT: `- [ ] T001 Create project structure per implementation plan`
160
+ - ✅ CORRECT: `- [ ] T005 [P] Implement authentication middleware in src/middleware/auth.py`
161
+ - ✅ CORRECT: `- [ ] T012 [P] [US1] Create User model in src/models/user.py`
162
+ - ✅ CORRECT: `- [ ] T014 [US1] Implement UserService in src/services/user_service.py`
163
+ - ❌ WRONG: `- [ ] Create User model` (missing ID and Story label)
164
+ - ❌ WRONG: `T001 [US1] Create model` (missing checkbox)
165
+ - ❌ WRONG: `- [ ] [US1] Create User model` (missing Task ID)
166
+ - ❌ WRONG: `- [ ] T001 [US1] Create model` (missing file path)
167
+
168
+ ### Task Organization
169
+
170
+ 1. **From User Stories (spec.md)** - PRIMARY ORGANIZATION:
171
+ - Each user story (P1, P2, P3...) gets its own phase
172
+ - Map all related components to their story:
173
+ - Models needed for that story
174
+ - Services needed for that story
175
+ - Interfaces/UI needed for that story
176
+ - If tests requested: Tests specific to that story
177
+ - Mark story dependencies (most stories should be independent)
178
+
179
+ 2. **From Contracts**:
180
+ - Map each interface contract → to the user story it serves
181
+ - If tests requested: Each interface contract → contract test task [P] before implementation in that story's phase
182
+
183
+ 3. **From Data Model**:
184
+ - Map each entity to the user story(ies) that need it
185
+ - If entity serves multiple stories: Put in earliest story or Setup phase
186
+ - Relationships → service layer tasks in appropriate story phase
187
+
188
+ 4. **From Setup/Infrastructure**:
189
+ - Shared infrastructure → Setup phase (Phase 1)
190
+ - Foundational/blocking tasks → Foundational phase (Phase 2)
191
+ - Story-specific setup → within that story's phase
192
+
193
+ ### Phase Structure
194
+
195
+ - **Phase 1**: Setup (project initialization)
196
+ - **Phase 2**: Foundational (blocking prerequisites - MUST complete before user stories)
197
+ - **Phase 3+**: User Stories in priority order (P1, P2, P3...)
198
+ - Within each story: Tests (if requested) → Models → Services → Endpoints → Integration
199
+ - Each phase should be a complete, independently testable increment
200
+ - **Final Phase**: Polish & Cross-Cutting Concerns
@@ -0,0 +1,30 @@
1
+ ---
2
+ description: Convert existing tasks into actionable, dependency-ordered GitHub issues for the feature based on available design artifacts.
3
+ tools: ['github/github-mcp-server/issue_write']
4
+ ---
5
+
6
+ ## User Input
7
+
8
+ ```text
9
+ $ARGUMENTS
10
+ ```
11
+
12
+ You **MUST** consider the user input before proceeding (if not empty).
13
+
14
+ ## Outline
15
+
16
+ 1. Run `.specify/scripts/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").
17
+ 1. From the executed script, extract the path to **tasks**.
18
+ 1. Get the Git remote by running:
19
+
20
+ ```bash
21
+ git config --get remote.origin.url
22
+ ```
23
+
24
+ > [!CAUTION]
25
+ > ONLY PROCEED TO NEXT STEPS IF THE REMOTE IS A GITHUB URL
26
+
27
+ 1. For each task in the list, use the GitHub MCP server to create a new issue in the repository that is representative of the Git remote.
28
+
29
+ > [!CAUTION]
30
+ > UNDER NO CIRCUMSTANCES EVER CREATE ISSUES IN REPOSITORIES THAT DO NOT MATCH THE REMOTE URL
@@ -0,0 +1,3 @@
1
+ ---
2
+ agent: speckit.analyze
3
+ ---
@@ -0,0 +1,3 @@
1
+ ---
2
+ agent: speckit.checklist
3
+ ---
@@ -0,0 +1,3 @@
1
+ ---
2
+ agent: speckit.clarify
3
+ ---
@@ -0,0 +1,3 @@
1
+ ---
2
+ agent: speckit.constitution
3
+ ---
@@ -0,0 +1,3 @@
1
+ ---
2
+ agent: speckit.implement
3
+ ---
@@ -0,0 +1,3 @@
1
+ ---
2
+ agent: speckit.plan
3
+ ---
@@ -0,0 +1,3 @@
1
+ ---
2
+ agent: speckit.specify
3
+ ---
@@ -0,0 +1,3 @@
1
+ ---
2
+ agent: speckit.tasks
3
+ ---
@@ -0,0 +1,3 @@
1
+ ---
2
+ agent: speckit.taskstoissues
3
+ ---
@@ -0,0 +1,119 @@
1
+ <!--
2
+ SYNC IMPACT REPORT
3
+ ==================
4
+ Version change: (none) → 1.0.0 (MINOR: initial population of constitution)
5
+
6
+ Added sections:
7
+ - Core Principles (I through V)
8
+ - Quality Requirements
9
+ - Development Workflow
10
+ - Governance
11
+
12
+ Modified principles: N/A (first version)
13
+ Removed sections: N/A (first version)
14
+
15
+ Templates checked:
16
+ - .specify/templates/plan-template.md ✅ "Constitution Check" gate already present
17
+ - .specify/templates/spec-template.md ✅ no constitution-specific sections required
18
+ - .specify/templates/tasks-template.md ✅ generic task categories compatible
19
+
20
+ Related XDRs created:
21
+ - .xdrs/_local/bdrs/index.md ✅ created
22
+ - .xdrs/_local/bdrs/principles/001-agentme-product-purpose.md ✅ created
23
+
24
+ Follow-up TODOs: none
25
+ -->
26
+
27
+ # agentme Constitution
28
+
29
+ ## Core Principles
30
+
31
+ ### I. XDR-First Knowledge Base
32
+
33
+ Every design decision, product requirement, and engineering convention MUST be captured in an XDR
34
+ before it is acted on. Specs and plans produced by speckit are temporary work products and may be
35
+ deleted after a feature ships. XDRs are permanent and form the living knowledge base used for
36
+ vibe coding, onboarding, and future feature development.
37
+
38
+ - BDRs capture product purpose, business rules, and consumer workflows.
39
+ - ADRs capture architectural context and cross-cutting patterns.
40
+ - EDRs capture concrete engineering decisions: tooling, structure, practices.
41
+ - Every non-trivial implementation decision MUST have a corresponding XDR entry in `_local` or
42
+ `agentme` scope before the implementation task is marked complete.
43
+
44
+ ### II. Preset Integrity (NON-NEGOTIABLE)
45
+
46
+ agentme distributes files to consumer projects via named presets (`basic`, `speckit`). Each
47
+ preset MUST be independently coherent, non-overlapping, and verified on every build.
48
+
49
+ - A preset MUST contain all files a consumer needs and nothing more.
50
+ - Presets MUST NOT share extraction sets unless the consumer explicitly requests multiple presets.
51
+ - The `examples/` folder MUST assert the exact file presence/absence for each preset combination
52
+ after every `make build`.
53
+ - Adding a file to a preset or changing selector patterns is a public API change and requires a
54
+ version bump (MINOR or MAJOR depending on impact).
55
+
56
+ ### III. Consumer-First API Discipline
57
+
58
+ XDRs, skills, and preset file sets are a public API consumed by external projects. Changes MUST
59
+ respect semantic versioning.
60
+
61
+ - MAJOR: removing or renaming a preset, removing or restructuring an XDR that external consumers
62
+ reference, or any change that requires consumer-side migration.
63
+ - MINOR: adding a new preset, adding XDRs or skills, adding files to an existing preset.
64
+ - PATCH: wording, clarifications, typo fixes inside XDRs or skills that carry no structural change.
65
+ - Breaking changes MUST be documented in the release notes and in the relevant XDR's `Conflicts`
66
+ or `Implementation Details` section before merging.
67
+
68
+ ### IV. Self-Contained Artifacts
69
+
70
+ Every XDR and skill MUST work without any implicit context outside itself.
71
+
72
+ - XDRs MUST be under 100 lines (hard limit 200 for templates and elaborate decisions).
73
+ - Skills MUST be under 500 lines; lengthy reference material goes in `references/`.
74
+ - Internal cross-references MUST use relative file paths; no absolute or external URLs without
75
+ explanation.
76
+ - A consumer reading an XDR or skill for the first time MUST be able to follow it without
77
+ accessing other systems.
78
+
79
+ ### V. Simplicity and Verified Quality
80
+
81
+ The simplest solution that passes all tests is always preferred. Quality gates are non-negotiable.
82
+
83
+ - `make test` MUST pass before any release; failures block publish.
84
+ - Linting MUST be clean (`make lint-fix`) before merging.
85
+ - Files MUST NOT exceed 400 lines (test files excepted).
86
+ - No feature scope creep: implement only what the current spec requires.
87
+ - Avoid adding error handling, fallbacks, or abstractions for hypothetical future scenarios.
88
+
89
+ ## Quality Requirements
90
+
91
+ - `make test` in `examples/` MUST verify all preset extraction scenarios end-to-end.
92
+ - XDRs produced during a feature MUST be reviewed for non-conflict before merging.
93
+ - All XDR indexes (`_local`, `agentme`, `_core`) MUST be updated before a PR is merged.
94
+ - New presets or selector changes MUST include updated test assertions in the examples Makefile.
95
+
96
+ ## Development Workflow
97
+
98
+ 1. Before starting a feature: check existing XDRs for applicable decisions.
99
+ 2. During specifying (`speckit.specify`): capture business requirements as BDRs in `_local`.
100
+ 3. During planning (`speckit.plan`): update or create ADRs and EDRs in `_local` that reflect
101
+ architectural and engineering decisions made during the planning phase.
102
+ 4. During implementation: follow XDRs; create new `_local` XDRs for decisions not yet captured.
103
+ 5. After implementation: delete feature specs and plans; XDRs remain permanently.
104
+ 6. Runtime guidance: see `.xdrs/index.md` and all linked scope indexes.
105
+
106
+ ## Governance
107
+
108
+ This constitution supersedes all other development practices within this repository. Amendments
109
+ require:
110
+ 1. A version bump following semantic versioning rules stated in Principle III.
111
+ 2. An updated `LAST_AMENDED_DATE` in this file.
112
+ 3. A review of all five principles for continued non-conflict.
113
+ 4. An updated Sync Impact Report (HTML comment at the top of this file).
114
+
115
+ All PRs MUST include a "Constitution Check" section confirming compliance with all five principles.
116
+ Complexity MUST be justified; if a solution requires deviation from a principle, that deviation
117
+ MUST be documented in a new or updated XDR in `_local`.
118
+
119
+ **Version**: 1.0.0 | **Ratified**: 2026-03-14 | **Last Amended**: 2026-03-14
@@ -0,0 +1,190 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Consolidated prerequisite checking script
4
+ #
5
+ # This script provides unified prerequisite checking for Spec-Driven Development workflow.
6
+ # It replaces the functionality previously spread across multiple scripts.
7
+ #
8
+ # Usage: ./check-prerequisites.sh [OPTIONS]
9
+ #
10
+ # OPTIONS:
11
+ # --json Output in JSON format
12
+ # --require-tasks Require tasks.md to exist (for implementation phase)
13
+ # --include-tasks Include tasks.md in AVAILABLE_DOCS list
14
+ # --paths-only Only output path variables (no validation)
15
+ # --help, -h Show help message
16
+ #
17
+ # OUTPUTS:
18
+ # JSON mode: {"FEATURE_DIR":"...", "AVAILABLE_DOCS":["..."]}
19
+ # Text mode: FEATURE_DIR:... \n AVAILABLE_DOCS: \n ✓/✗ file.md
20
+ # Paths only: REPO_ROOT: ... \n BRANCH: ... \n FEATURE_DIR: ... etc.
21
+
22
+ set -e
23
+
24
+ # Parse command line arguments
25
+ JSON_MODE=false
26
+ REQUIRE_TASKS=false
27
+ INCLUDE_TASKS=false
28
+ PATHS_ONLY=false
29
+
30
+ for arg in "$@"; do
31
+ case "$arg" in
32
+ --json)
33
+ JSON_MODE=true
34
+ ;;
35
+ --require-tasks)
36
+ REQUIRE_TASKS=true
37
+ ;;
38
+ --include-tasks)
39
+ INCLUDE_TASKS=true
40
+ ;;
41
+ --paths-only)
42
+ PATHS_ONLY=true
43
+ ;;
44
+ --help|-h)
45
+ cat << 'EOF'
46
+ Usage: check-prerequisites.sh [OPTIONS]
47
+
48
+ Consolidated prerequisite checking for Spec-Driven Development workflow.
49
+
50
+ OPTIONS:
51
+ --json Output in JSON format
52
+ --require-tasks Require tasks.md to exist (for implementation phase)
53
+ --include-tasks Include tasks.md in AVAILABLE_DOCS list
54
+ --paths-only Only output path variables (no prerequisite validation)
55
+ --help, -h Show this help message
56
+
57
+ EXAMPLES:
58
+ # Check task prerequisites (plan.md required)
59
+ ./check-prerequisites.sh --json
60
+
61
+ # Check implementation prerequisites (plan.md + tasks.md required)
62
+ ./check-prerequisites.sh --json --require-tasks --include-tasks
63
+
64
+ # Get feature paths only (no validation)
65
+ ./check-prerequisites.sh --paths-only
66
+
67
+ EOF
68
+ exit 0
69
+ ;;
70
+ *)
71
+ echo "ERROR: Unknown option '$arg'. Use --help for usage information." >&2
72
+ exit 1
73
+ ;;
74
+ esac
75
+ done
76
+
77
+ # Source common functions
78
+ SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
79
+ source "$SCRIPT_DIR/common.sh"
80
+
81
+ # Get feature paths and validate branch
82
+ _paths_output=$(get_feature_paths) || { echo "ERROR: Failed to resolve feature paths" >&2; exit 1; }
83
+ eval "$_paths_output"
84
+ unset _paths_output
85
+ check_feature_branch "$CURRENT_BRANCH" "$HAS_GIT" || exit 1
86
+
87
+ # If paths-only mode, output paths and exit (support JSON + paths-only combined)
88
+ if $PATHS_ONLY; then
89
+ if $JSON_MODE; then
90
+ # Minimal JSON paths payload (no validation performed)
91
+ if has_jq; then
92
+ jq -cn \
93
+ --arg repo_root "$REPO_ROOT" \
94
+ --arg branch "$CURRENT_BRANCH" \
95
+ --arg feature_dir "$FEATURE_DIR" \
96
+ --arg feature_spec "$FEATURE_SPEC" \
97
+ --arg impl_plan "$IMPL_PLAN" \
98
+ --arg tasks "$TASKS" \
99
+ '{REPO_ROOT:$repo_root,BRANCH:$branch,FEATURE_DIR:$feature_dir,FEATURE_SPEC:$feature_spec,IMPL_PLAN:$impl_plan,TASKS:$tasks}'
100
+ else
101
+ printf '{"REPO_ROOT":"%s","BRANCH":"%s","FEATURE_DIR":"%s","FEATURE_SPEC":"%s","IMPL_PLAN":"%s","TASKS":"%s"}\n' \
102
+ "$(json_escape "$REPO_ROOT")" "$(json_escape "$CURRENT_BRANCH")" "$(json_escape "$FEATURE_DIR")" "$(json_escape "$FEATURE_SPEC")" "$(json_escape "$IMPL_PLAN")" "$(json_escape "$TASKS")"
103
+ fi
104
+ else
105
+ echo "REPO_ROOT: $REPO_ROOT"
106
+ echo "BRANCH: $CURRENT_BRANCH"
107
+ echo "FEATURE_DIR: $FEATURE_DIR"
108
+ echo "FEATURE_SPEC: $FEATURE_SPEC"
109
+ echo "IMPL_PLAN: $IMPL_PLAN"
110
+ echo "TASKS: $TASKS"
111
+ fi
112
+ exit 0
113
+ fi
114
+
115
+ # Validate required directories and files
116
+ if [[ ! -d "$FEATURE_DIR" ]]; then
117
+ echo "ERROR: Feature directory not found: $FEATURE_DIR" >&2
118
+ echo "Run /speckit.specify first to create the feature structure." >&2
119
+ exit 1
120
+ fi
121
+
122
+ if [[ ! -f "$IMPL_PLAN" ]]; then
123
+ echo "ERROR: plan.md not found in $FEATURE_DIR" >&2
124
+ echo "Run /speckit.plan first to create the implementation plan." >&2
125
+ exit 1
126
+ fi
127
+
128
+ # Check for tasks.md if required
129
+ if $REQUIRE_TASKS && [[ ! -f "$TASKS" ]]; then
130
+ echo "ERROR: tasks.md not found in $FEATURE_DIR" >&2
131
+ echo "Run /speckit.tasks first to create the task list." >&2
132
+ exit 1
133
+ fi
134
+
135
+ # Build list of available documents
136
+ docs=()
137
+
138
+ # Always check these optional docs
139
+ [[ -f "$RESEARCH" ]] && docs+=("research.md")
140
+ [[ -f "$DATA_MODEL" ]] && docs+=("data-model.md")
141
+
142
+ # Check contracts directory (only if it exists and has files)
143
+ if [[ -d "$CONTRACTS_DIR" ]] && [[ -n "$(ls -A "$CONTRACTS_DIR" 2>/dev/null)" ]]; then
144
+ docs+=("contracts/")
145
+ fi
146
+
147
+ [[ -f "$QUICKSTART" ]] && docs+=("quickstart.md")
148
+
149
+ # Include tasks.md if requested and it exists
150
+ if $INCLUDE_TASKS && [[ -f "$TASKS" ]]; then
151
+ docs+=("tasks.md")
152
+ fi
153
+
154
+ # Output results
155
+ if $JSON_MODE; then
156
+ # Build JSON array of documents
157
+ if has_jq; then
158
+ if [[ ${#docs[@]} -eq 0 ]]; then
159
+ json_docs="[]"
160
+ else
161
+ json_docs=$(printf '%s\n' "${docs[@]}" | jq -R . | jq -s .)
162
+ fi
163
+ jq -cn \
164
+ --arg feature_dir "$FEATURE_DIR" \
165
+ --argjson docs "$json_docs" \
166
+ '{FEATURE_DIR:$feature_dir,AVAILABLE_DOCS:$docs}'
167
+ else
168
+ if [[ ${#docs[@]} -eq 0 ]]; then
169
+ json_docs="[]"
170
+ else
171
+ json_docs=$(printf '"%s",' "${docs[@]}")
172
+ json_docs="[${json_docs%,}]"
173
+ fi
174
+ printf '{"FEATURE_DIR":"%s","AVAILABLE_DOCS":%s}\n' "$(json_escape "$FEATURE_DIR")" "$json_docs"
175
+ fi
176
+ else
177
+ # Text output
178
+ echo "FEATURE_DIR:$FEATURE_DIR"
179
+ echo "AVAILABLE_DOCS:"
180
+
181
+ # Show status of each potential document
182
+ check_file "$RESEARCH" "research.md"
183
+ check_file "$DATA_MODEL" "data-model.md"
184
+ check_dir "$CONTRACTS_DIR" "contracts/"
185
+ check_file "$QUICKSTART" "quickstart.md"
186
+
187
+ if $INCLUDE_TASKS; then
188
+ check_file "$TASKS" "tasks.md"
189
+ fi
190
+ fi