feat: add injection preview functionality and enhance specs management

- Implemented injection preview feature in InjectionControlTab with file listing and content preview.
- Added new API endpoint for fetching injection preview data.
- Introduced content length caching for performance optimization.
- Enhanced spec loading to support category filtering.
- Updated localization files for new features and terms.
- Created new personal and project specs for coding style and architecture constraints.
- Improved CLI options for category selection in spec commands.
This commit is contained in:
catlog22
2026-02-27 09:45:28 +08:00
parent dfa8e0d9f5
commit 3f25dbb11b
15 changed files with 648 additions and 120 deletions

View File

@@ -11,6 +11,7 @@ import chalk from 'chalk';
interface SpecOptions {
dimension?: string;
category?: string;
keywords?: string;
stdin?: boolean;
json?: boolean;
@@ -58,13 +59,13 @@ function getProjectPath(hookCwd?: string): string {
// ============================================================================
/**
* Load action - load specs matching dimension/keywords.
* Load action - load specs matching dimension/category/keywords.
*
* CLI mode: --dimension and --keywords options, outputs formatted markdown.
* CLI mode: --dimension, --category, --keywords options, outputs formatted markdown.
* Hook mode: --stdin reads JSON {session_id, cwd, user_prompt}, outputs JSON {continue, systemMessage}.
*/
async function loadAction(options: SpecOptions): Promise<void> {
const { stdin, dimension, keywords: keywordsInput } = options;
const { stdin, dimension, category, keywords: keywordsInput } = options;
let projectPath: string;
let stdinData: StdinData | undefined;
@@ -96,6 +97,7 @@ async function loadAction(options: SpecOptions): Promise<void> {
const result = await loadSpecs({
projectPath,
dimension: dimension as 'specs' | 'personal' | undefined,
category: category as 'general' | 'exploration' | 'planning' | 'execution' | undefined,
keywords,
outputFormat: stdin ? 'hook' : 'cli',
stdinData,