refactor: align macro bootstrap with cli entry
This commit is contained in:
@@ -1,16 +1,24 @@
|
|||||||
import { feature } from 'bun:bundle';
|
import { feature } from 'bun:bundle';
|
||||||
|
|
||||||
const CLI_MACRO =
|
// Define MACRO global for development (normally injected by bun build --define)
|
||||||
typeof MACRO !== 'undefined'
|
if (typeof MACRO === 'undefined') {
|
||||||
? MACRO
|
(globalThis as typeof globalThis & {
|
||||||
: {
|
MACRO: {
|
||||||
VERSION: 'dev',
|
VERSION: string
|
||||||
BUILD_TIME: '',
|
BUILD_TIME: string
|
||||||
PACKAGE_URL: '@anthropic-ai/claude-code',
|
PACKAGE_URL: string
|
||||||
|
ISSUES_EXPLAINER: string
|
||||||
|
FEEDBACK_CHANNEL: string
|
||||||
|
}
|
||||||
|
}).MACRO = {
|
||||||
|
VERSION: '2.1.88-dev',
|
||||||
|
BUILD_TIME: new Date().toISOString(),
|
||||||
|
PACKAGE_URL: 'claude-code-recover',
|
||||||
ISSUES_EXPLAINER:
|
ISSUES_EXPLAINER:
|
||||||
'https://docs.anthropic.com/en/docs/claude-code/feedback',
|
'https://docs.anthropic.com/en/docs/claude-code/feedback',
|
||||||
FEEDBACK_CHANNEL: 'github',
|
FEEDBACK_CHANNEL: 'github',
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Bugfix for corepack auto-pinning, which adds yarnpkg to peoples' package.jsons
|
// Bugfix for corepack auto-pinning, which adds yarnpkg to peoples' package.jsons
|
||||||
// eslint-disable-next-line custom-rules/no-top-level-side-effects
|
// eslint-disable-next-line custom-rules/no-top-level-side-effects
|
||||||
@@ -49,7 +57,7 @@ async function main(): Promise<void> {
|
|||||||
if (args.length === 1 && (args[0] === '--version' || args[0] === '-v' || args[0] === '-V')) {
|
if (args.length === 1 && (args[0] === '--version' || args[0] === '-v' || args[0] === '-V')) {
|
||||||
// MACRO.VERSION is inlined at build time
|
// MACRO.VERSION is inlined at build time
|
||||||
// biome-ignore lint/suspicious/noConsole:: intentional console output
|
// biome-ignore lint/suspicious/noConsole:: intentional console output
|
||||||
console.log(`${CLI_MACRO.VERSION} (Claude Code)`);
|
console.log(`${MACRO.VERSION} (Claude Code)`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
14
src/main.tsx
14
src/main.tsx
@@ -65,18 +65,6 @@ import { computeInitialTeamContext } from './utils/swarm/reconnection.js';
|
|||||||
import { initializeWarningHandler } from './utils/warningHandler.js';
|
import { initializeWarningHandler } from './utils/warningHandler.js';
|
||||||
import { isWorktreeModeEnabled } from './utils/worktreeModeEnabled.js';
|
import { isWorktreeModeEnabled } from './utils/worktreeModeEnabled.js';
|
||||||
|
|
||||||
const MAIN_MACRO =
|
|
||||||
typeof MACRO !== 'undefined'
|
|
||||||
? MACRO
|
|
||||||
: {
|
|
||||||
VERSION: 'dev',
|
|
||||||
BUILD_TIME: '',
|
|
||||||
PACKAGE_URL: '@anthropic-ai/claude-code',
|
|
||||||
ISSUES_EXPLAINER:
|
|
||||||
'https://docs.anthropic.com/en/docs/claude-code/feedback',
|
|
||||||
FEEDBACK_CHANNEL: 'github',
|
|
||||||
};
|
|
||||||
|
|
||||||
// Lazy require to avoid circular dependency: teammate.ts -> AppState.tsx -> ... -> main.tsx
|
// Lazy require to avoid circular dependency: teammate.ts -> AppState.tsx -> ... -> main.tsx
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
const getTeammateUtils = () => require('./utils/teammate.js') as typeof import('./utils/teammate.js');
|
const getTeammateUtils = () => require('./utils/teammate.js') as typeof import('./utils/teammate.js');
|
||||||
@@ -3817,7 +3805,7 @@ async function run(): Promise<CommanderCommand> {
|
|||||||
pendingHookMessages
|
pendingHookMessages
|
||||||
}, renderAndRun);
|
}, renderAndRun);
|
||||||
}
|
}
|
||||||
}).version(`${MAIN_MACRO.VERSION} (Claude Code)`, '-v, --version', 'Output the version number');
|
}).version(`${MACRO.VERSION} (Claude Code)`, '-v, --version', 'Output the version number');
|
||||||
|
|
||||||
// Worktree flags
|
// Worktree flags
|
||||||
program.option('-w, --worktree [name]', 'Create a new git worktree for this session (optionally specify a name)');
|
program.option('-w, --worktree [name]', 'Create a new git worktree for this session (optionally specify a name)');
|
||||||
|
|||||||
Reference in New Issue
Block a user