ralph-cli-sandboxed 0.2.9 → 0.4.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.
Files changed (73) hide show
  1. package/README.md +99 -15
  2. package/dist/commands/action.d.ts +7 -0
  3. package/dist/commands/action.js +276 -0
  4. package/dist/commands/chat.d.ts +8 -0
  5. package/dist/commands/chat.js +701 -0
  6. package/dist/commands/config.d.ts +1 -0
  7. package/dist/commands/config.js +51 -0
  8. package/dist/commands/daemon.d.ts +23 -0
  9. package/dist/commands/daemon.js +422 -0
  10. package/dist/commands/docker.js +82 -4
  11. package/dist/commands/fix-config.d.ts +4 -0
  12. package/dist/commands/fix-config.js +388 -0
  13. package/dist/commands/help.js +80 -0
  14. package/dist/commands/init.js +135 -1
  15. package/dist/commands/listen.d.ts +8 -0
  16. package/dist/commands/listen.js +280 -0
  17. package/dist/commands/notify.d.ts +7 -0
  18. package/dist/commands/notify.js +165 -0
  19. package/dist/commands/once.js +8 -8
  20. package/dist/commands/prd.js +2 -2
  21. package/dist/commands/run.js +25 -12
  22. package/dist/config/languages.json +4 -0
  23. package/dist/index.js +14 -0
  24. package/dist/providers/telegram.d.ts +39 -0
  25. package/dist/providers/telegram.js +256 -0
  26. package/dist/templates/macos-scripts.d.ts +42 -0
  27. package/dist/templates/macos-scripts.js +448 -0
  28. package/dist/tui/ConfigEditor.d.ts +7 -0
  29. package/dist/tui/ConfigEditor.js +313 -0
  30. package/dist/tui/components/ArrayEditor.d.ts +22 -0
  31. package/dist/tui/components/ArrayEditor.js +193 -0
  32. package/dist/tui/components/BooleanToggle.d.ts +19 -0
  33. package/dist/tui/components/BooleanToggle.js +43 -0
  34. package/dist/tui/components/EditorPanel.d.ts +50 -0
  35. package/dist/tui/components/EditorPanel.js +232 -0
  36. package/dist/tui/components/HelpPanel.d.ts +13 -0
  37. package/dist/tui/components/HelpPanel.js +69 -0
  38. package/dist/tui/components/JsonSnippetEditor.d.ts +24 -0
  39. package/dist/tui/components/JsonSnippetEditor.js +380 -0
  40. package/dist/tui/components/KeyValueEditor.d.ts +34 -0
  41. package/dist/tui/components/KeyValueEditor.js +261 -0
  42. package/dist/tui/components/ObjectEditor.d.ts +23 -0
  43. package/dist/tui/components/ObjectEditor.js +227 -0
  44. package/dist/tui/components/PresetSelector.d.ts +23 -0
  45. package/dist/tui/components/PresetSelector.js +58 -0
  46. package/dist/tui/components/Preview.d.ts +18 -0
  47. package/dist/tui/components/Preview.js +190 -0
  48. package/dist/tui/components/ScrollableContainer.d.ts +38 -0
  49. package/dist/tui/components/ScrollableContainer.js +77 -0
  50. package/dist/tui/components/SectionNav.d.ts +31 -0
  51. package/dist/tui/components/SectionNav.js +130 -0
  52. package/dist/tui/components/StringEditor.d.ts +21 -0
  53. package/dist/tui/components/StringEditor.js +29 -0
  54. package/dist/tui/hooks/useConfig.d.ts +16 -0
  55. package/dist/tui/hooks/useConfig.js +89 -0
  56. package/dist/tui/hooks/useTerminalSize.d.ts +21 -0
  57. package/dist/tui/hooks/useTerminalSize.js +48 -0
  58. package/dist/tui/utils/presets.d.ts +52 -0
  59. package/dist/tui/utils/presets.js +191 -0
  60. package/dist/tui/utils/validation.d.ts +49 -0
  61. package/dist/tui/utils/validation.js +198 -0
  62. package/dist/utils/chat-client.d.ts +144 -0
  63. package/dist/utils/chat-client.js +102 -0
  64. package/dist/utils/config.d.ts +52 -0
  65. package/dist/utils/daemon-client.d.ts +36 -0
  66. package/dist/utils/daemon-client.js +70 -0
  67. package/dist/utils/message-queue.d.ts +58 -0
  68. package/dist/utils/message-queue.js +133 -0
  69. package/dist/utils/notification.d.ts +28 -1
  70. package/dist/utils/notification.js +146 -20
  71. package/docs/MACOS-DEVELOPMENT.md +435 -0
  72. package/docs/RALPH-SETUP-TEMPLATE.md +262 -0
  73. package/package.json +6 -1
