diff --git a/plugins/studio/.codex-plugin/plugin.json b/plugins/studio/.codex-plugin/plugin.json index e642c02..623a00c 100644 --- a/plugins/studio/.codex-plugin/plugin.json +++ b/plugins/studio/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "studio", - "version": "0.3.3", + "version": "0.3.4", "description": "DETA Studio 插件:以 AML 为唯一事实源编辑建筑模型,编译为建筑模型并执行规则校验。", "author": { "name": "DETA", diff --git a/plugins/studio/bin/deta-cli.mjs b/plugins/studio/bin/deta-cli.mjs index 99c81ac..f2b2a73 100644 --- a/plugins/studio/bin/deta-cli.mjs +++ b/plugins/studio/bin/deta-cli.mjs @@ -23,8 +23,17 @@ import { fileURLToPath } from 'node:url'; const HERE = dirname(fileURLToPath(import.meta.url)); const HOME = homedir(); const DETA_DIR = join(HOME, '.deta'); -/** 产品档位:由本文件所在插件目录名决定(studio / writer),DETA_PROFILE 可覆盖 */ -const PROFILE = process.env.DETA_PROFILE || basename(join(HERE, '..')); +/** 产品档位:优先读插件清单的 name——开发态是 `plugins/studio`,而宿主缓存布局是 + * `<市场>/<插件>/<版本>/`,从路径取目录名会把版本号当成产品名(实测踩过)。 */ +function detectProfile() { + if (process.env.DETA_PROFILE) return process.env.DETA_PROFILE; + try { + const manifest = JSON.parse(readFileSync(join(HERE, '..', '.codex-plugin', 'plugin.json'), 'utf8')); + if (typeof manifest?.name === 'string' && manifest.name) return manifest.name; + } catch { /* 清单不可读时回落目录名(仅开发态正确) */ } + return basename(join(HERE, '..')); +} +const PROFILE = detectProfile(); function readToken() { if (process.env.DETA_TOKEN) return { source: '环境变量 DETA_TOKEN', token: process.env.DETA_TOKEN }; diff --git a/plugins/studio/package-lock.json b/plugins/studio/package-lock.json index 8cdaf84..bc48d86 100644 --- a/plugins/studio/package-lock.json +++ b/plugins/studio/package-lock.json @@ -1,12 +1,12 @@ { "name": "deta-studio-plugin", - "version": "0.3.3", + "version": "0.3.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "deta-studio-plugin", - "version": "0.3.3", + "version": "0.3.4", "license": "Proprietary" } } diff --git a/plugins/studio/package.json b/plugins/studio/package.json index eefad9a..b648cda 100644 --- a/plugins/studio/package.json +++ b/plugins/studio/package.json @@ -1,6 +1,6 @@ { "name": "deta-studio-plugin", - "version": "0.3.3", + "version": "0.3.4", "description": "DETA Studio:AML 建筑模型读写与编译校验(Codex 插件 / dsh 组合包 双壳)", "type": "module", "license": "Proprietary", diff --git a/plugins/writer/.codex-plugin/plugin.json b/plugins/writer/.codex-plugin/plugin.json index 214629c..ba874ce 100644 --- a/plugins/writer/.codex-plugin/plugin.json +++ b/plugins/writer/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "writer", - "version": "0.1.1", + "version": "0.1.2", "description": "DETA Writer 插件:读取建筑模型与模拟结果,产出报告 / 文档内容。", "author": { "name": "DETA", diff --git a/plugins/writer/bin/deta-cli.mjs b/plugins/writer/bin/deta-cli.mjs index 99c81ac..f2b2a73 100644 --- a/plugins/writer/bin/deta-cli.mjs +++ b/plugins/writer/bin/deta-cli.mjs @@ -23,8 +23,17 @@ import { fileURLToPath } from 'node:url'; const HERE = dirname(fileURLToPath(import.meta.url)); const HOME = homedir(); const DETA_DIR = join(HOME, '.deta'); -/** 产品档位:由本文件所在插件目录名决定(studio / writer),DETA_PROFILE 可覆盖 */ -const PROFILE = process.env.DETA_PROFILE || basename(join(HERE, '..')); +/** 产品档位:优先读插件清单的 name——开发态是 `plugins/studio`,而宿主缓存布局是 + * `<市场>/<插件>/<版本>/`,从路径取目录名会把版本号当成产品名(实测踩过)。 */ +function detectProfile() { + if (process.env.DETA_PROFILE) return process.env.DETA_PROFILE; + try { + const manifest = JSON.parse(readFileSync(join(HERE, '..', '.codex-plugin', 'plugin.json'), 'utf8')); + if (typeof manifest?.name === 'string' && manifest.name) return manifest.name; + } catch { /* 清单不可读时回落目录名(仅开发态正确) */ } + return basename(join(HERE, '..')); +} +const PROFILE = detectProfile(); function readToken() { if (process.env.DETA_TOKEN) return { source: '环境变量 DETA_TOKEN', token: process.env.DETA_TOKEN }; diff --git a/plugins/writer/package-lock.json b/plugins/writer/package-lock.json index e990d61..27b51dd 100644 --- a/plugins/writer/package-lock.json +++ b/plugins/writer/package-lock.json @@ -1,12 +1,12 @@ { "name": "deta-writer-plugin", - "version": "0.1.1", + "version": "0.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "deta-writer-plugin", - "version": "0.1.1", + "version": "0.1.2", "license": "Proprietary" } } diff --git a/plugins/writer/package.json b/plugins/writer/package.json index 874b7d0..3b0ea52 100644 --- a/plugins/writer/package.json +++ b/plugins/writer/package.json @@ -1,6 +1,6 @@ { "name": "deta-writer-plugin", - "version": "0.1.1", + "version": "0.1.2", "description": "DETA Writer:建筑性能报告与文档产出(Codex 插件 / dsh 组合包 双壳)", "type": "module", "license": "Proprietary",