fix: 修复 这几个命令使用了废弃的项目路径定位方案
This commit is contained in:
@ -3,6 +3,7 @@ const fs = require('fs-extra')
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
const { COMMANDS } = require('../../../../constants')
|
const { COMMANDS } = require('../../../../constants')
|
||||||
const { getGlobalResourceManager } = require('../../resource')
|
const { getGlobalResourceManager } = require('../../resource')
|
||||||
|
const { getDirectoryService } = require('../../../utils/DirectoryService')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 记忆检索锦囊命令
|
* 记忆检索锦囊命令
|
||||||
@ -13,6 +14,7 @@ class RecallCommand extends BasePouchCommand {
|
|||||||
super()
|
super()
|
||||||
// 复用ActionCommand的ResourceManager方式
|
// 复用ActionCommand的ResourceManager方式
|
||||||
this.resourceManager = getGlobalResourceManager()
|
this.resourceManager = getGlobalResourceManager()
|
||||||
|
this.directoryService = getDirectoryService()
|
||||||
}
|
}
|
||||||
|
|
||||||
getPurpose () {
|
getPurpose () {
|
||||||
@ -139,11 +141,16 @@ ${formattedMemories}
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取项目路径(复用ActionCommand逻辑)
|
* 获取项目路径(与InitCommand保持一致)
|
||||||
*/
|
*/
|
||||||
async getProjectPath() {
|
async getProjectPath() {
|
||||||
// 使用ResourceManager的项目路径获取逻辑
|
// 使用DirectoryService统一获取项目路径
|
||||||
return this.resourceManager.projectPath || process.cwd()
|
const context = {
|
||||||
|
startDir: process.cwd(),
|
||||||
|
platform: process.platform,
|
||||||
|
avoidUserHome: true
|
||||||
|
}
|
||||||
|
return await this.directoryService.getProjectRoot(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -184,8 +184,13 @@ class RegisterCommand extends BasePouchCommand {
|
|||||||
* 获取项目路径(复用ActionCommand逻辑)
|
* 获取项目路径(复用ActionCommand逻辑)
|
||||||
*/
|
*/
|
||||||
async getProjectPath() {
|
async getProjectPath() {
|
||||||
// 使用ResourceManager的项目路径获取逻辑
|
// 使用DirectoryService统一获取项目路径(与InitCommand保持一致)
|
||||||
return this.resourceManager.projectPath || process.cwd()
|
const context = {
|
||||||
|
startDir: process.cwd(),
|
||||||
|
platform: process.platform,
|
||||||
|
avoidUserHome: true
|
||||||
|
}
|
||||||
|
return await this.directoryService.getProjectRoot(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
getPATEOAS (args) {
|
getPATEOAS (args) {
|
||||||
|
|||||||
@ -3,6 +3,7 @@ const fs = require('fs-extra')
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
const { COMMANDS } = require('../../../../constants')
|
const { COMMANDS } = require('../../../../constants')
|
||||||
const { getGlobalResourceManager } = require('../../resource')
|
const { getGlobalResourceManager } = require('../../resource')
|
||||||
|
const { getDirectoryService } = require('../../../utils/DirectoryService')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 记忆保存锦囊命令
|
* 记忆保存锦囊命令
|
||||||
@ -13,6 +14,7 @@ class RememberCommand extends BasePouchCommand {
|
|||||||
super()
|
super()
|
||||||
// 复用ActionCommand的ResourceManager方式
|
// 复用ActionCommand的ResourceManager方式
|
||||||
this.resourceManager = getGlobalResourceManager()
|
this.resourceManager = getGlobalResourceManager()
|
||||||
|
this.directoryService = getDirectoryService()
|
||||||
}
|
}
|
||||||
|
|
||||||
getPurpose () {
|
getPurpose () {
|
||||||
@ -87,11 +89,16 @@ class RememberCommand extends BasePouchCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取项目路径(复用ActionCommand逻辑)
|
* 获取项目路径(与InitCommand保持一致)
|
||||||
*/
|
*/
|
||||||
async getProjectPath() {
|
async getProjectPath() {
|
||||||
// 使用ResourceManager的项目路径获取逻辑
|
// 使用DirectoryService统一获取项目路径
|
||||||
return this.resourceManager.projectPath || process.cwd()
|
const context = {
|
||||||
|
startDir: process.cwd(),
|
||||||
|
platform: process.platform,
|
||||||
|
avoidUserHome: true
|
||||||
|
}
|
||||||
|
return await this.directoryService.getProjectRoot(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user