oh-my-opencode 0.3.3 → 0.4.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/README.ko.md +162 -37
- package/README.md +160 -35
- package/dist/auth/antigravity/constants.d.ts +36 -0
- package/dist/auth/antigravity/fetch.d.ts +68 -0
- package/dist/auth/antigravity/index.d.ts +13 -0
- package/dist/auth/antigravity/message-converter.d.ts +54 -0
- package/dist/auth/antigravity/oauth.d.ts +85 -0
- package/dist/auth/antigravity/plugin.d.ts +54 -0
- package/dist/auth/antigravity/project.d.ts +20 -0
- package/dist/auth/antigravity/request.d.ts +104 -0
- package/dist/auth/antigravity/response.d.ts +137 -0
- package/dist/auth/antigravity/thinking.d.ts +234 -0
- package/dist/auth/antigravity/thought-signature-store.d.ts +52 -0
- package/dist/auth/antigravity/token.d.ts +41 -0
- package/dist/auth/antigravity/tools.d.ts +119 -0
- package/dist/auth/antigravity/types.d.ts +173 -0
- package/dist/config/schema.d.ts +454 -80
- package/dist/features/background-agent/index.d.ts +2 -0
- package/dist/features/background-agent/manager.d.ts +37 -0
- package/dist/features/background-agent/types.d.ts +27 -0
- package/dist/google-auth.d.ts +3 -0
- package/dist/hooks/anthropic-auto-compact/types.d.ts +11 -0
- package/dist/hooks/auto-update-checker/cache.d.ts +1 -0
- package/dist/hooks/auto-update-checker/checker.d.ts +6 -0
- package/dist/hooks/auto-update-checker/constants.d.ts +8 -0
- package/dist/hooks/auto-update-checker/index.d.ts +12 -0
- package/dist/hooks/auto-update-checker/types.d.ts +19 -0
- package/dist/hooks/background-notification/index.d.ts +12 -0
- package/dist/hooks/background-notification/types.d.ts +4 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/rules-injector/constants.d.ts +6 -0
- package/dist/hooks/rules-injector/finder.d.ts +45 -0
- package/dist/hooks/rules-injector/index.d.ts +22 -0
- package/dist/hooks/rules-injector/matcher.d.ts +21 -0
- package/dist/hooks/rules-injector/parser.d.ts +18 -0
- package/dist/hooks/rules-injector/storage.d.ts +9 -0
- package/dist/hooks/rules-injector/types.d.ts +41 -0
- package/dist/hooks/session-recovery/storage.d.ts +1 -0
- package/dist/index.js +4320 -1445
- package/dist/tools/ast-grep/index.d.ts +4 -4
- package/dist/tools/ast-grep/tools.d.ts +4 -4
- package/dist/tools/background-task/constants.d.ts +3 -0
- package/dist/tools/background-task/index.d.ts +3 -0
- package/dist/tools/background-task/tools.d.ts +39 -0
- package/dist/tools/background-task/types.d.ts +13 -0
- package/dist/tools/call-omo-agent/constants.d.ts +2 -0
- package/dist/tools/call-omo-agent/index.d.ts +3 -0
- package/dist/tools/call-omo-agent/tools.d.ts +22 -0
- package/dist/tools/call-omo-agent/types.d.ts +24 -0
- package/dist/tools/index.d.ts +47 -6
- package/dist/tools/lsp/tools.d.ts +2 -2
- package/package.json +11 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function invalidateCache(): boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { UpdateCheckResult } from "./types";
|
|
2
|
+
export declare function isLocalDevMode(directory: string): boolean;
|
|
3
|
+
export declare function findPluginEntry(directory: string): string | null;
|
|
4
|
+
export declare function getCachedVersion(): string | null;
|
|
5
|
+
export declare function getLatestVersion(): Promise<string | null>;
|
|
6
|
+
export declare function checkForUpdate(directory: string): Promise<UpdateCheckResult>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const PACKAGE_NAME = "oh-my-opencode";
|
|
2
|
+
export declare const NPM_REGISTRY_URL = "https://registry.npmjs.org/-/package/oh-my-opencode/dist-tags";
|
|
3
|
+
export declare const NPM_FETCH_TIMEOUT = 5000;
|
|
4
|
+
export declare const CACHE_DIR: string;
|
|
5
|
+
export declare const VERSION_FILE: string;
|
|
6
|
+
export declare const INSTALLED_PACKAGE_JSON: string;
|
|
7
|
+
export declare const USER_CONFIG_DIR: string;
|
|
8
|
+
export declare const USER_OPENCODE_CONFIG: string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
export declare function createAutoUpdateCheckerHook(ctx: PluginInput): {
|
|
3
|
+
event: ({ event }: {
|
|
4
|
+
event: {
|
|
5
|
+
type: string;
|
|
6
|
+
properties?: unknown;
|
|
7
|
+
};
|
|
8
|
+
}) => Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
export type { UpdateCheckResult } from "./types";
|
|
11
|
+
export { checkForUpdate } from "./checker";
|
|
12
|
+
export { invalidateCache } from "./cache";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface NpmDistTags {
|
|
2
|
+
latest: string;
|
|
3
|
+
[key: string]: string;
|
|
4
|
+
}
|
|
5
|
+
export interface OpencodeConfig {
|
|
6
|
+
plugin?: string[];
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface PackageJson {
|
|
10
|
+
version: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface UpdateCheckResult {
|
|
15
|
+
needsUpdate: boolean;
|
|
16
|
+
currentVersion: string | null;
|
|
17
|
+
latestVersion: string | null;
|
|
18
|
+
isLocalDev: boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BackgroundManager } from "../../features/background-agent";
|
|
2
|
+
interface Event {
|
|
3
|
+
type: string;
|
|
4
|
+
properties?: Record<string, unknown>;
|
|
5
|
+
}
|
|
6
|
+
interface EventInput {
|
|
7
|
+
event: Event;
|
|
8
|
+
}
|
|
9
|
+
export declare function createBackgroundNotificationHook(manager: BackgroundManager): {
|
|
10
|
+
event: ({ event }: EventInput) => Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
export type { BackgroundNotificationHookConfig } from "./types";
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -10,3 +10,6 @@ export { createEmptyTaskResponseDetectorHook } from "./empty-task-response-detec
|
|
|
10
10
|
export { createAnthropicAutoCompactHook } from "./anthropic-auto-compact";
|
|
11
11
|
export { createThinkModeHook } from "./think-mode";
|
|
12
12
|
export { createClaudeCodeHooksHook } from "./claude-code-hooks";
|
|
13
|
+
export { createRulesInjectorHook } from "./rules-injector";
|
|
14
|
+
export { createBackgroundNotificationHook } from "./background-notification";
|
|
15
|
+
export { createAutoUpdateCheckerHook } from "./auto-update-checker";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const OPENCODE_STORAGE: string;
|
|
2
|
+
export declare const RULES_INJECTOR_STORAGE: string;
|
|
3
|
+
export declare const PROJECT_MARKERS: string[];
|
|
4
|
+
export declare const PROJECT_RULE_SUBDIRS: [string, string][];
|
|
5
|
+
export declare const USER_RULE_DIR = ".claude/rules";
|
|
6
|
+
export declare const RULE_EXTENSIONS: string[];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Candidate rule file with metadata for filtering and sorting
|
|
3
|
+
*/
|
|
4
|
+
export interface RuleFileCandidate {
|
|
5
|
+
/** Absolute path to the rule file */
|
|
6
|
+
path: string;
|
|
7
|
+
/** Real path after symlink resolution (for duplicate detection) */
|
|
8
|
+
realPath: string;
|
|
9
|
+
/** Whether this is a global/user-level rule */
|
|
10
|
+
isGlobal: boolean;
|
|
11
|
+
/** Directory distance from current file (9999 for global rules) */
|
|
12
|
+
distance: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Find project root by walking up from startPath.
|
|
16
|
+
* Checks for PROJECT_MARKERS (.git, pyproject.toml, package.json, etc.)
|
|
17
|
+
*
|
|
18
|
+
* @param startPath - Starting path to search from (file or directory)
|
|
19
|
+
* @returns Project root path or null if not found
|
|
20
|
+
*/
|
|
21
|
+
export declare function findProjectRoot(startPath: string): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Calculate directory distance between a rule file and current file.
|
|
24
|
+
* Distance is based on common ancestor within project root.
|
|
25
|
+
*
|
|
26
|
+
* @param rulePath - Path to the rule file
|
|
27
|
+
* @param currentFile - Path to the current file being edited
|
|
28
|
+
* @param projectRoot - Project root for relative path calculation
|
|
29
|
+
* @returns Distance (0 = same directory, higher = further)
|
|
30
|
+
*/
|
|
31
|
+
export declare function calculateDistance(rulePath: string, currentFile: string, projectRoot: string | null): number;
|
|
32
|
+
/**
|
|
33
|
+
* Find all rule files for a given context.
|
|
34
|
+
* Searches from currentFile upward to projectRoot for rule directories,
|
|
35
|
+
* then user-level directory (~/.claude/rules).
|
|
36
|
+
*
|
|
37
|
+
* IMPORTANT: This searches EVERY directory from file to project root.
|
|
38
|
+
* Not just the project root itself.
|
|
39
|
+
*
|
|
40
|
+
* @param projectRoot - Project root path (or null if outside any project)
|
|
41
|
+
* @param homeDir - User home directory
|
|
42
|
+
* @param currentFile - Current file being edited (for distance calculation)
|
|
43
|
+
* @returns Array of rule file candidates sorted by distance
|
|
44
|
+
*/
|
|
45
|
+
export declare function findRuleFiles(projectRoot: string | null, homeDir: string, currentFile: string): RuleFileCandidate[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
interface ToolExecuteInput {
|
|
3
|
+
tool: string;
|
|
4
|
+
sessionID: string;
|
|
5
|
+
callID: string;
|
|
6
|
+
}
|
|
7
|
+
interface ToolExecuteOutput {
|
|
8
|
+
title: string;
|
|
9
|
+
output: string;
|
|
10
|
+
metadata: unknown;
|
|
11
|
+
}
|
|
12
|
+
interface EventInput {
|
|
13
|
+
event: {
|
|
14
|
+
type: string;
|
|
15
|
+
properties?: unknown;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare function createRulesInjectorHook(ctx: PluginInput): {
|
|
19
|
+
"tool.execute.after": (input: ToolExecuteInput, output: ToolExecuteOutput) => Promise<void>;
|
|
20
|
+
event: ({ event }: EventInput) => Promise<void>;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RuleMetadata } from "./types";
|
|
2
|
+
export interface MatchResult {
|
|
3
|
+
applies: boolean;
|
|
4
|
+
reason?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Check if a rule should apply to the current file based on metadata
|
|
8
|
+
*/
|
|
9
|
+
export declare function shouldApplyRule(metadata: RuleMetadata, currentFilePath: string, projectRoot: string | null): MatchResult;
|
|
10
|
+
/**
|
|
11
|
+
* Check if realPath already exists in cache (symlink deduplication)
|
|
12
|
+
*/
|
|
13
|
+
export declare function isDuplicateByRealPath(realPath: string, cache: Set<string>): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Create SHA-256 hash of content, truncated to 16 chars
|
|
16
|
+
*/
|
|
17
|
+
export declare function createContentHash(content: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Check if content hash already exists in cache
|
|
20
|
+
*/
|
|
21
|
+
export declare function isDuplicateByContentHash(hash: string, cache: Set<string>): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RuleMetadata } from "./types";
|
|
2
|
+
export interface RuleFrontmatterResult {
|
|
3
|
+
metadata: RuleMetadata;
|
|
4
|
+
body: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Parse YAML frontmatter from rule file content
|
|
8
|
+
* Supports:
|
|
9
|
+
* - Single string: globs: "**\/*.py"
|
|
10
|
+
* - Inline array: globs: ["**\/*.py", "src/**\/*.ts"]
|
|
11
|
+
* - Multi-line array:
|
|
12
|
+
* globs:
|
|
13
|
+
* - "**\/*.py"
|
|
14
|
+
* - "src/**\/*.ts"
|
|
15
|
+
* - Comma-separated: globs: "**\/*.py, src/**\/*.ts"
|
|
16
|
+
* - Claude Code 'paths' field (alias for globs)
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseRuleFrontmatter(content: string): RuleFrontmatterResult;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function loadInjectedRules(sessionID: string): {
|
|
2
|
+
contentHashes: Set<string>;
|
|
3
|
+
realPaths: Set<string>;
|
|
4
|
+
};
|
|
5
|
+
export declare function saveInjectedRules(sessionID: string, data: {
|
|
6
|
+
contentHashes: Set<string>;
|
|
7
|
+
realPaths: Set<string>;
|
|
8
|
+
}): void;
|
|
9
|
+
export declare function clearInjectedRules(sessionID: string): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rule file metadata (Claude Code style frontmatter)
|
|
3
|
+
* @see https://docs.anthropic.com/en/docs/claude-code/settings#rule-files
|
|
4
|
+
*/
|
|
5
|
+
export interface RuleMetadata {
|
|
6
|
+
description?: string;
|
|
7
|
+
globs?: string | string[];
|
|
8
|
+
alwaysApply?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Rule information with path context and content
|
|
12
|
+
*/
|
|
13
|
+
export interface RuleInfo {
|
|
14
|
+
/** Absolute path to the rule file */
|
|
15
|
+
path: string;
|
|
16
|
+
/** Path relative to project root */
|
|
17
|
+
relativePath: string;
|
|
18
|
+
/** Directory distance from target file (0 = same dir) */
|
|
19
|
+
distance: number;
|
|
20
|
+
/** Rule file content (without frontmatter) */
|
|
21
|
+
content: string;
|
|
22
|
+
/** SHA-256 hash of content for deduplication */
|
|
23
|
+
contentHash: string;
|
|
24
|
+
/** Parsed frontmatter metadata */
|
|
25
|
+
metadata: RuleMetadata;
|
|
26
|
+
/** Why this rule matched (e.g., "alwaysApply", "glob: *.ts", "path match") */
|
|
27
|
+
matchReason: string;
|
|
28
|
+
/** Real path after symlink resolution (for duplicate detection) */
|
|
29
|
+
realPath: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Session storage for injected rules tracking
|
|
33
|
+
*/
|
|
34
|
+
export interface InjectedRulesData {
|
|
35
|
+
sessionID: string;
|
|
36
|
+
/** Content hashes of already injected rules */
|
|
37
|
+
injectedHashes: string[];
|
|
38
|
+
/** Real paths of already injected rules (for symlink deduplication) */
|
|
39
|
+
injectedRealPaths: string[];
|
|
40
|
+
updatedAt: number;
|
|
41
|
+
}
|
|
@@ -13,3 +13,4 @@ export declare function findMessagesWithThinkingBlocks(sessionID: string): strin
|
|
|
13
13
|
export declare function findMessagesWithOrphanThinking(sessionID: string): string[];
|
|
14
14
|
export declare function prependThinkingPart(sessionID: string, messageID: string): boolean;
|
|
15
15
|
export declare function stripThinkingParts(messageID: string): boolean;
|
|
16
|
+
export declare function findMessageByIndexNeedingThinking(sessionID: string, targetIndex: number): string | null;
|