mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-28 09:23:08 +08:00
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:
@@ -7273,6 +7273,8 @@ export interface SpecEntry {
|
||||
priority: 'critical' | 'high' | 'medium' | 'low';
|
||||
keywords: string[];
|
||||
scope: 'global' | 'project';
|
||||
/** Content length (body only, cached for performance) */
|
||||
contentLength: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -7305,6 +7307,54 @@ export async function rebuildSpecIndex(projectPath?: string): Promise<{ success:
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection preview file info
|
||||
*/
|
||||
export interface InjectionPreviewFile {
|
||||
file: string;
|
||||
title: string;
|
||||
dimension: string;
|
||||
category: string;
|
||||
scope: string;
|
||||
readMode: string;
|
||||
priority: string;
|
||||
contentLength: number;
|
||||
content?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection preview response
|
||||
*/
|
||||
export interface InjectionPreviewResponse {
|
||||
files: InjectionPreviewFile[];
|
||||
stats: {
|
||||
count: number;
|
||||
totalLength: number;
|
||||
maxLength: number;
|
||||
percentage: number;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get injection preview with file list
|
||||
* @param mode - 'required' | 'all' | 'keywords'
|
||||
* @param preview - Include content preview
|
||||
* @param projectPath - Optional project path
|
||||
*/
|
||||
export async function getInjectionPreview(
|
||||
mode: 'required' | 'all' | 'keywords' = 'required',
|
||||
preview: boolean = false,
|
||||
projectPath?: string
|
||||
): Promise<InjectionPreviewResponse> {
|
||||
const params = new URLSearchParams();
|
||||
params.set('mode', mode);
|
||||
params.set('preview', String(preview));
|
||||
if (projectPath) {
|
||||
params.set('path', projectPath);
|
||||
}
|
||||
return fetchApi<InjectionPreviewResponse>(`/api/specs/injection-preview?${params.toString()}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update spec frontmatter (toggle readMode)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user