@octocodeai/octocode-core 1.0.2 → 2.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.
- package/dist/configLoader.d.ts +5 -1
- package/dist/data/compressed.js +1 -1
- package/dist/data/default.json +319 -0
- package/dist/index.d.ts +2 -6
- package/dist/index.js +1 -1
- package/dist/schemas/descriptions.d.ts +17 -0
- package/dist/schemas/descriptions.js +1 -0
- package/dist/schemas/extraTypes.d.ts +205 -0
- package/dist/schemas/index.d.ts +431 -0
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/outputs.d.ts +817 -0
- package/dist/schemas/outputs.js +1 -0
- package/dist/schemas/runtime.d.ts +32 -0
- package/dist/schemas/runtime.js +1 -0
- package/dist/types/index.d.ts +383 -0
- package/dist/types/index.js +1 -0
- package/package.json +31 -8
- package/dist/latest/index.d.ts +0 -3
- package/dist/latest/index.js +0 -8
- package/dist/lib/deep-merge.d.ts +0 -7
- package/dist/lib/deep-merge.js +0 -1
- package/dist/metadata-types/metadata.d.ts +0 -44
- package/dist/schemes/base/baseSchema.d.ts +0 -24
- package/dist/schemes/base/baseSchema.js +0 -1
- package/dist/schemes/helpers/githubSchemaHelpers.d.ts +0 -158
- package/dist/schemes/helpers/githubSchemaHelpers.js +0 -1
- package/dist/schemes/helpers/localSchemaHelpers.d.ts +0 -164
- package/dist/schemes/helpers/localSchemaHelpers.js +0 -1
- package/dist/schemes/helpers/lspSchemaBuilders.d.ts +0 -20
- package/dist/schemes/helpers/lspSchemaBuilders.js +0 -1
- package/dist/schemes/helpers/lspSchemaDescriptions.d.ts +0 -5
- package/dist/schemes/helpers/lspSchemaDescriptions.js +0 -1
- package/dist/schemes/helpers/lspSchemaHelpers.d.ts +0 -52
- package/dist/schemes/helpers/lspSchemaHelpers.js +0 -1
- package/dist/schemes/helpers/schemaHelperFactory.d.ts +0 -3
- package/dist/schemes/helpers/schemaHelperFactory.js +0 -1
- package/dist/schemes/index.d.ts +0 -25
- package/dist/schemes/index.js +0 -1
- package/dist/schemes/input/githubCloneRepo.d.ts +0 -33
- package/dist/schemes/input/githubCloneRepo.js +0 -1
- package/dist/schemes/input/githubFetchContent.d.ts +0 -50
- package/dist/schemes/input/githubFetchContent.js +0 -1
- package/dist/schemes/input/githubSearchCode.d.ts +0 -46
- package/dist/schemes/input/githubSearchCode.js +0 -1
- package/dist/schemes/input/githubSearchPullRequests.d.ts +0 -140
- package/dist/schemes/input/githubSearchPullRequests.js +0 -1
- package/dist/schemes/input/githubSearchRepos.d.ts +0 -62
- package/dist/schemes/input/githubSearchRepos.js +0 -1
- package/dist/schemes/input/githubViewRepoStructure.d.ts +0 -40
- package/dist/schemes/input/githubViewRepoStructure.js +0 -1
- package/dist/schemes/input/localFindFiles.d.ts +0 -109
- package/dist/schemes/input/localFindFiles.js +0 -1
- package/dist/schemes/input/localGetFileContent.d.ts +0 -37
- package/dist/schemes/input/localGetFileContent.js +0 -1
- package/dist/schemes/input/localSearchCode.d.ts +0 -143
- package/dist/schemes/input/localSearchCode.js +0 -1
- package/dist/schemes/input/localViewStructure.d.ts +0 -65
- package/dist/schemes/input/localViewStructure.js +0 -1
- package/dist/schemes/input/lspCallHierarchy.d.ts +0 -45
- package/dist/schemes/input/lspCallHierarchy.js +0 -1
- package/dist/schemes/input/lspFindReferences.d.ts +0 -37
- package/dist/schemes/input/lspFindReferences.js +0 -1
- package/dist/schemes/input/lspGotoDefinition.d.ts +0 -31
- package/dist/schemes/input/lspGotoDefinition.js +0 -1
- package/dist/schemes/input/packageSearch.d.ts +0 -79
- package/dist/schemes/input/packageSearch.js +0 -1
- package/dist/schemes/output/outputSchemas.d.ts +0 -1311
- package/dist/schemes/output/outputSchemas.js +0 -1
- package/dist/schemes/output/outputTypes.d.ts +0 -66
- package/dist/schemes/output/outputTypes.js +0 -1
- package/dist/toolMetadata.d.ts +0 -2
- package/dist/toolMetadata.js +0 -1
- package/dist/types.d.ts +0 -54
- package/dist/types.js +0 -1
- package/dist/versionLoader.d.ts +0 -11
- package/dist/versionLoader.js +0 -1
- /package/dist/{metadata-types/metadata.js → schemas/extraTypes.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as t}from"zod/v4";import{STATUS_VALUES as o}from"../types/index.js";export const ErrorDataSchema=t.object({id:t.string().optional(),error:t.string(),hints:t.array(t.string()).optional()});const n=t.object({currentPage:t.number(),totalPages:t.number(),hasMore:t.boolean(),perPage:t.number().optional(),totalMatches:t.number().optional(),totalFiles:t.number().optional(),totalEntries:t.number().optional(),totalResults:t.number().optional(),entriesPerPage:t.number().optional(),filesPerPage:t.number().optional(),matchesPerPage:t.number().optional()}),a=t.object({currentPage:t.number(),totalPages:t.number(),hasMore:t.boolean(),charOffset:t.number(),charLength:t.number(),totalChars:t.number()}),i=t.array(t.string()).optional(),r=t.array(t.union([t.string(),t.object({kind:t.string()}).passthrough()])).optional(),e=t.enum([...o]),s=t.object({line:t.number(),value:t.string().optional(),column:t.number().optional()}),p=t.object({path:t.string(),matchCount:t.number(),matches:t.array(s).optional(),modified:t.string().optional()});export const LocalSearchCodeOutputSchema=t.object({status:e.optional(),data:t.object({files:t.array(p),pagination:n.optional(),searchEngine:t.string().optional()}).optional(),files:t.array(p).optional(),pagination:n.optional(),searchEngine:t.string().optional(),hints:i,warnings:r,error:t.string().optional()}).passthrough();const l=t.object({path:t.string(),type:t.string().optional(),size:t.number().optional(),modified:t.string().optional(),permissions:t.string().optional()});export const LocalFindFilesOutputSchema=t.object({status:e.optional(),data:t.object({files:t.array(l),pagination:n.optional()}).optional(),files:t.array(l).optional(),pagination:n.optional(),hints:i,warnings:r,error:t.string().optional()}).passthrough();const g=t.object({path:t.string(),name:t.string(),type:t.string(),size:t.number().optional(),modified:t.string().optional()});export const LocalViewStructureOutputSchema=t.object({status:e.optional(),data:t.object({entries:t.array(g),summary:t.string().optional(),pagination:n.optional()}).optional(),entries:t.array(g).optional(),summary:t.string().optional(),pagination:n.optional(),hints:i,warnings:r,error:t.string().optional()}).passthrough();export const LocalGetFileContentOutputSchema=t.object({status:e.optional(),data:t.object({path:t.string(),content:t.string(),totalLines:t.number().optional(),startLine:t.number().optional(),endLine:t.number().optional(),isPartial:t.boolean().optional(),matchRanges:t.array(t.array(t.number())).optional(),pagination:a.optional(),lastModified:t.string().optional(),lastModifiedBy:t.string().optional()}).optional(),path:t.string().optional(),content:t.string().optional(),pagination:a.optional(),hints:i,warnings:r,error:t.string().optional()}).passthrough();const c=t.object({start:t.object({line:t.number(),character:t.number()}),end:t.object({line:t.number(),character:t.number()})}),u=t.object({uri:t.string(),range:c,content:t.string().optional()});export const LspGotoDefinitionOutputSchema=t.object({status:e.optional(),data:t.object({locations:t.array(u),lspMode:t.string().optional()}).optional(),locations:t.array(u).optional(),lspMode:t.string().optional(),hints:i,warnings:r,error:t.string().optional()}).passthrough();export const LspFindReferencesOutputSchema=t.object({status:e.optional(),data:t.object({locations:t.array(u),pagination:n.optional(),lspMode:t.string().optional()}).optional(),locations:t.array(u).optional(),pagination:n.optional(),lspMode:t.string().optional(),hints:i,warnings:r,error:t.string().optional()}).passthrough();export const LspCallHierarchyOutputSchema=t.object({status:e.optional(),data:t.object({item:t.object({name:t.string(),uri:t.string(),range:c,content:t.string().optional()}).optional(),incomingCalls:t.array(t.object({from:t.object({name:t.string(),uri:t.string(),range:c,content:t.string().optional()}).optional(),to:t.object({name:t.string(),uri:t.string(),range:c,content:t.string().optional()}).optional(),fromRanges:t.array(c).optional()}).passthrough()).optional(),outgoingCalls:t.array(t.object({from:t.object({name:t.string(),uri:t.string(),range:c,content:t.string().optional()}).optional(),to:t.object({name:t.string(),uri:t.string(),range:c,content:t.string().optional()}).optional(),fromRanges:t.array(c).optional()}).passthrough()).optional(),direction:t.string().optional(),depth:t.number().optional(),pagination:n.optional(),lspMode:t.string().optional()}).optional(),pagination:n.optional(),hints:i,warnings:r,error:t.string().optional()}).passthrough();const h=t.object({owner:t.string().optional(),repo:t.string().optional(),full_name:t.string().optional(),url:t.string().optional(),stars:t.number().optional(),language:t.string().optional(),pushed_at:t.string().optional(),description:t.string().optional(),topics:t.array(t.string()).optional(),license:t.string().optional()}).passthrough();export const GitHubSearchRepositoriesOutputSchema=t.object({status:e.optional(),data:t.object({repositories:t.array(h),pagination:n.optional()}).optional(),repositories:t.array(h).optional(),pagination:n.optional(),hints:i,warnings:r,error:t.string().optional()}).passthrough();const b=t.object({number:t.number(),title:t.string(),url:t.string().optional(),state:t.string().optional(),draft:t.boolean().optional(),merged:t.boolean().optional(),created_at:t.string().optional(),updated_at:t.string().optional(),closed_at:t.string().optional(),merged_at:t.string().optional(),author:t.string().optional(),head_ref:t.string().optional(),base_ref:t.string().optional()}).passthrough(),m=t.object({path:t.string(),value:t.string().optional()}).passthrough(),d=t.object({id:t.string(),owner:t.string(),repo:t.string(),matches:t.array(m)}).passthrough();export const GitHubSearchCodeOutputSchema=t.object({status:e.optional(),data:t.object({results:t.array(d),pagination:n.optional()}).optional(),results:t.array(d).optional(),pagination:n.optional(),hints:i,warnings:r,error:t.string().optional()}).passthrough();export const GitHubSearchPullRequestsOutputSchema=t.object({status:e.optional(),data:t.object({pull_requests:t.array(b),total_count:t.number().optional(),pagination:n.optional()}).optional(),pull_requests:t.array(b).optional(),pagination:n.optional(),hints:i,warnings:r,error:t.string().optional()}).passthrough();const j=t.object({path:t.string(),name:t.string().optional(),type:t.string().optional(),size:t.number().optional()}).passthrough();export const GitHubFileContentOutputSchema=t.object({status:e.optional(),data:t.object({path:t.string(),content:t.string(),totalLines:t.number().optional(),startLine:t.number().optional(),endLine:t.number().optional(),isPartial:t.boolean().optional(),resolvedBranch:t.string().optional(),pagination:a.optional(),lastModified:t.string().optional(),lastModifiedBy:t.string().optional()}).optional(),path:t.string().optional(),content:t.string().optional(),pagination:a.optional(),hints:i,warnings:r,error:t.string().optional()}).passthrough();export const GitHubViewRepoStructureOutputSchema=t.object({status:e.optional(),data:t.object({entries:t.array(j),pagination:n.optional()}).optional(),entries:t.array(j).optional(),pagination:n.optional(),hints:i,warnings:r,error:t.string().optional()}).passthrough();export const GitHubCloneRepoOutputSchema=t.object({status:e.optional(),data:t.object({localPath:t.string(),branch:t.string(),cached:t.boolean(),sparsePath:t.string().optional(),cloneTimeMs:t.number().optional(),totalSize:t.number().optional(),fileCount:t.number().optional()}).optional(),localPath:t.string().optional(),branch:t.string().optional(),cached:t.boolean().optional(),hints:i,warnings:r,error:t.string().optional()}).passthrough();const y=t.object({name:t.string(),version:t.string().optional(),repository:t.string().optional(),license:t.string().optional(),description:t.string().optional(),deprecated:t.union([t.boolean(),t.string()]).optional(),downloads:t.number().optional(),recentVersions:t.array(t.string()).optional()}).passthrough();export const PackageSearchOutputSchema=t.object({status:e.optional(),data:t.object({packages:t.array(y)}).optional(),packages:t.array(y).optional(),hints:i,warnings:r,error:t.string().optional()}).passthrough();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime helpers for ripgrep queries — kept tiny intentionally. The
|
|
3
|
+
* mcp-host already has rich validation (zod overlay, command builder
|
|
4
|
+
* pre-flight); this surface exists so consumers can call the canonical
|
|
5
|
+
* function name without forking their own copy.
|
|
6
|
+
*/
|
|
7
|
+
import type { z } from "zod/v4";
|
|
8
|
+
import { RipgrepQuerySchema } from "./index.js";
|
|
9
|
+
type RuntimeRipgrepQuery = z.infer<typeof RipgrepQuerySchema>;
|
|
10
|
+
export interface RipgrepValidationResult {
|
|
11
|
+
isValid: boolean;
|
|
12
|
+
errors: string[];
|
|
13
|
+
warnings: string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Lightweight ripgrep-query sanity check. Returns `isValid: true` when
|
|
17
|
+
* the minimum required fields are present. Real validation runs in the
|
|
18
|
+
* mcp-host overlay; this helper is a no-op gate plus a couple of cheap
|
|
19
|
+
* mutex checks for combinations ripgrep itself rejects.
|
|
20
|
+
*/
|
|
21
|
+
export declare function validateRipgrepQuery(query: RuntimeRipgrepQuery): RipgrepValidationResult;
|
|
22
|
+
/**
|
|
23
|
+
* Translate a ripgrep query's `mode` cost lever into concrete flag
|
|
24
|
+
* defaults. Idempotent — re-applying the function yields the same
|
|
25
|
+
* query. Returns a shallow clone so callers can keep the original.
|
|
26
|
+
*
|
|
27
|
+
* discovery → filesOnly=true, no content
|
|
28
|
+
* detailed → contextLines=3 by default
|
|
29
|
+
* paginated → no-op (caller-supplied pagination knobs win)
|
|
30
|
+
*/
|
|
31
|
+
export declare function applyWorkflowMode<T extends RuntimeRipgrepQuery>(query: T): T;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function validateRipgrepQuery(e){const t=[],n=[];return e&&"object"==typeof e?(e.pattern&&"string"==typeof e.pattern||t.push("`pattern` is required"),e.filesOnly&&e.filesWithoutMatch&&t.push("`filesOnly` and `filesWithoutMatch` are mutually exclusive"),e.count&&e.countMatches&&n.push("Both `count` and `countMatches` set — `countMatches` takes precedence"),e.fixedString&&e.perlRegex&&t.push("`fixedString` and `perlRegex` are mutually exclusive"),{isValid:0===t.length,errors:t,warnings:n}):(t.push("Query must be an object"),{isValid:!1,errors:t,warnings:n})}export function applyWorkflowMode(e){if(!e||"object"!=typeof e)return e;const t=e.mode;if(!t||"string"!=typeof t)return e;const n={...e};return"discovery"===t?void 0===n.filesOnly&&(n.filesOnly=!0):"detailed"===t&&void 0===n.contextLines&&(n.contextLines=3),n}
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps constant keys (SCREAMING_SNAKE_CASE) to their canonical MCP tool name
|
|
3
|
+
* strings. Adding a new tool means adding one entry here; consumers derive
|
|
4
|
+
* key/value unions with `keyof ToolNames` and `ToolNames[keyof ToolNames]`.
|
|
5
|
+
*/
|
|
6
|
+
export interface ToolNames {
|
|
7
|
+
GITHUB_FETCH_CONTENT: "githubGetFileContent";
|
|
8
|
+
GITHUB_SEARCH_CODE: "githubSearchCode";
|
|
9
|
+
GITHUB_SEARCH_PULL_REQUESTS: "githubSearchPullRequests";
|
|
10
|
+
GITHUB_SEARCH_REPOSITORIES: "githubSearchRepositories";
|
|
11
|
+
GITHUB_VIEW_REPO_STRUCTURE: "githubViewRepoStructure";
|
|
12
|
+
PACKAGE_SEARCH: "packageSearch";
|
|
13
|
+
GITHUB_CLONE_REPO: "githubCloneRepo";
|
|
14
|
+
LOCAL_RIPGREP: "localSearchCode";
|
|
15
|
+
LOCAL_FETCH_CONTENT: "localGetFileContent";
|
|
16
|
+
LOCAL_FIND_FILES: "localFindFiles";
|
|
17
|
+
LOCAL_VIEW_STRUCTURE: "localViewStructure";
|
|
18
|
+
LSP_GOTO_DEFINITION: "lspGotoDefinition";
|
|
19
|
+
LSP_FIND_REFERENCES: "lspFindReferences";
|
|
20
|
+
LSP_CALL_HIERARCHY: "lspCallHierarchy";
|
|
21
|
+
}
|
|
22
|
+
export interface ToolHints {
|
|
23
|
+
readonly empty: readonly string[];
|
|
24
|
+
readonly dynamic?: Readonly<Record<string, readonly string[] | undefined>>;
|
|
25
|
+
}
|
|
26
|
+
export interface ToolSchema {
|
|
27
|
+
readonly [param: string]: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Authoring type for resource files — carries only the static definition
|
|
31
|
+
* (name, description, schema). Runtime hints are supplied separately by the
|
|
32
|
+
* MCP host; they are intentionally absent here.
|
|
33
|
+
*/
|
|
34
|
+
export interface ToolSpec {
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly description: string;
|
|
37
|
+
readonly schema: ToolSchema;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Full tool descriptor stored in the config blob and consumed by MCP clients.
|
|
41
|
+
* Extends ToolSpec with optional runtime hints (rarely populated — most
|
|
42
|
+
* response-handling guidance now lives in the system prompt).
|
|
43
|
+
*/
|
|
44
|
+
export interface ToolMetadata extends ToolSpec {
|
|
45
|
+
/**
|
|
46
|
+
* Runtime hint registry — always present (defaults to `{ empty: [] }`).
|
|
47
|
+
* Consumers index into this without null-checking the property itself,
|
|
48
|
+
* so it stays required even when the config blob ships no hints for the
|
|
49
|
+
* tool.
|
|
50
|
+
*/
|
|
51
|
+
readonly hints: ToolHints;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Canonical verbosity enum values. Mirrored at runtime as `VERBOSITY_VALUES`
|
|
55
|
+
* so consumers can `import { VERBOSITY_VALUES, Verbosity } from
|
|
56
|
+
* '@octocodeai/octocode-core'` instead of re-declaring locally.
|
|
57
|
+
*
|
|
58
|
+
* basic — full content + full hints/metadata (default).
|
|
59
|
+
* compact — full content + trimmed hints/metadata.
|
|
60
|
+
* concise — counts/top refs only, snippets dropped.
|
|
61
|
+
*/
|
|
62
|
+
export declare enum Verbosity {
|
|
63
|
+
Basic = "basic",
|
|
64
|
+
Compact = "compact",
|
|
65
|
+
Concise = "concise"
|
|
66
|
+
}
|
|
67
|
+
export declare const VERBOSITY_VALUES: readonly [Verbosity.Basic, Verbosity.Compact, Verbosity.Concise];
|
|
68
|
+
export interface VerbosityEnum {
|
|
69
|
+
readonly enum: readonly [
|
|
70
|
+
Verbosity.Basic,
|
|
71
|
+
Verbosity.Compact,
|
|
72
|
+
Verbosity.Concise
|
|
73
|
+
];
|
|
74
|
+
readonly default: Verbosity.Basic;
|
|
75
|
+
readonly description: string;
|
|
76
|
+
}
|
|
77
|
+
export interface BaseSchema {
|
|
78
|
+
readonly mainResearchGoal: string;
|
|
79
|
+
readonly researchGoal: string;
|
|
80
|
+
readonly reasoning: string;
|
|
81
|
+
readonly verbosity?: VerbosityEnum;
|
|
82
|
+
}
|
|
83
|
+
export interface OctocodeConfig {
|
|
84
|
+
readonly instructions: string;
|
|
85
|
+
readonly toolNames: ToolNames;
|
|
86
|
+
readonly baseSchema: BaseSchema;
|
|
87
|
+
readonly tools: Record<ToolNames[keyof ToolNames], ToolSpec>;
|
|
88
|
+
readonly baseHints?: Readonly<Record<string, readonly string[]>>;
|
|
89
|
+
readonly genericErrorHints?: readonly string[];
|
|
90
|
+
}
|
|
91
|
+
export interface CompleteMetadata {
|
|
92
|
+
readonly instructions: string;
|
|
93
|
+
readonly toolNames: ToolNames;
|
|
94
|
+
readonly baseSchema: BaseSchema;
|
|
95
|
+
readonly tools: Record<string, ToolSpec | ToolMetadata>;
|
|
96
|
+
/**
|
|
97
|
+
* Shared hint registry — keys are result kinds (`"empty"`, …). Always
|
|
98
|
+
* present (defaults to `{}`); consumers fall through to per-tool `hints`
|
|
99
|
+
* for tools without a matching key.
|
|
100
|
+
*/
|
|
101
|
+
readonly baseHints: Readonly<Record<string, readonly string[]>>;
|
|
102
|
+
/** Generic-error hint list — surfaced on any unhandled tool error. Defaults to `[]`. */
|
|
103
|
+
readonly genericErrorHints: readonly string[];
|
|
104
|
+
}
|
|
105
|
+
/** Envelope-level status — every tool's response carries this. */
|
|
106
|
+
export declare enum ToolStatus {
|
|
107
|
+
Empty = "empty",
|
|
108
|
+
Error = "error"
|
|
109
|
+
}
|
|
110
|
+
export declare const STATUS_VALUES: readonly [ToolStatus.Empty, ToolStatus.Error];
|
|
111
|
+
/** Row-level pagination — superset of every per-tool flavour. */
|
|
112
|
+
export interface PaginationInfo {
|
|
113
|
+
readonly currentPage: number;
|
|
114
|
+
readonly totalPages: number;
|
|
115
|
+
readonly hasMore: boolean;
|
|
116
|
+
readonly perPage?: number;
|
|
117
|
+
readonly totalMatches?: number;
|
|
118
|
+
readonly totalFiles?: number;
|
|
119
|
+
readonly totalEntries?: number;
|
|
120
|
+
readonly totalResults?: number;
|
|
121
|
+
readonly entriesPerPage?: number;
|
|
122
|
+
readonly filesPerPage?: number;
|
|
123
|
+
readonly matchesPerPage?: number;
|
|
124
|
+
}
|
|
125
|
+
/** Rendered-payload pagination — used by `charOffset` / `charLength` paths. */
|
|
126
|
+
export interface CharPagination {
|
|
127
|
+
readonly currentPage: number;
|
|
128
|
+
readonly totalPages: number;
|
|
129
|
+
readonly hasMore: boolean;
|
|
130
|
+
readonly charOffset: number;
|
|
131
|
+
readonly charLength: number;
|
|
132
|
+
readonly totalChars: number;
|
|
133
|
+
}
|
|
134
|
+
/** LSP semantic vs. fallback mode marker. */
|
|
135
|
+
export declare enum LspMode {
|
|
136
|
+
Semantic = "semantic",
|
|
137
|
+
Fallback = "fallback"
|
|
138
|
+
}
|
|
139
|
+
export declare const LSP_MODES: readonly [LspMode.Semantic, LspMode.Fallback];
|
|
140
|
+
/**
|
|
141
|
+
* Typed warning kinds emitted by tool responses. Discriminated by `kind`.
|
|
142
|
+
* Add new kinds here when introducing new advisory categories — keeps the
|
|
143
|
+
* agent-facing wire contract stable across consumers.
|
|
144
|
+
*/
|
|
145
|
+
export interface ToolWarning {
|
|
146
|
+
readonly kind: "match-value-truncated" | "content-truncated" | "verbosity-downgrade";
|
|
147
|
+
readonly truncatedAt?: number;
|
|
148
|
+
readonly field?: string;
|
|
149
|
+
readonly path?: string;
|
|
150
|
+
readonly detail?: string;
|
|
151
|
+
}
|
|
152
|
+
/** Generic envelope every tool wraps its data in. */
|
|
153
|
+
export interface ToolResultEnvelope<TData> {
|
|
154
|
+
readonly status?: ToolStatus;
|
|
155
|
+
readonly data?: TData;
|
|
156
|
+
readonly hints?: readonly string[];
|
|
157
|
+
readonly warnings?: readonly ToolWarning[];
|
|
158
|
+
readonly error?: string;
|
|
159
|
+
}
|
|
160
|
+
/** Per-file match pagination — for paging matches *within* a single file. */
|
|
161
|
+
export interface LocalSearchCodeMatchPagination {
|
|
162
|
+
readonly currentPage: number;
|
|
163
|
+
readonly totalPages: number;
|
|
164
|
+
readonly matchesPerPage?: number;
|
|
165
|
+
readonly totalMatches?: number;
|
|
166
|
+
readonly hasMore: boolean;
|
|
167
|
+
}
|
|
168
|
+
export interface LocalSearchCodeMatch {
|
|
169
|
+
line: number;
|
|
170
|
+
value?: string;
|
|
171
|
+
column?: number;
|
|
172
|
+
}
|
|
173
|
+
export interface LocalSearchCodeFile {
|
|
174
|
+
path: string;
|
|
175
|
+
matchCount: number;
|
|
176
|
+
matches: LocalSearchCodeMatch[];
|
|
177
|
+
modified?: string;
|
|
178
|
+
pagination?: LocalSearchCodeMatchPagination;
|
|
179
|
+
}
|
|
180
|
+
export interface LocalSearchCodeData {
|
|
181
|
+
readonly files: readonly LocalSearchCodeFile[];
|
|
182
|
+
readonly pagination?: PaginationInfo;
|
|
183
|
+
readonly searchEngine?: "rg";
|
|
184
|
+
}
|
|
185
|
+
export interface LocalFindFilesEntry {
|
|
186
|
+
path: string;
|
|
187
|
+
type?: "file" | "directory" | "symlink" | "f" | "d" | "l";
|
|
188
|
+
size?: number;
|
|
189
|
+
sizeFormatted?: string;
|
|
190
|
+
modified?: string;
|
|
191
|
+
permissions?: string;
|
|
192
|
+
extension?: string;
|
|
193
|
+
name?: string;
|
|
194
|
+
}
|
|
195
|
+
export interface LocalFindFilesData {
|
|
196
|
+
readonly files: readonly LocalFindFilesEntry[];
|
|
197
|
+
readonly pagination?: PaginationInfo;
|
|
198
|
+
}
|
|
199
|
+
export interface LocalGetFileContentData {
|
|
200
|
+
readonly path: string;
|
|
201
|
+
readonly content: string;
|
|
202
|
+
readonly totalLines?: number;
|
|
203
|
+
readonly startLine?: number;
|
|
204
|
+
readonly endLine?: number;
|
|
205
|
+
readonly isPartial?: boolean;
|
|
206
|
+
readonly matchRanges?: ReadonlyArray<readonly [number, number]>;
|
|
207
|
+
readonly pagination?: CharPagination;
|
|
208
|
+
readonly lastModified?: string;
|
|
209
|
+
readonly lastModifiedBy?: string;
|
|
210
|
+
}
|
|
211
|
+
export interface LocalViewStructureEntry {
|
|
212
|
+
readonly path: string;
|
|
213
|
+
readonly name: string;
|
|
214
|
+
readonly type: "file" | "directory" | "symlink";
|
|
215
|
+
readonly size?: number;
|
|
216
|
+
readonly modified?: string;
|
|
217
|
+
}
|
|
218
|
+
export interface LocalViewStructureData {
|
|
219
|
+
readonly entries: readonly LocalViewStructureEntry[];
|
|
220
|
+
readonly summary?: string;
|
|
221
|
+
readonly pagination?: PaginationInfo;
|
|
222
|
+
}
|
|
223
|
+
export interface LspRange {
|
|
224
|
+
readonly start: {
|
|
225
|
+
line: number;
|
|
226
|
+
character: number;
|
|
227
|
+
};
|
|
228
|
+
readonly end: {
|
|
229
|
+
line: number;
|
|
230
|
+
character: number;
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
export interface LspLocation {
|
|
234
|
+
readonly uri: string;
|
|
235
|
+
readonly range: LspRange;
|
|
236
|
+
readonly content?: string;
|
|
237
|
+
}
|
|
238
|
+
export interface LspGotoDefinitionData {
|
|
239
|
+
readonly locations: readonly LspLocation[];
|
|
240
|
+
readonly lspMode?: LspMode;
|
|
241
|
+
}
|
|
242
|
+
export interface LspFindReferencesData {
|
|
243
|
+
readonly locations: readonly LspLocation[];
|
|
244
|
+
readonly pagination?: PaginationInfo;
|
|
245
|
+
readonly lspMode?: LspMode;
|
|
246
|
+
}
|
|
247
|
+
export interface LspCallEdge {
|
|
248
|
+
readonly from?: {
|
|
249
|
+
name: string;
|
|
250
|
+
uri: string;
|
|
251
|
+
range: LspRange;
|
|
252
|
+
};
|
|
253
|
+
readonly to?: {
|
|
254
|
+
name: string;
|
|
255
|
+
uri: string;
|
|
256
|
+
range: LspRange;
|
|
257
|
+
};
|
|
258
|
+
readonly fromRanges?: readonly LspRange[];
|
|
259
|
+
}
|
|
260
|
+
export interface LspCallHierarchyData {
|
|
261
|
+
readonly item?: {
|
|
262
|
+
name: string;
|
|
263
|
+
uri: string;
|
|
264
|
+
range: LspRange;
|
|
265
|
+
content?: string;
|
|
266
|
+
};
|
|
267
|
+
readonly incomingCalls?: readonly LspCallEdge[];
|
|
268
|
+
readonly outgoingCalls?: readonly LspCallEdge[];
|
|
269
|
+
readonly direction?: "incoming" | "outgoing";
|
|
270
|
+
readonly depth?: number;
|
|
271
|
+
readonly pagination?: PaginationInfo;
|
|
272
|
+
readonly lspMode?: LspMode;
|
|
273
|
+
}
|
|
274
|
+
export interface GitHubSearchCodeMatch {
|
|
275
|
+
readonly path: string;
|
|
276
|
+
readonly value?: string;
|
|
277
|
+
}
|
|
278
|
+
export interface GitHubSearchCodeGroup {
|
|
279
|
+
readonly id: string;
|
|
280
|
+
readonly owner: string;
|
|
281
|
+
readonly repo: string;
|
|
282
|
+
readonly matches: readonly GitHubSearchCodeMatch[];
|
|
283
|
+
}
|
|
284
|
+
export interface GitHubSearchCodeData {
|
|
285
|
+
readonly results: readonly GitHubSearchCodeGroup[];
|
|
286
|
+
readonly pagination?: PaginationInfo;
|
|
287
|
+
}
|
|
288
|
+
export interface GitHubFileContentData {
|
|
289
|
+
readonly path: string;
|
|
290
|
+
readonly content: string;
|
|
291
|
+
readonly totalLines?: number;
|
|
292
|
+
readonly startLine?: number;
|
|
293
|
+
readonly endLine?: number;
|
|
294
|
+
readonly isPartial?: boolean;
|
|
295
|
+
readonly resolvedBranch?: string;
|
|
296
|
+
readonly pagination?: CharPagination;
|
|
297
|
+
readonly lastModified?: string;
|
|
298
|
+
readonly lastModifiedBy?: string;
|
|
299
|
+
}
|
|
300
|
+
export interface GitHubViewRepoStructureEntry {
|
|
301
|
+
readonly path: string;
|
|
302
|
+
readonly name: string;
|
|
303
|
+
readonly type: "file" | "dir";
|
|
304
|
+
readonly size?: number;
|
|
305
|
+
}
|
|
306
|
+
export interface GitHubViewRepoStructureData {
|
|
307
|
+
readonly entries: readonly GitHubViewRepoStructureEntry[];
|
|
308
|
+
readonly pagination?: PaginationInfo;
|
|
309
|
+
}
|
|
310
|
+
export interface GitHubRepositoryItem {
|
|
311
|
+
readonly full_name: string;
|
|
312
|
+
readonly url: string;
|
|
313
|
+
readonly stars: number;
|
|
314
|
+
readonly language?: string;
|
|
315
|
+
readonly pushed_at?: string;
|
|
316
|
+
readonly description?: string;
|
|
317
|
+
readonly topics?: readonly string[];
|
|
318
|
+
readonly license?: string;
|
|
319
|
+
}
|
|
320
|
+
export interface GitHubSearchReposData {
|
|
321
|
+
readonly repositories: readonly GitHubRepositoryItem[];
|
|
322
|
+
readonly pagination?: PaginationInfo;
|
|
323
|
+
}
|
|
324
|
+
export interface GitHubPullRequestFileChange {
|
|
325
|
+
readonly filename: string;
|
|
326
|
+
readonly status: string;
|
|
327
|
+
readonly additions: number;
|
|
328
|
+
readonly deletions: number;
|
|
329
|
+
readonly changes?: number;
|
|
330
|
+
readonly patch?: string;
|
|
331
|
+
}
|
|
332
|
+
export interface GitHubPullRequestItem {
|
|
333
|
+
readonly number: number;
|
|
334
|
+
readonly title: string;
|
|
335
|
+
readonly url: string;
|
|
336
|
+
readonly state: "open" | "closed";
|
|
337
|
+
readonly draft: boolean;
|
|
338
|
+
readonly merged: boolean;
|
|
339
|
+
readonly created_at: string;
|
|
340
|
+
readonly updated_at: string;
|
|
341
|
+
readonly closed_at?: string;
|
|
342
|
+
readonly merged_at?: string;
|
|
343
|
+
readonly author: string;
|
|
344
|
+
readonly head_ref: string;
|
|
345
|
+
readonly base_ref: string;
|
|
346
|
+
readonly comments?: number;
|
|
347
|
+
readonly commits?: number;
|
|
348
|
+
readonly additions?: number;
|
|
349
|
+
readonly deletions?: number;
|
|
350
|
+
readonly changed_files?: number;
|
|
351
|
+
readonly labels?: ReadonlyArray<{
|
|
352
|
+
name: string;
|
|
353
|
+
color?: string;
|
|
354
|
+
}>;
|
|
355
|
+
readonly file_changes?: readonly GitHubPullRequestFileChange[];
|
|
356
|
+
}
|
|
357
|
+
export interface GitHubSearchPullRequestsData {
|
|
358
|
+
readonly pull_requests: readonly GitHubPullRequestItem[];
|
|
359
|
+
readonly total_count?: number;
|
|
360
|
+
readonly pagination?: PaginationInfo;
|
|
361
|
+
}
|
|
362
|
+
export interface GitHubCloneRepoData {
|
|
363
|
+
readonly localPath: string;
|
|
364
|
+
readonly branch: string;
|
|
365
|
+
readonly cached: boolean;
|
|
366
|
+
readonly sparsePath?: string;
|
|
367
|
+
readonly cloneTimeMs?: number;
|
|
368
|
+
readonly totalSize?: number;
|
|
369
|
+
readonly fileCount?: number;
|
|
370
|
+
}
|
|
371
|
+
export interface PackageItem {
|
|
372
|
+
readonly name: string;
|
|
373
|
+
readonly version: string;
|
|
374
|
+
readonly repository?: string;
|
|
375
|
+
readonly license?: string;
|
|
376
|
+
readonly description?: string;
|
|
377
|
+
readonly deprecated?: boolean | string;
|
|
378
|
+
readonly downloads?: number;
|
|
379
|
+
readonly recentVersions?: readonly string[];
|
|
380
|
+
}
|
|
381
|
+
export interface PackageSearchData {
|
|
382
|
+
readonly packages: readonly PackageItem[];
|
|
383
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var Verbosity;!function(o){o.Basic="basic",o.Compact="compact",o.Concise="concise"}(Verbosity||(Verbosity={}));export const VERBOSITY_VALUES=[Verbosity.Basic,Verbosity.Compact,Verbosity.Concise];export var ToolStatus;!function(o){o.Empty="empty",o.Error="error"}(ToolStatus||(ToolStatus={}));export const STATUS_VALUES=[ToolStatus.Empty,ToolStatus.Error];export var LspMode;!function(o){o.Semantic="semantic",o.Fallback="fallback"}(LspMode||(LspMode={}));export const LSP_MODES=[LspMode.Semantic,LspMode.Fallback];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octocodeai/octocode-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Core config, prompts, tools, and schemas for Octocode MCP",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -10,24 +10,46 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"import": "./dist/index.js",
|
|
12
12
|
"types": "./dist/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./schemas": {
|
|
15
|
+
"import": "./dist/schemas/index.js",
|
|
16
|
+
"types": "./dist/schemas/index.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./schemas/outputs": {
|
|
19
|
+
"import": "./dist/schemas/outputs.js",
|
|
20
|
+
"types": "./dist/schemas/outputs.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./schemas/runtime": {
|
|
23
|
+
"import": "./dist/schemas/runtime.js",
|
|
24
|
+
"types": "./dist/schemas/runtime.d.ts"
|
|
25
|
+
},
|
|
26
|
+
"./types": {
|
|
27
|
+
"import": "./dist/types/index.js",
|
|
28
|
+
"types": "./dist/types/index.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"./extra-types": {
|
|
31
|
+
"import": "./dist/schemas/extraTypes.js",
|
|
32
|
+
"types": "./dist/schemas/extraTypes.d.ts"
|
|
13
33
|
}
|
|
14
34
|
},
|
|
15
35
|
"files": [
|
|
16
36
|
"dist/**/*.js",
|
|
17
37
|
"dist/**/*.d.ts",
|
|
38
|
+
"dist/**/*.json",
|
|
18
39
|
"README.md"
|
|
19
40
|
],
|
|
20
41
|
"publishConfig": {
|
|
21
42
|
"access": "public"
|
|
22
43
|
},
|
|
23
44
|
"scripts": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
45
|
+
"generate": "tsx src/octocode-scripts/generateDefaultJson.ts",
|
|
46
|
+
"compress": "yarn generate && node scripts/compress-config.mjs",
|
|
47
|
+
"build": "yarn generate && node scripts/compress-config.mjs && tsc && node scripts/minify-dist.mjs",
|
|
26
48
|
"lint": "eslint src/**/*.ts",
|
|
27
49
|
"lint:fix": "eslint src/**/*.ts --fix",
|
|
28
|
-
"typecheck": "
|
|
29
|
-
"test": "
|
|
30
|
-
"test:watch": "
|
|
50
|
+
"typecheck": "yarn compress && tsc --noEmit",
|
|
51
|
+
"test": "yarn compress && vitest run",
|
|
52
|
+
"test:watch": "yarn compress && vitest --watch",
|
|
31
53
|
"prepublishOnly": "yarn lint && yarn typecheck && yarn test && yarn build"
|
|
32
54
|
},
|
|
33
55
|
"keywords": [
|
|
@@ -46,7 +68,6 @@
|
|
|
46
68
|
"zod": ">=3.25.0"
|
|
47
69
|
},
|
|
48
70
|
"devDependencies": {
|
|
49
|
-
"zod": ">=3.25.0",
|
|
50
71
|
"@typescript-eslint/eslint-plugin": "8.48.1",
|
|
51
72
|
"@typescript-eslint/parser": "8.48.1",
|
|
52
73
|
"eslint": "^8.57.0",
|
|
@@ -54,7 +75,9 @@
|
|
|
54
75
|
"eslint-plugin-prettier": "^5.4.1",
|
|
55
76
|
"prettier": "^3.5.3",
|
|
56
77
|
"terser": "^5.46.1",
|
|
78
|
+
"tsx": "^4.19.2",
|
|
57
79
|
"typescript": "^5.8.3",
|
|
58
|
-
"vitest": "^3.2.4"
|
|
80
|
+
"vitest": "^3.2.4",
|
|
81
|
+
"zod": ">=3.25.0"
|
|
59
82
|
}
|
|
60
83
|
}
|
package/dist/latest/index.d.ts
DELETED