opencode-design-lab 0.0.5 → 0.1.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/.opencode/plugins/design-lab.js +115 -61
- package/package.json +6 -9
|
@@ -3596,16 +3596,20 @@ ${options.reviewModels.map((spec) => `- ${spec.agentName} (model: ${spec.model},
|
|
|
3596
3596
|
2. Create subdirectories:
|
|
3597
3597
|
- designs/
|
|
3598
3598
|
- reviews/
|
|
3599
|
-
3. For each design subagent, delegate a design task
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3599
|
+
3. For each design subagent, delegate a design task in parallel:
|
|
3600
|
+
- Use delegate_task for ALL design subagents simultaneously (do not wait for each to complete)
|
|
3601
|
+
- Provide the requirements and the exact output_file path:
|
|
3602
|
+
${options.baseOutputDir}/YYYY-MM-DD-topic/designs/{fileStem}.md
|
|
3603
|
+
- The output_file path is mandatory. If you omit it, the subagent must fail.
|
|
3604
|
+
- Instruct the subagent to write ONLY to the file and NOT to output the design in chat.
|
|
3605
|
+
- Wait for ALL design subagents to complete before proceeding.
|
|
3606
|
+
4. After all designs are written, delegate review tasks in parallel:
|
|
3607
|
+
- Use delegate_task for ALL review subagents simultaneously (do not wait for each to complete)
|
|
3608
|
+
- Provide the list of design file paths.
|
|
3609
|
+
- Provide the exact output_file path:
|
|
3610
|
+
${options.baseOutputDir}/YYYY-MM-DD-topic/reviews/review-{fileStem}.md
|
|
3611
|
+
- Each reviewer must produce ONE markdown report comparing ALL designs at once.
|
|
3612
|
+
- Wait for ALL review subagents to complete before proceeding.
|
|
3609
3613
|
5. After all reviews are written, read every review file and produce a short summary:
|
|
3610
3614
|
- Which design is recommended overall
|
|
3611
3615
|
- Approximate scores per design (from the score table)
|
|
@@ -3616,7 +3620,6 @@ ${options.reviewModels.map((spec) => `- ${spec.agentName} (model: ${spec.model},
|
|
|
3616
3620
|
- Never paste design or review content into the main chat.
|
|
3617
3621
|
- Return only a concise summary with the run directory, file paths, and the review summary.
|
|
3618
3622
|
- If asked "what agents will you call", list the design subagents by name.
|
|
3619
|
-
- If the user asks for parallel execution, explain that you run sequentially for stability.
|
|
3620
3623
|
- Use only the subagents listed above; do not invent agent names.`;
|
|
3621
3624
|
}
|
|
3622
3625
|
function buildDesignerSubagentPrompt(model) {
|
|
@@ -3684,6 +3687,52 @@ function normalizeAgentSuffix(model) {
|
|
|
3684
3687
|
//#endregion
|
|
3685
3688
|
//#region src/commands/index.ts
|
|
3686
3689
|
/**
|
|
3690
|
+
* Build the `/init` command configuration.
|
|
3691
|
+
*
|
|
3692
|
+
* Usage: /design-lab:init
|
|
3693
|
+
* Initializes a new design-lab.json config file in the project's .opencode directory
|
|
3694
|
+
* using the bundled template as a starting point.
|
|
3695
|
+
*/
|
|
3696
|
+
function buildInitCommand(baseDir) {
|
|
3697
|
+
return {
|
|
3698
|
+
description: "Initialize design-lab.json config in .opencode/ (creates from template)",
|
|
3699
|
+
template: `Initialize the Design Lab configuration file.
|
|
3700
|
+
|
|
3701
|
+
Create a new design-lab.json file at: ${baseDir}/.opencode/design-lab.json
|
|
3702
|
+
|
|
3703
|
+
## Instructions
|
|
3704
|
+
|
|
3705
|
+
1. Check if ${baseDir}/.opencode/design-lab.json already exists
|
|
3706
|
+
2. If it exists, report that the config already exists and show its path
|
|
3707
|
+
3. If it doesn't exist:
|
|
3708
|
+
- Create the .opencode/ directory if it doesn't exist
|
|
3709
|
+
- Copy the bundled template to ${baseDir}/.opencode/design-lab.json
|
|
3710
|
+
- Report success and show the path to the created file
|
|
3711
|
+
|
|
3712
|
+
Here is a template
|
|
3713
|
+
{
|
|
3714
|
+
"design_models": [
|
|
3715
|
+
"opencode/kimi-k2.5-free",
|
|
3716
|
+
"zhipuai-coding-plan/glm-4.7",
|
|
3717
|
+
"openai/gpt-5.2-codex",
|
|
3718
|
+
"google/antigravity-gemini-3-pro",
|
|
3719
|
+
"anthropic/claude-opus-4-5"
|
|
3720
|
+
],
|
|
3721
|
+
"review_models": [
|
|
3722
|
+
"opencode/kimi-k2.5-free",
|
|
3723
|
+
"zhipuai-coding-plan/glm-4.7",
|
|
3724
|
+
"openai/gpt-5.2-codex",
|
|
3725
|
+
"google/antigravity-gemini-3-pro",
|
|
3726
|
+
"anthropic/claude-opus-4-5"
|
|
3727
|
+
],
|
|
3728
|
+
"base_output_dir": ".design-lab",
|
|
3729
|
+
"design_agent_temperature": 0.7,
|
|
3730
|
+
"review_agent_temperature": 0.1
|
|
3731
|
+
}
|
|
3732
|
+
`
|
|
3733
|
+
};
|
|
3734
|
+
}
|
|
3735
|
+
/**
|
|
3687
3736
|
* Build the `/design` command configuration.
|
|
3688
3737
|
*
|
|
3689
3738
|
* Usage: /design <topic>
|
|
@@ -3704,10 +3753,11 @@ $input
|
|
|
3704
3753
|
1. Create a run directory: ${options.baseOutputDir}/YYYY-MM-DD-<topic-slug>/
|
|
3705
3754
|
Use today's date and a short hyphenated slug derived from the topic.
|
|
3706
3755
|
2. Create subdirectory: designs/
|
|
3707
|
-
3. Delegate design generation to each subagent
|
|
3756
|
+
3. Delegate design generation to each subagent in parallel:
|
|
3708
3757
|
${designList}
|
|
3709
|
-
4.
|
|
3710
|
-
5.
|
|
3758
|
+
4. Fire all delegate_task calls simultaneously - do NOT wait for each to complete before starting the next.
|
|
3759
|
+
5. Each subagent must write its design to the specified output_file path.
|
|
3760
|
+
6. Wait for ALL subagents to complete, then report the run directory and list of generated files.
|
|
3711
3761
|
|
|
3712
3762
|
Do NOT run reviews. Only generate designs.`
|
|
3713
3763
|
};
|
|
@@ -3734,11 +3784,12 @@ $input
|
|
|
3734
3784
|
recent run directory under ${options.baseOutputDir}/ (sort by date prefix).
|
|
3735
3785
|
2. Read all design files from the designs/ subdirectory.
|
|
3736
3786
|
3. Create subdirectory: reviews/ (if it doesn't exist).
|
|
3737
|
-
4. Delegate review tasks to each review subagent
|
|
3787
|
+
4. Delegate review tasks to each review subagent in parallel:
|
|
3738
3788
|
${reviewList}
|
|
3739
|
-
5.
|
|
3789
|
+
5. Fire all delegate_task calls simultaneously - do NOT wait for each to complete before starting the next.
|
|
3790
|
+
6. Each reviewer must read ALL designs and produce ONE comparative markdown
|
|
3740
3791
|
report written to its output_file path.
|
|
3741
|
-
|
|
3792
|
+
7. Wait for ALL review subagents to complete, then read the reviews and produce a summary:
|
|
3742
3793
|
- Which design is recommended overall
|
|
3743
3794
|
- Approximate scores per design
|
|
3744
3795
|
- Notable disagreements between reviewers`
|
|
@@ -7596,7 +7647,7 @@ const meta = meta$1;
|
|
|
7596
7647
|
* Configuration schema for OpenCode Design Lab plugin
|
|
7597
7648
|
*/
|
|
7598
7649
|
const DesignLabConfigSchema = object({
|
|
7599
|
-
|
|
7650
|
+
$schema: string().optional(),
|
|
7600
7651
|
design_models: array(string()).min(2, "At least 2 design models required"),
|
|
7601
7652
|
review_models: array(string()).optional(),
|
|
7602
7653
|
base_output_dir: string().default(".design-lab"),
|
|
@@ -7783,53 +7834,56 @@ function loadPluginConfig(directory) {
|
|
|
7783
7834
|
*/
|
|
7784
7835
|
const DesignLab = async (ctx) => {
|
|
7785
7836
|
const pluginConfig = loadPluginConfig(ctx.directory);
|
|
7786
|
-
if (!pluginConfig)
|
|
7787
|
-
|
|
7788
|
-
return {};
|
|
7789
|
-
}
|
|
7790
|
-
logger.info("Design Lab Plugin Loaded");
|
|
7837
|
+
if (!pluginConfig) logger.warn("DesignLab config not found; only init command will be available");
|
|
7838
|
+
else logger.info("Design Lab Plugin Loaded");
|
|
7791
7839
|
return { config: async (config$1) => {
|
|
7792
|
-
const designModels = uniqueModels(pluginConfig.design_models);
|
|
7793
|
-
const reviewModels = uniqueModels(pluginConfig.review_models ?? pluginConfig.design_models);
|
|
7794
|
-
const allModels = uniqueModels([...designModels, ...reviewModels]);
|
|
7795
|
-
const modelSpecs = new Map(allModels.map((model) => [model, {
|
|
7796
|
-
model,
|
|
7797
|
-
agentName: getDesignerSubagentName(model),
|
|
7798
|
-
fileStem: getDesignerModelFileStem(model)
|
|
7799
|
-
}]));
|
|
7800
|
-
const designSpecs = designModels.map((model) => modelSpecs.get(model)).filter(isModelSpec);
|
|
7801
|
-
const reviewSpecs = reviewModels.map((model) => modelSpecs.get(model)).filter(isModelSpec);
|
|
7802
|
-
const subagentEntries = Array.from(modelSpecs.values()).map((spec) => [spec.agentName, createDesignerModelAgent(spec.model)]);
|
|
7803
|
-
config$1.agent = {
|
|
7804
|
-
...config$1.agent ?? {},
|
|
7805
|
-
designer: createDesignerPrimaryAgent({
|
|
7806
|
-
baseOutputDir: pluginConfig.base_output_dir,
|
|
7807
|
-
designModels: designSpecs,
|
|
7808
|
-
reviewModels: reviewSpecs
|
|
7809
|
-
}),
|
|
7810
|
-
...Object.fromEntries(subagentEntries)
|
|
7811
|
-
};
|
|
7812
7840
|
config$1.command = {
|
|
7813
7841
|
...config$1.command ?? {},
|
|
7814
|
-
"design-lab:
|
|
7815
|
-
baseOutputDir: pluginConfig.base_output_dir,
|
|
7816
|
-
designModels: designSpecs,
|
|
7817
|
-
reviewModels: reviewSpecs
|
|
7818
|
-
}),
|
|
7819
|
-
"design-lab:review": buildReviewCommand({
|
|
7820
|
-
baseOutputDir: pluginConfig.base_output_dir,
|
|
7821
|
-
designModels: designSpecs,
|
|
7822
|
-
reviewModels: reviewSpecs
|
|
7823
|
-
})
|
|
7842
|
+
"design-lab:init": buildInitCommand(ctx.directory)
|
|
7824
7843
|
};
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
designModels,
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7844
|
+
if (pluginConfig) {
|
|
7845
|
+
const designModels = uniqueModels(pluginConfig.design_models);
|
|
7846
|
+
const reviewModels = uniqueModels(pluginConfig.review_models ?? pluginConfig.design_models);
|
|
7847
|
+
const allModels = uniqueModels([...designModels, ...reviewModels]);
|
|
7848
|
+
const modelSpecs = new Map(allModels.map((model) => [model, {
|
|
7849
|
+
model,
|
|
7850
|
+
agentName: getDesignerSubagentName(model),
|
|
7851
|
+
fileStem: getDesignerModelFileStem(model)
|
|
7852
|
+
}]));
|
|
7853
|
+
const designSpecs = designModels.map((model) => modelSpecs.get(model)).filter(isModelSpec);
|
|
7854
|
+
const reviewSpecs = reviewModels.map((model) => modelSpecs.get(model)).filter(isModelSpec);
|
|
7855
|
+
const subagentEntries = Array.from(modelSpecs.values()).map((spec) => [spec.agentName, createDesignerModelAgent(spec.model)]);
|
|
7856
|
+
config$1.agent = {
|
|
7857
|
+
...config$1.agent ?? {},
|
|
7858
|
+
designer: createDesignerPrimaryAgent({
|
|
7859
|
+
baseOutputDir: pluginConfig.base_output_dir,
|
|
7860
|
+
designModels: designSpecs,
|
|
7861
|
+
reviewModels: reviewSpecs
|
|
7862
|
+
}),
|
|
7863
|
+
...Object.fromEntries(subagentEntries)
|
|
7864
|
+
};
|
|
7865
|
+
config$1.command = {
|
|
7866
|
+
...config$1.command ?? {},
|
|
7867
|
+
"design-lab:design": buildDesignCommand({
|
|
7868
|
+
baseOutputDir: pluginConfig.base_output_dir,
|
|
7869
|
+
designModels: designSpecs,
|
|
7870
|
+
reviewModels: reviewSpecs
|
|
7871
|
+
}),
|
|
7872
|
+
"design-lab:review": buildReviewCommand({
|
|
7873
|
+
baseOutputDir: pluginConfig.base_output_dir,
|
|
7874
|
+
designModels: designSpecs,
|
|
7875
|
+
reviewModels: reviewSpecs
|
|
7876
|
+
})
|
|
7877
|
+
};
|
|
7878
|
+
const agentKeys = Object.keys(config$1.agent ?? {});
|
|
7879
|
+
const commandKeys = Object.keys(config$1.command ?? {});
|
|
7880
|
+
logger.info({
|
|
7881
|
+
designModels,
|
|
7882
|
+
reviewModels,
|
|
7883
|
+
agentsRegistered: agentKeys,
|
|
7884
|
+
commandsRegistered: commandKeys
|
|
7885
|
+
}, "DesignLab agents and commands registered");
|
|
7886
|
+
} else logger.info({ command: "design-lab:init" }, "DesignLab init command registered (config missing)");
|
|
7833
7887
|
} };
|
|
7834
7888
|
};
|
|
7835
7889
|
function uniqueModels(models) {
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-design-lab",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"description": "An OpenCode plugin that generates multiple independent design proposals using different AI models, then systematically evaluates, compares, and ranks those designs in a reproducible and structured way.",
|
|
6
6
|
"author": "OpenCode Design Lab Contributors",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"homepage": "https://github.com/
|
|
8
|
+
"homepage": "https://github.com/yourorg/opencode-design-lab#readme",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/
|
|
11
|
+
"url": "git+https://github.com/yourorg/opencode-design-lab.git"
|
|
12
12
|
},
|
|
13
13
|
"bugs": {
|
|
14
|
-
"url": "https://github.com/
|
|
14
|
+
"url": "https://github.com/yourorg/opencode-design-lab/issues"
|
|
15
15
|
},
|
|
16
16
|
"main": ".opencode/plugins/design-lab.js",
|
|
17
17
|
"files": [
|
|
@@ -29,17 +29,14 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^25.0.3",
|
|
31
31
|
"bumpp": "^10.3.2",
|
|
32
|
-
"pino-pretty": "^13.1.3",
|
|
33
32
|
"tsdown": "^0.19.0",
|
|
34
|
-
"tsx": "^4.19.0",
|
|
35
33
|
"typescript": "^5.9.3",
|
|
36
|
-
"vitest": "^4.0.16"
|
|
34
|
+
"vitest": "^4.0.16",
|
|
35
|
+
"tsx": "^4.19.0"
|
|
37
36
|
},
|
|
38
37
|
"dependencies": {
|
|
39
|
-
"@modelcontextprotocol/sdk": "^1.25.3",
|
|
40
38
|
"@opencode-ai/plugin": "^1.1.27",
|
|
41
39
|
"@opencode-ai/sdk": "^1.1.27",
|
|
42
|
-
"pino": "^10.2.1",
|
|
43
40
|
"zod": "^4.3.5"
|
|
44
41
|
}
|
|
45
42
|
}
|