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.
Files changed (192) hide show
  1. package/bin/fraim.js +5 -52
  2. package/dist/registry/scripts/build-scripts-generator.js +205 -0
  3. package/dist/registry/scripts/fraim-config.js +61 -0
  4. package/dist/registry/scripts/generic-issues-api.js +100 -0
  5. package/dist/registry/scripts/openapi-generator.js +664 -0
  6. package/dist/registry/scripts/performance/profile-server.js +390 -0
  7. package/dist/scripts/build-stub-registry.js +108 -0
  8. package/dist/src/cli/commands/doctor.js +5 -5
  9. package/dist/src/cli/commands/init-project.js +74 -0
  10. package/dist/src/cli/commands/setup.js +176 -0
  11. package/dist/src/cli/commands/sync.js +33 -19
  12. package/dist/src/cli/commands/test-mcp.js +135 -0
  13. package/dist/src/cli/fraim.js +6 -0
  14. package/dist/src/cli/setup/auto-mcp-setup.js +367 -0
  15. package/dist/src/cli/setup/ide-detector.js +163 -0
  16. package/dist/src/cli/setup/mcp-config-generator.js +115 -0
  17. package/dist/src/cli/setup/token-validator.js +49 -0
  18. package/dist/test-utils.js +96 -0
  19. package/dist/tests/debug-tools.js +2 -2
  20. package/dist/tests/esm-compat.js +11 -0
  21. package/dist/tests/shared-server-utils.js +57 -0
  22. package/dist/tests/test-chalk-esm-issue.js +159 -0
  23. package/dist/tests/test-chalk-real-world.js +265 -0
  24. package/dist/tests/test-chalk-regression.js +2 -18
  25. package/dist/tests/test-chalk-resolution-issue.js +304 -0
  26. package/dist/tests/test-client-scripts-validation.js +27 -5
  27. package/dist/tests/test-complete-setup-flow.js +110 -0
  28. package/dist/tests/test-fraim-install-chalk-issue.js +254 -0
  29. package/dist/tests/test-ide-detector.js +46 -0
  30. package/dist/tests/test-improved-setup.js +121 -0
  31. package/dist/tests/test-mcp-config-generator.js +70 -0
  32. package/dist/tests/test-mcp-connection.js +58 -117
  33. package/dist/tests/test-mcp-issue-integration.js +2 -2
  34. package/dist/tests/test-mcp-lifecycle-methods.js +34 -100
  35. package/dist/tests/test-mcp-shared-server.js +308 -0
  36. package/dist/tests/test-npm-resolution-diagnostic.js +140 -0
  37. package/dist/tests/test-package-size.js +101 -0
  38. package/dist/tests/test-prep-issue.js +34 -1
  39. package/dist/tests/test-script-location-independence.js +39 -62
  40. package/dist/tests/test-server-utils.js +32 -0
  41. package/dist/tests/test-session-rehydration.js +2 -2
  42. package/dist/tests/test-setup-integration.js +98 -0
  43. package/dist/tests/test-standalone.js +2 -2
  44. package/dist/tests/test-stub-registry.js +136 -0
  45. package/dist/tests/test-sync-stubs.js +143 -0
  46. package/dist/tests/test-telemetry.js +2 -2
  47. package/dist/tests/test-token-validator.js +30 -0
  48. package/dist/tests/test-user-journey.js +2 -1
  49. package/package.json +7 -9
  50. package/registry/agent-guardrails.md +62 -62
  51. package/registry/scripts/code-quality-check.sh +559 -559
  52. package/registry/scripts/detect-tautological-tests.sh +38 -38
  53. package/registry/scripts/prep-issue.sh +61 -30
  54. package/registry/scripts/validate-openapi-limits.ts +366 -366
  55. package/registry/scripts/validate-test-coverage.ts +280 -280
  56. package/registry/scripts/verify-pr-comments.sh +70 -70
  57. package/registry/stubs/workflows/bootstrap/create-architecture.md +11 -0
  58. package/registry/stubs/workflows/bootstrap/detect-broken-windows.md +11 -0
  59. package/registry/stubs/workflows/bootstrap/evaluate-code-quality.md +11 -0
  60. package/registry/stubs/workflows/bootstrap/verify-test-coverage.md +11 -0
  61. package/registry/stubs/workflows/business-development/create-business-plan.md +11 -0
  62. package/registry/stubs/workflows/business-development/ideate-business-opportunity.md +11 -0
  63. package/registry/stubs/workflows/business-development/price-product.md +18 -0
  64. package/registry/stubs/workflows/convert-to-pdf.md +11 -0
  65. package/registry/stubs/workflows/customer-development/insight-analysis.md +11 -0
  66. package/registry/stubs/workflows/customer-development/insight-triage.md +11 -0
  67. package/registry/stubs/workflows/customer-development/interview-preparation.md +11 -0
  68. package/registry/stubs/workflows/customer-development/linkedin-outreach.md +11 -0
  69. package/registry/stubs/workflows/customer-development/strategic-brainstorming.md +11 -0
  70. package/registry/stubs/workflows/customer-development/thank-customers.md +11 -0
  71. package/registry/stubs/workflows/customer-development/weekly-newsletter.md +11 -0
  72. package/registry/stubs/workflows/deploy/cloud-deployment.md +11 -0
  73. package/registry/stubs/workflows/improve-fraim/contribute.md +11 -0
  74. package/registry/stubs/workflows/improve-fraim/file-issue.md +11 -0
  75. package/registry/stubs/workflows/marketing/content-creation.md +11 -0
  76. package/registry/stubs/workflows/marketing/hbr-article.md +11 -0
  77. package/registry/stubs/workflows/marketing/launch-checklist.md +11 -0
  78. package/registry/stubs/workflows/marketing/marketing-strategy.md +11 -0
  79. package/registry/stubs/workflows/marketing/storytelling.md +11 -0
  80. package/registry/stubs/workflows/performance/analyze-performance.md +11 -0
  81. package/registry/stubs/workflows/product-building/design.md +11 -0
  82. package/registry/stubs/workflows/product-building/implement.md +12 -0
  83. package/registry/stubs/workflows/product-building/iterate-on-pr-comments.md +11 -0
  84. package/registry/stubs/workflows/product-building/prep-issue.md +11 -0
  85. package/registry/stubs/workflows/product-building/prototype.md +11 -0
  86. package/registry/stubs/workflows/product-building/resolve.md +11 -0
  87. package/registry/stubs/workflows/product-building/retrospect.md +11 -0
  88. package/registry/stubs/workflows/product-building/spec.md +11 -0
  89. package/registry/stubs/workflows/product-building/test.md +11 -0
  90. package/registry/stubs/workflows/quality-assurance/browser-validation.md +11 -0
  91. package/registry/stubs/workflows/quality-assurance/iterative-improvement-cycle.md +11 -0
  92. package/registry/stubs/workflows/replicate/replicate-discovery.md +11 -0
  93. package/registry/stubs/workflows/replicate/replicate-to-issues.md +11 -0
  94. package/registry/stubs/workflows/reviewer/review-implementation-vs-design-spec.md +11 -0
  95. package/registry/stubs/workflows/reviewer/review-implementation-vs-feature-spec.md +11 -0
  96. package/registry/stubs/workflows/startup-credits/aws-activate-application.md +11 -0
  97. package/registry/stubs/workflows/startup-credits/google-cloud-application.md +11 -0
  98. package/registry/stubs/workflows/startup-credits/microsoft-azure-application.md +11 -0
  99. package/.github/workflows/ci.yml +0 -65
  100. package/.github/workflows/deploy-fraim.yml +0 -87
  101. package/.github/workflows/phase-change.yml +0 -251
  102. package/.github/workflows/status-change.yml +0 -68
  103. package/.github/workflows/sync-on-pr-review.yml +0 -66
  104. package/examples/simple-webapp/TESTING.md +0 -62
  105. package/examples/simple-webapp/example-test.ts +0 -186
  106. package/registry/github/workflows/ci.yml +0 -51
  107. package/registry/github/workflows/phase-change.yml +0 -251
  108. package/registry/github/workflows/status-change.yml +0 -68
  109. package/registry/github/workflows/sync-on-pr-review.yml +0 -66
  110. package/registry/mcp-template.jsonc +0 -29
  111. package/registry/rules/agent-success-criteria.md +0 -52
  112. package/registry/rules/agent-testing-guidelines.md +0 -502
  113. package/registry/rules/architecture.md +0 -52
  114. package/registry/rules/communication.md +0 -122
  115. package/registry/rules/continuous-learning.md +0 -55
  116. package/registry/rules/debugging-multitenancy-issues.md +0 -85
  117. package/registry/rules/ephemeral-execution.md +0 -57
  118. package/registry/rules/git-safe-commands.md +0 -34
  119. package/registry/rules/hitl-ppe-record-analysis.md +0 -302
  120. package/registry/rules/integrity-and-test-ethics.md +0 -275
  121. package/registry/rules/local-development.md +0 -254
  122. package/registry/rules/merge-requirements.md +0 -231
  123. package/registry/rules/simplicity.md +0 -118
  124. package/registry/rules/software-development-lifecycle.md +0 -105
  125. package/registry/rules/spike-first-development.md +0 -205
  126. package/registry/rules/successful-debugging-patterns.md +0 -491
  127. package/registry/rules/telemetry.md +0 -67
  128. package/registry/templates/bootstrap/ARCHITECTURE-TEMPLATE.md +0 -53
  129. package/registry/templates/bootstrap/CODE-QUALITY-REPORT-TEMPLATE.md +0 -37
  130. package/registry/templates/bootstrap/TEST-COVERAGE-REPORT-TEMPLATE.md +0 -35
  131. package/registry/templates/business-development/IDEATION-REPORT-TEMPLATE.md +0 -29
  132. package/registry/templates/business-development/PRICING-STRATEGY-TEMPLATE.md +0 -126
  133. package/registry/templates/customer-development/customer-interview-template.md +0 -99
  134. package/registry/templates/customer-development/follow-up-email-templates.md +0 -132
  135. package/registry/templates/customer-development/insight-analysis-template.md +0 -74
  136. package/registry/templates/customer-development/strategic-recommendations-template.md +0 -53
  137. package/registry/templates/customer-development/thank-you-email-template.html +0 -124
  138. package/registry/templates/customer-development/thank-you-note-template.md +0 -16
  139. package/registry/templates/customer-development/triage-log-template.md +0 -278
  140. package/registry/templates/customer-development/weekly-newsletter-template.html +0 -204
  141. package/registry/templates/evidence/Design-Evidence.md +0 -30
  142. package/registry/templates/evidence/Implementation-BugEvidence.md +0 -86
  143. package/registry/templates/evidence/Implementation-FeatureEvidence.md +0 -121
  144. package/registry/templates/evidence/Spec-Evidence.md +0 -19
  145. package/registry/templates/help/HelpNeeded.md +0 -14
  146. package/registry/templates/marketing/HBR-ARTICLE-TEMPLATE.md +0 -66
  147. package/registry/templates/replicate/implementation-checklist.md +0 -39
  148. package/registry/templates/replicate/use-cases-template.md +0 -88
  149. package/registry/templates/retrospective/RETROSPECTIVE-TEMPLATE.md +0 -55
  150. package/registry/templates/specs/BUGSPEC-TEMPLATE.md +0 -37
  151. package/registry/templates/specs/FEATURESPEC-TEMPLATE.md +0 -29
  152. package/registry/templates/specs/TECHSPEC-TEMPLATE.md +0 -39
  153. package/registry/workflows/bootstrap/create-architecture.md +0 -38
  154. package/registry/workflows/bootstrap/evaluate-code-quality.md +0 -36
  155. package/registry/workflows/bootstrap/verify-test-coverage.md +0 -37
  156. package/registry/workflows/business-development/create-business-plan.md +0 -737
  157. package/registry/workflows/business-development/ideate-business-opportunity.md +0 -55
  158. package/registry/workflows/business-development/price-product.md +0 -325
  159. package/registry/workflows/convert-to-pdf.md +0 -235
  160. package/registry/workflows/customer-development/insight-analysis.md +0 -156
  161. package/registry/workflows/customer-development/insight-triage.md +0 -933
  162. package/registry/workflows/customer-development/interview-preparation.md +0 -421
  163. package/registry/workflows/customer-development/linkedin-outreach.md +0 -593
  164. package/registry/workflows/customer-development/strategic-brainstorming.md +0 -146
  165. package/registry/workflows/customer-development/thank-customers.md +0 -203
  166. package/registry/workflows/customer-development/weekly-newsletter.md +0 -366
  167. package/registry/workflows/deploy/cloud-deployment.md +0 -310
  168. package/registry/workflows/improve-fraim/contribute.md +0 -32
  169. package/registry/workflows/improve-fraim/file-issue.md +0 -32
  170. package/registry/workflows/marketing/content-creation.md +0 -37
  171. package/registry/workflows/marketing/hbr-article.md +0 -73
  172. package/registry/workflows/marketing/launch-checklist.md +0 -37
  173. package/registry/workflows/marketing/marketing-strategy.md +0 -45
  174. package/registry/workflows/performance/analyze-performance.md +0 -65
  175. package/registry/workflows/product-building/design.md +0 -130
  176. package/registry/workflows/product-building/implement.md +0 -315
  177. package/registry/workflows/product-building/iterate-on-pr-comments.md +0 -70
  178. package/registry/workflows/product-building/prep-issue.md +0 -43
  179. package/registry/workflows/product-building/prototype.md +0 -60
  180. package/registry/workflows/product-building/resolve.md +0 -164
  181. package/registry/workflows/product-building/retrospect.md +0 -86
  182. package/registry/workflows/product-building/spec.md +0 -117
  183. package/registry/workflows/product-building/test.md +0 -120
  184. package/registry/workflows/quality-assurance/browser-validation.md +0 -221
  185. package/registry/workflows/quality-assurance/iterative-improvement-cycle.md +0 -562
  186. package/registry/workflows/replicate/replicate-discovery.md +0 -336
  187. package/registry/workflows/replicate/replicate-to-issues.md +0 -319
  188. package/registry/workflows/reviewer/review-implementation-vs-design-spec.md +0 -632
  189. package/registry/workflows/reviewer/review-implementation-vs-feature-spec.md +0 -669
  190. package/registry/workflows/startup-credits/aws-activate-application.md +0 -535
  191. package/registry/workflows/startup-credits/google-cloud-application.md +0 -647
  192. package/registry/workflows/startup-credits/microsoft-azure-application.md +0 -538
