Merge remote-tracking branch 'origin/main' into ralph/chore/update.from.main

This commit is contained in:
Ralph Khreish
2025-09-24 20:10:19 +02:00
98 changed files with 152 additions and 143 deletions

View File

@@ -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,

View File

@@ -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();
}