freebuff 0.0.27 → 0.0.30

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 (2) hide show
  1. package/index.js +50 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -576,6 +576,7 @@ async function checkForUpdates(runningProcess, exitListener) {
576
576
 
577
577
  newChild.on('exit', (code, signal) => {
578
578
  resetTerminal()
579
+ printCrashDiagnostics(code, signal)
579
580
  process.exit(signal ? 1 : (code || 0))
580
581
  })
581
582
 
@@ -591,6 +592,54 @@ async function checkForUpdates(runningProcess, exitListener) {
591
592
  }
592
593
  }
593
594
 
595
+ function printCrashDiagnostics(code, signal) {
596
+ // Windows NTSTATUS codes (unsigned DWORD)
597
+ const unsignedCode = code != null && code < 0 ? (code >>> 0) : code
598
+ const isIllegalInstruction =
599
+ signal === 'SIGILL' ||
600
+ (process.platform === 'win32' && unsignedCode === 0xC000001D)
601
+ const isAccessViolation =
602
+ signal === 'SIGSEGV' ||
603
+ (process.platform === 'win32' && unsignedCode === 0xC0000005)
604
+ const isBusError = signal === 'SIGBUS'
605
+ const isAbort =
606
+ signal === 'SIGABRT' ||
607
+ (process.platform === 'win32' && unsignedCode === 0xC0000409)
608
+
609
+ if (!isIllegalInstruction && !isAccessViolation && !isBusError && !isAbort) return
610
+
611
+ const exitInfo = signal ? `signal ${signal}` : `code ${code}`
612
+ console.error('')
613
+ console.error(`❌ ${packageName} exited immediately (${exitInfo})`)
614
+ console.error('')
615
+
616
+ if (isIllegalInstruction) {
617
+ console.error('Your CPU may not support the required instruction set (AVX2).')
618
+ console.error('This typically affects CPUs from before 2013.')
619
+ console.error('Unfortunately, this binary is not compatible with your system.')
620
+ console.error('')
621
+ } else if (isAccessViolation) {
622
+ console.error('The binary crashed with an access violation.')
623
+ console.error('')
624
+ } else if (isBusError) {
625
+ console.error('The binary crashed with a bus error.')
626
+ console.error('This may indicate a platform compatibility issue.')
627
+ console.error('')
628
+ } else if (isAbort) {
629
+ console.error('The binary crashed with an abort signal.')
630
+ console.error('')
631
+ }
632
+
633
+ console.error('System info:')
634
+ console.error(` Platform: ${process.platform} ${process.arch}`)
635
+ console.error(` Node: ${process.version}`)
636
+ console.error(` Binary: ${CONFIG.binaryPath}`)
637
+ console.error('')
638
+ console.error('Please report this issue at:')
639
+ console.error(' https://github.com/CodebuffAI/codebuff/issues')
640
+ console.error('')
641
+ }
642
+
594
643
  async function main() {
595
644
  await ensureBinaryExists()
596
645
 
@@ -600,6 +649,7 @@ async function main() {
600
649
 
601
650
  const exitListener = (code, signal) => {
602
651
  resetTerminal()
652
+ printCrashDiagnostics(code, signal)
603
653
  process.exit(signal ? 1 : (code || 0))
604
654
  }
605
655
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "freebuff",
3
- "version": "0.0.27",
3
+ "version": "0.0.30",
4
4
  "description": "The world's strongest free coding agent",
5
5
  "license": "MIT",
6
6
  "bin": {