codebuff 1.0.637 → 1.0.638

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