fraim-framework 2.0.63 → 2.0.65

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 (106) hide show
  1. package/bin/fraim-mcp.js +52 -19
  2. package/bin/fraim.js +23 -0
  3. package/dist/src/cli/commands/add-ide.js +53 -14
  4. package/dist/src/cli/commands/doctor.js +12 -24
  5. package/dist/src/cli/commands/init-project.js +0 -3
  6. package/dist/src/cli/commands/init.js +0 -2
  7. package/dist/src/cli/commands/mcp.js +65 -0
  8. package/dist/src/cli/commands/setup.js +17 -1
  9. package/dist/src/cli/commands/sync.js +173 -104
  10. package/dist/src/cli/setup/auto-mcp-setup.js +6 -4
  11. package/dist/src/cli/setup/mcp-config-generator.js +65 -41
  12. package/dist/src/fraim/issue-tracking/ado-provider.js +304 -0
  13. package/dist/src/fraim/issue-tracking/factory.js +63 -0
  14. package/dist/src/fraim/issue-tracking/github-provider.js +200 -0
  15. package/dist/src/fraim/issue-tracking/types.js +7 -0
  16. package/dist/src/fraim/issue-tracking-config.js +83 -0
  17. package/dist/src/local-mcp-server/stdio-server.js +91 -15
  18. package/dist/src/utils/remote-sync.js +130 -0
  19. package/package.json +3 -4
  20. package/dist/src/utils/enforcement-utils.js +0 -239
  21. package/dist/src/utils/validate-workflows.js +0 -101
  22. package/registry/scripts/cleanup-branch.ts +0 -341
  23. package/registry/scripts/code-quality-check.sh +0 -566
  24. package/registry/scripts/comprehensive-explorer.py +0 -297
  25. package/registry/scripts/create-git-labels.sh +0 -49
  26. package/registry/scripts/create-website-structure.js +0 -562
  27. package/registry/scripts/detect-tautological-tests.sh +0 -38
  28. package/registry/scripts/evaluate-code-quality.ts +0 -36
  29. package/registry/scripts/exec-with-timeout.ts +0 -122
  30. package/registry/scripts/generate-engagement-emails.ts +0 -830
  31. package/registry/scripts/interactive-explorer.py +0 -270
  32. package/registry/scripts/markdown-to-pdf.js +0 -395
  33. package/registry/scripts/newsletter-helpers.ts +0 -777
  34. package/registry/scripts/pdf-styles.css +0 -172
  35. package/registry/scripts/prep-issue.sh +0 -548
  36. package/registry/scripts/productivity/build-productivity-csv.mjs +0 -242
  37. package/registry/scripts/productivity/fetch-pr-details.mjs +0 -144
  38. package/registry/scripts/productivity/productivity-report.sh +0 -147
  39. package/registry/scripts/profile-server.ts +0 -426
  40. package/registry/scripts/run-thank-you-workflow.ts +0 -122
  41. package/registry/scripts/scrape-site.py +0 -302
  42. package/registry/scripts/send-newsletter-simple.ts +0 -102
  43. package/registry/scripts/send-thank-you-emails.ts +0 -57
  44. package/registry/scripts/validate-openapi-limits.ts +0 -366
  45. package/registry/scripts/validate-test-coverage.ts +0 -280
  46. package/registry/scripts/verify-pr-comments.sh +0 -74
  47. package/registry/scripts/verify-test-coverage.ts +0 -36
  48. package/registry/stubs/workflows/bootstrap/create-architecture.md +0 -11
  49. package/registry/stubs/workflows/bootstrap/detect-broken-windows.md +0 -11
  50. package/registry/stubs/workflows/bootstrap/evaluate-code-quality.md +0 -11
  51. package/registry/stubs/workflows/bootstrap/verify-test-coverage.md +0 -11
  52. package/registry/stubs/workflows/brainstorming/blue-sky-brainstorming.md +0 -11
  53. package/registry/stubs/workflows/brainstorming/codebase-brainstorming.md +0 -11
  54. package/registry/stubs/workflows/business-development/create-business-plan.md +0 -11
  55. package/registry/stubs/workflows/business-development/ideate-business-opportunity.md +0 -11
  56. package/registry/stubs/workflows/business-development/price-product.md +0 -18
  57. package/registry/stubs/workflows/compliance/detect-compliance-requirements.md +0 -11
  58. package/registry/stubs/workflows/compliance/generate-audit-evidence.md +0 -11
  59. package/registry/stubs/workflows/compliance/soc2-evidence-generator.md +0 -11
  60. package/registry/stubs/workflows/customer-development/insight-analysis.md +0 -11
  61. package/registry/stubs/workflows/customer-development/insight-triage.md +0 -11
  62. package/registry/stubs/workflows/customer-development/interview-preparation.md +0 -11
  63. package/registry/stubs/workflows/customer-development/linkedin-outreach.md +0 -11
  64. package/registry/stubs/workflows/customer-development/strategic-brainstorming.md +0 -11
  65. package/registry/stubs/workflows/customer-development/thank-customers.md +0 -11
  66. package/registry/stubs/workflows/customer-development/user-survey-dispatch.md +0 -11
  67. package/registry/stubs/workflows/customer-development/users-to-target.md +0 -11
  68. package/registry/stubs/workflows/customer-development/weekly-newsletter.md +0 -11
  69. package/registry/stubs/workflows/deploy/cloud-deployment.md +0 -11
  70. package/registry/stubs/workflows/improve-fraim/contribute.md +0 -11
  71. package/registry/stubs/workflows/improve-fraim/file-issue.md +0 -11
  72. package/registry/stubs/workflows/learning/build-skillset.md +0 -11
  73. package/registry/stubs/workflows/learning/synthesize-learnings.md +0 -11
  74. package/registry/stubs/workflows/legal/contract-review-analysis.md +0 -11
  75. package/registry/stubs/workflows/legal/nda.md +0 -11
  76. package/registry/stubs/workflows/legal/patent-filing.md +0 -11
  77. package/registry/stubs/workflows/legal/saas-contract-development.md +0 -11
  78. package/registry/stubs/workflows/legal/trademark-filing.md +0 -11
  79. package/registry/stubs/workflows/marketing/content-creation.md +0 -11
  80. package/registry/stubs/workflows/marketing/convert-to-pdf.md +0 -11
  81. package/registry/stubs/workflows/marketing/create-modern-website.md +0 -11
  82. package/registry/stubs/workflows/marketing/domain-registration.md +0 -11
  83. package/registry/stubs/workflows/marketing/hbr-article.md +0 -11
  84. package/registry/stubs/workflows/marketing/launch-checklist.md +0 -11
  85. package/registry/stubs/workflows/marketing/marketing-strategy.md +0 -11
  86. package/registry/stubs/workflows/marketing/storytelling.md +0 -11
  87. package/registry/stubs/workflows/performance/analyze-performance.md +0 -11
  88. package/registry/stubs/workflows/product-building/design.md +0 -11
  89. package/registry/stubs/workflows/product-building/implement.md +0 -11
  90. package/registry/stubs/workflows/product-building/iterate-on-pr-comments.md +0 -11
  91. package/registry/stubs/workflows/product-building/prep-issue.md +0 -11
  92. package/registry/stubs/workflows/product-building/prototype.md +0 -11
  93. package/registry/stubs/workflows/product-building/resolve.md +0 -11
  94. package/registry/stubs/workflows/product-building/retrospect.md +0 -11
  95. package/registry/stubs/workflows/product-building/spec.md +0 -11
  96. package/registry/stubs/workflows/product-building/test.md +0 -11
  97. package/registry/stubs/workflows/productivity-report/productivity-report.md +0 -11
  98. package/registry/stubs/workflows/quality-assurance/browser-validation.md +0 -11
  99. package/registry/stubs/workflows/quality-assurance/iterative-improvement-cycle.md +0 -11
  100. package/registry/stubs/workflows/replicate/replicate-discovery.md +0 -11
  101. package/registry/stubs/workflows/replicate/replicate-to-issues.md +0 -11
  102. package/registry/stubs/workflows/reviewer/review-implementation-vs-design-spec.md +0 -11
  103. package/registry/stubs/workflows/reviewer/review-implementation-vs-feature-spec.md +0 -11
  104. package/registry/stubs/workflows/startup-credits/aws-activate-application.md +0 -11
  105. package/registry/stubs/workflows/startup-credits/google-cloud-application.md +0 -11
  106. package/registry/stubs/workflows/startup-credits/microsoft-azure-application.md +0 -11
