@jaguilar87/gaia-ops 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +315 -0
  2. package/CLAUDE.md +154 -0
  3. package/LICENSE +21 -0
  4. package/README.md +221 -0
  5. package/agents/aws-troubleshooter.md +50 -0
  6. package/agents/claude-architect.md +821 -0
  7. package/agents/devops-developer.md +92 -0
  8. package/agents/gcp-troubleshooter.md +50 -0
  9. package/agents/gitops-operator.md +360 -0
  10. package/agents/terraform-architect.md +289 -0
  11. package/bin/gaia-init.js +620 -0
  12. package/commands/architect.md +97 -0
  13. package/commands/restore-session.md +87 -0
  14. package/commands/save-session.md +88 -0
  15. package/commands/session-status.md +61 -0
  16. package/commands/speckit.add-task.md +144 -0
  17. package/commands/speckit.analyze-task.md +65 -0
  18. package/commands/speckit.implement.md +96 -0
  19. package/commands/speckit.init.md +237 -0
  20. package/commands/speckit.plan.md +88 -0
  21. package/commands/speckit.specify.md +161 -0
  22. package/commands/speckit.tasks.md +188 -0
  23. package/config/AGENTS.md +162 -0
  24. package/config/agent-catalog.md +604 -0
  25. package/config/context-contracts.md +682 -0
  26. package/config/git-standards.md +674 -0
  27. package/config/git_standards.json +69 -0
  28. package/config/orchestration-workflow.md +735 -0
  29. package/hooks/__pycache__/post_tool_use.cpython-312.pyc +0 -0
  30. package/hooks/__pycache__/pre_kubectl_security.cpython-312.pyc +0 -0
  31. package/hooks/__pycache__/pre_tool_use.cpython-312.pyc +0 -0
  32. package/hooks/__pycache__/session_start.cpython-312.pyc +0 -0
  33. package/hooks/__pycache__/subagent_stop.cpython-312.pyc +0 -0
  34. package/hooks/post_tool_use.py +463 -0
  35. package/hooks/pre_kubectl_security.py +205 -0
  36. package/hooks/pre_tool_use.py +530 -0
  37. package/hooks/session_start.py +315 -0
  38. package/hooks/subagent_stop.py +549 -0
  39. package/index.js +92 -0
  40. package/package.json +59 -0
  41. package/speckit/README.en.md +648 -0
  42. package/speckit/README.md +353 -0
  43. package/speckit/governance.md +169 -0
  44. package/speckit/scripts/check-prerequisites.sh +194 -0
  45. package/speckit/scripts/common.sh +126 -0
  46. package/speckit/scripts/create-new-feature.sh +131 -0
  47. package/speckit/scripts/init.sh +42 -0
  48. package/speckit/scripts/setup-plan.sh +95 -0
  49. package/speckit/scripts/update-agent-context.sh +718 -0
  50. package/speckit/templates/adr-template.md +118 -0
  51. package/speckit/templates/agent-file-template.md +23 -0
  52. package/speckit/templates/plan-template.md +233 -0
  53. package/speckit/templates/spec-template.md +116 -0
  54. package/speckit/templates/tasks-template-bkp.md +136 -0
  55. package/speckit/templates/tasks-template.md +345 -0
  56. package/templates/CLAUDE.template.md +170 -0
  57. package/templates/code-examples/approval_gate_workflow.py +141 -0
  58. package/templates/code-examples/clarification_workflow.py +94 -0
  59. package/templates/code-examples/commit_validation.py +86 -0
  60. package/templates/project-context.template.json +126 -0
  61. package/templates/settings.template.json +307 -0
  62. package/tools/__pycache__/agent_router.cpython-312.pyc +0 -0
  63. package/tools/__pycache__/approval_gate.cpython-312.pyc +0 -0
  64. package/tools/__pycache__/clarify_engine.cpython-312.pyc +0 -0
  65. package/tools/__pycache__/clarify_patterns.cpython-312.pyc +0 -0
  66. package/tools/__pycache__/commit_validator.cpython-312.pyc +0 -0
  67. package/tools/__pycache__/context_section_reader.cpython-312.pyc +0 -0
  68. package/tools/__pycache__/routing_dashboard.cpython-312.pyc +0 -0
  69. package/tools/__pycache__/routing_feedback.cpython-312.pyc +0 -0
  70. package/tools/__pycache__/semantic_matcher.cpython-312.pyc +0 -0
  71. package/tools/__pycache__/task_manager.cpython-312.pyc +0 -0
  72. package/tools/agent_capabilities.json +231 -0
  73. package/tools/agent_invoker_helper.py +239 -0
  74. package/tools/agent_router.py +730 -0
  75. package/tools/approval_gate.py +318 -0
  76. package/tools/clarify_engine.py +511 -0
  77. package/tools/clarify_patterns.py +356 -0
  78. package/tools/commit_validator.py +338 -0
  79. package/tools/context_provider.py +181 -0
  80. package/tools/context_section_reader.py +301 -0
  81. package/tools/demo_clarify.py +104 -0
  82. package/tools/generate_embeddings.py +168 -0
  83. package/tools/quicktriage_aws_troubleshooter.sh +45 -0
  84. package/tools/quicktriage_devops_developer.sh +38 -0
  85. package/tools/quicktriage_gcp_troubleshooter.sh +51 -0
  86. package/tools/quicktriage_gitops_operator.sh +47 -0
  87. package/tools/quicktriage_terraform_architect.sh +40 -0
  88. package/tools/semantic_matcher.py +222 -0
  89. package/tools/task_manager.py +547 -0
  90. package/tools/task_manager_README.md +395 -0
  91. package/tools/task_manager_example.py +215 -0
