oh-my-opencode-slim 0.9.15 → 1.0.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 +38 -18
- package/dist/agents/council.d.ts +7 -8
- package/dist/agents/orchestrator.d.ts +1 -1
- package/dist/background/background-manager.d.ts +11 -0
- package/dist/background/index.d.ts +1 -1
- package/dist/cli/index.js +309 -13804
- package/dist/cli/types.d.ts +1 -1
- package/dist/config/constants.d.ts +3 -3
- package/dist/config/council-schema.d.ts +46 -69
- package/dist/config/index.d.ts +1 -1
- package/dist/config/schema.d.ts +48 -33
- package/dist/config/utils.d.ts +7 -0
- package/dist/council/council-manager.d.ts +9 -13
- package/dist/hooks/auto-update-checker/types.d.ts +1 -1
- package/dist/hooks/foreground-fallback/index.d.ts +1 -1
- package/dist/hooks/phase-reminder/index.d.ts +1 -1
- package/dist/hooks/todo-continuation/todo-hygiene.d.ts +0 -1
- package/dist/index.js +7670 -26628
- package/dist/interview/service.d.ts +1 -0
- package/dist/multiplexer/index.d.ts +1 -0
- package/dist/multiplexer/session-manager.d.ts +46 -0
- package/dist/multiplexer/types.d.ts +1 -1
- package/dist/tools/ast-grep/index.d.ts +1 -1
- package/dist/tools/background.d.ts +1 -1
- package/dist/tools/council.d.ts +2 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/lsp/types.d.ts +1 -1
- package/dist/tools/preset-manager.d.ts +27 -0
- package/dist/utils/subagent-depth.d.ts +35 -0
- package/dist/utils/tmux-debug-log.d.ts +2 -0
- package/oh-my-opencode-slim.schema.json +35 -50
- package/package.json +9 -10
- package/src/skills/{cartography → codemap}/README.md +11 -9
- package/src/skills/{cartography → codemap}/SKILL.md +21 -18
- package/src/skills/codemap/codemap.md +36 -0
- package/src/skills/codemap/scripts/codemap.mjs +483 -0
- package/src/skills/codemap/scripts/codemap.test.ts +129 -0
- package/src/skills/codemap.md +40 -0
- package/src/skills/simplify/codemap.md +36 -0
- package/src/skills/cartography/scripts/cartographer.py +0 -456
- package/src/skills/cartography/scripts/test_cartographer.py +0 -87
|
@@ -3,6 +3,7 @@ import type { InterviewConfig } from '../config';
|
|
|
3
3
|
import type { InterviewAnswer, InterviewFileItem, InterviewListItem, InterviewRecord, InterviewState } from './types';
|
|
4
4
|
export declare function createInterviewService(ctx: PluginInput, config?: InterviewConfig, deps?: {
|
|
5
5
|
openBrowser?: (url: string) => void;
|
|
6
|
+
env?: NodeJS.ProcessEnv;
|
|
6
7
|
}): {
|
|
7
8
|
setBaseUrlResolver: (resolver: () => Promise<string>) => void;
|
|
8
9
|
setStatePushCallback: (callback: (interviewId: string, state: InterviewState) => void) => void;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Multiplexer module exports
|
|
3
3
|
*/
|
|
4
4
|
export { clearMultiplexerCache, getMultiplexer, startAvailabilityCheck, } from './factory';
|
|
5
|
+
export { MultiplexerSessionManager, TmuxSessionManager, } from './session-manager';
|
|
5
6
|
export { TmuxMultiplexer } from './tmux';
|
|
6
7
|
export type { Multiplexer, PaneResult } from './types';
|
|
7
8
|
export { isServerRunning } from './types';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
2
|
+
import type { MultiplexerConfig } from '../config/schema';
|
|
3
|
+
interface SessionEvent {
|
|
4
|
+
type: string;
|
|
5
|
+
properties?: {
|
|
6
|
+
info?: {
|
|
7
|
+
id?: string;
|
|
8
|
+
parentID?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
directory?: string;
|
|
11
|
+
};
|
|
12
|
+
sessionID?: string;
|
|
13
|
+
status?: {
|
|
14
|
+
type: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Tracks child sessions and spawns/closes multiplexer panes for them.
|
|
20
|
+
*
|
|
21
|
+
* Uses session.status events for completion detection instead of polling,
|
|
22
|
+
* with polling kept as a fallback for reliability.
|
|
23
|
+
*/
|
|
24
|
+
export declare class MultiplexerSessionManager {
|
|
25
|
+
private client;
|
|
26
|
+
private serverUrl;
|
|
27
|
+
private directory;
|
|
28
|
+
private multiplexer;
|
|
29
|
+
private sessions;
|
|
30
|
+
private pollInterval?;
|
|
31
|
+
private enabled;
|
|
32
|
+
constructor(ctx: PluginInput, config: MultiplexerConfig);
|
|
33
|
+
onSessionCreated(event: SessionEvent): Promise<void>;
|
|
34
|
+
onSessionStatus(event: SessionEvent): Promise<void>;
|
|
35
|
+
onSessionDeleted(event: SessionEvent): Promise<void>;
|
|
36
|
+
private startPolling;
|
|
37
|
+
private stopPolling;
|
|
38
|
+
private pollSessions;
|
|
39
|
+
private closeSession;
|
|
40
|
+
cleanup(): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated Use MultiplexerSessionManager instead
|
|
44
|
+
*/
|
|
45
|
+
export declare const TmuxSessionManager: typeof MultiplexerSessionManager;
|
|
46
|
+
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Multiplexer abstraction layer
|
|
3
3
|
*
|
|
4
4
|
* Provides a unified interface for terminal multiplexers (tmux, zellij, etc.)
|
|
5
|
-
* to spawn and manage panes for
|
|
5
|
+
* to spawn and manage panes for child agent sessions.
|
|
6
6
|
*/
|
|
7
7
|
import type { MultiplexerConfig, MultiplexerLayout } from '../config/schema';
|
|
8
8
|
export interface PaneResult {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ToolDefinition } from '@opencode-ai/plugin';
|
|
2
2
|
import { ast_grep_replace, ast_grep_search } from './tools';
|
|
3
3
|
export declare const builtinTools: Record<string, ToolDefinition>;
|
|
4
|
-
export { ast_grep_search, ast_grep_replace };
|
|
5
4
|
export { ensureCliAvailable, getAstGrepPath, isCliAvailable, startBackgroundInit, } from './cli';
|
|
6
5
|
export type { EnvironmentCheckResult } from './constants';
|
|
7
6
|
export { checkEnvironment, formatEnvironmentCheck } from './constants';
|
|
8
7
|
export { ensureAstGrepBinary, getCacheDir, getCachedBinaryPath, } from './downloader';
|
|
9
8
|
export type { CliLanguage, CliMatch, SgResult } from './types';
|
|
10
9
|
export { CLI_LANGUAGES } from './types';
|
|
10
|
+
export { ast_grep_replace, ast_grep_search };
|
|
@@ -8,6 +8,6 @@ import type { MultiplexerConfig } from '../config/schema';
|
|
|
8
8
|
* @param manager - Background task manager for launching and tracking tasks
|
|
9
9
|
* @param _multiplexerConfig - Optional multiplexer configuration for session management
|
|
10
10
|
* @param _pluginConfig - Optional plugin configuration for agent variants
|
|
11
|
-
* @returns Object containing background_task, background_output, and
|
|
11
|
+
* @returns Object containing background_task, background_output, background_cancel, and ask_orchestrator tools
|
|
12
12
|
*/
|
|
13
13
|
export declare function createBackgroundTools(_ctx: PluginInput, manager: BackgroundTaskManager, _multiplexerConfig?: MultiplexerConfig, _pluginConfig?: PluginConfig): Record<string, ToolDefinition>;
|
package/dist/tools/council.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { CouncilManager } from '../council/council-manager';
|
|
|
4
4
|
* Creates the council_session tool for multi-LLM orchestration.
|
|
5
5
|
*
|
|
6
6
|
* This tool triggers a full council session: parallel councillors →
|
|
7
|
-
*
|
|
7
|
+
* formatted results returned to the council agent for synthesis.
|
|
8
|
+
* Available to the council agent.
|
|
8
9
|
*/
|
|
9
10
|
export declare function createCouncilTool(_ctx: PluginInput, councilManager: CouncilManager): Record<string, ToolDefinition>;
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ast_grep_replace, ast_grep_search } from './ast-grep';
|
|
2
|
-
export { createBackgroundTools } from './background';
|
|
3
2
|
export { createCouncilTool } from './council';
|
|
4
|
-
export {
|
|
3
|
+
export type { PresetManager } from './preset-manager';
|
|
4
|
+
export { createPresetManager } from './preset-manager';
|
|
5
5
|
export { createWebfetchTool } from './smartfetch';
|
|
@@ -32,7 +32,7 @@ export type ServerLookupResult = {
|
|
|
32
32
|
server: ResolvedServer;
|
|
33
33
|
installHint: string;
|
|
34
34
|
};
|
|
35
|
-
export type {
|
|
35
|
+
export type { CreateFile, DeleteFile, Diagnostic, DocumentSymbol, Location, LocationLink, Position, Range, RenameFile, SymbolInfo, TextDocumentEdit, TextDocumentIdentifier, TextEdit, VersionedTextDocumentIdentifier, WorkspaceEdit, };
|
|
36
36
|
export interface DocumentDiagnosticReportFull {
|
|
37
37
|
kind: 'full';
|
|
38
38
|
items: Diagnostic[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
2
|
+
import type { PluginConfig } from '../config';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a preset manager for the /preset slash command.
|
|
5
|
+
*
|
|
6
|
+
* Uses the OpenCode SDK's client.config.update() to change agent models
|
|
7
|
+
* and temperatures without restarting. The server invalidates its agent
|
|
8
|
+
* cache and re-reads config on the next prompt.
|
|
9
|
+
*
|
|
10
|
+
* Note: activePreset is tracked in-memory only and resets on plugin reload.
|
|
11
|
+
* If the user manually edits config or another mechanism changes agents,
|
|
12
|
+
* this tracker may become stale until the next /preset call.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createPresetManager(ctx: PluginInput, config: PluginConfig): {
|
|
15
|
+
handleCommandExecuteBefore: (input: {
|
|
16
|
+
command: string;
|
|
17
|
+
sessionID: string;
|
|
18
|
+
arguments: string;
|
|
19
|
+
}, output: {
|
|
20
|
+
parts: Array<{
|
|
21
|
+
type: string;
|
|
22
|
+
text?: string;
|
|
23
|
+
}>;
|
|
24
|
+
}) => Promise<void>;
|
|
25
|
+
registerCommand: (opencodeConfig: Record<string, unknown>) => void;
|
|
26
|
+
};
|
|
27
|
+
export type PresetManager = ReturnType<typeof createPresetManager>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tracks subagent spawn depth to prevent excessive nesting.
|
|
3
|
+
*
|
|
4
|
+
* Depth 0 = root session (user's main conversation)
|
|
5
|
+
* Depth 1 = agent spawned by root (e.g., explorer, council)
|
|
6
|
+
* Depth 2 = agent spawned by depth-1 agent (e.g., councillor spawned by council)
|
|
7
|
+
* Depth 3 = agent spawned by depth-2 agent (max depth by default)
|
|
8
|
+
*
|
|
9
|
+
* When max depth is exceeded, the spawn is blocked.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SubagentDepthTracker {
|
|
12
|
+
private depthBySession;
|
|
13
|
+
private readonly _maxDepth;
|
|
14
|
+
constructor(maxDepth?: number);
|
|
15
|
+
/** Maximum allowed depth. */
|
|
16
|
+
get maxDepth(): number;
|
|
17
|
+
/**
|
|
18
|
+
* Get the current depth of a session.
|
|
19
|
+
* Root sessions (not tracked) have depth 0.
|
|
20
|
+
*/
|
|
21
|
+
getDepth(sessionId: string): number;
|
|
22
|
+
/**
|
|
23
|
+
* Register a child session and check if the spawn is allowed.
|
|
24
|
+
* @returns true if allowed, false if max depth exceeded
|
|
25
|
+
*/
|
|
26
|
+
registerChild(parentSessionId: string, childSessionId: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Clean up session tracking when a session is deleted.
|
|
29
|
+
*/
|
|
30
|
+
cleanup(sessionId: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Clean up all tracking data.
|
|
33
|
+
*/
|
|
34
|
+
cleanupAll(): void;
|
|
35
|
+
}
|
|
@@ -218,6 +218,7 @@
|
|
|
218
218
|
"type": "string"
|
|
219
219
|
},
|
|
220
220
|
{
|
|
221
|
+
"minItems": 1,
|
|
221
222
|
"type": "array",
|
|
222
223
|
"items": {
|
|
223
224
|
"anyOf": [
|
|
@@ -263,6 +264,14 @@
|
|
|
263
264
|
"type": "string"
|
|
264
265
|
}
|
|
265
266
|
},
|
|
267
|
+
"prompt": {
|
|
268
|
+
"type": "string",
|
|
269
|
+
"minLength": 1
|
|
270
|
+
},
|
|
271
|
+
"orchestratorPrompt": {
|
|
272
|
+
"type": "string",
|
|
273
|
+
"minLength": 1
|
|
274
|
+
},
|
|
266
275
|
"options": {
|
|
267
276
|
"type": "object",
|
|
268
277
|
"propertyNames": {
|
|
@@ -274,7 +283,8 @@
|
|
|
274
283
|
"type": "string",
|
|
275
284
|
"minLength": 1
|
|
276
285
|
}
|
|
277
|
-
}
|
|
286
|
+
},
|
|
287
|
+
"additionalProperties": false
|
|
278
288
|
}
|
|
279
289
|
}
|
|
280
290
|
},
|
|
@@ -292,6 +302,7 @@
|
|
|
292
302
|
"type": "string"
|
|
293
303
|
},
|
|
294
304
|
{
|
|
305
|
+
"minItems": 1,
|
|
295
306
|
"type": "array",
|
|
296
307
|
"items": {
|
|
297
308
|
"anyOf": [
|
|
@@ -337,6 +348,14 @@
|
|
|
337
348
|
"type": "string"
|
|
338
349
|
}
|
|
339
350
|
},
|
|
351
|
+
"prompt": {
|
|
352
|
+
"type": "string",
|
|
353
|
+
"minLength": 1
|
|
354
|
+
},
|
|
355
|
+
"orchestratorPrompt": {
|
|
356
|
+
"type": "string",
|
|
357
|
+
"minLength": 1
|
|
358
|
+
},
|
|
340
359
|
"options": {
|
|
341
360
|
"type": "object",
|
|
342
361
|
"propertyNames": {
|
|
@@ -348,11 +367,12 @@
|
|
|
348
367
|
"type": "string",
|
|
349
368
|
"minLength": 1
|
|
350
369
|
}
|
|
351
|
-
}
|
|
370
|
+
},
|
|
371
|
+
"additionalProperties": false
|
|
352
372
|
}
|
|
353
373
|
},
|
|
354
374
|
"disabled_agents": {
|
|
355
|
-
"description": "Agent names to disable completely. Disabled agents are not instantiated and cannot be delegated to. Orchestrator and council internal agents (councillor
|
|
375
|
+
"description": "Agent names to disable completely. Disabled agents are not instantiated and cannot be delegated to. Orchestrator and council internal agents (councillor) cannot be disabled. By default, 'observer' is disabled. Remove it from this list and configure a vision-capable model to enable.",
|
|
356
376
|
"type": "array",
|
|
357
377
|
"items": {
|
|
358
378
|
"type": "string"
|
|
@@ -435,17 +455,6 @@
|
|
|
435
455
|
}
|
|
436
456
|
}
|
|
437
457
|
},
|
|
438
|
-
"background": {
|
|
439
|
-
"type": "object",
|
|
440
|
-
"properties": {
|
|
441
|
-
"maxConcurrentStarts": {
|
|
442
|
-
"default": 10,
|
|
443
|
-
"type": "number",
|
|
444
|
-
"minimum": 1,
|
|
445
|
-
"maximum": 50
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
},
|
|
449
458
|
"interview": {
|
|
450
459
|
"type": "object",
|
|
451
460
|
"properties": {
|
|
@@ -462,6 +471,7 @@
|
|
|
462
471
|
},
|
|
463
472
|
"autoOpenBrowser": {
|
|
464
473
|
"default": true,
|
|
474
|
+
"description": "Automatically open the interview UI in your default browser during interactive runs. Disabled automatically in tests and CI.",
|
|
465
475
|
"type": "boolean"
|
|
466
476
|
},
|
|
467
477
|
"port": {
|
|
@@ -589,26 +599,6 @@
|
|
|
589
599
|
"council": {
|
|
590
600
|
"type": "object",
|
|
591
601
|
"properties": {
|
|
592
|
-
"master": {
|
|
593
|
-
"type": "object",
|
|
594
|
-
"properties": {
|
|
595
|
-
"model": {
|
|
596
|
-
"type": "string",
|
|
597
|
-
"pattern": "^[^/\\s]+\\/[^\\s]+$",
|
|
598
|
-
"description": "Model ID for the council master (e.g. \"anthropic/claude-opus-4-6\")"
|
|
599
|
-
},
|
|
600
|
-
"variant": {
|
|
601
|
-
"type": "string"
|
|
602
|
-
},
|
|
603
|
-
"prompt": {
|
|
604
|
-
"description": "Optional role/guidance injected into the master synthesis prompt",
|
|
605
|
-
"type": "string"
|
|
606
|
-
}
|
|
607
|
-
},
|
|
608
|
-
"required": [
|
|
609
|
-
"model"
|
|
610
|
-
]
|
|
611
|
-
},
|
|
612
602
|
"presets": {
|
|
613
603
|
"type": "object",
|
|
614
604
|
"propertyNames": {
|
|
@@ -628,12 +618,7 @@
|
|
|
628
618
|
}
|
|
629
619
|
}
|
|
630
620
|
},
|
|
631
|
-
"
|
|
632
|
-
"default": 300000,
|
|
633
|
-
"type": "number",
|
|
634
|
-
"minimum": 0
|
|
635
|
-
},
|
|
636
|
-
"councillors_timeout": {
|
|
621
|
+
"timeout": {
|
|
637
622
|
"default": 180000,
|
|
638
623
|
"type": "number",
|
|
639
624
|
"minimum": 0
|
|
@@ -642,14 +627,6 @@
|
|
|
642
627
|
"default": "default",
|
|
643
628
|
"type": "string"
|
|
644
629
|
},
|
|
645
|
-
"master_fallback": {
|
|
646
|
-
"description": "Fallback models for the council master. Tried in order if the primary model fails. Example: [\"anthropic/claude-sonnet-4-6\", \"openai/gpt-5.4\"]",
|
|
647
|
-
"type": "array",
|
|
648
|
-
"items": {
|
|
649
|
-
"type": "string",
|
|
650
|
-
"pattern": "^[^/\\s]+\\/[^\\s]+$"
|
|
651
|
-
}
|
|
652
|
-
},
|
|
653
630
|
"councillor_execution_mode": {
|
|
654
631
|
"default": "parallel",
|
|
655
632
|
"description": "Execution mode for councillors. \"serial\" runs them one at a time (required for single-model systems). \"parallel\" runs them concurrently (default, faster for multi-model systems).",
|
|
@@ -661,14 +638,22 @@
|
|
|
661
638
|
},
|
|
662
639
|
"councillor_retries": {
|
|
663
640
|
"default": 3,
|
|
664
|
-
"description": "Number of retry attempts for councillors
|
|
641
|
+
"description": "Number of retry attempts for councillors that return empty responses (e.g. due to provider rate limiting). Default: 3 retries.",
|
|
665
642
|
"type": "integer",
|
|
666
643
|
"minimum": 0,
|
|
667
644
|
"maximum": 5
|
|
645
|
+
},
|
|
646
|
+
"master": {
|
|
647
|
+
"description": "DEPRECATED — ignored. Council agent synthesizes directly."
|
|
648
|
+
},
|
|
649
|
+
"master_timeout": {
|
|
650
|
+
"description": "DEPRECATED — ignored. Use \"timeout\" instead."
|
|
651
|
+
},
|
|
652
|
+
"master_fallback": {
|
|
653
|
+
"description": "DEPRECATED — ignored. No separate master session."
|
|
668
654
|
}
|
|
669
655
|
},
|
|
670
656
|
"required": [
|
|
671
|
-
"master",
|
|
672
657
|
"presets"
|
|
673
658
|
]
|
|
674
659
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oh-my-opencode-slim",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Lightweight agent orchestration plugin for OpenCode - a slimmed-down fork of oh-my-opencode",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"LICENSE"
|
|
37
37
|
],
|
|
38
38
|
"scripts": {
|
|
39
|
-
"build:plugin": "bun build src/index.ts --outdir dist --target node --format esm --external @ast-grep/napi --external @opencode-ai/plugin --external @opencode-ai/sdk --external jsdom",
|
|
40
|
-
"build:cli": "bun build src/cli/index.ts --outdir dist/cli --target node --format esm --external @ast-grep/napi --external @opencode-ai/plugin --external @opencode-ai/sdk --external jsdom",
|
|
39
|
+
"build:plugin": "bun build src/index.ts --outdir dist --target node --format esm --external @ast-grep/napi --external @opencode-ai/plugin --external @opencode-ai/sdk --external jsdom --external zod",
|
|
40
|
+
"build:cli": "bun build src/cli/index.ts --outdir dist/cli --target node --format esm --external @ast-grep/napi --external @opencode-ai/plugin --external @opencode-ai/sdk --external jsdom --external zod",
|
|
41
41
|
"build": "bun run build:plugin && bun run build:cli && tsc --emitDeclarationOnly && bun run generate-schema",
|
|
42
42
|
"prepare": "bun run build",
|
|
43
43
|
"contributors:add": "all-contributors add",
|
|
@@ -66,21 +66,20 @@
|
|
|
66
66
|
"@opencode-ai/sdk": "^1.3.17",
|
|
67
67
|
"jsdom": "^26.1.0",
|
|
68
68
|
"lru-cache": "^11.3.3",
|
|
69
|
-
"turndown": "^7.2.4"
|
|
70
|
-
"vscode-jsonrpc": "^8.2.1",
|
|
71
|
-
"vscode-languageserver-protocol": "^3.17.5",
|
|
72
|
-
"which": "^6.0.1",
|
|
73
|
-
"zod": "^4.3.6"
|
|
69
|
+
"turndown": "^7.2.4"
|
|
74
70
|
},
|
|
75
71
|
"devDependencies": {
|
|
76
72
|
"@biomejs/biome": "2.4.11",
|
|
77
73
|
"@types/jsdom": "^21.1.7",
|
|
78
74
|
"@types/node": "^24.6.1",
|
|
79
75
|
"@types/turndown": "^5.0.6",
|
|
80
|
-
"@types/which": "^3.0.4",
|
|
81
76
|
"all-contributors-cli": "^6.26.1",
|
|
82
77
|
"bun-types": "1.3.12",
|
|
83
|
-
"typescript": "^5.9.3"
|
|
78
|
+
"typescript": "^5.9.3",
|
|
79
|
+
"zod": "^4.3.6"
|
|
80
|
+
},
|
|
81
|
+
"peerDependencies": {
|
|
82
|
+
"zod": "^4.0.0"
|
|
84
83
|
},
|
|
85
84
|
"trustedDependencies": [
|
|
86
85
|
"@ast-grep/cli"
|
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Codemap Skill
|
|
2
2
|
|
|
3
3
|
Repository understanding and hierarchical codemap generation.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Codemap helps orchestrators map and understand codebases by:
|
|
8
8
|
|
|
9
9
|
1. Selecting relevant code/config files using LLM judgment
|
|
10
|
-
2. Creating `.slim/
|
|
11
|
-
3. Generating empty `codemap.md` templates for
|
|
10
|
+
2. Creating `.slim/codemap.json` for change tracking
|
|
11
|
+
3. Generating empty `codemap.md` templates for fixers to fill in
|
|
12
|
+
|
|
13
|
+
Legacy `.slim/cartography.json` state is migrated to `.slim/codemap.json` automatically.
|
|
12
14
|
|
|
13
15
|
## Commands
|
|
14
16
|
|
|
15
17
|
```bash
|
|
16
18
|
# Initialize mapping
|
|
17
|
-
|
|
19
|
+
node codemap.mjs init --root /repo --include "src/**/*.ts" --exclude "node_modules/**"
|
|
18
20
|
|
|
19
21
|
# Check what changed
|
|
20
|
-
|
|
22
|
+
node codemap.mjs changes --root /repo
|
|
21
23
|
|
|
22
24
|
# Update hashes
|
|
23
|
-
|
|
25
|
+
node codemap.mjs update --root /repo
|
|
24
26
|
```
|
|
25
27
|
|
|
26
28
|
## Outputs
|
|
27
29
|
|
|
28
|
-
### .slim/
|
|
30
|
+
### .slim/codemap.json
|
|
29
31
|
|
|
30
32
|
```json
|
|
31
33
|
{
|
|
@@ -46,7 +48,7 @@ python3 cartographer.py update --root /repo
|
|
|
46
48
|
|
|
47
49
|
### codemap.md (per folder)
|
|
48
50
|
|
|
49
|
-
Empty templates created in each folder for
|
|
51
|
+
Empty templates created in each folder for fixers to fill with:
|
|
50
52
|
- Responsibility
|
|
51
53
|
- Design patterns
|
|
52
54
|
- Data/control flow
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: codemap
|
|
3
3
|
description: Generate comprehensive hierarchical codemaps for UNFAMILIAR repositories. Expensive operation - only use when explicitly asked for codebase documentation or initial repository mapping
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Codemap Skill
|
|
7
7
|
|
|
8
8
|
You help users understand and map repositories by creating hierarchical codemaps.
|
|
9
9
|
|
|
@@ -17,11 +17,15 @@ You help users understand and map repositories by creating hierarchical codemaps
|
|
|
17
17
|
|
|
18
18
|
### Step 1: Check for Existing State
|
|
19
19
|
|
|
20
|
-
**First, check if `.slim/
|
|
20
|
+
**First, check if `.slim/codemap.json` exists in the repo root.**
|
|
21
21
|
|
|
22
|
-
If it
|
|
22
|
+
If it does not exist, check for legacy state at `.slim/cartography.json`.
|
|
23
23
|
|
|
24
|
-
If
|
|
24
|
+
If legacy state exists: move `.slim/cartography.json` to `.slim/codemap.json`, then continue with change detection.
|
|
25
|
+
|
|
26
|
+
If `.slim/codemap.json` exists: Skip to Step 3 (Detect Changes) - no need to re-initialize.
|
|
27
|
+
|
|
28
|
+
If neither file exists: Continue to Step 2 (Initialize).
|
|
25
29
|
|
|
26
30
|
### Step 2: Initialize (Only if no state exists)
|
|
27
31
|
|
|
@@ -33,27 +37,27 @@ If it **doesn't exist**: Continue to Step 2 (Initialize).
|
|
|
33
37
|
- Docs: `docs/**`, `*.md` (except root `README.md` if needed), `LICENSE`
|
|
34
38
|
- Build/Deps: `node_modules/**`, `dist/**`, `build/**`, `*.min.js`
|
|
35
39
|
- Respect `.gitignore` automatically
|
|
36
|
-
3. **Run
|
|
40
|
+
3. **Run codemap.mjs init**:
|
|
37
41
|
|
|
38
42
|
```bash
|
|
39
|
-
|
|
43
|
+
node ~/.config/opencode/skills/codemap/scripts/codemap.mjs init \
|
|
40
44
|
--root ./ \
|
|
41
45
|
--include "src/**/*.ts" \
|
|
42
46
|
--exclude "**/*.test.ts" --exclude "dist/**" --exclude "node_modules/**"
|
|
43
47
|
```
|
|
44
48
|
|
|
45
49
|
This creates:
|
|
46
|
-
- `.slim/
|
|
50
|
+
- `.slim/codemap.json` - File and folder hashes for change detection
|
|
47
51
|
- Empty `codemap.md` files in all relevant subdirectories
|
|
48
52
|
|
|
49
|
-
4. **Delegate to
|
|
53
|
+
4. **Delegate codemap writing to Fixer agents** - Spawn one fixer per folder to read code and create or update its specific `codemap.md` file.
|
|
50
54
|
|
|
51
55
|
### Step 3: Detect Changes (If state already exists)
|
|
52
56
|
|
|
53
|
-
1. **Run
|
|
57
|
+
1. **Run codemap.mjs changes** to see what changed:
|
|
54
58
|
|
|
55
59
|
```bash
|
|
56
|
-
|
|
60
|
+
node ~/.config/opencode/skills/codemap/scripts/codemap.mjs changes \
|
|
57
61
|
--root ./
|
|
58
62
|
```
|
|
59
63
|
|
|
@@ -63,11 +67,11 @@ python3 ~/.config/opencode/skills/cartography/scripts/cartographer.py changes \
|
|
|
63
67
|
- Modified files
|
|
64
68
|
- Affected folders
|
|
65
69
|
|
|
66
|
-
3. **Only update affected codemaps** - Spawn one
|
|
70
|
+
3. **Only update affected codemaps** - Spawn one fixer per affected folder to update its `codemap.md`.
|
|
67
71
|
4. **Run update** to save new state:
|
|
68
72
|
|
|
69
73
|
```bash
|
|
70
|
-
|
|
74
|
+
node ~/.config/opencode/skills/codemap/scripts/codemap.mjs update \
|
|
71
75
|
--root ./
|
|
72
76
|
```
|
|
73
77
|
|
|
@@ -100,12 +104,11 @@ Before working on any task, read `codemap.md` to understand:
|
|
|
100
104
|
For deep work on a specific folder, also read that folder's `codemap.md`.
|
|
101
105
|
```
|
|
102
106
|
|
|
103
|
-
This is idempotent — repeated
|
|
104
|
-
|
|
107
|
+
This is idempotent — repeated codemap runs will detect the existing section and skip. No duplication.
|
|
105
108
|
|
|
106
109
|
## Codemap Content
|
|
107
110
|
|
|
108
|
-
|
|
111
|
+
Fixers are responsible for writing `codemap.md` files during this workflow. Use precise technical terminology to document the implementation:
|
|
109
112
|
|
|
110
113
|
- **Responsibility** - Define the specific role of this directory using standard software engineering terms (e.g., "Service Layer", "Data Access Object", "Middleware").
|
|
111
114
|
- **Design Patterns** - Identify and name specific patterns used (e.g., "Observer", "Singleton", "Factory", "Strategy"). Detail the abstractions and interfaces.
|
|
@@ -144,7 +147,7 @@ Example **Root Codemap (Atlas)**:
|
|
|
144
147
|
# Repository Atlas: oh-my-opencode-slim
|
|
145
148
|
|
|
146
149
|
## Project Responsibility
|
|
147
|
-
A high-performance, low-latency agent orchestration plugin for OpenCode, focusing on specialized sub-agent delegation and
|
|
150
|
+
A high-performance, low-latency agent orchestration plugin for OpenCode, focusing on specialized sub-agent delegation and multiplexer-assisted child sessions.
|
|
148
151
|
|
|
149
152
|
## System Entry Points
|
|
150
153
|
- `src/index.ts`: Plugin initialization and OpenCode integration.
|
|
@@ -155,6 +158,6 @@ A high-performance, low-latency agent orchestration plugin for OpenCode, focusin
|
|
|
155
158
|
| Directory | Responsibility Summary | Detailed Map |
|
|
156
159
|
|-----------|------------------------|--------------|
|
|
157
160
|
| `src/agents/` | Defines agent personalities (Orchestrator, Explorer) and manages model routing. | [View Map](src/agents/codemap.md) |
|
|
158
|
-
| `src/features/` | Core logic for tmux integration
|
|
161
|
+
| `src/features/` | Core logic for tmux integration and session state. | [View Map](src/features/codemap.md) |
|
|
159
162
|
| `src/config/` | Implements the configuration loading pipeline and environment variable injection. | [View Map](src/config/codemap.md) |
|
|
160
163
|
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# src/skills/codemap/
|
|
2
|
+
|
|
3
|
+
## Responsibility
|
|
4
|
+
|
|
5
|
+
- Provide a command-style skill package that standardizes repository mapping workflows for unfamiliar codebases.
|
|
6
|
+
- Define the task contract used by Orchestrator/fixer agents via `SKILL.md` and operational guidance via `README.md`.
|
|
7
|
+
- Generate and evolve change-aware codemap state artifacts (`.slim/codemap.json`) and scaffold placeholders (`codemap.md`).
|
|
8
|
+
|
|
9
|
+
## Design
|
|
10
|
+
|
|
11
|
+
- Contract layer: `SKILL.md` (machine prompt contract) + `README.md` (human-facing operation notes).
|
|
12
|
+
- Execution layer: `scripts/codemap.mjs` exports deterministic helper functions:
|
|
13
|
+
- `parseArgs(argv)`
|
|
14
|
+
- `cmdInit`, `cmdChanges`, `cmdUpdate`
|
|
15
|
+
- `selectFiles`, `computeFileHash`, `computeFolderHash`, `createEmptyCodemap`
|
|
16
|
+
- `loadState`, `saveState`, `migrateLegacyState`
|
|
17
|
+
- Persistence model: JSON state at `.slim/codemap.json` with `metadata`, `file_hashes`, and `folder_hashes`.
|
|
18
|
+
- Testing layer: `scripts/codemap.test.ts` validates pattern matching, hash determinism, and migration behavior.
|
|
19
|
+
- The script intentionally avoids network and mutates only filesystem-local state and codemap templates.
|
|
20
|
+
|
|
21
|
+
## Flow
|
|
22
|
+
|
|
23
|
+
- Entry point `main(argv)` parses command and arguments (`init|changes|update`, `--root`, `--include`, `--exclude`, `--exception`) and dispatches via strict branches.
|
|
24
|
+
- `cmdInit()` computes include/exclude candidate sets using `selectFiles()` and writes:
|
|
25
|
+
1) `.slim/codemap.json` via `saveState()`
|
|
26
|
+
2) one `codemap.md` per discovered folder via `createEmptyCodemap()`.
|
|
27
|
+
- `cmdChanges()` reloads state (`loadState()` + `migrateLegacyState()`), recomputes current hashes, emits added/removed/modified diffs and affected folder list, and exits non-zero if state is absent.
|
|
28
|
+
- `cmdUpdate()` recomputes full state from existing metadata and persists it, used after targeted fixers finish updates.
|
|
29
|
+
- `codemap` skill invocation path in SKILL workflow is explicit: Step 1 checks `.slim/codemap.json` or `.slim/cartography.json`, then Step 2/3 selects init or incremental path.
|
|
30
|
+
|
|
31
|
+
## Integration
|
|
32
|
+
|
|
33
|
+
- Installed under OpenCode through `src/cli/custom-skills.ts` as `name: 'codemap'`, `sourcePath: 'src/skills/codemap'`.
|
|
34
|
+
- `src/cli/install.ts` copies this directory into the user skill directory; OpenCode executes `scripts/codemap.mjs` from that context.
|
|
35
|
+
- `src/hooks/filter-available-skills/index.ts` applies agent-level skill gating via names from `getSkillPermissionsForAgent()`.
|
|
36
|
+
- `scripts/verify-release-artifact.ts` includes codemap skill metadata and runtime checks as required packaged files.
|