跳到主要内容

ARC 2.0.0-beta.42

检查本地空间

在 ARC 2.0.0-beta.42 上,对隔离 root 运行 arc space list、sync、tree、path、rm,并阅读真实输出。

arc space 检查本地 DID Space 数据:有哪些 app 片段、它们持有怎样的逻辑树、片段映射到哪条 AFS 路径。这是针对数据目录的离线 DX,不能替代实时 session 视图(/user/tmp/space),也不是正式的云部署。

已在 ARC CLI 2.0.0-beta.42 上验证。全部子命令的 man 式覆盖见 arc space。本页聚焦可复现的本地配方与失败模式。

前置条件

下文捕获使用的值
CLIarc 2.0.0-beta.42arc --version
隔离 root/tmp/arc-ids-docs-fixture(任意你拥有的空目录)
夹具 user DIDz1fixtureIdentityDocs000000000000001
夹具 app DIDtodo-docs-fixture
隔离标志每条检查命令都带 --root-path--user-did

做文档或实验时务必传入隔离的 --root-path。默认配置可能指向真实的 ~/.afs/spaces 并列出生产 app 片段。

当 de-identification 关闭时,你可能看到 AFS_DID_SPACE_SCOPE_SECRET unset 之类启动警告。它们不会阻断本地检查;含义是磁盘目录可能使用明文标识。

1. 确认空 root

bash
arc space list \
  --root-path /tmp/arc-ids-docs-fixture \
  --user-did z1fixtureIdentityDocs000000000000001

实际输出:

text
No app spaces found

list 就是全部概览:DID、文件数、根路径,按你给的 --scope 显示。

2. 把示例树写入 instance(system)片段

sync 接受的是两个目录,所以先用 path 问出片段在哪:

bash
arc space path todo-docs-fixture / \
  --root-path /tmp/arc-ids-docs-fixture \
  --user-did z1fixtureIdentityDocs000000000000001 \
  --scope instance
text
/spaces/sws6a445s4sgwlarm6eg32hkoppspbs2/blocklets/todo-docs-fixture/system

/spaces/ 之后的第一段是作用域目录,由 user DID 推导而来。开启 de-identification 时它是 DID 的 HMAC 而不是 DID 本身——你跑出来的会和上面这份捕获不同,所以这个配方是把它读回来,而不是写死。把 /spaces 换成你的 --root-path,就得到磁盘上的目标目录:

bash
mkdir -p /tmp/arc-ids-sample-fixture/notes
printf '%s\n' 'hello from identity docs evidence' > /tmp/arc-ids-sample-fixture/notes/readme.txt
printf '%s\n' 'secondary' > /tmp/arc-ids-sample-fixture/notes/extra.md

arc space sync \
  --from /tmp/arc-ids-sample-fixture \
  --to /tmp/arc-ids-docs-fixture/sws6a445s4sgwlarm6eg32hkoppspbs2/blocklets/todo-docs-fixture/system

实际输出:

text
/tmp/arc-ids-sample-fixture → /tmp/arc-ids-docs-fixture/sws6a445s4sgwlarm6eg32hkoppspbs2/blocklets/todo-docs-fixture/system
Base path: /
Mode:      additive

Engine:    manifest — the manifest engine works between any two endpoints
  not changelog: the changelog engine is a device↔cloud engine — it needs exactly one local folder (the device) and one remote host (the cloud); neither folder↔folder nor remote↔remote fits it
  not cursor: the cursor engine mirrors (it deletes destination-only paths); this run is additive, so use --mirror to allow deletions or let the manifest engine handle it

Added:     2
Modified:  0
Deleted:   0
Unchanged: 0

Transferred: 2 files
Verified:    no
Duration:    294ms

sync 是增量的,不传 --mirror 就永不删除已有文件。这里没有 --scope:角色前缀(system / user)就是你 sync 进去的那条路径的最后一段,目标路径本身已经说明了你指的是哪个片段。

3. list

bash
arc space list \
  --root-path /tmp/arc-ids-docs-fixture \
  --user-did z1fixtureIdentityDocs000000000000001 \
  --scope instance
text
DID                  Files  Last Modified
───                  ─────  ─────────────
todo-docs-fixture        2  —

覆盖 --root-path / --user-did 时,人类可读输出可能只显示单个区段,而不是默认 home 布局下的双栏 “Instance DID Space” / “User DID Space” 标题。需要区分角色时,始终显式传入 --scope instance--scope user

4. tree 与 path(instance → system)

bash
arc space tree todo-docs-fixture \
  --root-path /tmp/arc-ids-docs-fixture \
  --user-did z1fixtureIdentityDocs000000000000001 \
  --scope instance
text
todo-docs-fixture:
[d] /notes  (128 B)
    /notes/extra.md  (10 B)
    /notes/readme.txt  (34 B)
