framework-mcp 2.5.6 → 2.6.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/README.md +34 -9
- package/dist/core/safeguard-manager.js +4 -4
- package/dist/core/safeguard-manager.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces/http/http-server.js +3 -3
- package/dist/interfaces/mcp/mcp-server.js +3 -3
- package/dist/shared/types.d.ts +49 -25
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/shared/types.js.map +1 -1
- package/package.json +8 -1
- package/swagger.json +9 -77
- package/.claude/agents/mcp-developer.md +0 -41
- package/.claude/agents/project-orchestrator.md +0 -43
- package/.claude/agents/version-consistency-reviewer.md +0 -50
- package/.claude/commands/speckit.analyze.md +0 -184
- package/.claude/commands/speckit.checklist.md +0 -294
- package/.claude/commands/speckit.clarify.md +0 -181
- package/.claude/commands/speckit.constitution.md +0 -82
- package/.claude/commands/speckit.implement.md +0 -135
- package/.claude/commands/speckit.plan.md +0 -89
- package/.claude/commands/speckit.specify.md +0 -258
- package/.claude/commands/speckit.tasks.md +0 -137
- package/.claude/commands/speckit.taskstoissues.md +0 -30
- package/.claude/config.json +0 -11
- package/.claude_config.json +0 -11
- package/.do/app.yaml +0 -78
- package/.github/dependabot.yml +0 -15
- package/.github/workflows/ci.yml +0 -90
- package/.github/workflows/release.yml +0 -30
- package/.mcp.json +0 -11
- package/.specify/memory/constitution.md +0 -50
- package/.specify/scripts/bash/check-prerequisites.sh +0 -166
- package/.specify/scripts/bash/common.sh +0 -156
- package/.specify/scripts/bash/create-new-feature.sh +0 -297
- package/.specify/scripts/bash/setup-plan.sh +0 -61
- package/.specify/scripts/bash/update-agent-context.sh +0 -799
- package/.specify/templates/agent-file-template.md +0 -28
- package/.specify/templates/checklist-template.md +0 -40
- package/.specify/templates/plan-template.md +0 -104
- package/.specify/templates/spec-template.md +0 -115
- package/.specify/templates/tasks-template.md +0 -251
- package/examples/example-usage.md +0 -293
- package/examples/llm-analysis-patterns.md +0 -553
- package/examples/vendors.csv +0 -9
- package/examples/vendors.json +0 -32
- package/scripts/validate-documentation.sh +0 -150
- package/src/core/safeguard-manager.ts +0 -4634
- package/src/index.ts +0 -17
- package/src/interfaces/http/http-server.ts +0 -262
- package/src/interfaces/mcp/mcp-server.ts +0 -165
- package/src/shared/types.ts +0 -300
- package/tsconfig.json +0 -23
package/.do/app.yaml
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# DigitalOcean App Services Configuration
|
|
2
|
-
# Solves the stdio vs HTTP architecture mismatch
|
|
3
|
-
|
|
4
|
-
name: framework-mcp-api
|
|
5
|
-
region: nyc
|
|
6
|
-
|
|
7
|
-
services:
|
|
8
|
-
- name: api
|
|
9
|
-
source_dir: /
|
|
10
|
-
github:
|
|
11
|
-
repo: therealcybermattlee/FrameworkMCP
|
|
12
|
-
branch: main
|
|
13
|
-
deploy_on_push: true
|
|
14
|
-
|
|
15
|
-
# HTTP server configuration (NOT stdio)
|
|
16
|
-
run_command: npm run start:http
|
|
17
|
-
|
|
18
|
-
# DigitalOcean App Services requirements
|
|
19
|
-
environment_slug: node-js
|
|
20
|
-
instance_count: 1
|
|
21
|
-
instance_size_slug: basic-xxs
|
|
22
|
-
|
|
23
|
-
# HTTP port configuration (required for DigitalOcean)
|
|
24
|
-
http_port: 8080
|
|
25
|
-
|
|
26
|
-
# Health check configuration (required)
|
|
27
|
-
health_check:
|
|
28
|
-
http_path: /health
|
|
29
|
-
initial_delay_seconds: 60
|
|
30
|
-
period_seconds: 10
|
|
31
|
-
timeout_seconds: 5
|
|
32
|
-
success_threshold: 1
|
|
33
|
-
failure_threshold: 3
|
|
34
|
-
|
|
35
|
-
# Environment variables
|
|
36
|
-
envs:
|
|
37
|
-
- key: NODE_ENV
|
|
38
|
-
value: production
|
|
39
|
-
- key: PORT
|
|
40
|
-
value: "8080"
|
|
41
|
-
- key: ALLOWED_ORIGINS
|
|
42
|
-
value: "https://your-domain.com,https://app.your-domain.com"
|
|
43
|
-
|
|
44
|
-
# Resource allocation
|
|
45
|
-
cpu_count: 1
|
|
46
|
-
memory_mb: 512
|
|
47
|
-
|
|
48
|
-
# Auto-scaling configuration
|
|
49
|
-
instance_count: 1
|
|
50
|
-
instance_size_slug: basic-xxs
|
|
51
|
-
|
|
52
|
-
# Logging configuration
|
|
53
|
-
logs:
|
|
54
|
-
- name: app
|
|
55
|
-
location: /var/log/app.log
|
|
56
|
-
|
|
57
|
-
# Optional: Custom domain configuration
|
|
58
|
-
# domains:
|
|
59
|
-
# - domain: api.your-domain.com
|
|
60
|
-
# type: PRIMARY
|
|
61
|
-
|
|
62
|
-
# Database configuration (if needed in future)
|
|
63
|
-
# databases:
|
|
64
|
-
# - name: framework-db
|
|
65
|
-
# engine: PG
|
|
66
|
-
# version: "14"
|
|
67
|
-
# production: false
|
|
68
|
-
# size: basic-xxs
|
|
69
|
-
|
|
70
|
-
# Static site for documentation (optional)
|
|
71
|
-
# static_sites:
|
|
72
|
-
# - name: docs
|
|
73
|
-
# source_dir: /docs
|
|
74
|
-
# github:
|
|
75
|
-
# repo: therealcybermattlee/FrameworkMCP
|
|
76
|
-
# branch: main
|
|
77
|
-
# build_command: npm run build:docs
|
|
78
|
-
# output_dir: /dist
|
package/.github/dependabot.yml
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
version: 2
|
|
2
|
-
updates:
|
|
3
|
-
- package-ecosystem: "npm"
|
|
4
|
-
directory: "/"
|
|
5
|
-
schedule:
|
|
6
|
-
interval: "weekly"
|
|
7
|
-
open-pull-requests-limit: 10
|
|
8
|
-
groups:
|
|
9
|
-
security-updates:
|
|
10
|
-
applies-to: security-updates
|
|
11
|
-
|
|
12
|
-
- package-ecosystem: "github-actions"
|
|
13
|
-
directory: "/"
|
|
14
|
-
schedule:
|
|
15
|
-
interval: "weekly"
|
package/.github/workflows/ci.yml
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ main, develop ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ main ]
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
test:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
|
|
13
|
-
strategy:
|
|
14
|
-
matrix:
|
|
15
|
-
node-version: [18.x, 20.x]
|
|
16
|
-
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
|
|
20
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
21
|
-
uses: actions/setup-node@v4
|
|
22
|
-
with:
|
|
23
|
-
node-version: ${{ matrix.node-version }}
|
|
24
|
-
cache: 'npm'
|
|
25
|
-
|
|
26
|
-
- name: Install dependencies
|
|
27
|
-
run: npm ci
|
|
28
|
-
|
|
29
|
-
- name: Run linter
|
|
30
|
-
run: npm run lint --if-present
|
|
31
|
-
|
|
32
|
-
- name: Build
|
|
33
|
-
run: npm run build
|
|
34
|
-
|
|
35
|
-
- name: Run tests
|
|
36
|
-
run: npm test --if-present
|
|
37
|
-
|
|
38
|
-
security:
|
|
39
|
-
runs-on: ubuntu-latest
|
|
40
|
-
|
|
41
|
-
steps:
|
|
42
|
-
- uses: actions/checkout@v4
|
|
43
|
-
|
|
44
|
-
- name: Use Node.js
|
|
45
|
-
uses: actions/setup-node@v4
|
|
46
|
-
with:
|
|
47
|
-
node-version: '20.x'
|
|
48
|
-
cache: 'npm'
|
|
49
|
-
|
|
50
|
-
- name: Install dependencies
|
|
51
|
-
run: npm ci
|
|
52
|
-
|
|
53
|
-
- name: Security audit
|
|
54
|
-
run: npm audit --audit-level=high
|
|
55
|
-
|
|
56
|
-
publish:
|
|
57
|
-
needs: [test, security]
|
|
58
|
-
runs-on: ubuntu-latest
|
|
59
|
-
if: github.ref == 'refs/heads/main'
|
|
60
|
-
|
|
61
|
-
steps:
|
|
62
|
-
- uses: actions/checkout@v4
|
|
63
|
-
|
|
64
|
-
- name: Use Node.js
|
|
65
|
-
uses: actions/setup-node@v4
|
|
66
|
-
with:
|
|
67
|
-
node-version: '20.x'
|
|
68
|
-
registry-url: 'https://registry.npmjs.org'
|
|
69
|
-
|
|
70
|
-
- name: Install dependencies
|
|
71
|
-
run: npm ci
|
|
72
|
-
|
|
73
|
-
- name: Build
|
|
74
|
-
run: npm run build
|
|
75
|
-
|
|
76
|
-
- name: Check if version exists on npm
|
|
77
|
-
id: version-check
|
|
78
|
-
run: |
|
|
79
|
-
PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
|
80
|
-
if npm view framework-mcp@$PACKAGE_VERSION version 2>/dev/null; then
|
|
81
|
-
echo "exists=true" >> $GITHUB_OUTPUT
|
|
82
|
-
else
|
|
83
|
-
echo "exists=false" >> $GITHUB_OUTPUT
|
|
84
|
-
fi
|
|
85
|
-
|
|
86
|
-
- name: Publish to npm
|
|
87
|
-
if: steps.version-check.outputs.exists == 'false'
|
|
88
|
-
run: npm publish
|
|
89
|
-
env:
|
|
90
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
name: Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- 'v*'
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
publish:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v4
|
|
14
|
-
|
|
15
|
-
- name: Use Node.js
|
|
16
|
-
uses: actions/setup-node@v4
|
|
17
|
-
with:
|
|
18
|
-
node-version: '20.x'
|
|
19
|
-
registry-url: 'https://registry.npmjs.org'
|
|
20
|
-
|
|
21
|
-
- name: Install dependencies
|
|
22
|
-
run: npm ci
|
|
23
|
-
|
|
24
|
-
- name: Build
|
|
25
|
-
run: npm run build
|
|
26
|
-
|
|
27
|
-
- name: Publish to npm
|
|
28
|
-
run: npm publish
|
|
29
|
-
env:
|
|
30
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/.mcp.json
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# [PROJECT_NAME] Constitution
|
|
2
|
-
<!-- Example: Spec Constitution, TaskFlow Constitution, etc. -->
|
|
3
|
-
|
|
4
|
-
## Core Principles
|
|
5
|
-
|
|
6
|
-
### [PRINCIPLE_1_NAME]
|
|
7
|
-
<!-- Example: I. Library-First -->
|
|
8
|
-
[PRINCIPLE_1_DESCRIPTION]
|
|
9
|
-
<!-- Example: Every feature starts as a standalone library; Libraries must be self-contained, independently testable, documented; Clear purpose required - no organizational-only libraries -->
|
|
10
|
-
|
|
11
|
-
### [PRINCIPLE_2_NAME]
|
|
12
|
-
<!-- Example: II. CLI Interface -->
|
|
13
|
-
[PRINCIPLE_2_DESCRIPTION]
|
|
14
|
-
<!-- Example: Every library exposes functionality via CLI; Text in/out protocol: stdin/args → stdout, errors → stderr; Support JSON + human-readable formats -->
|
|
15
|
-
|
|
16
|
-
### [PRINCIPLE_3_NAME]
|
|
17
|
-
<!-- Example: III. Test-First (NON-NEGOTIABLE) -->
|
|
18
|
-
[PRINCIPLE_3_DESCRIPTION]
|
|
19
|
-
<!-- Example: TDD mandatory: Tests written → User approved → Tests fail → Then implement; Red-Green-Refactor cycle strictly enforced -->
|
|
20
|
-
|
|
21
|
-
### [PRINCIPLE_4_NAME]
|
|
22
|
-
<!-- Example: IV. Integration Testing -->
|
|
23
|
-
[PRINCIPLE_4_DESCRIPTION]
|
|
24
|
-
<!-- Example: Focus areas requiring integration tests: New library contract tests, Contract changes, Inter-service communication, Shared schemas -->
|
|
25
|
-
|
|
26
|
-
### [PRINCIPLE_5_NAME]
|
|
27
|
-
<!-- Example: V. Observability, VI. Versioning & Breaking Changes, VII. Simplicity -->
|
|
28
|
-
[PRINCIPLE_5_DESCRIPTION]
|
|
29
|
-
<!-- Example: Text I/O ensures debuggability; Structured logging required; Or: MAJOR.MINOR.BUILD format; Or: Start simple, YAGNI principles -->
|
|
30
|
-
|
|
31
|
-
## [SECTION_2_NAME]
|
|
32
|
-
<!-- Example: Additional Constraints, Security Requirements, Performance Standards, etc. -->
|
|
33
|
-
|
|
34
|
-
[SECTION_2_CONTENT]
|
|
35
|
-
<!-- Example: Technology stack requirements, compliance standards, deployment policies, etc. -->
|
|
36
|
-
|
|
37
|
-
## [SECTION_3_NAME]
|
|
38
|
-
<!-- Example: Development Workflow, Review Process, Quality Gates, etc. -->
|
|
39
|
-
|
|
40
|
-
[SECTION_3_CONTENT]
|
|
41
|
-
<!-- Example: Code review requirements, testing gates, deployment approval process, etc. -->
|
|
42
|
-
|
|
43
|
-
## Governance
|
|
44
|
-
<!-- Example: Constitution supersedes all other practices; Amendments require documentation, approval, migration plan -->
|
|
45
|
-
|
|
46
|
-
[GOVERNANCE_RULES]
|
|
47
|
-
<!-- Example: All PRs/reviews must verify compliance; Complexity must be justified; Use [GUIDANCE_FILE] for runtime development guidance -->
|
|
48
|
-
|
|
49
|
-
**Version**: [CONSTITUTION_VERSION] | **Ratified**: [RATIFICATION_DATE] | **Last Amended**: [LAST_AMENDED_DATE]
|
|
50
|
-
<!-- Example: Version: 2.1.1 | Ratified: 2025-06-13 | Last Amended: 2025-07-16 -->
|
|
@@ -1,166 +0,0 @@
|
|
|
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
|
-
eval $(get_feature_paths)
|
|
83
|
-
check_feature_branch "$CURRENT_BRANCH" "$HAS_GIT" || exit 1
|
|
84
|
-
|
|
85
|
-
# If paths-only mode, output paths and exit (support JSON + paths-only combined)
|
|
86
|
-
if $PATHS_ONLY; then
|
|
87
|
-
if $JSON_MODE; then
|
|
88
|
-
# Minimal JSON paths payload (no validation performed)
|
|
89
|
-
printf '{"REPO_ROOT":"%s","BRANCH":"%s","FEATURE_DIR":"%s","FEATURE_SPEC":"%s","IMPL_PLAN":"%s","TASKS":"%s"}\n' \
|
|
90
|
-
"$REPO_ROOT" "$CURRENT_BRANCH" "$FEATURE_DIR" "$FEATURE_SPEC" "$IMPL_PLAN" "$TASKS"
|
|
91
|
-
else
|
|
92
|
-
echo "REPO_ROOT: $REPO_ROOT"
|
|
93
|
-
echo "BRANCH: $CURRENT_BRANCH"
|
|
94
|
-
echo "FEATURE_DIR: $FEATURE_DIR"
|
|
95
|
-
echo "FEATURE_SPEC: $FEATURE_SPEC"
|
|
96
|
-
echo "IMPL_PLAN: $IMPL_PLAN"
|
|
97
|
-
echo "TASKS: $TASKS"
|
|
98
|
-
fi
|
|
99
|
-
exit 0
|
|
100
|
-
fi
|
|
101
|
-
|
|
102
|
-
# Validate required directories and files
|
|
103
|
-
if [[ ! -d "$FEATURE_DIR" ]]; then
|
|
104
|
-
echo "ERROR: Feature directory not found: $FEATURE_DIR" >&2
|
|
105
|
-
echo "Run /speckit.specify first to create the feature structure." >&2
|
|
106
|
-
exit 1
|
|
107
|
-
fi
|
|
108
|
-
|
|
109
|
-
if [[ ! -f "$IMPL_PLAN" ]]; then
|
|
110
|
-
echo "ERROR: plan.md not found in $FEATURE_DIR" >&2
|
|
111
|
-
echo "Run /speckit.plan first to create the implementation plan." >&2
|
|
112
|
-
exit 1
|
|
113
|
-
fi
|
|
114
|
-
|
|
115
|
-
# Check for tasks.md if required
|
|
116
|
-
if $REQUIRE_TASKS && [[ ! -f "$TASKS" ]]; then
|
|
117
|
-
echo "ERROR: tasks.md not found in $FEATURE_DIR" >&2
|
|
118
|
-
echo "Run /speckit.tasks first to create the task list." >&2
|
|
119
|
-
exit 1
|
|
120
|
-
fi
|
|
121
|
-
|
|
122
|
-
# Build list of available documents
|
|
123
|
-
docs=()
|
|
124
|
-
|
|
125
|
-
# Always check these optional docs
|
|
126
|
-
[[ -f "$RESEARCH" ]] && docs+=("research.md")
|
|
127
|
-
[[ -f "$DATA_MODEL" ]] && docs+=("data-model.md")
|
|
128
|
-
|
|
129
|
-
# Check contracts directory (only if it exists and has files)
|
|
130
|
-
if [[ -d "$CONTRACTS_DIR" ]] && [[ -n "$(ls -A "$CONTRACTS_DIR" 2>/dev/null)" ]]; then
|
|
131
|
-
docs+=("contracts/")
|
|
132
|
-
fi
|
|
133
|
-
|
|
134
|
-
[[ -f "$QUICKSTART" ]] && docs+=("quickstart.md")
|
|
135
|
-
|
|
136
|
-
# Include tasks.md if requested and it exists
|
|
137
|
-
if $INCLUDE_TASKS && [[ -f "$TASKS" ]]; then
|
|
138
|
-
docs+=("tasks.md")
|
|
139
|
-
fi
|
|
140
|
-
|
|
141
|
-
# Output results
|
|
142
|
-
if $JSON_MODE; then
|
|
143
|
-
# Build JSON array of documents
|
|
144
|
-
if [[ ${#docs[@]} -eq 0 ]]; then
|
|
145
|
-
json_docs="[]"
|
|
146
|
-
else
|
|
147
|
-
json_docs=$(printf '"%s",' "${docs[@]}")
|
|
148
|
-
json_docs="[${json_docs%,}]"
|
|
149
|
-
fi
|
|
150
|
-
|
|
151
|
-
printf '{"FEATURE_DIR":"%s","AVAILABLE_DOCS":%s}\n' "$FEATURE_DIR" "$json_docs"
|
|
152
|
-
else
|
|
153
|
-
# Text output
|
|
154
|
-
echo "FEATURE_DIR:$FEATURE_DIR"
|
|
155
|
-
echo "AVAILABLE_DOCS:"
|
|
156
|
-
|
|
157
|
-
# Show status of each potential document
|
|
158
|
-
check_file "$RESEARCH" "research.md"
|
|
159
|
-
check_file "$DATA_MODEL" "data-model.md"
|
|
160
|
-
check_dir "$CONTRACTS_DIR" "contracts/"
|
|
161
|
-
check_file "$QUICKSTART" "quickstart.md"
|
|
162
|
-
|
|
163
|
-
if $INCLUDE_TASKS; then
|
|
164
|
-
check_file "$TASKS" "tasks.md"
|
|
165
|
-
fi
|
|
166
|
-
fi
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Common functions and variables for all scripts
|
|
3
|
-
|
|
4
|
-
# Get repository root, with fallback for non-git repositories
|
|
5
|
-
get_repo_root() {
|
|
6
|
-
if git rev-parse --show-toplevel >/dev/null 2>&1; then
|
|
7
|
-
git rev-parse --show-toplevel
|
|
8
|
-
else
|
|
9
|
-
# Fall back to script location for non-git repos
|
|
10
|
-
local script_dir="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
11
|
-
(cd "$script_dir/../../.." && pwd)
|
|
12
|
-
fi
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
# Get current branch, with fallback for non-git repositories
|
|
16
|
-
get_current_branch() {
|
|
17
|
-
# First check if SPECIFY_FEATURE environment variable is set
|
|
18
|
-
if [[ -n "${SPECIFY_FEATURE:-}" ]]; then
|
|
19
|
-
echo "$SPECIFY_FEATURE"
|
|
20
|
-
return
|
|
21
|
-
fi
|
|
22
|
-
|
|
23
|
-
# Then check git if available
|
|
24
|
-
if git rev-parse --abbrev-ref HEAD >/dev/null 2>&1; then
|
|
25
|
-
git rev-parse --abbrev-ref HEAD
|
|
26
|
-
return
|
|
27
|
-
fi
|
|
28
|
-
|
|
29
|
-
# For non-git repos, try to find the latest feature directory
|
|
30
|
-
local repo_root=$(get_repo_root)
|
|
31
|
-
local specs_dir="$repo_root/specs"
|
|
32
|
-
|
|
33
|
-
if [[ -d "$specs_dir" ]]; then
|
|
34
|
-
local latest_feature=""
|
|
35
|
-
local highest=0
|
|
36
|
-
|
|
37
|
-
for dir in "$specs_dir"/*; do
|
|
38
|
-
if [[ -d "$dir" ]]; then
|
|
39
|
-
local dirname=$(basename "$dir")
|
|
40
|
-
if [[ "$dirname" =~ ^([0-9]{3})- ]]; then
|
|
41
|
-
local number=${BASH_REMATCH[1]}
|
|
42
|
-
number=$((10#$number))
|
|
43
|
-
if [[ "$number" -gt "$highest" ]]; then
|
|
44
|
-
highest=$number
|
|
45
|
-
latest_feature=$dirname
|
|
46
|
-
fi
|
|
47
|
-
fi
|
|
48
|
-
fi
|
|
49
|
-
done
|
|
50
|
-
|
|
51
|
-
if [[ -n "$latest_feature" ]]; then
|
|
52
|
-
echo "$latest_feature"
|
|
53
|
-
return
|
|
54
|
-
fi
|
|
55
|
-
fi
|
|
56
|
-
|
|
57
|
-
echo "main" # Final fallback
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
# Check if we have git available
|
|
61
|
-
has_git() {
|
|
62
|
-
git rev-parse --show-toplevel >/dev/null 2>&1
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
check_feature_branch() {
|
|
66
|
-
local branch="$1"
|
|
67
|
-
local has_git_repo="$2"
|
|
68
|
-
|
|
69
|
-
# For non-git repos, we can't enforce branch naming but still provide output
|
|
70
|
-
if [[ "$has_git_repo" != "true" ]]; then
|
|
71
|
-
echo "[specify] Warning: Git repository not detected; skipped branch validation" >&2
|
|
72
|
-
return 0
|
|
73
|
-
fi
|
|
74
|
-
|
|
75
|
-
if [[ ! "$branch" =~ ^[0-9]{3}- ]]; then
|
|
76
|
-
echo "ERROR: Not on a feature branch. Current branch: $branch" >&2
|
|
77
|
-
echo "Feature branches should be named like: 001-feature-name" >&2
|
|
78
|
-
return 1
|
|
79
|
-
fi
|
|
80
|
-
|
|
81
|
-
return 0
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
get_feature_dir() { echo "$1/specs/$2"; }
|
|
85
|
-
|
|
86
|
-
# Find feature directory by numeric prefix instead of exact branch match
|
|
87
|
-
# This allows multiple branches to work on the same spec (e.g., 004-fix-bug, 004-add-feature)
|
|
88
|
-
find_feature_dir_by_prefix() {
|
|
89
|
-
local repo_root="$1"
|
|
90
|
-
local branch_name="$2"
|
|
91
|
-
local specs_dir="$repo_root/specs"
|
|
92
|
-
|
|
93
|
-
# Extract numeric prefix from branch (e.g., "004" from "004-whatever")
|
|
94
|
-
if [[ ! "$branch_name" =~ ^([0-9]{3})- ]]; then
|
|
95
|
-
# If branch doesn't have numeric prefix, fall back to exact match
|
|
96
|
-
echo "$specs_dir/$branch_name"
|
|
97
|
-
return
|
|
98
|
-
fi
|
|
99
|
-
|
|
100
|
-
local prefix="${BASH_REMATCH[1]}"
|
|
101
|
-
|
|
102
|
-
# Search for directories in specs/ that start with this prefix
|
|
103
|
-
local matches=()
|
|
104
|
-
if [[ -d "$specs_dir" ]]; then
|
|
105
|
-
for dir in "$specs_dir"/"$prefix"-*; do
|
|
106
|
-
if [[ -d "$dir" ]]; then
|
|
107
|
-
matches+=("$(basename "$dir")")
|
|
108
|
-
fi
|
|
109
|
-
done
|
|
110
|
-
fi
|
|
111
|
-
|
|
112
|
-
# Handle results
|
|
113
|
-
if [[ ${#matches[@]} -eq 0 ]]; then
|
|
114
|
-
# No match found - return the branch name path (will fail later with clear error)
|
|
115
|
-
echo "$specs_dir/$branch_name"
|
|
116
|
-
elif [[ ${#matches[@]} -eq 1 ]]; then
|
|
117
|
-
# Exactly one match - perfect!
|
|
118
|
-
echo "$specs_dir/${matches[0]}"
|
|
119
|
-
else
|
|
120
|
-
# Multiple matches - this shouldn't happen with proper naming convention
|
|
121
|
-
echo "ERROR: Multiple spec directories found with prefix '$prefix': ${matches[*]}" >&2
|
|
122
|
-
echo "Please ensure only one spec directory exists per numeric prefix." >&2
|
|
123
|
-
echo "$specs_dir/$branch_name" # Return something to avoid breaking the script
|
|
124
|
-
fi
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
get_feature_paths() {
|
|
128
|
-
local repo_root=$(get_repo_root)
|
|
129
|
-
local current_branch=$(get_current_branch)
|
|
130
|
-
local has_git_repo="false"
|
|
131
|
-
|
|
132
|
-
if has_git; then
|
|
133
|
-
has_git_repo="true"
|
|
134
|
-
fi
|
|
135
|
-
|
|
136
|
-
# Use prefix-based lookup to support multiple branches per spec
|
|
137
|
-
local feature_dir=$(find_feature_dir_by_prefix "$repo_root" "$current_branch")
|
|
138
|
-
|
|
139
|
-
cat <<EOF
|
|
140
|
-
REPO_ROOT='$repo_root'
|
|
141
|
-
CURRENT_BRANCH='$current_branch'
|
|
142
|
-
HAS_GIT='$has_git_repo'
|
|
143
|
-
FEATURE_DIR='$feature_dir'
|
|
144
|
-
FEATURE_SPEC='$feature_dir/spec.md'
|
|
145
|
-
IMPL_PLAN='$feature_dir/plan.md'
|
|
146
|
-
TASKS='$feature_dir/tasks.md'
|
|
147
|
-
RESEARCH='$feature_dir/research.md'
|
|
148
|
-
DATA_MODEL='$feature_dir/data-model.md'
|
|
149
|
-
QUICKSTART='$feature_dir/quickstart.md'
|
|
150
|
-
CONTRACTS_DIR='$feature_dir/contracts'
|
|
151
|
-
EOF
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
check_file() { [[ -f "$1" ]] && echo " ✓ $2" || echo " ✗ $2"; }
|
|
155
|
-
check_dir() { [[ -d "$1" && -n $(ls -A "$1" 2>/dev/null) ]] && echo " ✓ $2" || echo " ✗ $2"; }
|
|
156
|
-
|