raggrep 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -9
- package/dist/app/indexer/index.d.ts +2 -2
- package/dist/cli/main.js +1964 -918
- package/dist/cli/main.js.map +21 -14
- package/dist/domain/entities/conventions.d.ts +63 -0
- package/dist/domain/entities/index.d.ts +2 -0
- package/dist/domain/services/conventions/configFiles.d.ts +10 -0
- package/dist/domain/services/conventions/conventions.test.d.ts +4 -0
- package/dist/domain/services/conventions/entryPoints.d.ts +10 -0
- package/dist/domain/services/conventions/frameworks/convex.d.ts +11 -0
- package/dist/domain/services/conventions/frameworks/index.d.ts +22 -0
- package/dist/domain/services/conventions/frameworks/nextjs.d.ts +10 -0
- package/dist/domain/services/conventions/index.d.ts +39 -0
- package/dist/domain/services/introspection.d.ts +31 -0
- package/dist/index.js +1452 -416
- package/dist/index.js.map +20 -14
- package/dist/infrastructure/config/configLoader.d.ts +22 -3
- package/dist/infrastructure/config/index.d.ts +1 -1
- package/dist/{introspection/index.d.ts → infrastructure/introspection/IntrospectionIndex.d.ts} +3 -14
- package/dist/infrastructure/introspection/index.d.ts +9 -0
- package/dist/{introspection → infrastructure/introspection}/projectDetector.d.ts +3 -12
- package/dist/tests/integration.test.d.ts +9 -0
- package/dist/types.d.ts +4 -4
- package/package.json +1 -1
- package/dist/introspection/fileIntrospector.d.ts +0 -14
- /package/dist/{introspection/types.d.ts → domain/entities/introspection.d.ts} +0 -0
- /package/dist/{introspection → domain/services}/introspection.test.d.ts +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convention Types
|
|
3
|
+
*
|
|
4
|
+
* Defines patterns for recognizing special files and their semantic meaning.
|
|
5
|
+
* Used by the conventions service to add semantic keywords to the search index.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Categories for organizing conventions.
|
|
9
|
+
*/
|
|
10
|
+
export type ConventionCategory = "entry-point" | "configuration" | "framework" | "types" | "test" | "documentation" | "build" | "deployment";
|
|
11
|
+
/**
|
|
12
|
+
* A file convention pattern that matches files and provides keywords.
|
|
13
|
+
*/
|
|
14
|
+
export interface FileConvention {
|
|
15
|
+
/** Unique identifier for this convention */
|
|
16
|
+
id: string;
|
|
17
|
+
/** Human-readable name */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Description of what this convention represents */
|
|
20
|
+
description: string;
|
|
21
|
+
/** Category for grouping conventions */
|
|
22
|
+
category: ConventionCategory;
|
|
23
|
+
/**
|
|
24
|
+
* Match function - returns true if the filepath matches this convention.
|
|
25
|
+
* @param filepath - The file path (relative to project root)
|
|
26
|
+
* @param filename - Just the filename
|
|
27
|
+
* @param extension - File extension including dot (e.g., ".ts")
|
|
28
|
+
*/
|
|
29
|
+
match: (filepath: string, filename: string, extension: string) => boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Keywords to add when this convention matches.
|
|
32
|
+
* These will be added to the search index.
|
|
33
|
+
*/
|
|
34
|
+
keywords: string[];
|
|
35
|
+
/**
|
|
36
|
+
* Optional: Additional keywords based on the filepath.
|
|
37
|
+
* Useful for extracting context from the path.
|
|
38
|
+
*/
|
|
39
|
+
dynamicKeywords?: (filepath: string) => string[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A framework convention provider.
|
|
43
|
+
* Frameworks can register their own conventions.
|
|
44
|
+
*/
|
|
45
|
+
export interface FrameworkConventions {
|
|
46
|
+
/** Framework identifier */
|
|
47
|
+
id: string;
|
|
48
|
+
/** Framework name */
|
|
49
|
+
name: string;
|
|
50
|
+
/** Check if this framework is detected in the project */
|
|
51
|
+
detect: (filepath: string, allFiles?: string[]) => boolean;
|
|
52
|
+
/** Conventions specific to this framework */
|
|
53
|
+
conventions: FileConvention[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Result of matching conventions against a file.
|
|
57
|
+
*/
|
|
58
|
+
export interface ConventionMatch {
|
|
59
|
+
/** The convention that matched */
|
|
60
|
+
convention: FileConvention;
|
|
61
|
+
/** Keywords from this match */
|
|
62
|
+
keywords: string[];
|
|
63
|
+
}
|
|
@@ -12,3 +12,5 @@ export type { SearchResult, SearchOptions, SearchContributions, CoreContribution
|
|
|
12
12
|
export { DEFAULT_SEARCH_OPTIONS } from "./searchResult";
|
|
13
13
|
export type { Config, ModuleConfig } from "./config";
|
|
14
14
|
export { DEFAULT_IGNORE_PATHS, DEFAULT_EXTENSIONS, createDefaultConfig, } from "./config";
|
|
15
|
+
export type { FileIntrospection, ProjectStructure, Project, ProjectType, Scope, IntrospectionConfig, } from "./introspection";
|
|
16
|
+
export type { FileConvention, ConventionCategory, FrameworkConventions, ConventionMatch, } from "./conventions";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration File Conventions
|
|
3
|
+
*
|
|
4
|
+
* Patterns for recognizing common configuration files.
|
|
5
|
+
*/
|
|
6
|
+
import type { FileConvention } from "../../entities/conventions";
|
|
7
|
+
/**
|
|
8
|
+
* Configuration file conventions.
|
|
9
|
+
*/
|
|
10
|
+
export declare const configFileConventions: FileConvention[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry Point Conventions
|
|
3
|
+
*
|
|
4
|
+
* Patterns for recognizing module entry points and barrel files.
|
|
5
|
+
*/
|
|
6
|
+
import type { FileConvention } from "../../entities/conventions";
|
|
7
|
+
/**
|
|
8
|
+
* Entry point conventions for JavaScript/TypeScript projects.
|
|
9
|
+
*/
|
|
10
|
+
export declare const entryPointConventions: FileConvention[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convex Framework Conventions
|
|
3
|
+
*
|
|
4
|
+
* Patterns for recognizing Convex backend files and structures.
|
|
5
|
+
* Convex is a backend platform with real-time sync.
|
|
6
|
+
*/
|
|
7
|
+
import type { FrameworkConventions } from "../../../entities/conventions";
|
|
8
|
+
/**
|
|
9
|
+
* Convex framework conventions provider.
|
|
10
|
+
*/
|
|
11
|
+
export declare const convexFramework: FrameworkConventions;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework Conventions Registry
|
|
3
|
+
*
|
|
4
|
+
* Central registry for framework-specific conventions.
|
|
5
|
+
* Add new frameworks here to extend convention support.
|
|
6
|
+
*/
|
|
7
|
+
import type { FrameworkConventions } from "../../../entities/conventions";
|
|
8
|
+
/**
|
|
9
|
+
* All registered framework convention providers.
|
|
10
|
+
* Add new frameworks to this array.
|
|
11
|
+
*/
|
|
12
|
+
export declare const frameworkProviders: FrameworkConventions[];
|
|
13
|
+
/**
|
|
14
|
+
* Get all framework conventions.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getAllFrameworkConventions(): import("..").FileConvention[];
|
|
17
|
+
/**
|
|
18
|
+
* Get frameworks by ID.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getFramework(id: string): FrameworkConventions | undefined;
|
|
21
|
+
export { nextjsFramework } from "./nextjs";
|
|
22
|
+
export { convexFramework } from "./convex";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Next.js Framework Conventions
|
|
3
|
+
*
|
|
4
|
+
* Patterns for recognizing Next.js specific files and structures.
|
|
5
|
+
*/
|
|
6
|
+
import type { FrameworkConventions } from "../../../entities/conventions";
|
|
7
|
+
/**
|
|
8
|
+
* Next.js framework conventions provider.
|
|
9
|
+
*/
|
|
10
|
+
export declare const nextjsFramework: FrameworkConventions;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File Conventions Service
|
|
3
|
+
*
|
|
4
|
+
* Pure functions for matching files against conventions and extracting keywords.
|
|
5
|
+
* No I/O operations - all functions operate on file paths.
|
|
6
|
+
*
|
|
7
|
+
* Categories:
|
|
8
|
+
* - Entry Points: index.ts, main.ts, App.tsx, etc.
|
|
9
|
+
* - Configuration: tsconfig.json, .prettierrc, package.json, etc.
|
|
10
|
+
* - Frameworks: Next.js, Convex, and other framework-specific patterns
|
|
11
|
+
* - Type Definitions: *.d.ts, *.types.ts
|
|
12
|
+
*
|
|
13
|
+
* Extensibility:
|
|
14
|
+
* - Add new conventions to entryPoints.ts or configFiles.ts
|
|
15
|
+
* - Add new frameworks in the frameworks/ directory
|
|
16
|
+
*/
|
|
17
|
+
import type { FileConvention, ConventionMatch } from "../../entities/conventions";
|
|
18
|
+
export type { FileConvention, ConventionCategory, ConventionMatch, FrameworkConventions, } from "../../entities/conventions";
|
|
19
|
+
/**
|
|
20
|
+
* Get all conventions including built-in ones.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getConventions(): FileConvention[];
|
|
23
|
+
/**
|
|
24
|
+
* Match a filepath against all conventions and return keywords.
|
|
25
|
+
*
|
|
26
|
+
* @param filepath - The file path (relative to project root)
|
|
27
|
+
* @returns Array of keywords from all matching conventions
|
|
28
|
+
*/
|
|
29
|
+
export declare function getConventionKeywords(filepath: string): string[];
|
|
30
|
+
/**
|
|
31
|
+
* Match a filepath against all conventions and return detailed matches.
|
|
32
|
+
*
|
|
33
|
+
* @param filepath - The file path (relative to project root)
|
|
34
|
+
* @returns Array of convention matches with details
|
|
35
|
+
*/
|
|
36
|
+
export declare function matchConventions(filepath: string): ConventionMatch[];
|
|
37
|
+
export { entryPointConventions } from "./entryPoints";
|
|
38
|
+
export { configFileConventions } from "./configFiles";
|
|
39
|
+
export { frameworkProviders, getAllFrameworkConventions } from "./frameworks";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Introspection Service
|
|
3
|
+
*
|
|
4
|
+
* Pure functions for extracting file metadata from paths and content.
|
|
5
|
+
* No I/O operations - all functions operate on provided data.
|
|
6
|
+
*/
|
|
7
|
+
import type { FileIntrospection, Project, ProjectStructure, Scope } from "../entities/introspection";
|
|
8
|
+
/**
|
|
9
|
+
* Extract introspection metadata for a file.
|
|
10
|
+
*
|
|
11
|
+
* @param filepath - Relative file path
|
|
12
|
+
* @param structure - Project structure (from detectProjectStructure)
|
|
13
|
+
* @param fileContent - Optional file content for framework detection
|
|
14
|
+
*/
|
|
15
|
+
export declare function introspectFile(filepath: string, structure: ProjectStructure, fileContent?: string): FileIntrospection;
|
|
16
|
+
/**
|
|
17
|
+
* Extract keywords from introspection for search boosting.
|
|
18
|
+
*/
|
|
19
|
+
export declare function introspectionToKeywords(intro: FileIntrospection): string[];
|
|
20
|
+
/**
|
|
21
|
+
* Detect scope from project name.
|
|
22
|
+
*/
|
|
23
|
+
export declare function detectScopeFromName(name: string): Scope;
|
|
24
|
+
/**
|
|
25
|
+
* Find which project a file belongs to.
|
|
26
|
+
*/
|
|
27
|
+
export declare function findProjectForFile(filepath: string, structure: ProjectStructure): Project;
|
|
28
|
+
/**
|
|
29
|
+
* Calculate search boost based on introspection and query.
|
|
30
|
+
*/
|
|
31
|
+
export declare function calculateIntrospectionBoost(intro: FileIntrospection, query: string): number;
|