@rosenfan/matrix 0.1.2 → 0.1.4
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/.claude/skills/matrix/SKILL.md +59 -62
- package/.claude/skills/matrix/scripts/matrix_claude.py +11 -11
- package/.claude/skills/matrix/scripts/matrix_state.py +53 -53
- package/.claude/skills/matrix-archive/SKILL.md +36 -33
- package/.claude/skills/matrix-build/SKILL.md +28 -23
- package/.claude/skills/matrix-claude/SKILL.md +13 -11
- package/.claude/skills/matrix-design/SKILL.md +32 -26
- package/.claude/skills/matrix-hotfix/SKILL.md +1 -1
- package/.claude/skills/matrix-open/SKILL.md +27 -15
- package/.claude/skills/matrix-status/SKILL.md +5 -5
- package/.claude/skills/matrix-tweak/SKILL.md +1 -1
- package/.claude/skills/matrix-verify/SKILL.md +35 -17
- package/README.md +131 -96
- package/README.zh-CN.md +127 -92
- package/assets/skills-zh-CN/matrix/SKILL.md +75 -72
- package/assets/skills-zh-CN/matrix-archive/SKILL.md +36 -33
- package/assets/skills-zh-CN/matrix-build/SKILL.md +41 -37
- package/assets/skills-zh-CN/matrix-claude/SKILL.md +33 -31
- package/assets/skills-zh-CN/matrix-design/SKILL.md +13 -7
- package/assets/skills-zh-CN/matrix-hotfix/SKILL.md +1 -1
- package/assets/skills-zh-CN/matrix-open/SKILL.md +18 -6
- package/assets/skills-zh-CN/matrix-status/SKILL.md +5 -5
- package/assets/skills-zh-CN/matrix-tweak/SKILL.md +1 -1
- package/assets/skills-zh-CN/matrix-verify/SKILL.md +27 -9
- package/package.json +2 -2
- package/src/catalog.js +29 -18
- package/src/cli.js +150 -39
- package/src/distribution.js +268 -114
- package/src/installer.js +10 -10
- package/src/matt-catalog.mjs +67 -0
- package/src/matt.js +115 -33
- package/src/messages.js +18 -14
- package/src/runtime-resolver.js +76 -0
- package/src/self-update.js +81 -0
- package/src/ui.js +1 -1
- package/src/workflow-transaction.js +622 -618
- package/src/workflow.js +949 -464
|
@@ -1,37 +1,41 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: matrix-build
|
|
3
|
-
description: 用测试优先的纵向切片实现冻结的 Matrix 计划。仅在活动 Matrix 阶段为 build 时使用。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Matrix Build
|
|
7
|
-
|
|
8
|
-
读取 `matrix
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
---
|
|
2
|
+
name: matrix-build
|
|
3
|
+
description: 用测试优先的纵向切片实现冻结的 Matrix 计划。仅在活动 Matrix 阶段为 build 时使用。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Matrix Build
|
|
7
|
+
|
|
8
|
+
读取 `node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect` 与已批准 Contract。full/legacy-full 读取 proposal/design/plan;lightweight 只读取紧凑 proposal,不补写 Design 产物。
|
|
9
|
+
|
|
10
|
+
Build 证据与面向用户的说明使用 `artifact_language`;Runtime 所需英文标题 token 保持不变。
|
|
11
|
+
|
|
12
|
+
## 编排
|
|
13
|
+
|
|
14
|
+
- **Prim**:使用 Matrix 自身实现与测试能力。
|
|
15
|
+
- **Arch**:可测试行为变化时调用 `tdd`;真实失败且根因未知时调用 `diagnosing-bugs`;批准 Contract 修改 agent-facing 指令时调用 `writing-for-agents`;只有 Contract 需要人工执行 shell 步骤时,才用 `wizard` 生成并静态验证脚本,绝不端到端执行或收集秘密。
|
|
16
|
+
|
|
17
|
+
进行中的 merge/rebase 冲突由 Matrix 自身治理,不调用会 stage、continue 或 commit 的 raw `resolving-merge-conflicts`。活动 Change 内不得调用 `implement`。
|
|
18
|
+
|
|
19
|
+
调用前说明能力与原因。companion 不得 commit、review、transition、archive 或扩大范围。正确安装的能力失败时最多执行一次同能力 Matrix fallback,并记录调用、失败、fallback 与证据;安装完整性问题必须停止并修复。
|
|
20
|
+
|
|
21
|
+
## 范围纪律
|
|
22
|
+
|
|
23
|
+
若实现暴露范围或设计变化,停止并执行:
|
|
24
|
+
|
|
25
|
+
```powershell
|
|
26
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason design-gap
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
回到 Design 会清除既有 Contract 批准并轮换当前验证证据;重新进入 Build 必须生成新的批准与新证据。
|
|
30
|
+
|
|
31
|
+
## 流程
|
|
32
|
+
|
|
33
|
+
1. 对可测试的行为变化使用 `tdd` 纵向切片;纯文档或不可观察的机械变更使用相称的静态检查。
|
|
34
|
+
2. 在 `## Build evidence` 记录共同事实;hotfix 另写 `## Reproduction evidence`、`## Root cause`,tweak 另写 `## Scope evidence`。
|
|
35
|
+
3. 运行 Build guard;它同时确认批准的 Contract 仍精确匹配。
|
|
36
|
+
4. 通过后推进至 Verify,并进入 `$matrix-verify`。
|
|
37
|
+
|
|
38
|
+
```powershell
|
|
39
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard build
|
|
40
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition verify
|
|
41
|
+
```
|
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: matrix-claude
|
|
3
|
-
description: 将已批准的 Matrix Contract 导出为受边界约束的 Claude Code 任务包,不改变 Matrix 工作流状态。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Matrix Claude Handoff
|
|
7
|
-
|
|
8
|
-
这是可选旁路,不是 Matrix phase。它不得执行 `transition`、`archive`,也不得写入 `matrix.yaml` 或 `events.jsonl
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
---
|
|
2
|
+
name: matrix-claude
|
|
3
|
+
description: 将已批准的 Matrix Contract 导出为受边界约束的 Claude Code 任务包,不改变 Matrix 工作流状态。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Matrix Claude Handoff
|
|
7
|
+
|
|
8
|
+
这是可选旁路,不是 Matrix phase。它不得执行 `transition`、`archive`,也不得写入 `matrix.yaml` 或 `events.jsonl`。它只支持匹配的 full 或 legacy-full 三产物 Contract;新的 lightweight hotfix/tweak 不支持导出。
|
|
9
|
+
|
|
10
|
+
人类可读 handoff 内容使用 inspect 的 `artifact_language`;稳定的机器可读标题和 metadata key 保持不变。
|
|
11
|
+
|
|
12
|
+
仅当变更已进入 Build、`design -> build` 已批准精确 Contract,并且用户明确选择 Claude Code 实现时使用。先检查:
|
|
13
|
+
|
|
14
|
+
```powershell
|
|
15
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard build
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
若结果为 `CONTRACT_CHANGED`、`CONTRACT_UNAPPROVED` 或 `CONTRACT_READ_FAILED`,回到 `$matrix-design`,修订后重新进入 Build 取得新批准。导出只读取批准快照中的 `proposal.md`、`design.md` 与 `plan.md`。
|
|
19
|
+
|
|
20
|
+
```powershell
|
|
21
|
+
# 通用项目:只导出 Matrix 产物
|
|
22
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs export --task-id <ID> --target generic
|
|
23
|
+
|
|
24
|
+
# FnSec:仅在 active.md 含有 NO_ACTIVE_OBJECTIVE 时更新看板
|
|
25
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs export --task-id <ID> --target fnsec --apply-fnsec-board
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
任务包包含批准的 Contract hash 与 revision,以及同一快照的 proposal、design、plan。导出本身不改变 Build 阶段;Claude 完成后,补齐 `## Build evidence`,然后继续:
|
|
29
|
+
|
|
30
|
+
```powershell
|
|
31
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard build
|
|
32
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition verify
|
|
33
|
+
```
|
|
@@ -5,14 +5,20 @@ description: 在实现前设计并冻结活动 Matrix 变更。
|
|
|
5
5
|
|
|
6
6
|
# Matrix Design
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
Design 只用于 full 和可恢复的旧 shortcut change。新的 lightweight hotfix/tweak 从 Open 直接进入 Build,不得为满足 full guard 补写 Design 产物。
|
|
9
|
+
|
|
10
|
+
design 和 plan 正文使用 `node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect` 的 `artifact_language`;Runtime 所需英文标题 token 保持不变。
|
|
11
|
+
|
|
12
|
+
读取 `node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect`、proposal 与冻结 `orchestration`,写入 `design.md`(`## Decisions`、`## Boundaries`、`## Test seams`、`## Risks`)与 `plan.md`(`## Steps`、`## Validation`、`## Stop conditions`)。
|
|
13
|
+
|
|
14
|
+
- **Prim**:使用 Matrix 自身能力调查并设计。
|
|
15
|
+
- **Arch**:仅按事实触发 `domain-modeling`、`research`、`prototype`、`codebase-design`;当 Contract 修改 Skill、`AGENTS.md`、`CLAUDE.md` 或 agent 指针可达文档时触发 `writing-for-agents`。不得机械执行固定序列;每次调用前说明能力与原因。
|
|
16
|
+
|
|
13
17
|
长期有效的领域、ADR 或研究产物遵循仓库约定,关键结论必须同步进入 Matrix design/plan。prototype 默认写入系统临时目录。companion 不得拥有 Matrix 状态或创建竞争计划。重大范围或架构决策须先由用户确认。
|
|
18
|
+
|
|
19
|
+
`wayfinder` 与 `improve-codebase-architecture` 只能作为活动 Design 外的显式 handoff;说明原因后由用户调用,选中的结果可另行进入受治理 Change。
|
|
14
20
|
|
|
15
21
|
```powershell
|
|
16
|
-
matrix
|
|
17
|
-
matrix
|
|
22
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard design
|
|
23
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition build
|
|
18
24
|
```
|
|
@@ -5,4 +5,4 @@ description: 为可复现的小型缺陷运行受约束的 Matrix 工作流。
|
|
|
5
5
|
|
|
6
6
|
# Matrix Hotfix
|
|
7
7
|
|
|
8
|
-
从 `$matrix` 以 `hotfix`
|
|
8
|
+
从 `$matrix` 以 `hotfix` 启动,共用 `open → build → verify → archive` lightweight 生命周期,不维护独立 hotfix 状态机。Build 前记录预期/实际行为和可复现失败信号,展示紧凑 Contract 并等待确认;Build 记录复现与根因,Verify 记录回归证据。若影响架构、公开 API、数据模式或多模块协调,受控 Return 后升级为 full。
|
|
@@ -5,14 +5,26 @@ description: 将开发请求澄清为有证据的 Matrix 提案。
|
|
|
5
5
|
|
|
6
6
|
# Matrix Open
|
|
7
7
|
|
|
8
|
-
读取 `matrix
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
读取 `node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect` 返回的 `profile` 与 `evidence_policy`。
|
|
9
|
+
|
|
10
|
+
proposal 正文使用其中的 `artifact_language`;Runtime 所需的英文标题 token 必须原样保留,仅标题下内容本地化。
|
|
11
|
+
|
|
12
|
+
- full proposal 包含 `## Goal`、`## Scope`、`## Non-goals`、`## Acceptance`、`## Risks`,随后进入 Design。
|
|
13
|
+
- lightweight proposal 在修改项目实现前完整定义 `## Goal`、`## Scope`、`## Non-goals`、`## Approach`、`## Acceptance`、`## Validation`、`## Risks`、`## Upgrade conditions`。
|
|
14
|
+
- hotfix 额外包含 `## Expected behavior`、`## Actual behavior`、`## Reproduction`。
|
|
15
|
+
- tweak 额外包含 `## Current behavior`、`## Preserved behavior`、`## Diff boundary`。
|
|
16
|
+
|
|
17
|
+
- **Prim**:使用 Matrix 自身能力澄清并编写提案。
|
|
11
18
|
- **Arch**:仅在存在重大歧义或用户要求压力测试时调用 `grilling`;仅在领域词汇、不变量或架构决定不清晰时调用 `domain-modeling`。调用前说明能力与原因。
|
|
12
19
|
|
|
13
|
-
|
|
20
|
+
若进展被另一人掌握的事实或决定阻塞,说明 `to-questionnaire` 适用的原因并让用户显式调用;Matrix 不得自行嵌套该 wrapper。
|
|
21
|
+
|
|
22
|
+
companion 输出只能作为当前 proposal 的证据,不得创建第二套工作流、提案、确认状态或阶段转换。正确安装的能力失败时最多执行一次同能力 Matrix fallback;安装完整性问题必须修复。
|
|
14
23
|
|
|
15
24
|
```powershell
|
|
16
|
-
matrix
|
|
17
|
-
|
|
25
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard open
|
|
26
|
+
# full
|
|
27
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition design
|
|
28
|
+
# hotfix/tweak,仅在用户明确确认后
|
|
29
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition build --confirmed
|
|
18
30
|
```
|
|
@@ -8,8 +8,8 @@ description: 检查活动 Matrix 工作流的磁盘状态、守卫与恢复命
|
|
|
8
8
|
执行:
|
|
9
9
|
|
|
10
10
|
```powershell
|
|
11
|
-
matrix
|
|
12
|
-
matrix
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
报告变更 ID
|
|
11
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs inspect
|
|
12
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs doctor
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
报告变更 ID、工作流、`profile`、`evidence_policy`、冻结 `orchestration`、阶段、守卫结果、`next_skill`、Workflow health、未完成 transaction、可用策略和精确恢复命令。Arch 完整性失败时列出平台/Skill 事实并报告 `matrix init --with-mattpocock`,不得把 change 解释为 Prim。两条命令都只读;不得推断恢复策略、运行 `--repair` 或修改状态。
|
|
@@ -5,4 +5,4 @@ description: 为边界清晰的小改动运行轻量 Matrix 工作流。
|
|
|
5
5
|
|
|
6
6
|
# Matrix Tweak
|
|
7
7
|
|
|
8
|
-
从 `$matrix` 以 `tweak`
|
|
8
|
+
从 `$matrix` 以 `tweak` 启动,共用 `open → build → verify → archive` lightweight 生命周期,不维护独立 tweak 状态机或 Design 阶段。修改实现前,在紧凑 proposal 中定义当前/保留行为、diff 边界、验收与验证,展示后等待确认;Build 与 Verify 必须证明范围和 diff 一致。若涉及 API、模式、架构或跨模块协调,受控 Return 后升级为 full。
|
|
@@ -5,23 +5,41 @@ description: 依据计划验证 Matrix 变更并审查差异。
|
|
|
5
5
|
|
|
6
6
|
# Matrix Verify
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
运行已批准 Contract 的验证命令,在 `verification.md` 写入 `## Test evidence`。hotfix 另写 `## Regression evidence`;tweak 另写 `## Scope review evidence`。所有模式都必须写入 `## Review evidence`,并在其中保留内容充分的 `### Standards` 与 `### Spec` 两个子节。读取冻结 `orchestration`:
|
|
9
|
+
|
|
10
|
+
验证正文使用 `artifact_language`;上述 Runtime 所需英文证据标题保持不变。
|
|
11
|
+
|
|
12
|
+
- **Prim**:Matrix 自行完成 Standards 与 Spec 双轴审查。
|
|
13
|
+
- **Arch**:调用 `code-review` 产生双轴证据,并说明调用原因。
|
|
14
|
+
|
|
15
|
+
审查结果只是 Matrix Verify 的输入;companion 不得决定阶段结果、扩大已批准架构、推进或归档。不得调用事后架构改进 wrapper。正确安装的审查能力失败时最多执行一次同能力 Matrix fallback;安装完整性问题必须停止。
|
|
9
16
|
|
|
10
|
-
-
|
|
11
|
-
- **Arch**:调用 `code-review` 产生双轴证据,并说明调用原因。
|
|
17
|
+
Arch 正常执行 `code-review` 后,使用项目 Runtime 把 fixed point、HEAD/diff、Contract、审查正文和工作区绑定为当前 revision 的回执:
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
```powershell
|
|
20
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs review --source code-review --fixed-point <ref> --standards <passed|failed> --spec <passed|failed>
|
|
21
|
+
```
|
|
14
22
|
|
|
15
|
-
|
|
23
|
+
只有在无 Git 基线、已提交的 HEAD diff 为空、仍存在 staged/unstaged/untracked 候选,或 capability 真实执行失败时,才记录限制并使用一次有界 fallback:
|
|
16
24
|
|
|
17
25
|
```powershell
|
|
18
|
-
matrix
|
|
19
|
-
matrix workflow return design --reason acceptance-or-design-gap
|
|
26
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs review --source matrix-fallback --reason <git-baseline-unavailable|empty-head-diff|uncommitted-worktree|capability-execution-failed> [--fixed-point <ref-for-empty-head-diff-or-uncommitted-worktree>] --standards <passed|failed> --spec <passed|failed>
|
|
20
27
|
```
|
|
21
28
|
|
|
29
|
+
不得把 fallback 写成 `code-review` 成功。`empty-head-diff` 必须提供 fixed point,由 Runtime 核实三点 diff 确实为空。`uncommitted-worktree` 也必须提供 fixed point,Runtime 会把 staged、unstaged 与 untracked 候选内容绑定为 `candidate_hash`,之后任意变化都会使回执过期。当前 revision 已有回执或任一审查轴失败时,必须先受控 Return,不能覆盖回执后继续。
|
|
30
|
+
|
|
31
|
+
失败时使用受控 Return:
|
|
32
|
+
|
|
33
|
+
```powershell
|
|
34
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs return build --reason verification-failed
|
|
35
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs return design --reason acceptance-or-design-gap
|
|
36
|
+
```
|
|
37
|
+
|
|
22
38
|
Return 会轮换旧 `verification.md`;不得把旧结论直接复制为新的当前证据。
|
|
39
|
+
|
|
40
|
+
Arch 的 Return 也会轮换 `review-receipt.json`;新 revision 必须重新审查并生成新回执。仅有 Markdown 标题、旧回执或与当前工作区不匹配的回执都不能通过 guard。
|
|
23
41
|
|
|
24
42
|
```powershell
|
|
25
|
-
matrix
|
|
26
|
-
matrix
|
|
43
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs guard verify
|
|
44
|
+
node <matrix-skill-directory>/scripts/matrix-runtime.mjs transition archive
|
|
27
45
|
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rosenfan/matrix",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Evidence-driven development workflow with Prim and Arch agent-skill orchestration.",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "Evidence-driven development workflow with Prim and Arch agent-skill orchestration.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
package/src/catalog.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import os from "node:os";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { MATT_INSTALLABLE_SKILLS, MATT_ROLES } from "./matt-catalog.mjs";
|
|
6
7
|
|
|
7
8
|
export const LANGUAGE_IDS = ["en", "zh-CN"];
|
|
8
9
|
export const PLATFORM_IDS = ["claude-code", "codex"];
|
|
@@ -10,14 +11,12 @@ export const MATRIX_SKILLS = [
|
|
|
10
11
|
"matrix", "matrix-open", "matrix-design", "matrix-build", "matrix-verify",
|
|
11
12
|
"matrix-archive", "matrix-hotfix", "matrix-tweak", "matrix-status", "matrix-claude"
|
|
12
13
|
];
|
|
13
|
-
export const MATT_SKILLS =
|
|
14
|
-
|
|
15
|
-
"codebase-design", "tdd", "diagnosing-bugs", "resolving-merge-conflicts", "code-review"
|
|
16
|
-
];
|
|
17
|
-
export const UNMANAGED_MATT_SKILLS = ["grill-with-docs", "implement", "improve-codebase-architecture"];
|
|
14
|
+
export const MATT_SKILLS = MATT_INSTALLABLE_SKILLS;
|
|
15
|
+
export const UNMANAGED_MATT_SKILLS = MATT_ROLES.incompatible;
|
|
18
16
|
|
|
19
|
-
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
20
|
-
const packageManifest = JSON.parse(fs.readFileSync(path.join(packageRoot, "package.json"), "utf8"));
|
|
17
|
+
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
18
|
+
const packageManifest = JSON.parse(fs.readFileSync(path.join(packageRoot, "package.json"), "utf8"));
|
|
19
|
+
export const MATRIX_VERSION = packageManifest.version;
|
|
21
20
|
|
|
22
21
|
export const PLATFORMS = {
|
|
23
22
|
"claude-code": {
|
|
@@ -76,17 +75,29 @@ export function hashDirectory(directory, extraFiles = []) {
|
|
|
76
75
|
|
|
77
76
|
export function workflowRuntimeSource() { return path.join(packageRoot, "src", "workflow.js"); }
|
|
78
77
|
export function workflowTransactionSource() { return path.join(packageRoot, "src", "workflow-transaction.js"); }
|
|
78
|
+
export function mattCatalogSource() { return path.join(packageRoot, "src", "matt-catalog.mjs"); }
|
|
79
79
|
|
|
80
|
-
export function releaseCatalog(language = "en") {
|
|
80
|
+
export function releaseCatalog(language = "en") {
|
|
81
81
|
if (!LANGUAGE_IDS.includes(language)) throw new Error(`Unsupported language: ${language}`);
|
|
82
|
-
const root = sourceSkillsRoot(language);
|
|
83
|
-
const missing = MATRIX_SKILLS.filter((skill) => !fs.existsSync(path.join(root, skill, "SKILL.md")));
|
|
84
|
-
if (missing.length) throw new Error(`Matrix package is incomplete. Missing: ${missing.join(", ")}`);
|
|
82
|
+
const root = sourceSkillsRoot(language);
|
|
83
|
+
const missing = MATRIX_SKILLS.filter((skill) => !fs.existsSync(path.join(root, skill, "SKILL.md")));
|
|
84
|
+
if (missing.length) throw new Error(`Matrix package is incomplete. Missing: ${missing.join(", ")}`);
|
|
85
85
|
const runtime = fs.readFileSync(workflowRuntimeSource());
|
|
86
86
|
const transaction = fs.readFileSync(workflowTransactionSource());
|
|
87
|
-
const
|
|
87
|
+
const mattCatalog = fs.readFileSync(mattCatalogSource());
|
|
88
|
+
const sharedRuntimeFiles = [
|
|
89
|
+
{ path: "scripts/package.json", contents: Buffer.from('{"type":"module"}\n') },
|
|
88
90
|
{ path: "scripts/matrix-runtime.mjs", contents: runtime },
|
|
89
|
-
{ path: "scripts/workflow-transaction.js", contents: transaction }
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
{ path: "scripts/workflow-transaction.js", contents: transaction },
|
|
92
|
+
{ path: "scripts/matt-catalog.mjs", contents: mattCatalog }
|
|
93
|
+
];
|
|
94
|
+
const compatibilityFiles = ["matrix_state.py", "matrix_claude.py"].map((filename) => ({
|
|
95
|
+
path: `scripts/${filename}`,
|
|
96
|
+
contents: fs.readFileSync(path.join(sourceSkillsRoot("en"), "matrix", "scripts", filename))
|
|
97
|
+
}));
|
|
98
|
+
const skills = Object.fromEntries(MATRIX_SKILLS.map((skill) => [skill, hashDirectory(
|
|
99
|
+
path.join(root, skill),
|
|
100
|
+
skill === "matrix" ? [...sharedRuntimeFiles, ...compatibilityFiles] : sharedRuntimeFiles
|
|
101
|
+
)]));
|
|
102
|
+
return { language, root, version: MATRIX_VERSION, skills, digest: crypto.createHash("sha256").update(JSON.stringify(skills)).digest("hex") };
|
|
103
|
+
}
|