Add read-only svc.sh info report for services, databases, and config snapshots #179

Merged
weichen merged 4 commits from feature/svc-info into main 2026-10-04 12:50:02 +00:00
Owner

feature/svc-info 任务卡

任务主记录:<PR 链接,task-finish 时填写>;状态:进行中;owner:weichen

基线与授权

  • 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= 1263e7f7d1
  • 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-svc-info(worktree);分支:feature/svc-info
  • 授权与交付终点:实现 scripts/svc.sh info 综合信息报告(只读);终点 = PR 合入 main(附 precheck / task-sync / 功能验证三段证据)

目标与非目标

目标:

  • 新增全局子命令 scripts/svc.sh info [name] [--tag T] [--reveal],一条命令展示本机现场:
    运行中的服务(list 表格 + 运行汇总)、postgres 实例详情(含运行中实例的内部数据库
    列表与大小
    、数据目录/备份体量)、配置文件与内容快照(逐服务 svc.env、全局 .svc.env、
    本次 --config、shell 层 SVC_* 变量)、最近事件。
  • 敏感值默认掩码(password=、键名含 KEY/PASS/SECRET/TOKEN/DSN、DSN 内密码段),
    --reveal 才显示;报告整体走 stdout 便于整页保存。
  • 同步更新:usage/usage_short/help(lifecycle、model 保留字补全 update/info)、docs/svc.md
    (新 §6.2,原 6.2-6.4 顺延 6.3-6.5)、Makefile(svc-info 目标 + help)。

非目标:不改 deploy/生命周期/db 运维任何行为;不做 JSON 输出;不涉 Web UI。

实现摘要

  • info 加入保留字(RESERVED_ENVS 与 help model 文档同步补全)。
  • 复用与抽取:registered_names(global_list 复用)、history_print_rows(cmd_history 复用);
    新增 mask_dsn/mask_kv(掩码)、info_pg_block/info_config_block/info_global_config/
    info_names_filtered、cmd_info。
  • main() 分派 info 子命令;make svc-info。

同步记录

节点 sync_base_sha tested_head_sha checked_at
启动 1263e7f7d1 1263e7f7d1 2026-10-04T12:34:43Z

结果与验证(完成后填写)

  • 结果:已实现。svc.sh info(全景:服务表+汇总/数据库实例+内部库/配置快照/最近事件)、
    info <name>(单服务深度)、--tag 过滤、--reveal 显示敏感值;退出码:0 成功、2 用法错误。
  • 验证(worktree runtime 内实测,2026-10-04):
    • bash -n 通过(shellcheck 本机不可用);
    • 空 runtime:五节报告友好空态,exit 0;
    • 伪造登记(agent+DSN 密码 / static / postgres 停机 + 备份文件 + .svc.env 含
      SVC_TAVILY_KEYS):全景报告正确;掩码实测——exec 内 DSN 密码→***、password=***、
      SVC_TAVILY_KEYS=***、非敏感值原样;--reveal 显示明文;
    • 真实 postgres:db create r-pg --port 18901 → start → 建额外库 orders → db backup →
      info 数据库节显示"运行中 pid、内部库 postgres/agent/orders 及大小、pgdata 43M、
      备份 1 份";rm r-pg --purge 回收;测试现场(伪造登记/.svc.env)全部清除;
    • 回归:list / history / --help / help lifecycle / make svc-info 均正常;
      info stdout 纯净(stderr 0 字节),可整页重定向;
    • 正式验收:make test(task-sync 后运行,tested_head=106ef07ef0)exit 0——
      test-boundaries + test-pins + test-libs(agent-intent/native/squad vet+test)+
      test-core + test-backend + test-frontend + test-ui(11 文件 79 用例全过)+ test-agentcmd。
  • 影响与剩余项:无行为变更(info 只读);剩余项无。
    | 同步前验收 | 1263e7f7d1 | 106ef07ef0 | 2026-10-04T12:42:58Z |

提交主题:Add read-only svc.sh info report for services, databases, and config snapshots
(body 四段 Why/Evidence/Impact/Refs 见各提交说明;本卡即 PR 主记录)