@@ -0,0 +1,11 @@
1
+ # FRAIM Workflow: review-implementation-vs-feature-spec
2
+
3
+ > [!IMPORTANT]
4
+ > This is a **FRAIM-managed workflow stub**.
5
+ > To load the full context (rules, templates, and execution steps), ask your AI agent to:
6
+ > `@fraim get_fraim_workflow("review-implementation-vs-feature-spec")`
7
+ >
8
+ > DO NOT EXECUTE.
9
+
10
+ ## Intent
11
+ To systematically verify that the implementation solves the customer problem and delivers the user experience described in the feature spec, ensuring functional completeness and user value.
@@ -0,0 +1,11 @@
1
+ # FRAIM Workflow: aws-activate-application
2
+
3
+ > [!IMPORTANT]
4
+ > This is a **FRAIM-managed workflow stub**.
5
+ > To load the full context (rules, templates, and execution steps), ask your AI agent to:
6
+ > `@fraim get_fraim_workflow("aws-activate-application")`
7
+ >
8
+ > DO NOT EXECUTE.
9
+
10
+ ## Intent
11
+ No intent defined.
@@ -0,0 +1,11 @@
1
+ # FRAIM Workflow: google-cloud-application
2
+
3
+ > [!IMPORTANT]
4
+ > This is a **FRAIM-managed workflow stub**.
5
+ > To load the full context (rules, templates, and execution steps), ask your AI agent to:
6
+ > `@fraim get_fraim_workflow("google-cloud-application")`
7
+ >
8
+ > DO NOT EXECUTE.
9
+
10
+ ## Intent
11
+ No intent defined.
@@ -0,0 +1,11 @@
1
+ # FRAIM Workflow: microsoft-azure-application
2
+
3
+ > [!IMPORTANT]
4
+ > This is a **FRAIM-managed workflow stub**.
5
+ > To load the full context (rules, templates, and execution steps), ask your AI agent to:
6
+ > `@fraim get_fraim_workflow("microsoft-azure-application")`
7
+ >
8
+ > DO NOT EXECUTE.
9
+
10
+ ## Intent
11
+ No intent defined.
@@ -1,65 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches:
6
- - 'master'
7
- schedule:
8
- - cron: '0 6 * * *' # 11 PM PST is 6 AM UTC
9
-
10
- # Sets permissions of the GITHUB_TOKEN
11
- permissions:
12
- contents: read
13
- checks: write
14
-
15
- # Cancel in-progress runs on same branch
16
- concurrency:
17
- group: ci-${{ github.workflow }}-${{ github.ref }}
18
- cancel-in-progress: true
19
-
20
- jobs:
21
- build:
22
- if: github.event_name == 'push'
23
- runs-on: ubuntu-latest
24
- timeout-minutes: 15
25
- services:
26
- mongodb:
27
- image: mongo:latest
28
- ports:
29
- - 27017:27017
30
-
31
- steps:
32
- - uses: actions/checkout@v4
33
- - uses: actions/setup-node@v4
34
- with:
35
- node-version: 20
36
- - run: npm install
37
- - name: Build
38
- run: npm run build
39
- - name: Test Smoke CI
40
- env:
41
- MONGODB_URI: mongodb://localhost:27017/fraim_test
42
- run: npm run test-smoke-ci
43
-
44
- full-test:
45
- runs-on: ubuntu-latest
46
- if: github.event_name == 'schedule' && github.ref == 'refs/heads/master'
47
- services:
48
- mongodb:
49
- image: mongo:latest
50
- ports:
51
- - 27017:27017
52
-
53
- steps:
54
- - uses: actions/checkout@v4
55
- - uses: actions/setup-node@v4
56
- with:
57
- node-version: 20
58
- - run: npm install
59
- - name: Build
60
- run: npm run build
61
- - name: Test All CI
62
- env:
63
- MONGODB_URI: mongodb://localhost:27017/fraim_test
64
- run: npm run test-all-ci
65
- timeout-minutes: 30
@@ -1,87 +0,0 @@
1
- name: Deploy Fraim Standalone Server
2
-
3
- on:
4
- workflow_dispatch:
5
- push:
6
- branches:
7
- - master
8
- paths:
9
- - 'src/fraim-mcp-server.ts'
10
- - 'src/fraim/**'
11
- - '.ai-agents/**'
12
- - '.fraim/**'
13
- - '.github/workflows/deploy-fraim.yml'
14
-
15
- concurrency:
16
- group: deploy-fraim-${{ github.ref }}
17
- cancel-in-progress: true
18
-
19
- jobs:
20
- deploy-fraim:
21
- runs-on: ubuntu-latest
22
- environment: production
23
- permissions:
24
- id-token: write
25
- contents: read
26
-
27
- steps:
28
- - name: Checkout repository
29
- uses: actions/checkout@v4
30
-
31
- - name: Setup Node.js
32
- uses: actions/setup-node@v4
33
- with:
34
- node-version: '20'
35
- cache: 'npm'
36
-
37
- - name: Install dependencies
38
- run: npm ci --prefer-offline --no-audit
39
-
40
- - name: Build application
41
- run: npm run build
42
-
43
- - name: Login to Azure
44
- uses: azure/login@v2
45
- with:
46
- client-id: 4acc096e-efff-417f-b177-cfa54a53b65c
47
- tenant-id: ad354a76-b97f-4ae4-9d93-665418b31e12
48
- subscription-id: c3af927d-af55-463b-9810-25bede96d185
49
-
50
- - name: Create deployment package
51
- run: |
52
- mkdir -p deploy-package
53
- # Prune dev dependencies to reduce package size
54
- npm prune --production
55
-
56
- # Copy necessary files
57
- cp -r dist deploy-package/
58
- cp -r node_modules deploy-package/
59
- # Include registry and .fraim directory for runtime
60
- cp -r registry deploy-package/
61
- cp -r .fraim deploy-package/
62
-
63
- cp package.json deploy-package/
64
- cp package-lock.json deploy-package/
65
-
66
- - name: Configure Startup Command
67
- uses: azure/CLI@v2
68
- with:
69
- inlineScript: |
70
- az webapp config appsettings set -g rg-ashley-fraim-prod -n app-ashley-fraim-prod --settings SCM_DO_BUILD_DURING_DEPLOYMENT=false MONGODB_DB_NAME="fraim_prod"
71
- az webapp config set -g rg-ashley-fraim-prod -n app-ashley-fraim-prod --startup-file "node dist/src/fraim-mcp-server.js"
72
-
73
- - name: Deploy to Azure Web App
74
- uses: azure/webapps-deploy@v3
75
- with:
76
- app-name: 'app-ashley-fraim-prod'
77
- package: ./deploy-package
78
-
79
- - name: Post-deploy health check
80
- uses: azure/CLI@v2
81
- with:
82
- inlineScript: |
83
- FRAIM_URL=$(az webapp show -g rg-ashley-fraim-prod -n app-ashley-fraim-prod --query defaultHostName -o tsv)
84
- FRAIM_KEY=$(az webapp config appsettings list -g rg-ashley-fraim-prod -n app-ashley-fraim-prod --query "[?name=='FRAIM_API_KEY'].value" -o tsv)
85
- echo "🧪 Waiting 30s for startup..."
86
- sleep 30
87
- curl -f -H "x-api-key: ${FRAIM_KEY}" "https://${FRAIM_URL}/health" && echo "✅ Fraim health check passed!" || echo "⚠️ Fraim health check failed (app may still be starting)"
@@ -1,251 +0,0 @@
1
- name: Phase Change Handler
2
-
3
- # This workflow now assumes branches are created by prep-issue.sh
4
- # It only handles PR creation/updating and status management
5
-
6
- on:
7
- issues:
8
- types: [labeled]
9
-
10
- permissions:
11
- issues: write
12
- pull-requests: write
13
- contents: write
14
-
15
- jobs:
16
- handle-phase-change:
17
- runs-on: ubuntu-latest
18
- if: |
19
- contains(github.event.label.name, 'phase:') ||
20
- (github.event.action == 'unlabeled' && contains(github.event.label.name, 'phase:'))
21
-
22
- steps:
23
- - name: Checkout repository
24
- uses: actions/checkout@v4
25
- with:
26
- token: ${{ secrets.GITHUB_TOKEN }}
27
- fetch-depth: 0
28
-
29
- - name: Setup Git
30
- run: |
31
- git config --global user.name "github-actions[bot]"
32
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
33
-
34
- - name: Auth GitHub CLI
35
- run: echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
36
-
37
- - name: Extract issue details
38
- id: issue-details
39
- run: |
40
- ISSUE_NUMBER="${{ github.event.issue.number }}"
41
- ISSUE_TITLE="${{ github.event.issue.title }}"
42
- BRANCH_NAME="feature/${ISSUE_NUMBER}-$(echo "$ISSUE_TITLE" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-\|-$//g')"
43
-
44
- echo "issue_number=$ISSUE_NUMBER" >> $GITHUB_OUTPUT
45
- echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
46
- echo "issue_title=$ISSUE_TITLE" >> $GITHUB_OUTPUT
47
-
48
- - name: Determine current phase
49
- id: current-phase
50
- run: |
51
- LABELS='${{ toJson(github.event.issue.labels) }}'
52
- CURRENT_PHASE=""
53
-
54
- # Extract current phase from labels
55
- for label in $(echo "$LABELS" | jq -r '.[].name'); do
56
- if [[ $label == phase:* ]]; then
57
- CURRENT_PHASE=$label
58
- break
59
- fi
60
- done
61
-
62
- echo "current_phase=$CURRENT_PHASE" >> $GITHUB_OUTPUT
63
- echo "Current phase: $CURRENT_PHASE"
64
-
65
- - name: Verify branch exists (created by prep-issue.sh)
66
- run: |
67
- BRANCH_NAME="${{ steps.issue-details.outputs.branch_name }}"
68
-
69
- # Check if branch exists remotely
70
- if git ls-remote --exit-code --heads origin "$BRANCH_NAME" >/dev/null 2>&1; then
71
- echo "✓ Branch $BRANCH_NAME exists remotely"
72
- git fetch origin "$BRANCH_NAME"
73
- else
74
- echo "⚠️ Branch $BRANCH_NAME does not exist remotely"
75
- echo " This should have been created by prep-issue.sh"
76
- echo " Please run prep-issue.sh before invoking agent workflows"
77
- exit 1
78
- fi
79
-
80
- - name: Check if PR already exists
81
- id: pr-check
82
- run: |
83
- BRANCH_NAME="${{ steps.issue-details.outputs.branch_name }}"
84
- EXISTING_PR=$(gh pr list --head "$BRANCH_NAME" --json number --jq '.[0].number' 2>/dev/null || echo "")
85
- echo "existing_pr=$EXISTING_PR" >> $GITHUB_OUTPUT
86
- if [ -n "$EXISTING_PR" ]; then
87
- echo "✓ PR #$EXISTING_PR already exists"
88
- else
89
- echo "ℹ️ No PR exists yet, will create one for phase: ${{ steps.current-phase.outputs.current_phase }}"
90
- fi
91
-
92
- - name: phase:spec → create/update PR for Specification phase
93
- if: steps.current-phase.outputs.current_phase == 'phase:spec'
94
- shell: bash
95
- env:
96
- ISSUE: ${{ github.event.issue.number }}
97
- run: |
98
- ISSUE_NUMBER="${{ steps.issue-details.outputs.issue_number }}"
99
- ISSUE_TITLE="${{ steps.issue-details.outputs.issue_title }}"
100
- BRANCH_NAME="${{ steps.issue-details.outputs.branch_name }}"
101
-
102
- # Create or update PR for Specification phase
103
- PR_TITLE="[Specification] Feature Spec for Issue #$ISSUE_NUMBER: $ISSUE_TITLE"
104
- PR_BODY="## Feature Specification for Issue #$ISSUE_NUMBER
105
-
106
- This PR contains the feature specification for: $ISSUE_TITLE
107
-
108
- **Phase:** Specification
109
- **Issue:** #$ISSUE_NUMBER
110
- **Branch:** \`$BRANCH_NAME\`
111
-
112
- ### Specification Document
113
- - 📋 [Feature Specification]($SPEC_FILE)
114
-
115
- **Note:** This is a Specification PR. Design and Implementation will follow after specification approval.
116
-
117
- "
118
-
119
- EXISTING_PR="${{ steps.pr-check.outputs.existing_pr }}"
120
-
121
- if [ -n "$EXISTING_PR" ]; then
122
- echo "Updating existing PR #$EXISTING_PR for Specification phase"
123
- gh pr edit "$EXISTING_PR" --title "$PR_TITLE" --body "$PR_BODY"
124
- gh pr edit "$EXISTING_PR" --add-label "phase:spec" --remove-label "phase:design" --remove-label "phase:tests" --remove-label "phase:impl"
125
- else
126
- echo "Creating new PR for Specification phase"
127
- gh pr create --title "$PR_TITLE" --body "$PR_BODY" --base master --head "$BRANCH_NAME" --draft
128
- gh pr edit --add-label "phase:spec"
129
- fi
130
-
131
- - name: phase:design → create/update PR for Design phase
132
- if: steps.current-phase.outputs.current_phase == 'phase:design'
133
- shell: bash
134
- env:
135
- ISSUE: ${{ github.event.issue.number }}
136
- run: |
137
- ISSUE_NUMBER="${{ steps.issue-details.outputs.issue_number }}"
138
- ISSUE_TITLE="${{ steps.issue-details.outputs.issue_title }}"
139
- BRANCH_NAME="${{ steps.issue-details.outputs.branch_name }}"
140
-
141
- # Create or update PR for Design phase
142
- PR_TITLE="[Design] RFC for Issue #$ISSUE_NUMBER: $ISSUE_TITLE"
143
- PR_BODY="## Design RFC for Issue #$ISSUE_NUMBER
144
-
145
- This PR contains the design RFC for: $ISSUE_TITLE
146
-
147
- **Phase:** Design
148
- **Issue:** #$ISSUE_NUMBER
149
- **Branch:** \`$BRANCH_NAME\`
150
-
151
- ### RFC Document
152
- - 📋 [RFC Document]($RFC_FILE)
153
-
154
- **Note:** This is a Design PR. Implementation will follow in a separate PR after design approval.
155
-
156
- "
157
-
158
- EXISTING_PR="${{ steps.pr-check.outputs.existing_pr }}"
159
-
160
- if [ -n "$EXISTING_PR" ]; then
161
- echo "Updating existing PR #$EXISTING_PR for Design phase"
162
- gh pr edit "$EXISTING_PR" --title "$PR_TITLE" --body "$PR_BODY"
163
- gh pr edit "$EXISTING_PR" --add-label "phase:design" --remove-label "phase:spec" --remove-label "phase:tests" --remove-label "phase:impl"
164
- else
165
- echo "Creating new PR for Design phase"
166
- gh pr create --title "$PR_TITLE" --body "$PR_BODY" --base master --head "$BRANCH_NAME" --draft
167
- gh pr edit --add-label "phase:design"
168
- fi
169
-
170
- - name: phase:tests → create/update PR for Test phase
171
- if: steps.current-phase.outputs.current_phase == 'phase:tests'
172
- run: |
173
- ISSUE_NUMBER="${{ steps.issue-details.outputs.issue_number }}"
174
- ISSUE_TITLE="${{ steps.issue-details.outputs.issue_title }}"
175
- BRANCH_NAME="${{ steps.issue-details.outputs.branch_name }}"
176
-
177
- # Create or update PR for Test phase
178
- PR_TITLE="[Testing] Test Cases for Issue #$ISSUE_NUMBER: $ISSUE_TITLE"
179
- PR_BODY="## Test cases for Issue #$ISSUE_NUMBER
180
-
181
- This PR contains the test cases for: $ISSUE_TITLE
182
-
183
- **Phase:** Tests
184
- **Issue:** #$ISSUE_NUMBER
185
- **Branch:** \`$BRANCH_NAME\`
186
-
187
- ### Test Cases
188
-
189
-
190
- **Note:** This is a Test PR. Implementation will follow after test approval.
191
-
192
- "
193
-
194
- EXISTING_PR="${{ steps.pr-check.outputs.existing_pr }}"
195
-
196
- if [ -n "$EXISTING_PR" ]; then
197
- echo "Updating existing PR #$EXISTING_PR for Test phase"
198
- gh pr edit "$EXISTING_PR" --title "$PR_TITLE" --body "$PR_BODY"
199
- gh pr edit "$EXISTING_PR" --add-label "phase:tests" --remove-label "phase:spec" --remove-label "phase:design" --remove-label "phase:impl"
200
- else
201
- echo "Creating new PR for Test phase"
202
- gh pr create --title "$PR_TITLE" --body "$PR_BODY" --base master --head "$BRANCH_NAME" --draft
203
- gh pr edit --add-label "phase:tests"
204
- fi
205
-
206
- - name: phase:impl → create/update PR for Implementation phase
207
- if: steps.current-phase.outputs.current_phase == 'phase:impl'
208
- run: |
209
- ISSUE_NUMBER="${{ steps.issue-details.outputs.issue_number }}"
210
- ISSUE_TITLE="${{ steps.issue-details.outputs.issue_title }}"
211
- BRANCH_NAME="${{ steps.issue-details.outputs.branch_name }}"
212
-
213
- # Create or update PR for Implementation phase
214
- PR_TITLE="[Implementation] Fixes for Issue #$ISSUE_NUMBER: $ISSUE_TITLE"
215
- PR_BODY="## Fixes for Issue #$ISSUE_NUMBER
216
-
217
- This PR contains the fixes for: $ISSUE_TITLE
218
-
219
- **Phase:** Implementation
220
- **Issue:** #$ISSUE_NUMBER
221
- **Branch:** \`$BRANCH_NAME\`
222
-
223
- ### Fixes
224
-
225
-
226
- Closes #$ISSUE_NUMBER
227
-
228
- "
229
-
230
- EXISTING_PR="${{ steps.pr-check.outputs.existing_pr }}"
231
-
232
- if [ -n "$EXISTING_PR" ]; then
233
- echo "Updating existing PR #$EXISTING_PR for Implementation phase"
234
- gh pr edit "$EXISTING_PR" --title "$PR_TITLE" --body "$PR_BODY"
235
- gh pr edit "$EXISTING_PR" --add-label "phase:impl" --remove-label "phase:spec" --remove-label "phase:design" --remove-label "phase:tests"
236
- else
237
- echo "Creating new PR for Implementation phase"
238
- gh pr create --title "$PR_TITLE" --body "$PR_BODY" --base master --head "$BRANCH_NAME" --draft
239
- gh pr edit --add-label "phase:impl"
240
- fi
241
-
242
- - name: Normalize ISSUE and PR status to WIP (authoritative)
243
- run: |
244
- gh issue edit ${{ github.event.issue.number }} --add-label "status:wip" --remove-label "status:needs-review" --remove-label "status:complete" || true
245
-
246
- # Use the PR number from the check step
247
- EXISTING_PR="${{ steps.pr-check.outputs.existing_pr }}"
248
-
249
- if [ -n "$EXISTING_PR" ]; then
250
- gh pr edit "$EXISTING_PR" --add-label "status:wip" --remove-label "status:needs-review" --remove-label "status:complete" || true
251
- fi
@@ -1,68 +0,0 @@
1
- name: Status Change → Flip PR Draft/Ready
2
-
3
- on:
4
- issues:
5
- types: [labeled]
6
-
7
- permissions:
8
- pull-requests: write
9
- issues: read
10
- contents: write
11
-
12
- # Serialize per ISSUE; last status wins
13
- concurrency:
14
- group: status-change-${{ github.event.issue.number }}
15
- cancel-in-progress: true
16
-
17
- jobs:
18
- status-change:
19
- if: startsWith(github.event.label.name, 'status:')
20
- runs-on: ubuntu-latest
21
- steps:
22
- - name: Checkout repository
23
- uses: actions/checkout@v4
24
- with:
25
- token: ${{ secrets.GITHUB_TOKEN }}
26
- fetch-depth: 0
27
-
28
- - name: Setup Git
29
- run: |
30
- git config --global user.name "github-actions[bot]"
31
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
32
-
33
- - name: Auth GitHub CLI
34
- run: echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
35
-
36
- - name: Derive branch + find PR
37
- id: pr
38
- shell: bash
39
- env:
40
- ISSUE_NUMBER: ${{ github.event.issue.number }}
41
- ISSUE_TITLE: ${{ github.event.issue.title }}
42
- run: |
43
- set -euo pipefail
44
- slug=$(echo "$ISSUE_TITLE" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g;s/^-+|-+$//g')
45
- BR="feature/${ISSUE_NUMBER}-${slug}"
46
- PR=$(gh pr list --state open --head "$BR" --json number --jq '.[0].number')
47
- echo "pr=$PR" >> $GITHUB_OUTPUT
48
- echo "label=${{ github.event.label.name }}" >> $GITHUB_OUTPUT
49
-
50
- - name: Flip PR state (Draft/Ready) based on label
51
- if: steps.pr.outputs.pr != ''
52
- shell: bash
53
- env:
54
- PR: ${{ steps.pr.outputs.pr }}
55
- LABEL: ${{ steps.pr.outputs.label }}
56
- run: |
57
- set -euo pipefail
58
- case "$LABEL" in
59
- status:needs-review)
60
- gh pr ready "$PR"
61
- gh pr edit "$PR" --add-label "status:needs-review" --remove-label "status:wip" --remove-label "status:complete" || true
62
- ;;
63
- status:wip)
64
- gh pr edit "$PR" --add-label "status:wip" --remove-label "status:needs-review" --remove-label "status:complete" || true
65
- ;;
66
- *)
67
- echo "No action for label: $LABEL" ;;
68
- esac
@@ -1,66 +0,0 @@
1
- name: Sync Issue on PR Review
2
- on:
3
- pull_request_review:
4
- types: [submitted]
5
-
6
- permissions:
7
- pull-requests: write
8
- issues: write
9
-
10
- concurrency:
11
- group: review-sync-${{ github.event.pull_request.number }}
12
- cancel-in-progress: true
13
-
14
- jobs:
15
- sync-on-review:
16
- runs-on: ubuntu-latest
17
- # no job-level `if` — we branch inside the script
18
- env:
19
- GH_TOKEN: ${{ secrets.PR_AUTOMATION_TOKEN || secrets.GITHUB_TOKEN }}
20
- REPO: ${{ github.repository }}
21
- steps:
22
- - name: Derive review state, issue number, and branch
23
- id: vars
24
- shell: bash
25
- run: |
26
- set -euo pipefail
27
- STATE="${{ github.event.review.state }}"
28
- BR="${{ github.event.pull_request.head.ref }}" # e.g., feature/26-slug
29
- ISSUE="$(sed -nE 's#^feature/([0-9]+)-.*#\1#p' <<< "$BR" || true)"
30
- echo "state=$STATE" >> $GITHUB_OUTPUT
31
- echo "issue=$ISSUE" >> $GITHUB_OUTPUT
32
- echo "branch=$BR" >> $GITHUB_OUTPUT
33
- echo "Detected review state: $STATE; branch: $BR; issue: $ISSUE"
34
-
35
- - name: Handle review states
36
- if: steps.vars.outputs.issue != ''
37
- shell: bash
38
- env:
39
- STATE: ${{ steps.vars.outputs.state }}
40
- ISSUE: ${{ steps.vars.outputs.issue }}
41
- PRNUM: ${{ github.event.pull_request.number }}
42
- REPO: ${{ env.REPO }}
43
- run: |
44
- set -euo pipefail
45
- case "$STATE" in
46
- changes_requested)
47
- # Flip to WIP
48
- gh issue edit "$ISSUE" --repo "$REPO" \
49
- --add-label "status:wip" --remove-label "status:needs-review" --remove-label "status:complete" || true
50
- gh pr edit "$PRNUM" --repo "$REPO" \
51
- --add-label "status:wip" --remove-label "status:needs-review" --remove-label "status:complete" || true
52
- ;;
53
- approved)
54
- # Flip to Complete
55
- gh issue edit "$ISSUE" --repo "$REPO" \
56
- --add-label "status:complete" --remove-label "status:wip" --remove-label "status:needs-review" || true
57
- gh pr edit "$PRNUM" --repo "$REPO" --add-label "status:complete" --remove-label "status:wip" --remove-label "status:needs-review" || true
58
- ;;
59
- commented)
60
- # No-op; comments don't change state
61
- echo "Review was 'commented' — no state change."
62
- ;;
63
- *)
64
- echo "Unknown review state: $STATE"
65
- ;;
66
- esac
@@ -1,62 +0,0 @@
1
- # Testing with FRAIM Framework
2
-
3
- This directory contains example test cases that demonstrate how to use the FRAIM testing framework with proper tagging and structure.
4
-
5
- ## Test Structure
6
-
7
- The example test file (`example-test.ts`) demonstrates:
8
-
9
- - **BaseTestCase Interface**: All test cases extend the `BaseTestCase` interface
10
- - **Tagging System**: Tests are tagged with categories like `smoke`, `integration`, `performance`, etc.
11
- - **Test Organization**: Tests are organized by functionality and complexity
12
- - **Mock Functions**: Example mock functions for common scenarios
13
-
14
- ## Recommended Test Tags (you can add others to your preference)
15
-
16
- - **`smoke`**: Critical tests that must pass for basic functionality
17
- - **`flaky`**: Tests that may be unreliable or environment-dependent
18
- - **`failing`**: Tests that are currently failing and need debugging
19
-
20
- ## Running Tests
21
-
22
- ### Run All Tests
23
- ```bash
24
- npx run test example-test.ts
25
- ```
26
-
27
- ### Run Only Smoke Tests
28
- ```bash
29
- npx run test-smoke example-test.ts
30
- ```
31
-
32
- ### Run Only Flaky Tests
33
- ```bash
34
- npx run test-flkay *test*.ts
35
- ```
36
-
37
- ## Best Practices
38
-
39
- 1. **Always use tags**: Tag your tests appropriately for easy filtering
40
- 2. **Include descriptions**: Provide clear descriptions of what each test does
41
- 3. **Use meaningful names**: Test names should clearly indicate what's being tested
42
- 4. **Handle errors gracefully**: Catch and report errors appropriately
43
- 5. **Use mocks for external dependencies**: Don't rely on external services in tests
44
- 6. **Test both success and failure cases**: Ensure your tests cover edge cases
45
-
46
- ## Integration with FRAIM
47
-
48
- This testing framework integrates with FRAIM's agent coordination system:
49
-
50
- - **AI Agents**: Use these tests during implementation phase
51
- - **CI/CD**: Automated test execution with proper tagging
52
- - **Evidence Collection**: Test results are collected as evidence for reviews
53
-
54
- ## Customization
55
-
56
- To adapt this testing framework for your project:
57
-
58
- 1. **Update mock functions**: Replace example mocks with your actual functions
59
- 2. **Add project-specific tags**: Define tags relevant to your domain
60
- 3. **Customize test structure**: Modify the test case interface as needed
61
- 4. **Add setup/teardown**: Include any necessary test setup or cleanup
62
- 5. **Configure CI integration**: Set up automated test execution in your CI pipeline