@seemseam/architec 0.2.10 → 0.2.11
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/README.md +130 -140
- package/README.zh-CN.md +114 -117
- package/bin/archi.js +9 -131
- package/docs/npm-release.md +75 -55
- package/lib/archi-dispatcher.js +291 -0
- package/package.json +14 -9
- package/scripts/check-release-assets.js +101 -0
package/README.zh-CN.md
CHANGED
|
@@ -3,75 +3,59 @@
|
|
|
3
3
|
**面向 AI 辅助开发代码库的增量架构审查 CLI。**
|
|
4
4
|
|
|
5
5
|
[](https://www.python.org/)
|
|
6
|
-
[](
|
|
6
|
+
[](README.md#quick-start)
|
|
7
7
|
[](#无需登录)
|
|
8
8
|
|
|
9
9
|
[English](README.md) | [中文](README.zh-CN.md)
|
|
10
10
|
|
|
11
|
-
Architec
|
|
12
|
-
|
|
13
|
-
它关注的实际问题是:
|
|
11
|
+
Architec 是一个建议型架构分析工具,核心问题是:
|
|
14
12
|
|
|
15
13
|
> 这次改动会不会让项目更难长期维护?
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## 包状态
|
|
20
|
-
|
|
21
|
-
当前 checkout 已经具备 Python 发布配置,并准备了 npm launcher 草案:
|
|
22
|
-
|
|
23
|
-
| Registry | 包名 | CLI 命令 | 当前 checkout 状态 |
|
|
24
|
-
| --- | --- | --- | --- |
|
|
25
|
-
| PyPI | `architec` | `archi` | 包元数据、README、许可证、wheel/sdist 内容已经配置。必须等 companion dependencies 可从目标索引安装,并选择新的 release version/tag 后再发布。 |
|
|
26
|
-
| npm | `@seemseam/architec` | `archi` | scoped launcher 包已经配置,但 scope 所有权、Trusted Publishing 设置和 Python 依赖链仍需发布前验证。 |
|
|
27
|
-
|
|
28
|
-
未加 scope 的 npm 包名 `architec` 已被无关包占用,所以 npm 发布应使用你控制的 scope。Python 侧的发行名和命令名是刻意分开的:发行名是 `architec`,安装后的控制台命令是 `archi`。
|
|
29
|
-
|
|
30
|
-
只有在对应 registry 页面显示目标版本后,才使用 registry 安装命令。根据本次审计,现有 `v0.2.10` tag 指向较旧提交,未来 registry release 应使用新的版本和 tag。
|
|
31
|
-
|
|
32
|
-
## 安装
|
|
33
|
-
|
|
34
|
-
Architec 需要 Python 3.11 或更新版本。
|
|
35
|
-
|
|
36
|
-
从当前 checkout 做本地开发安装:
|
|
15
|
+
默认命令是:
|
|
37
16
|
|
|
38
17
|
```bash
|
|
39
|
-
|
|
18
|
+
archi
|
|
40
19
|
```
|
|
41
20
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
PyPI 包发布并验证后,预期安装方式是:
|
|
21
|
+
它会审查当前 git 变更,构建紧凑的架构证据,并通过 LLM 给出可读的架构建议。
|
|
22
|
+
如果需要查看整个项目的架构基线,使用:
|
|
45
23
|
|
|
46
24
|
```bash
|
|
47
|
-
|
|
25
|
+
archi --full
|
|
48
26
|
```
|
|
49
27
|
|
|
50
|
-
|
|
28
|
+
Architec 只给建议,不做合并判定,不自动修改代码,也不要求登录。
|
|
51
29
|
|
|
52
|
-
|
|
30
|
+
## 为什么需要 Architec
|
|
53
31
|
|
|
54
|
-
|
|
55
|
-
npm install -g @seemseam/architec
|
|
56
|
-
```
|
|
32
|
+
AI 辅助开发会显著加快编码速度,但也容易带来架构漂移:
|
|
57
33
|
|
|
58
|
-
|
|
34
|
+
- 新实现重复造轮子;
|
|
35
|
+
- 兼容路径和主实现混在一起;
|
|
36
|
+
- 小改动绕过了模块边界;
|
|
37
|
+
- helper 逐渐膨胀成无归属子系统;
|
|
38
|
+
- 陈旧代码、陈旧文档和清理候选长期堆积;
|
|
39
|
+
- 高风险文件在高 churn 区域继续扩张。
|
|
59
40
|
|
|
60
|
-
|
|
41
|
+
Architec 会把这些信号整理成结构化审查结果,帮助人类 reviewer 或 coding agent
|
|
42
|
+
更快判断哪些建议值得进一步检查。
|
|
61
43
|
|
|
62
|
-
Architec
|
|
44
|
+
## Architec、Hippos 和 llmgateway
|
|
45
|
+
|
|
46
|
+
Architec 本身是架构审查层,依赖两个运行时组件:
|
|
63
47
|
|
|
64
48
|
| 组件 | 命令 / 包 | 作用 |
|
|
65
49
|
| --- | --- | --- |
|
|
66
50
|
| **Architec** | `archi` / `architec` | 执行架构审查,通过 llmgateway 调用 LLM,并把结果写入 `.architec/`。 |
|
|
67
|
-
| **
|
|
51
|
+
| **Hippos** | `hippos` / `seemseam-hippos` | 生成 `.hippos/` 结构快照,包括文件清单、代码签名、仓库索引、结构 prompt 和指标。 |
|
|
68
52
|
| **llmgateway** | `llmgateway` | 管理 provider 凭据、base URL、API 风格、模型名,以及 strong/weak 模型路由。 |
|
|
69
53
|
|
|
70
54
|
```text
|
|
71
55
|
源码树 + git 变更
|
|
72
56
|
|
|
|
73
57
|
v
|
|
74
|
-
|
|
58
|
+
Hippos 结构快照 -> .hippos/
|
|
75
59
|
|
|
|
76
60
|
v
|
|
77
61
|
Architec 证据构建 -> 增量范围或全项目上下文
|
|
@@ -83,66 +67,104 @@ llmgateway LLM 调用 -> strong / weak 模型
|
|
|
83
67
|
Architec 审查输出 -> .architec/
|
|
84
68
|
```
|
|
85
69
|
|
|
86
|
-
日常 `archi`
|
|
70
|
+
日常 `archi` 仍然会使用 LLM,但不会默认刷新完整 Hippos 快照。`archi --full`
|
|
71
|
+
更依赖 Hippos 的全项目结构信息;如果要先刷新结构快照,可以运行:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
archi --refresh-from-hippos --full
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 工作原理
|
|
78
|
+
|
|
79
|
+
Architec 结合确定性代码信号和 LLM 解释:
|
|
80
|
+
|
|
81
|
+
1. **选择范围**
|
|
82
|
+
- `archi` 读取当前 git 变更,聚焦 changed files。
|
|
83
|
+
- `archi --full` 审查整个项目。
|
|
84
|
+
|
|
85
|
+
2. **读取结构上下文**
|
|
86
|
+
- Hippos 生成 `.hippos/` 快照。
|
|
87
|
+
- Architec 判断快照是否存在、是否陈旧、是否无法判断 freshness。
|
|
88
|
+
|
|
89
|
+
3. **构建架构证据**
|
|
90
|
+
- 静态扫描重复逻辑、shadow implementation、边界压力、清理候选、热点、拓扑压力等。
|
|
91
|
+
- 增量审查会把 selected-change concerns 和全局上下文分开,避免小 diff 被全局噪音淹没。
|
|
92
|
+
|
|
93
|
+
4. **交给 LLM 解释**
|
|
94
|
+
- Architec 把紧凑证据发送给 llmgateway。
|
|
95
|
+
- llmgateway 根据配置选择 strong 或 weak 模型,并负责 provider 凭据。
|
|
96
|
+
|
|
97
|
+
5. **输出建议**
|
|
98
|
+
- Architec 对 concerns 排序,保留原始 artifacts,并生成 Markdown / JSON 输出。
|
|
99
|
+
- 输出是架构建议,不是 pass/fail,也不是运行时正确性的证明。
|
|
100
|
+
|
|
101
|
+
## 安装
|
|
102
|
+
|
|
103
|
+
需要 Python 3.11+。
|
|
104
|
+
|
|
105
|
+
推荐从 PyPI 安装:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
python3 -m pip install --user architec
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
这会安装:
|
|
112
|
+
|
|
113
|
+
- `archi`:Architec CLI;
|
|
114
|
+
- `seemseam-llmgateway`:提供 LLM provider 网关能力的包;
|
|
115
|
+
- `seemseam-hippos`:提供 Hippos 结构快照能力的包。
|
|
116
|
+
|
|
117
|
+
运行时 import 名仍是 `llmgateway` 和 `hippos`,不需要额外配置 Python 包索引。
|
|
118
|
+
|
|
119
|
+
本地开发安装:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
python3 -m pip install -e .
|
|
123
|
+
```
|
|
87
124
|
|
|
88
125
|
## 配置 LLM
|
|
89
126
|
|
|
90
|
-
Architec 的 LLM
|
|
127
|
+
Architec 的 LLM 调用全部通过 **llmgateway**。请在下面的文件中配置 provider
|
|
128
|
+
和 strong/weak 模型:
|
|
91
129
|
|
|
92
130
|
```text
|
|
93
131
|
~/.llmgateway/config.yaml
|
|
94
132
|
```
|
|
95
133
|
|
|
96
|
-
|
|
134
|
+
最小示例:
|
|
97
135
|
|
|
98
136
|
```yaml
|
|
99
137
|
version: 1
|
|
100
138
|
provider:
|
|
101
139
|
provider_type: openai
|
|
102
140
|
api_style: openai_responses
|
|
103
|
-
base_url: https://your-llm-endpoint
|
|
104
|
-
api_key:
|
|
141
|
+
base_url: https://your-llm-endpoint/v1
|
|
142
|
+
api_key: sk-...
|
|
105
143
|
settings:
|
|
106
144
|
strong_model: your-strong-model
|
|
107
145
|
weak_model: your-fast-model
|
|
108
146
|
```
|
|
109
147
|
|
|
110
|
-
这个文件应该只保存在本机,不要提交到仓库。Architec 不会把 LLM provider 凭据写入 `.architec/`;provider 配置和请求路由由 llmgateway 负责。
|
|
111
|
-
|
|
112
148
|
检查安装和 LLM 路由:
|
|
113
149
|
|
|
114
150
|
```bash
|
|
115
151
|
archi --check .
|
|
116
152
|
```
|
|
117
153
|
|
|
118
|
-
|
|
154
|
+
## 快速使用
|
|
119
155
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
审查当前目录里的 git 变更:
|
|
156
|
+
审查当前变更:
|
|
123
157
|
|
|
124
158
|
```bash
|
|
125
159
|
archi
|
|
126
160
|
```
|
|
127
161
|
|
|
128
|
-
审查另一个项目路径:
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
archi /path/to/project
|
|
132
|
-
```
|
|
133
|
-
|
|
134
162
|
全项目架构审查:
|
|
135
163
|
|
|
136
164
|
```bash
|
|
137
165
|
archi --full
|
|
138
166
|
```
|
|
139
167
|
|
|
140
|
-
先刷新 Hippo 输入,再做全项目审查:
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
archi --refresh-from-hippo --full
|
|
144
|
-
```
|
|
145
|
-
|
|
146
168
|
保存 JSON 输出:
|
|
147
169
|
|
|
148
170
|
```bash
|
|
@@ -150,44 +172,26 @@ archi --out review.json
|
|
|
150
172
|
archi --full --out full-review.json
|
|
151
173
|
```
|
|
152
174
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
| 命令 | 用途 |
|
|
156
|
-
| --- | --- |
|
|
157
|
-
| `archi` | 对当前 git 变更做增量 LLM 架构审查。 |
|
|
158
|
-
| `archi <path>` | 对另一个项目根目录做增量审查。 |
|
|
159
|
-
| `archi --full` | 对整个项目做 LLM 架构审查。 |
|
|
160
|
-
| `archi --refresh-from-hippo --full` | 刷新 Hippo 结构输入后运行全量审查。 |
|
|
161
|
-
| `archi --check .` | 检查 Hippo bundle 状态和 llmgateway 配置。 |
|
|
162
|
-
| `archi --out review.json` | 保存增量审查 JSON。 |
|
|
163
|
-
| `archi --version` | 显示当前 CLI 版本,并在可用时检查最新发布状态。 |
|
|
164
|
-
| `archi update` | 通过配置的安装器重新安装最新公开构建。 |
|
|
165
|
-
| `archi uninstall --yes` | 移除已安装的 launcher、托管资源、配置和依赖。 |
|
|
166
|
-
|
|
167
|
-
仓库里仍保留一些兼容命令和隐藏参数,供旧自动化使用,例如 `archi code-review --full .`、`archi code-review --diff .`、`archi plan-review`、`archi status --snapshot` 和 `archi fix-advice --review review.json`。新用户应优先使用上面的顶层命令,并用下面的命令检查本机安装版本:
|
|
175
|
+
刷新 Hippos 快照后再全量审查:
|
|
168
176
|
|
|
169
177
|
```bash
|
|
170
|
-
archi --
|
|
178
|
+
archi --refresh-from-hippos --full
|
|
171
179
|
```
|
|
172
180
|
|
|
173
|
-
##
|
|
174
|
-
|
|
175
|
-
Architec 会输出建议型 concerns 和 signals,包括:
|
|
181
|
+
## 命令速查
|
|
176
182
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
-
|
|
183
|
-
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
这些输出是建议,不是 pass/fail gate。
|
|
183
|
+
| 命令 | 用途 |
|
|
184
|
+
| --- | --- |
|
|
185
|
+
| `archi` | 对当前 selected changes 进行增量 LLM 架构审查。 |
|
|
186
|
+
| `archi --full` | 对整个项目进行 LLM 架构审查。 |
|
|
187
|
+
| `archi --out review.json` | 保存增量审查 JSON。 |
|
|
188
|
+
| `archi --full --out full-review.json` | 保存全量审查 JSON。 |
|
|
189
|
+
| `archi --refresh-from-hippos --full` | 刷新 Hippos 结构输入后运行全量审查。 |
|
|
190
|
+
| `archi --check .` | 检查 Hippos bundle 状态和 llmgateway 配置。 |
|
|
187
191
|
|
|
188
|
-
##
|
|
192
|
+
## 输出
|
|
189
193
|
|
|
190
|
-
Architec
|
|
194
|
+
Architec 写入 `.architec/`:
|
|
191
195
|
|
|
192
196
|
```text
|
|
193
197
|
.architec/
|
|
@@ -200,27 +204,31 @@ Architec 会把生成文件写入 `.architec/`:
|
|
|
200
204
|
cache/
|
|
201
205
|
```
|
|
202
206
|
|
|
203
|
-
|
|
207
|
+
Hippos 写入 `.hippos/`。
|
|
204
208
|
|
|
205
|
-
建议先读 `.architec/architec-summary.md
|
|
209
|
+
建议先读 `.architec/architec-summary.md`,需要精确字段时再看
|
|
210
|
+
`.architec/architec-analysis.json`。
|
|
206
211
|
|
|
207
|
-
##
|
|
212
|
+
## Agent 命令兼容
|
|
208
213
|
|
|
209
|
-
|
|
214
|
+
当前公开工作流是 `archi` 和 `archi --full`。部分旧版本 `archi` 可能仍显示旧命令形态:
|
|
215
|
+
全量审查是 `archi .`,增量审查是 `archi --diff .`。
|
|
210
216
|
|
|
211
|
-
|
|
212
|
-
- `hippocampus>=0.1.7`;
|
|
213
|
-
- 来自 Python 包索引的 `PyYAML`、`certifi` 和 `cryptography`。
|
|
217
|
+
Agent 和自动化脚本应先检查本机命令:
|
|
214
218
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
219
|
+
```bash
|
|
220
|
+
archi --help
|
|
221
|
+
```
|
|
218
222
|
|
|
219
|
-
|
|
223
|
+
| Help 输出 | 增量审查 | 全量审查 |
|
|
224
|
+
| --- | --- | --- |
|
|
225
|
+
| 包含 `--full` | `archi` | `archi --full` |
|
|
226
|
+
| 不包含 `--full` 但包含 `--diff` | `archi --diff .` | `archi .` |
|
|
220
227
|
|
|
221
|
-
|
|
228
|
+
## 无需登录
|
|
222
229
|
|
|
223
|
-
|
|
230
|
+
架构分析不需要 `archi login`。账号相关命令可能用于诊断,但不是日常 Architec
|
|
231
|
+
分析流程的一部分。
|
|
224
232
|
|
|
225
233
|
## 开发
|
|
226
234
|
|
|
@@ -233,21 +241,10 @@ PYTHONPATH=src python3 -m pytest -q
|
|
|
233
241
|
从当前 checkout 运行 Architec:
|
|
234
242
|
|
|
235
243
|
```bash
|
|
236
|
-
PYTHONPATH=src python3 -m architec --help
|
|
237
244
|
PYTHONPATH=src python3 -m architec
|
|
238
245
|
PYTHONPATH=src python3 -m architec --full
|
|
239
246
|
```
|
|
240
247
|
|
|
241
|
-
## 发布维护说明
|
|
242
|
-
|
|
243
|
-
- `pyproject.toml`、`package.json` 和 `src/architec/_version.py` 当前声明版本为 `0.2.10`。
|
|
244
|
-
- 现有 `v0.2.10` tag 指向较旧提交。不要为了新的 release state 复用或移动它。
|
|
245
|
-
- 只有在版本、包元数据、README 和依赖策略都确定后,才创建新的 `vX.Y.Z` git tag。
|
|
246
|
-
- 除非明确接受当前 dirty 状态,否则不要从 dirty worktree 发布。
|
|
247
|
-
- PyPI 发布前需要验证 `architec` 项目名、目标版本、wheel/sdist 内容、依赖解析和 long description 渲染。
|
|
248
|
-
- npm 发布前需要验证 package scope、`bin` 入口、files allowlist、launcher smoke test 和 Trusted Publishing 配置。
|
|
249
|
-
- npm 发布细节见 [docs/npm-release.md](docs/npm-release.md)。
|
|
250
|
-
|
|
251
248
|
## 更多文档
|
|
252
249
|
|
|
253
250
|
- [使用手册](docs/usage-manual.md)
|
package/bin/archi.js
CHANGED
|
@@ -1,135 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
);
|
|
13
|
-
const VERSION = PACKAGE_JSON.version;
|
|
14
|
-
const DEFAULT_SOURCE = `architec @ git+https://github.com/SeemSeam/architec.git@v${VERSION}`;
|
|
15
|
-
const PYTHON_SPEC = process.env.ARCHITEC_NPM_PIP_SPEC || DEFAULT_SOURCE;
|
|
16
|
-
const CACHE_ROOT =
|
|
17
|
-
process.env.ARCHITEC_NPM_CACHE_DIR ||
|
|
18
|
-
path.join(os.homedir(), ".cache", "architec", "npm");
|
|
19
|
-
const VENV_DIR = path.join(CACHE_ROOT, VERSION, "venv");
|
|
20
|
-
const MARKER_PATH = path.join(CACHE_ROOT, VERSION, "install.json");
|
|
21
|
-
|
|
22
|
-
function fail(message, detail) {
|
|
23
|
-
console.error(`archi npm launcher: ${message}`);
|
|
24
|
-
if (detail) {
|
|
25
|
-
console.error(detail);
|
|
26
|
-
}
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function run(command, args, options = {}) {
|
|
31
|
-
return spawnSync(command, args, {
|
|
32
|
-
stdio: options.stdio || "pipe",
|
|
33
|
-
encoding: options.encoding === false ? undefined : "utf8",
|
|
34
|
-
env: process.env,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function commandWorks(command) {
|
|
39
|
-
const result = run(command, ["--version"]);
|
|
40
|
-
return !result.error && result.status === 0;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function pythonVersion(command) {
|
|
44
|
-
const result = run(command, [
|
|
45
|
-
"-c",
|
|
46
|
-
"import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')",
|
|
47
|
-
]);
|
|
48
|
-
if (result.error || result.status !== 0) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
const [major, minor] = String(result.stdout || "").trim().split(".").map(Number);
|
|
52
|
-
if (!Number.isInteger(major) || !Number.isInteger(minor)) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
return { major, minor };
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function findPython() {
|
|
59
|
-
const configured = process.env.ARCHITEC_NPM_PYTHON;
|
|
60
|
-
const candidates = configured ? [configured] : ["python3", "python"];
|
|
61
|
-
for (const candidate of candidates) {
|
|
62
|
-
if (!commandWorks(candidate)) {
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
const version = pythonVersion(candidate);
|
|
66
|
-
if (version && (version.major > 3 || (version.major === 3 && version.minor >= 11))) {
|
|
67
|
-
return candidate;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function venvPython() {
|
|
74
|
-
if (process.platform === "win32") {
|
|
75
|
-
return path.join(VENV_DIR, "Scripts", "python.exe");
|
|
76
|
-
}
|
|
77
|
-
return path.join(VENV_DIR, "bin", "python");
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function installedMarkerMatches() {
|
|
81
|
-
try {
|
|
82
|
-
const marker = JSON.parse(fs.readFileSync(MARKER_PATH, "utf8"));
|
|
83
|
-
return marker.version === VERSION && marker.pythonSpec === PYTHON_SPEC;
|
|
84
|
-
} catch {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function ensureVenv() {
|
|
90
|
-
const targetPython = venvPython();
|
|
91
|
-
if (fs.existsSync(targetPython) && installedMarkerMatches()) {
|
|
92
|
-
return targetPython;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const python = findPython();
|
|
96
|
-
if (!python) {
|
|
97
|
-
fail(
|
|
98
|
-
"Python 3.11+ is required.",
|
|
99
|
-
"Set ARCHITEC_NPM_PYTHON to a Python 3.11+ executable, or install the Python package directly with pip.",
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
fs.mkdirSync(path.dirname(VENV_DIR), { recursive: true });
|
|
104
|
-
let result = run(python, ["-m", "venv", VENV_DIR], { stdio: "inherit" });
|
|
105
|
-
if (result.error || result.status !== 0) {
|
|
106
|
-
fail("failed to create the Python virtual environment");
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
result = run(targetPython, ["-m", "pip", "install", "--upgrade", PYTHON_SPEC], {
|
|
110
|
-
stdio: "inherit",
|
|
4
|
+
const { main } = require("../lib/archi-dispatcher");
|
|
5
|
+
|
|
6
|
+
main(process.argv.slice(2))
|
|
7
|
+
.then((status) => {
|
|
8
|
+
process.exit(status === undefined || status === null ? 0 : status);
|
|
9
|
+
})
|
|
10
|
+
.catch((error) => {
|
|
11
|
+
console.error(`archi npm dispatcher: ${error.message}`);
|
|
12
|
+
process.exit(1);
|
|
111
13
|
});
|
|
112
|
-
if (result.error || result.status !== 0) {
|
|
113
|
-
fail(
|
|
114
|
-
"failed to install the Architec Python CLI.",
|
|
115
|
-
`Tried: ${targetPython} -m pip install --upgrade "${PYTHON_SPEC}"`,
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
fs.writeFileSync(
|
|
120
|
-
MARKER_PATH,
|
|
121
|
-
`${JSON.stringify({ version: VERSION, pythonSpec: PYTHON_SPEC }, null, 2)}\n`,
|
|
122
|
-
);
|
|
123
|
-
return targetPython;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const python = ensureVenv();
|
|
127
|
-
const child = spawnSync(python, ["-m", "architec", ...process.argv.slice(2)], {
|
|
128
|
-
stdio: "inherit",
|
|
129
|
-
env: process.env,
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
if (child.error) {
|
|
133
|
-
fail("failed to start the Architec Python CLI", child.error.message);
|
|
134
|
-
}
|
|
135
|
-
process.exit(child.status === null ? 1 : child.status);
|
package/docs/npm-release.md
CHANGED
|
@@ -1,65 +1,85 @@
|
|
|
1
1
|
# npm Release Notes
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
`@seemseam/architec` is a binary dispatcher for the Architec CLI. It is not a
|
|
4
|
+
Node.js rewrite and it must not bundle the Python source trees for `architec`,
|
|
5
|
+
`seemseam_hippos`, or `seemseam_llmgateway`.
|
|
5
6
|
|
|
6
7
|
## Package Identity
|
|
7
8
|
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
4.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
9
|
+
- npm package: `@seemseam/architec`
|
|
10
|
+
- CLI command: `archi`
|
|
11
|
+
- npm version: must match the released Architec version on PyPI and the
|
|
12
|
+
GitHub tag, for example `0.2.11` and `v0.2.11`
|
|
13
|
+
- source package: PyPI `architec`
|
|
14
|
+
- binary source: GitHub Release standalone `archi` assets
|
|
15
|
+
|
|
16
|
+
The unscoped npm package `architec` is owned by someone else and is not used.
|
|
17
|
+
|
|
18
|
+
## Dispatcher Strategy
|
|
19
|
+
|
|
20
|
+
The npm package contains a small Node.js dispatcher. On first run it:
|
|
21
|
+
|
|
22
|
+
1. maps the current OS/CPU to a release asset name;
|
|
23
|
+
2. downloads `archi-v<version>-checksums.txt` from the matching GitHub Release;
|
|
24
|
+
3. downloads the matching `archi-v<version>-<platform>` binary;
|
|
25
|
+
4. verifies the SHA-256 checksum before caching the binary;
|
|
26
|
+
5. executes the cached binary on later runs.
|
|
27
|
+
|
|
28
|
+
Default release URL:
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
https://github.com/SeemSeam/architec/releases/download/v<version>/
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The first npm release gate requires these assets for the selected platform
|
|
35
|
+
matrix:
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
archi-v0.2.11-linux-x64
|
|
39
|
+
archi-v0.2.11-darwin-x64
|
|
40
|
+
archi-v0.2.11-darwin-arm64
|
|
41
|
+
archi-v0.2.11-win32-x64.exe
|
|
42
|
+
archi-v0.2.11-checksums.txt
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`linux-arm64` is supported by the dispatcher if an asset exists, but it is not
|
|
46
|
+
part of the default first-release gate until a real Linux arm64 build runner and
|
|
47
|
+
smoke test are selected.
|
|
48
|
+
|
|
49
|
+
## Local Verification
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm test
|
|
53
|
+
npm run pack:dry-run
|
|
54
|
+
ARCHITEC_NPM_REQUIRED_TRIPLETS=linux-x64 npm run release-assets:check
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The dispatcher smoke test uses a local file URL fixture and does not contact
|
|
58
|
+
GitHub. `release-assets:check` contacts GitHub and fails until the matching
|
|
59
|
+
GitHub Release binary assets and checksum file exist.
|
|
51
60
|
|
|
52
61
|
## Trusted Publishing
|
|
53
62
|
|
|
54
|
-
|
|
63
|
+
Configure npm Trusted Publishing for the existing package:
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
Provider: GitHub Actions
|
|
67
|
+
Organization or user: SeemSeam
|
|
68
|
+
Repository: architec
|
|
69
|
+
Workflow filename: npm.yml
|
|
70
|
+
Environment name: <blank>
|
|
71
|
+
Allowed actions: npm publish
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The workflow must exist at `.github/workflows/npm.yml`, use a GitHub-hosted
|
|
75
|
+
runner, use Node 24 with npm 11.5.1 or newer, set `permissions:
|
|
76
|
+
id-token: write`, and publish without `NODE_AUTH_TOKEN`.
|
|
55
77
|
|
|
56
|
-
|
|
57
|
-
- Organization or user: `SeemSeam`
|
|
58
|
-
- Repository: `architec`
|
|
59
|
-
- Workflow filename: `release.yml`
|
|
60
|
-
- Environment: blank unless the npm job uses a GitHub environment
|
|
61
|
-
- Allowed actions: `npm publish`, or `npm stage publish` if staged publishing is
|
|
62
|
-
preferred
|
|
78
|
+
## Release Order
|
|
63
79
|
|
|
64
|
-
|
|
65
|
-
|
|
80
|
+
1. Publish `architec` to PyPI.
|
|
81
|
+
2. Build standalone `archi` binaries from the released PyPI package set.
|
|
82
|
+
3. Upload binaries and `archi-v<version>-checksums.txt` to the matching GitHub
|
|
83
|
+
Release.
|
|
84
|
+
4. Verify `npm test`, `npm pack --dry-run`, and `release-assets:check`.
|
|
85
|
+
5. Publish `@seemseam/architec@<version>` through npm Trusted Publishing.
|