bash
arc space path todo-docs-fixture /notes \
  --root-path /tmp/arc-ids-docs-fixture \
  --user-did z1fixtureIdentityDocs000000000000001 \
  --scope instance
text
/spaces/sws6a445s4sgwlarm6eg32hkoppspbs2/blocklets/todo-docs-fixture/system/notes

path 打印角色片段的逻辑 AFS 路径。它不是 shell 文件系统路径,也不是 /user/notes 这类 session 路径——但正如第 2 步演示的,把 /spaces 换成你的 --root-path,得到的就是磁盘上的目录。

5. user 作用域片段

同一个动作,只差一段路径——user 而不是 system

bash
arc space sync \
  --from /tmp/arc-ids-sample-fixture \
  --to /tmp/arc-ids-docs-fixture/sws6a445s4sgwlarm6eg32hkoppspbs2/blocklets/todo-docs-fixture/user/docs
text
/tmp/arc-ids-sample-fixture → /tmp/arc-ids-docs-fixture/sws6a445s4sgwlarm6eg32hkoppspbs2/blocklets/todo-docs-fixture/user/docs
Base path: /blocklets/todo-docs-fixture/user/docs
Mode:      additive

Engine:    manifest — the manifest engine works between any two endpoints
  not changelog: the changelog engine is a device↔cloud engine — it needs exactly one local folder (the device) and one remote host (the cloud); neither folder↔folder nor remote↔remote fits it
  not cursor: the cursor engine mirrors (it deletes destination-only paths); this run is additive, so use --mirror to allow deletions or let the manifest engine handle it

Added:     2
Modified:  0
Deleted:   0
Unchanged: 0

Transferred: 2 files
Verified:    no
Duration:    337ms
bash
arc space tree todo-docs-fixture \
  --root-path /tmp/arc-ids-docs-fixture \
  --user-did z1fixtureIdentityDocs000000000000001 \
  --scope user
text
todo-docs-fixture:
[d] /docs  (96 B)
[d] /docs/notes  (128 B)
    /docs/notes/extra.md  (10 B)
    /docs/notes/readme.txt  (34 B)
bash
arc space path todo-docs-fixture /docs \
  --root-path /tmp/arc-ids-docs-fixture \
  --user-did z1fixtureIdentityDocs000000000000001 \
  --scope user
text
/spaces/sws6a445s4sgwlarm6eg32hkoppspbs2/blocklets/todo-docs-fixture/user/docs

instance 作用域映射到 system 角色前缀;user 作用域映射到 user 角色前缀。这与 provider 的 getInstanceSpace({ role }) 合同一致——也正是一个以 /system/user/docs 结尾的 sync 目标会落在那里的原因。

6. 在片段内删除

bash
arc space rm todo-docs-fixture /notes/extra.md \
  --root-path /tmp/arc-ids-docs-fixture \
  --user-did z1fixtureIdentityDocs000000000000001 \
  --scope instance
text
Deleted todo-docs-fixture [instance] /notes/extra.md
bash
arc space tree todo-docs-fixture \
  --root-path /tmp/arc-ids-docs-fixture \
  --user-did z1fixtureIdentityDocs000000000000001 \
  --scope instance
text
todo-docs-fixture:
[d] /notes  (96 B)
    /notes/readme.txt  (34 B)

rm 的默认 --scopeuser。从 system 片段删除时要传 --scope instance

删片段里的文件请用 rm,不要直接去那个目录里手删:直接 rm -rf 会在 space 索引里留下一条幽灵记录,只有 arc space repair --folder <dir> 能清掉。

失败模式(已捕获)

情形命令观察到的结果
未知 app DIDarc space tree does-not-exist-app --root-path … --user-did … --scope instanceERROR: App space not found: does-not-exist-app
tree 上无效 scopearc space tree todo-docs-fixture … --scope allInvalid values: Argument: scope, Given: "all", Choices: "instance", "user"
path 缺少 app 参数arc space pathNot enough non-option arguments: got 0, need at least 1
空 root在全新目录上 arc space listNo app spaces found

treepath 不接受 --scope all。用 list 做多作用域概览,再一次检查一个角色。

本地检查不是什么

本地 arc space实时 session / 正式部署
操作选定的 root 目录操作运行时挂载的 session 视图
展示 /spaces/…/blocklets/… 下的 system / user 片段向调用者暴露 /user/tmp、可选 /space
不会替你认证终端用户用户叠加需要已验证的 CallerInfo
远端 sync(一端是 https://<host>)需要服务端鉴权本页未复跑;视为环境相关的独立操作

不要仅为了检查数据而把文档或本地 UI 工作部署到 DID Space。本地直接运行 blocklet,空间 CLI 实验使用隔离的 --root-path

相关