@frenchtoastman/oh-my-groundcontrol 0.0.17 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +0 -6
- package/dist/hooks/analyze-command/index.d.ts +10 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/index.js +166 -6
- package/package.json +1 -1
- package/src/skills/analyze/SKILL.md +0 -116
package/dist/cli/index.js
CHANGED
|
@@ -13822,12 +13822,6 @@ var CUSTOM_SKILLS = [
|
|
|
13822
13822
|
description: "Repository understanding and hierarchical codemap generation",
|
|
13823
13823
|
allowedAgents: ["orchestrator", "explorer"],
|
|
13824
13824
|
sourcePath: "src/skills/cartography"
|
|
13825
|
-
},
|
|
13826
|
-
{
|
|
13827
|
-
name: "analyze",
|
|
13828
|
-
description: "Code review and analysis for uncommitted changes, commits, branches, PRs, or specific files.",
|
|
13829
|
-
allowedAgents: ["*"],
|
|
13830
|
-
sourcePath: "src/skills/analyze"
|
|
13831
13825
|
}
|
|
13832
13826
|
];
|
|
13833
13827
|
function getCustomSkillsDir() {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Part } from '@opencode-ai/sdk';
|
|
2
|
+
export declare function createAnalyzeCommandHook(): {
|
|
3
|
+
'command.execute.before': (input: {
|
|
4
|
+
command: string;
|
|
5
|
+
sessionID: string;
|
|
6
|
+
arguments: string;
|
|
7
|
+
}, output: {
|
|
8
|
+
parts: Part[];
|
|
9
|
+
}) => Promise<void>;
|
|
10
|
+
};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { createAnalyzeCommandHook } from './analyze-command';
|
|
1
2
|
export type { AutoUpdateCheckerOptions } from './auto-update-checker';
|
|
2
3
|
export { createAutoUpdateCheckerHook } from './auto-update-checker';
|
|
3
4
|
export { createDelegateTaskRetryHook } from './delegate-task-retry';
|
package/dist/index.js
CHANGED
|
@@ -3284,12 +3284,6 @@ var CUSTOM_SKILLS = [
|
|
|
3284
3284
|
description: "Repository understanding and hierarchical codemap generation",
|
|
3285
3285
|
allowedAgents: ["orchestrator", "explorer"],
|
|
3286
3286
|
sourcePath: "src/skills/cartography"
|
|
3287
|
-
},
|
|
3288
|
-
{
|
|
3289
|
-
name: "analyze",
|
|
3290
|
-
description: "Code review and analysis for uncommitted changes, commits, branches, PRs, or specific files.",
|
|
3291
|
-
allowedAgents: ["*"],
|
|
3292
|
-
sourcePath: "src/skills/analyze"
|
|
3293
3287
|
}
|
|
3294
3288
|
];
|
|
3295
3289
|
|
|
@@ -22232,6 +22226,170 @@ function validateAllowedProviders(allowedProviders, enabledProviders) {
|
|
|
22232
22226
|
return null;
|
|
22233
22227
|
}
|
|
22234
22228
|
|
|
22229
|
+
// src/hooks/analyze-command/template/analyze.txt
|
|
22230
|
+
var analyze_default = `You are a code reviewer. Your job is to review code changes and provide actionable feedback.
|
|
22231
|
+
|
|
22232
|
+
---
|
|
22233
|
+
|
|
22234
|
+
$REVIEW_TARGET
|
|
22235
|
+
|
|
22236
|
+
---
|
|
22237
|
+
|
|
22238
|
+
## Gathering Context
|
|
22239
|
+
|
|
22240
|
+
**Diffs alone are not enough.** After getting the diff, read the entire file(s) being modified to understand the full context. Code that looks wrong in isolation may be correct given surrounding logic\u2014and vice versa.
|
|
22241
|
+
|
|
22242
|
+
- Use the diff to identify which files changed
|
|
22243
|
+
- Use \`git status --short\` to identify untracked files, then read their full contents
|
|
22244
|
+
- Read the full file to understand existing patterns, control flow, and error handling
|
|
22245
|
+
- Check for existing style guide or conventions files (CONVENTIONS.md, AGENTS.md, .editorconfig, etc.)
|
|
22246
|
+
|
|
22247
|
+
---
|
|
22248
|
+
|
|
22249
|
+
## What to Look For
|
|
22250
|
+
|
|
22251
|
+
**Bugs** - Your primary focus.
|
|
22252
|
+
- Logic errors, off-by-one mistakes, incorrect conditionals
|
|
22253
|
+
- If-else guards: missing guards, incorrect branching, unreachable code paths
|
|
22254
|
+
- Edge cases: null/empty/undefined inputs, error conditions, race conditions
|
|
22255
|
+
- Security issues: injection, auth bypass, data exposure
|
|
22256
|
+
- Broken error handling that swallows failures, throws unexpectedly or returns error types that are not caught.
|
|
22257
|
+
|
|
22258
|
+
**Structure** - Does the code fit the codebase?
|
|
22259
|
+
- Does it follow existing patterns and conventions?
|
|
22260
|
+
- Are there established abstractions it should use but doesn't?
|
|
22261
|
+
- Excessive nesting that could be flattened with early returns or extraction
|
|
22262
|
+
|
|
22263
|
+
**Performance** - Only flag if obviously problematic.
|
|
22264
|
+
- O(n\xB2) on unbounded data, N+1 queries, blocking I/O on hot paths
|
|
22265
|
+
|
|
22266
|
+
**Behavior Changes** - If a behavioral change is introduced, raise it (especially if it's possibly unintentional).
|
|
22267
|
+
|
|
22268
|
+
---
|
|
22269
|
+
|
|
22270
|
+
## Before You Flag Something
|
|
22271
|
+
|
|
22272
|
+
**Be certain.** If you're going to call something a bug, you need to be confident it actually is one.
|
|
22273
|
+
|
|
22274
|
+
- Only review the changes - do not review pre-existing code that wasn't modified
|
|
22275
|
+
- Don't flag something as a bug if you're unsure - investigate first
|
|
22276
|
+
- Don't invent hypothetical problems - if an edge case matters, explain the realistic scenario where it breaks
|
|
22277
|
+
- If you need more context to be sure, use the tools below to get it
|
|
22278
|
+
|
|
22279
|
+
**Don't be a zealot about style.** When checking code against conventions:
|
|
22280
|
+
|
|
22281
|
+
- Verify the code is *actually* in violation. Don't complain about else statements if early returns are already being used correctly.
|
|
22282
|
+
- Some "violations" are acceptable when they're the simplest option. A \`let\` statement is fine if the alternative is convoluted.
|
|
22283
|
+
- Excessive nesting is a legitimate concern regardless of other style choices.
|
|
22284
|
+
- Don't flag style preferences as issues unless they clearly violate established project conventions.
|
|
22285
|
+
|
|
22286
|
+
---
|
|
22287
|
+
|
|
22288
|
+
## Tools
|
|
22289
|
+
|
|
22290
|
+
Use these to inform your review:
|
|
22291
|
+
|
|
22292
|
+
- **@explorer** - Find how existing code handles similar problems. Check patterns, conventions, and prior art before claiming something doesn't fit.
|
|
22293
|
+
- **@librarian** - Verify correct usage of libraries/APIs before flagging something as wrong. Research best practices if you're unsure about a pattern.
|
|
22294
|
+
- **@oracle** - Consult on complex architectural decisions, design pattern trade-offs, or systemic concerns that go beyond the immediate diff.
|
|
22295
|
+
|
|
22296
|
+
If you're uncertain about something and can't verify it with these tools, say "I'm not sure about X" rather than flagging it as a definite issue.
|
|
22297
|
+
|
|
22298
|
+
---
|
|
22299
|
+
|
|
22300
|
+
## Output
|
|
22301
|
+
|
|
22302
|
+
1. If there is a bug, be direct and clear about why it is a bug.
|
|
22303
|
+
2. Clearly communicate severity of issues. Do not overstate severity.
|
|
22304
|
+
3. Critiques should clearly and explicitly communicate the scenarios, environments, or inputs that are necessary for the bug to arise. The comment should immediately indicate that the issue's severity depends on these factors.
|
|
22305
|
+
4. Your tone should be matter-of-fact and not accusatory or overly positive. It should read as a helpful AI assistant suggestion without sounding too much like a human reviewer.
|
|
22306
|
+
5. Write so the reader can quickly understand the issue without reading too closely.
|
|
22307
|
+
6. AVOID flattery, do not give any comments that are not helpful to the reader. Avoid phrasing like "Great job ...", "Thanks for ...".`;
|
|
22308
|
+
|
|
22309
|
+
// src/hooks/analyze-command/index.ts
|
|
22310
|
+
function detectReviewType(args) {
|
|
22311
|
+
if (!args)
|
|
22312
|
+
return "uncommitted";
|
|
22313
|
+
if (args.includes("github.com") || args.includes("gitlab.com") || args.includes("/pull/") || args.includes("/merge_requests/")) {
|
|
22314
|
+
return "pr";
|
|
22315
|
+
}
|
|
22316
|
+
if (/^#?\d+$/.test(args.trim()))
|
|
22317
|
+
return "pr";
|
|
22318
|
+
if (/^[0-9a-f]{7,40}$/i.test(args.trim()))
|
|
22319
|
+
return "commit";
|
|
22320
|
+
if (/\.\w+$/.test(args.trim()) || args.trim().startsWith("./") || args.trim().startsWith("/")) {
|
|
22321
|
+
return "file";
|
|
22322
|
+
}
|
|
22323
|
+
return "branch";
|
|
22324
|
+
}
|
|
22325
|
+
function buildReviewTarget(type, args) {
|
|
22326
|
+
switch (type) {
|
|
22327
|
+
case "uncommitted":
|
|
22328
|
+
return `## Review Target: Uncommitted Changes
|
|
22329
|
+
|
|
22330
|
+
Review all uncommitted changes in the current working directory.
|
|
22331
|
+
|
|
22332
|
+
- Run: \`git diff\` for unstaged changes
|
|
22333
|
+
- Run: \`git diff --cached\` for staged changes
|
|
22334
|
+
- Run: \`git status --short\` to identify untracked (net new) files`;
|
|
22335
|
+
case "commit":
|
|
22336
|
+
return `## Review Target: Commit \`${args}\`
|
|
22337
|
+
|
|
22338
|
+
Review the specified commit.
|
|
22339
|
+
|
|
22340
|
+
- Run: \`git show ${args}\``;
|
|
22341
|
+
case "branch":
|
|
22342
|
+
return `## Review Target: Branch \`${args}\`
|
|
22343
|
+
|
|
22344
|
+
Compare the current branch against the specified branch.
|
|
22345
|
+
|
|
22346
|
+
- Run: \`git diff ${args}...HEAD\``;
|
|
22347
|
+
case "pr":
|
|
22348
|
+
return `## Review Target: Pull Request \`${args}\`
|
|
22349
|
+
|
|
22350
|
+
Review the specified pull request.
|
|
22351
|
+
|
|
22352
|
+
- Run: \`gh pr view ${args}\` to get PR context
|
|
22353
|
+
- Run: \`gh pr diff ${args}\` to get the diff`;
|
|
22354
|
+
case "file":
|
|
22355
|
+
return `## Review Target: File \`${args}\`
|
|
22356
|
+
|
|
22357
|
+
Review a specific file and its recent changes.
|
|
22358
|
+
|
|
22359
|
+
- Verify the file exists and is a regular file (not a directory or binary)
|
|
22360
|
+
- Read the full file contents
|
|
22361
|
+
- Run: \`git log --oneline -10 "${args}"\` to see recent history
|
|
22362
|
+
- Run: \`git diff HEAD~5 -- "${args}"\` to get recent changes (adjust range based on log output)
|
|
22363
|
+
- Review the recent changes in context of the full file
|
|
22364
|
+
|
|
22365
|
+
If the file does not exist: "File not found: \`${args}\`. Please check the path and try again."
|
|
22366
|
+
If a directory was provided: "Cannot review a directory. Please provide a specific file path."`;
|
|
22367
|
+
}
|
|
22368
|
+
}
|
|
22369
|
+
function createAnalyzeCommandHook() {
|
|
22370
|
+
return {
|
|
22371
|
+
"command.execute.before": async (input, output) => {
|
|
22372
|
+
if (input.command === "analyze") {
|
|
22373
|
+
const args = input.arguments?.trim() || "";
|
|
22374
|
+
const reviewType = detectReviewType(args);
|
|
22375
|
+
log("[analyze-command] Intercepted /analyze command", {
|
|
22376
|
+
arguments: args,
|
|
22377
|
+
reviewType
|
|
22378
|
+
});
|
|
22379
|
+
const reviewTarget = buildReviewTarget(reviewType, args);
|
|
22380
|
+
const template = analyze_default.replace("$REVIEW_TARGET", reviewTarget);
|
|
22381
|
+
output.parts.push({
|
|
22382
|
+
type: "text",
|
|
22383
|
+
text: template
|
|
22384
|
+
});
|
|
22385
|
+
output.parts.push({
|
|
22386
|
+
type: "agent",
|
|
22387
|
+
name: "oracle"
|
|
22388
|
+
});
|
|
22389
|
+
}
|
|
22390
|
+
}
|
|
22391
|
+
};
|
|
22392
|
+
}
|
|
22235
22393
|
// src/hooks/auto-update-checker/cache.ts
|
|
22236
22394
|
import * as fs3 from "fs";
|
|
22237
22395
|
import * as path4 from "path";
|
|
@@ -39195,6 +39353,7 @@ var OhMyOpenCodeLite = async (ctx) => {
|
|
|
39195
39353
|
const phaseReminderHook = createPhaseReminderHook();
|
|
39196
39354
|
const postReadNudgeHook = createPostReadNudgeHook();
|
|
39197
39355
|
const questionRouterHook = createQuestionRouterHook(ctx);
|
|
39356
|
+
const analyzeCommandHook = createAnalyzeCommandHook();
|
|
39198
39357
|
const delegateTaskRetryHook = createDelegateTaskRetryHook(ctx);
|
|
39199
39358
|
const jsonErrorRecoveryHook = createJsonErrorRecoveryHook(ctx);
|
|
39200
39359
|
const hashlineReadEnhancerHook = createHashlineReadEnhancerHook(config3.hashline_edit);
|
|
@@ -39303,6 +39462,7 @@ var OhMyOpenCodeLite = async (ctx) => {
|
|
|
39303
39462
|
},
|
|
39304
39463
|
"experimental.chat.messages.transform": phaseReminderHook["experimental.chat.messages.transform"],
|
|
39305
39464
|
"chat.message": questionRouterHook["chat.message"],
|
|
39465
|
+
"command.execute.before": analyzeCommandHook["command.execute.before"],
|
|
39306
39466
|
"tool.execute.after": async (input, output) => {
|
|
39307
39467
|
await delegateTaskRetryHook["tool.execute.after"](input, output);
|
|
39308
39468
|
await jsonErrorRecoveryHook["tool.execute.after"](input, output);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frenchtoastman/oh-my-groundcontrol",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"description": "An OpenCode plugin for multi-agent orchestration for structured planning with NASA-style guardrails.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: analyze
|
|
3
|
-
description: Code review and analysis for uncommitted changes, commits, branches, PRs, or specific files.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
You are a code reviewer. Your job is to review code changes and provide actionable feedback.
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
Input: $ARGUMENTS
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Determining What to Review
|
|
15
|
-
|
|
16
|
-
Based on the input provided, determine which type of review to perform:
|
|
17
|
-
|
|
18
|
-
1. **No arguments (default)**: Review all uncommitted changes
|
|
19
|
-
- Run: `git diff` for unstaged changes
|
|
20
|
-
- Run: `git diff --cached` for staged changes
|
|
21
|
-
- Run: `git status --short` to identify untracked (net new) files
|
|
22
|
-
|
|
23
|
-
2. **Commit hash** (40-char SHA or short hash): Review that specific commit
|
|
24
|
-
- Run: `git show $ARGUMENTS`
|
|
25
|
-
|
|
26
|
-
3. **Branch name**: Compare current branch to the specified branch
|
|
27
|
-
- Run: `git diff $ARGUMENTS...HEAD`
|
|
28
|
-
|
|
29
|
-
4. **PR URL or number** (contains "github.com" or "pull" or looks like a PR number): Review the pull request
|
|
30
|
-
- Run: `gh pr view $ARGUMENTS` to get PR context
|
|
31
|
-
- Run: `gh pr diff $ARGUMENTS` to get the diff
|
|
32
|
-
|
|
33
|
-
5. **File path**: Review a specific file and its recent changes
|
|
34
|
-
- Verify the file exists and is a regular file (not a directory or binary)
|
|
35
|
-
- Read the full file contents
|
|
36
|
-
- Run: `git log --oneline -10 "$ARGUMENTS"` to see recent history
|
|
37
|
-
- Run: `git diff HEAD~5 -- "$ARGUMENTS"` to get recent changes (adjust range based on log output)
|
|
38
|
-
- Review the recent changes in context of the full file
|
|
39
|
-
|
|
40
|
-
If the file does not exist: "File not found: `<path>`. Please check the path and try again."
|
|
41
|
-
If the argument is a directory: "Cannot review a directory. Please provide a specific file path."
|
|
42
|
-
|
|
43
|
-
Use best judgement when processing input.
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## Gathering Context
|
|
48
|
-
|
|
49
|
-
**Diffs alone are not enough.** After getting the diff, read the entire file(s) being modified to understand the full context. Code that looks wrong in isolation may be correct given surrounding logic—and vice versa.
|
|
50
|
-
|
|
51
|
-
- Use the diff to identify which files changed
|
|
52
|
-
- Use `git status --short` to identify untracked files, then read their full contents
|
|
53
|
-
- Read the full file to understand existing patterns, control flow, and error handling
|
|
54
|
-
- Check for existing style guide or conventions files (CONVENTIONS.md, AGENTS.md, .editorconfig, etc.)
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## What to Look For
|
|
59
|
-
|
|
60
|
-
**Bugs** - Your primary focus.
|
|
61
|
-
- Logic errors, off-by-one mistakes, incorrect conditionals
|
|
62
|
-
- If-else guards: missing guards, incorrect branching, unreachable code paths
|
|
63
|
-
- Edge cases: null/empty/undefined inputs, error conditions, race conditions
|
|
64
|
-
- Security issues: injection, auth bypass, data exposure
|
|
65
|
-
- Broken error handling that swallows failures, throws unexpectedly or returns error types that are not caught.
|
|
66
|
-
|
|
67
|
-
**Structure** - Does the code fit the codebase?
|
|
68
|
-
- Does it follow existing patterns and conventions?
|
|
69
|
-
- Are there established abstractions it should use but doesn't?
|
|
70
|
-
- Excessive nesting that could be flattened with early returns or extraction
|
|
71
|
-
|
|
72
|
-
**Performance** - Only flag if obviously problematic.
|
|
73
|
-
- O(n^2) on unbounded data, N+1 queries, blocking I/O on hot paths
|
|
74
|
-
|
|
75
|
-
**Behavior Changes** - If a behavioral change is introduced, raise it (especially if it's possibly unintentional).
|
|
76
|
-
|
|
77
|
-
---
|
|
78
|
-
|
|
79
|
-
## Before You Flag Something
|
|
80
|
-
|
|
81
|
-
**Be certain.** If you're going to call something a bug, you need to be confident it actually is one.
|
|
82
|
-
|
|
83
|
-
- Only review the changes - do not review pre-existing code that wasn't modified
|
|
84
|
-
- Don't flag something as a bug if you're unsure - investigate first
|
|
85
|
-
- Don't invent hypothetical problems - if an edge case matters, explain the realistic scenario where it breaks
|
|
86
|
-
- If you need more context to be sure, use the tools below to get it
|
|
87
|
-
|
|
88
|
-
**Don't be a zealot about style.** When checking code against conventions:
|
|
89
|
-
|
|
90
|
-
- Verify the code is *actually* in violation. Don't complain about else statements if early returns are already being used correctly.
|
|
91
|
-
- Some "violations" are acceptable when they're the simplest option. A `let` statement is fine if the alternative is convoluted.
|
|
92
|
-
- Excessive nesting is a legitimate concern regardless of other style choices.
|
|
93
|
-
- Don't flag style preferences as issues unless they clearly violate established project conventions.
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
## Tools
|
|
98
|
-
|
|
99
|
-
Use these to inform your review:
|
|
100
|
-
|
|
101
|
-
- **@explorer** - Find how existing code handles similar problems. Check patterns, conventions, and prior art before claiming something doesn't fit.
|
|
102
|
-
- **@librarian** - Verify correct usage of libraries/APIs before flagging something as wrong. Research best practices if you're unsure about a pattern.
|
|
103
|
-
- **@oracle** - Consult on complex architectural decisions, design pattern trade-offs, or systemic concerns that go beyond the immediate diff.
|
|
104
|
-
|
|
105
|
-
If you're uncertain about something and can't verify it with these tools, say "I'm not sure about X" rather than flagging it as a definite issue.
|
|
106
|
-
|
|
107
|
-
---
|
|
108
|
-
|
|
109
|
-
## Output
|
|
110
|
-
|
|
111
|
-
1. If there is a bug, be direct and clear about why it is a bug.
|
|
112
|
-
2. Clearly communicate severity of issues. Do not overstate severity.
|
|
113
|
-
3. Critiques should clearly and explicitly communicate the scenarios, environments, or inputs that are necessary for the bug to arise. The comment should immediately indicate that the issue's severity depends on these factors.
|
|
114
|
-
4. Your tone should be matter-of-fact and not accusatory or overly positive. It should read as a helpful AI assistant suggestion without sounding too much like a human reviewer.
|
|
115
|
-
5. Write so the reader can quickly understand the issue without reading too closely.
|
|
116
|
-
6. AVOID flattery, do not give any comments that are not helpful to the reader. Avoid phrasing like "Great job ...", "Thanks for ...".
|