@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.
- package/CHANGELOG.md +315 -0
- package/CLAUDE.md +154 -0
- package/LICENSE +21 -0
- package/README.md +221 -0
- package/agents/aws-troubleshooter.md +50 -0
- package/agents/claude-architect.md +821 -0
- package/agents/devops-developer.md +92 -0
- package/agents/gcp-troubleshooter.md +50 -0
- package/agents/gitops-operator.md +360 -0
- package/agents/terraform-architect.md +289 -0
- package/bin/gaia-init.js +620 -0
- package/commands/architect.md +97 -0
- package/commands/restore-session.md +87 -0
- package/commands/save-session.md +88 -0
- package/commands/session-status.md +61 -0
- package/commands/speckit.add-task.md +144 -0
- package/commands/speckit.analyze-task.md +65 -0
- package/commands/speckit.implement.md +96 -0
- package/commands/speckit.init.md +237 -0
- package/commands/speckit.plan.md +88 -0
- package/commands/speckit.specify.md +161 -0
- package/commands/speckit.tasks.md +188 -0
- package/config/AGENTS.md +162 -0
- package/config/agent-catalog.md +604 -0
- package/config/context-contracts.md +682 -0
- package/config/git-standards.md +674 -0
- package/config/git_standards.json +69 -0
- package/config/orchestration-workflow.md +735 -0
- package/hooks/__pycache__/post_tool_use.cpython-312.pyc +0 -0
- package/hooks/__pycache__/pre_kubectl_security.cpython-312.pyc +0 -0
- package/hooks/__pycache__/pre_tool_use.cpython-312.pyc +0 -0
- package/hooks/__pycache__/session_start.cpython-312.pyc +0 -0
- package/hooks/__pycache__/subagent_stop.cpython-312.pyc +0 -0
- package/hooks/post_tool_use.py +463 -0
- package/hooks/pre_kubectl_security.py +205 -0
- package/hooks/pre_tool_use.py +530 -0
- package/hooks/session_start.py +315 -0
- package/hooks/subagent_stop.py +549 -0
- package/index.js +92 -0
- package/package.json +59 -0
- package/speckit/README.en.md +648 -0
- package/speckit/README.md +353 -0
- package/speckit/governance.md +169 -0
- package/speckit/scripts/check-prerequisites.sh +194 -0
- package/speckit/scripts/common.sh +126 -0
- package/speckit/scripts/create-new-feature.sh +131 -0
- package/speckit/scripts/init.sh +42 -0
- package/speckit/scripts/setup-plan.sh +95 -0
- package/speckit/scripts/update-agent-context.sh +718 -0
- package/speckit/templates/adr-template.md +118 -0
- package/speckit/templates/agent-file-template.md +23 -0
- package/speckit/templates/plan-template.md +233 -0
- package/speckit/templates/spec-template.md +116 -0
- package/speckit/templates/tasks-template-bkp.md +136 -0
- package/speckit/templates/tasks-template.md +345 -0
- package/templates/CLAUDE.template.md +170 -0
- package/templates/code-examples/approval_gate_workflow.py +141 -0
- package/templates/code-examples/clarification_workflow.py +94 -0
- package/templates/code-examples/commit_validation.py +86 -0
- package/templates/project-context.template.json +126 -0
- package/templates/settings.template.json +307 -0
- package/tools/__pycache__/agent_router.cpython-312.pyc +0 -0
- package/tools/__pycache__/approval_gate.cpython-312.pyc +0 -0
- package/tools/__pycache__/clarify_engine.cpython-312.pyc +0 -0
- package/tools/__pycache__/clarify_patterns.cpython-312.pyc +0 -0
- package/tools/__pycache__/commit_validator.cpython-312.pyc +0 -0
- package/tools/__pycache__/context_section_reader.cpython-312.pyc +0 -0
- package/tools/__pycache__/routing_dashboard.cpython-312.pyc +0 -0
- package/tools/__pycache__/routing_feedback.cpython-312.pyc +0 -0
- package/tools/__pycache__/semantic_matcher.cpython-312.pyc +0 -0
- package/tools/__pycache__/task_manager.cpython-312.pyc +0 -0
- package/tools/agent_capabilities.json +231 -0
- package/tools/agent_invoker_helper.py +239 -0
- package/tools/agent_router.py +730 -0
- package/tools/approval_gate.py +318 -0
- package/tools/clarify_engine.py +511 -0
- package/tools/clarify_patterns.py +356 -0
- package/tools/commit_validator.py +338 -0
- package/tools/context_provider.py +181 -0
- package/tools/context_section_reader.py +301 -0
- package/tools/demo_clarify.py +104 -0
- package/tools/generate_embeddings.py +168 -0
- package/tools/quicktriage_aws_troubleshooter.sh +45 -0
- package/tools/quicktriage_devops_developer.sh +38 -0
- package/tools/quicktriage_gcp_troubleshooter.sh +51 -0
- package/tools/quicktriage_gitops_operator.sh +47 -0
- package/tools/quicktriage_terraform_architect.sh +40 -0
- package/tools/semantic_matcher.py +222 -0
- package/tools/task_manager.py +547 -0
- package/tools/task_manager_README.md +395 -0
- package/tools/task_manager_example.py +215 -0
|
@@ -0,0 +1,194 @@
|
|
|
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 <speckit-root> <feature-name> [OPTIONS]
|
|
9
|
+
#
|
|
10
|
+
# ARGUMENTS:
|
|
11
|
+
# <speckit-root> Path to spec-kit root directory (e.g., spec-kit-tcm-plan)
|
|
12
|
+
# <feature-name> Feature directory name (e.g., 004-project-guidance-deployment)
|
|
13
|
+
#
|
|
14
|
+
# OPTIONS:
|
|
15
|
+
# --json Output in JSON format
|
|
16
|
+
# --require-tasks Require tasks.md to exist (for implementation phase)
|
|
17
|
+
# --include-tasks Include tasks.md in AVAILABLE_DOCS list
|
|
18
|
+
# --paths-only Only output path variables (no validation)
|
|
19
|
+
# --help, -h Show help message
|
|
20
|
+
#
|
|
21
|
+
# OUTPUTS:
|
|
22
|
+
# JSON mode: {"FEATURE_DIR":"...", "AVAILABLE_DOCS":["..."]}
|
|
23
|
+
# Text mode: FEATURE_DIR:... \n AVAILABLE_DOCS: \n ✓/✗ file.md
|
|
24
|
+
# Paths only: REPO_ROOT: ... \n BRANCH: ... \n FEATURE_DIR: ... etc.
|
|
25
|
+
|
|
26
|
+
set -e
|
|
27
|
+
|
|
28
|
+
# Parse positional arguments and flags
|
|
29
|
+
POSITIONAL_ARGS=()
|
|
30
|
+
JSON_MODE=false
|
|
31
|
+
REQUIRE_TASKS=false
|
|
32
|
+
INCLUDE_TASKS=false
|
|
33
|
+
PATHS_ONLY=false
|
|
34
|
+
|
|
35
|
+
for arg in "$@"; do
|
|
36
|
+
case "$arg" in
|
|
37
|
+
--json)
|
|
38
|
+
JSON_MODE=true
|
|
39
|
+
;;
|
|
40
|
+
--require-tasks)
|
|
41
|
+
REQUIRE_TASKS=true
|
|
42
|
+
;;
|
|
43
|
+
--include-tasks)
|
|
44
|
+
INCLUDE_TASKS=true
|
|
45
|
+
;;
|
|
46
|
+
--paths-only)
|
|
47
|
+
PATHS_ONLY=true
|
|
48
|
+
;;
|
|
49
|
+
--help|-h)
|
|
50
|
+
cat << 'EOF'
|
|
51
|
+
Usage: check-prerequisites.sh <speckit-root> <feature-name> [OPTIONS]
|
|
52
|
+
|
|
53
|
+
Consolidated prerequisite checking for Spec-Driven Development workflow.
|
|
54
|
+
|
|
55
|
+
ARGUMENTS:
|
|
56
|
+
<speckit-root> Path to spec-kit root directory (e.g., spec-kit-tcm-plan)
|
|
57
|
+
<feature-name> Feature directory name (e.g., 004-project-guidance-deployment)
|
|
58
|
+
|
|
59
|
+
OPTIONS:
|
|
60
|
+
--json Output in JSON format
|
|
61
|
+
--require-tasks Require tasks.md to exist (for implementation phase)
|
|
62
|
+
--include-tasks Include tasks.md in AVAILABLE_DOCS list
|
|
63
|
+
--paths-only Only output path variables (no prerequisite validation)
|
|
64
|
+
--help, -h Show this help message
|
|
65
|
+
|
|
66
|
+
EXAMPLES:
|
|
67
|
+
# Check task prerequisites (plan.md required)
|
|
68
|
+
./check-prerequisites.sh spec-kit-tcm-plan 004-feature-name --json
|
|
69
|
+
|
|
70
|
+
# Check implementation prerequisites (plan.md + tasks.md required)
|
|
71
|
+
./check-prerequisites.sh spec-kit-tcm-plan 004-feature-name --json --require-tasks --include-tasks
|
|
72
|
+
|
|
73
|
+
# Get feature paths only (no validation)
|
|
74
|
+
./check-prerequisites.sh spec-kit-tcm-plan 004-feature-name --paths-only
|
|
75
|
+
|
|
76
|
+
EOF
|
|
77
|
+
exit 0
|
|
78
|
+
;;
|
|
79
|
+
-*)
|
|
80
|
+
echo "ERROR: Unknown option '$arg'. Use --help for usage information." >&2
|
|
81
|
+
exit 1
|
|
82
|
+
;;
|
|
83
|
+
*)
|
|
84
|
+
POSITIONAL_ARGS+=("$arg")
|
|
85
|
+
;;
|
|
86
|
+
esac
|
|
87
|
+
done
|
|
88
|
+
|
|
89
|
+
# Extract positional arguments
|
|
90
|
+
SPECKIT_ROOT_ARG="${POSITIONAL_ARGS[0]:-}"
|
|
91
|
+
FEATURE_NAME_ARG="${POSITIONAL_ARGS[1]:-}"
|
|
92
|
+
|
|
93
|
+
# Validate required arguments
|
|
94
|
+
if [[ -z "$SPECKIT_ROOT_ARG" ]]; then
|
|
95
|
+
echo "ERROR: speckit-root argument is required" >&2
|
|
96
|
+
echo "Usage: check-prerequisites.sh <speckit-root> <feature-name> [OPTIONS]" >&2
|
|
97
|
+
exit 1
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
if [[ -z "$FEATURE_NAME_ARG" ]]; then
|
|
101
|
+
echo "ERROR: feature-name argument is required" >&2
|
|
102
|
+
echo "Usage: check-prerequisites.sh <speckit-root> <feature-name> [OPTIONS]" >&2
|
|
103
|
+
exit 1
|
|
104
|
+
fi
|
|
105
|
+
|
|
106
|
+
# Source common functions
|
|
107
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
108
|
+
source "$SCRIPT_DIR/common.sh"
|
|
109
|
+
|
|
110
|
+
# Get feature paths using explicit arguments
|
|
111
|
+
eval $(get_feature_paths "$SPECKIT_ROOT_ARG" "$FEATURE_NAME_ARG")
|
|
112
|
+
|
|
113
|
+
# If paths-only mode, output paths and exit (support JSON + paths-only combined)
|
|
114
|
+
if $PATHS_ONLY; then
|
|
115
|
+
if $JSON_MODE; then
|
|
116
|
+
# Minimal JSON paths payload (no validation performed)
|
|
117
|
+
printf '{"REPO_ROOT":"%s","BRANCH":"%s","FEATURE_DIR":"%s","FEATURE_SPEC":"%s","IMPL_PLAN":"%s","TASKS":"%s"}\n' \
|
|
118
|
+
"$REPO_ROOT" "$CURRENT_BRANCH" "$FEATURE_DIR" "$FEATURE_SPEC" "$IMPL_PLAN" "$TASKS"
|
|
119
|
+
else
|
|
120
|
+
echo "REPO_ROOT: $REPO_ROOT"
|
|
121
|
+
echo "BRANCH: $CURRENT_BRANCH"
|
|
122
|
+
echo "FEATURE_DIR: $FEATURE_DIR"
|
|
123
|
+
echo "FEATURE_SPEC: $FEATURE_SPEC"
|
|
124
|
+
echo "IMPL_PLAN: $IMPL_PLAN"
|
|
125
|
+
echo "TASKS: $TASKS"
|
|
126
|
+
fi
|
|
127
|
+
exit 0
|
|
128
|
+
fi
|
|
129
|
+
|
|
130
|
+
# Validate required directories and files
|
|
131
|
+
if [[ ! -d "$FEATURE_DIR" ]]; then
|
|
132
|
+
echo "ERROR: Feature directory not found: $FEATURE_DIR" >&2
|
|
133
|
+
echo "Run /specify first to create the feature structure." >&2
|
|
134
|
+
exit 1
|
|
135
|
+
fi
|
|
136
|
+
|
|
137
|
+
if [[ ! -f "$IMPL_PLAN" ]]; then
|
|
138
|
+
echo "ERROR: plan.md not found in $FEATURE_DIR" >&2
|
|
139
|
+
echo "Run /plan first to create the implementation plan." >&2
|
|
140
|
+
exit 1
|
|
141
|
+
fi
|
|
142
|
+
|
|
143
|
+
# Check for tasks.md if required
|
|
144
|
+
if $REQUIRE_TASKS && [[ ! -f "$TASKS" ]]; then
|
|
145
|
+
echo "ERROR: tasks.md not found in $FEATURE_DIR" >&2
|
|
146
|
+
echo "Run /tasks first to create the task list." >&2
|
|
147
|
+
exit 1
|
|
148
|
+
fi
|
|
149
|
+
|
|
150
|
+
# Build list of available documents
|
|
151
|
+
docs=()
|
|
152
|
+
|
|
153
|
+
# Always check these optional docs
|
|
154
|
+
[[ -f "$RESEARCH" ]] && docs+=("research.md")
|
|
155
|
+
[[ -f "$DATA_MODEL" ]] && docs+=("data-model.md")
|
|
156
|
+
|
|
157
|
+
# Check contracts directory (only if it exists and has files)
|
|
158
|
+
if [[ -d "$CONTRACTS_DIR" ]] && [[ -n "$(ls -A "$CONTRACTS_DIR" 2>/dev/null)" ]]; then
|
|
159
|
+
docs+=("contracts/")
|
|
160
|
+
fi
|
|
161
|
+
|
|
162
|
+
[[ -f "$QUICKSTART" ]] && docs+=("quickstart.md")
|
|
163
|
+
|
|
164
|
+
# Include tasks.md if requested and it exists
|
|
165
|
+
if $INCLUDE_TASKS && [[ -f "$TASKS" ]]; then
|
|
166
|
+
docs+=("tasks.md")
|
|
167
|
+
fi
|
|
168
|
+
|
|
169
|
+
# Output results
|
|
170
|
+
if $JSON_MODE; then
|
|
171
|
+
# Build JSON array of documents
|
|
172
|
+
if [[ ${#docs[@]} -eq 0 ]]; then
|
|
173
|
+
json_docs="[]"
|
|
174
|
+
else
|
|
175
|
+
json_docs=$(printf '"%s",' "${docs[@]}")
|
|
176
|
+
json_docs="[${json_docs%,}]"
|
|
177
|
+
fi
|
|
178
|
+
|
|
179
|
+
printf '{"FEATURE_DIR":"%s","AVAILABLE_DOCS":%s}\n' "$FEATURE_DIR" "$json_docs"
|
|
180
|
+
else
|
|
181
|
+
# Text output
|
|
182
|
+
echo "FEATURE_DIR:$FEATURE_DIR"
|
|
183
|
+
echo "AVAILABLE_DOCS:"
|
|
184
|
+
|
|
185
|
+
# Show status of each potential document
|
|
186
|
+
check_file "$RESEARCH" "research.md"
|
|
187
|
+
check_file "$DATA_MODEL" "data-model.md"
|
|
188
|
+
check_dir "$CONTRACTS_DIR" "contracts/"
|
|
189
|
+
check_file "$QUICKSTART" "quickstart.md"
|
|
190
|
+
|
|
191
|
+
if $INCLUDE_TASKS; then
|
|
192
|
+
check_file "$TASKS" "tasks.md"
|
|
193
|
+
fi
|
|
194
|
+
fi
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Common functions for Spec-Kit scripts - Simplified Version 2.0
|
|
3
|
+
# All commands now receive explicit arguments: <speckit-root> <feature-name>
|
|
4
|
+
|
|
5
|
+
# Get repository root
|
|
6
|
+
get_repo_root() {
|
|
7
|
+
if git rev-parse --show-toplevel >/dev/null 2>&1; then
|
|
8
|
+
git rev-parse --show-toplevel
|
|
9
|
+
else
|
|
10
|
+
# Fall back to script location for non-git repos
|
|
11
|
+
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
12
|
+
(cd "$script_dir/../../.." && pwd)
|
|
13
|
+
fi
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
# Derive all paths from explicit arguments
|
|
17
|
+
# Usage: get_feature_paths <speckit-root> <feature-name>
|
|
18
|
+
# Returns: Environment variables for all paths
|
|
19
|
+
get_feature_paths() {
|
|
20
|
+
local speckit_root_arg="${1:-}"
|
|
21
|
+
local feature_name_arg="${2:-}"
|
|
22
|
+
|
|
23
|
+
# Validate arguments
|
|
24
|
+
if [[ -z "$speckit_root_arg" ]]; then
|
|
25
|
+
echo "ERROR: speckit-root argument is required" >&2
|
|
26
|
+
echo "Usage: <command> <speckit-root> <feature-name>" >&2
|
|
27
|
+
echo "Example: setup-plan.sh spec-kit-tcm-plan 004-project-guidance-deployment" >&2
|
|
28
|
+
return 1
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
if [[ -z "$feature_name_arg" ]]; then
|
|
32
|
+
echo "ERROR: feature-name argument is required" >&2
|
|
33
|
+
echo "Usage: <command> <speckit-root> <feature-name>" >&2
|
|
34
|
+
echo "Example: setup-plan.sh spec-kit-tcm-plan 004-project-guidance-deployment" >&2
|
|
35
|
+
return 1
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
local repo_root=$(get_repo_root)
|
|
39
|
+
|
|
40
|
+
# Resolve speckit_root to absolute path
|
|
41
|
+
local speckit_root
|
|
42
|
+
if [[ "$speckit_root_arg" = /* ]]; then
|
|
43
|
+
# Already absolute path
|
|
44
|
+
speckit_root="$speckit_root_arg"
|
|
45
|
+
else
|
|
46
|
+
# Relative path - resolve from repo root
|
|
47
|
+
speckit_root="$repo_root/$speckit_root_arg"
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
# Extract feature name (if path was provided instead of name)
|
|
51
|
+
local feature_name
|
|
52
|
+
if [[ "$feature_name_arg" == *"/"* ]]; then
|
|
53
|
+
# Extract basename from path
|
|
54
|
+
feature_name=$(basename "$feature_name_arg")
|
|
55
|
+
else
|
|
56
|
+
feature_name="$feature_name_arg"
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
# Clean up feature name
|
|
60
|
+
feature_name=$(echo "$feature_name" | tr -d '\r' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
|
61
|
+
|
|
62
|
+
# Derive all paths from these two arguments
|
|
63
|
+
local specs_dir="$speckit_root/specs"
|
|
64
|
+
local feature_dir="$specs_dir/$feature_name"
|
|
65
|
+
local constitution_path="$speckit_root/constitution.md"
|
|
66
|
+
local templates_dir="$repo_root/.claude/speckit/templates"
|
|
67
|
+
local scripts_dir="$repo_root/.claude/speckit/scripts"
|
|
68
|
+
|
|
69
|
+
# Output all paths
|
|
70
|
+
cat <<EOF
|
|
71
|
+
REPO_ROOT='$repo_root'
|
|
72
|
+
SPECKIT_ROOT='$speckit_root'
|
|
73
|
+
SPECS_DIR='$specs_dir'
|
|
74
|
+
FEATURE_NAME='$feature_name'
|
|
75
|
+
FEATURE_DIR='$feature_dir'
|
|
76
|
+
FEATURE_SPEC='$feature_dir/spec.md'
|
|
77
|
+
IMPL_PLAN='$feature_dir/plan.md'
|
|
78
|
+
TASKS='$feature_dir/tasks.md'
|
|
79
|
+
RESEARCH='$feature_dir/research.md'
|
|
80
|
+
DATA_MODEL='$feature_dir/data-model.md'
|
|
81
|
+
QUICKSTART='$feature_dir/quickstart.md'
|
|
82
|
+
CONTRACTS_DIR='$feature_dir/contracts'
|
|
83
|
+
CONSTITUTION_PATH='$constitution_path'
|
|
84
|
+
TEMPLATES_DIR='$templates_dir'
|
|
85
|
+
SCRIPTS_DIR='$scripts_dir'
|
|
86
|
+
EOF
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
# Utility functions for validation
|
|
90
|
+
check_file() {
|
|
91
|
+
[[ -f "$1" ]] && echo " ✓ $2" || echo " ✗ $2"
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
check_dir() {
|
|
95
|
+
[[ -d "$1" && -n $(ls -A "$1" 2>/dev/null) ]] && echo " ✓ $2" || echo " ✗ $2"
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
# Validate speckit root directory exists
|
|
99
|
+
validate_speckit_root() {
|
|
100
|
+
local speckit_root="$1"
|
|
101
|
+
|
|
102
|
+
if [[ ! -d "$speckit_root" ]]; then
|
|
103
|
+
echo "ERROR: Spec-Kit root directory not found: $speckit_root" >&2
|
|
104
|
+
echo "" >&2
|
|
105
|
+
echo "Create it first: mkdir -p $speckit_root" >&2
|
|
106
|
+
return 1
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
# Optionally warn if constitution doesn't exist
|
|
110
|
+
if [[ ! -f "$speckit_root/constitution.md" ]]; then
|
|
111
|
+
echo "WARNING: constitution.md not found at $speckit_root/constitution.md" >&2
|
|
112
|
+
echo "Consider creating it for project governance." >&2
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
return 0
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
# Create specs directory if it doesn't exist
|
|
119
|
+
ensure_specs_dir() {
|
|
120
|
+
local specs_dir="$1"
|
|
121
|
+
|
|
122
|
+
if [[ ! -d "$specs_dir" ]]; then
|
|
123
|
+
mkdir -p "$specs_dir"
|
|
124
|
+
echo "Created specs directory: $specs_dir"
|
|
125
|
+
fi
|
|
126
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
# Parse command line arguments
|
|
6
|
+
JSON_MODE=false
|
|
7
|
+
SPECKIT_ROOT_ARG=""
|
|
8
|
+
FEATURE_DESCRIPTION=""
|
|
9
|
+
|
|
10
|
+
usage() {
|
|
11
|
+
echo "Usage: $0 [--json] <speckit-root> <feature-description>"
|
|
12
|
+
echo ""
|
|
13
|
+
echo "Arguments:"
|
|
14
|
+
echo " speckit-root Path to spec-kit root directory (e.g., spec-kit-tcm-plan)"
|
|
15
|
+
echo " feature-description Natural language description of the feature"
|
|
16
|
+
echo ""
|
|
17
|
+
echo "Options:"
|
|
18
|
+
echo " --json Output results in JSON format"
|
|
19
|
+
echo " --help, -h Show this help message"
|
|
20
|
+
echo ""
|
|
21
|
+
echo "Examples:"
|
|
22
|
+
echo " $0 spec-kit-tcm-plan Add dark mode toggle"
|
|
23
|
+
echo " $0 --json spec-kit-tcm-plan Implement user authentication"
|
|
24
|
+
exit 0
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
# Parse arguments
|
|
28
|
+
POSITIONAL_ARGS=()
|
|
29
|
+
for arg in "$@"; do
|
|
30
|
+
case "$arg" in
|
|
31
|
+
--json)
|
|
32
|
+
JSON_MODE=true
|
|
33
|
+
;;
|
|
34
|
+
--help|-h)
|
|
35
|
+
usage
|
|
36
|
+
;;
|
|
37
|
+
-*)
|
|
38
|
+
echo "Unknown option: $arg" >&2
|
|
39
|
+
usage
|
|
40
|
+
;;
|
|
41
|
+
*)
|
|
42
|
+
POSITIONAL_ARGS+=("$arg")
|
|
43
|
+
;;
|
|
44
|
+
esac
|
|
45
|
+
done
|
|
46
|
+
|
|
47
|
+
# Extract speckit-root (first positional) and feature-description (remaining)
|
|
48
|
+
if [ "${#POSITIONAL_ARGS[@]}" -lt 2 ]; then
|
|
49
|
+
echo "ERROR: Both <speckit-root> and <feature-description> are required" >&2
|
|
50
|
+
echo "" >&2
|
|
51
|
+
usage
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
SPECKIT_ROOT_ARG="${POSITIONAL_ARGS[0]}"
|
|
55
|
+
# Join remaining args as feature description
|
|
56
|
+
FEATURE_DESCRIPTION="${POSITIONAL_ARGS[@]:1}"
|
|
57
|
+
|
|
58
|
+
if [ -z "$FEATURE_DESCRIPTION" ]; then
|
|
59
|
+
echo "ERROR: Feature description cannot be empty" >&2
|
|
60
|
+
exit 1
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
# Get script directory and load common functions
|
|
64
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
65
|
+
source "$SCRIPT_DIR/common.sh"
|
|
66
|
+
|
|
67
|
+
REPO_ROOT=$(get_repo_root)
|
|
68
|
+
cd "$REPO_ROOT"
|
|
69
|
+
|
|
70
|
+
# Resolve speckit_root to absolute path
|
|
71
|
+
if [[ "$SPECKIT_ROOT_ARG" = /* ]]; then
|
|
72
|
+
SPECKIT_ROOT="$SPECKIT_ROOT_ARG"
|
|
73
|
+
else
|
|
74
|
+
SPECKIT_ROOT="$REPO_ROOT/$SPECKIT_ROOT_ARG"
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
# Validate speckit root exists
|
|
78
|
+
validate_speckit_root "$SPECKIT_ROOT" || exit 1
|
|
79
|
+
|
|
80
|
+
# Derive specs directory
|
|
81
|
+
SPECS_DIR="$SPECKIT_ROOT/specs"
|
|
82
|
+
ensure_specs_dir "$SPECS_DIR"
|
|
83
|
+
|
|
84
|
+
# Find highest numbered feature
|
|
85
|
+
HIGHEST=0
|
|
86
|
+
if [ -d "$SPECS_DIR" ]; then
|
|
87
|
+
for dir in "$SPECS_DIR"/*; do
|
|
88
|
+
[ -d "$dir" ] || continue
|
|
89
|
+
dirname=$(basename "$dir")
|
|
90
|
+
number=$(echo "$dirname" | grep -o '^[0-9]\+' || echo "0")
|
|
91
|
+
number=$((10#$number))
|
|
92
|
+
if [ "$number" -gt "$HIGHEST" ]; then
|
|
93
|
+
HIGHEST=$number
|
|
94
|
+
fi
|
|
95
|
+
done
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
# Generate next feature number
|
|
99
|
+
NEXT=$((HIGHEST + 1))
|
|
100
|
+
FEATURE_NUM=$(printf "%03d" "$NEXT")
|
|
101
|
+
|
|
102
|
+
# Generate feature name from description
|
|
103
|
+
FEATURE_NAME=$(echo "$FEATURE_DESCRIPTION" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/-\+/-/g' | sed 's/^-//' | sed 's/-$//')
|
|
104
|
+
WORDS=$(echo "$FEATURE_NAME" | tr '-' '\n' | grep -v '^$' | head -3 | tr '\n' '-' | sed 's/-$//')
|
|
105
|
+
FEATURE_NAME="${FEATURE_NUM}-${WORDS}"
|
|
106
|
+
|
|
107
|
+
# Create feature directory
|
|
108
|
+
FEATURE_DIR="$SPECS_DIR/$FEATURE_NAME"
|
|
109
|
+
mkdir -p "$FEATURE_DIR"
|
|
110
|
+
|
|
111
|
+
# Copy spec template
|
|
112
|
+
TEMPLATE="$REPO_ROOT/.claude/speckit/templates/spec-template.md"
|
|
113
|
+
SPEC_FILE="$FEATURE_DIR/spec.md"
|
|
114
|
+
if [ -f "$TEMPLATE" ]; then
|
|
115
|
+
cp "$TEMPLATE" "$SPEC_FILE"
|
|
116
|
+
else
|
|
117
|
+
touch "$SPEC_FILE"
|
|
118
|
+
echo "Warning: Spec template not found at $TEMPLATE" >&2
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
# Output results
|
|
122
|
+
if $JSON_MODE; then
|
|
123
|
+
printf '{"FEATURE_NAME":"%s","SPEC_FILE":"%s","FEATURE_NUM":"%s","FEATURE_DIR":"%s","SPECKIT_ROOT":"%s"}\n' \
|
|
124
|
+
"$FEATURE_NAME" "$SPEC_FILE" "$FEATURE_NUM" "$FEATURE_DIR" "$SPECKIT_ROOT"
|
|
125
|
+
else
|
|
126
|
+
echo "FEATURE_NAME: $FEATURE_NAME"
|
|
127
|
+
echo "SPEC_FILE: $SPEC_FILE"
|
|
128
|
+
echo "FEATURE_NUM: $FEATURE_NUM"
|
|
129
|
+
echo "FEATURE_DIR: $FEATURE_DIR"
|
|
130
|
+
echo "SPECKIT_ROOT: $SPECKIT_ROOT"
|
|
131
|
+
fi
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# ============================================================================
|
|
3
|
+
# DEPRECATED: This script is no longer needed in Spec-Kit 2.0
|
|
4
|
+
# ============================================================================
|
|
5
|
+
#
|
|
6
|
+
# Spec-Kit 2.0 uses explicit arguments instead of config.json:
|
|
7
|
+
#
|
|
8
|
+
# OLD WORKFLOW (config.json required):
|
|
9
|
+
# /speckit.init --root spec-kit-tcm-plan
|
|
10
|
+
# /speckit.plan
|
|
11
|
+
# /speckit.tasks
|
|
12
|
+
#
|
|
13
|
+
# NEW WORKFLOW (no initialization needed):
|
|
14
|
+
# /speckit.plan spec-kit-tcm-plan 004-feature-name
|
|
15
|
+
# /speckit.tasks spec-kit-tcm-plan 004-feature-name
|
|
16
|
+
#
|
|
17
|
+
# All commands now receive two explicit arguments:
|
|
18
|
+
# 1. <speckit-root>: Path to spec-kit directory
|
|
19
|
+
# 2. <feature-name>: Name of the feature
|
|
20
|
+
#
|
|
21
|
+
# This eliminates the need for config.json and makes all operations explicit.
|
|
22
|
+
#
|
|
23
|
+
# If you need to migrate from Spec-Kit 1.0, simply start using the new
|
|
24
|
+
# command format. Your existing specs/ directories will work unchanged.
|
|
25
|
+
#
|
|
26
|
+
# ============================================================================
|
|
27
|
+
|
|
28
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
29
|
+
echo " ⚠️ DEPRECATED: /speckit.init is no longer needed in Spec-Kit 2.0"
|
|
30
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
31
|
+
echo ""
|
|
32
|
+
echo "Spec-Kit 2.0 uses explicit arguments instead of config.json."
|
|
33
|
+
echo ""
|
|
34
|
+
echo "NEW USAGE:"
|
|
35
|
+
echo " /speckit.plan <speckit-root> <feature-name>"
|
|
36
|
+
echo ""
|
|
37
|
+
echo "EXAMPLE:"
|
|
38
|
+
echo " /speckit.plan spec-kit-tcm-plan 004-project-guidance-deployment"
|
|
39
|
+
echo ""
|
|
40
|
+
echo "No initialization is required. Just use the commands with explicit paths!"
|
|
41
|
+
echo ""
|
|
42
|
+
exit 1
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
# Parse command line arguments
|
|
6
|
+
JSON_MODE=false
|
|
7
|
+
SPECKIT_ROOT_ARG=""
|
|
8
|
+
FEATURE_NAME_ARG=""
|
|
9
|
+
|
|
10
|
+
usage() {
|
|
11
|
+
echo "Usage: $0 [--json] <speckit-root> <feature-name>"
|
|
12
|
+
echo ""
|
|
13
|
+
echo "Arguments:"
|
|
14
|
+
echo " speckit-root Path to spec-kit root directory (e.g., spec-kit-tcm-plan)"
|
|
15
|
+
echo " feature-name Feature name (e.g., 004-project-guidance-deployment)"
|
|
16
|
+
echo ""
|
|
17
|
+
echo "Options:"
|
|
18
|
+
echo " --json Output results in JSON format"
|
|
19
|
+
echo " --help, -h Show this help message"
|
|
20
|
+
echo ""
|
|
21
|
+
echo "Examples:"
|
|
22
|
+
echo " $0 spec-kit-tcm-plan 004-project-guidance-deployment"
|
|
23
|
+
echo " $0 --json spec-kit-tcm-plan 004-project-guidance-deployment"
|
|
24
|
+
echo " $0 /absolute/path/to/spec-kit-tcm-plan 004-project-guidance-deployment"
|
|
25
|
+
exit 0
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
for arg in "$@"; do
|
|
29
|
+
case "$arg" in
|
|
30
|
+
--json)
|
|
31
|
+
JSON_MODE=true
|
|
32
|
+
;;
|
|
33
|
+
--help|-h)
|
|
34
|
+
usage
|
|
35
|
+
;;
|
|
36
|
+
-*)
|
|
37
|
+
echo "Unknown option: $arg" >&2
|
|
38
|
+
usage
|
|
39
|
+
;;
|
|
40
|
+
*)
|
|
41
|
+
# First positional arg = speckit-root, second = feature-name
|
|
42
|
+
if [[ -z "$SPECKIT_ROOT_ARG" ]]; then
|
|
43
|
+
SPECKIT_ROOT_ARG="$arg"
|
|
44
|
+
elif [[ -z "$FEATURE_NAME_ARG" ]]; then
|
|
45
|
+
FEATURE_NAME_ARG="$arg"
|
|
46
|
+
fi
|
|
47
|
+
;;
|
|
48
|
+
esac
|
|
49
|
+
done
|
|
50
|
+
|
|
51
|
+
# Validate required arguments
|
|
52
|
+
if [[ -z "$SPECKIT_ROOT_ARG" ]] || [[ -z "$FEATURE_NAME_ARG" ]]; then
|
|
53
|
+
echo "ERROR: Both <speckit-root> and <feature-name> are required" >&2
|
|
54
|
+
echo "" >&2
|
|
55
|
+
usage
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
# Get script directory and load common functions
|
|
59
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
60
|
+
source "$SCRIPT_DIR/common.sh"
|
|
61
|
+
|
|
62
|
+
# Get all paths from explicit arguments (no config.json needed!)
|
|
63
|
+
eval $(get_feature_paths "$SPECKIT_ROOT_ARG" "$FEATURE_NAME_ARG") || exit 1
|
|
64
|
+
|
|
65
|
+
# Validate speckit root exists
|
|
66
|
+
validate_speckit_root "$SPECKIT_ROOT" || exit 1
|
|
67
|
+
|
|
68
|
+
# Ensure specs directory exists
|
|
69
|
+
ensure_specs_dir "$SPECS_DIR"
|
|
70
|
+
|
|
71
|
+
# Ensure feature directory exists
|
|
72
|
+
mkdir -p "$FEATURE_DIR"
|
|
73
|
+
|
|
74
|
+
# Copy plan template if it exists
|
|
75
|
+
TEMPLATE="$TEMPLATES_DIR/plan-template.md"
|
|
76
|
+
if [[ -f "$TEMPLATE" ]]; then
|
|
77
|
+
cp "$TEMPLATE" "$IMPL_PLAN"
|
|
78
|
+
echo "Copied plan template to $IMPL_PLAN"
|
|
79
|
+
else
|
|
80
|
+
echo "Warning: Plan template not found at $TEMPLATE"
|
|
81
|
+
# Create a basic plan file if template doesn't exist
|
|
82
|
+
touch "$IMPL_PLAN"
|
|
83
|
+
fi
|
|
84
|
+
|
|
85
|
+
# Output results
|
|
86
|
+
if $JSON_MODE; then
|
|
87
|
+
printf '{"FEATURE_SPEC":"%s","IMPL_PLAN":"%s","FEATURE_DIR":"%s","FEATURE_NAME":"%s","SPECKIT_ROOT":"%s"}\n' \
|
|
88
|
+
"$FEATURE_SPEC" "$IMPL_PLAN" "$FEATURE_DIR" "$FEATURE_NAME" "$SPECKIT_ROOT"
|
|
89
|
+
else
|
|
90
|
+
echo "FEATURE_SPEC: $FEATURE_SPEC"
|
|
91
|
+
echo "IMPL_PLAN: $IMPL_PLAN"
|
|
92
|
+
echo "FEATURE_DIR: $FEATURE_DIR"
|
|
93
|
+
echo "FEATURE_NAME: $FEATURE_NAME"
|
|
94
|
+
echo "SPECKIT_ROOT: $SPECKIT_ROOT"
|
|
95
|
+
fi
|