opencode-context 1.0.0

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.
@@ -0,0 +1,10 @@
1
+ import { FileMatch, FileMetadata, SearchOptions, SearchResult, ParsedQuery } from './types.js';
2
+ export declare function parseQuery(query: string): ParsedQuery;
3
+ export declare function isTestFile(filePath: string): boolean;
4
+ export declare function isConfigFile(filePath: string): boolean;
5
+ export declare function isDocFile(filePath: string): boolean;
6
+ export declare function detectLanguage(filePath: string): string | undefined;
7
+ export declare function extractMetadata(filePath: string): Promise<FileMetadata>;
8
+ export declare function calculateFileScore(filePath: string, query: ParsedQuery, metadata: FileMetadata, rootPath: string, searchContent: boolean): Promise<FileMatch>;
9
+ export declare function searchFiles(options: SearchOptions): Promise<SearchResult>;
10
+ //# sourceMappingURL=search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,SAAS,EAET,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EAOZ,MAAM,YAAY,CAAC;AAEpB,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAmDrD;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAMpD;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAMtD;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAMnD;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQnE;AAED,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAiB7E;AAgQD,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,OAAO,GACrB,OAAO,CAAC,SAAS,CAAC,CAmCpB;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAiE/E"}
@@ -0,0 +1,75 @@
1
+ export interface FileMatch {
2
+ path: string;
3
+ relativePath: string;
4
+ score: number;
5
+ reasons: MatchReason[];
6
+ metadata: FileMetadata;
7
+ }
8
+ export interface MatchReason {
9
+ type: MatchType;
10
+ description: string;
11
+ matchedContent?: string;
12
+ contribution: number;
13
+ }
14
+ export type MatchType = 'filename' | 'filepath' | 'content' | 'export' | 'import' | 'function' | 'class' | 'interface' | 'comment' | 'config' | 'test' | 'related';
15
+ export interface FileMetadata {
16
+ size: number;
17
+ lastModified: Date;
18
+ extension: string;
19
+ lineCount: number;
20
+ isTest: boolean;
21
+ isConfig: boolean;
22
+ isDoc: boolean;
23
+ language?: string;
24
+ exports?: string[];
25
+ imports?: string[];
26
+ }
27
+ export interface SearchOptions {
28
+ query: string;
29
+ maxFiles?: number;
30
+ minScore?: number;
31
+ rootPath?: string;
32
+ include?: string[];
33
+ exclude?: string[];
34
+ includeTests?: boolean;
35
+ includeConfigs?: boolean;
36
+ includeDocs?: boolean;
37
+ searchContent?: boolean;
38
+ maxFileSize?: number;
39
+ }
40
+ export interface SearchResult {
41
+ files: FileMatch[];
42
+ filesScanned: number;
43
+ timeMs: number;
44
+ query: string;
45
+ }
46
+ export interface ParsedQuery {
47
+ original: string;
48
+ terms: string[];
49
+ exactTerms: string[];
50
+ fileTypes: string[];
51
+ wantTests: boolean;
52
+ wantConfigs: boolean;
53
+ wantDocs: boolean;
54
+ }
55
+ export interface ScoringWeights {
56
+ filename: number;
57
+ filepath: number;
58
+ content: number;
59
+ export: number;
60
+ import: number;
61
+ function: number;
62
+ class: number;
63
+ interface: number;
64
+ comment: number;
65
+ config: number;
66
+ test: number;
67
+ related: number;
68
+ }
69
+ export declare const DEFAULT_WEIGHTS: ScoringWeights;
70
+ export declare const LANGUAGE_EXTENSIONS: Record<string, string[]>;
71
+ export declare const DEFAULT_EXCLUDE_PATTERNS: string[];
72
+ export declare const TEST_PATTERNS: string[];
73
+ export declare const CONFIG_PATTERNS: string[];
74
+ export declare const DOC_PATTERNS: string[];
75
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,QAAQ,EAAE,YAAY,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,SAAS,GACjB,UAAU,GACV,UAAU,GACV,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,OAAO,GACP,WAAW,GACX,SAAS,GACT,QAAQ,GACR,MAAM,GACN,SAAS,CAAC;AAEd,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,IAAI,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,E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B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAuBxD,CAAC;AAEF,eAAO,MAAM,wBAAwB,UAcpC,CAAC;AAEF,eAAO,MAAM,aAAa,UAWzB,CAAC;AAEF,eAAO,MAAM,eAAe,UAO3B,CAAC;AAEF,eAAO,MAAM,YAAY,UAUxB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "opencode-context",
3
+ "version": "1.0.0",
4
+ "description": "Smart file finder for codebases - semantic search with confidence scoring. Also available as an OpenCode plugin.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "bin": {
9
+ "opencode-context": "dist/index.js",
10
+ "opencode-context-install": "dist/install.js"
11
+ },
12
+ "files": [
13
+ "dist/",
14
+ "README.md",
15
+ "LICENSE"
16
+ ],
17
+ "scripts": {
18
+ "build": "bun build ./src/index.ts --outfile ./dist/index.js --target node && bun build ./src/plugin.ts --outfile ./dist/plugin.js --target node && bun build ./src/install.ts --outfile ./dist/install.js --target node && echo '#!/usr/bin/env node' | cat - ./dist/index.js > temp && mv temp ./dist/index.js && chmod +x ./dist/index.js",
19
+ "build:types": "tsc --emitDeclarationOnly",
20
+ "dev": "bun run src/index.ts",
21
+ "test": "bun test",
22
+ "prepublishOnly": "bun run build && bun run build:types"
23
+ },
24
+ "dependencies": {
25
+ "@clack/prompts": "^0.9.1",
26
+ "@opencode-ai/plugin": "^1.2.2",
27
+ "commander": "^12.0.0",
28
+ "fast-glob": "^3.3.2",
29
+ "picocolors": "^1.0.0"
30
+ },
31
+ "devDependencies": {
32
+ "@types/node": "^22.19.11",
33
+ "bun-types": "latest",
34
+ "typescript": "^5.0.0"
35
+ },
36
+ "engines": {
37
+ "node": ">=22"
38
+ },
39
+ "keywords": [
40
+ "file-finder",
41
+ "code-search",
42
+ "semantic-search",
43
+ "cli",
44
+ "tui",
45
+ "developer-tools",
46
+ "codebase",
47
+ "context",
48
+ "intelligent-search"
49
+ ],
50
+ "author": "",
51
+ "license": "MIT"
52
+ }