@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.
- package/INSTALLATION.md +285 -0
- package/QUICKSTART.md +151 -0
- package/SYSTEM_PROMPT.md +583 -0
- package/SYSTEM_PROMPT_EXTRACTED.md +1 -0
- package/Untitled +1 -0
- package/bin/xcode +69 -120
- package/bootstrap/state.ts +1758 -0
- package/bun-bundle-hook.js +38 -17
- package/bun-bundle-shim.ts +12 -0
- package/bun.lock +645 -0
- package/context/QueuedMessageContext.tsx +63 -0
- package/context/fpsMetrics.tsx +30 -0
- package/context/mailbox.tsx +38 -0
- package/context/modalContext.tsx +58 -0
- package/context/notifications.tsx +240 -0
- package/context/overlayContext.tsx +151 -0
- package/context/promptOverlayContext.tsx +125 -0
- package/context/stats.tsx +220 -0
- package/context/voice.tsx +88 -0
- package/coordinator/coordinatorMode.ts +369 -0
- package/costHook.ts +22 -0
- package/dialogLaunchers.tsx +133 -0
- package/entrypoints/cli.tsx +1 -1
- package/extract_prompt.ts +304 -0
- package/ink.ts +85 -0
- package/install.sh +221 -0
- package/interactiveHelpers.tsx +366 -0
- package/macro.ts +1 -1
- package/memdir/findRelevantMemories.ts +141 -0
- package/memdir/memdir.ts +511 -0
- package/memdir/memoryAge.ts +53 -0
- package/memdir/memoryScan.ts +94 -0
- package/memdir/memoryTypes.ts +271 -0
- package/memdir/paths.ts +291 -0
- package/memdir/teamMemPaths.ts +292 -0
- package/memdir/teamMemPrompts.ts +100 -0
- package/moreright/useMoreRight.tsx +26 -0
- package/native-ts/color-diff/index.ts +999 -0
- package/native-ts/file-index/index.ts +370 -0
- package/native-ts/yoga-layout/enums.ts +134 -0
- package/native-ts/yoga-layout/index.ts +2578 -0
- package/outputStyles/loadOutputStylesDir.ts +98 -0
- package/package.json +5 -42
- package/plugins/builtinPlugins.ts +159 -0
- package/plugins/bundled/index.ts +23 -0
- package/projectOnboardingState.ts +83 -0
- package/public/claude-files.png +0 -0
- package/public/leak-tweet.png +0 -0
- package/query/config.ts +46 -0
- package/query/deps.ts +40 -0
- package/query/stopHooks.ts +470 -0
- package/query/tokenBudget.ts +93 -0
- package/replLauncher.tsx +27 -0
- package/schemas/hooks.ts +222 -0
- package/screens/Doctor.tsx +575 -0
- package/screens/REPL.tsx +7107 -0
- package/screens/ResumeConversation.tsx +399 -0
- package/scripts/postinstall.js +90 -0
- package/server/createDirectConnectSession.ts +88 -0
- package/server/directConnectManager.ts +213 -0
- package/server/types.ts +57 -0
- package/setup.ts +477 -0
- package/stub_types.sh +13 -0
- package/tasks.ts +39 -0
- package/tools.ts +396 -0
- package/tsconfig.json +16 -0
- package/upstreamproxy/relay.ts +455 -0
- package/upstreamproxy/upstreamproxy.ts +285 -0
- package/vim/motions.ts +82 -0
- package/vim/operators.ts +556 -0
- package/vim/textObjects.ts +186 -0
- package/vim/transitions.ts +490 -0
- package/vim/types.ts +199 -0
- package/voice/voiceModeEnabled.ts +54 -0
- package/utils/bunBundleCompat.ts +0 -44
package/bin/xcode
CHANGED
|
@@ -1,164 +1,113 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* XCode CLI Entry Point
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Installed via: npm install -g @xortex/xcode
|
|
5
|
+
*
|
|
6
|
+
* Bun is installed as part of npm postinstall.
|
|
7
|
+
* This launcher finds Bun and runs the app with it.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
const { execSync } = require('child_process');
|
|
10
11
|
const { spawn } = require('child_process');
|
|
11
12
|
const path = require('path');
|
|
12
13
|
const fs = require('fs');
|
|
14
|
+
const os = require('os');
|
|
13
15
|
|
|
14
|
-
// Get the project root (where this script is located)
|
|
15
16
|
const projectRoot = path.resolve(__dirname, '..');
|
|
16
17
|
const mainScript = path.join(projectRoot, 'entrypoints', 'cli.tsx');
|
|
17
|
-
const bunBundleHook = path.join(projectRoot, 'bun-bundle-hook.js');
|
|
18
18
|
|
|
19
|
-
//
|
|
20
|
-
|
|
19
|
+
// ── find Bun ──────────────────────────────────────────────────────────────────
|
|
20
|
+
|
|
21
|
+
function findBun() {
|
|
22
|
+
// 1. Check PATH
|
|
21
23
|
try {
|
|
22
|
-
|
|
23
|
-
return
|
|
24
|
-
} catch {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
24
|
+
const p = execSync('which bun', { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
|
|
25
|
+
if (p && fs.existsSync(p)) return p;
|
|
26
|
+
} catch {}
|
|
27
|
+
|
|
28
|
+
// 2. Common install locations
|
|
29
|
+
const candidates = [
|
|
30
|
+
path.join(os.homedir(), '.bun', 'bin', 'bun'),
|
|
31
|
+
'/usr/local/bin/bun',
|
|
32
|
+
'/usr/bin/bun',
|
|
33
|
+
'C:\\Users\\' + (process.env.USERNAME || '') + '\\.bun\\bin\\bun.exe',
|
|
34
|
+
];
|
|
35
|
+
for (const c of candidates) {
|
|
36
|
+
if (fs.existsSync(c)) return c;
|
|
37
37
|
}
|
|
38
|
+
return null;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
//
|
|
41
|
+
// ── CLI flags ─────────────────────────────────────────────────────────────────
|
|
42
|
+
|
|
41
43
|
process.env.XCODE_CLI = 'true';
|
|
42
44
|
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
|
|
43
45
|
|
|
44
|
-
// Handle special commands
|
|
45
46
|
const args = process.argv.slice(2);
|
|
46
|
-
const command = args[0];
|
|
47
47
|
|
|
48
|
-
if (
|
|
49
|
-
console.log('xcode v3.0
|
|
48
|
+
if (args[0] === '--version' || args[0] === '-v' || args[0] === '-V') {
|
|
49
|
+
console.log('xcode v3.1.0 — AI coding assistant with XMem memory');
|
|
50
50
|
process.exit(0);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
if (
|
|
53
|
+
if (args[0] === '--help' || args[0] === '-h') {
|
|
54
54
|
console.log(`
|
|
55
55
|
XCode - AI-powered coding assistant with XMem memory
|
|
56
56
|
|
|
57
|
-
Usage: xcode [options]
|
|
57
|
+
Usage: xcode [options]
|
|
58
58
|
|
|
59
59
|
Options:
|
|
60
|
-
-v, --version
|
|
61
|
-
-h, --help
|
|
62
|
-
--model <
|
|
60
|
+
-v, --version Show version
|
|
61
|
+
-h, --help Show help
|
|
62
|
+
--model <name> Model: gemini-2.5-pro, kimi-k2.5, deepseek-v3.2, sonnet, opus
|
|
63
|
+
--openrouter Use OpenRouter provider
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
(none) Start interactive session
|
|
66
|
-
|
|
67
|
-
Environment Variables:
|
|
68
|
-
OPENROUTER_API_KEY OpenRouter API key (optional, has default)
|
|
69
|
-
XMEM_API_URL XMem memory server URL (default: http://localhost:8000)
|
|
65
|
+
Environment:
|
|
70
66
|
ANTHROPIC_API_KEY Anthropic API key (for Claude models)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
xcode # Start with default model
|
|
74
|
-
xcode --model gemini-2.5-pro # Use Gemini via OpenRouter
|
|
75
|
-
xcode --model kimi-k2.5 # Use Kimi via OpenRouter
|
|
67
|
+
OPENROUTER_API_KEY OpenRouter API key (optional, default provided)
|
|
68
|
+
XMEM_API_URL XMem memory server URL (default: http://localhost:8000)
|
|
76
69
|
`);
|
|
77
70
|
process.exit(0);
|
|
78
71
|
}
|
|
79
72
|
|
|
80
|
-
//
|
|
81
|
-
const
|
|
82
|
-
if (
|
|
83
|
-
const model = args[
|
|
73
|
+
// Model / provider flags
|
|
74
|
+
const modelIdx = args.indexOf('--model');
|
|
75
|
+
if (modelIdx !== -1 && args[modelIdx + 1]) {
|
|
76
|
+
const model = args[modelIdx + 1];
|
|
84
77
|
process.env.ANTHROPIC_MODEL = model;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const openRouterModels = ['kimi', 'deepseek', 'gemini', 'moonshot', 'google/gemini'];
|
|
88
|
-
if (openRouterModels.some(m => model.toLowerCase().includes(m.toLowerCase()))) {
|
|
78
|
+
const orModels = ['kimi', 'deepseek', 'gemini', 'moonshot', 'google/'];
|
|
79
|
+
if (orModels.some(m => model.toLowerCase().includes(m))) {
|
|
89
80
|
process.env.CLAUDE_CODE_USE_OPENROUTER = 'true';
|
|
90
81
|
}
|
|
91
82
|
}
|
|
92
|
-
|
|
93
|
-
// Check for explicit OpenRouter flag
|
|
94
83
|
if (args.includes('--openrouter')) {
|
|
95
84
|
process.env.CLAUDE_CODE_USE_OPENROUTER = 'true';
|
|
96
85
|
}
|
|
97
86
|
|
|
98
|
-
//
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
} else {
|
|
113
|
-
// Use Node with ts-node or tsx
|
|
114
|
-
// First check if tsx is installed globally or locally
|
|
115
|
-
let tsxPath;
|
|
116
|
-
try {
|
|
117
|
-
// Try local tsx first
|
|
118
|
-
tsxPath = require.resolve('tsx/dist/cli.mjs', { paths: [projectRoot] });
|
|
119
|
-
} catch {
|
|
120
|
-
try {
|
|
121
|
-
// Try global tsx
|
|
122
|
-
tsxPath = require.resolve('tsx/dist/cli.mjs');
|
|
123
|
-
} catch {
|
|
124
|
-
// Fallback to npx tsx
|
|
125
|
-
tsxPath = null;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
let child;
|
|
130
|
-
const hasHook = fs.existsSync(bunBundleHook);
|
|
131
|
-
|
|
132
|
-
if (tsxPath) {
|
|
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], {
|
|
136
|
-
cwd: projectRoot,
|
|
137
|
-
stdio: 'inherit',
|
|
138
|
-
env: process.env,
|
|
139
|
-
});
|
|
140
|
-
} else {
|
|
141
|
-
// Fallback to npx
|
|
142
|
-
const npxArgs = hasHook ? ['--node-options', `--require ${bunBundleHook}`, 'tsx'] : ['tsx'];
|
|
143
|
-
child = spawn('npx', [...npxArgs, mainScript, ...args], {
|
|
144
|
-
cwd: projectRoot,
|
|
145
|
-
stdio: 'inherit',
|
|
146
|
-
env: process.env,
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
child.on('exit', (code) => {
|
|
151
|
-
process.exit(code || 0);
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
child.on('error', (err) => {
|
|
155
|
-
console.error('❌ Failed to start XCode:', err.message);
|
|
156
|
-
console.error('');
|
|
157
|
-
console.error('Please ensure tsx is installed:');
|
|
158
|
-
console.error(' npm install -g tsx');
|
|
159
|
-
console.error('');
|
|
160
|
-
console.error('Or use Bun instead:');
|
|
161
|
-
console.error(' curl -fsSL https://bun.sh/install | bash');
|
|
162
|
-
process.exit(1);
|
|
163
|
-
});
|
|
87
|
+
// ── launch with Bun ───────────────────────────────────────────────────────────
|
|
88
|
+
|
|
89
|
+
const bun = findBun();
|
|
90
|
+
|
|
91
|
+
if (!bun) {
|
|
92
|
+
console.error('');
|
|
93
|
+
console.error('❌ Bun runtime not found.');
|
|
94
|
+
console.error('');
|
|
95
|
+
console.error(' Please install Bun and try again:');
|
|
96
|
+
console.error(' curl -fsSL https://bun.sh/install | bash');
|
|
97
|
+
console.error('');
|
|
98
|
+
console.error(' Then restart your terminal and run: xcode');
|
|
99
|
+
console.error('');
|
|
100
|
+
process.exit(1);
|
|
164
101
|
}
|
|
102
|
+
|
|
103
|
+
const child = spawn(bun, ['run', mainScript, ...args], {
|
|
104
|
+
cwd: projectRoot,
|
|
105
|
+
stdio: 'inherit',
|
|
106
|
+
env: process.env,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
child.on('exit', code => process.exit(code ?? 0));
|
|
110
|
+
child.on('error', err => {
|
|
111
|
+
console.error('\n❌ Failed to start XCode:', err.message);
|
|
112
|
+
process.exit(1);
|
|
113
|
+
});
|