@vasm/cli 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @vasm/cli
2
+
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Strengthen activation governance and split the published VASMC packages into fixed-version core, CLI, and console artifacts.
package/README.md CHANGED
@@ -1,97 +1,183 @@
1
- # VASMC
1
+ # @vasm/cli
2
2
 
3
- [🇨🇳 中文](#zh-cn) | [🌍 English](#en)
3
+ `@vasm/cli` 发布 `vasmc` 命令,是 VASMC 的 AI-facing 编译入口。它将 `.vasm.md` 源文件编译为纯净 Markdown 产物,并在 `build` 时生成 `.vasmc/build-instructions.md`,让当前 AI 继续处理语义任务。
4
4
 
5
- ***
5
+ <a name="cli"></a>
6
6
 
7
- <a name="zh-cn"></a>
7
+ ## 🛠️ @vasm/cli:AI 编译与工作单
8
8
 
9
- ## 🇨🇳 中文
9
+ `@vasm/cli` 提供 `vasmc` 命令,是 VASMC 的 AI-facing 编译入口。它只做确定性工作:依赖同步、AST 组装、语言块过滤、产物写入,以及生成给当前 AI 使用的后续工作单。
10
10
 
11
- 去中心化的 LLM Prompt 编译器 — 模块化导入、交叉编译、AI 原生的 Agent 编排,以及输入面主权保障。
11
+ ### 安装
12
12
 
13
- 在大语言模型时代,Markdown 已经演变为**源代码** — System Prompt、技能包、指令集全部用 Markdown 编写。VASMC 将它们视为一等编译目标:解析 `@import` 依赖、跨语种交叉编译,并编排 AI 编辑器处理那些属于智能而非工具的语义任务。
13
+ ```bash
14
+ npm install -g @vasm/cli
15
+ ```
14
16
 
15
- AI-Native 系统中,整个上下文窗口既是执行空间也是数据空间——LLM 无法区分指令与数据。VASMC 在执行面形成之前建立确定性的控制点:所有进入 system prompt 的内容,都经过编译链的显式声明与组装,来源可追溯,格式有分类。
17
+ ### 1. 初始化项目
16
18
 
17
- 👉 [阅读完整的设计规范](DESIGN.md)
19
+ ```bash
20
+ vasmc init
21
+ ```
18
22
 
19
- ### 📦 核心特性
23
+ 在工程根目录建立一个 `vasmc.yaml` 来声明依赖:
20
24
 
21
- * **输入面主权**: 编译期内容来源管控——所有进入执行面的 token 都有可追溯的人类授权来源,`prompt` / `doc` 格式分类是编译时的安全分类原语。
22
- * **去中心化包管理**: 直接通过 URL 拉取 Markdown 模块 — 无注册表,无中间人。
23
- * **确定性构建**: SHA-256 锁文件 (`vasmc-lock.yaml`) 确保构建可复现。
24
- * **交叉编译**: AST 级语言块过滤 (`<!-- lang:xx -->`) 生成各语种产物;未覆盖语种可自动唤起 LLM 交叉编译回译。
25
- * **双模式引入**:
26
- * `@import:link` — 别名重写为本地相对路径(保留超链接结构)。
27
- * `@import:inline` — 内联展开远程内容(组装大型 Prompt 上下文)。
25
+ ```yaml
26
+ dependencies:
27
+ company-rules: "https://example.com/guidelines.md"
28
+ coder-skill:
29
+ url: "https://example.com/coder-skill.md"
30
+ dest: "./skills/coder.md"
31
+ ```
28
32
 
29
- ### 🛠️ CLI 命令架构 (v3.0)
33
+ 也可以直接使用命令行注册依赖:
30
34
 
31
- | 命令 | 分类 | 说明 |
32
- |------|------|------|
33
- | `vasmc build` | 确定性工具 | 纯编译器 — AST 组装 + 交叉编译 |
34
- | `vasmc agent` | Agent 工具 | 零 LLM 编译 + 生成 AI 编辑器编排指令 |
35
- | `vasmc lint` | LLM 增强工具 | 对编译产物进行语义冲突检测 |
36
- | `vasmc diff` | LLM 增强工具 | 版本间语义差异分析 |
37
- | `vasmc graph` | 确定性工具 | ASCII 依赖图谱可视化 |
38
- | `vasmc seal` | 确定性工具 | 为普通 Markdown 注入 Frontmatter |
39
- | `vasmc sync` | 确定性工具 | 安装并锁定所有依赖 |
35
+ ```bash
36
+ vasmc add https://example.com/coder-skill.md --alias coder-skill --dest ./skills/coder.md
37
+ ```
38
+
39
+ ### 2. 同步与锁定
40
40
 
41
- ### 🚀 快速上手
41
+ `.vasmc/` 加入 `.gitignore`。这是 VASMC 的内部缓存目录。`vasmc-lock.yaml` 应提交到版本控制,它确保构建输入确定。
42
+
43
+ ```gitignore
44
+ .vasmc/
45
+ ```
46
+
47
+ 安装所有缺失依赖并生成或更新锁文件:
42
48
 
43
49
  ```bash
44
- npm install -g @vasm/cli
45
- vasmc init # 生成 vasmc-build.yaml
46
- vasmc add https://example.com/skill.md --alias my-skill
47
- vasmc build # 编译工作区
50
+ vasmc sync
51
+ ```
52
+
53
+ 需要强制刷新时:
54
+
55
+ ```bash
56
+ vasmc update <alias>
57
+ vasmc update
58
+ ```
59
+
60
+ ### 3. AI 编译
61
+
62
+ 一对一编译并生成工作单:
63
+
64
+ ```bash
65
+ vasmc build main.vasm.md -o ./dist
66
+ ```
67
+
68
+ 工作区编译并生成工作单:
69
+
70
+ ```bash
71
+ vasmc build
72
+ ```
73
+
74
+ `vasmc build` 是 AI 侧唯一编译入口。它会执行确定性的 AST 组装、语言块过滤和产物写入;如果目标语言缺失,它不会调用外部模型自动补全,而是在 `.vasmc/build-instructions.md` 中生成后续工作单,让当前 AI 接管 Verify、Translate、Diff、Policy Review、Policy Gate、Project Review 和 Tree-Shake 等语义任务。
75
+
76
+ ### 4. 工作单
77
+
78
+ ```bash
79
+ cat .vasmc/build-instructions.md
80
+ ```
81
+
82
+ 每次执行 `vasmc build` 后,AI 编辑器都应立即读取 `.vasmc/build-instructions.md`,并按其中列出的 Action Items 顺序执行。`.vasmc/build-report.yaml` 会记录本次构建涉及的入口、产物、manifest 摘要、依赖、`policy.status` 和 policy diagnostics,供 AI 做上下文与权限边界审查。若启用 `ai.projectReview`,`.vasmc/project-review-context.yaml` 会列出可供 AI 做项目感知建议的文件索引。
83
+
84
+ ### 5. 其他确定性命令
85
+
86
+ ```bash
87
+ vasmc graph main.vasm.md
88
+ vasmc seal my-prompt.md --alias my-custom-name
89
+ vasmc seal "prompts/**/*.md" --format prompt
48
90
  ```
49
91
 
50
- 完整 CLI 用法请参阅 **[帮助与用法文档](HELP.md)**。
92
+ `seal` 会为普通 Markdown 注入 VASM Frontmatter,并将文件重命名为 `.vasm.md`。对于 README、HELP、DESIGN 等人类文档,请显式使用 `--format doc`;对于 System Prompt、Skill 等 AI 消费文件,请使用 `--format prompt`。
51
93
 
52
94
  ***
53
95
 
54
- <a name="en"></a>
96
+ <a name="workspace"></a>
55
97
 
56
- ## 🌍 English
98
+ ### 🗂️ 工作区批量编译
57
99
 
58
- Decentralized LLM Prompt Compiler — Modular imports, cross-compilation, AI-native Agent orchestration, and input-surface sovereignty protection.
100
+ ```yaml
101
+ includes:
102
+ - "src/**/*.vasm.md"
59
103
 
60
- In the era of Large Language Models, Markdown has evolved into **source code** — System Prompts, skill sets, and instruction sets are all written in Markdown. VASMC treats them as first-class compilation targets: parsing `@import` dependencies, cross-compiling across languages, and orchestrating AI editors to handle semantic tasks that belong to intelligence rather than tools.
104
+ output:
105
+ dir: "./dist"
61
106
 
62
- In AI-Native systems, the entire context window is both execution space and data space — LLMs cannot distinguish between instructions and data. VASMC establishes deterministic control points before the execution surface is formed: all content entering the system prompt undergoes explicit declaration and assembly through the compilation chain, with traceable origins and categorized formats.
107
+ baseDir: "./src"
63
108
 
64
- 👉 [Read the full design specification](DESIGN.md)
109
+ compile:
110
+ doc:
111
+ targetLangs: ["zh-CN"]
112
+ prompt:
113
+ targetLangs: ["zh-CN"]
65
114
 
66
- ### 📦 Core Features
115
+ routing:
116
+ - match: "src/agents/*.vasm.md"
117
+ dest: "./dist/agents/"
118
+ ```
119
+
120
+ 也支持 CLI 临时覆盖:
67
121
 
68
- * **Input-Surface Sovereignty**: Compilation-time content source control — all tokens entering the execution surface have traceable human-authorized origins; `prompt` / `doc` format classification serves as a security classification primitive at compile time.
69
- * **Decentralized Package Management**: Pull Markdown modules directly via URL — no registry, no middleman.
70
- * **Deterministic Builds**: SHA-256 lock files (`vasmc-lock.yaml`) ensure reproducible builds.
71
- * **Cross-Compilation**: AST-level language block filtering (`<!-- lang:xx -->`) generates artifacts for various languages; uncovered languages can automatically trigger LLM cross-compilation back-translation.
72
- * **Dual-Mode Import**:
73
- * `@import:link` — Alias rewritten to local relative paths (preserving hyperlink structure).
74
- * `@import:inline` — Inline expansion of remote content (assembling large Prompt contexts).
122
+ ```bash
123
+ vasmc build --out-dir ./doc --base-dir ./src
124
+ ```
75
125
 
76
- ### 🛠️ CLI Command Architecture (v3.0)
126
+ <a name="cli-ai-build"></a>
77
127
 
78
- | Command | Category | Description |
79
- |------|------|------|
80
- | `vasmc build` | Deterministic Tool | Pure compiler — AST assembly + cross-compilation |
81
- | `vasmc agent` | Agent Tool | Zero-LLM compilation + generating AI editor orchestration instructions |
82
- | `vasmc lint` | LLM-Enhanced Tool | Semantic conflict detection for compiled artifacts |
83
- | `vasmc diff` | LLM-Enhanced Tool | Semantic difference analysis between versions |
84
- | `vasmc graph` | Deterministic Tool | ASCII dependency graph visualization |
85
- | `vasmc seal` | Deterministic Tool | Inject Frontmatter into standard Markdown |
86
- | `vasmc sync` | Deterministic Tool | Install and lock all dependencies |
128
+ ## 🤖 AI Build 工作流
87
129
 
88
- ### 🚀 Quick Start
130
+ 大模型辅助编程时代,VASMC 只负责确定性组装;语义校验、翻译、Diff 和裁剪应由当前 AI 接管。作为统管全局的 AI 助手,你应该使用 AI 侧 build 驱动编译:
89
131
 
90
132
  ```bash
91
- npm install -g @vasm/cli
92
- vasmc init # Generate vasmc-build.yaml
93
- vasmc add https://example.com/skill.md --alias my-skill
94
- vasmc build # Compile workspace
133
+ vasmc build [file]
134
+ ```
135
+
136
+ > **AI 编辑器始终使用 `vasmc build`。**\
137
+ > 在 `@vasm/cli` 中,`build` 会同时产出确定性 Markdown 和 `.vasmc/build-instructions.md` 后续工作单。
138
+
139
+ 在该模式下,VASMC 执行 AST 静态组装,并在项目隐藏目录输出指令清单和结构化报告:
140
+
141
+ **`.vasmc/build-instructions.md`**
142
+
143
+ **`.vasmc/build-report.yaml`**
144
+
145
+ **`.vasmc/project-review-context.yaml`**(仅在 `ai.projectReview` 开启时生成)
146
+
147
+ ### AI 助手操作规程
148
+
149
+ 每当你执行了 `vasmc build` 命令后,**立即读取 `.vasmc/build-instructions.md`**,并按其中列出的 Action Items 顺序执行以下任务(具体步骤由编译器按需生成):
150
+
151
+ 1. **Semantic Verify**:读取 Minimal-Token Variant,检查语义冲突、人格分裂、逻辑冗余和系统破坏风险四类问题。
152
+ 2. **Translation**(按需):若 instructions 中包含此步骤,将已校验的核心文件翻译到指定的其他语种,**严格保留** Markdown AST 结构。
153
+ 3. **Semantic Diff**(按需):若 instructions 中包含此步骤,读取指定的历史备份文件,向用户说明本次编译在底层结构上影响了什么。
154
+ 4. **Policy Review**(按需):若 instructions 中包含此步骤,读取 `.vasmc/build-report.yaml`,检查 skill manifest 的 scope、capabilities、activation、trust,以及 activation intent 是否存在冲突、重叠或 priority 抢占风险。
155
+ 5. **Policy Gate**(按需):若 instructions 中包含此步骤,说明确定性 policy 已发现阻断风险;在 `security.mode: enforce` 下,VASMC 不会更新该 skill 的正式输出。
156
+ 6. **Project Review**(按需):若 instructions 中包含此步骤,读取 `.vasmc/project-review-context.yaml` 和 `.vasmc/build-report.yaml`,结合项目文件给出源文件级建议或 patch 建议,不能直接编辑生成物。
157
+ 7. **Tree-Shake(条件性)**:**仅在**用户明确表达了优化 Prompt 的意图时,才执行裁剪分析。
158
+
159
+ 你是统筹全局的智能主体,而 VASMC 是你最可靠的确权肌肉。
160
+
161
+ ### Policy 状态
162
+
163
+ `.vasmc/build-report.yaml` 中每个 entry 都包含 `policy.status`:
164
+
165
+ * `pass`:无确定性风险信号。
166
+ * `review`:允许输出,但 AI 必须审查 report 中的 diagnostics。
167
+ * `blocked`:存在可确定的阻断风险,例如依赖 capability 越权或 lockfile hash 失配。默认 `review` 模式只报告;`enforce` 模式会阻止 unsafe skill 输出被更新。
168
+
169
+ ### Project Review
170
+
171
+ 项目可以在 `vasmc-build.yaml` 中开启项目感知审查:
172
+
173
+ ```yaml
174
+ ai:
175
+ projectReview:
176
+ mode: suggest
177
+ include:
178
+ - "README.md"
179
+ - "docs/**/*.md"
180
+ - "package.json"
95
181
  ```
96
182
 
97
- For full CLI usage, please refer to the **[Help and Usage Documentation](HELP.md)**.
183
+ 这是 AI pass,不是编译器自动重写。VASMC 只生成上下文索引和工作单;当前 AI 根据索引读取项目文件,检查 skill/prompt 是否缺少项目实际命令、目录、术语、约束,或是否有过宽 activation、可收窄 capability、重复 fragment 等问题。