@@ -1,548 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e # Exit on any error
4
-
5
- # Default flags (can be overridden by command line)
6
- SKIP_INSTALL=false
7
- SKIP_SERENA=true
8
- SKIP_EDITOR=true
9
- USE_DEFAULT_BRANCH=true
10
-
11
- # Function to display usage
12
- usage() {
13
- echo "Usage: $0 <issue_number> [editor] [flags]"
14
- echo "Example: $0 123"
15
- echo "Example: $0 123 windsurf"
16
- echo "Example: $0 123 claude --skip-install"
17
- echo "Example: $0 123 cursor --use-default --skip-serena"
18
- echo ""
19
- echo "Editor options: windsurf, claude, claudecode, cursor (default)"
20
- echo "If no editor specified, will try to detect from GitHub issue labels"
21
- echo ""
22
- echo "Flags:"
23
- echo " --skip-install Skip npm install step"
24
- echo " --skip-serena Skip Serena indexing step"
25
- echo " --skip-editor Skip opening editor"
26
- echo " --use-default Force branch creation from default branch (ignore current branch)"
27
- echo " --help Show this help message"
28
- exit 1
29
- }
30
-
31
- # Function to get editor from GitHub issue labels
32
- get_editor_from_issue() {
33
- local issue_num=$1
34
-
35
- # Try to get the issue labels using GitHub CLI or curl
36
- if command -v gh &> /dev/null; then
37
- # Use GitHub CLI if available
38
- local labels=$(gh issue view $issue_num -R "$REPO_OWNER/$REPO_NAME" --json labels --jq '.labels[].name' 2>/dev/null)
39
- else
40
- # Fallback to curl (requires GitHub token in GITHUB_TOKEN env var)
41
- if [ -n "$GITHUB_TOKEN" ]; then
42
- local labels=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
43
- "https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/issues/$issue_num" \
44
- | grep -o '"name":"ai-agent:[^"]*"' | sed 's/"name":"ai-agent://' | sed 's/"//' 2>/dev/null)
45
- else
46
- echo "Warning: No GitHub CLI or GITHUB_TOKEN found. Cannot auto-detect editor from issue labels." >&2
47
- return 1
48
- fi
49
- fi
50
-
51
- # Look for ai-agent labels
52
- for label in $labels; do
53
- if [[ $label == ai-agent:* ]]; then
54
- local editor=${label#ai-agent:}
55
- echo "Found ai-agent label: $label -> editor: $editor" >&2
56
- echo "$editor"
57
- return 0
58
- fi
59
- done
60
-
61
- echo "No ai-agent label found in issue #$issue_num, will continue without editor" >&2
62
- return 0
63
- }
64
-
65
- # Parse command line arguments
66
- if [ $# -eq 0 ]; then
67
- echo "Error: Issue number is required"
68
- usage
69
- fi
70
-
71
- ISSUE_NUMBER=$1
72
- EDITOR="" # Will be set later if not provided
73
-
74
- # Parse remaining arguments (editor and flags)
75
- shift 1 # Remove issue_number
76
- while [[ $# -gt 0 ]]; do
77
- case $1 in
78
- --skip-install)
79
- SKIP_INSTALL=true
80
- shift
81
- ;;
82
- --skip-serena)
83
- SKIP_SERENA=true
84
- shift
85
- ;;
86
- --skip-editor)
87
- SKIP_EDITOR=true
88
- shift
89
- ;;
90
- --use-default)
91
- USE_DEFAULT_BRANCH=true
92
- shift
93
- ;;
94
- --help)
95
- usage
96
- ;;
97
- windsurf|claude|claudecode|cursor)
98
- # Valid editor names
99
- if [ -z "$EDITOR" ]; then
100
- EDITOR="$1"
101
- else
102
- echo "Error: Multiple editors specified: $EDITOR and $1"
103
- usage
104
- fi
105
- shift
106
- ;;
107
- *)
108
- echo "Unknown argument: $1"
109
- echo "Valid editors: windsurf, claude, claudecode, cursor"
110
- echo "Valid flags: --skip-install, --skip-serena, --skip-editor, --use-default"
111
- usage
112
- ;;
113
- esac
114
- done
115
-
116
- # Load repository config from config.json
117
- CONFIG_FILE=".fraim/config.json"
118
- if [ ! -f "$CONFIG_FILE" ]; then
119
- echo "Error: Config file not found at $CONFIG_FILE" >&2
120
- echo "Make sure you're running this script from the project root directory" >&2
121
- echo "Current directory: $(pwd)" >&2
122
- exit 1
123
- fi
124
-
125
- echo "Using config file: $CONFIG_FILE"
126
-
127
- if ! command -v node &> /dev/null; then
128
- echo "Error: node is required but not installed." >&2
129
- exit 1
130
- fi
131
-
132
- # Extract values using node reading from stdin to avoid path issues
133
- NODE_SCRIPT="
134
- const fs = require('fs');
135
- try {
136
- const input = fs.readFileSync(0, 'utf-8');
137
- const config = JSON.parse(input);
138
-
139
- // Support both 'repository' (new) and 'git' (legacy/current) schemas
140
- let repo = config.repository;
141
- let defaultBranch = 'master'; // Default fallback
142
-
143
- if (!repo) {
144
- if (config.git) {
145
- repo = {
146
- owner: config.git.repoOwner,
147
- name: config.git.repoName,
148
- url: config.git.repoUrl || \`https://github.com/\${config.git.repoOwner}/\${config.git.repoName}.git\`
149
- };
150
- // Extract defaultBranch from git config
151
- defaultBranch = config.git.defaultBranch || 'master';
152
- }
153
- } else {
154
- // Extract defaultBranch from repository config
155
- defaultBranch = repo.defaultBranch || 'master';
156
- // Ensure URL is present - construct it if missing
157
- if (!repo.url && repo.owner && repo.name) {
158
- repo.url = \`https://github.com/\${repo.owner}/\${repo.name}.git\`;
159
- }
160
- }
161
-
162
- if (!repo || !repo.owner || !repo.name) {
163
- console.error('❌ Config validation failed: Missing required repository fields');
164
- console.error(' Required: repository.owner, repository.name');
165
- console.error(' Found in config:', JSON.stringify(repo, null, 2));
166
- process.exit(1);
167
- }
168
-
169
- if (!repo.url) {
170
- console.error('❌ Config validation failed: Missing repository.url field');
171
- console.error(' This field is required for cloning the repository');
172
- console.error(' Expected format: https://github.com/owner/repo.git');
173
- console.error(' Current config:', JSON.stringify(repo, null, 2));
174
- console.error('');
175
- console.error('💡 To fix this:');
176
- console.error(' 1. Add \"url\": \"https://github.com/\${repo.owner}/\${repo.name}.git\" to your .fraim/config.json');
177
- console.error(' 2. Or run: fraim init-project (if using FRAIM CLI)');
178
- process.exit(1);
179
- }
180
-
181
- console.log(\`\${repo.owner}|\${repo.name}|\${repo.url}|\${defaultBranch}\`);
182
- } catch (e) {
183
- console.error('❌ Failed to parse .fraim/config.json');
184
- console.error(' Error:', e.message);
185
- console.error('');
186
- console.error('💡 Common issues:');
187
- console.error(' • Invalid JSON syntax');
188
- console.error(' • Missing required fields: repository.owner, repository.name, repository.url');
189
- console.error(' • File encoding issues');
190
- console.error('');
191
- console.error('📝 Expected config format:');
192
- console.error('{');
193
- console.error(' \"repository\": {');
194
- console.error(' \"provider\": \"github\",');
195
- console.error(' \"owner\": \"your-username\",');
196
- console.error(' \"name\": \"your-repo\",');
197
- console.error(' \"url\": \"https://github.com/your-username/your-repo.git\",');
198
- console.error(' \"defaultBranch\": \"main\"');
199
- console.error(' }');
200
- console.error('}');
201
- process.exit(1);
202
- }
203
- "
204
-
205
- REPO_INFO=$(cat "$CONFIG_FILE" | node -e "$NODE_SCRIPT" 2>&1)
206
- if [ $? -ne 0 ]; then
207
- echo "$REPO_INFO" >&2
208
- echo "" >&2
209
- echo "🔧 To fix this issue:" >&2
210
- echo " 1. Check your .fraim/config.json file" >&2
211
- echo " 2. Ensure it has the required repository fields" >&2
212
- echo " 3. Run 'fraim init-project' to regenerate the config" >&2
213
- exit 1
214
- fi
215
-
216
- # Split the result into variables using pipe delimiter
217
- IFS='|' read -r REPO_OWNER REPO_NAME REPO_URL CONFIG_DEFAULT_BRANCH <<< "$REPO_INFO"
218
-
219
- echo "Repository Configuration:"
220
- echo " Owner: $REPO_OWNER"
221
- echo " Name: $REPO_NAME"
222
- echo " URL: $REPO_URL"
223
- echo " Default Branch: $CONFIG_DEFAULT_BRANCH"
224
- echo
225
-
226
- echo "=== $REPO_NAME - Issue Preparation ==="
227
- echo "Preparing for Issue #$ISSUE_NUMBER"
228
- echo
229
-
230
- # Auto-detect editor from GitHub issue labels if not provided
231
- if [ -z "$EDITOR" ]; then
232
- echo "No editor specified, attempting to detect from GitHub issue labels..."
233
- echo "Fetching issue #$ISSUE_NUMBER labels from GitHub..."
234
- DETECTED_EDITOR=$(get_editor_from_issue $ISSUE_NUMBER)
235
- if [ $? -eq 0 ] && [ -n "$DETECTED_EDITOR" ]; then
236
- EDITOR="$DETECTED_EDITOR"
237
- echo "Auto-detected editor: $EDITOR"
238
- else
239
- EDITOR="cursor" # Default fallback
240
- echo "Using default editor: $EDITOR"
241
- fi
242
- else
243
- echo "Using specified editor: $EDITOR"
244
- fi
245
-
246
- # Step 1: Capture current branch BEFORE cloning
247
- echo "Step 1: Determining base branch from current repository..."
248
-
249
- # Determine base branch from the ORIGINAL repository (before cloning)
250
- if [ "$USE_DEFAULT_BRANCH" = true ]; then
251
- # Use the default branch from FRAIM config
252
- DEFAULT_BRANCH="$CONFIG_DEFAULT_BRANCH"
253
- echo "✓ Using default branch from FRAIM config: $DEFAULT_BRANCH"
254
-
255
- # Verify the branch exists on remote
256
- if git ls-remote --exit-code --heads "$REPO_URL" "$DEFAULT_BRANCH" >/dev/null 2>&1; then
257
- echo "✓ Confirmed branch '$DEFAULT_BRANCH' exists on remote"
258
- else
259
- echo "⚠️ Warning: Configured default branch '$DEFAULT_BRANCH' not found on remote"
260
- echo " Falling back to branch detection..."
261
-
262
- # Fallback to detection if configured branch doesn't exist
263
- DEFAULT_BRANCH=""
264
- for candidate in main master develop; do
265
- if git ls-remote --exit-code --heads "$REPO_URL" "$candidate" >/dev/null 2>&1; then
266
- DEFAULT_BRANCH="$candidate"
267
- echo "✓ Detected fallback branch: $DEFAULT_BRANCH"
268
- break
269
- fi
270
- done
271
-
272
- # Final fallback to master
273
- if [ -z "$DEFAULT_BRANCH" ]; then
274
- DEFAULT_BRANCH="master"
275
- echo "⚠️ Could not detect any branch, defaulting to: $DEFAULT_BRANCH"
276
- fi
277
- fi
278
-
279
- BASE_BRANCH="$DEFAULT_BRANCH"
280
- echo "Using default branch as base: $BASE_BRANCH (--use-default flag)"
281
- else
282
- # Get current branch from the original repo
283
- ORIGINAL_BRANCH=$(git branch --show-current 2>/dev/null || echo "")
284
-
285
- if [ -z "$ORIGINAL_BRANCH" ]; then
286
- echo "Warning: Detached HEAD detected in original repo, falling back to configured default branch"
287
-
288
- # Use the default branch from FRAIM config
289
- DEFAULT_BRANCH="$CONFIG_DEFAULT_BRANCH"
290
- echo "✓ Using default branch from FRAIM config: $DEFAULT_BRANCH"
291
-
292
- # Verify the branch exists on remote
293
- if git ls-remote --exit-code --heads "$REPO_URL" "$DEFAULT_BRANCH" >/dev/null 2>&1; then
294
- echo "✓ Confirmed branch '$DEFAULT_BRANCH' exists on remote"
295
- else
296
- echo "⚠️ Warning: Configured default branch '$DEFAULT_BRANCH' not found on remote"
297
- echo " Falling back to branch detection..."
298
-
299
- # Fallback to detection if configured branch doesn't exist
300
- DEFAULT_BRANCH=""
301
- for candidate in main master develop; do
302
- if git ls-remote --exit-code --heads "$REPO_URL" "$candidate" >/dev/null 2>&1; then
303
- DEFAULT_BRANCH="$candidate"
304
- echo "✓ Detected fallback branch: $DEFAULT_BRANCH"
305
- break
306
- fi
307
- done
308
-
309
- # Final fallback to master
310
- if [ -z "$DEFAULT_BRANCH" ]; then
311
- DEFAULT_BRANCH="master"
312
- echo "⚠️ Could not detect any branch, defaulting to: $DEFAULT_BRANCH"
313
- fi
314
- fi
315
-
316
- BASE_BRANCH="$DEFAULT_BRANCH"
317
- else
318
- BASE_BRANCH="$ORIGINAL_BRANCH"
319
- echo "Using current branch from original repo as base: $BASE_BRANCH"
320
- fi
321
- fi
322
-
323
- echo "Issue number = $ISSUE_NUMBER, Editor = $EDITOR, Base branch = $BASE_BRANCH"
324
- echo
325
-
326
- # Step 2: Clone the repo
327
- echo "Step 2: Cloning repository..."
328
-
329
- echo "Issue number = $ISSUE_NUMBER, Editor = $EDITOR, Base branch = $BASE_BRANCH"
330
- echo
331
-
332
- # Get current workspace path
333
- CURRENT_WORKSPACE=$(pwd)
334
- echo "Current workspace: $CURRENT_WORKSPACE"
335
-
336
- # Change to parent directory
337
- echo "Changing to parent directory..."
338
- cd ..
339
- PARENT_DIR=$(pwd)
340
- echo "Parent directory: $PARENT_DIR"
341
-
342
- # Define clone directory name
343
- CLONE_DIR="$REPO_NAME - Issue $ISSUE_NUMBER"
344
- CLONE_PATH="$PARENT_DIR/$CLONE_DIR"
345
-
346
- # Check if directory already exists
347
- if [ -d "$CLONE_PATH" ]; then
348
- echo "Warning: Directory '$CLONE_PATH' already exists"
349
- read -p "Do you want to remove it and re-clone? (y/N): " -n 1 -r
350
- echo
351
- if [[ $REPLY =~ ^[Yy]$ ]]; then
352
- echo "Removing existing directory..."
353
- rm -rf "$CLONE_PATH"
354
- else
355
- echo "Aborting. Please remove the existing directory manually or choose a different issue number."
356
- exit 1
357
- fi
358
- fi
359
-
360
- # Clone the repository
361
- echo "Cloning to: $CLONE_PATH"
362
- git clone "$REPO_URL" "$CLONE_DIR"
363
-
364
- # Change into the cloned repository
365
- cd "$CLONE_DIR"
366
- echo "Changed into cloned repository: $(pwd)"
367
-
368
- echo
369
- echo "Step 3: Safety Checklist Verification"
370
- echo "====================================="
371
-
372
- # Safety checklist verification
373
- echo -n "✓ Confirmed current workspace path with pwd: "
374
- pwd
375
-
376
- echo -n "✓ Verified we are in the cloned repository: "
377
- if [[ "$(pwd)" = "$CLONE_PATH" ]]; then
378
- echo "YES"
379
- else
380
- echo "NO - ERROR!"
381
- exit 1
382
- fi
383
-
384
- echo -n "✓ Successfully changed into cloned repository: "
385
- if [ -d ".git" ]; then
386
- echo "YES"
387
- else
388
- echo "NO - ERROR!"
389
- exit 1
390
- fi
391
-
392
- echo
393
- echo "🎉 Huzzah! Issue #$ISSUE_NUMBER preparation completed successfully!"
394
- echo "Repository cloned to: $(pwd)"
395
- echo
396
-
397
- # Step 4: Create and checkout the feature branch
398
- echo "Step 4: Creating and checking out feature branch..."
399
-
400
- # Get issue title for branch naming
401
- ISSUE_TITLE=$(gh issue view $ISSUE_NUMBER -R "$REPO_OWNER/$REPO_NAME" --json title --jq '.title' 2>/dev/null || echo "issue-$ISSUE_NUMBER")
402
- BRANCH_NAME="feature/${ISSUE_NUMBER}-$(echo "$ISSUE_TITLE" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-\|-$//g')"
403
-
404
- echo "Issue title: $ISSUE_TITLE"
405
- echo "Branch name: $BRANCH_NAME"
406
- echo "Base branch (from original repo): $BASE_BRANCH"
407
-
408
- # Create and checkout the branch
409
- if git show-ref --verify --quiet refs/heads/$BRANCH_NAME; then
410
- echo "Branch $BRANCH_NAME already exists locally, checking it out..."
411
- git checkout $BRANCH_NAME
412
- git pull origin $BRANCH_NAME 2>/dev/null || echo "No remote branch to pull from"
413
- else
414
- echo "Creating new branch $BRANCH_NAME from $BASE_BRANCH..."
415
-
416
- # Ensure we're on the base branch and it's up to date
417
- git checkout $BASE_BRANCH
418
- git pull origin $BASE_BRANCH 2>/dev/null || echo "Warning: Could not update $BASE_BRANCH from remote"
419
-
420
- # Create the new branch
421
- git checkout -b $BRANCH_NAME
422
-
423
- # Push branch without any commits
424
- # PR will be created by phase-change.yml when a phase label is applied
425
- echo "Pushing empty branch to origin..."
426
- git push -u origin $BRANCH_NAME
427
- fi
428
-
429
- echo "✓ Successfully on branch: $BRANCH_NAME (created from: $BASE_BRANCH)"
430
-
431
- # Install dependencies (optional)
432
- if [ "$SKIP_INSTALL" = false ]; then
433
- echo "Installing npm dependencies..."
434
- npm install
435
- if [ $? -eq 0 ]; then
436
- echo "✓ npm install completed successfully"
437
- else
438
- echo "⚠️ npm install failed - you may need to run it manually"
439
- fi
440
- else
441
- echo "⏭️ Skipping npm install (--skip-install flag)"
442
- fi
443
-
444
- # Step 5: Branch Ready for Phase Workflow
445
- echo "Step 5: Branch ready for phase workflow..."
446
- echo "✓ Branch $BRANCH_NAME created and pushed (no commits yet)"
447
- echo "✓ PR will be created when you apply a phase label to the issue"
448
- echo " (phase:spec, phase:design, phase:tests, or phase:impl)"
449
-
450
- # Step 6: Index the codebase with Serena (optional)
451
- if [ "$SKIP_SERENA" = false ]; then
452
- echo "Step 6: Indexing codebase with Serena..."
453
- echo "Running: uvx --from git+https://github.com/oraios/serena serena project index"
454
-
455
- if command -v uvx &> /dev/null; then
456
- uvx --from git+https://github.com/oraios/serena serena project index
457
- if [ $? -eq 0 ]; then
458
- echo "✓ Serena indexing completed successfully"
459
- else
460
- echo "⚠️ Serena indexing failed, but continuing..."
461
- fi
462
- else
463
- echo "⚠️ uvx command not found, skipping Serena indexing"
464
- echo " You may want to install uvx or run the indexing manually"
465
- fi
466
- else
467
- echo "⏭️ Skipping Serena indexing (--skip-serena flag)"
468
- fi
469
-
470
- # Step 7: Open the specified editor in the new directory (optional)
471
- if [ "$SKIP_EDITOR" = false ]; then
472
- echo "Step 7: Opening $EDITOR in the new workspace..."
473
- echo "Opening: $(pwd)"
474
-
475
- # Open the specified editor
476
- case $EDITOR in
477
- windsurf)
478
- if command -v windsurf &> /dev/null; then
479
- echo "Opening with 'windsurf' command..."
480
- windsurf .
481
- else
482
- echo "Could not find 'windsurf' command."
483
- echo "Please manually open Windsurf in: $(pwd)"
484
- fi
485
- ;;
486
- claude|claudecode)
487
- if command -v claude &> /dev/null; then
488
- echo "Opening with 'claude' command..."
489
- claude --dangerously-skip-permissions .
490
- else
491
- echo "Could not find 'claude' command."
492
- echo "Please manually open Claude in: $(pwd)"
493
- fi
494
- ;;
495
- cursor)
496
- if command -v cursor &> /dev/null; then
497
- echo "Opening with 'cursor' command..."
498
- cursor .
499
- elif command -v code &> /dev/null; then
500
- echo "Opening with 'code' command (VS Code fallback)..."
501
- code .
502
- else
503
- echo "Could not find 'cursor' or 'code' command."
504
- echo "Please manually open Cursor in: $(pwd)"
505
- fi
506
- ;;
507
- *)
508
- echo "Unknown editor: $EDITOR"
509
- echo "Supported editors: windsurf, claude, claudecode, cursor"
510
- echo "Please manually open your editor in: $(pwd)"
511
- ;;
512
- esac
513
- else
514
- echo "⏭️ Skipping editor launch (--skip-editor flag)"
515
- echo "Manually open your editor in: $(pwd)"
516
- fi
517
-
518
- echo
519
- echo "🎉 Setup Complete! Ready for agent workflow."
520
- echo
521
- echo "What was prepared:"
522
- echo "- ✅ Repository cloned and ready"
523
- echo "- ✅ Branch created: $BRANCH_NAME (from: $BASE_BRANCH)"
524
- echo "- ✅ Branch checked out and pushed"
525
- if [ "$SKIP_INSTALL" = false ]; then
526
- echo "- ✅ Dependencies installed"
527
- else
528
- echo "- ⏭️ Dependencies skipped"
529
- fi
530
- if [ "$SKIP_SERENA" = false ]; then
531
- echo "- ✅ Codebase indexed with Serena"
532
- else
533
- echo "- ⏭️ Serena indexing skipped"
534
- fi
535
- if [ "$SKIP_EDITOR" = false ]; then
536
- echo "- ✅ Editor opened: $EDITOR"
537
- else
538
- echo "- ⏭️ Editor launch skipped"
539
- fi
540
- echo
541
- echo "Agent workflow:"
542
- echo "1. Agent can start working immediately in this environment"
543
- echo "2. No need to create branches - already done!"
544
- echo "3. AGENT: Before starting work, you MUST read all documents in the retrospectives/ folder to learn from previous issues and avoid repeating mistakes."
545
- echo "4. Agent labels the issue with the appropriate phase (e.g., phase:spec, phase:design)"
546
- echo "5. GitHub Actions will automatically create the PR when phase label is applied"
547
- echo "6. Agent can commit and push changes directly"
548
- echo "7. GitHub Actions will update the PR when phase changes"