@@ -0,0 +1,237 @@
1
+ ---
2
+ description: Bootstrap Spec-Kit structure and validate/create project-context.json
3
+ ---
4
+
5
+ **USAGE**: `/speckit.init [feature-name]`
6
+
7
+ **Examples**:
8
+ ```
9
+ /speckit.init 005-new-feature
10
+ /speckit.init # Without feature name - just validates project-context.json
11
+ ```
12
+
13
+ ## Purpose
14
+
15
+ Initialize Spec-Kit for a new feature or bootstrap the project configuration. This command:
16
+ 1. Validates that `project-context.json` exists and is properly configured
17
+ 2. If missing, interactively creates `project-context.json` from user input
18
+ 3. Optionally creates feature directory structure with templates
19
+
20
+ ## Execution Steps
21
+
22
+ ### 1. Validate project-context.json
23
+
24
+ Check if `.claude/project-context.json` exists:
25
+
26
+ **If EXISTS**:
27
+ - Read and validate structure
28
+ - Check required fields:
29
+ - `project_details.id`
30
+ - `project_details.region`
31
+ - `project_details.cluster_name`
32
+ - `gitops_configuration.repository.path`
33
+ - `terraform_infrastructure.layout.base_path`
34
+ - Report validation results
35
+ - If missing critical fields, offer to fix interactively
36
+
37
+ **If NOT EXISTS**:
38
+ - Inform user that project-context.json is missing
39
+ - Offer to create it interactively
40
+ - Ask the following questions:
41
+
42
+ #### Interactive Project Context Creation
43
+
44
+ **Question 1: GCP Project ID**
45
+ ```
46
+ What is your GCP project ID?
47
+ Example: aaxis-rnd-general-project
48
+ ```
49
+
50
+ **Question 2: GCP Region**
51
+ ```
52
+ What is your primary GCP region?
53
+ Options:
54
+ - us-central1
55
+ - us-east1
56
+ - us-west1
57
+ - europe-west1
58
+ - Other (specify)
59
+ ```
60
+
61
+ **Question 3: GKE Cluster Name**
62
+ ```
63
+ What is your GKE cluster name?
64
+ Example: tcm-gke-non-prod
65
+ ```
66
+
67
+ **Question 4: GitOps Repository Path**
68
+ ```
69
+ What is the ABSOLUTE path to your GitOps repository?
70
+ Example: /home/jaguilar/aaxis/rnd/repositories/gitops
71
+ ```
72
+
73
+ **Question 5: Terraform Repository Path**
74
+ ```
75
+ What is the ABSOLUTE path to your Terraform repository?
76
+ Example: /home/jaguilar/aaxis/rnd/repositories/terraform
77
+ ```
78
+
79
+ **Question 6: PostgreSQL Instance (Optional)**
80
+ ```
81
+ PostgreSQL Cloud SQL instance name (or skip):
82
+ Example: tcm-postgres-non-prod
83
+ [Press Enter to skip]
84
+ ```
85
+
86
+ After collecting answers, generate `project-context.json`:
87
+
88
+ ```json
89
+ {
90
+ "version": "2.0.0",
91
+ "last_updated": "YYYY-MM-DD",
92
+ "project_details": {
93
+ "id": "<answer1>",
94
+ "region": "<answer2>",
95
+ "environment": "non-prod",
96
+ "cluster_name": "<answer3>"
97
+ },
98
+ "gitops_configuration": {
99
+ "repository": {
100
+ "path": "<answer4>",
101
+ "structure": "flux-standard"
102
+ },
103
+ "flux_details": {
104
+ "version": "v2",
105
+ "reconciliation_interval": "5m"
106
+ }
107
+ },
108
+ "terraform_infrastructure": {
109
+ "layout": {
110
+ "base_path": "<answer5>",
111
+ "structure": "terragrunt-hierarchical"
112
+ },
113
+ "provider_credentials": {
114
+ "auth_method": "gcloud-default"
115
+ }
116
+ },
117
+ "databases": {
118
+ "postgres": {
119
+ "instance": "<answer6>",
120
+ "type": "cloud-sql"
121
+ }
122
+ },
123
+ "operational_guidelines": {
124
+ "commit_standards": "conventional-commits",
125
+ "gitops_principles": "flux-cd",
126
+ "security_tiers": ["T0", "T1", "T2", "T3"]
127
+ }
128
+ }
129
+ ```
130
+
131
+ Write file to `.claude/project-context.json` and report success.
132
+
133
+ ### 2. Feature Directory Bootstrap (Optional)
134
+
135
+ If `[feature-name]` argument provided:
136
+
137
+ a) **Determine Spec-Kit root**:
138
+ - Check if directory `spec-kit-tcm-plan` exists in current directory
139
+ - If not, ask user: "Spec-Kit root directory name? (default: spec-kit-tcm-plan)"
140
+
141
+ b) **Create feature directory structure**:
142
+ ```
143
+ <speckit-root>/specs/<feature-name>/
144
+ ├── spec.md (from .claude/speckit/templates/spec-template.md)
145
+ ├── plan.md (empty placeholder)
146
+ ├── tasks.md (empty placeholder)
147
+ └── contracts/ (empty directory)
148
+ ```
149
+
150
+ c) **Initialize spec.md with project context**:
151
+ - Copy spec-template.md to feature directory
152
+ - **AUTO-FILL** placeholders using project-context.json:
153
+ - `[PROJECT_ID]` → `project_details.id`
154
+ - `[REGION]` → `project_details.region`
155
+ - `[CLUSTER]` → `project_details.cluster_name`
156
+ - `[GITOPS_PATH]` → `gitops_configuration.repository.path`
157
+ - `[TERRAFORM_PATH]` → `terraform_infrastructure.layout.base_path`
158
+
159
+ d) **Report feature initialization**:
160
+ ```markdown
161
+ ✅ Feature initialized: <feature-name>
162
+
163
+ **Directory**: <speckit-root>/specs/<feature-name>/
164
+ **Files created**:
165
+ - spec.md (auto-filled with project context)
166
+ - plan.md (placeholder)
167
+ - tasks.md (placeholder)
168
+ - contracts/ (directory)
169
+
170
+ **Next steps**:
171
+ 1. Edit spec.md to define your feature
172
+ 2. Run: /speckit.plan <speckit-root> <feature-name>
173
+ ```
174
+
175
+ ### 3. Validation Summary
176
+
177
+ Always output validation summary:
178
+
179
+ ```markdown
180
+ ## Project Context Validation
181
+
182
+ ✅ project-context.json exists
183
+ ✅ All required fields present
184
+ ✅ GitOps path exists: <path>
185
+ ✅ Terraform path exists: <path>
186
+
187
+ **Configuration**:
188
+ - Project ID: <id>
189
+ - Region: <region>
190
+ - Cluster: <cluster-name>
191
+ - GitOps: <path>
192
+ - Terraform: <path>
193
+
194
+ **Spec-Kit Status**:
195
+ - Governance: .claude/speckit/governance.md
196
+ - ADR Template: .claude/speckit/templates/adr-template.md
197
+ - Commands: /specify, /plan, /tasks, /implement, /init
198
+
199
+ **You're ready to use Spec-Kit!**
200
+ ```
201
+
202
+ ## Error Handling
203
+
204
+ **Missing paths**:
205
+ ```
206
+ ⚠️ WARNING: GitOps path does not exist: <path>
207
+ This may cause issues with gitops-operator agent.
208
+ Recommendation: Create directory or update project-context.json
209
+ ```
210
+
211
+ **Invalid JSON**:
212
+ ```
213
+ ❌ ERROR: project-context.json is malformed
214
+ <JSON parse error>
215
+
216
+ Fix the JSON syntax or delete the file to regenerate.
217
+ ```
218
+
219
+ **Permission issues**:
220
+ ```
221
+ ❌ ERROR: Cannot write to .claude/project-context.json
222
+ Check directory permissions for .claude/
223
+ ```
224
+
225
+ ## Notes
226
+
227
+ - **Run once per project** to create project-context.json
228
+ - **Run per feature** to bootstrap new feature directory
229
+ - **Idempotent**: Safe to run multiple times (won't overwrite existing files)
230
+ - **No config.json**: Spec-Kit 2.0 uses project-context.json + explicit arguments
231
+ - **No constitution.md**: Replaced with governance.md (project-wide, not versioned per feature)
232
+
233
+ ## See Also
234
+
235
+ - `/speckit.specify` - Create feature specification (uses project-context.json)
236
+ - `/speckit.plan` - Generate implementation plan
237
+ - `.claude/speckit/governance.md` - Project governance principles
@@ -0,0 +1,88 @@
1
+ ---
2
+ description: Execute the implementation planning workflow using the plan template to generate design artifacts.
3
+ ---
4
+
5
+ The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty).
6
+
7
+ User input:
8
+
9
+ $ARGUMENTS
10
+
11
+ **IMPORTANT**: This command now requires TWO arguments:
12
+ 1. `<speckit-root>`: Path to spec-kit root directory (e.g., `spec-kit-tcm-plan` or `/absolute/path/to/spec-kit-tcm-plan`)
13
+ 2. `<feature-name>`: Feature name (e.g., `004-project-guidance-deployment`)
14
+
15
+ **Example usage**:
16
+ ```
17
+ /speckit.plan spec-kit-tcm-plan 004-project-guidance-deployment
18
+ ```
19
+
20
+ Given the implementation details provided as an argument, do this:
21
+
22
+ 1. Extract `<speckit-root>` and `<feature-name>` from $ARGUMENTS. If not provided, ERROR and show usage example.
23
+ 2. Run `.claude/speckit/scripts/setup-plan.sh --json <speckit-root> <feature-name>` from the repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, FEATURE_DIR, FEATURE_NAME, SPECKIT_ROOT. All future file paths must be absolute.
24
+
25
+ 3. **Automatic Clarification (Integrated)**:
26
+ BEFORE proceeding with planning, perform ambiguity detection and clarification:
27
+
28
+ a) **Scan for ambiguities** across these categories:
29
+ - Functional Scope (user goals, out-of-scope, roles)
30
+ - Data Model (entities, relationships, lifecycle)
31
+ - Non-Functional (performance, security, reliability targets)
32
+ - Integration (external APIs, failure modes)
33
+ - Edge Cases (error handling, conflicts)
34
+ - Terminology (vague adjectives like "robust", "intuitive")
35
+
36
+ b) **Generate clarification questions** (max 5 total):
37
+ - Only ask if answer materially impacts architecture, data model, or testing
38
+ - Prioritize by Impact × Uncertainty heuristic
39
+ - Use multiple-choice (2-5 options) or short-answer (≤5 words)
40
+ - Skip if already answered in spec or low-impact
41
+
42
+ c) **Interactive questioning** (if needed):
43
+ - Present ONE question at a time
44
+ - For multiple-choice, use markdown table with options
45
+ - After answer, validate and integrate IMMEDIATELY into spec
46
+ - Create `## Clarifications / ### Session YYYY-MM-DD` section
47
+ - Update appropriate sections (Functional Requirements, Data Model, etc.)
48
+ - Save spec after EACH answer (atomic updates)
49
+ - Stop when: all critical ambiguities resolved, user says "done", or 5 questions reached
50
+
51
+ d) **Clarification Results**:
52
+ - If NO ambiguities found: Report "No critical ambiguities detected" and continue
53
+ - If clarifications made: Report count, sections updated, suggest proceeding
54
+ - If high-impact areas still unresolved: Warn user about rework risk
55
+
56
+ **CRITICAL**: Clarification is automatic and integrated. No separate command invocation required.
57
+
58
+ 4. Read and analyze the feature specification to understand:
59
+ - The feature requirements and user stories
60
+ - Functional and non-functional requirements
61
+ - Success criteria and acceptance criteria
62
+ - Any technical constraints or dependencies mentioned
63
+
64
+ 5. Read governance.md to understand architectural principles and standards:
65
+ - Path: `.claude/speckit/governance.md` (project-wide standards)
66
+ - Extract: Code-First Protocol, GitOps principles, security tiers, commit standards
67
+
68
+ 4. Execute the implementation plan template:
69
+ - Load `.claude/speckit/templates/plan-template.md` (already copied to IMPL_PLAN path as plan.md)
70
+ - Set Input path to FEATURE_SPEC
71
+ - Run the Execution Flow (main) function steps 1-9
72
+ - The template is self-contained and executable
73
+ - Follow error handling and gate checks as specified
74
+ - Let the template guide artifact generation in $SPECS_DIR:
75
+ * Phase 0 generates research.md
76
+ * Phase 1 generates plan.md, data-model.md, contracts/, quickstart.md
77
+ * Phase 2 generates tasks.md
78
+ - Incorporate user-provided details from arguments into Technical Context: $ARGUMENTS
79
+ - Update Progress Tracking as you complete each phase
80
+
81
+ 5. Verify execution completed:
82
+ - Check Progress Tracking shows all phases complete
83
+ - Ensure all required artifacts were generated
84
+ - Confirm no ERROR states in execution
85
+
86
+ 6. Report results con las rutas generadas y los artefactos creados (no es necesario incluir la rama git).
87
+
88
+ Use absolute paths with the repository root for all file operations to avoid path issues.
@@ -0,0 +1,161 @@
1
+ ---
2
+ description: Create or update the feature specification from a natural language feature description.
3
+ ---
4
+
5
+ The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty).
6
+
7
+ User input:
8
+
9
+ $ARGUMENTS
10
+
11
+ **IMPORTANT**: This command now requires arguments in format:
12
+ ```
13
+ /speckit.specify <speckit-root> <feature-description>
14
+ ```
15
+
16
+ **Example usage**:
17
+ ```
18
+ /speckit.specify spec-kit-tcm-plan Add dark mode toggle to settings
19
+ ```
20
+
21
+ The text after `<speckit-root>` is the feature description.
22
+
23
+ Given those arguments, do this:
24
+
25
+ 1. Extract `<speckit-root>` (first word) and `<feature-description>` (remaining text) from $ARGUMENTS.
26
+ - If speckit-root is missing, ERROR and show usage example.
27
+ - If feature-description is empty, ERROR and ask user to provide a description.
28
+
29
+ 2. **CLARIFICATION CHECK (NEW)**:
30
+ Before proceeding, analyze the feature description for ambiguity using the clarification engine:
31
+
32
+ ```python
33
+ import sys
34
+ sys.path.insert(0, '/home/jaguilar/aaxis/rnd/repositories/.claude/tools')
35
+ from clarify_engine import request_clarification, process_clarification
36
+
37
+ # Detect ambiguity in feature description
38
+ clarification_data = request_clarification(
39
+ user_prompt=feature_description,
40
+ command_context={"command": "speckit.specify"}
41
+ )
42
+
43
+ if clarification_data["needs_clarification"]:
44
+ # Present summary
45
+ print(clarification_data["summary"])
46
+
47
+ # Ask questions (AskUserQuestion tool)
48
+ response = AskUserQuestion(**clarification_data["question_config"])
49
+
50
+ # Enrich feature description
51
+ result = process_clarification(
52
+ clarification_data["engine_instance"],
53
+ feature_description,
54
+ response["answers"],
55
+ clarification_data["clarification_context"]
56
+ )
57
+
58
+ # Use enriched description for remaining steps
59
+ feature_description = result["enriched_prompt"]
60
+ ```
61
+
62
+ **What gets clarified**:
63
+ - Ambiguous service references (e.g., "add API endpoint" → which API?)
64
+ - Ambiguous namespace (e.g., "deploy to cluster" → which namespace?)
65
+ - Infrastructure keywords without specifics (e.g., "needs Redis" → which Redis instance?)
66
+ - Environment confusion (e.g., user says "prod" but context is "non-prod")
67
+
68
+ **Example clarification**:
69
+ ```
70
+ Feature description: "Add caching to the API"
71
+
72
+ Clarification question:
73
+ 📦 Servicio
74
+ ¿Qué API quieres modificar?
75
+
76
+ Options:
77
+ 📦 tcm-api (NestJS | tcm-non-prod | Port 3001 | ✅ Running)
78
+ 📦 pg-api (Spring Boot | pg-non-prod | Port 8086 | ✅ Running)
79
+
80
+ Enriched description:
81
+ "Add caching to the API
82
+
83
+ [Clarification - service_ambiguity]: tcm-api"
84
+ ```
85
+
86
+ 3. Run the script `.claude/speckit/scripts/create-new-feature.sh --json <speckit-root> <feature-description>` from repo root and parse its JSON output for FEATURE_NAME, SPEC_FILE, FEATURE_DIR, and FEATURE_NUM. All file paths must be absolute.
87
+ **IMPORTANT** You must only ever run this script once. The JSON is provided in the terminal as output - always refer to it to get the actual content you're looking for.
88
+
89
+ 4. **Load project-context.json (MANDATORY)**:
90
+ Read `.claude/project-context.json` to auto-fill infrastructure placeholders.
91
+
92
+ **If project-context.json EXISTS**:
93
+ - Extract: `project_details.id`, `project_details.region`, `project_details.cluster_name`
94
+ - Extract: `gitops_configuration.repository.path`
95
+ - Extract: `terraform_infrastructure.layout.base_path`
96
+ - Extract (optional): `databases.postgres.instance`
97
+ - Use these values to replace placeholders in spec template
98
+
99
+ **If project-context.json MISSING**:
100
+ - Warn user: "⚠️ project-context.json not found"
101
+ - Suggest: "Run /speckit.init to create project configuration"
102
+ - **Ask interactively**:
103
+ - "GCP Project ID?"
104
+ - "GCP Region?"
105
+ - "GKE Cluster Name?"
106
+ - "GitOps repository path?"
107
+ - "Terraform repository path?"
108
+ - Store answers temporarily for this spec
109
+ - Recommend running /init after to persist configuration
110
+
111
+ 5. Load `.claude/speckit/templates/spec-template.md` to understand required sections.
112
+
113
+ 6. Write the specification to SPEC_FILE using the template structure:
114
+ - Replace **infrastructure placeholders** with project-context.json values:
115
+ - `[PROJECT_ID]` → `project_details.id`
116
+ - `[REGION]` → `project_details.region`
117
+ - `[CLUSTER]` → `project_details.cluster_name`
118
+ - `[GITOPS_PATH]` → `gitops_configuration.repository.path`
119
+ - `[TERRAFORM_PATH]` → `terraform_infrastructure.layout.base_path`
120
+ - `[POSTGRES_INSTANCE]` → `databases.postgres.instance` (if applicable)
121
+
122
+ - Replace **feature placeholders** with derived content from feature description:
123
+ - `[FEATURE_NAME]` → Extracted from arguments
124
+ - `[FEATURE_DESCRIPTION]` → User's feature description
125
+ - `[FUNCTIONAL_REQUIREMENTS]` → Analyze description for requirements
126
+ - `[USER_STORIES]` → Generate user stories from description
127
+ - `[TECHNICAL_CONSTRAINTS]` → Infer from description (or mark TBD)
128
+
129
+ - Preserve section order and headings from template
130
+ - Flag any placeholders that couldn't be auto-filled (mark with TODO)
131
+
132
+ 7. **Auto-context verification**:
133
+ - List which placeholders were auto-filled from project-context.json
134
+ - List which placeholders need manual completion
135
+ - If >5 manual placeholders remain, suggest running /clarify after
136
+
137
+ 8. Report completion with feature name, spec file path, feature directory, and auto-filled context summary:
138
+ ```markdown
139
+ ✅ Feature specification created: <FEATURE_NAME>
140
+
141
+ **Files**:
142
+ - Spec: <SPEC_FILE>
143
+ - Directory: <FEATURE_DIR>
144
+
145
+ **Auto-filled from project-context.json**:
146
+ - ✅ Project ID: <value>
147
+ - ✅ Region: <value>
148
+ - ✅ Cluster: <value>
149
+ - ✅ GitOps path: <value>
150
+ - ✅ Terraform path: <value>
151
+
152
+ **Manual placeholders** (review and complete):
153
+ - [ ] Performance targets (spec.md:L45)
154
+ - [ ] Security requirements (spec.md:L67)
155
+
156
+ **Next steps**:
157
+ 1. Review and complete manual placeholders in spec.md
158
+ 2. Run: /speckit.plan <speckit-root> <feature-name>
159
+ ```
160
+
161
+ Note: The script creates the feature directory (specs/###-feature-name/) and initializes the spec file. Git workflow is managed separately by the user.
@@ -0,0 +1,188 @@
1
+ ---
2
+ description: Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts.
3
+ ---
4
+
5
+ The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty).
6
+
7
+ User input:
8
+
9
+ $ARGUMENTS
10
+
11
+ **IMPORTANT**: This command now requires TWO arguments:
12
+ 1. `<speckit-root>`: Path to spec-kit root directory (e.g., `spec-kit-tcm-plan`)
13
+ 2. `<feature-name>`: Feature name (e.g., `004-project-guidance-deployment`)
14
+
15
+ **Example usage**:
16
+ ```
17
+ /speckit.tasks spec-kit-tcm-plan 004-project-guidance-deployment
18
+ ```
19
+
20
+ 1. Extract `<speckit-root>` and `<feature-name>` from $ARGUMENTS. If not provided, ERROR and show usage example.
21
+ 2. Derive paths manually (no check-prerequisites.sh needed):
22
+ ```
23
+ SPECKIT_ROOT = <speckit-root> (resolve to absolute if relative)
24
+ FEATURE_DIR = $SPECKIT_ROOT/specs/<feature-name>
25
+ IMPL_PLAN = $FEATURE_DIR/plan.md
26
+ DATA_MODEL = $FEATURE_DIR/data-model.md
27
+ CONTRACTS_DIR = $FEATURE_DIR/contracts/
28
+ RESEARCH = $FEATURE_DIR/research.md
29
+ QUICKSTART = $FEATURE_DIR/quickstart.md
30
+ TASKS = $FEATURE_DIR/tasks.md
31
+ ```
32
+ 3. Check which design documents are available (use file existence checks):
33
+ 2. Load and analyze available design documents:
34
+ - Always read plan.md for tech stack and libraries
35
+ - IF EXISTS: Read data-model.md for entities
36
+ - IF EXISTS: Read contracts/ for API endpoints
37
+ - IF EXISTS: Read research.md for technical decisions
38
+ - IF EXISTS: Read quickstart.md for test scenarios
39
+
40
+ Note: Not all projects have all documents. For example:
41
+ - CLI tools might not have contracts/
42
+ - Simple libraries might not need data-model.md
43
+ - Generate tasks based on what's available
44
+
45
+ 3. Generate tasks following the template:
46
+ - Use `.claude/speckit/templates/tasks-template.md` as the base
47
+ - Replace example tasks with actual tasks based on:
48
+ * **Setup tasks**: Project init, dependencies, linting
49
+ * **Test tasks [P]**: One per contract, one per integration scenario
50
+ * **Core tasks**: One per entity, service, CLI command, endpoint
51
+ * **Integration tasks**: DB connections, middleware, logging
52
+ * **Polish tasks [P]**: Unit tests, performance, docs
53
+
54
+ 4. Task generation rules:
55
+ - Each contract file → contract test task marked [P]
56
+ - Each entity in data-model → model creation task marked [P]
57
+ - Each endpoint → implementation task (not parallel if shared files)
58
+ - Each user story → integration test marked [P]
59
+ - Different files = can be parallel [P]
60
+ - Same file = sequential (no [P])
61
+
62
+ 5. Order tasks by dependencies:
63
+ - Setup before everything
64
+ - Tests before implementation (TDD)
65
+ - Models before services
66
+ - Services before endpoints
67
+ - Core before integration
68
+ - Everything before polish
69
+
70
+ 6. Include parallel execution examples:
71
+ - Group [P] tasks that can run together
72
+ - Show actual Task agent commands
73
+
74
+ 7. Create FEATURE_DIR/tasks.md with enriched metadata:
75
+ - Correct feature name from implementation plan
76
+ - Numbered tasks (T001, T002, etc.)
77
+ - Clear file paths for each task
78
+ - Dependency notes
79
+ - Parallel execution guidance
80
+ - **INLINE metadata for EVERY task** (generated automatically, not post-processed)
81
+
82
+ 8. **Automatic Task Enrichment (MANDATORY)**:
83
+ For EACH task you generate, automatically add metadata comments IMMEDIATELY after the task line:
84
+
85
+ **Task Format**:
86
+ ```markdown
87
+ - [ ] T001 Create GKE cluster configuration
88
+ <!-- 🤖 Agent: terraform-architect | 👁️ T0 | ⚡ 0.85 -->
89
+ <!-- 🏷️ Tags: #terraform #infrastructure #gke -->
90
+ <!-- 🎯 skill: terraform_infrastructure (8.0) -->
91
+ ```
92
+
93
+ **Agent Routing Rules** (analyze task description):
94
+
95
+ | Keywords in Task | Agent | Tier |
96
+ |-----------------|-------|------|
97
+ | terraform, terragrunt, .tf, infrastructure, vpc, gke, cloud-sql | terraform-architect | T0 (read), T2 (plan), T3 (apply) |
98
+ | kubectl, helm, flux, kubernetes, k8s, deployment, service, ingress | gitops-operator | T0 (read), T2 (dry-run), T3 (push) |
99
+ | gcloud, GCP, cloud logging, IAM, service account | gcp-troubleshooter | T0 (diagnostics) |
100
+ | docker, npm, build, test, CI, pipeline, Dockerfile | devops-developer | T0-T1 |
101
+
102
+ **Security Tier Detection**:
103
+ - T0: describe, get, show, list, logs, read operations
104
+ - T1: validate, lint, template, format operations
105
+ - T2: plan, dry-run, diff operations
106
+ - T3: apply, push, create, delete, deploy operations (⚠️ HIGH RISK)
107
+
108
+ **Tag Generation** (add ALL matching):
109
+ - Tech: #terraform #kubernetes #helm #docker #gcp #aws
110
+ - Domain: #database #security #networking #api #monitoring
111
+ - Work: #setup #test #deploy #config #docs #debug
112
+
113
+ **Priority Signal**:
114
+ - ❓ Low complexity (setup, config, docs)
115
+ - ⚡ Medium complexity (implementation, integration)
116
+ - 🔥 High impact (security, database, production)
117
+
118
+ **High-Risk Warning** (for T2/T3 tasks):
119
+ ```markdown
120
+ - [ ] T042 Apply Terraform changes to production VPC
121
+ <!-- 🤖 Agent: terraform-architect | 🚫 T3 | 🔥 0.95 -->
122
+ <!-- 🏷️ Tags: #terraform #infrastructure #networking #production -->
123
+ <!-- ⚠️ HIGH RISK: Analyze before execution -->
124
+ <!-- 💡 Suggested: /speckit.analyze-task T042 -->
125
+ <!-- 🎯 skill: terraform_infrastructure (12.0) -->
126
+ ```
127
+
128
+ **CRITICAL**: Generate ALL tasks with metadata inline. NO post-processing step required.
129
+
130
+ 9. **Automatic Cross-Artifact Validation (Integrated)**:
131
+ After generating tasks.md, IMMEDIATELY perform consistency analysis:
132
+
133
+ a) **Load artifacts for validation**:
134
+ - spec.md: Functional/Non-functional requirements, User Stories, Edge Cases
135
+ - plan.md: Architecture, Data Model, Technical constraints
136
+ - tasks.md: All generated tasks with metadata
137
+ - governance.md: Architectural principles and standards
138
+
139
+ b) **Detection passes** (automated):
140
+ - **Duplication**: Flag near-duplicate requirements or tasks
141
+ - **Ambiguity**: Detect vague adjectives ("fast", "robust") without measurable criteria, unresolved TODOs/placeholders
142
+ - **Underspecification**: Requirements missing acceptance criteria, tasks referencing undefined components
143
+ - **Governance alignment**: Check against principles (GitOps, Code-First Protocol, Security Tiers, etc.)
144
+ - **Coverage gaps**: Requirements with zero tasks, tasks with no mapped requirement, missing non-functional coverage
145
+ - **Inconsistency**: Terminology drift, data entities mismatch, task ordering contradictions
146
+
147
+ c) **Severity assignment**:
148
+ - CRITICAL: Violates governance MUST principle, requirement with zero coverage
149
+ - HIGH: Duplicate/conflicting requirements, ambiguous security/performance
150
+ - MEDIUM: Terminology drift, missing non-functional coverage
151
+ - LOW: Style/wording improvements
152
+
153
+ d) **Validation report** (inline output):
154
+ ```markdown
155
+ ### Validation Report
156
+
157
+ **Metrics**:
158
+ - Total Requirements: X
159
+ - Total Tasks: Y
160
+ - Coverage: Z% (requirements with ≥1 task)
161
+ - Issues: A critical, B high, C medium, D low
162
+
163
+ **Issues Found**:
164
+ | ID | Severity | Category | Location | Summary | Recommendation |
165
+ |----|----------|----------|----------|---------|----------------|
166
+ | A1 | CRITICAL | Coverage | spec.md:L45 | "Performance monitoring" has zero tasks | Add task for metrics/logging setup |
167
+ | A2 | HIGH | Ambiguity | spec.md:L89 | "Fast response time" lacks metric | Clarify: <200ms p95 latency? |
168
+
169
+ **Next Actions**:
170
+ - If CRITICAL issues: Resolve before proceeding to /implement
171
+ - If only MEDIUM/LOW: Proceed with caution, address during implementation
172
+ ```
173
+
174
+ e) **Automatic remediation** (if no CRITICAL issues):
175
+ - For LOW/MEDIUM issues: Add notes to tasks.md Dependencies section
176
+ - For ambiguities: Flag for clarification during implementation
177
+ - For coverage gaps: Generate missing tasks inline
178
+
179
+ f) **Gate decision**:
180
+ - If CRITICAL issues found: Pause and require user approval to proceed
181
+ - If only HIGH/MEDIUM/LOW: Report and continue
182
+ - If zero issues: Report success and proceed
183
+
184
+ **CRITICAL**: Validation runs automatically. NO separate /analyze-plan command needed.
185
+
186
+ Context for task generation: $ARGUMENTS
187
+
188
+ The tasks.md should be immediately executable - each task must be specific enough that an LLM can complete it without additional context.