Conversation
向导原来生成裸 flags 的前台运行命令(npx 一次性进程,关掉终端即 断连)。runtime CLI 在 felinics#1128 已有 enroll/service 的 daemon 能力,但 向导从未跟进。 改为生成官方文档推荐的持久化流程:全局安装 CLI 后 enroll + service install + service start,服务由 launchd/systemd/Task Scheduler 接管, 不再依赖 npx 缓存路径(README 明确 npx 缓存不是持久安装)。 CLI bin 名按 @memohai/<name> → memoh-<name> 约定从包名推导,hosted 部署(如 @memohai/cloud-runtime)经 VITE_RUNTIME_NPX_PACKAGE 传入包 名即可获得正确的 memoh-cloud-runtime 命令,无需额外配置。
|
@qqqqqf-q Please complete the following information using the template:
Editing the description triggers another check; format feedback does not block or cancel code CI. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f66c4724f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| key, | ||
| ] | ||
| const bin = runtimeCliBin(npmPackage) | ||
| const enrollArgs = [bin, 'enroll', '--server', serverUrl, '--key', key] |
There was a problem hiding this comment.
Replace an existing enrollment in the generated command
When the same machine is connected again after revocation, an account/server change, or another freshly issued credential, its previous ~/.memoh/runtime.json remains. enroll deliberately rejects a different saved enrollment without --replace (packages/runtime/src/cli-main.ts, lines 125-133), so this && chain stops before installing or starting the service and the dialog waits indefinitely. Add --replace to this wizard-generated enrollment or explicitly handle existing enrollment.
Useful? React with 👍 / 👎.
| enrollArgs.join(' '), | ||
| `${bin} service install`, | ||
| `${bin} service start`, | ||
| ].join(' && ') |
There was a problem hiding this comment.
Support Windows PowerShell in the generated command
When a Windows user pastes this generic command into Windows PowerShell 5.1, parsing fails at the first &&; Microsoft documents these pipeline-chain operators as introduced in PowerShell 7 in about_Pipeline_Chain_Operators. Since the runtime explicitly supports Windows Task Scheduler (packages/runtime/src/daemon/index.ts, lines 20-29), provide shell-specific syntax or a Windows-compatible command instead of making the supported Windows flow depend on PowerShell 7 or cmd.exe.
Useful? React with 👍 / 👎.
- enroll 加 --replace:每次向导会话都签发新 key(关闭即 revoke 旧 credential),已登记过的机器重跑命令必然与存档不同,不加会被 'saved enrollment differs' 拦截断链;换绑正是用户意图 - && 链改为逐行命令:Windows 默认 PowerShell 5.1 不支持 &&,多行 粘贴在 bash/zsh/cmd/PS 各 shell 都逐条执行
单行一次粘贴、失败即停,符合连接向导的一次性操作语义。唯一例外是 Windows PowerShell 5.1(不支持 &&),该环境下用户分行执行;cmd 与 PowerShell 7+ 正常。
问题
「Connect computer」向导生成的命令仍是
npx --yes <pkg> --server ... --key ...裸 flags 前台运行模式:终端一关连接就断,用户只能把进程一直挂着。#1128 给 runtime CLI 加了 enroll/service 的 daemon 能力(launchd / systemd / Task Scheduler),但向导从未跟进——CLI 有持久化能力,产品入口生成的却还是一次性命令。改动
buildRuntimeConnectCommand改为生成官方 README 推荐的持久化流程(&&单行,一次粘贴):@memohai/<name>→memoh-<name>约定从包名推导(@memohai/cloud-runtime→memoh-cloud-runtime),hosted 构建经VITE_RUNTIME_NPX_PACKAGE传入包名即自动得到正确命令,Cloud 侧无需改配置。--replace:每次向导会话都签发新 key(关闭对话框即 revoke 旧 credential),重开向导重跑命令必然与已存登记不同,不带会被saved enrollment differs拦截;换绑正是用户意图。&&单行:一次粘贴、失败即停。唯一例外是 Windows PowerShell 5.1(不支持&&),该环境下分行执行;cmd 与 PowerShell 7+ 正常。--insecure-localhost(loopback 开发)照旧附加到 enroll 段。npm 上
@memohai/runtimelatest 仍是 0.18.0(无 enroll/service,strict 解析遇 positional 直接退出)。本 PR 合并后,任何从 main 构建的 OSS 自托管 web 生成的命令会在 enroll 处失败,直到@memohai/runtime@0.20.0发布。v0.20.0 tag 已推,但 release workflow 的 npm publish 因 org 更名(memohai→felinics)导致 trusted publisher 不匹配而 404,需先在 npmjs.com 更新各包的 trusted publisher 后重跑 failed jobs。Cloud 不受影响(@memohai/cloud-runtime@2026.9.15-1已含 daemon)。验证
command.test.ts8 个用例全绿(默认包、无 team-id 旧凭据、loopback insecure、单行无换行、必带--replace、hosted 包名推导、bin 约定、未知包兜底)packages/runtime/src/cli-main.ts的 enroll/service 实现核验enroll --replace(覆盖既有登记)→service install→service start,launchd running、日志 connected