@shundoo-ai/dsh-cosmic 1.0.4-alpha.1 → 1.0.4-alpha.3
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/package.json
CHANGED
|
@@ -46,12 +46,10 @@ description: >
|
|
|
46
46
|
|
|
47
47
|
> 下面各职责给的是 **macOS/Linux** 命令。Windows 上**手拼这套流程代价极高** —— 实测一个 Windows 会话为跑通「构建 + 热部署」发了 **63 条 pwsh**、**6 次提权**(探测 PID → 找 JDK → 找 tools.jar → attach,每步都要单独授权)。
|
|
48
48
|
|
|
49
|
-
本 skill 随包提供封装脚本,**把全程收敛成一次调用 ⇒
|
|
49
|
+
本 skill 随包提供封装脚本,**把全程收敛成一次调用 ⇒ 一次授权就够**:
|
|
50
50
|
|
|
51
51
|
```powershell
|
|
52
|
-
#
|
|
53
|
-
pwsh -File {SKILL_DIR}\scripts\cosmic-hotdeploy.ps1
|
|
54
|
-
# 构建 + 热部署
|
|
52
|
+
# ⭐ 推荐:直接带 -Module 一次跑完(脚本内部会先体检,再构建 + 热部署)
|
|
55
53
|
pwsh -File {SKILL_DIR}\scripts\cosmic-hotdeploy.ps1 -Module <模块名>
|
|
56
54
|
# 干净重建 + 热部署
|
|
57
55
|
pwsh -File {SKILL_DIR}\scripts\cosmic-hotdeploy.ps1 -Module <模块名> -Clean
|
|
@@ -59,8 +57,16 @@ pwsh -File {SKILL_DIR}\scripts\cosmic-hotdeploy.ps1 -Module <模块名> -Clean
|
|
|
59
57
|
pwsh -File {SKILL_DIR}\scripts\cosmic-hotdeploy.ps1 -Jar <jar路径>
|
|
60
58
|
# 只构建、不部署
|
|
61
59
|
pwsh -File {SKILL_DIR}\scripts\cosmic-hotdeploy.ps1 -Module <模块名> -WhatIf
|
|
60
|
+
# 仅体检(已经有授权时用;没授权时它会因端口查询被拒而报错,见下)
|
|
61
|
+
pwsh -File {SKILL_DIR}\scripts\cosmic-hotdeploy.ps1
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
+
> ⚠️ **本脚本在 Windows 上需要放开沙箱(`danger-full-access`),且必须「整条命令一次授权」**:
|
|
65
|
+
> 它要 `Get-NetTCPConnection` 查端口归属、并跨进程 attach 到 cosmic JVM,受限沙箱下二者都被拒
|
|
66
|
+
> (`CreatePipe error=5` / `access denied`)。
|
|
67
|
+
> **所以:不要先跑一次「体检」再去跑构建** —— 那会白花一次授权。直接带 `-Module` 发**一条**命令、**一次性**授权,全流程都在这一次调用里完成。
|
|
68
|
+
> 若端口查询被沙箱拒绝,脚本会**明确报出这一点**(而不是误报「cosmic 没在跑」)—— 看到该提示就带沙箱放开重发同一条命令。
|
|
69
|
+
|
|
64
70
|
内部依次完成:定位工作区 → 解析 preset bundle → 读 `dev.json` → **按端口反查 cosmic PID**(不是 `jps`,见职责②)→ 挑含 `tools.jar` 的 JDK → 构建 → Attacher 热加载。
|
|
65
71
|
|
|
66
72
|
参数:`-Module`|`-Jar`|`-Clean`|`-WhatIf`|`-LogFile`|`-Workspace`|`-PresetDir`|`-Port`。
|
|
@@ -122,9 +122,25 @@ $tenantId = $dev.tenant_id
|
|
|
122
122
|
if (-not $accountId) { throw "dev.json has no account_id -- re-run 'dev.py init'." }
|
|
123
123
|
|
|
124
124
|
# ---- 2. Discover the cosmic PID by port ownership, then validate the JVM ----
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
# NOTE: do NOT use -ErrorAction SilentlyContinue here. Get-NetTCPConnection is a cross-process
|
|
126
|
+
# query and the DSH sandbox DENIES it ("access denied") unless the call runs with danger-full-access.
|
|
127
|
+
# Swallowing that error makes an empty result mean two very different things, and the old code
|
|
128
|
+
# reported it as "cosmic is not running" -- sending the caller off to hunt a non-existent problem.
|
|
129
|
+
$conn = $null
|
|
130
|
+
try {
|
|
131
|
+
$conn = Get-NetTCPConnection -LocalPort $effPort -State Listen -ErrorAction Stop |
|
|
132
|
+
Select-Object -First 1
|
|
133
|
+
} catch {
|
|
134
|
+
throw @"
|
|
135
|
+
Port query was DENIED: $($_.Exception.Message)
|
|
136
|
+
This script needs the DSH sandbox opened for the whole run (Windows: danger-full-access).
|
|
137
|
+
Rationale: it must query port ownership (Get-NetTCPConnection) and attach to the cosmic JVM
|
|
138
|
+
across processes; both are blocked by the restricted sandbox (CreatePipe error=5 / access denied).
|
|
139
|
+
Re-run this single command with the sandbox escalated -- the whole discover+build+attach flow
|
|
140
|
+
is one call, so one grant covers it.
|
|
141
|
+
"@
|
|
142
|
+
}
|
|
143
|
+
if (-not $conn) { throw "Nothing is listening on port $effPort -- is cosmic running? (port query itself succeeded)" }
|
|
128
144
|
$targetPid = $conn.OwningProcess
|
|
129
145
|
$proc = Get-CimInstance Win32_Process -Filter "ProcessId=$targetPid"
|
|
130
146
|
if ($proc.CommandLine -notmatch 'kd\.bos\.service\.webserver\.JettyServer') {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
| GRADLE_USER_HOME | `<cwd>/.gradle/user-home` | gradle wrapper 缓存;dist 从系统 `~/.gradle/wrapper/dists` **复制**(勿用软链——wrapper 会删链重解压) |
|
|
42
42
|
| gradlew / gradlew.bat | POSIX:项目根 `gradlew` 需 `chmod +x`;Windows:需 `gradle/wrapper/`(gradle-wrapper.properties + gradle-wrapper.jar)齐全,`gradlew.bat` 才可运行 | 模板生成时可能缺 x 位;缺 wrapper 元数据时从模板/系统 dist 补齐 |
|
|
43
43
|
| 插件编译脚本 | `{VENV}/bin/python compile_plugin_source.py` | 脚本只注入 `JAVA_HOME`、**不注入 `GRADLE_USER_HOME`**,调用方必须显式 `export GRADLE_USER_HOME=<cwd>/.gradle/user-home`,否则 Gradle 默认写用户主目录(Windows:`%USERPROFILE%\.gradle`)触发权限拦截;cosmic_home、解释器约定见上 |
|
|
44
|
-
| 构建权限边界 | 产 jar 走 `:<模块>:build`(写工作区);勿用 `buildJar`/`deployJar`(写 cosmic 安装目录 outputdir,工作区外) | Windows 另有 `CreatePipe`
|
|
44
|
+
| 构建权限边界 | 产 jar 走 `:<模块>:build`(写工作区);勿用 `buildJar`/`deployJar`(写 cosmic 安装目录 outputdir,工作区外) | Windows 另有 `CreatePipe` 限制,构建/热部署仍须放开权限;**Windows 推荐一条命令跑完**:`pwsh -File {PRESET}/skills/cosmic-build/skills/cosmic-vibe-coding/scripts/cosmic-hotdeploy.ps1 -Module <模块>`(内部含体检+构建+注入),**一次授权即覆盖全流程** —— 不要先单独跑「体检」(会白花一次授权);Attacher classpath 分隔符 Windows 用 `;` |
|
|
45
45
|
|
|
46
46
|
> 📌 配置按**工作区**隔离(appconfig / GRADLE_USER_HOME / ERP 凭证均在 `<cwd>` 下),多工作区可并行开展不同项目;bash 每次调用为独立 shell,命令中需显式携带工作区约定值(如 `export GRADLE_USER_HOME=<cwd>/.gradle/user-home`),勿依赖跨调用 export。沙箱写权限仅限工作区(preset 技能脚本 `~/.dsh/...`、`~/kd` 等外部路径修改需授权)。权限放开按平台:**macOS/Linux 无管道限制,构建/热部署无需放开**(缓存入工作区即可);**Windows 禁跨进程管道(`CreatePipe error=5`),构建/热部署每次须单命令级放开 `danger-full-access`**(或会话级放宽;`--no-daemon` 无效)。
|
|
47
47
|
> 📌 **发邮件不需要提权**:`send_email.py` 用 `password = "授权码"` 时明文直读、**不起子进程**,纯网络调用,任何平台都无需放开权限。(只有 `auth_cmd` 那条路要起子进程捕获 stdout,Windows 受限令牌下才需提权 —— 见 `references/email-delivery.md`。)
|