@xortex/xcode 3.0.5 → 3.1.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 (75) hide show
  1. package/INSTALLATION.md +285 -0
  2. package/QUICKSTART.md +151 -0
  3. package/SYSTEM_PROMPT.md +583 -0
  4. package/SYSTEM_PROMPT_EXTRACTED.md +1 -0
  5. package/Untitled +1 -0
  6. package/bin/xcode +69 -120
  7. package/bootstrap/state.ts +1758 -0
  8. package/bun-bundle-hook.js +38 -17
  9. package/bun-bundle-shim.ts +12 -0
  10. package/bun.lock +645 -0
  11. package/context/QueuedMessageContext.tsx +63 -0
  12. package/context/fpsMetrics.tsx +30 -0
  13. package/context/mailbox.tsx +38 -0
  14. package/context/modalContext.tsx +58 -0
  15. package/context/notifications.tsx +240 -0
  16. package/context/overlayContext.tsx +151 -0
  17. package/context/promptOverlayContext.tsx +125 -0
  18. package/context/stats.tsx +220 -0
  19. package/context/voice.tsx +88 -0
  20. package/coordinator/coordinatorMode.ts +369 -0
  21. package/costHook.ts +22 -0
  22. package/dialogLaunchers.tsx +133 -0
  23. package/entrypoints/cli.tsx +1 -1
  24. package/extract_prompt.ts +304 -0
  25. package/ink.ts +85 -0
  26. package/install.sh +221 -0
  27. package/interactiveHelpers.tsx +366 -0
  28. package/macro.ts +1 -1
  29. package/memdir/findRelevantMemories.ts +141 -0
  30. package/memdir/memdir.ts +511 -0
  31. package/memdir/memoryAge.ts +53 -0
  32. package/memdir/memoryScan.ts +94 -0
  33. package/memdir/memoryTypes.ts +271 -0
  34. package/memdir/paths.ts +291 -0
  35. package/memdir/teamMemPaths.ts +292 -0
  36. package/memdir/teamMemPrompts.ts +100 -0
  37. package/moreright/useMoreRight.tsx +26 -0
  38. package/native-ts/color-diff/index.ts +999 -0
  39. package/native-ts/file-index/index.ts +370 -0
  40. package/native-ts/yoga-layout/enums.ts +134 -0
  41. package/native-ts/yoga-layout/index.ts +2578 -0
  42. package/outputStyles/loadOutputStylesDir.ts +98 -0
  43. package/package.json +5 -42
  44. package/plugins/builtinPlugins.ts +159 -0
  45. package/plugins/bundled/index.ts +23 -0
  46. package/projectOnboardingState.ts +83 -0
  47. package/public/claude-files.png +0 -0
  48. package/public/leak-tweet.png +0 -0
  49. package/query/config.ts +46 -0
  50. package/query/deps.ts +40 -0
  51. package/query/stopHooks.ts +470 -0
  52. package/query/tokenBudget.ts +93 -0
  53. package/replLauncher.tsx +27 -0
  54. package/schemas/hooks.ts +222 -0
  55. package/screens/Doctor.tsx +575 -0
  56. package/screens/REPL.tsx +7107 -0
  57. package/screens/ResumeConversation.tsx +399 -0
  58. package/scripts/postinstall.js +90 -0
  59. package/server/createDirectConnectSession.ts +88 -0
  60. package/server/directConnectManager.ts +213 -0
  61. package/server/types.ts +57 -0
  62. package/setup.ts +477 -0
  63. package/stub_types.sh +13 -0
  64. package/tasks.ts +39 -0
  65. package/tools.ts +396 -0
  66. package/tsconfig.json +16 -0
  67. package/upstreamproxy/relay.ts +455 -0
  68. package/upstreamproxy/upstreamproxy.ts +285 -0
  69. package/vim/motions.ts +82 -0
  70. package/vim/operators.ts +556 -0
  71. package/vim/textObjects.ts +186 -0
  72. package/vim/transitions.ts +490 -0
  73. package/vim/types.ts +199 -0
  74. package/voice/voiceModeEnabled.ts +54 -0
  75. package/utils/bunBundleCompat.ts +0 -44
@@ -1,25 +1,46 @@
1
1
  /**
2
- * Node.js require hook to shim bun:bundle module
3
- * This must be loaded before any other modules via --require flag
2
+ * Node.js require hook to shim 'bun:bundle' for tsx/Node.js compatibility.
3
+ *
4
+ * Strategy:
5
+ * 1. Intercept Module._resolveFilename so 'bun:bundle' resolves to a
6
+ * sentinel path (not a real file) instead of throwing MODULE_NOT_FOUND.
7
+ * 2. Pre-populate Module._cache with the shim exports under that sentinel
8
+ * path, so Module._load finds it in cache and never tries to read a file.
9
+ *
10
+ * This works even when tsx wraps _resolveFilename after this hook is installed,
11
+ * because tsx calls the original _resolveFilename as a fallback.
12
+ *
13
+ * Loaded via --require before tsx.
4
14
  */
15
+ if (!global.__bunBundleHookInstalled) {
16
+ global.__bunBundleHookInstalled = true;
5
17
 
6
- const Module = require('module');
7
- const path = require('path');
18
+ const Module = require('module');
8
19
 
9
- const originalResolveFilename = Module._resolveFilename;
20
+ // Use a sentinel that looks like an absolute path so tsx / Node accept it.
21
+ // It never needs to exist on disk because we pre-populate the cache.
22
+ const SENTINEL = '\0bun:bundle';
10
23
 
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;
24
+ // feature() shim: in Node.js all DCE gates are off by default.
25
+ // Override via CLAUDE_CODE_FEATURE_<NAME>=1 if needed.
26
+ function feature(name) {
27
+ const key = 'CLAUDE_CODE_FEATURE_' + String(name).replace(/[^A-Za-z0-9]/g, '_').toUpperCase();
28
+ const v = process.env[key];
29
+ return v === '1' || v === 'true';
20
30
  }
21
31
 
22
- return originalResolveFilename.call(this, request, parent, isMain, options);
23
- };
32
+ // Populate the module cache before tsx can intercept _load
33
+ const shimModule = new Module(SENTINEL, null);
34
+ shimModule.id = SENTINEL;
35
+ shimModule.filename = SENTINEL;
36
+ shimModule.loaded = true;
37
+ shimModule.exports = { feature };
38
+ Module._cache[SENTINEL] = shimModule;
24
39
 
25
- console.log('[XCode] Bun compatibility hook loaded');
40
+ // Intercept _resolveFilename so 'bun:bundle' maps to our sentinel
41
+ const originalResolve = Module._resolveFilename;
42
+ Module._resolveFilename = function (request, parent, isMain, options) {
43
+ if (request === 'bun:bundle') return SENTINEL;
44
+ return originalResolve.call(this, request, parent, isMain, options);
45
+ };
46
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Shim for Bun's `bun:bundle` module, used in Node.js via tsx path aliases.
3
+ * Provides a no-op `feature()` function since all Bun DCE gates default to false
4
+ * in Node.js (the guarded code blocks have their own Node.js fallbacks).
5
+ */
6
+
7
+ export function feature(name: string): boolean {
8
+ // Allow opt-in via env var if ever needed
9
+ const key = `CLAUDE_CODE_FEATURE_${String(name).replace(/[^A-Za-z0-9]/g, '_').toUpperCase()}`;
10
+ const v = process.env[key];
11
+ return v === '1' || v === 'true';
12
+ }