forked from github/spec-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-plan.fish
More file actions
55 lines (47 loc) · 1.54 KB
/
setup-plan.fish
File metadata and controls
55 lines (47 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env fish
# Parse command line arguments
set JSON_MODE false
set ARGS
for arg in $argv
switch $arg
case --json
set JSON_MODE true
case --help -h
echo "Usage: setup-plan.fish [--json]"
echo " --json Output results in JSON format"
echo " --help Show this help message"
exit 0
case '*'
set -a ARGS $arg
end
end
# Get script directory and load common functions
set SCRIPT_DIR (dirname (status --current-filename))
source "$SCRIPT_DIR/common.fish"
# 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; or exit 1
# Ensure the feature directory exists
mkdir -p "$FEATURE_DIR"
# Copy plan template if it exists
set TEMPLATE "$REPO_ROOT/.specify/templates/plan-template.md"
if test -f "$TEMPLATE"
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"
end
# Output results
if test $JSON_MODE = true
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"
end