@octocodeai/octocode-tools-core 16.2.0 → 16.5.1
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 +546 -0
- package/dist/config.d.ts +7 -0
- package/dist/direct.js +34 -41
- package/dist/errors/pathUtils.d.ts +1 -1
- package/dist/github/directoryFetch.d.ts +2 -1
- package/dist/github/githubAPI.d.ts +10 -1
- package/dist/github/repoStructureRecursive.d.ts +6 -0
- package/dist/index.d.ts +15 -27
- package/dist/index.js +41 -48
- package/dist/providers/providerQueries.d.ts +9 -0
- package/dist/providers/providerResults.d.ts +2 -0
- package/dist/scheme/coreSchemas.d.ts +5 -5
- package/dist/scheme/fields.d.ts +6 -6
- package/dist/serverConfig.d.ts +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/shared/config/defaults.d.ts +15 -0
- package/dist/shared/config/index.d.ts +10 -0
- package/dist/shared/config/index.js +10 -0
- package/dist/shared/config/loader.d.ts +7 -0
- package/dist/shared/config/resolver.d.ts +2 -0
- package/dist/shared/config/resolverCache.d.ts +12 -0
- package/dist/shared/config/resolverSections.d.ts +12 -0
- package/dist/shared/config/runtimeSurface.d.ts +21 -0
- package/dist/shared/config/schemas.d.ts +12 -0
- package/dist/shared/config/types.d.ts +100 -0
- package/dist/shared/config/validator.d.ts +2 -0
- package/dist/shared/credentials/constants.d.ts +2 -0
- package/dist/shared/credentials/credentialCache.d.ts +13 -0
- package/dist/shared/credentials/credentialEncryption.d.ts +10 -0
- package/dist/shared/credentials/credentialUtils.d.ts +4 -0
- package/dist/shared/credentials/envTokens.d.ts +9 -0
- package/dist/shared/credentials/ghCli.d.ts +1 -0
- package/dist/shared/credentials/index.d.ts +3 -0
- package/dist/shared/credentials/index.js +9 -0
- package/dist/shared/credentials/schemas.d.ts +22 -0
- package/dist/shared/credentials/storage.d.ts +30 -0
- package/dist/shared/credentials/testing.d.ts +2 -0
- package/dist/shared/credentials/testing.js +8 -0
- package/dist/shared/credentials/tokenRefresh.d.ts +24 -0
- package/dist/shared/credentials/tokenResolution.d.ts +30 -0
- package/dist/shared/credentials/types.d.ts +28 -0
- package/dist/shared/fs-utils.d.ts +2 -0
- package/dist/shared/fs-utils.js +8 -0
- package/dist/shared/index.d.ts +7 -0
- package/dist/shared/logger/index.d.ts +2 -0
- package/dist/shared/logger/logger.d.ts +17 -0
- package/dist/shared/paths.d.ts +33 -0
- package/dist/shared/paths.js +8 -0
- package/dist/shared/platform/index.d.ts +1 -0
- package/dist/shared/platform/index.js +8 -0
- package/dist/shared/platform/platform.d.ts +8 -0
- package/dist/shared/session/index.d.ts +5 -0
- package/dist/shared/session/index.js +9 -0
- package/dist/shared/session/schemas.d.ts +103 -0
- package/dist/shared/session/sessionCache.d.ts +9 -0
- package/dist/shared/session/sessionDiskIO.d.ts +6 -0
- package/dist/shared/session/statsDefaults.d.ts +4 -0
- package/dist/shared/session/storage.d.ts +20 -0
- package/dist/shared/session/types.d.ts +53 -0
- package/dist/tools/github_clone_repo/cache.d.ts +4 -0
- package/dist/tools/github_clone_repo/scheme.d.ts +56 -9
- package/dist/tools/github_clone_repo/types.d.ts +1 -1
- package/dist/tools/github_fetch_content/scheme.d.ts +8 -4
- package/dist/tools/github_fetch_content/types.d.ts +12 -0
- package/dist/tools/github_search_code/scheme.d.ts +6 -6
- package/dist/tools/github_search_pull_requests/contentResponse.d.ts +0 -1
- package/dist/tools/github_search_pull_requests/execution.d.ts +1 -11
- package/dist/tools/github_search_pull_requests/scheme.d.ts +6 -2
- package/dist/tools/github_search_repos/scheme.d.ts +7 -6
- package/dist/tools/github_view_repo_structure/execution.d.ts +0 -9
- package/dist/tools/github_view_repo_structure/scheme.d.ts +10 -6
- package/dist/tools/local_binary_inspect/archiveOps.d.ts +2 -0
- package/dist/tools/local_binary_inspect/binaryInspector.d.ts +48 -7
- package/dist/tools/local_binary_inspect/binaryOps.d.ts +16 -7
- package/dist/tools/local_binary_inspect/scheme.d.ts +10 -7
- package/dist/tools/local_fetch_content/scheme.d.ts +2 -2
- package/dist/tools/local_find_files/scheme.d.ts +2 -2
- package/dist/tools/local_ripgrep/lspBoost.d.ts +54 -0
- package/dist/tools/local_ripgrep/rankingProfile.d.ts +113 -0
- package/dist/tools/local_ripgrep/ripgrepResultBuilder.d.ts +10 -1
- package/dist/tools/local_ripgrep/scheme.d.ts +29 -4
- package/dist/tools/local_ripgrep/structuralSearch.d.ts +3 -4
- package/dist/tools/local_view_structure/scheme.d.ts +2 -2
- package/dist/tools/local_view_structure/structureFilters.d.ts +1 -3
- package/dist/tools/local_view_structure/structureResponse.d.ts +1 -0
- package/dist/tools/lsp/semantic_content/scheme.d.ts +4 -8
- package/dist/tools/lsp/shared/callHierarchyTraversal.d.ts +2 -2
- package/dist/tools/lsp/shared/semanticTypes.d.ts +2 -1
- package/dist/tools/package_search/scheme.d.ts +9 -7
- package/dist/tools/providerMappers.d.ts +19 -0
- package/dist/tools/toolMetadata/proxies.d.ts +0 -6
- package/dist/tools/utils.d.ts +3 -7
- package/dist/types/bulk.d.ts +0 -2
- package/dist/types/execution.d.ts +1 -2
- package/dist/types/toolResults.d.ts +2 -3
- package/dist/utils/contextUtils.d.ts +35 -2
- package/dist/utils/core/lines.d.ts +16 -0
- package/dist/utils/core/types.d.ts +10 -0
- package/dist/utils/file/filters.d.ts +2 -11
- package/dist/utils/parsers/diff.d.ts +18 -0
- package/dist/utils/ranking/evidenceRanker.d.ts +86 -0
- package/dist/utils/response/error.d.ts +38 -4
- package/dist/utils/response/groupedFinalizer.d.ts +0 -2
- package/package.json +43 -14
- package/dist/commands/RipgrepCommandBuilder.d.ts +0 -27
- package/dist/hints/dynamic.d.ts +0 -6
- package/dist/hints/index.d.ts +0 -2
- package/dist/hints/types.d.ts +0 -1
- package/dist/tools/github_clone_repo/hints.d.ts +0 -2
- package/dist/tools/github_fetch_content/hints.d.ts +0 -2
- package/dist/tools/github_search_code/hints.d.ts +0 -2
- package/dist/tools/github_search_pull_requests/hints.d.ts +0 -2
- package/dist/tools/github_search_repos/hints.d.ts +0 -2
- package/dist/tools/github_view_repo_structure/hints.d.ts +0 -2
- package/dist/tools/local_fetch_content/hints.d.ts +0 -2
- package/dist/tools/local_find_files/hints.d.ts +0 -2
- package/dist/tools/local_ripgrep/grepFallbackExecutor.d.ts +0 -3
- package/dist/tools/local_ripgrep/hints.d.ts +0 -2
- package/dist/tools/local_ripgrep/ripgrepParser.d.ts +0 -9
- package/dist/tools/local_view_structure/hints.d.ts +0 -2
- package/dist/tools/local_view_structure/structureParser.d.ts +0 -3
- package/dist/tools/local_view_structure/structureWalker.d.ts +0 -24
- package/dist/tools/lsp/semantic_content/hints.d.ts +0 -4
- package/dist/tools/package_search/hints.d.ts +0 -2
- package/dist/types/metadata.d.ts +0 -69
- package/dist/utils/exec/commandAvailability.d.ts +0 -19
- package/dist/utils/exec/ripgrepBinary.d.ts +0 -3
|
@@ -31,6 +31,7 @@ export interface FileContentQuery extends BaseProviderQuery {
|
|
|
31
31
|
charOffset?: number;
|
|
32
32
|
charLength?: number;
|
|
33
33
|
fullContent?: boolean;
|
|
34
|
+
forceRefresh?: boolean;
|
|
34
35
|
minify: 'none' | 'standard' | 'symbols';
|
|
35
36
|
}
|
|
36
37
|
export interface RepoSearchQuery extends BaseProviderQuery {
|
|
@@ -84,6 +85,14 @@ export interface PullRequestQuery extends BaseProviderQuery {
|
|
|
84
85
|
interactions?: number | string;
|
|
85
86
|
draft?: boolean;
|
|
86
87
|
match?: Array<'title' | 'body' | 'comments'>;
|
|
88
|
+
milestone?: string;
|
|
89
|
+
language?: string;
|
|
90
|
+
checks?: 'pending' | 'success' | 'failure';
|
|
91
|
+
review?: 'none' | 'required' | 'approved' | 'changes_requested';
|
|
92
|
+
locked?: boolean;
|
|
93
|
+
visibility?: 'public' | 'private';
|
|
94
|
+
teamMentions?: string;
|
|
95
|
+
project?: string;
|
|
87
96
|
archived?: boolean;
|
|
88
97
|
content?: unknown;
|
|
89
98
|
reviewMode?: 'summary' | 'full';
|
|
@@ -42,6 +42,8 @@ export interface CodeSearchResult {
|
|
|
42
42
|
branch?: string;
|
|
43
43
|
};
|
|
44
44
|
nonExistentScope?: boolean;
|
|
45
|
+
/** Provider's search index did not fully complete (GitHub incomplete_results) — empty/partial results may be a false negative. */
|
|
46
|
+
incompleteResults?: boolean;
|
|
45
47
|
}
|
|
46
48
|
export interface FileContentResult {
|
|
47
49
|
path: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
type AnyZodObject = z.ZodObject<z.ZodRawShape>;
|
|
3
3
|
export type QueryShape = Record<string, z.ZodTypeAny>;
|
|
4
|
-
|
|
4
|
+
type QuerySchemaOptions = {
|
|
5
5
|
strict?: boolean;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
omit?: readonly string[];
|
|
7
|
+
};
|
|
8
|
+
export declare function describeQuerySchema<T extends AnyZodObject>(coreSchema: T, overrides?: QueryShape, options?: QuerySchemaOptions): T;
|
|
9
|
+
export declare function createQueryShapeSchema<T extends AnyZodObject>(coreSchema: T, overrides?: QueryShape, options?: QuerySchemaOptions): AnyZodObject;
|
|
10
10
|
export {};
|
package/dist/scheme/fields.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare function clampedInt(min: number, max: number): z.
|
|
2
|
+
export declare function clampedInt(min: number, max: number): z.ZodPreprocess<z.ZodNumber>;
|
|
3
3
|
export type MinifyMode = 'none' | 'standard' | 'symbols';
|
|
4
|
-
export declare const relaxedPageNumberField: z.ZodDefault<z.ZodOptional<z.
|
|
5
|
-
export declare const contextLinesField: z.ZodOptional<z.
|
|
6
|
-
export declare const lineNumberField: z.ZodOptional<z.
|
|
4
|
+
export declare const relaxedPageNumberField: z.ZodDefault<z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>>;
|
|
5
|
+
export declare const contextLinesField: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
|
|
6
|
+
export declare const lineNumberField: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
|
|
7
7
|
export declare function createRelaxedBulkQuerySchema(querySchema: z.ZodTypeAny, options?: {
|
|
8
8
|
maxQueries?: number;
|
|
9
9
|
}): z.ZodObject<{
|
|
10
|
-
responseCharOffset: z.ZodOptional<z.
|
|
11
|
-
responseCharLength: z.ZodOptional<z.
|
|
10
|
+
responseCharOffset: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
|
|
11
|
+
responseCharLength: z.ZodOptional<z.ZodPreprocess<z.ZodNumber>>;
|
|
12
12
|
queries: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
13
13
|
}, z.core.$strip>;
|
package/dist/serverConfig.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProviderType } from './providers/types.js';
|
|
2
|
-
import { resolveTokenFull } from '
|
|
2
|
+
import { resolveTokenFull } from './shared/index.js';
|
|
3
3
|
import type { ServerConfig, TokenSourceType } from './types/server.js';
|
|
4
4
|
type ResolveTokenFullFn = typeof resolveTokenFull;
|
|
5
5
|
export declare function _setTokenResolvers(resolvers: {
|
package/dist/session.d.ts
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RequiredGitHubConfig, RequiredLocalConfig, RequiredToolsConfig, RequiredNetworkConfig, RequiredTelemetryConfig, RequiredLspConfig, RequiredOutputConfig, ResolvedConfig } from './types.js';
|
|
2
|
+
export declare const DEFAULT_GITHUB_CONFIG: RequiredGitHubConfig;
|
|
3
|
+
export declare const DEFAULT_LOCAL_CONFIG: RequiredLocalConfig;
|
|
4
|
+
export declare const DEFAULT_TOOLS_CONFIG: RequiredToolsConfig;
|
|
5
|
+
export declare const DEFAULT_NETWORK_CONFIG: RequiredNetworkConfig;
|
|
6
|
+
export declare const DEFAULT_TELEMETRY_CONFIG: RequiredTelemetryConfig;
|
|
7
|
+
export declare const DEFAULT_LSP_CONFIG: RequiredLspConfig;
|
|
8
|
+
export declare const DEFAULT_OUTPUT_CONFIG: RequiredOutputConfig;
|
|
9
|
+
export declare const DEFAULT_CONFIG: Omit<ResolvedConfig, 'source' | 'configPath'>;
|
|
10
|
+
export declare const MIN_TIMEOUT = 5000;
|
|
11
|
+
export declare const MAX_TIMEOUT = 300000;
|
|
12
|
+
export declare const MIN_RETRIES = 0;
|
|
13
|
+
export declare const MAX_RETRIES = 10;
|
|
14
|
+
export declare const MIN_OUTPUT_DEFAULT_CHAR_LENGTH = 1000;
|
|
15
|
+
export declare const MAX_OUTPUT_DEFAULT_CHAR_LENGTH = 50000;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { OctocodeConfig, ResolvedConfig, ValidationResult, LoadConfigResult, GitHubConfigOptions, LocalConfigOptions, ToolsConfigOptions, NetworkConfigOptions, TelemetryConfigOptions, LspConfigOptions, OutputConfigOptions, OutputPaginationConfigOptions, RequiredGitHubConfig, RequiredLocalConfig, RequiredToolsConfig, RequiredNetworkConfig, RequiredTelemetryConfig, RequiredLspConfig, RequiredOutputConfig, RequiredOutputPaginationConfig, MinifyMode, } from './types.js';
|
|
2
|
+
export { CONFIG_SCHEMA_VERSION, CONFIG_FILE_NAME } from './types.js';
|
|
3
|
+
export { DEFAULT_CONFIG, DEFAULT_GITHUB_CONFIG, DEFAULT_LOCAL_CONFIG, DEFAULT_TOOLS_CONFIG, DEFAULT_NETWORK_CONFIG, DEFAULT_TELEMETRY_CONFIG, DEFAULT_LSP_CONFIG, DEFAULT_OUTPUT_CONFIG, MIN_TIMEOUT, MAX_TIMEOUT, MIN_RETRIES, MAX_RETRIES, MIN_OUTPUT_DEFAULT_CHAR_LENGTH, MAX_OUTPUT_DEFAULT_CHAR_LENGTH, } from './defaults.js';
|
|
4
|
+
export { CONFIG_FILE_PATH } from './loader.js';
|
|
5
|
+
export { loadConfig, loadConfigSync, configExists, getConfigPath, getOctocodeDir, } from './loader.js';
|
|
6
|
+
export { validateConfig } from './validator.js';
|
|
7
|
+
export { getConfig, getConfigSync, reloadConfig, resolveConfig, resolveConfigSync, invalidateConfigCache, getConfigValue, _resetConfigCache, _getCacheState, } from './resolver.js';
|
|
8
|
+
export { parseLoggingEnv } from './resolverSections.js';
|
|
9
|
+
export { setRuntimeSurface, getRuntimeSurface, _resetRuntimeSurface, type RuntimeSurface, } from './runtimeSurface.js';
|
|
10
|
+
export { OctocodeConfigSchema } from './schemas.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __dirname_fn } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __dirname_fn(__filename);
|
|
8
|
+
var b=1,Ce=".octocoderc";var v={apiUrl:"https://api.github.com"},f={enabled:!1,enableClone:!1,allowedPaths:[],workspaceRoot:void 0},d={enabled:null,enableAdditional:null,disabled:null},C={timeout:3e4,maxRetries:3},A={logging:!0},w={configPath:void 0},g={format:"yaml",pagination:{defaultCharLength:2e4}},M={version:1,github:v,local:f,tools:d,network:C,telemetry:A,lsp:w,output:g},m=5e3,O=3e5,R=0,T=10,h=1e3,L=5e4;import{existsSync as Z,readFileSync as he}from"node:fs";import{existsSync as Ze,mkdirSync as en}from"node:fs";import{join as u}from"node:path";import y from"node:os";import me from"node:path";var x=y.platform()==="win32",P=y.platform()==="darwin",Oe=y.platform()==="linux",p=y.homedir();function F(){return x?process.env.APPDATA||me.join(p,"AppData","Roaming"):p}var D=".octocode";function Re(e){let n=process.env[e];return n&&n.trim().length>0?n:void 0}function Te(){return x?u(F(),D):P?u(p,D):u(Re("XDG_CONFIG_HOME")??u(p,".config"),D)}var a=Te(),H={home:a,config:u(a,".octocoderc"),credentials:u(a,"credentials.json"),key:u(a,".key"),session:u(a,"session.json"),stats:u(a,"stats.json"),tmp:u(a,"tmp"),clone:u(a,"tmp","clone"),tree:u(a,"tmp","tree"),binary:u(a,"tmp","binary"),repos:u(a,"tmp","clone"),logs:u(a,"logs"),unzip:u(a,"tmp","unzip"),cliConfig:u(a,"config.json"),lspConfig:u(a,"lsp-servers.json")};import{z as s}from"zod";var G=s.looseObject({$schema:s.string().optional(),version:s.number().int().optional(),github:s.record(s.string(),s.unknown()).optional(),local:s.record(s.string(),s.unknown()).optional(),tools:s.record(s.string(),s.unknown()).optional(),network:s.record(s.string(),s.unknown()).optional(),telemetry:s.record(s.string(),s.unknown()).optional(),lsp:s.record(s.string(),s.unknown()).optional(),output:s.record(s.string(),s.unknown()).optional()});var U=H.config;function Le(e){let n="",o=0,t=!1,r="";for(;o<e.length;){let i=e[o],l=e[o+1];if(!t&&(i==='"'||i==="'")){t=!0,r=i,n+=i,o++;continue}if(t){if(n+=i,i==="\\"&&o+1<e.length){n+=e[o+1],o+=2;continue}i===r&&(t=!1),o++;continue}if(i==="/"&&l==="/"){for(;o<e.length&&e[o]!==`
|
|
9
|
+
`;)o++;continue}if(i==="/"&&l==="*"){for(o+=2;o<e.length-1;){if(e[o]==="*"&&e[o+1]==="/"){o+=2;break}o++}continue}n+=i,o++}return n=n.replace(/,(\s*[}\]])/g,"$1"),n}function Ee(e){let n=Le(e);return JSON.parse(n)}function q(){return Z(U)}async function _e(){return N()}function N(){let e=U;if(!Z(e))return{success:!1,error:"Config file does not exist",path:e};try{let n=he(e,"utf-8");if(!n.trim())return{success:!0,config:{},path:e};let o=Ee(n),t=G.safeParse(o);return t.success?{success:!0,config:t.data,path:e}:{success:!1,error:`Config file has invalid structure: ${t.error.issues[0]?.message??"unknown error"}`,path:e}}catch(n){return{success:!1,error:`Failed to parse config file: ${n instanceof Error?n.message:"Unknown error"}`,path:e}}}function be(){return U}function ve(){return H.home}function Ae(e,n){if(e==null)return null;if(typeof e!="string")return`${n}: Must be a string`;try{let o=new URL(e);return["http:","https:"].includes(o.protocol)?null:`${n}: Only http/https URLs allowed`}catch{return`${n}: Invalid URL format`}}function $(e,n,o,t){return e==null?null:typeof e!="number"||isNaN(e)?`${n}: Must be a number`:e<o||e>t?`${n}: Must be between ${o} and ${t}`:null}function W(e,n){return e==null?null:typeof e!="boolean"?`${n}: Must be a boolean`:null}function ee(e,n){if(e==null)return null;if(!Array.isArray(e))return`${n}: Must be an array`;for(let o=0;o<e.length;o++)if(typeof e[o]!="string")return`${n}[${o}]: Must be a string`;return null}function we(e){let n=[];for(let o=0;o<e.length;o++){let t=e[o];typeof t=="string"&&(t.trim()===""?n.push(`local.allowedPaths[${o}]: empty or whitespace-only path`):!t.startsWith("/")&&!t.startsWith("~")?n.push(`local.allowedPaths[${o}]: must be absolute path or start with ~ (got "${t}")`):t.includes("..")&&n.push(`local.allowedPaths[${o}]: path traversal (..) not allowed (got "${t}")`))}return n}function j(e,n){return e===void 0||e===null?null:ee(e,n)}function ne(e,n){return e==null?null:typeof e!="string"?`${n}: Must be a string`:null}function ye(e,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){n.push("github: Must be an object");return}let t=Ae(e.apiUrl,"github.apiUrl");t&&n.push(t)}function xe(e,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){n.push("local: Must be an object");return}let o=e,t=W(o.enabled,"local.enabled");t&&n.push(t);let r=W(o.enableClone,"local.enableClone");r&&n.push(r);let i=ee(o.allowedPaths,"local.allowedPaths");if(i)n.push(i);else if(Array.isArray(o.allowedPaths)){let l=we(o.allowedPaths);n.push(...l)}if(o.workspaceRoot!==void 0&&o.workspaceRoot!==null){let l=ne(o.workspaceRoot,"local.workspaceRoot");l?n.push(l):typeof o.workspaceRoot=="string"&&!o.workspaceRoot.startsWith("/")&&!o.workspaceRoot.startsWith("~")?n.push('local.workspaceRoot: must be an absolute path or start with ~ (got "'+o.workspaceRoot+'")'):typeof o.workspaceRoot=="string"&&o.workspaceRoot.includes("..")&&n.push('local.workspaceRoot: path traversal (..) not allowed (got "'+o.workspaceRoot+'")')}}function Ue(e,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){n.push("tools: Must be an object");return}let o=e,t=j(o.enabled,"tools.enabled");t&&n.push(t);let r=j(o.enableAdditional,"tools.enableAdditional");r&&n.push(r);let i=j(o.disabled,"tools.disabled");i&&n.push(i)}function Ne(e,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){n.push("network: Must be an object");return}let o=e,t=$(o.timeout,"network.timeout",m,O);t&&n.push(t);let r=$(o.maxRetries,"network.maxRetries",R,T);r&&n.push(r)}function ke(e,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){n.push("telemetry: Must be an object");return}let t=W(e.logging,"telemetry.logging");t&&n.push(t)}function Se(e,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){n.push("lsp: Must be an object");return}let t=ne(e.configPath,"lsp.configPath");t&&n.push(t)}function Ie(e,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){n.push("output: Must be an object");return}let o=e;if(o.format!==void 0&&(typeof o.format!="string"?n.push("output.format: Must be a string"):["yaml","json"].includes(o.format)||n.push("output.format: Must be one of: yaml, json")),o.pagination!==void 0&&o.pagination!==null)if(typeof o.pagination!="object"||Array.isArray(o.pagination))n.push("output.pagination: Must be an object");else{let t=o.pagination,r=$(t.defaultCharLength,"output.pagination.defaultCharLength",h,L);r&&n.push(r)}}function B(e){let n=[],o=[];if(typeof e!="object"||e===null||Array.isArray(e))return{valid:!1,errors:["Configuration must be a JSON object"],warnings:[]};let t=e;t.version!==void 0&&(typeof t.version!="number"||!Number.isInteger(t.version)?n.push("version: Must be an integer"):t.version>1&&o.push(`version: Config version ${t.version} is newer than supported version ${1}`)),ye(t.github,n),xe(t.local,n),Ue(t.tools,n),Ne(t.network,n),ke(t.telemetry,n),Se(t.lsp,n),Ie(t.output,n);let r=new Set(["$schema","version","github","local","tools","network","telemetry","lsp","output"]);for(let i of Object.keys(t))r.has(i)||o.push(`Unknown configuration key: ${i}`);return{valid:n.length===0,errors:n,warnings:o,config:n.length===0?e:void 0}}var Me=null;function Pe(e){let n=`[${e.module}]`,o=e.data&&Object.keys(e.data).length>0?` ${JSON.stringify(e.data)}`:"";process.stderr.write(`${n} ${e.level}: ${e.message}${o}
|
|
10
|
+
`)}function X(e){function n(o,t,r){let i={level:o,module:e,message:t,...r&&{data:r}};(Me??Pe)(i)}return{debug:(o,t)=>n("debug",o,t),info:(o,t)=>n("info",o,t),warn:(o,t)=>n("warn",o,t),error:(o,t)=>n("error",o,t)}}var V="__octocodeRuntimeSurface__";function Fe(e){globalThis[V]=e}function K(){return globalThis[V]??"mcp"}function De(){delete globalThis[V]}function oe(e){if(e==null)return;let n=e.trim().toLowerCase();if(n!==""){if(n==="true"||n==="1")return!0;if(n==="false"||n==="0")return!1}}function z(e){if(e==null)return;let n=e.trim();if(n==="")return;let o=parseInt(n,10);if(!isNaN(o))return o}function k(e){if(e==null)return;let n=e.trim();if(n!=="")return n.split(",").map(o=>o.trim()).filter(o=>o.length>0)}function te(e){if(e==null)return;let n=e.trim().toLowerCase();if(n!=="")return!(n==="false"||n==="0")}function re(e){return{apiUrl:process.env.GITHUB_API_URL?.trim()||e?.apiUrl||v.apiUrl}}function ie(e){let n=K()==="cli",o=oe(process.env.ENABLE_LOCAL),t=oe(process.env.ENABLE_CLONE),r=k(process.env.ALLOWED_PATHS),i=process.env.WORKSPACE_ROOT?.trim()||void 0;return{enabled:o??e?.enabled??(n?!0:f.enabled),enableClone:t??e?.enableClone??(n?!0:f.enableClone),allowedPaths:r??e?.allowedPaths??f.allowedPaths,workspaceRoot:i??e?.workspaceRoot??f.workspaceRoot}}function se(e){let n=k(process.env.TOOLS_TO_RUN),o=k(process.env.ENABLE_TOOLS),t=k(process.env.DISABLE_TOOLS);return{enabled:n??e?.enabled??d.enabled,enableAdditional:o??e?.enableAdditional??d.enableAdditional,disabled:t??e?.disabled??d.disabled}}function ue(e){let n=z(process.env.REQUEST_TIMEOUT),o=z(process.env.MAX_RETRIES),t=n??e?.timeout??C.timeout;t=Math.max(m,Math.min(O,t));let r=o??e?.maxRetries??C.maxRetries;return r=Math.max(R,Math.min(T,r)),{timeout:t,maxRetries:r}}function ae(e){return{logging:te(process.env.LOG)??e?.logging??A.logging}}function le(e){return{configPath:(process.env.OCTOCODE_LSP_CONFIG?.trim()||void 0)??e?.configPath??w.configPath}}var He=new Set(["yaml","json"]);function fe(e){let n=process.env.OCTOCODE_OUTPUT_FORMAT?.trim().toLowerCase(),o=z(process.env.OCTOCODE_OUTPUT_DEFAULT_CHAR_LENGTH),t=n||e?.format||g.format,r=o??e?.pagination?.defaultCharLength??g.pagination.defaultCharLength,i=Math.max(h,Math.min(L,r));return{format:He.has(t)?t:g.format,pagination:{defaultCharLength:i}}}var S=X("octocode-config");function J(e,n){let o=e!==void 0,t=process.env.GITHUB_API_URL!==void 0||process.env.ENABLE_LOCAL!==void 0||process.env.ENABLE_CLONE!==void 0||process.env.ALLOWED_PATHS!==void 0||process.env.WORKSPACE_ROOT!==void 0||process.env.TOOLS_TO_RUN!==void 0||process.env.ENABLE_TOOLS!==void 0||process.env.DISABLE_TOOLS!==void 0||process.env.REQUEST_TIMEOUT!==void 0||process.env.MAX_RETRIES!==void 0||process.env.LOG!==void 0||process.env.OCTOCODE_LSP_CONFIG!==void 0||process.env.OCTOCODE_OUTPUT_FORMAT!==void 0||process.env.OCTOCODE_OUTPUT_DEFAULT_CHAR_LENGTH!==void 0,r;return o&&t?r="mixed":o?r="file":r="defaults",{version:e?.version??M.version,github:re(e?.github),local:ie(e?.local),tools:se(e?.tools),network:ue(e?.network),telemetry:ae(e?.telemetry),lsp:le(e?.lsp),output:fe(e?.output),source:r,configPath:o?n:void 0}}function I(){let e=N();if(e.success&&e.config){let n=B(e.config);if(n.warnings.length>0)for(let o of n.warnings)S.warn(`Warning: ${o}`);if(!n.valid){for(let o of n.errors)S.warn(`Validation error: ${o}`);return S.warn("Config file has validation errors \u2014 falling back to defaults with env overrides"),J(void 0)}return J(e.config,e.path)}return e.error&&q()&&S.warn(e.error),J(void 0)}async function ce(){return I()}var c=null,E=0,Ge=6e4;function _(){let e=Date.now();return c&&e-E<Ge||(c=I(),E=e),c}async function Y(){return _()}async function de(){return Q(),Y()}function Q(){c=null,E=0}function ge(){c=null,E=0}function pe(){return{cached:c!==null,timestamp:E}}function qe(e){let n=_(),o=e.split("."),t=n;for(let r of o){if(t==null||typeof t!="object")return;t=t[r]}return t}export{Ce as CONFIG_FILE_NAME,U as CONFIG_FILE_PATH,b as CONFIG_SCHEMA_VERSION,M as DEFAULT_CONFIG,v as DEFAULT_GITHUB_CONFIG,f as DEFAULT_LOCAL_CONFIG,w as DEFAULT_LSP_CONFIG,C as DEFAULT_NETWORK_CONFIG,g as DEFAULT_OUTPUT_CONFIG,A as DEFAULT_TELEMETRY_CONFIG,d as DEFAULT_TOOLS_CONFIG,L as MAX_OUTPUT_DEFAULT_CHAR_LENGTH,T as MAX_RETRIES,O as MAX_TIMEOUT,h as MIN_OUTPUT_DEFAULT_CHAR_LENGTH,R as MIN_RETRIES,m as MIN_TIMEOUT,G as OctocodeConfigSchema,pe as _getCacheState,ge as _resetConfigCache,De as _resetRuntimeSurface,q as configExists,Y as getConfig,be as getConfigPath,_ as getConfigSync,qe as getConfigValue,ve as getOctocodeDir,K as getRuntimeSurface,Q as invalidateConfigCache,_e as loadConfig,N as loadConfigSync,te as parseLoggingEnv,de as reloadConfig,ce as resolveConfig,I as resolveConfigSync,Fe as setRuntimeSurface,B as validateConfig};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LoadConfigResult } from './types.js';
|
|
2
|
+
export declare const CONFIG_FILE_PATH: string;
|
|
3
|
+
export declare function configExists(): boolean;
|
|
4
|
+
export declare function loadConfig(): Promise<LoadConfigResult>;
|
|
5
|
+
export declare function loadConfigSync(): LoadConfigResult;
|
|
6
|
+
export declare function getConfigPath(): string;
|
|
7
|
+
export declare function getOctocodeDir(): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ResolvedConfig } from './types.js';
|
|
2
|
+
export declare function resolveConfigSync(): ResolvedConfig;
|
|
3
|
+
export declare function resolveConfig(): Promise<ResolvedConfig>;
|
|
4
|
+
export declare function getConfigSync(): ResolvedConfig;
|
|
5
|
+
export declare function getConfig(): Promise<ResolvedConfig>;
|
|
6
|
+
export declare function reloadConfig(): Promise<ResolvedConfig>;
|
|
7
|
+
export declare function invalidateConfigCache(): void;
|
|
8
|
+
export declare function _resetConfigCache(): void;
|
|
9
|
+
export declare function _getCacheState(): {
|
|
10
|
+
cached: boolean;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OctocodeConfig, RequiredGitHubConfig, RequiredLocalConfig, RequiredToolsConfig, RequiredNetworkConfig, RequiredTelemetryConfig, RequiredLspConfig, RequiredOutputConfig } from './types.js';
|
|
2
|
+
export declare function parseBooleanEnv(value: string | undefined): boolean | undefined;
|
|
3
|
+
export declare function parseIntEnv(value: string | undefined): number | undefined;
|
|
4
|
+
export declare function parseStringArrayEnv(value: string | undefined): string[] | undefined;
|
|
5
|
+
export declare function parseLoggingEnv(value: string | undefined): boolean | undefined;
|
|
6
|
+
export declare function resolveGitHub(fileConfig?: OctocodeConfig['github']): RequiredGitHubConfig;
|
|
7
|
+
export declare function resolveLocal(fileConfig?: OctocodeConfig['local']): RequiredLocalConfig;
|
|
8
|
+
export declare function resolveTools(fileConfig?: OctocodeConfig['tools']): RequiredToolsConfig;
|
|
9
|
+
export declare function resolveNetwork(fileConfig?: OctocodeConfig['network']): RequiredNetworkConfig;
|
|
10
|
+
export declare function resolveTelemetry(fileConfig?: OctocodeConfig['telemetry']): RequiredTelemetryConfig;
|
|
11
|
+
export declare function resolveLsp(fileConfig?: OctocodeConfig['lsp']): RequiredLspConfig;
|
|
12
|
+
export declare function resolveOutput(fileConfig?: OctocodeConfig['output']): RequiredOutputConfig;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which interface is driving the shared tool core right now.
|
|
3
|
+
*
|
|
4
|
+
* Some config defaults differ by surface (see `resolveLocal`):
|
|
5
|
+
* - `cli`: `ENABLE_LOCAL` is honored and defaults to ENABLED; clone defaults
|
|
6
|
+
* to ENABLED.
|
|
7
|
+
* - `mcp`: `ENABLE_LOCAL` is honored and defaults to DISABLED; clone defaults
|
|
8
|
+
* to DISABLED.
|
|
9
|
+
*
|
|
10
|
+
* Defaults to `mcp`, the primary consumer. The CLI binary calls
|
|
11
|
+
* `setRuntimeSurface('cli')` at startup before any tool runs.
|
|
12
|
+
*
|
|
13
|
+
* State lives on `globalThis` (not a module-level variable) so a single shared
|
|
14
|
+
* value is seen even when bundlers (esbuild) inline this module more than once
|
|
15
|
+
* across different package subpath entry points (`/config`, `/direct`, …).
|
|
16
|
+
*/
|
|
17
|
+
export type RuntimeSurface = 'cli' | 'mcp';
|
|
18
|
+
export declare function setRuntimeSurface(surface: RuntimeSurface): void;
|
|
19
|
+
export declare function getRuntimeSurface(): RuntimeSurface;
|
|
20
|
+
/** Test helper: restore the default surface. */
|
|
21
|
+
export declare function _resetRuntimeSurface(): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const OctocodeConfigSchema: z.ZodObject<{
|
|
3
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
4
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
5
|
+
github: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
6
|
+
local: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
7
|
+
tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
8
|
+
network: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
9
|
+
telemetry: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
10
|
+
lsp: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
11
|
+
output: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
12
|
+
}, z.core.$loose>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export declare const CONFIG_SCHEMA_VERSION = 1;
|
|
2
|
+
export declare const CONFIG_FILE_NAME = ".octocoderc";
|
|
3
|
+
export interface GitHubConfigOptions {
|
|
4
|
+
apiUrl?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface LocalConfigOptions {
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
enableClone?: boolean;
|
|
9
|
+
allowedPaths?: string[];
|
|
10
|
+
workspaceRoot?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ToolsConfigOptions {
|
|
13
|
+
enabled?: string[] | null;
|
|
14
|
+
enableAdditional?: string[] | null;
|
|
15
|
+
disabled?: string[] | null;
|
|
16
|
+
}
|
|
17
|
+
export interface NetworkConfigOptions {
|
|
18
|
+
timeout?: number;
|
|
19
|
+
maxRetries?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface TelemetryConfigOptions {
|
|
22
|
+
logging?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface LspConfigOptions {
|
|
25
|
+
configPath?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface OutputPaginationConfigOptions {
|
|
28
|
+
defaultCharLength?: number;
|
|
29
|
+
}
|
|
30
|
+
export type MinifyMode = 'none' | 'standard' | 'symbols';
|
|
31
|
+
export interface OutputConfigOptions {
|
|
32
|
+
format?: 'yaml' | 'json';
|
|
33
|
+
pagination?: OutputPaginationConfigOptions;
|
|
34
|
+
}
|
|
35
|
+
export interface OctocodeConfig {
|
|
36
|
+
$schema?: string;
|
|
37
|
+
version?: number;
|
|
38
|
+
github?: GitHubConfigOptions;
|
|
39
|
+
local?: LocalConfigOptions;
|
|
40
|
+
tools?: ToolsConfigOptions;
|
|
41
|
+
network?: NetworkConfigOptions;
|
|
42
|
+
telemetry?: TelemetryConfigOptions;
|
|
43
|
+
lsp?: LspConfigOptions;
|
|
44
|
+
output?: OutputConfigOptions;
|
|
45
|
+
}
|
|
46
|
+
export interface RequiredGitHubConfig {
|
|
47
|
+
apiUrl: string;
|
|
48
|
+
}
|
|
49
|
+
export interface RequiredLocalConfig {
|
|
50
|
+
enabled: boolean;
|
|
51
|
+
enableClone: boolean;
|
|
52
|
+
allowedPaths: string[];
|
|
53
|
+
workspaceRoot: string | undefined;
|
|
54
|
+
}
|
|
55
|
+
export interface RequiredToolsConfig {
|
|
56
|
+
enabled: string[] | null;
|
|
57
|
+
enableAdditional: string[] | null;
|
|
58
|
+
disabled: string[] | null;
|
|
59
|
+
}
|
|
60
|
+
export interface RequiredNetworkConfig {
|
|
61
|
+
timeout: number;
|
|
62
|
+
maxRetries: number;
|
|
63
|
+
}
|
|
64
|
+
export interface RequiredTelemetryConfig {
|
|
65
|
+
logging: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface RequiredLspConfig {
|
|
68
|
+
configPath: string | undefined;
|
|
69
|
+
}
|
|
70
|
+
export interface RequiredOutputPaginationConfig {
|
|
71
|
+
defaultCharLength: number;
|
|
72
|
+
}
|
|
73
|
+
export interface RequiredOutputConfig {
|
|
74
|
+
format: 'yaml' | 'json';
|
|
75
|
+
pagination: RequiredOutputPaginationConfig;
|
|
76
|
+
}
|
|
77
|
+
export interface ResolvedConfig {
|
|
78
|
+
version: number;
|
|
79
|
+
github: RequiredGitHubConfig;
|
|
80
|
+
local: RequiredLocalConfig;
|
|
81
|
+
tools: RequiredToolsConfig;
|
|
82
|
+
network: RequiredNetworkConfig;
|
|
83
|
+
telemetry: RequiredTelemetryConfig;
|
|
84
|
+
lsp: RequiredLspConfig;
|
|
85
|
+
output: RequiredOutputConfig;
|
|
86
|
+
source: 'file' | 'defaults' | 'mixed';
|
|
87
|
+
configPath?: string;
|
|
88
|
+
}
|
|
89
|
+
export interface ValidationResult {
|
|
90
|
+
valid: boolean;
|
|
91
|
+
errors: string[];
|
|
92
|
+
warnings: string[];
|
|
93
|
+
config?: OctocodeConfig;
|
|
94
|
+
}
|
|
95
|
+
export interface LoadConfigResult {
|
|
96
|
+
success: boolean;
|
|
97
|
+
config?: OctocodeConfig;
|
|
98
|
+
error?: string;
|
|
99
|
+
path: string;
|
|
100
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { StoredCredentials } from './types.js';
|
|
2
|
+
export declare function invalidateCredentialsCache(hostname?: string): void;
|
|
3
|
+
export declare function _getCacheStats(): {
|
|
4
|
+
size: number;
|
|
5
|
+
entries: Array<{
|
|
6
|
+
hostname: string;
|
|
7
|
+
age: number;
|
|
8
|
+
valid: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
};
|
|
11
|
+
export declare function _resetCredentialsCache(): void;
|
|
12
|
+
export declare function getCachedCredentials(hostname: string): StoredCredentials | null | undefined;
|
|
13
|
+
export declare function setCachedCredentials(hostname: string, credentials: StoredCredentials | null): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CredentialsStore } from './types.js';
|
|
2
|
+
export declare const OCTOCODE_DIR: string;
|
|
3
|
+
export declare const CREDENTIALS_FILE: string;
|
|
4
|
+
export declare const KEY_FILE: string;
|
|
5
|
+
export declare function ensureOctocodeDir(): void;
|
|
6
|
+
export declare function encrypt(data: string): string;
|
|
7
|
+
export declare function decrypt(encryptedData: string): string;
|
|
8
|
+
export declare function readCredentialsStore(): CredentialsStore;
|
|
9
|
+
export declare function writeCredentialsStore(store: CredentialsStore): void;
|
|
10
|
+
export declare function cleanupKeyFile(): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StoredCredentials } from './types.js';
|
|
2
|
+
export declare function normalizeHostname(hostname: string): string;
|
|
3
|
+
export declare function isTokenExpired(credentials: StoredCredentials): boolean;
|
|
4
|
+
export declare function isRefreshTokenExpired(credentials: StoredCredentials): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TokenSource } from './types.js';
|
|
2
|
+
export declare const ENV_TOKEN_VARS: readonly ["OCTOCODE_TOKEN", "GH_TOKEN", "GITHUB_TOKEN"];
|
|
3
|
+
export declare function getTokenFromEnv(): string | null;
|
|
4
|
+
export declare function getEnvTokenSource(): TokenSource;
|
|
5
|
+
export declare function hasEnvToken(): boolean;
|
|
6
|
+
export declare function resolveEnvToken(): {
|
|
7
|
+
token: string;
|
|
8
|
+
source: NonNullable<TokenSource>;
|
|
9
|
+
} | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getGhCliToken(hostname?: string): Promise<string | null>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { OAuthToken, StoredCredentials, StoreResult, DeleteResult, CredentialsStore, TokenSource, } from './types.js';
|
|
2
|
+
export { storeCredentials, getCredentials, type GetCredentialsOptions, getCredentialsSync, deleteCredentials, updateToken, invalidateCredentialsCache, getToken, getTokenSync, resolveToken, type ResolvedToken, getTokenWithRefresh, type TokenWithRefreshResult, resolveTokenWithRefresh, type ResolvedTokenWithRefresh, refreshAuthToken, type RefreshResult, resolveTokenFull, type FullTokenResolution, type GhCliTokenGetter, resetTokenResolution, listStoredHosts, listStoredHostsSync, hasCredentials, hasCredentialsSync, isTokenExpired, isRefreshTokenExpired, getCredentialsFilePath, readCredentialsStore, encrypt, decrypt, ensureOctocodeDir, OCTOCODE_DIR, CREDENTIALS_FILE, KEY_FILE, ENV_TOKEN_VARS, getTokenFromEnv, getEnvTokenSource, hasEnvToken, } from './storage.js';
|
|
3
|
+
export { getGhCliToken } from './ghCli.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __dirname_fn } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __dirname_fn(__filename);
|
|
8
|
+
var pe=null;function ge(e){let t=`[${e.module}]`,r=e.data&&Object.keys(e.data).length>0?` ${JSON.stringify(e.data)}`:"";process.stderr.write(`${t} ${e.level}: ${e.message}${r}
|
|
9
|
+
`)}function R(e){function t(r,n,o){let s={level:r,module:e,message:n,...o&&{data:o}};(pe??ge)(s)}return{debug:(r,n)=>t("debug",r,n),info:(r,n)=>t("info",r,n),warn:(r,n)=>t("warn",r,n),error:(r,n)=>t("error",r,n)}}function c(e){return e.toLowerCase().replace(/^https?:\/\//,"").replace(/\/$/,"")}function d(e){if(!e.token.expiresAt)return!1;let t=new Date(e.token.expiresAt);if(isNaN(t.getTime()))return!0;let r=new Date;return t.getTime()-r.getTime()<300*1e3}function A(e){if(!e.token.refreshTokenExpiresAt)return!1;let t=new Date(e.token.refreshTokenExpiresAt);return isNaN(t.getTime())?!0:new Date>=t}var S=new Map,he=300*1e3;function me(e){let t=c(e),r=S.get(t);return!r||Date.now()-r.cachedAt>=he?!1:r.credentials?!d(r.credentials):!0}function b(e){e?S.delete(c(e)):S.clear()}function $(e){let t=c(e);if(me(t))return S.get(t).credentials}function U(e,t){let r=c(e);S.set(r,{credentials:t,cachedAt:Date.now()})}import{existsSync as _,readFileSync as Y,writeFileSync as q,unlinkSync as Z,statSync as Ae,chmodSync as be}from"node:fs";import{createCipheriv as Oe,createDecipheriv as we,randomBytes as X}from"node:crypto";import{existsSync as xe,mkdirSync as Ce}from"node:fs";import{join as i}from"node:path";import O from"node:os";import ke from"node:path";var w=O.platform()==="win32",P=O.platform()==="darwin",Te=O.platform()==="linux",k=O.homedir();function H(){return w?process.env.APPDATA||ke.join(k,"AppData","Roaming"):k}var F=".octocode",ye=448;function Re(e){let t=process.env[e];return t&&t.trim().length>0?t:void 0}function Se(){return w?i(H(),F):P?i(k,F):i(Re("XDG_CONFIG_HOME")??i(k,".config"),F)}var l=Se(),T={home:l,config:i(l,".octocoderc"),credentials:i(l,"credentials.json"),key:i(l,".key"),session:i(l,"session.json"),stats:i(l,"stats.json"),tmp:i(l,"tmp"),clone:i(l,"tmp","clone"),tree:i(l,"tmp","tree"),binary:i(l,"tmp","binary"),repos:i(l,"tmp","clone"),logs:i(l,"logs"),unzip:i(l,"tmp","unzip"),cliConfig:i(l,"config.json"),lspConfig:i(l,"lsp-servers.json")};function B(){xe(T.home)||Ce(T.home,{recursive:!0,mode:ye})}import{z as a}from"zod";var ve=a.object({token:a.string(),tokenType:a.literal("oauth"),scopes:a.array(a.string()).optional(),refreshToken:a.string().optional(),expiresAt:a.string().optional(),refreshTokenExpiresAt:a.string().optional()}),Ee=a.object({hostname:a.string(),username:a.string(),token:ve,gitProtocol:a.enum(["ssh","https"]),createdAt:a.string(),updatedAt:a.string()}),V=a.object({version:a.number(),credentials:a.record(a.string(),Ee)});var J=R("token-storage");function _e(e){return e.replace(/\b(ghp_|gho_|ghu_|ghs_|ghr_)[a-zA-Z0-9]{36,}\b/g,"***MASKED***").replace(/\b[a-zA-Z0-9]{40,}\b/g,"***MASKED***")}var Q=T.home,u=T.credentials,f=T.key,ee="aes-256-gcm",De=16;function v(){B()}function te(){if(v(),_(f))return Ae(f).mode&511&63&&be(f,384),Buffer.from(Y(f,"utf8"),"hex");let e=X(32);return q(f,e.toString("hex"),{mode:384}),e}function N(e){let t=te(),r=X(De),n=Oe(ee,t,r),o=n.update(e,"utf8","hex");o+=n.final("hex");let s=n.getAuthTag();return`${r.toString("hex")}:${s.toString("hex")}:${o}`}function G(e){let t=te(),[r,n,o]=e.split(":");if(!r||!n||!o)throw new Error("Invalid encrypted data format");let s=Buffer.from(r,"hex"),m=Buffer.from(n,"hex"),h=we(ee,t,s);h.setAuthTag(m);let y=h.update(o,"hex","utf8");return y+=h.final("utf8"),y}function p(){if(v(),!_(u))return{version:1,credentials:{}};try{let e=Y(u,"utf8"),t=G(e),r=JSON.parse(t),n=V.safeParse(r);return n.success?n.data:(J.warn("Credentials file has invalid format \u2014 starting fresh",{file:u}),{version:1,credentials:{}})}catch(e){let t=e instanceof Error&&e.message?_e(e.message):void 0;return J.warn("Could not read credentials file \u2014 you may need to login again",{file:u,...t&&{reason:t}}),{version:1,credentials:{}}}}function I(e){v();let t=N(JSON.stringify(e,null,2));q(u,t,{mode:384})}function re(){try{_(u)&&Z(u),_(f)&&Z(f)}catch{}}import{refreshToken as Le}from"@octokit/oauth-methods";import{request as Pe}from"@octokit/request";var x="178c6fc778ccc68e1d6a",g="github.com";function He(e){return e.replace(/\b(ghp_|gho_|ghu_|ghs_|ghr_)[a-zA-Z0-9]{36,}\b/g,"***MASKED***").replace(/\b[a-zA-Z0-9]{40,}\b/g,"***MASKED***")}function Fe(e){return e==="github.com"||e===g?"https://api.github.com":`https://${e}/api/v3`}async function M(e,t=g,r=x){let n=await e.getCredentials(t);if(!n)return{success:!1,error:`Not logged in to ${t}`};if(!n.token.refreshToken)return{success:!1,error:"Token does not support refresh (OAuth App tokens do not expire)"};if(A(n))return{success:!1,error:"Refresh token has expired. Please login again."};try{let o=await Le({clientType:"github-app",clientId:r,clientSecret:"",refreshToken:n.token.refreshToken,request:Pe.defaults({baseUrl:Fe(t)})}),s={token:o.authentication.token,tokenType:"oauth",refreshToken:o.authentication.refreshToken,expiresAt:o.authentication.expiresAt,refreshTokenExpiresAt:o.authentication.refreshTokenExpiresAt};return await e.updateToken(t,s),{success:!0,username:n.username,hostname:t}}catch(o){return{success:!1,error:o instanceof Error?He(o.message):"Token refresh failed"}}}async function ne(e,t=g,r=x){let n=await e.getCredentials(t);if(!n||!n.token)return{token:null,source:"none"};if(!d(n))return{token:n.token.token,source:"stored",username:n.username};if(n.token.refreshToken){let o=await M(e,t,r);if(o.success){let s=await e.getCredentials(t);if(s?.token.token)return{token:s.token.token,source:"refreshed",username:s.username}}return{token:null,source:"none",refreshError:o.error}}return{token:null,source:"none",refreshError:"Token expired and no refresh token available"}}var E=["OCTOCODE_TOKEN","GH_TOKEN","GITHUB_TOKEN"];function W(){for(let e of E){let t=process.env[e];if(t&&t.trim())return t.trim()}return null}function oe(){for(let e of E){let t=process.env[e];if(t&&t.trim())return`env:${e}`}return null}function se(){return W()!==null}function ie(){for(let e of E){let t=process.env[e];if(t?.trim())return{token:t.trim(),source:`env:${e}`}}return null}import{execFile as Ne}from"child_process";var Ge=["/opt/homebrew/bin","/usr/local/bin","/home/linuxbrew/.linuxbrew/bin"];function j(e){return new Promise(t=>{let r=["auth","token"];e&&r.push("--hostname",e);let n=process.env.PATH??"",o=new Set(n.split(":")),s=Ge.filter(h=>!o.has(h)),m=s.length?`${s.join(":")}:${n}`:n;Ne("gh",r,{encoding:"utf8",timeout:5e3,env:{...process.env,PATH:m}},(h,y)=>{if(h||!y){t(null);return}t(y.trim()||null)})})}var D=null;function ae(e){D=e}function le(){D=null}function Ie(){if(!D)throw new Error("Token resolution not initialized. Call initTokenResolution() first.");return D}async function L(e){let t=e?.hostname??g,r=e?.clientId??x,n=e?.getGhCliToken??j,o=ie();if(o)return{token:o.token,source:o.source,wasRefreshed:!1};let s=await Ie().getTokenWithRefresh(t,r);if(s.token)return{token:s.token,source:"octocode-storage",wasRefreshed:s.source==="refreshed",username:s.username};try{let m=await Promise.resolve(n(t));if(m?.trim())return{token:m.trim(),source:"gh-cli",wasRefreshed:!1}}catch{}return null}async function ce(e=g){let t=await L({hostname:e,getGhCliToken:()=>null});return t?{token:t.token,source:t.source}:null}async function ue(e=g,t=x){let r=await L({hostname:e,clientId:t,getGhCliToken:()=>null});return r?{token:r.token,source:r.source,wasRefreshed:r.wasRefreshed,username:r.username}:null}var Me=R("token-storage");async function fe(e){let t=c(e.hostname),r={...e,hostname:t,updatedAt:new Date().toISOString()};try{let n=p();return n.credentials[t]=r,I(n),b(t),{success:!0}}catch(n){let o=n instanceof Error?n.message:String(n);throw Me.error("CRITICAL: Storage failed",{error:o.replace(/\b(ghp_|gho_|ghu_|ghs_|ghr_)[a-zA-Z0-9]{36,}\b/g,"***MASKED***").replace(/\b[a-zA-Z0-9]{40,}\b/g,"***MASKED***")}),new Error("Failed to store credentials")}}async function C(e="github.com",t){let r=c(e);if(!t?.bypassCache){let s=$(r);if(s!==void 0)return s}let o=p().credentials[r]||null;return U(r,o),o}function z(e="github.com"){let t=c(e);return p().credentials[t]||null}async function We(e="github.com"){let t=c(e),r=!1,n=p();return n.credentials[t]&&(delete n.credentials[t],Object.keys(n.credentials).length===0?re():I(n),r=!0),b(t),{success:r,deletedFromFile:r}}async function je(){let e=p();return Object.keys(e.credentials)}function ze(){let e=p();return Object.keys(e.credentials)}async function Ke(e="github.com"){return await C(e)!==null}function $e(e="github.com"){return z(e)!==null}async function K(e,t){let r=await C(e);return r?(r.token=t,r.updatedAt=new Date().toISOString(),await fe(r),!0):!1}function Ue(){return u}async function Be(e="github.com"){let t=await C(e);return!t||!t.token||d(t)?null:t.token.token}function Ve(e="github.com"){let t=z(e);return!t||!t.token||d(t)?null:t.token.token}async function Ze(e,t){return M({getCredentials:C,updateToken:K},e,t)}async function de(e,t){return ne({getCredentials:C,updateToken:K},e,t)}ae({getTokenWithRefresh:de});export{u as CREDENTIALS_FILE,E as ENV_TOKEN_VARS,f as KEY_FILE,Q as OCTOCODE_DIR,G as decrypt,We as deleteCredentials,N as encrypt,v as ensureOctocodeDir,C as getCredentials,Ue as getCredentialsFilePath,z as getCredentialsSync,oe as getEnvTokenSource,j as getGhCliToken,Be as getToken,W as getTokenFromEnv,Ve as getTokenSync,de as getTokenWithRefresh,Ke as hasCredentials,$e as hasCredentialsSync,se as hasEnvToken,b as invalidateCredentialsCache,A as isRefreshTokenExpired,d as isTokenExpired,je as listStoredHosts,ze as listStoredHostsSync,p as readCredentialsStore,Ze as refreshAuthToken,le as resetTokenResolution,ce as resolveToken,L as resolveTokenFull,ue as resolveTokenWithRefresh,fe as storeCredentials,K as updateToken};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const CredentialsStoreSchema: z.ZodObject<{
|
|
3
|
+
version: z.ZodNumber;
|
|
4
|
+
credentials: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
5
|
+
hostname: z.ZodString;
|
|
6
|
+
username: z.ZodString;
|
|
7
|
+
token: z.ZodObject<{
|
|
8
|
+
token: z.ZodString;
|
|
9
|
+
tokenType: z.ZodLiteral<"oauth">;
|
|
10
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
11
|
+
refreshToken: z.ZodOptional<z.ZodString>;
|
|
12
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
13
|
+
refreshTokenExpiresAt: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
gitProtocol: z.ZodEnum<{
|
|
16
|
+
ssh: "ssh";
|
|
17
|
+
https: "https";
|
|
18
|
+
}>;
|
|
19
|
+
createdAt: z.ZodString;
|
|
20
|
+
updatedAt: z.ZodString;
|
|
21
|
+
}, z.core.$strip>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { StoredCredentials, StoreResult, DeleteResult } from './types.js';
|
|
2
|
+
import { invalidateCredentialsCache, _getCacheStats, _resetCredentialsCache } from './credentialCache.js';
|
|
3
|
+
import { OCTOCODE_DIR, CREDENTIALS_FILE, KEY_FILE, encrypt, decrypt, ensureOctocodeDir, readCredentialsStore, writeCredentialsStore } from './credentialEncryption.js';
|
|
4
|
+
import { type RefreshResult, type TokenWithRefreshResult } from './tokenRefresh.js';
|
|
5
|
+
import { resolveToken, type ResolvedToken, resolveTokenWithRefresh, type ResolvedTokenWithRefresh, resolveTokenFull, type FullTokenResolution, type GhCliTokenGetter, resetTokenResolution } from './tokenResolution.js';
|
|
6
|
+
import { getTokenFromEnv, getEnvTokenSource, hasEnvToken, ENV_TOKEN_VARS } from './envTokens.js';
|
|
7
|
+
import { isTokenExpired, isRefreshTokenExpired } from './credentialUtils.js';
|
|
8
|
+
export { getTokenFromEnv, getEnvTokenSource, hasEnvToken, ENV_TOKEN_VARS };
|
|
9
|
+
export declare function storeCredentials(credentials: StoredCredentials): Promise<StoreResult>;
|
|
10
|
+
export interface GetCredentialsOptions {
|
|
11
|
+
bypassCache?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function getCredentials(hostname?: string, options?: GetCredentialsOptions): Promise<StoredCredentials | null>;
|
|
14
|
+
export declare function getCredentialsSync(hostname?: string): StoredCredentials | null;
|
|
15
|
+
export declare function deleteCredentials(hostname?: string): Promise<DeleteResult>;
|
|
16
|
+
export declare function listStoredHosts(): Promise<string[]>;
|
|
17
|
+
export declare function listStoredHostsSync(): string[];
|
|
18
|
+
export declare function hasCredentials(hostname?: string): Promise<boolean>;
|
|
19
|
+
export declare function hasCredentialsSync(hostname?: string): boolean;
|
|
20
|
+
export declare function updateToken(hostname: string, token: StoredCredentials['token']): Promise<boolean>;
|
|
21
|
+
export declare function getCredentialsFilePath(): string;
|
|
22
|
+
export declare function getToken(hostname?: string): Promise<string | null>;
|
|
23
|
+
export declare function getTokenSync(hostname?: string): string | null;
|
|
24
|
+
export { invalidateCredentialsCache, _getCacheStats, _resetCredentialsCache };
|
|
25
|
+
export { encrypt, decrypt, ensureOctocodeDir, readCredentialsStore, writeCredentialsStore, OCTOCODE_DIR, CREDENTIALS_FILE, KEY_FILE, };
|
|
26
|
+
export declare function refreshAuthToken(hostname?: string, clientId?: string): Promise<RefreshResult>;
|
|
27
|
+
export declare function getTokenWithRefresh(hostname?: string, clientId?: string): Promise<TokenWithRefreshResult>;
|
|
28
|
+
export type { RefreshResult, TokenWithRefreshResult };
|
|
29
|
+
export { resolveToken, resolveTokenWithRefresh, resolveTokenFull, resetTokenResolution, type ResolvedToken, type ResolvedTokenWithRefresh, type FullTokenResolution, type GhCliTokenGetter, };
|
|
30
|
+
export { isTokenExpired, isRefreshTokenExpired };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __dirname_fn } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __dirname_fn(__filename);
|
|
8
|
+
function o(e){return e.toLowerCase().replace(/^https?:\/\//,"").replace(/\/$/,"")}function s(e){if(!e.token.expiresAt)return!1;let n=new Date(e.token.expiresAt);if(isNaN(n.getTime()))return!0;let t=new Date;return n.getTime()-t.getTime()<300*1e3}var r=new Map,i=300*1e3;function l(e){let n=o(e),t=r.get(n);return!t||Date.now()-t.cachedAt>=i?!1:t.credentials?!s(t.credentials):!0}function a(){let e=Date.now();return{size:r.size,entries:Array.from(r.entries()).map(([n,t])=>({hostname:n,age:e-t.cachedAt,valid:l(n)}))}}function u(){r.clear()}import{execFile as g}from"child_process";var c=null;function f(){c=null}export{a as _getCacheStats,u as _resetCredentialsCache,f as resetTokenResolution};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { OAuthToken, StoredCredentials } from './types.js';
|
|
2
|
+
export interface RefreshResult {
|
|
3
|
+
success: boolean;
|
|
4
|
+
username?: string;
|
|
5
|
+
hostname?: string;
|
|
6
|
+
error?: string;
|
|
7
|
+
}
|
|
8
|
+
type GetCredentialsFn = (hostname?: string) => Promise<StoredCredentials | null>;
|
|
9
|
+
type UpdateTokenFn = (hostname: string, token: OAuthToken) => Promise<boolean>;
|
|
10
|
+
export declare function refreshAuthToken(deps: {
|
|
11
|
+
getCredentials: GetCredentialsFn;
|
|
12
|
+
updateToken: UpdateTokenFn;
|
|
13
|
+
}, hostname?: string, clientId?: string): Promise<RefreshResult>;
|
|
14
|
+
export interface TokenWithRefreshResult {
|
|
15
|
+
token: string | null;
|
|
16
|
+
source: 'stored' | 'refreshed' | 'none';
|
|
17
|
+
username?: string;
|
|
18
|
+
refreshError?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function getTokenWithRefresh(deps: {
|
|
21
|
+
getCredentials: GetCredentialsFn;
|
|
22
|
+
updateToken: UpdateTokenFn;
|
|
23
|
+
}, hostname?: string, clientId?: string): Promise<TokenWithRefreshResult>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { TokenSource } from './types.js';
|
|
2
|
+
import type { TokenWithRefreshResult } from './tokenRefresh.js';
|
|
3
|
+
interface StorageDeps {
|
|
4
|
+
getTokenWithRefresh: (hostname?: string, clientId?: string) => Promise<TokenWithRefreshResult>;
|
|
5
|
+
}
|
|
6
|
+
export declare function initTokenResolution(deps: StorageDeps): void;
|
|
7
|
+
export declare function resetTokenResolution(): void;
|
|
8
|
+
export interface FullTokenResolution {
|
|
9
|
+
token: string;
|
|
10
|
+
source: TokenSource | 'gh-cli';
|
|
11
|
+
wasRefreshed?: boolean;
|
|
12
|
+
username?: string;
|
|
13
|
+
}
|
|
14
|
+
export type GhCliTokenGetter = (hostname?: string) => string | null | Promise<string | null>;
|
|
15
|
+
export declare function resolveTokenFull(options?: {
|
|
16
|
+
hostname?: string;
|
|
17
|
+
clientId?: string;
|
|
18
|
+
getGhCliToken?: GhCliTokenGetter;
|
|
19
|
+
}): Promise<FullTokenResolution | null>;
|
|
20
|
+
export interface ResolvedToken {
|
|
21
|
+
token: string;
|
|
22
|
+
source: TokenSource;
|
|
23
|
+
}
|
|
24
|
+
export declare function resolveToken(hostname?: string): Promise<ResolvedToken | null>;
|
|
25
|
+
export interface ResolvedTokenWithRefresh extends ResolvedToken {
|
|
26
|
+
wasRefreshed?: boolean;
|
|
27
|
+
username?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function resolveTokenWithRefresh(hostname?: string, clientId?: string): Promise<ResolvedTokenWithRefresh | null>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface OAuthToken {
|
|
2
|
+
token: string;
|
|
3
|
+
tokenType: 'oauth';
|
|
4
|
+
scopes?: string[];
|
|
5
|
+
refreshToken?: string;
|
|
6
|
+
expiresAt?: string;
|
|
7
|
+
refreshTokenExpiresAt?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface StoredCredentials {
|
|
10
|
+
hostname: string;
|
|
11
|
+
username: string;
|
|
12
|
+
token: OAuthToken;
|
|
13
|
+
gitProtocol: 'ssh' | 'https';
|
|
14
|
+
createdAt: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
}
|
|
17
|
+
export interface StoreResult {
|
|
18
|
+
success: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface DeleteResult {
|
|
21
|
+
success: boolean;
|
|
22
|
+
deletedFromFile: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface CredentialsStore {
|
|
25
|
+
version: number;
|
|
26
|
+
credentials: Record<string, StoredCredentials>;
|
|
27
|
+
}
|
|
28
|
+
export type TokenSource = 'env:OCTOCODE_TOKEN' | 'env:GH_TOKEN' | 'env:GITHUB_TOKEN' | 'octocode-storage' | 'gh-cli' | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __dirname_fn } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __dirname_fn(__filename);
|
|
8
|
+
import{existsSync as f,readdirSync as u,lstatSync as l}from"node:fs";import{join as m}from"node:path";function a(n){if(!f(n))return 0;let r=0,t=[n];for(;t.length>0;){let e=t.pop(),o;try{o=u(e)}catch{continue}for(let s of o){let c=m(e,s);try{let i=l(c);if(i.isSymbolicLink())continue;i.isDirectory()?t.push(c):i.isFile()&&(r+=i.size)}catch{}}}return r}function d(n){if(n<1024)return`${n} B`;let r=n/1024;if(r<1024)return`${r.toFixed(1)} KB`;let t=r/1024;return t<1024?`${t.toFixed(1)} MB`:`${(t/1024).toFixed(2)} GB`}export{d as formatBytes,a as getDirectorySizeBytes};
|