opencode-design-lab 0.0.4 → 0.0.5
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.
|
@@ -3463,8 +3463,20 @@ function formatTimestamp() {
|
|
|
3463
3463
|
const now = /* @__PURE__ */ new Date();
|
|
3464
3464
|
return `${String(now.getHours()).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}:${String(now.getSeconds()).padStart(2, "0")}.${String(now.getMilliseconds()).padStart(3, "0")}`;
|
|
3465
3465
|
}
|
|
3466
|
+
/**
|
|
3467
|
+
* Get the global config directory for logs (cross-platform)
|
|
3468
|
+
*/
|
|
3469
|
+
function getLogDirectory() {
|
|
3470
|
+
let configDir;
|
|
3471
|
+
if (process.platform === "win32") configDir = process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming");
|
|
3472
|
+
else configDir = process.env.XDG_CONFIG_HOME || path.join(os.homedir(), ".config");
|
|
3473
|
+
const logDir = path.join(configDir, "opencode");
|
|
3474
|
+
if (!fs.existsSync(logDir)) fs.mkdirSync(logDir, { recursive: true });
|
|
3475
|
+
return logDir;
|
|
3476
|
+
}
|
|
3466
3477
|
function createLogStream() {
|
|
3467
|
-
const
|
|
3478
|
+
const logDir = getLogDirectory();
|
|
3479
|
+
const logPath = path.join(logDir, "design-lab.log");
|
|
3468
3480
|
const stream = fs.createWriteStream(logPath, { flags: "a" });
|
|
3469
3481
|
return import_pino.default.multistream([{
|
|
3470
3482
|
level: "trace",
|
|
@@ -3669,6 +3681,70 @@ function normalizeAgentSuffix(model) {
|
|
|
3669
3681
|
return normalizeModelSlug(model).replace(/-/g, "");
|
|
3670
3682
|
}
|
|
3671
3683
|
|
|
3684
|
+
//#endregion
|
|
3685
|
+
//#region src/commands/index.ts
|
|
3686
|
+
/**
|
|
3687
|
+
* Build the `/design` command configuration.
|
|
3688
|
+
*
|
|
3689
|
+
* Usage: /design <topic>
|
|
3690
|
+
* Triggers the full design generation workflow — creates a run directory,
|
|
3691
|
+
* delegates to all model subagents, and produces design files.
|
|
3692
|
+
*/
|
|
3693
|
+
function buildDesignCommand(options) {
|
|
3694
|
+
const designList = options.designModels.map((spec) => `- ${spec.agentName} → designs/${spec.fileStem}.md`).join("\n");
|
|
3695
|
+
return {
|
|
3696
|
+
description: "Generate design proposals from all configured models for a given topic",
|
|
3697
|
+
agent: "designer",
|
|
3698
|
+
template: `Generate designs for the following topic:
|
|
3699
|
+
|
|
3700
|
+
$input
|
|
3701
|
+
|
|
3702
|
+
## Instructions
|
|
3703
|
+
|
|
3704
|
+
1. Create a run directory: ${options.baseOutputDir}/YYYY-MM-DD-<topic-slug>/
|
|
3705
|
+
Use today's date and a short hyphenated slug derived from the topic.
|
|
3706
|
+
2. Create subdirectory: designs/
|
|
3707
|
+
3. Delegate design generation to each subagent sequentially:
|
|
3708
|
+
${designList}
|
|
3709
|
+
4. Each subagent must write its design to the specified output_file path.
|
|
3710
|
+
5. After all designs are written, report the run directory and list of generated files.
|
|
3711
|
+
|
|
3712
|
+
Do NOT run reviews. Only generate designs.`
|
|
3713
|
+
};
|
|
3714
|
+
}
|
|
3715
|
+
/**
|
|
3716
|
+
* Build the `/review` command configuration.
|
|
3717
|
+
*
|
|
3718
|
+
* Usage: /review [run-directory]
|
|
3719
|
+
* Triggers cross-review of existing designs. If no directory is given,
|
|
3720
|
+
* finds the most recent run under the base output directory.
|
|
3721
|
+
*/
|
|
3722
|
+
function buildReviewCommand(options) {
|
|
3723
|
+
const reviewList = options.reviewModels.map((spec) => `- ${spec.agentName} → reviews/review-${spec.fileStem}.md`).join("\n");
|
|
3724
|
+
return {
|
|
3725
|
+
description: "Run cross-reviews on existing designs using all configured review models",
|
|
3726
|
+
agent: "designer",
|
|
3727
|
+
template: `Run cross-reviews on existing designs.
|
|
3728
|
+
|
|
3729
|
+
$input
|
|
3730
|
+
|
|
3731
|
+
## Instructions
|
|
3732
|
+
|
|
3733
|
+
1. If a run directory is specified above, use it. Otherwise, find the most
|
|
3734
|
+
recent run directory under ${options.baseOutputDir}/ (sort by date prefix).
|
|
3735
|
+
2. Read all design files from the designs/ subdirectory.
|
|
3736
|
+
3. Create subdirectory: reviews/ (if it doesn't exist).
|
|
3737
|
+
4. Delegate review tasks to each review subagent sequentially:
|
|
3738
|
+
${reviewList}
|
|
3739
|
+
5. Each reviewer must read ALL designs and produce ONE comparative markdown
|
|
3740
|
+
report written to its output_file path.
|
|
3741
|
+
6. After all reviews are written, read them and produce a summary:
|
|
3742
|
+
- Which design is recommended overall
|
|
3743
|
+
- Approximate scores per design
|
|
3744
|
+
- Notable disagreements between reviewers`
|
|
3745
|
+
};
|
|
3746
|
+
}
|
|
3747
|
+
|
|
3672
3748
|
//#endregion
|
|
3673
3749
|
//#region node_modules/zod/v4/core/core.js
|
|
3674
3750
|
/** A special constant with type `never` */
|
|
@@ -7733,12 +7809,27 @@ const DesignLab = async (ctx) => {
|
|
|
7733
7809
|
}),
|
|
7734
7810
|
...Object.fromEntries(subagentEntries)
|
|
7735
7811
|
};
|
|
7812
|
+
config$1.command = {
|
|
7813
|
+
...config$1.command ?? {},
|
|
7814
|
+
"design-lab:design": buildDesignCommand({
|
|
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
|
+
})
|
|
7824
|
+
};
|
|
7736
7825
|
const agentKeys = Object.keys(config$1.agent ?? {});
|
|
7826
|
+
const commandKeys = Object.keys(config$1.command ?? {});
|
|
7737
7827
|
logger.info({
|
|
7738
7828
|
designModels,
|
|
7739
7829
|
reviewModels,
|
|
7740
|
-
agentsRegistered: agentKeys
|
|
7741
|
-
|
|
7830
|
+
agentsRegistered: agentKeys,
|
|
7831
|
+
commandsRegistered: commandKeys
|
|
7832
|
+
}, "DesignLab agents and commands registered");
|
|
7742
7833
|
} };
|
|
7743
7834
|
};
|
|
7744
7835
|
function uniqueModels(models) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-design-lab",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
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",
|