fix: get storage type better with tm-core (#1347)

This commit is contained in:
Ralph Khreish
2025-10-26 08:30:47 +01:00
committed by GitHub
parent 486ed40215
commit d0342d2696
4 changed files with 9 additions and 14 deletions

View File

@@ -127,10 +127,8 @@ export class NextCommand extends Command {
const task = await this.tmCore.tasks.getNext(options.tag);
// Get storage type and active tag
const storageType = this.tmCore.config.getStorageConfig().type;
if (storageType === 'auto') {
throw new Error('Storage type must be resolved before use');
}
const storageType = this.tmCore.tasks.getStorageType();
const activeTag = options.tag || this.tmCore.config.getActiveTag();
return {

View File

@@ -164,10 +164,7 @@ export class SetStatusCommand extends Command {
this.lastResult = {
success: true,
updatedTasks,
storageType: this.tmCore.config.getStorageConfig().type as Exclude<
StorageType,
'auto'
>
storageType: this.tmCore.tasks.getStorageType()
};
// Display results

View File

@@ -156,7 +156,7 @@ export class ShowCommand extends Command {
const result = await this.tmCore.tasks.get(taskId);
// Get storage type
const storageType = this.tmCore.config.getStorageConfig().type;
const storageType = this.tmCore.tasks.getStorageType();
return {
task: result.task,
@@ -189,13 +189,13 @@ export class ShowCommand extends Command {
}
}
// Get storage type
const storageType = this.tmCore.config.getStorageConfig().type;
// Get storage type (resolved, not config value)
const storageType = this.tmCore.tasks.getStorageType();
return {
tasks,
notFound,
storageType: storageType as Exclude<StorageType, 'auto'>
storageType
};
}

View File

@@ -144,10 +144,10 @@ export class StartCommand extends Command {
await this.executeChildProcess(coreResult.command);
}
// Convert core result to CLI result with storage type
// Convert core result to CLI result with storage type (resolved, not config value)
const result: StartCommandResult = {
...coreResult,
storageType: this.tmCore?.config.getStorageConfig().type
storageType: this.tmCore?.tasks.getStorageType()
};
// Store result for programmatic access