# feature/svc-info 任务卡 任务主记录:<PR 链接,task-finish 时填写>;状态:进行中;owner:weichen ## 基线与授权 - 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= 1263e7f7d10eb4d58fcfc39a7cd4c5c963a30ff6 - 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-svc-info(worktree);分支:feature/svc-info - 授权与交付终点:实现 `scripts/svc.sh info` 综合信息报告(只读);终点 = PR 合入 main(附 precheck / task-sync / 功能验证三段证据) ## 目标与非目标 目标: - 新增全局子命令 `scripts/svc.sh info [name] [--tag T] [--reveal]`,一条命令展示本机现场: 运行中的服务(list 表格 + 运行汇总)、postgres 实例详情(含运行中实例的**内部数据库 列表与大小**、数据目录/备份体量)、配置文件与内容快照(逐服务 svc.env、全局 .svc.env、 本次 --config、shell 层 SVC_* 变量)、最近事件。 - 敏感值默认掩码(password=、键名含 KEY/PASS/SECRET/TOKEN/DSN、DSN 内密码段), `--reveal` 才显示;报告整体走 stdout 便于整页保存。 - 同步更新:usage/usage_short/help(lifecycle、model 保留字补全 update/info)、docs/svc.md (新 §6.2,原 6.2-6.4 顺延 6.3-6.5)、Makefile(svc-info 目标 + help)。 非目标:不改 deploy/生命周期/db 运维任何行为;不做 JSON 输出;不涉 Web UI。 ## 实现摘要 - `info` 加入保留字(RESERVED_ENVS 与 help model 文档同步补全)。 - 复用与抽取:`registered_names`(global_list 复用)、`history_print_rows`(cmd_history 复用); 新增 mask_dsn/mask_kv(掩码)、info_pg_block/info_config_block/info_global_config/ info_names_filtered、cmd_info。 - main() 分派 `info` 子命令;make svc-info。 ## 同步记录 | 节点 | sync_base_sha | tested_head_sha | checked_at | |---|---|---|---| | 启动 | 1263e7f7d10eb4d58fcfc39a7cd4c5c963a30ff6 | 1263e7f7d10eb4d58fcfc39a7cd4c5c963a30ff6 | 2026-10-04T12:34:43Z | ## 结果与验证(完成后填写) - 结果:已实现。`svc.sh info`(全景:服务表+汇总/数据库实例+内部库/配置快照/最近事件)、 `info <name>`(单服务深度)、`--tag` 过滤、`--reveal` 显示敏感值;退出码:0 成功、2 用法错误。 - 验证(worktree runtime 内实测,2026-10-04): - `bash -n` 通过(shellcheck 本机不可用); - 空 runtime:五节报告友好空态,exit 0; - 伪造登记(agent+DSN 密码 / static / postgres 停机 + 备份文件 + .svc.env 含 SVC_TAVILY_KEYS):全景报告正确;掩码实测——exec 内 DSN 密码→`***`、`password=***`、 `SVC_TAVILY_KEYS=***`、非敏感值原样;`--reveal` 显示明文; - 真实 postgres:`db create r-pg --port 18901` → start → 建额外库 orders → db backup → info 数据库节显示"运行中 pid、内部库 postgres/agent/orders 及大小、pgdata 43M、 备份 1 份";`rm r-pg --purge` 回收;测试现场(伪造登记/.svc.env)全部清除; - 回归:`list` / `history` / `--help` / `help lifecycle` / `make svc-info` 均正常; `info` stdout 纯净(stderr 0 字节),可整页重定向; - 正式验收:`make test`(task-sync 后运行,tested_head=106ef07ef0)exit 0—— test-boundaries + test-pins + test-libs(agent-intent/native/squad vet+test)+ test-core + test-backend + test-frontend + test-ui(11 文件 79 用例全过)+ test-agentcmd。 - 影响与剩余项:无行为变更(info 只读);剩余项无。 | 同步前验收 | 1263e7f7d10eb4d58fcfc39a7cd4c5c963a30ff6 | 106ef07ef0cd212535a3cf8224a7d5cf200120e8 | 2026-10-04T12:42:58Z | --- 提交主题:Add read-only svc.sh info report for services, databases, and config snapshots (body 四段 Why/Evidence/Impact/Refs 见各提交说明;本卡即 PR 主记录)
weichen added 4 commits 2026-10-04 12:44:43 +00:00
Why: svc.sh could show a service table (list), per-instance DB names one at a
time (db ls), and per-service status, but had no single view answering "what
is running, which databases exist, and what is configured" -- the questions
asked when inspecting or handing over a machine.

Evidence: exercised in the task worktree runtime -- empty-state report; fake
agent/static/postgres registrations proving masking (exec DSN password,
password=, SVC_TAVILY_KEYS -> ***, non-secret values verbatim; --reveal shows
plaintext); a real postgres instance (db create r-pg --port 18901, start,
extra orders db, one backup) whose info section lists inner databases with
sizes, pgdata size and backup stats; regressions list/history/--help/help
lifecycle/make svc-info; info stdout carries the full report (stderr 0 bytes)
so it can be redirected as a snapshot. Full log in the task card.

Impact: new read-only `scripts/svc.sh info [name] [--tag T] [--reveal]`
command (also `make svc-info`): service table + running summary, postgres
instances incl. inner databases, per-service svc.env content snapshots plus
global .svc.env / --config / exported SVC_* vars, and recent events. Secrets
are masked by default. No deploy/lifecycle/db-ops behavior changes; `info`
becomes a reserved service name; docs/svc.md gains section 6.2 (former
6.2-6.4 shifted to 6.3-6.5).

Refs: task card .task/feature-svc-info.md (same doc as the PR); docs/svc.md
Why: the completion statement must carry precheck / task-sync / test evidence.
Evidence: make test exit 0 on tested_head=106ef07ef0 (full suite incl. ui 79
tests and agentcmd); functional evidence logged in the card.
Impact: card-only change; PR description mirrors this card.
Refs: .task/feature-svc-info.md
weichen merged commit 5d3a4b3ee3 into main 2026-10-04 12:50:02 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Dev#179