fraim-framework 2.0.36 → 2.0.38
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/bin/fraim.js +5 -52
- package/dist/registry/scripts/build-scripts-generator.js +205 -0
- package/dist/registry/scripts/fraim-config.js +61 -0
- package/dist/registry/scripts/generic-issues-api.js +100 -0
- package/dist/registry/scripts/openapi-generator.js +664 -0
- package/dist/registry/scripts/performance/profile-server.js +390 -0
- package/dist/scripts/build-stub-registry.js +108 -0
- package/dist/src/cli/commands/doctor.js +5 -5
- package/dist/src/cli/commands/init-project.js +74 -0
- package/dist/src/cli/commands/setup.js +176 -0
- package/dist/src/cli/commands/sync.js +33 -19
- package/dist/src/cli/commands/test-mcp.js +135 -0
- package/dist/src/cli/fraim.js +6 -0
- package/dist/src/cli/setup/auto-mcp-setup.js +367 -0
- package/dist/src/cli/setup/ide-detector.js +163 -0
- package/dist/src/cli/setup/mcp-config-generator.js +115 -0
- package/dist/src/cli/setup/token-validator.js +49 -0
- package/dist/test-utils.js +96 -0
- package/dist/tests/debug-tools.js +2 -2
- package/dist/tests/esm-compat.js +11 -0
- package/dist/tests/shared-server-utils.js +57 -0
- package/dist/tests/test-chalk-esm-issue.js +159 -0
- package/dist/tests/test-chalk-real-world.js +265 -0
- package/dist/tests/test-chalk-regression.js +2 -18
- package/dist/tests/test-chalk-resolution-issue.js +304 -0
- package/dist/tests/test-client-scripts-validation.js +27 -5
- package/dist/tests/test-complete-setup-flow.js +110 -0
- package/dist/tests/test-fraim-install-chalk-issue.js +254 -0
- package/dist/tests/test-ide-detector.js +46 -0
- package/dist/tests/test-improved-setup.js +121 -0
- package/dist/tests/test-mcp-config-generator.js +70 -0
- package/dist/tests/test-mcp-connection.js +58 -117
- package/dist/tests/test-mcp-issue-integration.js +2 -2
- package/dist/tests/test-mcp-lifecycle-methods.js +34 -100
- package/dist/tests/test-mcp-shared-server.js +308 -0
- package/dist/tests/test-npm-resolution-diagnostic.js +140 -0
- package/dist/tests/test-package-size.js +101 -0
- package/dist/tests/test-prep-issue.js +34 -1
- package/dist/tests/test-script-location-independence.js +39 -62
- package/dist/tests/test-server-utils.js +32 -0
- package/dist/tests/test-session-rehydration.js +2 -2
- package/dist/tests/test-setup-integration.js +98 -0
- package/dist/tests/test-standalone.js +2 -2
- package/dist/tests/test-stub-registry.js +136 -0
- package/dist/tests/test-sync-stubs.js +143 -0
- package/dist/tests/test-telemetry.js +2 -2
- package/dist/tests/test-token-validator.js +30 -0
- package/dist/tests/test-user-journey.js +2 -1
- package/package.json +7 -9
- package/registry/agent-guardrails.md +62 -62
- package/registry/scripts/code-quality-check.sh +559 -559
- package/registry/scripts/detect-tautological-tests.sh +38 -38
- package/registry/scripts/prep-issue.sh +61 -30
- package/registry/scripts/validate-openapi-limits.ts +366 -366
- package/registry/scripts/validate-test-coverage.ts +280 -280
- package/registry/scripts/verify-pr-comments.sh +70 -70
- package/registry/stubs/workflows/bootstrap/create-architecture.md +11 -0
- package/registry/stubs/workflows/bootstrap/detect-broken-windows.md +11 -0
- package/registry/stubs/workflows/bootstrap/evaluate-code-quality.md +11 -0
- package/registry/stubs/workflows/bootstrap/verify-test-coverage.md +11 -0
- package/registry/stubs/workflows/business-development/create-business-plan.md +11 -0
- package/registry/stubs/workflows/business-development/ideate-business-opportunity.md +11 -0
- package/registry/stubs/workflows/business-development/price-product.md +18 -0
- package/registry/stubs/workflows/convert-to-pdf.md +11 -0
- package/registry/stubs/workflows/customer-development/insight-analysis.md +11 -0
- package/registry/stubs/workflows/customer-development/insight-triage.md +11 -0
- package/registry/stubs/workflows/customer-development/interview-preparation.md +11 -0
- package/registry/stubs/workflows/customer-development/linkedin-outreach.md +11 -0
- package/registry/stubs/workflows/customer-development/strategic-brainstorming.md +11 -0
- package/registry/stubs/workflows/customer-development/thank-customers.md +11 -0
- package/registry/stubs/workflows/customer-development/weekly-newsletter.md +11 -0
- package/registry/stubs/workflows/deploy/cloud-deployment.md +11 -0
- package/registry/stubs/workflows/improve-fraim/contribute.md +11 -0
- package/registry/stubs/workflows/improve-fraim/file-issue.md +11 -0
- package/registry/stubs/workflows/marketing/content-creation.md +11 -0
- package/registry/stubs/workflows/marketing/hbr-article.md +11 -0
- package/registry/stubs/workflows/marketing/launch-checklist.md +11 -0
- package/registry/stubs/workflows/marketing/marketing-strategy.md +11 -0
- package/registry/stubs/workflows/marketing/storytelling.md +11 -0
- package/registry/stubs/workflows/performance/analyze-performance.md +11 -0
- package/registry/stubs/workflows/product-building/design.md +11 -0
- package/registry/stubs/workflows/product-building/implement.md +12 -0
- package/registry/stubs/workflows/product-building/iterate-on-pr-comments.md +11 -0
- package/registry/stubs/workflows/product-building/prep-issue.md +11 -0
- package/registry/stubs/workflows/product-building/prototype.md +11 -0
- package/registry/stubs/workflows/product-building/resolve.md +11 -0
- package/registry/stubs/workflows/product-building/retrospect.md +11 -0
- package/registry/stubs/workflows/product-building/spec.md +11 -0
- package/registry/stubs/workflows/product-building/test.md +11 -0
- package/registry/stubs/workflows/quality-assurance/browser-validation.md +11 -0
- package/registry/stubs/workflows/quality-assurance/iterative-improvement-cycle.md +11 -0
- package/registry/stubs/workflows/replicate/replicate-discovery.md +11 -0
- package/registry/stubs/workflows/replicate/replicate-to-issues.md +11 -0
- package/registry/stubs/workflows/reviewer/review-implementation-vs-design-spec.md +11 -0
- package/registry/stubs/workflows/reviewer/review-implementation-vs-feature-spec.md +11 -0
- package/registry/stubs/workflows/startup-credits/aws-activate-application.md +11 -0
- package/registry/stubs/workflows/startup-credits/google-cloud-application.md +11 -0
- package/registry/stubs/workflows/startup-credits/microsoft-azure-application.md +11 -0
- package/.github/workflows/ci.yml +0 -65
- package/.github/workflows/deploy-fraim.yml +0 -87
- package/.github/workflows/phase-change.yml +0 -251
- package/.github/workflows/status-change.yml +0 -68
- package/.github/workflows/sync-on-pr-review.yml +0 -66
- package/examples/simple-webapp/TESTING.md +0 -62
- package/examples/simple-webapp/example-test.ts +0 -186
- package/registry/github/workflows/ci.yml +0 -51
- package/registry/github/workflows/phase-change.yml +0 -251
- package/registry/github/workflows/status-change.yml +0 -68
- package/registry/github/workflows/sync-on-pr-review.yml +0 -66
- package/registry/mcp-template.jsonc +0 -29
- package/registry/rules/agent-success-criteria.md +0 -52
- package/registry/rules/agent-testing-guidelines.md +0 -502
- package/registry/rules/architecture.md +0 -52
- package/registry/rules/communication.md +0 -122
- package/registry/rules/continuous-learning.md +0 -55
- package/registry/rules/debugging-multitenancy-issues.md +0 -85
- package/registry/rules/ephemeral-execution.md +0 -57
- package/registry/rules/git-safe-commands.md +0 -34
- package/registry/rules/hitl-ppe-record-analysis.md +0 -302
- package/registry/rules/integrity-and-test-ethics.md +0 -275
- package/registry/rules/local-development.md +0 -254
- package/registry/rules/merge-requirements.md +0 -231
- package/registry/rules/simplicity.md +0 -118
- package/registry/rules/software-development-lifecycle.md +0 -105
- package/registry/rules/spike-first-development.md +0 -205
- package/registry/rules/successful-debugging-patterns.md +0 -491
- package/registry/rules/telemetry.md +0 -67
- package/registry/templates/bootstrap/ARCHITECTURE-TEMPLATE.md +0 -53
- package/registry/templates/bootstrap/CODE-QUALITY-REPORT-TEMPLATE.md +0 -37
- package/registry/templates/bootstrap/TEST-COVERAGE-REPORT-TEMPLATE.md +0 -35
- package/registry/templates/business-development/IDEATION-REPORT-TEMPLATE.md +0 -29
- package/registry/templates/business-development/PRICING-STRATEGY-TEMPLATE.md +0 -126
- package/registry/templates/customer-development/customer-interview-template.md +0 -99
- package/registry/templates/customer-development/follow-up-email-templates.md +0 -132
- package/registry/templates/customer-development/insight-analysis-template.md +0 -74
- package/registry/templates/customer-development/strategic-recommendations-template.md +0 -53
- package/registry/templates/customer-development/thank-you-email-template.html +0 -124
- package/registry/templates/customer-development/thank-you-note-template.md +0 -16
- package/registry/templates/customer-development/triage-log-template.md +0 -278
- package/registry/templates/customer-development/weekly-newsletter-template.html +0 -204
- package/registry/templates/evidence/Design-Evidence.md +0 -30
- package/registry/templates/evidence/Implementation-BugEvidence.md +0 -86
- package/registry/templates/evidence/Implementation-FeatureEvidence.md +0 -121
- package/registry/templates/evidence/Spec-Evidence.md +0 -19
- package/registry/templates/help/HelpNeeded.md +0 -14
- package/registry/templates/marketing/HBR-ARTICLE-TEMPLATE.md +0 -66
- package/registry/templates/replicate/implementation-checklist.md +0 -39
- package/registry/templates/replicate/use-cases-template.md +0 -88
- package/registry/templates/retrospective/RETROSPECTIVE-TEMPLATE.md +0 -55
- package/registry/templates/specs/BUGSPEC-TEMPLATE.md +0 -37
- package/registry/templates/specs/FEATURESPEC-TEMPLATE.md +0 -29
- package/registry/templates/specs/TECHSPEC-TEMPLATE.md +0 -39
- package/registry/workflows/bootstrap/create-architecture.md +0 -38
- package/registry/workflows/bootstrap/evaluate-code-quality.md +0 -36
- package/registry/workflows/bootstrap/verify-test-coverage.md +0 -37
- package/registry/workflows/business-development/create-business-plan.md +0 -737
- package/registry/workflows/business-development/ideate-business-opportunity.md +0 -55
- package/registry/workflows/business-development/price-product.md +0 -325
- package/registry/workflows/convert-to-pdf.md +0 -235
- package/registry/workflows/customer-development/insight-analysis.md +0 -156
- package/registry/workflows/customer-development/insight-triage.md +0 -933
- package/registry/workflows/customer-development/interview-preparation.md +0 -421
- package/registry/workflows/customer-development/linkedin-outreach.md +0 -593
- package/registry/workflows/customer-development/strategic-brainstorming.md +0 -146
- package/registry/workflows/customer-development/thank-customers.md +0 -203
- package/registry/workflows/customer-development/weekly-newsletter.md +0 -366
- package/registry/workflows/deploy/cloud-deployment.md +0 -310
- package/registry/workflows/improve-fraim/contribute.md +0 -32
- package/registry/workflows/improve-fraim/file-issue.md +0 -32
- package/registry/workflows/marketing/content-creation.md +0 -37
- package/registry/workflows/marketing/hbr-article.md +0 -73
- package/registry/workflows/marketing/launch-checklist.md +0 -37
- package/registry/workflows/marketing/marketing-strategy.md +0 -45
- package/registry/workflows/performance/analyze-performance.md +0 -65
- package/registry/workflows/product-building/design.md +0 -130
- package/registry/workflows/product-building/implement.md +0 -315
- package/registry/workflows/product-building/iterate-on-pr-comments.md +0 -70
- package/registry/workflows/product-building/prep-issue.md +0 -43
- package/registry/workflows/product-building/prototype.md +0 -60
- package/registry/workflows/product-building/resolve.md +0 -164
- package/registry/workflows/product-building/retrospect.md +0 -86
- package/registry/workflows/product-building/spec.md +0 -117
- package/registry/workflows/product-building/test.md +0 -120
- package/registry/workflows/quality-assurance/browser-validation.md +0 -221
- package/registry/workflows/quality-assurance/iterative-improvement-cycle.md +0 -562
- package/registry/workflows/replicate/replicate-discovery.md +0 -336
- package/registry/workflows/replicate/replicate-to-issues.md +0 -319
- package/registry/workflows/reviewer/review-implementation-vs-design-spec.md +0 -632
- package/registry/workflows/reviewer/review-implementation-vs-feature-spec.md +0 -669
- package/registry/workflows/startup-credits/aws-activate-application.md +0 -535
- package/registry/workflows/startup-credits/google-cloud-application.md +0 -647
- package/registry/workflows/startup-credits/microsoft-azure-application.md +0 -538
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Detect Tautological Tests
|
|
4
|
-
# This script scans test files for patterns that suggest tests are validating code structure
|
|
5
|
-
# (interfaces, enums) rather than runtime behavior.
|
|
6
|
-
|
|
7
|
-
echo "🔍 Scanning for Tautological Test Patterns..."
|
|
8
|
-
ERROR_FOUND=0
|
|
9
|
-
|
|
10
|
-
# Pattern 1: Asserting an array literal equals another array literal (common in enum testing)
|
|
11
|
-
# Looks for: assert.deepEqual(['a', 'b'], ['a', 'b'])
|
|
12
|
-
if grep -rE "assert\.(deep)?(Strict)?Equal\(\[.*\], \[.*\]\)" test*.ts; then
|
|
13
|
-
echo "❌ ERROR: Found potential tautological array comparison. Tests should verify app logic, not hardcoded arrays."
|
|
14
|
-
echo " Rationale: Testing that ['A'] equals ['A'] validates nothing about the application."
|
|
15
|
-
ERROR_FOUND=1
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
# Pattern 2: Asserting properties on an object literal defined in the test (Type/Interface testing)
|
|
19
|
-
# Simplified: Look for defining a typed object and immediately asserting on it in the same file
|
|
20
|
-
# This is hard to do robustly with just grep, so we'll rely on the Naming Convention check for now.
|
|
21
|
-
|
|
22
|
-
# Pattern 3: Test names that explicitly say "Validate Enums", "Validate Fields", etc.
|
|
23
|
-
# We match "Validate TaskStatus Enums" or similar phrases
|
|
24
|
-
if grep -riE "['\"]Unit: Validate (Enum|Constant|Interface|Type|Field|Object|TaskStatus|Task Object)" test*.ts; then
|
|
25
|
-
echo "❌ ERROR: Found test descriptions explicitly claiming to validate Enums/Types/Fields."
|
|
26
|
-
echo " Rationale: Unit tests should validate BEHAVIOR (e.g., 'persists correct status'), not definitions."
|
|
27
|
-
ERROR_FOUND=1
|
|
28
|
-
fi
|
|
29
|
-
|
|
30
|
-
if [ $ERROR_FOUND -eq 1 ]; then
|
|
31
|
-
echo ""
|
|
32
|
-
echo "⚠️ Potential Anti-Patterns Detected."
|
|
33
|
-
echo " Please review the identified tests against rules/integrity-and-test-ethics.md"
|
|
34
|
-
exit 1
|
|
35
|
-
else
|
|
36
|
-
echo "✅ No obvious tautological patterns found."
|
|
37
|
-
exit 0
|
|
38
|
-
fi
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Detect Tautological Tests
|
|
4
|
+
# This script scans test files for patterns that suggest tests are validating code structure
|
|
5
|
+
# (interfaces, enums) rather than runtime behavior.
|
|
6
|
+
|
|
7
|
+
echo "🔍 Scanning for Tautological Test Patterns..."
|
|
8
|
+
ERROR_FOUND=0
|
|
9
|
+
|
|
10
|
+
# Pattern 1: Asserting an array literal equals another array literal (common in enum testing)
|
|
11
|
+
# Looks for: assert.deepEqual(['a', 'b'], ['a', 'b'])
|
|
12
|
+
if grep -rE "assert\.(deep)?(Strict)?Equal\(\[.*\], \[.*\]\)" test*.ts; then
|
|
13
|
+
echo "❌ ERROR: Found potential tautological array comparison. Tests should verify app logic, not hardcoded arrays."
|
|
14
|
+
echo " Rationale: Testing that ['A'] equals ['A'] validates nothing about the application."
|
|
15
|
+
ERROR_FOUND=1
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# Pattern 2: Asserting properties on an object literal defined in the test (Type/Interface testing)
|
|
19
|
+
# Simplified: Look for defining a typed object and immediately asserting on it in the same file
|
|
20
|
+
# This is hard to do robustly with just grep, so we'll rely on the Naming Convention check for now.
|
|
21
|
+
|
|
22
|
+
# Pattern 3: Test names that explicitly say "Validate Enums", "Validate Fields", etc.
|
|
23
|
+
# We match "Validate TaskStatus Enums" or similar phrases
|
|
24
|
+
if grep -riE "['\"]Unit: Validate (Enum|Constant|Interface|Type|Field|Object|TaskStatus|Task Object)" test*.ts; then
|
|
25
|
+
echo "❌ ERROR: Found test descriptions explicitly claiming to validate Enums/Types/Fields."
|
|
26
|
+
echo " Rationale: Unit tests should validate BEHAVIOR (e.g., 'persists correct status'), not definitions."
|
|
27
|
+
ERROR_FOUND=1
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
if [ $ERROR_FOUND -eq 1 ]; then
|
|
31
|
+
echo ""
|
|
32
|
+
echo "⚠️ Potential Anti-Patterns Detected."
|
|
33
|
+
echo " Please review the identified tests against rules/integrity-and-test-ethics.md"
|
|
34
|
+
exit 1
|
|
35
|
+
else
|
|
36
|
+
echo "✅ No obvious tautological patterns found."
|
|
37
|
+
exit 0
|
|
38
|
+
fi
|
|
@@ -134,6 +134,7 @@ try {
|
|
|
134
134
|
|
|
135
135
|
// Support both 'repository' (new) and 'git' (legacy/current) schemas
|
|
136
136
|
let repo = config.repository;
|
|
137
|
+
let defaultBranch = 'master'; // Default fallback
|
|
137
138
|
|
|
138
139
|
if (!repo) {
|
|
139
140
|
if (config.git) {
|
|
@@ -142,13 +143,18 @@ try {
|
|
|
142
143
|
name: config.git.repoName,
|
|
143
144
|
url: config.git.repoUrl || \`https://github.com/\${config.git.repoOwner}/\${config.git.repoName}.git\`
|
|
144
145
|
};
|
|
146
|
+
// Extract defaultBranch from git config
|
|
147
|
+
defaultBranch = config.git.defaultBranch || 'master';
|
|
145
148
|
}
|
|
149
|
+
} else {
|
|
150
|
+
// Extract defaultBranch from repository config
|
|
151
|
+
defaultBranch = repo.defaultBranch || 'master';
|
|
146
152
|
}
|
|
147
153
|
|
|
148
154
|
if (!repo || !repo.owner || !repo.name || !repo.url) {
|
|
149
155
|
process.exit(1);
|
|
150
156
|
}
|
|
151
|
-
console.log(\`\${repo.owner}
|
|
157
|
+
console.log(\`\${repo.owner}|\${repo.name}|\${repo.url}|\${defaultBranch}\`);
|
|
152
158
|
} catch (e) {
|
|
153
159
|
process.exit(1);
|
|
154
160
|
}
|
|
@@ -161,13 +167,14 @@ if [ $? -ne 0 ]; then
|
|
|
161
167
|
exit 1
|
|
162
168
|
fi
|
|
163
169
|
|
|
164
|
-
# Split the result into variables
|
|
165
|
-
IFS='
|
|
170
|
+
# Split the result into variables using pipe delimiter
|
|
171
|
+
IFS='|' read -r REPO_OWNER REPO_NAME REPO_URL CONFIG_DEFAULT_BRANCH <<< "$REPO_INFO"
|
|
166
172
|
|
|
167
173
|
echo "Repository Configuration:"
|
|
168
174
|
echo " Owner: $REPO_OWNER"
|
|
169
175
|
echo " Name: $REPO_NAME"
|
|
170
176
|
echo " URL: $REPO_URL"
|
|
177
|
+
echo " Default Branch: $CONFIG_DEFAULT_BRANCH"
|
|
171
178
|
echo
|
|
172
179
|
|
|
173
180
|
echo "=== $REPO_NAME - Issue Preparation ==="
|
|
@@ -195,45 +202,69 @@ echo "Step 1: Determining base branch from current repository..."
|
|
|
195
202
|
|
|
196
203
|
# Determine base branch from the ORIGINAL repository (before cloning)
|
|
197
204
|
if [ "$USE_DEFAULT_BRANCH" = true ]; then
|
|
198
|
-
#
|
|
199
|
-
DEFAULT_BRANCH=""
|
|
200
|
-
|
|
201
|
-
if git ls-remote --exit-code --heads "$REPO_URL" "$candidate" >/dev/null 2>&1; then
|
|
202
|
-
DEFAULT_BRANCH="$candidate"
|
|
203
|
-
echo "✓ Detected default branch: $DEFAULT_BRANCH"
|
|
204
|
-
break
|
|
205
|
-
fi
|
|
206
|
-
done
|
|
207
|
-
|
|
208
|
-
# Fallback to master if nothing else worked
|
|
209
|
-
if [ -z "$DEFAULT_BRANCH" ]; then
|
|
210
|
-
DEFAULT_BRANCH="master"
|
|
211
|
-
echo "⚠️ Could not detect default branch, defaulting to: $DEFAULT_BRANCH"
|
|
212
|
-
fi
|
|
213
|
-
|
|
214
|
-
BASE_BRANCH="$DEFAULT_BRANCH"
|
|
215
|
-
echo "Using detected default branch as base: $BASE_BRANCH (--use-default flag)"
|
|
216
|
-
else
|
|
217
|
-
# Get current branch from the original repo
|
|
218
|
-
ORIGINAL_BRANCH=$(git branch --show-current 2>/dev/null || echo "")
|
|
205
|
+
# Use the default branch from FRAIM config
|
|
206
|
+
DEFAULT_BRANCH="$CONFIG_DEFAULT_BRANCH"
|
|
207
|
+
echo "✓ Using default branch from FRAIM config: $DEFAULT_BRANCH"
|
|
219
208
|
|
|
220
|
-
|
|
221
|
-
|
|
209
|
+
# Verify the branch exists on remote
|
|
210
|
+
if git ls-remote --exit-code --heads "$REPO_URL" "$DEFAULT_BRANCH" >/dev/null 2>&1; then
|
|
211
|
+
echo "✓ Confirmed branch '$DEFAULT_BRANCH' exists on remote"
|
|
212
|
+
else
|
|
213
|
+
echo "⚠️ Warning: Configured default branch '$DEFAULT_BRANCH' not found on remote"
|
|
214
|
+
echo " Falling back to branch detection..."
|
|
222
215
|
|
|
223
|
-
#
|
|
216
|
+
# Fallback to detection if configured branch doesn't exist
|
|
224
217
|
DEFAULT_BRANCH=""
|
|
225
218
|
for candidate in main master develop; do
|
|
226
219
|
if git ls-remote --exit-code --heads "$REPO_URL" "$candidate" >/dev/null 2>&1; then
|
|
227
220
|
DEFAULT_BRANCH="$candidate"
|
|
228
|
-
echo "✓ Detected
|
|
221
|
+
echo "✓ Detected fallback branch: $DEFAULT_BRANCH"
|
|
229
222
|
break
|
|
230
223
|
fi
|
|
231
224
|
done
|
|
232
225
|
|
|
233
|
-
#
|
|
226
|
+
# Final fallback to master
|
|
234
227
|
if [ -z "$DEFAULT_BRANCH" ]; then
|
|
235
228
|
DEFAULT_BRANCH="master"
|
|
236
|
-
echo "⚠️ Could not detect
|
|
229
|
+
echo "⚠️ Could not detect any branch, defaulting to: $DEFAULT_BRANCH"
|
|
230
|
+
fi
|
|
231
|
+
fi
|
|
232
|
+
|
|
233
|
+
BASE_BRANCH="$DEFAULT_BRANCH"
|
|
234
|
+
echo "Using default branch as base: $BASE_BRANCH (--use-default flag)"
|
|
235
|
+
else
|
|
236
|
+
# Get current branch from the original repo
|
|
237
|
+
ORIGINAL_BRANCH=$(git branch --show-current 2>/dev/null || echo "")
|
|
238
|
+
|
|
239
|
+
if [ -z "$ORIGINAL_BRANCH" ]; then
|
|
240
|
+
echo "Warning: Detached HEAD detected in original repo, falling back to configured default branch"
|
|
241
|
+
|
|
242
|
+
# Use the default branch from FRAIM config
|
|
243
|
+
DEFAULT_BRANCH="$CONFIG_DEFAULT_BRANCH"
|
|
244
|
+
echo "✓ Using default branch from FRAIM config: $DEFAULT_BRANCH"
|
|
245
|
+
|
|
246
|
+
# Verify the branch exists on remote
|
|
247
|
+
if git ls-remote --exit-code --heads "$REPO_URL" "$DEFAULT_BRANCH" >/dev/null 2>&1; then
|
|
248
|
+
echo "✓ Confirmed branch '$DEFAULT_BRANCH' exists on remote"
|
|
249
|
+
else
|
|
250
|
+
echo "⚠️ Warning: Configured default branch '$DEFAULT_BRANCH' not found on remote"
|
|
251
|
+
echo " Falling back to branch detection..."
|
|
252
|
+
|
|
253
|
+
# Fallback to detection if configured branch doesn't exist
|
|
254
|
+
DEFAULT_BRANCH=""
|
|
255
|
+
for candidate in main master develop; do
|
|
256
|
+
if git ls-remote --exit-code --heads "$REPO_URL" "$candidate" >/dev/null 2>&1; then
|
|
257
|
+
DEFAULT_BRANCH="$candidate"
|
|
258
|
+
echo "✓ Detected fallback branch: $DEFAULT_BRANCH"
|
|
259
|
+
break
|
|
260
|
+
fi
|
|
261
|
+
done
|
|
262
|
+
|
|
263
|
+
# Final fallback to master
|
|
264
|
+
if [ -z "$DEFAULT_BRANCH" ]; then
|
|
265
|
+
DEFAULT_BRANCH="master"
|
|
266
|
+
echo "⚠️ Could not detect any branch, defaulting to: $DEFAULT_BRANCH"
|
|
267
|
+
fi
|
|
237
268
|
fi
|
|
238
269
|
|
|
239
270
|
BASE_BRANCH="$DEFAULT_BRANCH"
|