@@ -0,0 +1,448 @@
1
+ /**
2
+ * macOS/Swift development script templates
3
+ * These scripts are generated when Swift + SwiftUI is selected during ralph init
4
+ */
5
+ /**
6
+ * Generate gen_xcode.sh script content
7
+ * This script generates an Xcode project from a Swift package, supporting SwiftUI apps
8
+ *
9
+ * Usage: ./scripts/gen_xcode.sh [project_name]
10
+ *
11
+ * @param projectName - Default project name (can be overridden by script argument)
12
+ */
13
+ export function generateGenXcodeScript(projectName = "App") {
14
+ return `#!/bin/bash
15
+ #
16
+ # gen_xcode.sh - Generate Xcode project from Swift package
17
+ #
18
+ # This script generates an Xcode project from a Swift package, with support
19
+ # for SwiftUI macOS applications including proper Info.plist and entitlements.
20
+ #
21
+ # USAGE:
22
+ # ./scripts/gen_xcode.sh [project_name]
23
+ #
24
+ # ARGUMENTS:
25
+ # project_name - Name of the project/app (default: ${projectName})
26
+ #
27
+ # EXAMPLES:
28
+ # ./scripts/gen_xcode.sh # Uses default project name
29
+ # ./scripts/gen_xcode.sh MyAwesomeApp # Creates MyAwesomeApp.xcodeproj
30
+ #
31
+ # REQUIREMENTS:
32
+ # - Swift toolchain installed
33
+ # - Xcode command line tools
34
+ # - For SwiftUI apps: xcodegen (brew install xcodegen) OR swift package generate-xcodeproj
35
+ #
36
+ # OUTPUT:
37
+ # - Creates <project_name>.xcodeproj in the project root
38
+ # - Generates Info.plist if not present
39
+ # - Generates entitlements file if not present
40
+ #
41
+ # This script is designed to be run on the host macOS system (not in Docker)
42
+ # since Xcode and macOS-specific tooling is required.
43
+ #
44
+
45
+ set -e
46
+
47
+ PROJECT_NAME="\${1:-${projectName}}"
48
+ SCRIPT_DIR="$(cd "$(dirname "\${BASH_SOURCE[0]}")" && pwd)"
49
+ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
50
+
51
+ echo "Generating Xcode project: \$PROJECT_NAME"
52
+ echo "Project root: \$PROJECT_ROOT"
53
+ echo ""
54
+
55
+ cd "$PROJECT_ROOT"
56
+
57
+ # Check if Package.swift exists
58
+ if [ ! -f "Package.swift" ]; then
59
+ echo "Error: Package.swift not found in project root"
60
+ echo "This script requires a Swift Package Manager project"
61
+ exit 1
62
+ fi
63
+
64
+ # Create Supporting Files directory for Info.plist and entitlements
65
+ SUPPORT_DIR="$PROJECT_ROOT/Sources/\$PROJECT_NAME/Supporting Files"
66
+ mkdir -p "$SUPPORT_DIR"
67
+
68
+ # Generate Info.plist if it doesn't exist
69
+ INFO_PLIST="$SUPPORT_DIR/Info.plist"
70
+ if [ ! -f "$INFO_PLIST" ]; then
71
+ echo "Creating Info.plist..."
72
+ cat > "$INFO_PLIST" << 'PLIST_EOF'
73
+ <?xml version="1.0" encoding="UTF-8"?>
74
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
75
+ <plist version="1.0">
76
+ <dict>
77
+ <key>CFBundleDevelopmentRegion</key>
78
+ <string>$(DEVELOPMENT_LANGUAGE)</string>
79
+ <key>CFBundleExecutable</key>
80
+ <string>$(EXECUTABLE_NAME)</string>
81
+ <key>CFBundleIdentifier</key>
82
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
83
+ <key>CFBundleInfoDictionaryVersion</key>
84
+ <string>6.0</string>
85
+ <key>CFBundleName</key>
86
+ <string>$(PRODUCT_NAME)</string>
87
+ <key>CFBundlePackageType</key>
88
+ <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
89
+ <key>CFBundleShortVersionString</key>
90
+ <string>1.0</string>
91
+ <key>CFBundleVersion</key>
92
+ <string>1</string>
93
+ <key>LSMinimumSystemVersion</key>
94
+ <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
95
+ <key>NSHumanReadableCopyright</key>
96
+ <string>Copyright © 2024. All rights reserved.</string>
97
+ <key>NSMainStoryboardFile</key>
98
+ <string></string>
99
+ <key>NSPrincipalClass</key>
100
+ <string>NSApplication</string>
101
+ </dict>
102
+ </plist>
103
+ PLIST_EOF
104
+ echo "Created: $INFO_PLIST"
105
+ fi
106
+
107
+ # Generate entitlements file if it doesn't exist
108
+ ENTITLEMENTS="$SUPPORT_DIR/\$PROJECT_NAME.entitlements"
109
+ if [ ! -f "$ENTITLEMENTS" ]; then
110
+ echo "Creating entitlements file..."
111
+ cat > "$ENTITLEMENTS" << 'ENTITLEMENTS_EOF'
112
+ <?xml version="1.0" encoding="UTF-8"?>
113
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
114
+ <plist version="1.0">
115
+ <dict>
116
+ <key>com.apple.security.app-sandbox</key>
117
+ <true/>
118
+ <key>com.apple.security.network.client</key>
119
+ <true/>
120
+ <key>com.apple.security.files.user-selected.read-write</key>
121
+ <true/>
122
+ </dict>
123
+ </plist>
124
+ ENTITLEMENTS_EOF
125
+ echo "Created: $ENTITLEMENTS"
126
+ fi
127
+
128
+ # Try xcodegen first (recommended for SwiftUI apps)
129
+ if command -v xcodegen &> /dev/null; then
130
+ echo ""
131
+ echo "Using xcodegen to generate Xcode project..."
132
+
133
+ # Create project.yml if it doesn't exist
134
+ PROJECT_YML="$PROJECT_ROOT/project.yml"
135
+ if [ ! -f "$PROJECT_YML" ]; then
136
+ echo "Creating project.yml for xcodegen..."
137
+ cat > "$PROJECT_YML" << YAML_EOF
138
+ name: \$PROJECT_NAME
139
+ options:
140
+ bundleIdPrefix: com.example
141
+ deploymentTarget:
142
+ macOS: "13.0"
143
+ xcodeVersion: "15.0"
144
+ generateEmptyDirectories: true
145
+
146
+ targets:
147
+ \$PROJECT_NAME:
148
+ type: application
149
+ platform: macOS
150
+ sources:
151
+ - path: Sources/\$PROJECT_NAME
152
+ excludes:
153
+ - "**/*.entitlements"
154
+ settings:
155
+ base:
156
+ PRODUCT_BUNDLE_IDENTIFIER: com.example.\$PROJECT_NAME
157
+ INFOPLIST_FILE: Sources/\$PROJECT_NAME/Supporting Files/Info.plist
158
+ CODE_SIGN_ENTITLEMENTS: Sources/\$PROJECT_NAME/Supporting Files/\$PROJECT_NAME.entitlements
159
+ MACOSX_DEPLOYMENT_TARGET: "13.0"
160
+ SWIFT_VERSION: "5.9"
161
+ DEVELOPMENT_TEAM: ""
162
+ CODE_SIGN_STYLE: Automatic
163
+ COMBINE_HIDPI_IMAGES: true
164
+ ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
165
+ dependencies: []
166
+ YAML_EOF
167
+ echo "Created: $PROJECT_YML"
168
+ fi
169
+
170
+ xcodegen generate
171
+ echo ""
172
+ echo "Xcode project generated successfully!"
173
+
174
+ else
175
+ # Fall back to swift package generate-xcodeproj (deprecated but still works)
176
+ echo ""
177
+ echo "xcodegen not found, using 'swift package generate-xcodeproj'..."
178
+ echo "Note: For better SwiftUI support, consider installing xcodegen:"
179
+ echo " brew install xcodegen"
180
+ echo ""
181
+
182
+ swift package generate-xcodeproj
183
+ echo ""
184
+ echo "Xcode project generated successfully!"
185
+ echo ""
186
+ echo "Note: You may need to manually configure SwiftUI app settings in Xcode:"
187
+ echo " 1. Set the app target type to 'Application'"
188
+ echo " 2. Add Info.plist to the target"
189
+ echo " 3. Configure signing and capabilities"
190
+ fi
191
+
192
+ echo ""
193
+ echo "Next steps:"
194
+ echo " 1. Open \$PROJECT_NAME.xcodeproj in Xcode"
195
+ echo " 2. Configure your Team ID for code signing"
196
+ echo " 3. Build and run (Cmd+R)"
197
+ echo ""
198
+ echo "If using xcodegen, you can regenerate the project anytime with:"
199
+ echo " ./scripts/gen_xcode.sh"
200
+ `;
201
+ }
202
+ /**
203
+ * Check if the selected technologies include SwiftUI
204
+ */
205
+ export function hasSwiftUI(technologies) {
206
+ return technologies.some(tech => tech.toLowerCase().includes('swiftui') ||
207
+ tech.toLowerCase() === 'swiftui');
208
+ }
209
+ /**
210
+ * Check if the selected technologies include Fastlane
211
+ */
212
+ export function hasFastlane(technologies) {
213
+ return technologies.some(tech => tech.toLowerCase().includes('fastlane') ||
214
+ tech.toLowerCase() === 'fastlane');
215
+ }
216
+ /**
217
+ * Generate Fastfile template for macOS/iOS deployment
218
+ * This creates a standard Fastfile with beta and release lanes
219
+ *
220
+ * @param projectName - Name of the Xcode project/app
221
+ */
222
+ export function generateFastfile(projectName = "App") {
223
+ return `# Fastfile - Fastlane configuration for ${projectName}
224
+ #
225
+ # This file contains lanes for automating builds and deployments.
226
+ # Run lanes from the scripts/ directory: cd scripts && fastlane <lane>
227
+ #
228
+ # SETUP:
229
+ # 1. Run 'fastlane init' in this directory to configure credentials
230
+ # 2. Update the Appfile with your Apple Developer account details
231
+ # 3. Configure signing in Xcode or via match
232
+ #
233
+ # AVAILABLE LANES:
234
+ # fastlane beta - Build and upload to TestFlight
235
+ # fastlane release - Build and submit to App Store
236
+ # fastlane tests - Run all tests
237
+ #
238
+ # For more information: https://docs.fastlane.tools
239
+ #
240
+
241
+ default_platform(:mac)
242
+
243
+ platform :mac do
244
+ desc "Run all tests"
245
+ lane :tests do
246
+ run_tests(
247
+ project: "../${projectName}.xcodeproj",
248
+ scheme: "${projectName}",
249
+ clean: true,
250
+ code_coverage: true
251
+ )
252
+ end
253
+
254
+ desc "Build and upload to TestFlight for beta testing"
255
+ lane :beta do
256
+ # Ensure we're on a clean git state
257
+ ensure_git_status_clean
258
+
259
+ # Increment build number
260
+ increment_build_number(
261
+ xcodeproj: "../${projectName}.xcodeproj"
262
+ )
263
+
264
+ # Build the app
265
+ build_mac_app(
266
+ project: "../${projectName}.xcodeproj",
267
+ scheme: "${projectName}",
268
+ configuration: "Release",
269
+ export_method: "app-store",
270
+ output_directory: "../build",
271
+ output_name: "${projectName}.app"
272
+ )
273
+
274
+ # Upload to TestFlight
275
+ upload_to_testflight(
276
+ skip_waiting_for_build_processing: true
277
+ )
278
+
279
+ # Commit version bump
280
+ commit_version_bump(
281
+ xcodeproj: "../${projectName}.xcodeproj",
282
+ message: "chore: Bump build number for beta release"
283
+ )
284
+
285
+ # Tag the release
286
+ add_git_tag(
287
+ tag: "beta/#{get_version_number(xcodeproj: '../${projectName}.xcodeproj')}-#{get_build_number(xcodeproj: '../${projectName}.xcodeproj')}"
288
+ )
289
+
290
+ # Push to remote
291
+ push_to_git_remote
292
+ end
293
+
294
+ desc "Build and submit to the App Store"
295
+ lane :release do
296
+ # Ensure we're on a clean git state
297
+ ensure_git_status_clean
298
+
299
+ # Run tests first
300
+ tests
301
+
302
+ # Increment version number (patch)
303
+ increment_version_number(
304
+ xcodeproj: "../${projectName}.xcodeproj",
305
+ bump_type: "patch"
306
+ )
307
+
308
+ # Reset build number for new version
309
+ increment_build_number(
310
+ xcodeproj: "../${projectName}.xcodeproj",
311
+ build_number: "1"
312
+ )
313
+
314
+ # Build the app
315
+ build_mac_app(
316
+ project: "../${projectName}.xcodeproj",
317
+ scheme: "${projectName}",
318
+ configuration: "Release",
319
+ export_method: "app-store",
320
+ output_directory: "../build",
321
+ output_name: "${projectName}.app"
322
+ )
323
+
324
+ # Upload to App Store Connect
325
+ upload_to_app_store(
326
+ submit_for_review: false,
327
+ automatic_release: false,
328
+ skip_metadata: true,
329
+ skip_screenshots: true
330
+ )
331
+
332
+ # Commit version bump
333
+ commit_version_bump(
334
+ xcodeproj: "../${projectName}.xcodeproj",
335
+ message: "chore: Bump version for App Store release"
336
+ )
337
+
338
+ # Tag the release
339
+ add_git_tag(
340
+ tag: "v#{get_version_number(xcodeproj: '../${projectName}.xcodeproj')}"
341
+ )
342
+
343
+ # Push to remote
344
+ push_to_git_remote(tags: true)
345
+ end
346
+
347
+ # Error handling
348
+ error do |lane, exception|
349
+ # You can add error notifications here (e.g., Slack, email)
350
+ UI.error("Lane #{lane} failed with error: #{exception.message}")
351
+ end
352
+ end
353
+ `;
354
+ }
355
+ /**
356
+ * Generate Appfile template for Fastlane
357
+ * This contains app-specific configuration like bundle ID and Apple ID
358
+ *
359
+ * @param projectName - Name of the Xcode project/app
360
+ */
361
+ export function generateAppfile(projectName = "App") {
362
+ const bundleId = `com.example.${projectName.toLowerCase().replace(/[^a-z0-9]/g, "")}`;
363
+ return `# Appfile - Fastlane app configuration
364
+ #
365
+ # This file contains your app's bundle identifier and Apple Developer account info.
366
+ # Update the values below with your actual credentials.
367
+ #
368
+ # For more information: https://docs.fastlane.tools/advanced/Appfile/
369
+ #
370
+
371
+ # Your app's bundle identifier (must match Xcode project)
372
+ app_identifier "${bundleId}"
373
+
374
+ # Your Apple Developer email address
375
+ # apple_id "your-email@example.com"
376
+
377
+ # Your App Store Connect team ID (if you're on multiple teams)
378
+ # itc_team_id "123456789"
379
+
380
+ # Your Apple Developer Portal team ID (if you're on multiple teams)
381
+ # team_id "XXXXXXXXXX"
382
+
383
+ # For more information about the Appfile, see:
384
+ # https://docs.fastlane.tools/advanced/Appfile/
385
+ `;
386
+ }
387
+ /**
388
+ * Generate README section for Fastlane setup
389
+ * This provides documentation on how to use Fastlane with the project
390
+ *
391
+ * @param projectName - Name of the Xcode project/app
392
+ */
393
+ export function generateFastlaneReadmeSection(projectName = "App") {
394
+ return `## Fastlane Deployment
395
+
396
+ This project includes [Fastlane](https://fastlane.tools/) configuration for automated builds and deployments.
397
+
398
+ ### Setup
399
+
400
+ 1. **Install Fastlane** (if not already installed):
401
+ \`\`\`bash
402
+ # Using Homebrew
403
+ brew install fastlane
404
+
405
+ # Or using RubyGems
406
+ gem install fastlane
407
+ \`\`\`
408
+
409
+ 2. **Configure credentials**:
410
+ - Edit \`scripts/fastlane/Appfile\` with your Apple Developer account details
411
+ - Run \`cd scripts && fastlane init\` to set up App Store Connect credentials
412
+
413
+ 3. **Configure code signing** (choose one):
414
+ - **Xcode automatic signing**: Enable "Automatically manage signing" in Xcode
415
+ - **Fastlane match**: Run \`fastlane match init\` to set up certificate/profile management
416
+
417
+ ### Available Lanes
418
+
419
+ Run Fastlane commands from the \`scripts/\` directory:
420
+
421
+ | Lane | Description |
422
+ |------|-------------|
423
+ | \`fastlane tests\` | Run all unit and UI tests |
424
+ | \`fastlane beta\` | Build and upload to TestFlight |
425
+ | \`fastlane release\` | Build and submit to App Store |
426
+
427
+ ### Using with Ralph
428
+
429
+ Ralph can trigger Fastlane lanes via daemon actions:
430
+
431
+ \`\`\`bash
432
+ # From inside the sandbox (via ralph action)
433
+ ralph action fastlane_beta
434
+ ralph action fastlane_release
435
+
436
+ # From Telegram chat
437
+ /notify fastlane_beta
438
+ /notify fastlane_release
439
+ \`\`\`
440
+
441
+ ### Customization
442
+
443
+ - **Fastfile** (\`scripts/fastlane/Fastfile\`): Add custom lanes for your workflow
444
+ - **Appfile** (\`scripts/fastlane/Appfile\`): Configure app bundle ID and team settings
445
+
446
+ For more information, see the [Fastlane documentation](https://docs.fastlane.tools/).
447
+ `;
448
+ }
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ /**
3
+ * ConfigEditor is the main TUI application component.
4
+ * It provides a two-panel layout with section navigation and field editing.
5
+ */
6
+ export declare function ConfigEditor(): React.ReactElement;
7
+ export default ConfigEditor;