diff --git a/AGENTS.md b/AGENTS.md index bf91bf90..2f4c4aca 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -57,10 +57,10 @@ UniDesk 以主 server 为统一入口。本文件只做自动加载的顶级索 ## P0: HWLAB、AgentRun 与节点边界 -- P0: HWLAB 开发和部署固定只使用 NC01:固定 workspace 是 `NC01:/root/hwlab`,k3s route 是 `NC01:k3s`,配置真相是 `config/hwlab-node-lanes.yaml`。细则见 `docs/reference/hwlab.md`。 +- P0: HWLAB 开发和部署固定只使用 NC01:固定 workspace 是 `NC01:/root/hwlab-v03`,k3s route 是 `NC01:k3s`,配置真相是 `config/hwlab-node-lanes.yaml`。细则见 `docs/reference/hwlab.md`。 - P0: BK7258 项目/苗总项目/飞思创/脚本适配/中间件适配/MicroPython 相关材料常用目录是 `D518:D:\Work\HWLabOA\Project Management\[EPIC002][MIAO][PRJ001][BK7258]\`,进入后先读 `D002001001-SUMMARY.md`。 - P0: D601 UniDesk 固定开发 workspace 是 `/home/ubuntu/workspace/unidesk-dev`;源码/配置任务先从最新 `origin/master` 创建独立 worktree。细则见 `docs/reference/dev-environment.md`。 -- P0: AgentRun 开发和部署固定只使用 NC01:固定 workspace 是 `NC01:/root/agentrun`,k3s route 是 `NC01:k3s`,配置真相是 `config/agentrun.yaml`。细则见 `docs/reference/agentrun.md`。 +- P0: AgentRun 开发和部署固定只使用 NC01:固定 workspace 是 `NC01:/root/agentrun-v02`,k3s route 是 `NC01:k3s`,配置真相是 `config/agentrun.yaml`。细则见 `docs/reference/agentrun.md`。 ## P0: HWLAB API key 与 issue 关闭 diff --git a/config/agentrun.yaml b/config/agentrun.yaml index 4bf062a2..d1cfc64c 100644 --- a/config/agentrun.yaml +++ b/config/agentrun.yaml @@ -323,7 +323,7 @@ controlPlane: variables: NODE: NC01 remote: http://gitea-http.devops-infra.svc.cluster.local:3000/mirrors/pikasTech-agentrun.git - workspace: /root/agentrun + workspace: /root/agentrun-v02 pipeline: agentrun-nc01-v02-ci-image-publish pipelineRunPrefix: agentrun-nc01-v02-ci serviceAccountName: agentrun-nc01-v02-tekton-runner diff --git a/config/hwlab-node-lanes.yaml b/config/hwlab-node-lanes.yaml index 5f9aab18..9375010f 100644 --- a/config/hwlab-node-lanes.yaml +++ b/config/hwlab-node-lanes.yaml @@ -12,7 +12,7 @@ nodes: NC01: route: NC01 kubeRoute: NC01:k3s - sourceWorkspace: /root/hwlab + sourceWorkspace: /root/hwlab-v03 gitopsRoot: deploy/gitops/node networkProfile: jd01-node-ci-egress downloadProfile: jd01-node-default @@ -33,7 +33,7 @@ lanes: stageRefPrefix: "refs/unidesk/snapshots/hwlab-node-runtime/{branch}" missingObjectPolicy: fail-fast refreshPolicy: sync-before-snapshot - workspace: /root/hwlab + workspace: /root/hwlab-v03 cicdRepo: /root/hwlab-v03-cicd.git cicdRepoLock: /tmp/hwlab-v03-cicd-repo.lock app: hwlab-node-v03 @@ -83,7 +83,27 @@ lanes: targets: NC01: node: NC01 - workspace: /root/hwlab + workspace: /root/hwlab-v03 + sourceWorkspace: + git: + remoteName: origin + remoteUrl: git@github.com:pikasTech/HWLAB.git + verifyRemote: false + requireUpToDate: false + requiredCommands: + - git + - node + - npm + requiredFiles: + - AGENTS.md + - package.json + - package-lock.json + install: + executor: host + dependencyCommand: npm ci + browserCommand: npx playwright install chromium + stateDir: /tmp/hwlab-v03-source-workspace-bootstrap + timeoutSeconds: 1800 sourceAuthority: extends: templates.hwlabV03.sourceAuthorityGiteaSnapshot giteaMirrorRepoKey: hwlab-nc01-v03 diff --git a/docs/reference/agentrun.md b/docs/reference/agentrun.md index aa5c8a1e..11e27872 100644 --- a/docs/reference/agentrun.md +++ b/docs/reference/agentrun.md @@ -13,32 +13,32 @@ git@github.com:pikasTech/agentrun.git AgentRun 当前固定 source worktree 是: ```text -NC01:/root/agentrun +NC01:/root/agentrun-v02 ``` 该目录必须固定跟踪当前 NC01 lane 声明的 AgentRun source branch,remote 必须符合 `config/agentrun.yaml#controlPlane.lanes.nc01-v02.source.remote`,并保持 clean。任何 AgentRun 开发、文档修改、部署观察或恢复中断后,先通过 UniDesk SSH 透传执行: ```bash -trans NC01:/root/agentrun sh -- 'pwd; git status --short --branch; git remote -v' +trans NC01:/root/agentrun-v02 sh -- 'pwd; git status --short --branch; git remote -v' ``` 期望状态: -- 当前路径是 `/root/agentrun`; +- 当前路径是 `/root/agentrun-v02`; - 分支和 remote 与 `config/agentrun.yaml` 的 NC01 lane 声明一致; - 固定 source worktree clean。 -如果固定 source worktree 缺失、dirty、分支不对或 remote 不对,必须先修正,再继续工作。不得把非 NC01 workspace、`/root/unidesk`、`/root/hwlab`、临时 clone、runner checkout、pod 内副本或 master-server 副本当作 AgentRun source truth。 +如果固定 source worktree 缺失、dirty、分支不对或 remote 不对,必须先修正,再继续工作。不得把非 NC01 workspace、`/root/unidesk`、`/root/hwlab-v03`、临时 clone、runner checkout、pod 内副本或 master-server 副本当作 AgentRun source truth。 ## Worktree 规则 固定 source worktree 只用于预检、fetch、worktree 管理和最终同步。常规 AgentRun `v0.2` 功能、文档和部署修改必须使用独立 worktree: ```text -NC01:/root/agentrun/.worktree/{pr_branch} +NC01:/root/agentrun-v02/.worktree/{pr_branch} ``` -任务 worktree 必须从 NC01 lane 声明的最新 source branch 创建。任务分支只覆盖当前变更,提交时只提交当前任务相关文件。不要把 `/root/agentrun` 根目录当作并行任务 scratch 区。 +任务 worktree 必须从 NC01 lane 声明的最新 source branch 创建。任务分支只覆盖当前变更,提交时只提交当前任务相关文件。不要把 `/root/agentrun-v02` 根目录当作并行任务 scratch 区。 ## 文档落库规则 diff --git a/docs/reference/hwlab.md b/docs/reference/hwlab.md index 2ebffc64..52b2a7b8 100644 --- a/docs/reference/hwlab.md +++ b/docs/reference/hwlab.md @@ -6,9 +6,9 @@ - UniDesk 指挥侧 workspace:`/root/unidesk`,固定使用 `master`,开始前执行 `git status` 和 `git pull --ff-only origin master`。 - HWLAB 开发、部署和验证固定只使用 NC01。`config/hwlab-node-lanes.yaml` 是 node、lane、workspace、CI/CD repo、namespace、GitOps path、公网入口和 Secret sourceRef 的配置真相,当前默认目标必须是 `NC01/v03`。 -- HWLAB 固定主 workspace 是 `NC01:/root/hwlab`,固定跟踪 `v0.3`。源码修改、PR 准备、repo 内验证、GitOps render 和 rollout 修复都必须在该固定 workspace 下创建任务级 `.worktree/`;master server 本地 `/root/HWLAB`、一次性 clone、runner clone、pod 内副本或非 NC01 workspace 只能做只读对照,不能承担开发 source truth。 +- HWLAB 固定主 workspace 是 `NC01:/root/hwlab-v03`,固定跟踪 `v0.3`。源码修改、PR 准备、repo 内验证、GitOps render 和 rollout 修复都必须在该固定 workspace 下创建任务级 `.worktree/`;master server 本地 `/root/HWLAB`、一次性 clone、runner clone、pod 内副本或非 NC01 workspace 只能做只读对照,不能承担开发 source truth。 - HWLAB v0.3 CI/CD source authority 由 `config/hwlab-node-lanes.yaml#lanes.v03.targets.NC01.sourceAuthority` 决定。`trigger-current` / `status` / build 只消费受控 source snapshot,不得把 host worktree、本地 fetch/pull、可变 branch ref 或 Pipeline 直连 GitHub 当 authoritative source。固定 workspace 只服务源码修改、PR 准备和 repo 内验证;rollout closeout 以 source snapshot、PipelineRun、GitOps/Argo revision 和 runtime revision 收口。完整操作口径见 `$unidesk-cicd`。 -- 进入任何 HWLAB 工作前,按 `NC01/v03` 解析 route/workspace/sourceBranch/kubeRoute/runtime namespace 做预检、快进和验证:工作面是 `NC01:/root/hwlab`、source branch 是 `v0.3`、k3s route 是 `NC01:k3s`、runtime namespace 是 `hwlab-v03`、公网入口由 YAML 的 NC01 target 声明。 +- 进入任何 HWLAB 工作前,按 `NC01/v03` 解析 route/workspace/sourceBranch/kubeRoute/runtime namespace 做预检、快进和验证:工作面是 `NC01:/root/hwlab-v03`、source branch 是 `v0.3`、k3s route 是 `NC01:k3s`、runtime namespace 是 `hwlab-v03`、公网入口由 YAML 的 NC01 target 声明。 - NC01 的 node-local registry 是 k3s workload/PVC,不是 host Docker registry。`hwlab nodes control-plane infra status --node NC01 --lane v03` 应显示 registry workload ready、PVC bound 和 endpoint ready;必须通过受控 `runtime-image preload` 和 `infra tools-image build/status` 补齐 BuildKit、runtime/base 和 tools image,再把 HWLAB/AgentRun status 与 web-probe smoke 作为可用性证据。 - HWLAB 项目内长期规则入口仍以目标 repo 的 `AGENTS.md` 为准。进入已解析的目标 workspace 后,必须重新读取该 workspace 的规则文件;不能只凭主 server 的压缩上下文继续操作。 - 每次开始源码修改、PR 准备或 repo 内验证前必须通过 YAML-first 受控入口检查并同步 NC01 workspace:`bun scripts/cli.ts hwlab nodes control-plane source-workspace sync --node NC01 --lane v03 --confirm`,再用 `source-workspace status` 读取 clean、branch、remote、HEAD 和依赖状态。`source-workspace status` 必须显示声明 remote/base 已对齐;如果返回 `source-workspace-not-ready`、`remoteUpToDate=false`、ahead/behind/diverged 或 HEAD 与声明 remote/base 不一致,先修复固定 workspace,再创建 `.worktree/`、提交测试 PR 或给验收写结论。运行面 `status` healthy、PaC snapshot 对齐和 GitOps/Argo healthy 只能证明 runtime source authority,不代表 host 固定 workspace 已可用于源码工作。 @@ -155,7 +155,7 @@ NC01 runtime lane 的硬边界必须从 `config/hwlab-node-lanes.yaml` 的 NC01 - master server 是 UniDesk/HWLAB 的生产入口且资源紧张;它只能承担轻量源码编辑、Git 操作、日志/健康观察、JSON CLI 指挥和受控 CD 审阅,不能承担正式校验执行面。 - 禁止在 master server 上运行 HWLAB 或 UniDesk 的仓库级 `check`/`test`/smoke 命令,包括但不限于 `bun scripts/cli.ts check`、`node --test`、`node web/hwlab-cloud-web/scripts/check.mjs`、`node scripts/dev-cloud-workbench-smoke.mjs`、Playwright/browser layout smoke,以及其他会长时间占用 CPU/内存、启动浏览器或遍历大仓库的校验流程。 - 需要正式验证时,固定切到 issue/CLI 选中的 node/lane workspace、k3s/Tekton、HWLAB repo-owned CI 或其他获批外部执行面;master server 只负责发起、观察和记录,不负责实际跑 check。 -- 如果为了排障必须从 master server 生成命令或查看源码,后续验证命令也必须显式改到目标 node/lane 路径执行,例如 `trans NC01:/root/hwlab sh -- ...` 或 `trans NC01:k3s ...`,而不是直接在 `/root/unidesk` 或 master server 上本地运行。 +- 如果为了排障必须从 master server 生成命令或查看源码,后续验证命令也必须显式改到目标 node/lane 路径执行,例如 `trans NC01:/root/hwlab-v03 sh -- ...` 或 `trans NC01:k3s ...`,而不是直接在 `/root/unidesk` 或 master server 上本地运行。 ## Node/Lane 运行面口径 diff --git a/scripts/src/help.ts b/scripts/src/help.ts index cf40a07f..312924b2 100644 --- a/scripts/src/help.ts +++ b/scripts/src/help.ts @@ -184,7 +184,7 @@ export function sshHelp(): unknown { "trans skills [--scope all|wsl|windows] [--limit N]", "trans find [--contains TEXT] [--limit N]", "trans glob [--root DIR] [--pattern PATTERN]", - "trans NC01:/root/hwlab git status --short --branch", + "trans NC01:/root/hwlab-v03 git status --short --branch", "trans D601:win ps <<'PS'", "trans D601:win/c/test ps <<'PS'", "trans D601:win/c/test cmd <<'CMD'", diff --git a/scripts/src/hwlab-g14/types.ts b/scripts/src/hwlab-g14/types.ts index 6bdc649a..34a3d533 100644 --- a/scripts/src/hwlab-g14/types.ts +++ b/scripts/src/hwlab-g14/types.ts @@ -18,7 +18,7 @@ export const G14_SOURCE_BRANCH = "v0.3"; export const G14_PROVIDER = "NC01"; -export const G14_WORKSPACE = "/root/hwlab"; +export const G14_WORKSPACE = "/root/hwlab-v03"; export const V02_LANE_SPEC = hwlabRuntimeLaneSpec("v02") ?? hwlabRuntimeLaneSpec("v03");