Files
marqdo/public/features/16-fs-mid2.mq.md
T
cflmy 9331af78e2 release(2.8.0): 合入 CHANGELOG/README/发版说明/skills prove 任务;CI 链接指向 doc/releases
- CHANGELOG.md:v2.8.0 条目(中英双语);
- README.md:版本行 2.7.1→2.8.0 + 愿景第 6 条(知识可证明);
- doc/releases/v2.8.0.md:双语发版说明(亮点/用法/已知限制);
- skills/marqdo-dev/index.mq.md:新增 prove 任务(路径/目录模式/
  require_lean/json;参数用 + 行声明升参,check 与 narrative-ratio 通过);
- 设计文档 §12.5 标记已合入;发版链接统一指向 doc/releases/v2.8.0.md。
2026-11-18 10:29:26 +08:00

2.2 KiB
Executable File

markup, title, import
markup title import
occlusion Native directory trees, enumeration and file metadata
fs
lib/fs.mq.md

This complete demonstration uses native filesystem tools. Call main with fs.write and a disposable --fs-root. It returns actual metadata and relative paths after cleaning its own temporary directory.

main

返回 类型 说明
result map Actual byte size, directory entry count and relative paths

Create a unique temporary directory, then one child directory and one text file. Every write remains under the granted root, avoiding collisions with a pre-existing demo folder. Paths are built explicitly; no generated reader/writer or foreign process participates.

The content ok occupies two UTF-8 bytes. File size measures stored bytes rather than text character count. Enumeration returns relative paths for the child directory and file; counting those paths is another distinct observation. The example does not depend on operating-system enumeration order. Sort explicitly if a later workflow requires stable ordering.

Collect the real metadata and paths before removing this run's unique tree. Returned paths describe an observation, not still-live artifacts. A failure can retain its native diagnostic and this run's directory for caller inspection. Cleanup must stay scoped to the directory created by this invocation.

We work = Create a unique directory inside the granted root and child = work + "/sub" and note = work + "/readme.txt". We Create this run own child directory and [Write the exact UTF-8 example content](fs.write_text(path=note, text="ok")). We metadata = Read the actual file metadata and paths = Enumerate this run directory entries and size = Retain storage byte size) and entries = Count the actual enumerated paths. We Remove only this run unique directory tree after collecting the observations.

observed =

size entries paths
size entries paths

After observing and cleaning this run we return observed.