opencode-code-simplifier 1.3.0 → 1.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/dist/plugin.js +1 -53
- package/package.json +1 -1
package/dist/plugin.js
CHANGED
|
@@ -12439,31 +12439,11 @@ Simplify code for clarity while preserving exact functionality.
|
|
|
12439
12439
|
Skip when:
|
|
12440
12440
|
- User wants exact structure preserved
|
|
12441
12441
|
- Code is already clean`;
|
|
12442
|
-
var COMMAND_CONTENT = `---
|
|
12443
|
-
description: Simplify code for clarity while preserving functionality
|
|
12444
|
-
agent: code
|
|
12445
|
-
---
|
|
12446
|
-
|
|
12447
|
-
Use code-simplifier skill to simplify recently modified code.
|
|
12448
|
-
|
|
12449
|
-
Focus on:
|
|
12450
|
-
1. Reducing complexity and nesting
|
|
12451
|
-
2. Eliminating nested ternaries
|
|
12452
|
-
3. Improving readability with clear names
|
|
12453
|
-
4. Extracting reusable functions
|
|
12454
|
-
5. Removing debug artifacts (unconditional console.log, debugger, commented code)
|
|
12455
|
-
6. Removing obvious comments
|
|
12456
|
-
7. Preserving all functionality
|
|
12457
|
-
|
|
12458
|
-
If no file specified, focus on recently modified code.
|
|
12459
|
-
|
|
12460
|
-
User request: $ARGUMENTS`;
|
|
12461
12442
|
function ensureFilesExist() {
|
|
12462
12443
|
const configDir = join(homedir(), ".config", "opencode");
|
|
12463
12444
|
const files = [
|
|
12464
12445
|
{ path: "skills/code-simplifier/SKILL.md", content: SKILL_CONTENT },
|
|
12465
|
-
{ path: "rules/code-simplifier.md", content: RULES_CONTENT }
|
|
12466
|
-
{ path: "commands/simplify.md", content: COMMAND_CONTENT }
|
|
12446
|
+
{ path: "rules/code-simplifier.md", content: RULES_CONTENT }
|
|
12467
12447
|
];
|
|
12468
12448
|
for (const file2 of files) {
|
|
12469
12449
|
const fullPath = join(configDir, file2.path);
|
|
@@ -12476,39 +12456,7 @@ function ensureFilesExist() {
|
|
|
12476
12456
|
}
|
|
12477
12457
|
var CodeSimplifier = async ({ client }) => {
|
|
12478
12458
|
ensureFilesExist();
|
|
12479
|
-
await client.app.log({
|
|
12480
|
-
body: {
|
|
12481
|
-
service: "code-simplifier",
|
|
12482
|
-
level: "info",
|
|
12483
|
-
message: "Code Simplifier loaded. Use /simplify or the simplify-code tool."
|
|
12484
|
-
}
|
|
12485
|
-
});
|
|
12486
12459
|
return {
|
|
12487
|
-
event: async ({ event }) => {
|
|
12488
|
-
if (event.type === "session.created") {
|
|
12489
|
-
await client.app.log({
|
|
12490
|
-
body: {
|
|
12491
|
-
service: "code-simplifier",
|
|
12492
|
-
level: "info",
|
|
12493
|
-
message: "Code Simplifier active for this session."
|
|
12494
|
-
}
|
|
12495
|
-
});
|
|
12496
|
-
}
|
|
12497
|
-
},
|
|
12498
|
-
"tool.execute.after": async (input, output) => {
|
|
12499
|
-
if (input.tool === "write" || input.tool === "edit") {
|
|
12500
|
-
const filePath = input?.args?.filePath || input?.args?.file_path;
|
|
12501
|
-
if (filePath) {
|
|
12502
|
-
await client.app.log({
|
|
12503
|
-
body: {
|
|
12504
|
-
service: "code-simplifier",
|
|
12505
|
-
level: "debug",
|
|
12506
|
-
message: `Code modified: ${filePath}`
|
|
12507
|
-
}
|
|
12508
|
-
});
|
|
12509
|
-
}
|
|
12510
|
-
}
|
|
12511
|
-
},
|
|
12512
12460
|
tool: {
|
|
12513
12461
|
"simplify-code": tool({
|
|
12514
12462
|
description: "Simplify code for clarity while preserving functionality",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-code-simplifier",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Code simplifier plugin for OpenCode - simplifies and refines code for clarity while preserving functionality",
|
|
5
5
|
"main": "dist/plugin.js",
|
|
6
6
|
"types": "dist/plugin.d.ts",
|