@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
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
-
import os from "node:os";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import crypto from "node:crypto";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import crypto from "node:crypto";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
6
|
|
|
7
7
|
const JOURNAL_SCHEMA = "matrix/workflow-transaction/v1";
|
|
8
8
|
const RECEIPT_SCHEMA = "matrix/workflow-transaction-receipt/v1";
|
|
9
9
|
const LOCK_SCHEMA = "matrix/workflow-lock/v1";
|
|
10
10
|
const MAX_JOURNAL_BYTES = 1024 * 1024;
|
|
11
11
|
const MAX_TRANSACTIONS = 128;
|
|
12
|
-
const RECEIPT_LIMIT = 32;
|
|
13
|
-
const quoteCommandPath = (value) => process.platform === "win32" ? `"${value}"` : `'${value.replaceAll("'", "'\\''")}'`;
|
|
14
|
-
const workflowRuntimePath = path.join(path.dirname(fileURLToPath(import.meta.url)), "matrix-runtime.mjs");
|
|
15
|
-
const workflowCommand = (argumentsText) => `node ${quoteCommandPath(workflowRuntimePath)} ${argumentsText}`;
|
|
12
|
+
const RECEIPT_LIMIT = 32;
|
|
13
|
+
const quoteCommandPath = (value) => process.platform === "win32" ? `"${value}"` : `'${value.replaceAll("'", "'\\''")}'`;
|
|
14
|
+
const workflowRuntimePath = path.join(path.dirname(fileURLToPath(import.meta.url)), "matrix-runtime.mjs");
|
|
15
|
+
const workflowCommand = (argumentsText) => `node ${quoteCommandPath(workflowRuntimePath)} ${argumentsText}`;
|
|
16
16
|
|
|
17
17
|
const stamp = () => new Date().toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
18
18
|
const fail = (code, message, extra = {}) => ({ ok: false, code, message, ...extra });
|
|
@@ -434,11 +434,11 @@ export function workflowMutationGate(cwd) {
|
|
|
434
434
|
let pending;
|
|
435
435
|
try { pending = pendingTransactions(cwd); }
|
|
436
436
|
catch (error) { return recoverError(error, null); }
|
|
437
|
-
if (pending.length) return fail("WORKFLOW_RECOVERY_REQUIRED", "An unfinished Workflow transaction must be resolved before starting another mutation.", { transactions: pending.map(({ id }) => id), recovery_command: workflowCommand("doctor") });
|
|
437
|
+
if (pending.length) return fail("WORKFLOW_RECOVERY_REQUIRED", "An unfinished Workflow transaction must be resolved before starting another mutation.", { transactions: pending.map(({ id }) => id), recovery_command: workflowCommand("doctor") });
|
|
438
438
|
const currentLock = readLock(cwd);
|
|
439
439
|
if (!currentLock) return null;
|
|
440
440
|
const owner = lockOwner(currentLock);
|
|
441
|
-
return fail(owner === "active" ? "WORKFLOW_BUSY" : owner === "absent" ? "WORKFLOW_RECOVERY_REQUIRED" : "WORKFLOW_LOCK_CONFLICT", owner === "active" ? "An active Workflow mutation owns the project boundary." : "A Workflow lock requires explicit doctor recovery.", { lock_id: currentLock.id, transaction_id: currentLock.transaction_id, recovery_command: workflowCommand("doctor") });
|
|
441
|
+
return fail(owner === "active" ? "WORKFLOW_BUSY" : owner === "absent" ? "WORKFLOW_RECOVERY_REQUIRED" : "WORKFLOW_LOCK_CONFLICT", owner === "active" ? "An active Workflow mutation owns the project boundary." : "A Workflow lock requires explicit doctor recovery.", { lock_id: currentLock.id, transaction_id: currentLock.transaction_id, recovery_command: workflowCommand("doctor") });
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
function compactReceipt(cwd, journal, disposition) {
|
|
@@ -478,7 +478,7 @@ function recoverError(error, transactionId) {
|
|
|
478
478
|
const code = error.code && String(error.code).startsWith("WORKFLOW_") ? error.code : "WORKFLOW_PERSISTENCE_FAILED";
|
|
479
479
|
return fail(code, error.message, {
|
|
480
480
|
transaction_id: transactionId,
|
|
481
|
-
recovery_command: workflowCommand(`doctor --repair --transaction ${transactionId} --strategy continue`)
|
|
481
|
+
recovery_command: workflowCommand(`doctor --repair --transaction ${transactionId} --strategy continue`)
|
|
482
482
|
});
|
|
483
483
|
}
|
|
484
484
|
|
|
@@ -563,7 +563,7 @@ function repairTransaction(cwd, id, strategy) {
|
|
|
563
563
|
}
|
|
564
564
|
|
|
565
565
|
function exactCommands(transaction) {
|
|
566
|
-
return transaction.strategies.map((strategy) => workflowCommand(`doctor --repair --transaction ${transaction.id} --strategy ${strategy}`));
|
|
566
|
+
return transaction.strategies.map((strategy) => workflowCommand(`doctor --repair --transaction ${transaction.id} --strategy ${strategy}`));
|
|
567
567
|
}
|
|
568
568
|
|
|
569
569
|
export function workflowDoctor(cwd, { repair = false, transaction = null, strategy = null, lock = null } = {}) {
|
|
@@ -589,7 +589,7 @@ export function workflowDoctor(cwd, { repair = false, transaction = null, strate
|
|
|
589
589
|
transaction_id: currentLock.transaction_id,
|
|
590
590
|
owner,
|
|
591
591
|
commands: owner === "absent" && !transactions.some((item) => item.id === currentLock.transaction_id && (item.corrupt || !["committed", "rolled-back"].includes(item.status)))
|
|
592
|
-
? [workflowCommand(`doctor --repair --lock ${currentLock.id}`)]
|
|
592
|
+
? [workflowCommand(`doctor --repair --lock ${currentLock.id}`)]
|
|
593
593
|
: []
|
|
594
594
|
}] : [])
|
|
595
595
|
];
|