@rosenfan/matrix 0.1.4 → 0.1.5
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/LICENSE +21 -21
- package/README.md +29 -29
- package/README.zh-CN.md +27 -27
- package/{.claude → assets}/skills/matrix/SKILL.md +78 -78
- package/{.claude → assets}/skills/matrix/agents/openai.yaml +4 -4
- package/{.claude → assets}/skills/matrix/scripts/matrix_claude.py +11 -11
- package/{.claude → assets}/skills/matrix/scripts/matrix_state.py +49 -49
- package/assets/skills/matrix/scripts/test_matrix_claude.py +69 -0
- package/assets/skills/matrix/scripts/test_matrix_state.py +69 -0
- package/{.claude → assets}/skills/matrix-archive/SKILL.md +36 -36
- package/{.claude/skills/matrix-hotfix → assets/skills/matrix-archive}/agents/openai.yaml +4 -4
- package/{.claude → assets}/skills/matrix-build/SKILL.md +41 -41
- package/{.claude/skills/matrix-archive → assets/skills/matrix-build}/agents/openai.yaml +4 -4
- package/{.claude → assets}/skills/matrix-claude/SKILL.md +98 -98
- package/{.claude → assets}/skills/matrix-claude/agents/openai.yaml +4 -4
- package/{.claude → assets}/skills/matrix-design/SKILL.md +65 -65
- package/{.claude → assets}/skills/matrix-design/agents/openai.yaml +4 -4
- package/{.claude → assets}/skills/matrix-hotfix/SKILL.md +8 -8
- package/{.claude/skills/matrix-build → assets/skills/matrix-hotfix}/agents/openai.yaml +4 -4
- package/{.claude → assets}/skills/matrix-open/SKILL.md +39 -39
- package/assets/skills/matrix-open/agents/openai.yaml +4 -0
- package/{.claude → assets}/skills/matrix-status/SKILL.md +15 -15
- package/{.claude → assets}/skills/matrix-status/agents/openai.yaml +4 -4
- package/{.claude → assets}/skills/matrix-tweak/SKILL.md +8 -8
- package/assets/skills/matrix-tweak/agents/openai.yaml +4 -0
- package/{.claude → assets}/skills/matrix-verify/SKILL.md +62 -62
- package/assets/skills/matrix-verify/agents/openai.yaml +4 -0
- package/assets/skills-zh-CN/matrix/SKILL.md +14 -14
- package/assets/skills-zh-CN/matrix-build/SKILL.md +4 -4
- package/assets/skills-zh-CN/matrix-design/SKILL.md +4 -4
- package/assets/skills-zh-CN/matrix-open/SKILL.md +3 -3
- package/assets/skills-zh-CN/matrix-verify/SKILL.md +19 -19
- package/bin/matrix.js +15 -15
- package/package.json +4 -13
- package/src/catalog.js +79 -72
- package/src/cli.js +100 -100
- package/src/distribution.js +181 -178
- package/src/installer.js +10 -10
- package/src/matt-catalog.mjs +1 -1
- package/src/matt.js +115 -115
- package/src/messages.js +14 -14
- package/src/runtime-resolver.js +76 -76
- package/src/self-update.js +81 -81
- package/src/workflow-transaction.js +13 -13
- package/src/workflow.js +711 -705
- package/.claude/skills/matrix-open/agents/openai.yaml +0 -4
- package/.claude/skills/matrix-tweak/agents/openai.yaml +0 -4
- package/.claude/skills/matrix-verify/agents/openai.yaml +0 -4
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Rosen
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rosen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -93,10 +93,10 @@ matrix init
|
|
|
93
93
|
|
|
94
94
|
The interactive setup lets you:
|
|
95
95
|
|
|
96
|
-
- Choose English or Chinese, project or global Matrix discovery scope, and Claude Code, Codex, or both
|
|
96
|
+
- Choose English or Chinese, project or global Matrix discovery scope, and Claude Code, Codex, or both
|
|
97
97
|
- Copy skills (recommended) or symlink them for local development
|
|
98
98
|
- Safely reconfigure an existing installation with an automatic backup
|
|
99
|
-
- Review all 25 official Matt Skills v1.2.3 roles and install the 23 compatible Skills into the target project
|
|
99
|
+
- Review all 25 official Matt Skills v1.2.3 roles and install the 23 compatible Skills into the target project
|
|
100
100
|
- Choose **Prim** or **Arch** as the project default without disabling the other available mode
|
|
101
101
|
|
|
102
102
|
For automation and CI:
|
|
@@ -105,17 +105,17 @@ For automation and CI:
|
|
|
105
105
|
# Safe non-interactive installation for both verified platforms
|
|
106
106
|
matrix init --yes --platform claude-code --platform codex --with-mattpocock
|
|
107
107
|
|
|
108
|
-
# Explicitly select the project default
|
|
109
|
-
matrix init --yes --with-mattpocock --default-orchestration arch
|
|
110
|
-
|
|
111
|
-
# Replace locally modified Matt Skills only after an explicit backup authorization
|
|
112
|
-
matrix init --yes --with-mattpocock --force-matt
|
|
108
|
+
# Explicitly select the project default
|
|
109
|
+
matrix init --yes --with-mattpocock --default-orchestration arch
|
|
110
|
+
|
|
111
|
+
# Replace locally modified Matt Skills only after an explicit backup authorization
|
|
112
|
+
matrix init --yes --with-mattpocock --force-matt
|
|
113
113
|
|
|
114
114
|
# Preview exactly what would change (including backups) without writing
|
|
115
115
|
matrix init --platform codex --dry-run --json
|
|
116
116
|
|
|
117
|
-
# Inspect Matrix ownership, project-local Matt compatibility, and the selected platform
|
|
118
|
-
matrix doctor --platform codex
|
|
117
|
+
# Inspect Matrix ownership, project-local Matt compatibility, and the selected platform
|
|
118
|
+
matrix doctor --platform codex
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
Update an initialized project:
|
|
@@ -131,9 +131,9 @@ matrix update --skip-self-update
|
|
|
131
131
|
matrix update --yes
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
`matrix update` preserves the installation's scope, platforms, language, mode, and orchestration. It first validates a newer npm package in isolation, then re-runs the new CLI to refresh Matrix assets. It never downloads, installs, repairs, or deletes Matt Skills; after the Matrix update it reports the local Matt compatibility status and, when needed, points to `matrix init . --with-mattpocock`. npm and project assets are separate transactions: if asset refresh fails after a CLI upgrade, run `matrix update --skip-self-update` to retry.
|
|
135
|
-
|
|
136
|
-
Matrix 0.1.
|
|
134
|
+
`matrix update` preserves the installation's scope, platforms, language, mode, and orchestration. It first validates a newer npm package in isolation, then re-runs the new CLI to refresh Matrix assets. It never downloads, installs, repairs, or deletes Matt Skills; after the Matrix update it reports the local Matt compatibility status and, when needed, points to `matrix init . --with-mattpocock`. npm and project assets are separate transactions: if asset refresh fails after a CLI upgrade, run `matrix update --skip-self-update` to retry.
|
|
135
|
+
|
|
136
|
+
Matrix 0.1.5 is bound to Matt Skills v1.2.3 at commit `6acc160e4e0cd062dbbbd7a1b26ae92855edf07e`. `matrix init --with-mattpocock` always uses that exact archive and its reviewed 23-Skill compatible manifest, even if upstream has a newer release. The two official but incompatible Skills, `implement` and raw `resolving-merge-conflicts`, are not Matrix-managed or installed. Matrix scope controls Matrix Skill discovery only: Matt Skills and `.matrix/matt-installation.json` are always project-local. Global Matt copies are preserved but never used to complete project readiness.
|
|
137
137
|
|
|
138
138
|
The language selected by `matrix init` controls the prose in new Matrix artifacts. Markdown headings required by Matrix guards remain stable English tokens; the artifact body is Chinese for `zh-CN` and English for `en`. A change freezes this language at creation time.
|
|
139
139
|
|
|
@@ -179,9 +179,9 @@ Matrix will:
|
|
|
179
179
|
| Phase | Arch capabilities (triggered, not a fixed sequence) | Deliverables | Guard Condition |
|
|
180
180
|
|-------|------------------------------------------------------|--------------|-----------------|
|
|
181
181
|
| **open** | `/grilling`, `/domain-modeling` | `proposal.md`; optional repository-standard context/ADR evidence | Goal, Scope, Non-goals, Acceptance, Risks present |
|
|
182
|
-
| **design** | `/domain-modeling`, `/research`, `/prototype`, `/codebase-design`, conditional `/writing-for-agents` | `design.md`, `plan.md` | Decisions, Test seams, Steps documented |
|
|
183
|
-
| **build** | `/tdd`, `/diagnosing-bugs`, conditional `/writing-for-agents` and generate-only `/wizard` | Code, `verification.md` | Exact approved Contract matches; build evidence recorded |
|
|
184
|
-
| **verify** | `/code-review` | Test evidence, two-axis review, Arch receipt | Evidence is substantive; Arch receipt matches the current Contract, review, and workspace |
|
|
182
|
+
| **design** | `/domain-modeling`, `/research`, `/prototype`, `/codebase-design`, conditional `/writing-for-agents` | `design.md`, `plan.md` | Decisions, Test seams, Steps documented |
|
|
183
|
+
| **build** | `/tdd`, `/diagnosing-bugs`, conditional `/writing-for-agents` and generate-only `/wizard` | Code, `verification.md` | Exact approved Contract matches; build evidence recorded |
|
|
184
|
+
| **verify** | `/code-review` | Test evidence, two-axis review, Arch receipt | Evidence is substantive; Arch receipt matches the current Contract, review, and workspace |
|
|
185
185
|
| **archive** | None; Matrix-owned in both modes | Archive record | Verify guard passed |
|
|
186
186
|
|
|
187
187
|
---
|
|
@@ -285,26 +285,26 @@ The sidecar does NOT change Matrix state. It's a pure export — like taking a s
|
|
|
285
285
|
|
|
286
286
|
## Integration with Matt Pocock's Skills
|
|
287
287
|
|
|
288
|
-
Prim uses Matrix's own capability. Matrix reviews all 25 official Matt v1.2.3 roles, installs the 23 compatible Skills, and lets Arch automatically invoke only this reviewed ten-capability cohort:
|
|
288
|
+
Prim uses Matrix's own capability. Matrix reviews all 25 official Matt v1.2.3 roles, installs the 23 compatible Skills, and lets Arch automatically invoke only this reviewed ten-capability cohort:
|
|
289
289
|
|
|
290
290
|
| Phase | Capability | Trigger |
|
|
291
291
|
|---|---|---|
|
|
292
292
|
| open | `/grilling` | Material ambiguity or explicit stress-test request |
|
|
293
293
|
| open/design | `/domain-modeling` | Unclear vocabulary, invariants, or architectural decisions |
|
|
294
294
|
| design | `/research` | Required external facts are unavailable in the repository |
|
|
295
|
-
| design | `/prototype` | A material design question needs disposable evidence |
|
|
296
|
-
| design | `/codebase-design` | A deep-module, interface, or test-seam decision remains |
|
|
297
|
-
| design/build | `/writing-for-agents` | The Contract changes agent-facing instructions or pointer-reached documents |
|
|
298
|
-
| build | `/tdd` | Observable behavior changes at a testable seam |
|
|
299
|
-
| build | `/diagnosing-bugs` | An actual failure exists and root cause is unknown |
|
|
300
|
-
| build | `/wizard` | The Contract requires generated human-run shell steps; Matrix never runs them end-to-end |
|
|
301
|
-
| verify | `/code-review` | Standards and Spec review evidence is required |
|
|
302
|
-
|
|
303
|
-
Matrix may recommend but never nest these user-invoked handoffs: `setup-matt-pocock-skills`, `improve-codebase-architecture`, `wayfinder`, `handoff`, and `to-questionnaire`. The user explicitly runs them outside the active phase; selected output may enter a governed Change.
|
|
304
|
-
|
|
305
|
-
Arch records a Runtime-managed review receipt after `code-review`, binding its fixed point and committed HEAD diff to the current Contract, review evidence, and workspace. A normal `code-review` receipt requires a clean candidate worktree outside Matrix-managed assets. When Git has no usable baseline, the committed diff is empty, staged/unstaged/untracked candidate files still exist, or the correctly installed capability fails, Matrix may perform one explicitly labelled same-capability fallback for that revision. The `uncommitted-worktree` fallback binds both the fixed point and a content hash of the complete worktree candidate. Installation-integrity failures never fall back. A heading or self-description without the matching receipt cannot advance Verify.
|
|
306
|
-
|
|
307
|
-
Installed standalone Skills are `ask-matt`, `grill-with-docs`, `triage`, `to-spec`, `to-tickets`, `grill-me`, `teach`, and `wait-what`. `implement` and raw `resolving-merge-conflicts` are incompatible because they can take over TDD/review/staging/commit effects owned by Matrix, so 0.1.
|
|
295
|
+
| design | `/prototype` | A material design question needs disposable evidence |
|
|
296
|
+
| design | `/codebase-design` | A deep-module, interface, or test-seam decision remains |
|
|
297
|
+
| design/build | `/writing-for-agents` | The Contract changes agent-facing instructions or pointer-reached documents |
|
|
298
|
+
| build | `/tdd` | Observable behavior changes at a testable seam |
|
|
299
|
+
| build | `/diagnosing-bugs` | An actual failure exists and root cause is unknown |
|
|
300
|
+
| build | `/wizard` | The Contract requires generated human-run shell steps; Matrix never runs them end-to-end |
|
|
301
|
+
| verify | `/code-review` | Standards and Spec review evidence is required |
|
|
302
|
+
|
|
303
|
+
Matrix may recommend but never nest these user-invoked handoffs: `setup-matt-pocock-skills`, `improve-codebase-architecture`, `wayfinder`, `handoff`, and `to-questionnaire`. The user explicitly runs them outside the active phase; selected output may enter a governed Change.
|
|
304
|
+
|
|
305
|
+
Arch records a Runtime-managed review receipt after `code-review`, binding its fixed point and committed HEAD diff to the current Contract, review evidence, and workspace. A normal `code-review` receipt requires a clean candidate worktree outside Matrix-managed assets. When Git has no usable baseline, the committed diff is empty, staged/unstaged/untracked candidate files still exist, or the correctly installed capability fails, Matrix may perform one explicitly labelled same-capability fallback for that revision. The `uncommitted-worktree` fallback binds both the fixed point and a content hash of the complete worktree candidate. Installation-integrity failures never fall back. A heading or self-description without the matching receipt cannot advance Verify.
|
|
306
|
+
|
|
307
|
+
Installed standalone Skills are `ask-matt`, `grill-with-docs`, `triage`, `to-spec`, `to-tickets`, `grill-me`, `teach`, and `wait-what`. `implement` and raw `resolving-merge-conflicts` are incompatible because they can take over TDD/review/staging/commit effects owned by Matrix, so 0.1.5 neither installs nor manages them. Pre-existing copies are preserved and reported as unmanaged extras. Installation never grants automatic invocation, and no companion may transition, commit, archive, recover, or write Matrix state.
|
|
308
308
|
|
|
309
309
|
---
|
|
310
310
|
|
package/README.zh-CN.md
CHANGED
|
@@ -93,10 +93,10 @@ matrix init
|
|
|
93
93
|
|
|
94
94
|
交互式初始化支持:
|
|
95
95
|
|
|
96
|
-
- 选择 Matrix Skill 发现入口安装到当前项目或全局
|
|
96
|
+
- 选择 Matrix Skill 发现入口安装到当前项目或全局
|
|
97
97
|
- 复制 skills(推荐)或为本地开发创建符号链接
|
|
98
98
|
- 安全地重新配置已有安装,并自动备份被替换的 Matrix 文件
|
|
99
|
-
- 审查 Matt Skills v1.2.3 官方 25 项角色,并在目标项目安装其中 23 项兼容 Skill
|
|
99
|
+
- 审查 Matt Skills v1.2.3 官方 25 项角色,并在目标项目安装其中 23 项兼容 Skill
|
|
100
100
|
- 选择 Prim 或 Arch 作为项目默认值,且不禁用另一种可用模式
|
|
101
101
|
|
|
102
102
|
自动化或 CI 环境可以使用:
|
|
@@ -105,11 +105,11 @@ matrix init
|
|
|
105
105
|
# 使用推荐的项目级默认值,不显示交互问题
|
|
106
106
|
matrix init --yes --with-mattpocock
|
|
107
107
|
|
|
108
|
-
# 显式选择项目默认编排
|
|
109
|
-
matrix init --yes --with-mattpocock --default-orchestration arch
|
|
110
|
-
|
|
111
|
-
# 只有明确授权备份后才替换被本地修改的 Matt Skills
|
|
112
|
-
matrix init --yes --with-mattpocock --force-matt
|
|
108
|
+
# 显式选择项目默认编排
|
|
109
|
+
matrix init --yes --with-mattpocock --default-orchestration arch
|
|
110
|
+
|
|
111
|
+
# 只有明确授权备份后才替换被本地修改的 Matt Skills
|
|
112
|
+
matrix init --yes --with-mattpocock --force-matt
|
|
113
113
|
|
|
114
114
|
# 检查安装完整性和运行环境
|
|
115
115
|
matrix doctor
|
|
@@ -128,9 +128,9 @@ matrix update --skip-self-update
|
|
|
128
128
|
matrix update --yes
|
|
129
129
|
```
|
|
130
130
|
|
|
131
|
-
`matrix update` 会保留既有安装的 scope、平台、语言、mode 与 orchestration。它先隔离验证 npm 新包,再由新 CLI 同步 Matrix 资产;它绝不下载、安装、修复或删除 Matt Skills。Matrix 更新完成后只读报告项目 Matt 兼容状态,必要时提示 `matrix init . --with-mattpocock`。npm 与项目资产是两个事务:若 CLI 已更新但资产同步失败,可运行 `matrix update --skip-self-update` 重试。
|
|
132
|
-
|
|
133
|
-
Matrix 0.1.
|
|
131
|
+
`matrix update` 会保留既有安装的 scope、平台、语言、mode 与 orchestration。它先隔离验证 npm 新包,再由新 CLI 同步 Matrix 资产;它绝不下载、安装、修复或删除 Matt Skills。Matrix 更新完成后只读报告项目 Matt 兼容状态,必要时提示 `matrix init . --with-mattpocock`。npm 与项目资产是两个事务:若 CLI 已更新但资产同步失败,可运行 `matrix update --skip-self-update` 重试。
|
|
132
|
+
|
|
133
|
+
Matrix 0.1.5 固定对应 Matt Skills v1.2.3,commit 为 `6acc160e4e0cd062dbbbd7a1b26ae92855edf07e`。即使上游已有新版,`matrix init --with-mattpocock` 仍使用该确切 archive 与经过审查的 23 项兼容 manifest。官方角色中的 `implement` 与 raw `resolving-merge-conflicts` 不兼容,因此 Matrix 不安装也不管理它们。Matrix scope 只控制 Matrix Skill 的发现位置;Matt Skills 与 `.matrix/matt-installation.json` 始终属于目标项目。全局 Matt 副本会保留,但绝不用于补齐项目 readiness。
|
|
134
134
|
|
|
135
135
|
`matrix init` 选择的语言决定新 Matrix 产物的正文语言:`zh-CN` 使用中文、`en` 使用英文。Runtime 守卫依赖的 Markdown 英文标题 token 保持不变;每个 change 在创建时冻结该语言。
|
|
136
136
|
|
|
@@ -176,9 +176,9 @@ Matrix 将会:
|
|
|
176
176
|
| 阶段 | Arch 能力(按事实触发,不是固定序列) | 交付物 | 守卫条件 |
|
|
177
177
|
|------|----------------------------------------|--------|----------|
|
|
178
178
|
| **open** | `/grilling`、`/domain-modeling` | `proposal.md`;可选仓库约定的 context/ADR 证据 | 目标、范围、验收标准、风险存在 |
|
|
179
|
-
| **design** | `/domain-modeling`、`/research`、`/prototype`、`/codebase-design`、条件触发的 `/writing-for-agents` | `design.md`、`plan.md` | 决策、测试点、步骤已记录 |
|
|
180
|
-
| **build** | `/tdd`、`/diagnosing-bugs`、条件触发的 `/writing-for-agents` 与仅生成的 `/wizard` | 代码、`verification.md` | 已批准的精确 Contract 匹配,且已记录构建证据 |
|
|
181
|
-
| **verify** | `/code-review` | 测试证据、双轴审查、Arch 回执 | 证据内容充分;Arch 回执匹配当前 Contract、审查正文和工作区 |
|
|
179
|
+
| **design** | `/domain-modeling`、`/research`、`/prototype`、`/codebase-design`、条件触发的 `/writing-for-agents` | `design.md`、`plan.md` | 决策、测试点、步骤已记录 |
|
|
180
|
+
| **build** | `/tdd`、`/diagnosing-bugs`、条件触发的 `/writing-for-agents` 与仅生成的 `/wizard` | 代码、`verification.md` | 已批准的精确 Contract 匹配,且已记录构建证据 |
|
|
181
|
+
| **verify** | `/code-review` | 测试证据、双轴审查、Arch 回执 | 证据内容充分;Arch 回执匹配当前 Contract、审查正文和工作区 |
|
|
182
182
|
| **archive** | 无;两种模式均由 Matrix 拥有 | 归档记录 | 验证守卫通过 |
|
|
183
183
|
|
|
184
184
|
---
|
|
@@ -282,26 +282,26 @@ $matrix → open → design → build → verify → archive
|
|
|
282
282
|
|
|
283
283
|
## 与 Matt Pocock Skills 的集成
|
|
284
284
|
|
|
285
|
-
Prim 使用 Matrix 自身能力。Matrix 会审查 Matt v1.2.3 官方 25 项角色,安装其中 23 项兼容 Skill,但 Arch 只自动调用以下十项经过审查的能力:
|
|
285
|
+
Prim 使用 Matrix 自身能力。Matrix 会审查 Matt v1.2.3 官方 25 项角色,安装其中 23 项兼容 Skill,但 Arch 只自动调用以下十项经过审查的能力:
|
|
286
286
|
|
|
287
287
|
| 阶段 | 能力 | 触发条件 |
|
|
288
288
|
|---|---|---|
|
|
289
289
|
| open | `/grilling` | 存在重大歧义或用户明确要求压力测试 |
|
|
290
290
|
| open/design | `/domain-modeling` | 词汇、不变量或架构决定不清晰 |
|
|
291
291
|
| design | `/research` | 仓库内无法获得必需的外部事实 |
|
|
292
|
-
| design | `/prototype` | 重大设计问题需要一次性实验证据 |
|
|
293
|
-
| design | `/codebase-design` | 深模块、接口或测试接缝决定尚未完成 |
|
|
294
|
-
| design/build | `/writing-for-agents` | Contract 修改 agent-facing 指令或指针可达文档 |
|
|
295
|
-
| build | `/tdd` | 可测试接缝上的可观察行为发生变化 |
|
|
296
|
-
| build | `/diagnosing-bugs` | 存在真实失败且根因未知 |
|
|
297
|
-
| build | `/wizard` | Contract 需要生成人工执行的 shell 步骤;Matrix 不端到端运行 |
|
|
298
|
-
| verify | `/code-review` | 需要 Standards 与 Spec 双轴证据 |
|
|
299
|
-
|
|
300
|
-
Matrix 可以推荐但绝不嵌套以下 user-invoked handoff:`setup-matt-pocock-skills`、`improve-codebase-architecture`、`wayfinder`、`handoff`、`to-questionnaire`。它们由用户在活动阶段外显式运行,选中的结果可以再进入受治理 Change。
|
|
301
|
-
|
|
302
|
-
Arch 在 `code-review` 后记录由 Runtime 管理的审查回执,把 fixed point 与已提交的 HEAD diff 绑定到当前 Contract、审查正文和工作区。正常的 `code-review` 回执要求 Matrix 管理资产之外的候选工作区是干净的。无可用 Git 基线、已提交 diff 为空、仍存在 staged/unstaged/untracked 候选,或正确安装的 capability 真实失败时,Matrix 可为该 revision 执行一次明确标记的同能力 fallback;其中 `uncommitted-worktree` 会同时绑定 fixed point 与完整工作区候选的内容 hash。安装完整性失败不得 fallback。只有标题或自述、但没有匹配回执时,Verify 不能推进。
|
|
303
|
-
|
|
304
|
-
安装但保持 standalone 的 Skill 是 `ask-matt`、`grill-with-docs`、`triage`、`to-spec`、`to-tickets`、`grill-me`、`teach`、`wait-what`。`implement` 与 raw `resolving-merge-conflicts` 可能接管 Matrix 所有的 TDD、review、stage 或 commit 副作用,因此 0.1.
|
|
292
|
+
| design | `/prototype` | 重大设计问题需要一次性实验证据 |
|
|
293
|
+
| design | `/codebase-design` | 深模块、接口或测试接缝决定尚未完成 |
|
|
294
|
+
| design/build | `/writing-for-agents` | Contract 修改 agent-facing 指令或指针可达文档 |
|
|
295
|
+
| build | `/tdd` | 可测试接缝上的可观察行为发生变化 |
|
|
296
|
+
| build | `/diagnosing-bugs` | 存在真实失败且根因未知 |
|
|
297
|
+
| build | `/wizard` | Contract 需要生成人工执行的 shell 步骤;Matrix 不端到端运行 |
|
|
298
|
+
| verify | `/code-review` | 需要 Standards 与 Spec 双轴证据 |
|
|
299
|
+
|
|
300
|
+
Matrix 可以推荐但绝不嵌套以下 user-invoked handoff:`setup-matt-pocock-skills`、`improve-codebase-architecture`、`wayfinder`、`handoff`、`to-questionnaire`。它们由用户在活动阶段外显式运行,选中的结果可以再进入受治理 Change。
|
|
301
|
+
|
|
302
|
+
Arch 在 `code-review` 后记录由 Runtime 管理的审查回执,把 fixed point 与已提交的 HEAD diff 绑定到当前 Contract、审查正文和工作区。正常的 `code-review` 回执要求 Matrix 管理资产之外的候选工作区是干净的。无可用 Git 基线、已提交 diff 为空、仍存在 staged/unstaged/untracked 候选,或正确安装的 capability 真实失败时,Matrix 可为该 revision 执行一次明确标记的同能力 fallback;其中 `uncommitted-worktree` 会同时绑定 fixed point 与完整工作区候选的内容 hash。安装完整性失败不得 fallback。只有标题或自述、但没有匹配回执时,Verify 不能推进。
|
|
303
|
+
|
|
304
|
+
安装但保持 standalone 的 Skill 是 `ask-matt`、`grill-with-docs`、`triage`、`to-spec`、`to-tickets`、`grill-me`、`teach`、`wait-what`。`implement` 与 raw `resolving-merge-conflicts` 可能接管 Matrix 所有的 TDD、review、stage 或 commit 副作用,因此 0.1.5 不安装也不管理它们;已有副本会被保留并报告为未管理额外项。安装不代表自动调用;任何 companion 都不得推进、提交、归档、恢复或写 Matrix 状态。
|
|
305
305
|
|
|
306
306
|
---
|
|
307
307
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: matrix
|
|
3
|
-
description: Route, initialize, resume, and govern a persistent Matrix development workflow. Use when the user starts a feature, change, bug fix, or asks to resume managed development.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Matrix
|
|
7
|
-
|
|
8
|
-
Use Matrix as the development-workflow entrypoint. Its source of truth is the current repository's `.matrix/`; never infer a phase from chat history.
|
|
9
|
-
|
|
10
|
-
Read `artifact_language` from `node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect`. Keep required Markdown heading tokens unchanged, but write every user-facing artifact body, explanation, and handoff in that language: English for `en`, Chinese for `zh-CN`.
|
|
11
|
-
|
|
12
|
-
## Route
|
|
13
|
-
|
|
1
|
+
---
|
|
2
|
+
name: matrix
|
|
3
|
+
description: Route, initialize, resume, and govern a persistent Matrix development workflow. Use when the user starts a feature, change, bug fix, or asks to resume managed development.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Matrix
|
|
7
|
+
|
|
8
|
+
Use Matrix as the development-workflow entrypoint. Its source of truth is the current repository's `.matrix/`; never infer a phase from chat history.
|
|
9
|
+
|
|
10
|
+
Read `artifact_language` from `node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect`. Keep required Markdown heading tokens unchanged, but write every user-facing artifact body, explanation, and handoff in that language: English for `en`, Chinese for `zh-CN`.
|
|
11
|
+
|
|
12
|
+
## Route
|
|
13
|
+
|
|
14
14
|
For every workflow command, run the Runtime bundled with this project Skill so the project compatibility authority wins over a different global launcher:
|
|
15
15
|
|
|
16
16
|
```powershell
|
|
@@ -18,70 +18,70 @@ node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect
|
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
Use the global `matrix` command for `init`, `update`, and bootstrap only. A trusted 0.1.4 launcher auto-delegates only to an exact, hash-verified 0.1.4 project Runtime. A different or unidentified project release remains authoritative but must be invoked through the exact direct command returned by the launcher. Older launchers cannot provide this cross-release check and must not be used as the project workflow entrypoint.
|
|
21
|
-
|
|
22
|
-
- If an active change exists, show its phase and frozen `orchestration`, report any Arch installation-integrity failure, and enter the returned `next_skill` only when the Runtime permits continuation.
|
|
23
|
-
- If no active change exists, classify the request: reproducible small bug → `$matrix-hotfix` with workflow `hotfix`; bounded small change with no public API/schema/architecture impact → `$matrix-tweak` with workflow `tweak`; otherwise full Matrix with workflow `full`.
|
|
24
|
-
- Do not create Matrix state for questions, read-only investigation, or requests outside software development.
|
|
25
|
-
- Before `init`, derive a short kebab-case change id and an accurate title. Start with `full` unless a shortcut clearly applies.
|
|
26
|
-
|
|
27
|
-
```powershell
|
|
28
|
-
node <matrix-skill-directory>/scripts/matrix-runtime.mjs init <change-id> --workflow <full|hotfix|tweak> --orchestration <prim|arch> --title "<title>"
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
An explicit mode wins; otherwise Runtime uses the project `default_orchestration`. The resolved value is immutable for the change and is shown in init, inspect, and the initialized Event. Then enter `$matrix-open`.
|
|
32
|
-
|
|
33
|
-
## Orchestration
|
|
34
|
-
|
|
35
|
-
- **Prim** uses Matrix's own capability in every phase and never requires Matt Skills.
|
|
21
|
+
|
|
22
|
+
- If an active change exists, show its phase and frozen `orchestration`, report any Arch installation-integrity failure, and enter the returned `next_skill` only when the Runtime permits continuation.
|
|
23
|
+
- If no active change exists, classify the request: reproducible small bug → `$matrix-hotfix` with workflow `hotfix`; bounded small change with no public API/schema/architecture impact → `$matrix-tweak` with workflow `tweak`; otherwise full Matrix with workflow `full`.
|
|
24
|
+
- Do not create Matrix state for questions, read-only investigation, or requests outside software development.
|
|
25
|
+
- Before `init`, derive a short kebab-case change id and an accurate title. Start with `full` unless a shortcut clearly applies.
|
|
26
|
+
|
|
27
|
+
```powershell
|
|
28
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs init <change-id> --workflow <full|hotfix|tweak> --orchestration <prim|arch> --title "<title>"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
An explicit mode wins; otherwise Runtime uses the project `default_orchestration`. The resolved value is immutable for the change and is shown in init, inspect, and the initialized Event. Then enter `$matrix-open`.
|
|
32
|
+
|
|
33
|
+
## Orchestration
|
|
34
|
+
|
|
35
|
+
- **Prim** uses Matrix's own capability in every phase and never requires Matt Skills.
|
|
36
36
|
- **Arch** conditionally invokes the ten reviewed automatic capabilities frozen by the active Change. Matrix 0.1.4 reviews all 25 official Matt Skills v1.2.3 roles and installs only the 23 compatible Skills project-locally; `implement` and raw `resolving-merge-conflicts` are excluded.
|
|
37
|
-
|
|
38
|
-
Both orchestration modes use the same selected workflow profile. `full` uses `open → design → build → verify → archive`; `hotfix` and `tweak` share one internal `lightweight` profile, `open → build → verify → archive`, with different evidence policies. Companion Skills never write Matrix state, transition, commit, archive, or create competing workflow artifacts.
|
|
39
|
-
|
|
40
|
-
A correctly installed Arch capability that fails gets at most one Matrix-owned fallback for the same bounded capability, with failure and evidence recorded. A missing, modified, or incomplete Arch installation must be repaired with `matrix init --with-mattpocock`; never switch the active change to Prim.
|
|
41
|
-
|
|
42
|
-
## Recovery
|
|
43
|
-
|
|
44
|
-
Use Runtime commands instead of editing Matrix state:
|
|
45
|
-
|
|
46
|
-
```powershell
|
|
47
|
-
node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason design-gap
|
|
48
|
-
node <matrix-skill-directory>/scripts/matrix-runtime.mjs return build --reason verification-failed
|
|
49
|
-
node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason acceptance-or-design-gap
|
|
50
|
-
node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason acceptance-or-design-gap # from Archive, before terminal archive
|
|
51
|
-
node <matrix-skill-directory>/scripts/matrix-runtime.mjs abort --reason <requirement-cancelled|superseded|no-longer-valuable|blocked|other>
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Return preserves the change but moves the current `verification.md` into revisioned evidence history, so the returned phase must produce fresh current evidence. Abort preserves the last phase and moves the terminal change into `.matrix/archive/`; it never undoes worktree changes.
|
|
55
|
-
|
|
56
|
-
If any mutation reports `WORKFLOW_RECOVERY_REQUIRED`, stop normal phase work and run the read-only diagnosis:
|
|
57
|
-
|
|
58
|
-
```powershell
|
|
59
|
-
node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Never infer a repair target or strategy. Use only the exact command returned by doctor:
|
|
63
|
-
|
|
64
|
-
```powershell
|
|
65
|
-
node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor --repair --transaction <id> --strategy <continue|rollback>
|
|
66
|
-
node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor --repair --lock <id>
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Optional Claude handoff
|
|
70
|
-
|
|
71
|
-
`$matrix-claude` is an optional sidecar command used after the approved Design -> Build transition. It exports the matching approved contract to a Claude Code task package. It never changes the Matrix phase, workflow, guard result, or runtime state.
|
|
72
|
-
Use it only when the user explicitly chooses Codex design with Claude Code implementation; never inject it into the standard path.
|
|
73
|
-
|
|
74
|
-
## Cross-Cutting Skills
|
|
75
|
-
|
|
37
|
+
|
|
38
|
+
Both orchestration modes use the same selected workflow profile. `full` uses `open → design → build → verify → archive`; `hotfix` and `tweak` share one internal `lightweight` profile, `open → build → verify → archive`, with different evidence policies. Companion Skills never write Matrix state, transition, commit, archive, or create competing workflow artifacts.
|
|
39
|
+
|
|
40
|
+
A correctly installed Arch capability that fails gets at most one Matrix-owned fallback for the same bounded capability, with failure and evidence recorded. A missing, modified, or incomplete Arch installation must be repaired with `matrix init --with-mattpocock`; never switch the active change to Prim.
|
|
41
|
+
|
|
42
|
+
## Recovery
|
|
43
|
+
|
|
44
|
+
Use Runtime commands instead of editing Matrix state:
|
|
45
|
+
|
|
46
|
+
```powershell
|
|
47
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason design-gap
|
|
48
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs return build --reason verification-failed
|
|
49
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason acceptance-or-design-gap
|
|
50
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason acceptance-or-design-gap # from Archive, before terminal archive
|
|
51
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs abort --reason <requirement-cancelled|superseded|no-longer-valuable|blocked|other>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Return preserves the change but moves the current `verification.md` into revisioned evidence history, so the returned phase must produce fresh current evidence. Abort preserves the last phase and moves the terminal change into `.matrix/archive/`; it never undoes worktree changes.
|
|
55
|
+
|
|
56
|
+
If any mutation reports `WORKFLOW_RECOVERY_REQUIRED`, stop normal phase work and run the read-only diagnosis:
|
|
57
|
+
|
|
58
|
+
```powershell
|
|
59
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Never infer a repair target or strategy. Use only the exact command returned by doctor:
|
|
63
|
+
|
|
64
|
+
```powershell
|
|
65
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor --repair --transaction <id> --strategy <continue|rollback>
|
|
66
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor --repair --lock <id>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Optional Claude handoff
|
|
70
|
+
|
|
71
|
+
`$matrix-claude` is an optional sidecar command used after the approved Design -> Build transition. It exports the matching approved contract to a Claude Code task package. It never changes the Matrix phase, workflow, guard result, or runtime state.
|
|
72
|
+
Use it only when the user explicitly chooses Codex design with Claude Code implementation; never inject it into the standard path.
|
|
73
|
+
|
|
74
|
+
## Cross-Cutting Skills
|
|
75
|
+
|
|
76
76
|
Matrix never nests user-invoked Matt Skills. When relevant, explain the reason and ask the user to invoke one explicitly: `setup-matt-pocock-skills` for one-time setup, `improve-codebase-architecture` for an out-of-band scan, `wayfinder` for generating a separate large-effort candidate, `handoff` at a context boundary, or `to-questionnaire` when another person owns blocking facts. `ask-matt`, `grill-with-docs`, `triage`, `to-spec`, `to-tickets`, `grill-me`, `teach`, and `wait-what` remain standalone. Matrix does not install or manage `implement` or raw `resolving-merge-conflicts`; preserve pre-existing copies as unmanaged extras and never suggest them inside an active Change.
|
|
77
|
-
|
|
78
|
-
## Rules
|
|
79
|
-
|
|
80
|
-
- A phase can advance only through `node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition`; run its guard first.
|
|
81
|
-
- A phase can move backward only through one of the documented `node <matrix-skill-directory>/scripts/matrix-runtime.mjs return` intents.
|
|
82
|
-
- Full Build approval binds proposal, design, and plan. Lightweight Build approval binds its compact proposal, requires `transition build --confirmed`, and rejects project implementation changes made after initialization but before approval.
|
|
83
|
-
- A successful Archive is always a two-step optimistic commit: run `node <matrix-skill-directory>/scripts/matrix-runtime.mjs archive --dry-run`, then pass its exact hash to `node <matrix-skill-directory>/scripts/matrix-runtime.mjs archive --expect-preflight <sha256>`. Never bypass the preflight.
|
|
84
|
-
- `node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor` is read-only. Every transaction or stale-lock repair must explicitly bind the identity reported by doctor; do not edit or delete `.matrix/transactions/` or `.matrix/workflow.lock`.
|
|
85
|
-
- Do not replace required evidence with an assertion that work is complete.
|
|
86
|
-
- Pause for user confirmation at material architecture/scope decisions and before archive/commit.
|
|
87
|
-
- On shortcut scope expansion, run `node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason design-gap`; Runtime upgrades the change to `full`. Never silently continue the old contract.
|
|
77
|
+
|
|
78
|
+
## Rules
|
|
79
|
+
|
|
80
|
+
- A phase can advance only through `node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition`; run its guard first.
|
|
81
|
+
- A phase can move backward only through one of the documented `node <matrix-skill-directory>/scripts/matrix-runtime.mjs return` intents.
|
|
82
|
+
- Full Build approval binds proposal, design, and plan. Lightweight Build approval binds its compact proposal, requires `transition build --confirmed`, and rejects project implementation changes made after initialization but before approval.
|
|
83
|
+
- A successful Archive is always a two-step optimistic commit: run `node <matrix-skill-directory>/scripts/matrix-runtime.mjs archive --dry-run`, then pass its exact hash to `node <matrix-skill-directory>/scripts/matrix-runtime.mjs archive --expect-preflight <sha256>`. Never bypass the preflight.
|
|
84
|
+
- `node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor` is read-only. Every transaction or stale-lock repair must explicitly bind the identity reported by doctor; do not edit or delete `.matrix/transactions/` or `.matrix/workflow.lock`.
|
|
85
|
+
- Do not replace required evidence with an assertion that work is complete.
|
|
86
|
+
- Pause for user confirmation at material architecture/scope decisions and before archive/commit.
|
|
87
|
+
- On shortcut scope expansion, run `node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason design-gap`; Runtime upgrades the change to `full`. Never silently continue the old contract.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface:
|
|
2
|
-
display_name: "Matrix"
|
|
3
|
-
short_description: "Route, resume, and govern development changes"
|
|
4
|
-
default_prompt: "Use $matrix to start or resume a development change."
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "Matrix"
|
|
3
|
+
short_description: "Route, resume, and govern development changes"
|
|
4
|
+
default_prompt: "Use $matrix to start or resume a development change."
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""Compatibility adapter for the authoritative Node workflow exporter."""
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import sys
|
|
6
|
-
|
|
7
|
-
from matrix_state import run_runtime
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if __name__ == "__main__":
|
|
11
|
-
raise SystemExit(run_runtime(sys.argv[1:]))
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Compatibility adapter for the authoritative Node workflow exporter."""
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
from matrix_state import run_runtime
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
if __name__ == "__main__":
|
|
11
|
+
raise SystemExit(run_runtime(sys.argv[1:]))
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""Compatibility adapter for the authoritative Node Workflow Runtime."""
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import os
|
|
6
|
-
import shutil
|
|
7
|
-
import subprocess
|
|
8
|
-
import sys
|
|
9
|
-
from pathlib import Path
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def development_runtime() -> Path | None:
|
|
13
|
-
"""Return an explicitly selected source runtime for repository tests only."""
|
|
14
|
-
configured = os.environ.get("MATRIX_DEVELOPMENT_RUNTIME")
|
|
15
|
-
return Path(configured).resolve() if configured else None
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def primary_runtime() -> str | None:
|
|
19
|
-
if os.name == "nt":
|
|
20
|
-
return shutil.which("matrix.cmd") or shutil.which("matrix.exe")
|
|
21
|
-
return shutil.which("matrix")
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Compatibility adapter for the authoritative Node Workflow Runtime."""
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import shutil
|
|
7
|
+
import subprocess
|
|
8
|
+
import sys
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def development_runtime() -> Path | None:
|
|
13
|
+
"""Return an explicitly selected source runtime for repository tests only."""
|
|
14
|
+
configured = os.environ.get("MATRIX_DEVELOPMENT_RUNTIME")
|
|
15
|
+
return Path(configured).resolve() if configured else None
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def primary_runtime() -> str | None:
|
|
19
|
+
if os.name == "nt":
|
|
20
|
+
return shutil.which("matrix.cmd") or shutil.which("matrix.exe")
|
|
21
|
+
return shutil.which("matrix")
|
|
22
|
+
|
|
23
|
+
|
|
24
24
|
def runtime_command(args: list[str]) -> list[str]:
|
|
25
25
|
development = development_runtime()
|
|
26
26
|
if development is not None:
|
|
27
|
-
if not development.is_file():
|
|
28
|
-
raise RuntimeError(f"Configured Matrix development runtime was not found: {development}")
|
|
29
|
-
node = shutil.which("node")
|
|
30
|
-
if node is None:
|
|
31
|
-
raise RuntimeError("Node.js is required to run the Matrix workflow.")
|
|
32
|
-
return [node, str(development), *args]
|
|
33
|
-
|
|
34
|
-
bundled = Path(__file__).with_name("matrix-runtime.mjs")
|
|
35
|
-
node = shutil.which("node")
|
|
27
|
+
if not development.is_file():
|
|
28
|
+
raise RuntimeError(f"Configured Matrix development runtime was not found: {development}")
|
|
29
|
+
node = shutil.which("node")
|
|
30
|
+
if node is None:
|
|
31
|
+
raise RuntimeError("Node.js is required to run the Matrix workflow.")
|
|
32
|
+
return [node, str(development), *args]
|
|
33
|
+
|
|
34
|
+
bundled = Path(__file__).with_name("matrix-runtime.mjs")
|
|
35
|
+
node = shutil.which("node")
|
|
36
36
|
if node is not None and bundled.exists():
|
|
37
37
|
return [node, str(bundled), *args]
|
|
38
38
|
|
|
@@ -41,20 +41,20 @@ def runtime_command(args: list[str]) -> list[str]:
|
|
|
41
41
|
return [primary, "workflow", *args, "--json"]
|
|
42
42
|
|
|
43
43
|
raise RuntimeError("Matrix CLI is absent and the bundled workflow runtime was not found.")
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def run_runtime(args: list[str]) -> int:
|
|
47
|
-
try:
|
|
48
|
-
completed = subprocess.run(runtime_command(args), cwd=Path.cwd(), check=False)
|
|
49
|
-
except (OSError, RuntimeError) as error:
|
|
50
|
-
print(f"MATRIX ERROR [RUNTIME_UNAVAILABLE]: {error}", file=sys.stderr)
|
|
51
|
-
return 2
|
|
52
|
-
return completed.returncode
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def main() -> int:
|
|
56
|
-
return run_runtime(sys.argv[1:])
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if __name__ == "__main__":
|
|
60
|
-
raise SystemExit(main())
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def run_runtime(args: list[str]) -> int:
|
|
47
|
+
try:
|
|
48
|
+
completed = subprocess.run(runtime_command(args), cwd=Path.cwd(), check=False)
|
|
49
|
+
except (OSError, RuntimeError) as error:
|
|
50
|
+
print(f"MATRIX ERROR [RUNTIME_UNAVAILABLE]: {error}", file=sys.stderr)
|
|
51
|
+
return 2
|
|
52
|
+
return completed.returncode
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def main() -> int:
|
|
56
|
+
return run_runtime(sys.argv[1:])
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
if __name__ == "__main__":
|
|
60
|
+
raise SystemExit(main())
|