@xortex/xcode 3.0.2 → 3.0.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/xcode CHANGED
@@ -14,6 +14,7 @@ const fs = require('fs');
14
14
  // Get the project root (where this script is located)
15
15
  const projectRoot = path.resolve(__dirname, '..');
16
16
  const mainScript = path.join(projectRoot, 'entrypoints', 'cli.tsx');
17
+ const bunBundleHook = path.join(projectRoot, 'bun-bundle-hook.js');
17
18
 
18
19
  // Check if bun is available
19
20
  function getRuntime() {
@@ -45,7 +46,7 @@ const args = process.argv.slice(2);
45
46
  const command = args[0];
46
47
 
47
48
  if (command === '--version' || command === '-v') {
48
- console.log('xcode v3.0.1 — AI coding assistant with XMem memory');
49
+ console.log('xcode v3.0.4 — AI coding assistant with XMem memory');
49
50
  process.exit(0);
50
51
  }
51
52
 
@@ -126,16 +127,20 @@ if (runtime === 'bun') {
126
127
  }
127
128
 
128
129
  let child;
130
+ const hasHook = fs.existsSync(bunBundleHook);
131
+
129
132
  if (tsxPath) {
130
- // Use direct tsx path
131
- child = spawn('node', [tsxPath, mainScript, ...args], {
133
+ // Use direct tsx path with bun:bundle shim
134
+ const nodeArgs = hasHook ? ['--require', bunBundleHook, tsxPath, mainScript] : [tsxPath, mainScript];
135
+ child = spawn('node', [...nodeArgs, ...args], {
132
136
  cwd: projectRoot,
133
137
  stdio: 'inherit',
134
138
  env: process.env,
135
139
  });
136
140
  } else {
137
141
  // Fallback to npx
138
- child = spawn('npx', ['tsx', mainScript, ...args], {
142
+ const npxArgs = hasHook ? ['--node-options', `--require ${bunBundleHook}`, 'tsx'] : ['tsx'];
143
+ child = spawn('npx', [...npxArgs, mainScript, ...args], {
139
144
  cwd: projectRoot,
140
145
  stdio: 'inherit',
141
146
  env: process.env,
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Node.js require hook to shim bun:bundle module
3
+ * This must be loaded before any other modules via --require flag
4
+ */
5
+
6
+ const Module = require('module');
7
+ const path = require('path');
8
+
9
+ const originalResolveFilename = Module._resolveFilename;
10
+
11
+ // Store the project root
12
+ const projectRoot = path.resolve(__dirname);
13
+
14
+ Module._resolveFilename = function (request, parent, isMain, options) {
15
+ // Intercept bun:bundle imports
16
+ if (request === 'bun:bundle') {
17
+ // Redirect to our compatibility module
18
+ const compatPath = path.join(projectRoot, 'utils', 'bunBundleCompat.js');
19
+ return compatPath;
20
+ }
21
+
22
+ return originalResolveFilename.call(this, request, parent, isMain, options);
23
+ };
24
+
25
+ console.log('[XCode] Bun compatibility hook loaded');
@@ -1,6 +1,26 @@
1
1
  import '../macro'; // Import to set MACRO global before any other code
2
2
 
3
- import { feature } from 'bun:bundle';
3
+ // Conditional import for bun:bundle - only available in Bun runtime
4
+ // eslint-disable-next-line custom-rules/no-top-level-side-effects
5
+ declare const Bun: { version: string } | undefined;
6
+ // eslint-disable-next-line custom-rules/no-top-level-side-effects
7
+ const isBun = typeof Bun !== 'undefined' && typeof Bun.version === 'string';
8
+
9
+ // Stub feature function for Node.js compatibility
10
+ // eslint-disable-next-line custom-rules/no-top-level-side-effects
11
+ function feature(name: string): boolean {
12
+ if (isBun) {
13
+ // Dynamic import for Bun - will only execute in Bun
14
+ try {
15
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
16
+ const bunBundle = require('bun:bundle');
17
+ return bunBundle.feature(name);
18
+ } catch {
19
+ return false;
20
+ }
21
+ }
22
+ return false;
23
+ }
4
24
 
5
25
  // Bugfix for corepack auto-pinning, which adds yarnpkg to peoples' package.jsons
6
26
  // eslint-disable-next-line custom-rules/no-top-level-side-effects
@@ -39,7 +59,7 @@ async function main(): Promise<void> {
39
59
  if (args.length === 1 && (args[0] === '--version' || args[0] === '-v' || args[0] === '-V')) {
40
60
  // MACRO.VERSION is inlined at build time
41
61
  // biome-ignore lint/suspicious/noConsole:: intentional console output
42
- console.log(`xcode v3.0.0 — AI coding assistant with XMem memory`);
62
+ console.log(`xcode v3.0.4 — AI coding assistant with XMem memory`);
43
63
  return;
44
64
  }
45
65
 
package/macro.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // Build-time macros - stubbed for development
2
2
 
3
3
  export const MACRO = {
4
- VERSION: '3.0.2',
4
+ VERSION: '3.0.4',
5
5
  VERSION_CHANGELOG: '',
6
6
  NATIVE_PACKAGE_URL: '@anthropic-ai/claude-code-native',
7
7
  CLI_BIN_PATH: './cli.tsx',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xortex/xcode",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "XCode - AI-powered coding assistant with XMem long-term memory. Supports Claude, Gemini, Kimi, DeepSeek via OpenRouter.",
5
5
  "main": "main.tsx",
6
6
  "bin": {
@@ -15,6 +15,8 @@
15
15
  "entrypoints/",
16
16
  "main.tsx",
17
17
  "macro.ts",
18
+ "bun-bundle-hook.js",
19
+ "utils/bunBundleCompat.ts",
18
20
  "src/",
19
21
  "constants/",
20
22
  "utils/",
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Compatibility layer for bun:bundle module
3
+ * Provides feature() function for both Bun and Node.js runtimes
4
+ */
5
+
6
+ // Detect if running in Bun
7
+ // eslint-disable-next-line custom-rules/no-top-level-side-effects
8
+ declare const Bun: { version: string } | undefined;
9
+ // eslint-disable-next-line custom-rules/no-top-level-side-effects
10
+ const isBunRuntime = typeof Bun !== 'undefined' && typeof Bun.version === 'string';
11
+
12
+ /**
13
+ * Check if a feature flag is enabled.
14
+ * In Bun, this uses the native bun:bundle module.
15
+ * In Node.js, this checks environment variables.
16
+ */
17
+ export function feature(name: string): boolean {
18
+ if (isBunRuntime) {
19
+ try {
20
+ // Dynamic require for Bun
21
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
22
+ const bunBundle = require('bun:bundle');
23
+ return bunBundle.feature(name);
24
+ } catch {
25
+ return false;
26
+ }
27
+ }
28
+
29
+ // In Node.js, check for equivalent environment variable
30
+ // Features are typically controlled via CLAUDE_CODE_* env vars
31
+ const envVarName = name.replace(/([A-Z])/g, '_$1').toUpperCase();
32
+ const envValue = process.env[`CLAUDE_CODE_${envVarName}`] || process.env[envVarName];
33
+
34
+ if (envValue === '1' || envValue === 'true') {
35
+ return true;
36
+ }
37
+
38
+ // Default feature flags for Node.js
39
+ const defaultEnabled: Record<string, boolean> = {
40
+ // Add any features that should be enabled by default
41
+ };
42
+
43
+ return defaultEnabled[name] ?? false;
44
+ }