openrune 0.3.2 → 0.3.4
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/rune.js +44 -15
- package/package.json +1 -1
package/bin/rune.js
CHANGED
|
@@ -439,10 +439,29 @@ function registerFileAssociation(projectRoot) {
|
|
|
439
439
|
|
|
440
440
|
fs.writeFileSync(path.join(appContents, 'Info.plist'), appPlist)
|
|
441
441
|
|
|
442
|
-
// Launcher script —
|
|
442
|
+
// Launcher script — dynamically finds the rune binary and uses it to resolve Electron
|
|
443
|
+
const runeBin = path.resolve(__dirname, 'rune.js')
|
|
444
|
+
const nodebin = process.execPath
|
|
443
445
|
const launcherScript = `#!/bin/bash
|
|
444
|
-
|
|
445
|
-
|
|
446
|
+
# Dynamically resolve Rune's install location via the CLI binary
|
|
447
|
+
RUNE_BIN="${runeBin}"
|
|
448
|
+
RUNE_PROJECT="$(dirname "$(dirname "$RUNE_BIN")")"
|
|
449
|
+
|
|
450
|
+
# Find Electron binary
|
|
451
|
+
ELECTRON="$RUNE_PROJECT/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron"
|
|
452
|
+
|
|
453
|
+
if [ ! -f "$ELECTRON" ]; then
|
|
454
|
+
# Fallback: try the path saved by rune install
|
|
455
|
+
if [ -f "$HOME/.rune/project-path" ]; then
|
|
456
|
+
RUNE_PROJECT="$(cat "$HOME/.rune/project-path")"
|
|
457
|
+
ELECTRON="$RUNE_PROJECT/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron"
|
|
458
|
+
fi
|
|
459
|
+
fi
|
|
460
|
+
|
|
461
|
+
if [ ! -f "$ELECTRON" ]; then
|
|
462
|
+
osascript -e 'display dialog "Electron not found. Run: rune install" buttons {"OK"}'
|
|
463
|
+
exit 1
|
|
464
|
+
fi
|
|
446
465
|
|
|
447
466
|
# CRITICAL: unset this so Electron runs as an app, not plain Node.js
|
|
448
467
|
unset ELECTRON_RUN_AS_NODE
|
|
@@ -609,6 +628,23 @@ function createRune(name, allArgs) {
|
|
|
609
628
|
|
|
610
629
|
// ── open ─────────────────────────────────────────
|
|
611
630
|
|
|
631
|
+
function findProjectRoot() {
|
|
632
|
+
// Always resolve from the actual package location (works for both global and local)
|
|
633
|
+
const fromBin = path.resolve(__dirname, '..')
|
|
634
|
+
const electronCheck = path.join(fromBin, 'node_modules', 'electron', 'dist', 'Electron.app', 'Contents', 'MacOS', 'Electron')
|
|
635
|
+
if (fs.existsSync(electronCheck)) return fromBin
|
|
636
|
+
|
|
637
|
+
// Fallback: check saved path
|
|
638
|
+
const savedPath = path.join(RUNE_HOME, 'project-path')
|
|
639
|
+
if (fs.existsSync(savedPath)) {
|
|
640
|
+
const saved = fs.readFileSync(savedPath, 'utf-8').trim()
|
|
641
|
+
const savedElectron = path.join(saved, 'node_modules', 'electron', 'dist', 'Electron.app', 'Contents', 'MacOS', 'Electron')
|
|
642
|
+
if (fs.existsSync(savedElectron)) return saved
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
return null
|
|
646
|
+
}
|
|
647
|
+
|
|
612
648
|
function openRune(file) {
|
|
613
649
|
if (!file) {
|
|
614
650
|
console.log('Usage: rune open <file.rune>')
|
|
@@ -621,21 +657,14 @@ function openRune(file) {
|
|
|
621
657
|
process.exit(1)
|
|
622
658
|
}
|
|
623
659
|
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
const savedPath = path.join(RUNE_HOME, 'project-path')
|
|
627
|
-
if (fs.existsSync(savedPath)) {
|
|
628
|
-
projectRoot = fs.readFileSync(savedPath, 'utf-8').trim()
|
|
629
|
-
} else {
|
|
630
|
-
projectRoot = path.resolve(__dirname, '..')
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
const electronBinary = path.join(projectRoot, 'node_modules', 'electron', 'dist', 'Electron.app', 'Contents', 'MacOS', 'Electron')
|
|
634
|
-
if (!fs.existsSync(electronBinary)) {
|
|
660
|
+
const projectRoot = findProjectRoot()
|
|
661
|
+
if (!projectRoot) {
|
|
635
662
|
console.error(' ❌ Electron not found. Run `rune install` first.')
|
|
636
663
|
process.exit(1)
|
|
637
664
|
}
|
|
638
665
|
|
|
666
|
+
const electronBinary = path.join(projectRoot, 'node_modules', 'electron', 'dist', 'Electron.app', 'Contents', 'MacOS', 'Electron')
|
|
667
|
+
|
|
639
668
|
console.log(`🔮 Opening ${path.basename(filePath)}...`)
|
|
640
669
|
|
|
641
670
|
// CRITICAL: unset ELECTRON_RUN_AS_NODE — Claude Code sets it,
|
|
@@ -719,7 +748,7 @@ function runRune(file, restArgs) {
|
|
|
719
748
|
console.log(`🔮 [auto] ${rune.name} is working on: ${prompt}\n`)
|
|
720
749
|
|
|
721
750
|
const claudeArgs = ['-p', '--print',
|
|
722
|
-
'--
|
|
751
|
+
'--dangerously-skip-permissions',
|
|
723
752
|
'--verbose',
|
|
724
753
|
'--output-format', 'stream-json',
|
|
725
754
|
]
|
package/package.json
CHANGED