mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
feat: 优化项目和全局配置的获取逻辑,添加Codex配置支持
This commit is contained in:
@@ -3,4 +3,8 @@
|
|||||||
- **CLI Tools Usage**: @~/.claude/workflows/cli-tools-usage.md
|
- **CLI Tools Usage**: @~/.claude/workflows/cli-tools-usage.md
|
||||||
- **Coding Philosophy**: @~/.claude/workflows/coding-philosophy.md
|
- **Coding Philosophy**: @~/.claude/workflows/coding-philosophy.md
|
||||||
- **Context Requirements**: @~/.claude/workflows/context-tools.md
|
- **Context Requirements**: @~/.claude/workflows/context-tools.md
|
||||||
- **File Modification**: @~/.claude/workflows/file-modification.md
|
- **File Modification**: @~/.claude/workflows/file-modification.md
|
||||||
|
|
||||||
|
## Agent Execution
|
||||||
|
|
||||||
|
- **Always use `run_in_background = false`** for Task tool agent calls to ensure synchronous execution and immediate result visibility
|
||||||
@@ -42,17 +42,41 @@ function getCcwEnabledToolsCodex() {
|
|||||||
|
|
||||||
// Get current CCW_PROJECT_ROOT from config
|
// Get current CCW_PROJECT_ROOT from config
|
||||||
function getCcwProjectRoot() {
|
function getCcwProjectRoot() {
|
||||||
|
// Try project config first, then global config
|
||||||
const currentPath = projectPath;
|
const currentPath = projectPath;
|
||||||
const projectData = mcpAllProjects[currentPath] || {};
|
const projectData = mcpAllProjects[currentPath] || {};
|
||||||
const ccwConfig = projectData.mcpServers?.['ccw-tools'];
|
const projectCcwConfig = projectData.mcpServers?.['ccw-tools'];
|
||||||
return ccwConfig?.env?.CCW_PROJECT_ROOT || '';
|
if (projectCcwConfig?.env?.CCW_PROJECT_ROOT) {
|
||||||
|
return projectCcwConfig.env.CCW_PROJECT_ROOT;
|
||||||
|
}
|
||||||
|
// Fallback to global config
|
||||||
|
const globalCcwConfig = mcpUserServers?.['ccw-tools'];
|
||||||
|
return globalCcwConfig?.env?.CCW_PROJECT_ROOT || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current CCW_ALLOWED_DIRS from config
|
// Get current CCW_ALLOWED_DIRS from config
|
||||||
function getCcwAllowedDirs() {
|
function getCcwAllowedDirs() {
|
||||||
|
// Try project config first, then global config
|
||||||
const currentPath = projectPath;
|
const currentPath = projectPath;
|
||||||
const projectData = mcpAllProjects[currentPath] || {};
|
const projectData = mcpAllProjects[currentPath] || {};
|
||||||
const ccwConfig = projectData.mcpServers?.['ccw-tools'];
|
const projectCcwConfig = projectData.mcpServers?.['ccw-tools'];
|
||||||
|
if (projectCcwConfig?.env?.CCW_ALLOWED_DIRS) {
|
||||||
|
return projectCcwConfig.env.CCW_ALLOWED_DIRS;
|
||||||
|
}
|
||||||
|
// Fallback to global config
|
||||||
|
const globalCcwConfig = mcpUserServers?.['ccw-tools'];
|
||||||
|
return globalCcwConfig?.env?.CCW_ALLOWED_DIRS || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get current CCW_PROJECT_ROOT from Codex config
|
||||||
|
function getCcwProjectRootCodex() {
|
||||||
|
const ccwConfig = codexMcpServers?.['ccw-tools'];
|
||||||
|
return ccwConfig?.env?.CCW_PROJECT_ROOT || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get current CCW_ALLOWED_DIRS from Codex config
|
||||||
|
function getCcwAllowedDirsCodex() {
|
||||||
|
const ccwConfig = codexMcpServers?.['ccw-tools'];
|
||||||
return ccwConfig?.env?.CCW_ALLOWED_DIRS || '';
|
return ccwConfig?.env?.CCW_ALLOWED_DIRS || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,7 +284,7 @@ async function renderMcpManager() {
|
|||||||
<input type="text"
|
<input type="text"
|
||||||
class="ccw-project-root-input flex-1 px-2 py-1 text-xs bg-background border border-border rounded focus:outline-none focus:ring-1 focus:ring-primary"
|
class="ccw-project-root-input flex-1 px-2 py-1 text-xs bg-background border border-border rounded focus:outline-none focus:ring-1 focus:ring-primary"
|
||||||
placeholder="${projectPath || t('mcp.useCurrentDir')}"
|
placeholder="${projectPath || t('mcp.useCurrentDir')}"
|
||||||
value="${getCcwProjectRoot()}">
|
value="${getCcwProjectRootCodex()}">
|
||||||
<button class="p-1 text-muted-foreground hover:text-foreground"
|
<button class="p-1 text-muted-foreground hover:text-foreground"
|
||||||
onclick="setCcwProjectRootToCurrent()"
|
onclick="setCcwProjectRootToCurrent()"
|
||||||
title="${t('mcp.useCurrentProject')}">
|
title="${t('mcp.useCurrentProject')}">
|
||||||
@@ -272,7 +296,7 @@ async function renderMcpManager() {
|
|||||||
<input type="text"
|
<input type="text"
|
||||||
class="ccw-allowed-dirs-input flex-1 px-2 py-1 text-xs bg-background border border-border rounded focus:outline-none focus:ring-1 focus:ring-primary"
|
class="ccw-allowed-dirs-input flex-1 px-2 py-1 text-xs bg-background border border-border rounded focus:outline-none focus:ring-1 focus:ring-primary"
|
||||||
placeholder="${t('mcp.allowedDirsPlaceholder')}"
|
placeholder="${t('mcp.allowedDirsPlaceholder')}"
|
||||||
value="${getCcwAllowedDirs()}">
|
value="${getCcwAllowedDirsCodex()}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user