Merge pull request #1233 from eyaltoledano/ralph/chore/fix.ci.failure.main
This commit is contained in:
7
.changeset/loose-poems-tickle.md
Normal file
7
.changeset/loose-poems-tickle.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"task-master-ai": patch
|
||||
---
|
||||
|
||||
Fix Zed MCP configuration by adding required "source" property
|
||||
|
||||
- Add "source": "custom" property to task-master-ai server in Zed settings.json
|
||||
13
.changeset/pre.json
Normal file
13
.changeset/pre.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"mode": "exit",
|
||||
"tag": "rc",
|
||||
"initialVersions": {
|
||||
"task-master-ai": "0.27.0",
|
||||
"docs": "0.0.3",
|
||||
"extension": "0.25.1"
|
||||
},
|
||||
"changesets": [
|
||||
"fluffy-clocks-cross",
|
||||
"soft-dingos-grow"
|
||||
]
|
||||
}
|
||||
5
.changeset/soft-dingos-grow.md
Normal file
5
.changeset/soft-dingos-grow.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"task-master-ai": patch
|
||||
---
|
||||
|
||||
One last testing final final
|
||||
12
CHANGELOG.md
12
CHANGELOG.md
@@ -1,5 +1,17 @@
|
||||
# task-master-ai
|
||||
|
||||
## 0.27.1-rc.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1233](https://github.com/eyaltoledano/claude-task-master/pull/1233) [`1a18794`](https://github.com/eyaltoledano/claude-task-master/commit/1a1879483b86c118a4e46c02cbf4acebfcf6bcf9) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - One last testing final final
|
||||
|
||||
## 0.27.1-rc.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1232](https://github.com/eyaltoledano/claude-task-master/pull/1232) [`f487736`](https://github.com/eyaltoledano/claude-task-master/commit/f487736670ef8c484059f676293777eabb249c9e) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Fix module not found for new 0.27.0 release
|
||||
|
||||
## 0.27.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -18,7 +18,8 @@ export * as ui from './utils/ui.js';
|
||||
export {
|
||||
checkForUpdate,
|
||||
performAutoUpdate,
|
||||
displayUpgradeNotification
|
||||
displayUpgradeNotification,
|
||||
compareVersions
|
||||
} from './utils/auto-update.js';
|
||||
|
||||
// Re-export commonly used types from tm-core
|
||||
|
||||
@@ -7,7 +7,6 @@ import https from 'https';
|
||||
import chalk from 'chalk';
|
||||
import ora from 'ora';
|
||||
import boxen from 'boxen';
|
||||
import packageJson from '../../../../package.json' with { type: 'json' };
|
||||
|
||||
export interface UpdateInfo {
|
||||
currentVersion: string;
|
||||
@@ -16,15 +15,18 @@ export interface UpdateInfo {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current version from package.json
|
||||
* Get current version from build-time injected environment variable
|
||||
*/
|
||||
function getCurrentVersion(): string {
|
||||
try {
|
||||
return packageJson.version;
|
||||
} catch (error) {
|
||||
console.warn('Could not read package.json for version info');
|
||||
return '0.0.0';
|
||||
// Version is injected at build time via TM_PUBLIC_VERSION
|
||||
const version = process.env.TM_PUBLIC_VERSION;
|
||||
if (version && version !== 'unknown') {
|
||||
return version;
|
||||
}
|
||||
|
||||
// Fallback for development or if injection failed
|
||||
console.warn('Could not read version from TM_PUBLIC_VERSION, using fallback');
|
||||
return '0.0.0';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,7 +35,7 @@ function getCurrentVersion(): string {
|
||||
* @param v2 - Second version
|
||||
* @returns -1 if v1 < v2, 0 if v1 = v2, 1 if v1 > v2
|
||||
*/
|
||||
function compareVersions(v1: string, v2: string): number {
|
||||
export function compareVersions(v1: string, v2: string): number {
|
||||
const toParts = (v: string) => {
|
||||
const [core, pre = ''] = v.split('-', 2);
|
||||
const nums = core.split('.').map((n) => Number.parseInt(n, 10) || 0);
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# Change Log
|
||||
|
||||
## 0.25.2-rc.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`1a18794`](https://github.com/eyaltoledano/claude-task-master/commit/1a1879483b86c118a4e46c02cbf4acebfcf6bcf9)]:
|
||||
- task-master-ai@0.27.1-rc.1
|
||||
|
||||
## 0.25.2-rc.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`f487736`](https://github.com/eyaltoledano/claude-task-master/commit/f487736670ef8c484059f676293777eabb249c9e)]:
|
||||
- task-master-ai@0.27.1-rc.0
|
||||
|
||||
## 0.25.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"private": true,
|
||||
"displayName": "TaskMaster",
|
||||
"description": "A visual Kanban board interface for TaskMaster projects in VS Code",
|
||||
"version": "0.25.1",
|
||||
"version": "0.25.2-rc.1",
|
||||
"publisher": "Hamster",
|
||||
"icon": "assets/icon.png",
|
||||
"engines": {
|
||||
@@ -240,7 +240,7 @@
|
||||
"check-types": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"task-master-ai": "*"
|
||||
"task-master-ai": "0.27.1-rc.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
|
||||
53
package-lock.json
generated
53
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "task-master-ai",
|
||||
"version": "0.27.0",
|
||||
"version": "0.27.1-rc.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "task-master-ai",
|
||||
"version": "0.27.0",
|
||||
"version": "0.27.1-rc.0",
|
||||
"license": "MIT WITH Commons-Clause",
|
||||
"workspaces": [
|
||||
"apps/*",
|
||||
@@ -29,7 +29,7 @@
|
||||
"@inquirer/search": "^3.0.15",
|
||||
"@openrouter/ai-sdk-provider": "^0.4.5",
|
||||
"@streamparser/json": "^0.0.22",
|
||||
"@supabase/supabase-js": "^2.48.0",
|
||||
"@supabase/supabase-js": "^2.57.4",
|
||||
"ai": "^4.3.10",
|
||||
"ajv": "^8.17.1",
|
||||
"ajv-formats": "^3.0.1",
|
||||
@@ -38,7 +38,7 @@
|
||||
"cli-highlight": "^2.1.11",
|
||||
"cli-progress": "^3.12.0",
|
||||
"cli-table3": "^0.6.5",
|
||||
"commander": "^11.1.0",
|
||||
"commander": "^12.1.0",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.3.1",
|
||||
"express": "^4.21.2",
|
||||
@@ -86,9 +86,9 @@
|
||||
"supertest": "^7.1.0",
|
||||
"ts-jest": "^29.4.2",
|
||||
"tsdown": "^0.15.2",
|
||||
"tsx": "^4.16.2",
|
||||
"tsx": "^4.20.4",
|
||||
"turbo": "^2.5.6",
|
||||
"typescript": "^5.9.2"
|
||||
"typescript": "^5.7.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
@@ -104,12 +104,12 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@tm/core": "*",
|
||||
"boxen": "^7.1.1",
|
||||
"boxen": "^8.0.1",
|
||||
"chalk": "5.6.2",
|
||||
"cli-table3": "^0.6.5",
|
||||
"commander": "^12.1.0",
|
||||
"inquirer": "^9.2.10",
|
||||
"ora": "^8.1.0"
|
||||
"inquirer": "^12.5.0",
|
||||
"ora": "^8.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^1.9.4",
|
||||
@@ -190,15 +190,6 @@
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"apps/cli/node_modules/commander": {
|
||||
"version": "12.1.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz",
|
||||
"integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"apps/cli/node_modules/emoji-regex": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||
@@ -366,9 +357,9 @@
|
||||
}
|
||||
},
|
||||
"apps/extension": {
|
||||
"version": "0.25.1",
|
||||
"version": "0.25.2-rc.0",
|
||||
"dependencies": {
|
||||
"task-master-ai": "*"
|
||||
"task-master-ai": "0.27.1-rc.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
@@ -384,7 +375,7 @@
|
||||
"@tailwindcss/postcss": "^4.1.11",
|
||||
"@tanstack/react-query": "^5.83.0",
|
||||
"@types/mocha": "^10.0.10",
|
||||
"@types/node": "20.x",
|
||||
"@types/node": "^22.10.5",
|
||||
"@types/react": "19.1.8",
|
||||
"@types/react-dom": "19.1.6",
|
||||
"@types/vscode": "^1.101.0",
|
||||
@@ -404,7 +395,7 @@
|
||||
"react-dom": "^19.0.0",
|
||||
"tailwind-merge": "^3.3.1",
|
||||
"tailwindcss": "4.1.11",
|
||||
"typescript": "^5.8.3"
|
||||
"typescript": "^5.7.3"
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "^1.93.0"
|
||||
@@ -14313,12 +14304,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "11.1.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz",
|
||||
"integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==",
|
||||
"version": "12.1.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz",
|
||||
"integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/component-emitter": {
|
||||
@@ -32178,18 +32169,18 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@supabase/supabase-js": "^2.57.4",
|
||||
"zod": "^3.22.4"
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^1.9.4",
|
||||
"@tm/build-config": "*",
|
||||
"@types/node": "^20.11.30",
|
||||
"@types/node": "^22.10.5",
|
||||
"@vitest/coverage-v8": "^2.0.5",
|
||||
"dotenv-mono": "^1.3.14",
|
||||
"dotenv-mono": "^1.5.1",
|
||||
"ts-node": "^10.9.2",
|
||||
"tsup": "^8.5.0",
|
||||
"typescript": "^5.4.3",
|
||||
"vitest": "^2.0.5"
|
||||
"typescript": "^5.7.3",
|
||||
"vitest": "^2.1.8"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "task-master-ai",
|
||||
"version": "0.27.0",
|
||||
"version": "0.27.1-rc.1",
|
||||
"description": "A task management system for ambitious AI-driven development that doesn't overwhelm and confuse Cursor.",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import readline from 'readline';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { dirname } from 'path';
|
||||
import chalk from 'chalk';
|
||||
import figlet from 'figlet';
|
||||
import boxen from 'boxen';
|
||||
@@ -49,9 +47,6 @@ import {
|
||||
GITIGNORE_FILE
|
||||
} from '../src/constants/paths.js';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
// Define log levels
|
||||
const LOG_LEVELS = {
|
||||
debug: 0,
|
||||
@@ -619,13 +614,7 @@ function createProjectStructure(
|
||||
|
||||
// Copy .gitignore with GitTasks preference
|
||||
try {
|
||||
const gitignoreTemplatePath = path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'assets',
|
||||
'gitignore'
|
||||
);
|
||||
const templateContent = fs.readFileSync(gitignoreTemplatePath, 'utf8');
|
||||
const templateContent = readAsset('gitignore', 'utf8');
|
||||
manageGitignoreFile(
|
||||
path.join(targetDir, GITIGNORE_FILE),
|
||||
templateContent,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Command-line interface for the Task Master CLI
|
||||
*/
|
||||
|
||||
import { program } from 'commander';
|
||||
import { Command } from 'commander';
|
||||
import path from 'path';
|
||||
import chalk from 'chalk';
|
||||
import boxen from 'boxen';
|
||||
@@ -5076,28 +5076,10 @@ Examples:
|
||||
*/
|
||||
function setupCLI() {
|
||||
// Create a new program instance
|
||||
const programInstance = program
|
||||
.name('dev')
|
||||
const programInstance = new Command()
|
||||
.name('task-master')
|
||||
.description('AI-driven development task management')
|
||||
.version(() => {
|
||||
// Read version directly from package.json ONLY
|
||||
try {
|
||||
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
||||
if (fs.existsSync(packageJsonPath)) {
|
||||
const packageJson = JSON.parse(
|
||||
fs.readFileSync(packageJsonPath, 'utf8')
|
||||
);
|
||||
return packageJson.version;
|
||||
}
|
||||
} catch (error) {
|
||||
// Silently fall back to 'unknown'
|
||||
log(
|
||||
'warn',
|
||||
'Could not read package.json for version info in .version()'
|
||||
);
|
||||
}
|
||||
return 'unknown'; // Default fallback if package.json fails
|
||||
})
|
||||
.version(process.env.TM_PUBLIC_VERSION || 'unknown')
|
||||
.helpOption('-h, --help', 'Display help')
|
||||
.addHelpCommand(false); // Disable default help command
|
||||
|
||||
@@ -5126,8 +5108,9 @@ function setupCLI() {
|
||||
*/
|
||||
async function runCLI(argv = process.argv) {
|
||||
try {
|
||||
// Display banner if not in a pipe
|
||||
if (process.stdout.isTTY) {
|
||||
// Display banner if not in a pipe (except for init command which has its own banner)
|
||||
const isInitCommand = argv.includes('init');
|
||||
if (process.stdout.isTTY && !isInitCommand) {
|
||||
displayBanner();
|
||||
}
|
||||
|
||||
|
||||
@@ -142,6 +142,14 @@ function onPostConvertRulesProfile(targetDir, assetsDir) {
|
||||
// Transform to Zed format
|
||||
const zedConfig = transformToZedFormat(mcpConfig);
|
||||
|
||||
// Add "source": "custom" to task-master-ai server for Zed
|
||||
if (
|
||||
zedConfig['context_servers'] &&
|
||||
zedConfig['context_servers']['task-master-ai']
|
||||
) {
|
||||
zedConfig['context_servers']['task-master-ai'].source = 'custom';
|
||||
}
|
||||
|
||||
// Write back the transformed config with proper formatting
|
||||
fs.writeFileSync(
|
||||
mcpConfigPath,
|
||||
|
||||
@@ -463,6 +463,17 @@ export function findConfigPath(explicitPath = null, args = null, log = null) {
|
||||
}
|
||||
}
|
||||
|
||||
logger.warn?.(`No configuration file found in project: ${projectRoot}`);
|
||||
// Only warn once per command execution to prevent spam during init
|
||||
const warningKey = `config_warning_${projectRoot}`;
|
||||
|
||||
if (!global._tmConfigWarningsThisRun) {
|
||||
global._tmConfigWarningsThisRun = new Set();
|
||||
}
|
||||
|
||||
if (!global._tmConfigWarningsThisRun.has(warningKey)) {
|
||||
global._tmConfigWarningsThisRun.add(warningKey);
|
||||
logger.warn?.(`No configuration file found in project: ${projectRoot}`);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -100,17 +100,13 @@ describe('Roo Files Inclusion in Package', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('source Roo files exist in public/assets directory', () => {
|
||||
test('source Roo files exist in assets directory', () => {
|
||||
// Verify that the source files for Roo integration exist
|
||||
expect(
|
||||
fs.existsSync(
|
||||
path.join(process.cwd(), 'public', 'assets', 'roocode', '.roo')
|
||||
)
|
||||
fs.existsSync(path.join(process.cwd(), 'assets', 'roocode', '.roo'))
|
||||
).toBe(true);
|
||||
expect(
|
||||
fs.existsSync(
|
||||
path.join(process.cwd(), 'public', 'assets', 'roocode', '.roomodes')
|
||||
)
|
||||
fs.existsSync(path.join(process.cwd(), 'assets', 'roocode', '.roomodes'))
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -16,9 +16,9 @@ describe('Rules Files Inclusion in Package', () => {
|
||||
expect(packageJson.files).toContain('dist/**');
|
||||
});
|
||||
|
||||
test('source rules files exist in public/assets/rules directory', () => {
|
||||
test('source rules files exist in assets/rules directory', () => {
|
||||
// Verify that the actual rules files exist
|
||||
const rulesDir = path.join(process.cwd(), 'public', 'assets', 'rules');
|
||||
const rulesDir = path.join(process.cwd(), 'assets', 'rules');
|
||||
expect(fs.existsSync(rulesDir)).toBe(true);
|
||||
|
||||
// Check for the 4 files that currently exist
|
||||
@@ -86,17 +86,13 @@ describe('Rules Files Inclusion in Package', () => {
|
||||
expect(rooJsContent.includes('${mode}-rules')).toBe(true);
|
||||
});
|
||||
|
||||
test('source Roo files exist in public/assets directory', () => {
|
||||
test('source Roo files exist in assets directory', () => {
|
||||
// Verify that the source files for Roo integration exist
|
||||
expect(
|
||||
fs.existsSync(
|
||||
path.join(process.cwd(), 'public', 'assets', 'roocode', '.roo')
|
||||
)
|
||||
fs.existsSync(path.join(process.cwd(), 'assets', 'roocode', '.roo'))
|
||||
).toBe(true);
|
||||
expect(
|
||||
fs.existsSync(
|
||||
path.join(process.cwd(), 'public', 'assets', 'roocode', '.roomodes')
|
||||
)
|
||||
fs.existsSync(path.join(process.cwd(), 'assets', 'roocode', '.roomodes'))
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -96,11 +96,10 @@ import {
|
||||
RULES_SETUP_ACTION,
|
||||
RULES_ACTIONS
|
||||
} from '../../src/constants/rules-actions.js';
|
||||
import { compareVersions } from '@tm/cli';
|
||||
|
||||
describe('Commands Module - CLI Setup and Integration', () => {
|
||||
const mockExistsSync = jest.spyOn(fs, 'existsSync');
|
||||
const mockReadFileSync = jest.spyOn(fs, 'readFileSync');
|
||||
const mockJoin = jest.spyOn(path, 'join');
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
@@ -115,55 +114,42 @@ describe('Commands Module - CLI Setup and Integration', () => {
|
||||
test('should return Commander program instance', () => {
|
||||
const program = setupCLI();
|
||||
expect(program).toBeDefined();
|
||||
expect(program.name()).toBe('dev');
|
||||
expect(program.name()).toBe('task-master');
|
||||
});
|
||||
|
||||
test('should read version from package.json when available', () => {
|
||||
mockExistsSync.mockReturnValue(true);
|
||||
mockReadFileSync.mockReturnValue('{"version": "1.0.0"}');
|
||||
mockJoin.mockReturnValue('package.json');
|
||||
test('should return version that matches package.json when TM_PUBLIC_VERSION is set', () => {
|
||||
// Read actual version from package.json
|
||||
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
||||
const expectedVersion = packageJson.version;
|
||||
|
||||
// Set environment variable to match package.json
|
||||
const originalEnv = process.env.TM_PUBLIC_VERSION;
|
||||
process.env.TM_PUBLIC_VERSION = expectedVersion;
|
||||
|
||||
const program = setupCLI();
|
||||
const version = program._version();
|
||||
expect(mockReadFileSync).toHaveBeenCalledWith('package.json', 'utf8');
|
||||
expect(version).toBe('1.0.0');
|
||||
const version = program.version();
|
||||
expect(version).toBe(expectedVersion);
|
||||
|
||||
// Restore original environment
|
||||
if (originalEnv !== undefined) {
|
||||
process.env.TM_PUBLIC_VERSION = originalEnv;
|
||||
} else {
|
||||
delete process.env.TM_PUBLIC_VERSION;
|
||||
}
|
||||
});
|
||||
|
||||
test('should use default version when package.json is not available', () => {
|
||||
mockExistsSync.mockReturnValue(false);
|
||||
test('should use default version when TM_PUBLIC_VERSION is not available', () => {
|
||||
const originalEnv = process.env.TM_PUBLIC_VERSION;
|
||||
delete process.env.TM_PUBLIC_VERSION;
|
||||
|
||||
const program = setupCLI();
|
||||
const version = program._version();
|
||||
expect(mockReadFileSync).not.toHaveBeenCalled();
|
||||
expect(version).toBe('unknown');
|
||||
});
|
||||
|
||||
test('should use default version when package.json reading throws an error', () => {
|
||||
mockExistsSync.mockReturnValue(true);
|
||||
mockReadFileSync.mockImplementation(() => {
|
||||
throw new Error('Read error');
|
||||
});
|
||||
|
||||
// Mock console methods to prevent chalk formatting conflicts
|
||||
const consoleErrorSpy = jest
|
||||
.spyOn(console, 'error')
|
||||
.mockImplementation(() => {});
|
||||
const consoleLogSpy = jest
|
||||
.spyOn(console, 'log')
|
||||
.mockImplementation(() => {});
|
||||
const consoleWarnSpy = jest
|
||||
.spyOn(console, 'warn')
|
||||
.mockImplementation(() => {});
|
||||
|
||||
const program = setupCLI();
|
||||
const version = program._version();
|
||||
expect(mockReadFileSync).toHaveBeenCalled();
|
||||
const version = program.version();
|
||||
expect(version).toBe('unknown');
|
||||
|
||||
// Restore console methods
|
||||
consoleErrorSpy.mockRestore();
|
||||
consoleLogSpy.mockRestore();
|
||||
consoleWarnSpy.mockRestore();
|
||||
// Restore original environment
|
||||
if (originalEnv !== undefined) {
|
||||
process.env.TM_PUBLIC_VERSION = originalEnv;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -277,31 +263,6 @@ describe('Commands Module - CLI Setup and Integration', () => {
|
||||
|
||||
// Test utility functions that commands rely on
|
||||
describe('Version comparison utility', () => {
|
||||
let compareVersions;
|
||||
|
||||
beforeAll(async () => {
|
||||
// Import from @tm/cli instead of commands.js
|
||||
const { compareVersions: cv } = await import(
|
||||
'../../apps/cli/src/utils/auto-update.js'
|
||||
);
|
||||
|
||||
// Create a local compareVersions function for testing
|
||||
compareVersions = (v1, v2) => {
|
||||
const v1Parts = v1.split('.').map((p) => parseInt(p, 10));
|
||||
const v2Parts = v2.split('.').map((p) => parseInt(p, 10));
|
||||
|
||||
for (let i = 0; i < Math.max(v1Parts.length, v2Parts.length); i++) {
|
||||
const v1Part = v1Parts[i] || 0;
|
||||
const v2Part = v2Parts[i] || 0;
|
||||
|
||||
if (v1Part < v2Part) return -1;
|
||||
if (v1Part > v2Part) return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
});
|
||||
|
||||
test('compareVersions correctly compares semantic versions', () => {
|
||||
expect(compareVersions('1.0.0', '1.0.0')).toBe(0);
|
||||
expect(compareVersions('1.0.0', '1.0.1')).toBe(-1);
|
||||
|
||||
@@ -7,6 +7,18 @@ dotenvLoad();
|
||||
// Get all TM_PUBLIC_* env variables for build-time injection
|
||||
const getBuildTimeEnvs = () => {
|
||||
const envs: Record<string, string> = {};
|
||||
|
||||
// Inject package.json version at build time
|
||||
try {
|
||||
const packageJson = JSON.parse(
|
||||
require('fs').readFileSync('package.json', 'utf8')
|
||||
);
|
||||
envs['TM_PUBLIC_VERSION'] = packageJson.version || 'unknown';
|
||||
} catch (error) {
|
||||
console.warn('Could not read package.json version during build:', error);
|
||||
envs['TM_PUBLIC_VERSION'] = 'unknown';
|
||||
}
|
||||
|
||||
for (const [key, value] of Object.entries(process.env)) {
|
||||
if (key.startsWith('TM_PUBLIC_')) {
|
||||
// Return the actual value, not JSON.stringify'd
|
||||
@@ -23,7 +35,7 @@ export default defineConfig(
|
||||
'mcp-server': 'mcp-server/server.js'
|
||||
},
|
||||
outDir: 'dist',
|
||||
copy: ['public'],
|
||||
copy: ['assets'],
|
||||
ignoreWatch: ['node_modules', 'dist', 'tests', 'apps/extension'],
|
||||
// Bundle only our workspace packages, keep npm dependencies external
|
||||
noExternal: [/^@tm\//],
|
||||
|
||||
Reference in New Issue
Block a user