mirror of
https://github.com/jlengrand/Maestro.git
synced 2026-03-10 15:51:18 +00:00
- Add scripts/set-version.mjs for cross-platform VITE_APP_VERSION setting
(replaces bash-specific env var syntax that failed on Windows)
- Extract magic numbers into CLAUDE_SESSION_PARSE_LIMITS and CLAUDE_PRICING
constants for better maintainability
- Remove legacy session format migration code - sessions now require aiTabs
- Fix session ID regex patterns to properly parse -ai-{tabId} format
- Remove deprecated aiLogs fallbacks - logs are exclusively in aiTabs now
Claude ID: bfd92ffb-a375-47be-94c5-fe4186325092
Maestro ID: b9bc0d08-5be2-4fdf-93cd-5618a8d53b35
57 lines
1.3 KiB
JavaScript
57 lines
1.3 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Cross-platform script to set VITE_APP_VERSION environment variable
|
|
* with the local git hash. Works on Windows, macOS, and Linux.
|
|
*
|
|
* Usage: node scripts/set-version.mjs <command> [args...]
|
|
* Example: node scripts/set-version.mjs npm run build
|
|
*/
|
|
|
|
import { execFileSync, spawn } from 'child_process';
|
|
import process from 'process';
|
|
|
|
function getGitHash() {
|
|
try {
|
|
const hash = execFileSync('git', ['rev-parse', '--short=8', 'HEAD'], {
|
|
encoding: 'utf8',
|
|
stdio: ['pipe', 'pipe', 'pipe']
|
|
}).trim();
|
|
return hash;
|
|
} catch {
|
|
return 'unknown';
|
|
}
|
|
}
|
|
|
|
const gitHash = getGitHash();
|
|
const version = `LOCAL ${gitHash}`;
|
|
|
|
// Set environment variable
|
|
process.env.VITE_APP_VERSION = version;
|
|
|
|
// Get the command and args to run
|
|
const [,, ...args] = process.argv;
|
|
|
|
if (args.length === 0) {
|
|
console.log(`VITE_APP_VERSION=${version}`);
|
|
process.exit(0);
|
|
}
|
|
|
|
// Run the command with the environment variable set
|
|
const command = args[0];
|
|
const commandArgs = args.slice(1);
|
|
|
|
const child = spawn(command, commandArgs, {
|
|
stdio: 'inherit',
|
|
shell: true,
|
|
env: { ...process.env, VITE_APP_VERSION: version }
|
|
});
|
|
|
|
child.on('close', (code) => {
|
|
process.exit(code ?? 0);
|
|
});
|
|
|
|
child.on('error', (err) => {
|
|
console.error(`Failed to run command: ${err.message}`);
|
|
process.exit(1);
|
|
});
|