-
Notifications
You must be signed in to change notification settings - Fork 4
feat(scripts): harvest spec-kit upstream — argument-hints, --paths-only, --dry-run, gitflow detection (#75 #76 #77) #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7fed370
7b4fccd
1157d39
82d256e
22059bd
d0bca2f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -205,19 +205,29 @@ has_git && HAS_GIT="true" | |
| CURRENT_BRANCH=$(get_current_branch) | ||
|
|
||
| # Check feature branch (may set SPECIFY_FEATURE, may exit 2 for needs_selection) | ||
| STATUS_NO_FEATURE=false | ||
| NO_FEATURE_BRANCH=false | ||
| BRANCH_EXIT=0 | ||
| if [[ "$P_EXTRAS" == *"status_mode"* ]]; then | ||
| # Status mode: suppress stderr from branch validation (info goes in JSON only) | ||
| # paths_only and status_mode tolerate non-feature branches — they emit informational | ||
| # output rather than gating on branch shape. | ||
| SOFT_BRANCH_MODE=false | ||
| if [[ "$P_EXTRAS" == *"status_mode"* ]] || [[ "$P_EXTRAS" == *"paths_only"* ]]; then | ||
| SOFT_BRANCH_MODE=true | ||
| fi | ||
| if $SOFT_BRANCH_MODE; then | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| # Suppress stderr from branch validation (info goes in JSON only) | ||
| check_feature_branch "$CURRENT_BRANCH" "$HAS_GIT" 2>/dev/null || BRANCH_EXIT=$? | ||
| elif [[ "$PHASE" == "00" ]]; then | ||
| # Constitution phase: skip feature branch validation entirely | ||
| BRANCH_EXIT=0 | ||
| else | ||
| check_feature_branch "$CURRENT_BRANCH" "$HAS_GIT" || BRANCH_EXIT=$? | ||
| fi | ||
| if [[ $BRANCH_EXIT -eq 2 ]]; then | ||
| # Multiple features, no active one — caller should present picker | ||
| if [[ $BRANCH_EXIT -eq 2 ]] && [[ "$P_EXTRAS" != *"paths_only"* ]]; then | ||
| # Multiple features, no active one — caller should present picker. | ||
| # paths_only is the only mode that swallows this: callers asking only | ||
| # for paths (CI dry-runs, doctor #74) must never be blocked by a picker. | ||
| # status_mode still surfaces the picker so /iikit-core status can guide | ||
| # the user to select a feature. | ||
| FEATURES_JSON=$(list_features_json) | ||
| if $JSON_MODE; then | ||
| printf '{"needs_selection":true,"features":%s}\n' "$FEATURES_JSON" | ||
|
|
@@ -227,8 +237,10 @@ if [[ $BRANCH_EXIT -eq 2 ]]; then | |
| fi | ||
| exit 2 | ||
| elif [[ $BRANCH_EXIT -ne 0 ]]; then | ||
| if [[ "$P_EXTRAS" == *"status_mode"* ]]; then | ||
| # Status mode: no feature branch is informational, not fatal | ||
| if $SOFT_BRANCH_MODE; then | ||
| # Soft modes treat "no feature branch" as informational — emit empty | ||
| # path JSON instead of gating. (paths_only additionally swallows | ||
| # needs_selection per the branch above.) | ||
| FEATURE_DIR="" | ||
| FEATURE_SPEC="" | ||
| IMPL_PLAN="" | ||
|
|
@@ -237,14 +249,14 @@ elif [[ $BRANCH_EXIT -ne 0 ]]; then | |
| DATA_MODEL="" | ||
| QUICKSTART="" | ||
| CONTRACTS_DIR="" | ||
| STATUS_NO_FEATURE=true | ||
| NO_FEATURE_BRANCH=true | ||
| else | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| # Get all feature paths (uses SPECIFY_FEATURE if set by check_feature_branch) | ||
| if ! $STATUS_NO_FEATURE; then | ||
| if ! $NO_FEATURE_BRANCH; then | ||
| eval $(get_feature_paths) | ||
|
|
||
| # Override paths if --project-root was specified | ||
|
|
@@ -360,7 +372,7 @@ if [[ "$P_EXTRAS" == *"status_mode"* ]]; then | |
| if [[ -n "$FEATURE_DIR" && -d "$FEATURE_DIR" ]]; then | ||
| local_feature=$(basename "$FEATURE_DIR") | ||
| FEATURE_STAGE=$(get_feature_stage "$REPO_ROOT" "$local_feature") | ||
| elif $STATUS_NO_FEATURE; then | ||
| elif $NO_FEATURE_BRANCH; then | ||
| FEATURE_STAGE="unknown" | ||
| fi | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,9 +119,23 @@ if ($ProjectRoot) { | |
| } | ||
| $hasGit = Test-HasGit | ||
| $currentBranch = Get-CurrentBranch | ||
| $statusNoFeature = $false | ||
| $branchResult = Test-FeatureBranch -Branch $currentBranch -HasGit $hasGit | ||
| if ($branchResult -eq "NEEDS_SELECTION") { | ||
| $noFeatureBranch = $false | ||
| # paths_only and status_mode tolerate non-feature branches. | ||
| $softBranchMode = ($cfg.Extras -match 'status_mode') -or ($cfg.Extras -match 'paths_only') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| $pathsOnlyMode = ($cfg.Extras -match 'paths_only') | ||
| # In soft modes the script emits JSON or status text only — suppress | ||
| # Test-FeatureBranch's diagnostic warning/error streams so they cannot | ||
| # contaminate the structured payload. Mirrors `2>/dev/null` in the bash | ||
| # implementation. | ||
| if ($softBranchMode) { | ||
| $branchResult = Test-FeatureBranch -Branch $currentBranch -HasGit $hasGit 2>$null 3>$null | ||
| } else { | ||
| $branchResult = Test-FeatureBranch -Branch $currentBranch -HasGit $hasGit | ||
| } | ||
| if ($branchResult -eq "NEEDS_SELECTION" -and -not $pathsOnlyMode) { | ||
| # Multiple features, no active one — present picker. Only paths_only | ||
| # swallows this; status_mode still surfaces it so /iikit-core status | ||
| # can guide the user to select a feature. | ||
| $featuresJson = Get-FeaturesJson | ||
| if ($Json) { | ||
| Write-Output "{`"needs_selection`":true,`"features`":$featuresJson}" | ||
|
|
@@ -130,9 +144,11 @@ if ($branchResult -eq "NEEDS_SELECTION") { | |
| Write-Output "Run: /iikit-core use <feature> to select a feature." | ||
| } | ||
| exit 2 | ||
| } elseif ($branchResult -eq "ERROR") { | ||
| if ($cfg.Extras -match 'status_mode') { | ||
| $statusNoFeature = $true | ||
| } elseif ($branchResult -eq "ERROR" -or ($branchResult -eq "NEEDS_SELECTION" -and $pathsOnlyMode)) { | ||
| if ($softBranchMode) { | ||
| # Soft modes treat "no feature branch" as informational. | ||
| # paths_only additionally swallows needs_selection per the branch above. | ||
| $noFeatureBranch = $true | ||
| $paths = [PSCustomObject]@{ | ||
| REPO_ROOT = $repoRoot | ||
| CURRENT_BRANCH = $currentBranch | ||
|
|
@@ -151,8 +167,8 @@ if ($branchResult -eq "NEEDS_SELECTION") { | |
| } | ||
| } | ||
|
|
||
| # Get all feature paths (skip if status mode with no feature) | ||
| if (-not $statusNoFeature) { | ||
| # Get all feature paths (skip if soft branch mode with no feature) | ||
| if (-not $noFeatureBranch) { | ||
| $paths = Get-FeaturePathsEnv | ||
|
|
||
| # Override paths if -ProjectRoot was specified | ||
|
|
@@ -269,7 +285,7 @@ if ($cfg.Extras -match 'status_mode') { | |
| if ($paths.FEATURE_DIR -and (Test-Path $paths.FEATURE_DIR -PathType Container -ErrorAction SilentlyContinue)) { | ||
| $localFeature = Split-Path $paths.FEATURE_DIR -Leaf | ||
| $featureStage = Get-FeatureStage -RepoRoot $repoRoot -Feature $localFeature | ||
| } elseif ($statusNoFeature) { | ||
| } elseif ($noFeatureBranch) { | ||
| $featureStage = 'no-feature' | ||
| } | ||
|
|
||
|
|
@@ -290,7 +306,7 @@ if ($cfg.Extras -match 'status_mode') { | |
| if (-not $aConstitution) { | ||
| $nextStep = '/iikit-00-constitution' | ||
| $clearBefore = $false | ||
| } elseif ($statusNoFeature -or -not $paths.FEATURE_DIR -or -not (Test-Path $paths.FEATURE_DIR -PathType Container -ErrorAction SilentlyContinue)) { | ||
| } elseif ($noFeatureBranch -or -not $paths.FEATURE_DIR -or -not (Test-Path $paths.FEATURE_DIR -PathType Container -ErrorAction SilentlyContinue)) { | ||
| $nextStep = '/iikit-01-specify <description>' | ||
| $clearBefore = $false | ||
| } elseif (-not $vSpec) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jbaruch/coding-policy: skill-authoringsays: "Optional fields:allowed-tools,disable-model-invocation,user-invocable". This PR addsargument-hintfrontmatter to this skill (and the same pattern appears in the other changedSKILL.mdfiles), but that field is not permitted by the loaded skill frontmatter contract. Remove theseargument-hintentries, or update the policy first soargument-hintis an allowed skill frontmatter field before introducing it here.