mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-10 02:24:35 +08:00
fix: ccw package.json removal - add root build script and fix cli.ts path resolution
- Fix cli.ts loadPackageInfo() to try root package.json first (../../package.json) - Add build script and devDependencies to root package.json - Remove ccw/package.json and ccw/package-lock.json (no longer needed) - CodexLens: add config.json support for index_dir configuration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -62,10 +62,27 @@ def _parse_languages(raw: Optional[List[str]]) -> Optional[List[str]]:
|
||||
|
||||
|
||||
def _get_index_root() -> Path:
|
||||
"""Get the index root directory from config or default."""
|
||||
"""Get the index root directory from config or default.
|
||||
|
||||
Priority order:
|
||||
1. CODEXLENS_INDEX_DIR environment variable
|
||||
2. index_dir from ~/.codexlens/config.json
|
||||
3. Default: ~/.codexlens/indexes
|
||||
"""
|
||||
env_override = os.getenv("CODEXLENS_INDEX_DIR")
|
||||
if env_override:
|
||||
return Path(env_override).expanduser().resolve()
|
||||
|
||||
# Read from config.json
|
||||
config_file = Path.home() / ".codexlens" / "config.json"
|
||||
if config_file.exists():
|
||||
try:
|
||||
cfg = json.loads(config_file.read_text(encoding="utf-8"))
|
||||
if "index_dir" in cfg:
|
||||
return Path(cfg["index_dir"]).expanduser().resolve()
|
||||
except (json.JSONDecodeError, OSError):
|
||||
pass # Fall through to default
|
||||
|
||||
return Path.home() / ".codexlens" / "indexes"
|
||||
|
||||
|
||||
|
||||
@@ -14,11 +14,37 @@ Storage Structure:
|
||||
└── _index.db # src/ directory index
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import platform
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
|
||||
def _get_configured_index_root() -> Path:
|
||||
"""Get the index root from environment or config file.
|
||||
|
||||
Priority order:
|
||||
1. CODEXLENS_INDEX_DIR environment variable
|
||||
2. index_dir from ~/.codexlens/config.json
|
||||
3. Default: ~/.codexlens/indexes
|
||||
"""
|
||||
env_override = os.getenv("CODEXLENS_INDEX_DIR")
|
||||
if env_override:
|
||||
return Path(env_override).expanduser().resolve()
|
||||
|
||||
config_file = Path.home() / ".codexlens" / "config.json"
|
||||
if config_file.exists():
|
||||
try:
|
||||
cfg = json.loads(config_file.read_text(encoding="utf-8"))
|
||||
if "index_dir" in cfg:
|
||||
return Path(cfg["index_dir"]).expanduser().resolve()
|
||||
except (json.JSONDecodeError, OSError):
|
||||
pass
|
||||
|
||||
return Path.home() / ".codexlens" / "indexes"
|
||||
|
||||
|
||||
class PathMapper:
|
||||
"""Bidirectional mapping tool for source paths ↔ index paths.
|
||||
|
||||
@@ -31,7 +57,7 @@ class PathMapper:
|
||||
index_root: Configured index root directory
|
||||
"""
|
||||
|
||||
DEFAULT_INDEX_ROOT = Path.home() / ".codexlens" / "indexes"
|
||||
DEFAULT_INDEX_ROOT = _get_configured_index_root()
|
||||
INDEX_DB_NAME = "_index.db"
|
||||
|
||||
def __init__(self, index_root: Optional[Path] = None):
|
||||
|
||||
Reference in New Issue
Block a user