@meridian-flow/mars-schema 0.24.2 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/fixtures/typescript-hooks/all-events/hook.toml +62 -0
- package/fixtures/typescript-hooks/all-events/opencode.ts +99 -0
- package/fixtures/typescript-hooks/all-events/pi.ts +144 -0
- package/fixtures/typescript-hooks/all-events/report.txt +10 -0
- package/fixtures/typescript-hooks/left-out/hook.toml +25 -0
- package/fixtures/typescript-hooks/left-out/opencode.ts +24 -0
- package/fixtures/typescript-hooks/left-out/pi.ts +39 -0
- package/fixtures/typescript-hooks/left-out/report.txt +9 -0
- package/index.d.ts +43 -0
- package/node/mars_schema_wasm.d.ts +9 -0
- package/node/mars_schema_wasm.js +46 -0
- package/node/mars_schema_wasm_bg.wasm +0 -0
- package/node/mars_schema_wasm_bg.wasm.d.ts +1 -0
- package/package.json +1 -1
- package/web/mars_schema_wasm.d.ts +10 -0
- package/web/mars_schema_wasm.js +45 -0
- package/web/mars_schema_wasm_bg.wasm +0 -0
- package/web/mars_schema_wasm_bg.wasm.d.ts +1 -0
package/README.md
CHANGED
|
@@ -35,6 +35,7 @@ await init();
|
|
|
35
35
|
| `satisfies(constraint, version)` | Whether a version meets a dependency entry's `version` (`^1.2`, `v2`, a bare `0.20` as `^0.20`, `latest`; a branch or commit pin is met by none). |
|
|
36
36
|
| `satisfiesRequirement(requirement, version)` | Whether a version meets a package's `requires-mars` or `requires-meridian`, where a bare `0.20` means `>=0.20.0`. |
|
|
37
37
|
| `selectVersion({available, constraints, locked?})` | Which ref a package ends at, from every `[requester, version \| null]` on it and the repository's tags: `{pin}` (a branch or commit), `{locked: true}` (the locked version still meets every semver range, whether or not the repository still has its tag), `{tag}` (the newest that meets every semver range) or `{untagged: true}` (no version tags). Throws when none qualifies. |
|
|
38
|
+
| `renderHooks(hookToml, targets, tokens?)` | A `hook.toml`'s `[hooks]` table as each target (`.claude`, `.codex`, …) takes it: finished entries or generated files, what the target leaves out, and the reader's diagnostics. |
|
|
38
39
|
| `selectItems({packages, root?, requests?})` | Which Agents, skills and bootstrap documents an install of `root` and its dependencies yields, and why. Takes each package's `prepare` result. |
|
|
39
40
|
| `version()` | The version of the schema crate this build was made from. |
|
|
40
41
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name = "all-events"
|
|
2
|
+
|
|
3
|
+
[[hooks.PreToolUse]]
|
|
4
|
+
matcher = "Bash|Edit"
|
|
5
|
+
[[hooks.PreToolUse.hooks]]
|
|
6
|
+
type = "command"
|
|
7
|
+
command = 'bash "${MARS_HOOK_DIR}/run.sh" PreToolUse ${MARS_HOOK_TARGET}'
|
|
8
|
+
commandWindows = 'bash "${MARS_HOOK_DIR}/run.sh" "quoted \\ path"'
|
|
9
|
+
if = "Bash(*tmux*)"
|
|
10
|
+
onFailure = "block"
|
|
11
|
+
timeout = 2.5
|
|
12
|
+
|
|
13
|
+
[[hooks.PostToolUse]]
|
|
14
|
+
matcher = "*"
|
|
15
|
+
[[hooks.PostToolUse.hooks]]
|
|
16
|
+
type = "command"
|
|
17
|
+
command = 'bash "${MARS_HOOK_DIR}/run.sh" PostToolUse ${MARS_HOOK_TARGET}'
|
|
18
|
+
async = true
|
|
19
|
+
|
|
20
|
+
[[hooks.PostToolUseFailure]]
|
|
21
|
+
[[hooks.PostToolUseFailure.hooks]]
|
|
22
|
+
type = "command"
|
|
23
|
+
command = 'bash "${MARS_HOOK_DIR}/run.sh" PostToolUseFailure ${MARS_HOOK_TARGET}'
|
|
24
|
+
|
|
25
|
+
[[hooks.UserPromptSubmit]]
|
|
26
|
+
[[hooks.UserPromptSubmit.hooks]]
|
|
27
|
+
type = "command"
|
|
28
|
+
command = 'bash "${MARS_HOOK_DIR}/run.sh" UserPromptSubmit ${MARS_HOOK_TARGET}'
|
|
29
|
+
|
|
30
|
+
[[hooks.SessionStart]]
|
|
31
|
+
matcher = "startup"
|
|
32
|
+
[[hooks.SessionStart.hooks]]
|
|
33
|
+
type = "command"
|
|
34
|
+
command = 'bash "${MARS_HOOK_DIR}/run.sh" SessionStart ${MARS_HOOK_TARGET}'
|
|
35
|
+
|
|
36
|
+
[[hooks.Stop]]
|
|
37
|
+
[[hooks.Stop.hooks]]
|
|
38
|
+
type = "command"
|
|
39
|
+
command = 'bash "${MARS_HOOK_DIR}/run.sh" Stop ${MARS_HOOK_TARGET}'
|
|
40
|
+
|
|
41
|
+
[[hooks.PreCompact]]
|
|
42
|
+
[[hooks.PreCompact.hooks]]
|
|
43
|
+
type = "command"
|
|
44
|
+
command = 'bash "${MARS_HOOK_DIR}/run.sh" PreCompact ${MARS_HOOK_TARGET}'
|
|
45
|
+
|
|
46
|
+
[[hooks.PostCompact]]
|
|
47
|
+
matcher = "auto"
|
|
48
|
+
[[hooks.PostCompact.hooks]]
|
|
49
|
+
type = "command"
|
|
50
|
+
command = 'bash "${MARS_HOOK_DIR}/run.sh" PostCompact ${MARS_HOOK_TARGET}'
|
|
51
|
+
|
|
52
|
+
[[hooks.SessionEnd]]
|
|
53
|
+
matcher = "clear|other"
|
|
54
|
+
[[hooks.SessionEnd.hooks]]
|
|
55
|
+
type = "command"
|
|
56
|
+
command = 'bash "${MARS_HOOK_DIR}/run.sh" SessionEnd ${MARS_HOOK_TARGET}'
|
|
57
|
+
|
|
58
|
+
[[hooks.PermissionRequest]]
|
|
59
|
+
matcher = "^mcp__"
|
|
60
|
+
[[hooks.PermissionRequest.hooks]]
|
|
61
|
+
type = "command"
|
|
62
|
+
command = 'bash "${MARS_HOOK_DIR}/run.sh" PermissionRequest ${MARS_HOOK_TARGET}'
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Generated by mars from hook `all-events`. Mars rewrites this file on every sync: edit the hook, not this file.
|
|
2
|
+
const HOOK: any = {
|
|
3
|
+
"events": {
|
|
4
|
+
"PermissionRequest": [
|
|
5
|
+
{
|
|
6
|
+
"handlers": [
|
|
7
|
+
{
|
|
8
|
+
"async": false,
|
|
9
|
+
"command": "bash \"/p/hooks/case/run.sh\" PermissionRequest .opencode",
|
|
10
|
+
"commandWindows": null,
|
|
11
|
+
"if": null,
|
|
12
|
+
"onFailure": null,
|
|
13
|
+
"timeout": 600
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"matcher": "^mcp__"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"PostToolUse": [
|
|
20
|
+
{
|
|
21
|
+
"handlers": [
|
|
22
|
+
{
|
|
23
|
+
"async": true,
|
|
24
|
+
"command": "bash \"/p/hooks/case/run.sh\" PostToolUse .opencode",
|
|
25
|
+
"commandWindows": null,
|
|
26
|
+
"if": null,
|
|
27
|
+
"onFailure": null,
|
|
28
|
+
"timeout": null
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"matcher": "*"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"PostToolUseFailure": [
|
|
35
|
+
{
|
|
36
|
+
"handlers": [
|
|
37
|
+
{
|
|
38
|
+
"async": false,
|
|
39
|
+
"command": "bash \"/p/hooks/case/run.sh\" PostToolUseFailure .opencode",
|
|
40
|
+
"commandWindows": null,
|
|
41
|
+
"if": null,
|
|
42
|
+
"onFailure": null,
|
|
43
|
+
"timeout": 600
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"matcher": null
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"PreCompact": [
|
|
50
|
+
{
|
|
51
|
+
"handlers": [
|
|
52
|
+
{
|
|
53
|
+
"async": false,
|
|
54
|
+
"command": "bash \"/p/hooks/case/run.sh\" PreCompact .opencode",
|
|
55
|
+
"commandWindows": null,
|
|
56
|
+
"if": null,
|
|
57
|
+
"onFailure": null,
|
|
58
|
+
"timeout": 600
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"matcher": null
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"PreToolUse": [
|
|
65
|
+
{
|
|
66
|
+
"handlers": [
|
|
67
|
+
{
|
|
68
|
+
"async": false,
|
|
69
|
+
"command": "bash \"/p/hooks/case/run.sh\" PreToolUse .opencode",
|
|
70
|
+
"commandWindows": "bash \"/p/hooks/case/run.sh\" \"quoted \\\\ path\"",
|
|
71
|
+
"if": "Bash(*tmux*)",
|
|
72
|
+
"onFailure": "block",
|
|
73
|
+
"timeout": 2.5
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"matcher": "Bash|Edit"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"UserPromptSubmit": [
|
|
80
|
+
{
|
|
81
|
+
"handlers": [
|
|
82
|
+
{
|
|
83
|
+
"async": false,
|
|
84
|
+
"command": "bash \"/p/hooks/case/run.sh\" UserPromptSubmit .opencode",
|
|
85
|
+
"commandWindows": null,
|
|
86
|
+
"if": null,
|
|
87
|
+
"onFailure": null,
|
|
88
|
+
"timeout": 30
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"matcher": null
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"harness": "OpenCode",
|
|
96
|
+
"name": "all-events",
|
|
97
|
+
"verified": "OpenCode 2.2.0"
|
|
98
|
+
};
|
|
99
|
+
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// Generated by mars from hook `all-events`. Mars rewrites this file on every sync: edit the hook, not this file.
|
|
2
|
+
const HOOK: any = {
|
|
3
|
+
"events": {
|
|
4
|
+
"PostCompact": [
|
|
5
|
+
{
|
|
6
|
+
"handlers": [
|
|
7
|
+
{
|
|
8
|
+
"async": false,
|
|
9
|
+
"command": "bash \"/p/hooks/case/run.sh\" PostCompact .pi",
|
|
10
|
+
"commandWindows": null,
|
|
11
|
+
"if": null,
|
|
12
|
+
"onFailure": null,
|
|
13
|
+
"timeout": 600
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"matcher": "auto"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"PostToolUse": [
|
|
20
|
+
{
|
|
21
|
+
"handlers": [
|
|
22
|
+
{
|
|
23
|
+
"async": true,
|
|
24
|
+
"command": "bash \"/p/hooks/case/run.sh\" PostToolUse .pi",
|
|
25
|
+
"commandWindows": null,
|
|
26
|
+
"if": null,
|
|
27
|
+
"onFailure": null,
|
|
28
|
+
"timeout": null
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"matcher": "*"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"PostToolUseFailure": [
|
|
35
|
+
{
|
|
36
|
+
"handlers": [
|
|
37
|
+
{
|
|
38
|
+
"async": false,
|
|
39
|
+
"command": "bash \"/p/hooks/case/run.sh\" PostToolUseFailure .pi",
|
|
40
|
+
"commandWindows": null,
|
|
41
|
+
"if": null,
|
|
42
|
+
"onFailure": null,
|
|
43
|
+
"timeout": 600
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"matcher": null
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"PreCompact": [
|
|
50
|
+
{
|
|
51
|
+
"handlers": [
|
|
52
|
+
{
|
|
53
|
+
"async": false,
|
|
54
|
+
"command": "bash \"/p/hooks/case/run.sh\" PreCompact .pi",
|
|
55
|
+
"commandWindows": null,
|
|
56
|
+
"if": null,
|
|
57
|
+
"onFailure": null,
|
|
58
|
+
"timeout": 600
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"matcher": null
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"PreToolUse": [
|
|
65
|
+
{
|
|
66
|
+
"handlers": [
|
|
67
|
+
{
|
|
68
|
+
"async": false,
|
|
69
|
+
"command": "bash \"/p/hooks/case/run.sh\" PreToolUse .pi",
|
|
70
|
+
"commandWindows": "bash \"/p/hooks/case/run.sh\" \"quoted \\\\ path\"",
|
|
71
|
+
"if": "Bash(*tmux*)",
|
|
72
|
+
"onFailure": "block",
|
|
73
|
+
"timeout": 2.5
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"matcher": "Bash|Edit"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"SessionEnd": [
|
|
80
|
+
{
|
|
81
|
+
"handlers": [
|
|
82
|
+
{
|
|
83
|
+
"async": false,
|
|
84
|
+
"command": "bash \"/p/hooks/case/run.sh\" SessionEnd .pi",
|
|
85
|
+
"commandWindows": null,
|
|
86
|
+
"if": null,
|
|
87
|
+
"onFailure": null,
|
|
88
|
+
"timeout": 1.5
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"matcher": "clear|other"
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"SessionStart": [
|
|
95
|
+
{
|
|
96
|
+
"handlers": [
|
|
97
|
+
{
|
|
98
|
+
"async": false,
|
|
99
|
+
"command": "bash \"/p/hooks/case/run.sh\" SessionStart .pi",
|
|
100
|
+
"commandWindows": null,
|
|
101
|
+
"if": null,
|
|
102
|
+
"onFailure": null,
|
|
103
|
+
"timeout": 600
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"matcher": "startup"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"Stop": [
|
|
110
|
+
{
|
|
111
|
+
"handlers": [
|
|
112
|
+
{
|
|
113
|
+
"async": false,
|
|
114
|
+
"command": "bash \"/p/hooks/case/run.sh\" Stop .pi",
|
|
115
|
+
"commandWindows": null,
|
|
116
|
+
"if": null,
|
|
117
|
+
"onFailure": null,
|
|
118
|
+
"timeout": 600
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
"matcher": null
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
"UserPromptSubmit": [
|
|
125
|
+
{
|
|
126
|
+
"handlers": [
|
|
127
|
+
{
|
|
128
|
+
"async": false,
|
|
129
|
+
"command": "bash \"/p/hooks/case/run.sh\" UserPromptSubmit .pi",
|
|
130
|
+
"commandWindows": null,
|
|
131
|
+
"if": null,
|
|
132
|
+
"onFailure": null,
|
|
133
|
+
"timeout": 30
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"matcher": null
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
"harness": "Pi",
|
|
141
|
+
"name": "all-events",
|
|
142
|
+
"verified": "Pi 1.4.0"
|
|
143
|
+
};
|
|
144
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
.opencode
|
|
2
|
+
skip PostCompact: OpenCode reports a finished compaction only on its bus
|
|
3
|
+
skip SessionEnd: OpenCode reports a deleted session only on its bus
|
|
4
|
+
skip SessionStart: OpenCode has no per-session start hook (a plugin's setup runs once per project)
|
|
5
|
+
skip Stop: OpenCode's end of a turn is a bus event that is not awaited
|
|
6
|
+
answers PreCompact: OpenCode cannot cancel a compaction: the script runs and a block answer is ignored
|
|
7
|
+
answers UserPromptSubmit: a block answer stops the prompt, but OpenCode shows a generic error instead of the reason
|
|
8
|
+
.pi
|
|
9
|
+
skip PermissionRequest: Pi has no permission system
|
|
10
|
+
answers UserPromptSubmit: a block answer stops the prompt, but Pi shows the reason only in its UI: print mode shows nothing
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[[hooks.PreToolUse]]
|
|
2
|
+
matcher = "Bash"
|
|
3
|
+
[[hooks.PreToolUse.hooks]]
|
|
4
|
+
type = "http"
|
|
5
|
+
url = "https://example.test"
|
|
6
|
+
[[hooks.PreToolUse.hooks]]
|
|
7
|
+
type = "command"
|
|
8
|
+
command = "echo ok"
|
|
9
|
+
|
|
10
|
+
[[hooks.PreCompact]]
|
|
11
|
+
matcher = "manual"
|
|
12
|
+
[[hooks.PreCompact.hooks]]
|
|
13
|
+
type = "command"
|
|
14
|
+
command = "echo a"
|
|
15
|
+
|
|
16
|
+
[[hooks.Stop]]
|
|
17
|
+
[[hooks.Stop.hooks]]
|
|
18
|
+
type = "command"
|
|
19
|
+
command = "echo b"
|
|
20
|
+
if = "Bash(*)"
|
|
21
|
+
|
|
22
|
+
[[hooks.Notification]]
|
|
23
|
+
[[hooks.Notification.hooks]]
|
|
24
|
+
type = "command"
|
|
25
|
+
command = "echo n"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Generated by mars from hook `case`. Mars rewrites this file on every sync: edit the hook, not this file.
|
|
2
|
+
const HOOK: any = {
|
|
3
|
+
"events": {
|
|
4
|
+
"PreToolUse": [
|
|
5
|
+
{
|
|
6
|
+
"handlers": [
|
|
7
|
+
{
|
|
8
|
+
"async": false,
|
|
9
|
+
"command": "echo ok",
|
|
10
|
+
"commandWindows": null,
|
|
11
|
+
"if": null,
|
|
12
|
+
"onFailure": null,
|
|
13
|
+
"timeout": 600
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"matcher": "Bash"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"harness": "OpenCode",
|
|
21
|
+
"name": "case",
|
|
22
|
+
"verified": "OpenCode 2.2.0"
|
|
23
|
+
};
|
|
24
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Generated by mars from hook `case`. Mars rewrites this file on every sync: edit the hook, not this file.
|
|
2
|
+
const HOOK: any = {
|
|
3
|
+
"events": {
|
|
4
|
+
"PreCompact": [
|
|
5
|
+
{
|
|
6
|
+
"handlers": [
|
|
7
|
+
{
|
|
8
|
+
"async": false,
|
|
9
|
+
"command": "echo a",
|
|
10
|
+
"commandWindows": null,
|
|
11
|
+
"if": null,
|
|
12
|
+
"onFailure": null,
|
|
13
|
+
"timeout": 600
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"matcher": "manual"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"PreToolUse": [
|
|
20
|
+
{
|
|
21
|
+
"handlers": [
|
|
22
|
+
{
|
|
23
|
+
"async": false,
|
|
24
|
+
"command": "echo ok",
|
|
25
|
+
"commandWindows": null,
|
|
26
|
+
"if": null,
|
|
27
|
+
"onFailure": null,
|
|
28
|
+
"timeout": 600
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"matcher": "Bash"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"harness": "Pi",
|
|
36
|
+
"name": "case",
|
|
37
|
+
"verified": "Pi 1.4.0"
|
|
38
|
+
};
|
|
39
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
.opencode
|
|
2
|
+
skip Notification: OpenCode has no such event
|
|
3
|
+
skip PreCompact: matcher group 0: OpenCode gives `PreCompact` no `trigger` to test `manual` against
|
|
4
|
+
skip PreToolUse: matcher group 0, handler 0: OpenCode runs `command` handlers, not `http`
|
|
5
|
+
skip Stop: OpenCode's end of a turn is a bus event that is not awaited
|
|
6
|
+
.pi
|
|
7
|
+
skip Notification: Pi has no such event
|
|
8
|
+
skip PreToolUse: matcher group 0, handler 0: Pi runs `command` handlers, not `http`
|
|
9
|
+
skip Stop: matcher group 0, handler 0: Claude never runs a handler with `if` on a non-tool event
|
package/index.d.ts
CHANGED
|
@@ -635,3 +635,46 @@ export function selectItems(input: {
|
|
|
635
635
|
packages: { [name: string]: SelectionPackage };
|
|
636
636
|
root?: SelectionPackage;
|
|
637
637
|
}): SelectionResult;
|
|
638
|
+
|
|
639
|
+
/** What a hook installs on one target: the schema's own `HookOutput`, as `mars sync` reports it. */
|
|
640
|
+
export type HookTargetOutput =
|
|
641
|
+
| {
|
|
642
|
+
kind: "merge";
|
|
643
|
+
/** Finished entries per native event. A native hook's `[]` is kept: it turns that event off. */
|
|
644
|
+
events: { [event: string]: unknown[] };
|
|
645
|
+
/** Unknown events a dependency's native hook lists, left out of `events`. */
|
|
646
|
+
skippedEvents: string[];
|
|
647
|
+
/** Events the target does not list that `unchecked = true` let through. */
|
|
648
|
+
uncheckedEvents: string[];
|
|
649
|
+
/** Events a native hook declares that `[hooks]` also declares: the native hook's replace the generated entries. */
|
|
650
|
+
overrides: string[];
|
|
651
|
+
skips: HookSkip[];
|
|
652
|
+
}
|
|
653
|
+
| {
|
|
654
|
+
kind: "file";
|
|
655
|
+
files: { path: string; content: string }[];
|
|
656
|
+
/** What is wrong with the authored native hook, if anything; it is installed regardless. */
|
|
657
|
+
nativeHookProblem: string | null;
|
|
658
|
+
skips: HookSkip[];
|
|
659
|
+
/** Rendered events whose portable answers do not all carry over to the target. */
|
|
660
|
+
answerLimits: HookSkip[];
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
/** Something a target does not run. `event` is `null` when the whole target is skipped. */
|
|
664
|
+
export interface HookSkip {
|
|
665
|
+
event: string | null;
|
|
666
|
+
reason: string;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* A `hook.toml`'s `[hooks]` table as each target in `targets` (roots such as `.claude`,
|
|
671
|
+
* `.codex`) takes it, from the same render `mars sync` uses. `tokens` fills `${MARS_HOOK_DIR}`
|
|
672
|
+
* and `${MARS_HOOK_TARGET}`; one left out stays as written (`hookTarget` defaults to the
|
|
673
|
+
* target's root). When `diagnostics` holds an error, `targets` is empty. A root with no hook
|
|
674
|
+
* mechanism throws `input.invalid`.
|
|
675
|
+
*/
|
|
676
|
+
export function renderHooks(
|
|
677
|
+
hookToml: string,
|
|
678
|
+
targets: string[],
|
|
679
|
+
tokens?: { hookDir?: string; hookTarget?: string } | null,
|
|
680
|
+
): { diagnostics: Diagnostic[]; targets: { [root: string]: HookTargetOutput } };
|
|
@@ -33,6 +33,15 @@ export function prepare(argument: any): any;
|
|
|
33
33
|
*/
|
|
34
34
|
export function read(path: string, text: string): any;
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* A `hook.toml`'s `[hooks]` as each of `targets` (roots such as `.claude`) takes it:
|
|
38
|
+
* `{diagnostics, targets: {<root>: HookOutput}}`, where `HookOutput` is the schema's own
|
|
39
|
+
* serialization (`kind: "merge" | "file"`; see `index.d.ts`). `tokens` (`{hookDir?, hookTarget?}`) fills the hook tokens; one
|
|
40
|
+
* left out stays as written (`hookTarget` defaults to the target's root). `targets` is empty
|
|
41
|
+
* when `diagnostics` holds an error. A root with no hook mechanism throws `input.invalid`.
|
|
42
|
+
*/
|
|
43
|
+
export function renderHooks(hook_toml: string, targets: string[], tokens: any): any;
|
|
44
|
+
|
|
36
45
|
/**
|
|
37
46
|
* The full frontmatter block for `[key, value][]`, ending in exactly one newline.
|
|
38
47
|
*/
|
package/node/mars_schema_wasm.js
CHANGED
|
@@ -132,6 +132,38 @@ function read(path, text) {
|
|
|
132
132
|
}
|
|
133
133
|
exports.read = read;
|
|
134
134
|
|
|
135
|
+
/**
|
|
136
|
+
* A `hook.toml`'s `[hooks]` as each of `targets` (roots such as `.claude`) takes it:
|
|
137
|
+
* `{diagnostics, targets: {<root>: HookOutput}}`, where `HookOutput` is the schema's own
|
|
138
|
+
* serialization (`kind: "merge" | "file"`; see `index.d.ts`). `tokens` (`{hookDir?, hookTarget?}`) fills the hook tokens; one
|
|
139
|
+
* left out stays as written (`hookTarget` defaults to the target's root). `targets` is empty
|
|
140
|
+
* when `diagnostics` holds an error. A root with no hook mechanism throws `input.invalid`.
|
|
141
|
+
* @param {string} hook_toml
|
|
142
|
+
* @param {string[]} targets
|
|
143
|
+
* @param {any} tokens
|
|
144
|
+
* @returns {any}
|
|
145
|
+
*/
|
|
146
|
+
function renderHooks(hook_toml, targets, tokens) {
|
|
147
|
+
try {
|
|
148
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
149
|
+
const ptr0 = passStringToWasm0(hook_toml, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
150
|
+
const len0 = WASM_VECTOR_LEN;
|
|
151
|
+
const ptr1 = passArrayJsValueToWasm0(targets, wasm.__wbindgen_export);
|
|
152
|
+
const len1 = WASM_VECTOR_LEN;
|
|
153
|
+
wasm.renderHooks(retptr, ptr0, len0, ptr1, len1, addHeapObject(tokens));
|
|
154
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
155
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
156
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
157
|
+
if (r2) {
|
|
158
|
+
throw takeObject(r1);
|
|
159
|
+
}
|
|
160
|
+
return takeObject(r0);
|
|
161
|
+
} finally {
|
|
162
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
exports.renderHooks = renderHooks;
|
|
166
|
+
|
|
135
167
|
/**
|
|
136
168
|
* The full frontmatter block for `[key, value][]`, ending in exactly one newline.
|
|
137
169
|
* @param {any} frontmatter
|
|
@@ -363,6 +395,10 @@ function __wbg_get_imports() {
|
|
|
363
395
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
364
396
|
return ret;
|
|
365
397
|
},
|
|
398
|
+
__wbg___wbindgen_is_null_87c3bfe968c6a5ad: function(arg0) {
|
|
399
|
+
const ret = getObject(arg0) === null;
|
|
400
|
+
return ret;
|
|
401
|
+
},
|
|
366
402
|
__wbg___wbindgen_is_object_56732c2bc353f41d: function(arg0) {
|
|
367
403
|
const val = getObject(arg0);
|
|
368
404
|
const ret = typeof(val) === 'object' && val !== null;
|
|
@@ -725,6 +761,16 @@ function isLikeNone(x) {
|
|
|
725
761
|
return x === undefined || x === null;
|
|
726
762
|
}
|
|
727
763
|
|
|
764
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
765
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
766
|
+
const mem = getDataViewMemory0();
|
|
767
|
+
for (let i = 0; i < array.length; i++) {
|
|
768
|
+
mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
|
|
769
|
+
}
|
|
770
|
+
WASM_VECTOR_LEN = array.length;
|
|
771
|
+
return ptr;
|
|
772
|
+
}
|
|
773
|
+
|
|
728
774
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
729
775
|
if (realloc === undefined) {
|
|
730
776
|
const buf = cachedTextEncoder.encode(arg);
|
|
Binary file
|
|
@@ -6,6 +6,7 @@ export const inspect: (a: number, b: number) => void;
|
|
|
6
6
|
export const normalize: (a: number, b: number) => void;
|
|
7
7
|
export const prepare: (a: number, b: number) => void;
|
|
8
8
|
export const read: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
9
|
+
export const renderHooks: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
9
10
|
export const rewriteBlock: (a: number, b: number) => void;
|
|
10
11
|
export const satisfies: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
11
12
|
export const satisfiesRequirement: (a: number, b: number, c: number, d: number, e: number) => void;
|
package/package.json
CHANGED
|
@@ -33,6 +33,15 @@ export function prepare(argument: any): any;
|
|
|
33
33
|
*/
|
|
34
34
|
export function read(path: string, text: string): any;
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* A `hook.toml`'s `[hooks]` as each of `targets` (roots such as `.claude`) takes it:
|
|
38
|
+
* `{diagnostics, targets: {<root>: HookOutput}}`, where `HookOutput` is the schema's own
|
|
39
|
+
* serialization (`kind: "merge" | "file"`; see `index.d.ts`). `tokens` (`{hookDir?, hookTarget?}`) fills the hook tokens; one
|
|
40
|
+
* left out stays as written (`hookTarget` defaults to the target's root). `targets` is empty
|
|
41
|
+
* when `diagnostics` holds an error. A root with no hook mechanism throws `input.invalid`.
|
|
42
|
+
*/
|
|
43
|
+
export function renderHooks(hook_toml: string, targets: string[], tokens: any): any;
|
|
44
|
+
|
|
36
45
|
/**
|
|
37
46
|
* The full frontmatter block for `[key, value][]`, ending in exactly one newline.
|
|
38
47
|
*/
|
|
@@ -87,6 +96,7 @@ export interface InitOutput {
|
|
|
87
96
|
readonly normalize: (a: number, b: number) => void;
|
|
88
97
|
readonly prepare: (a: number, b: number) => void;
|
|
89
98
|
readonly read: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
99
|
+
readonly renderHooks: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
90
100
|
readonly rewriteBlock: (a: number, b: number) => void;
|
|
91
101
|
readonly satisfies: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
92
102
|
readonly satisfiesRequirement: (a: number, b: number, c: number, d: number, e: number) => void;
|
package/web/mars_schema_wasm.js
CHANGED
|
@@ -127,6 +127,37 @@ export function read(path, text) {
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
/**
|
|
131
|
+
* A `hook.toml`'s `[hooks]` as each of `targets` (roots such as `.claude`) takes it:
|
|
132
|
+
* `{diagnostics, targets: {<root>: HookOutput}}`, where `HookOutput` is the schema's own
|
|
133
|
+
* serialization (`kind: "merge" | "file"`; see `index.d.ts`). `tokens` (`{hookDir?, hookTarget?}`) fills the hook tokens; one
|
|
134
|
+
* left out stays as written (`hookTarget` defaults to the target's root). `targets` is empty
|
|
135
|
+
* when `diagnostics` holds an error. A root with no hook mechanism throws `input.invalid`.
|
|
136
|
+
* @param {string} hook_toml
|
|
137
|
+
* @param {string[]} targets
|
|
138
|
+
* @param {any} tokens
|
|
139
|
+
* @returns {any}
|
|
140
|
+
*/
|
|
141
|
+
export function renderHooks(hook_toml, targets, tokens) {
|
|
142
|
+
try {
|
|
143
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
144
|
+
const ptr0 = passStringToWasm0(hook_toml, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
145
|
+
const len0 = WASM_VECTOR_LEN;
|
|
146
|
+
const ptr1 = passArrayJsValueToWasm0(targets, wasm.__wbindgen_export);
|
|
147
|
+
const len1 = WASM_VECTOR_LEN;
|
|
148
|
+
wasm.renderHooks(retptr, ptr0, len0, ptr1, len1, addHeapObject(tokens));
|
|
149
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
150
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
151
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
152
|
+
if (r2) {
|
|
153
|
+
throw takeObject(r1);
|
|
154
|
+
}
|
|
155
|
+
return takeObject(r0);
|
|
156
|
+
} finally {
|
|
157
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
130
161
|
/**
|
|
131
162
|
* The full frontmatter block for `[key, value][]`, ending in exactly one newline.
|
|
132
163
|
* @param {any} frontmatter
|
|
@@ -351,6 +382,10 @@ function __wbg_get_imports() {
|
|
|
351
382
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
352
383
|
return ret;
|
|
353
384
|
},
|
|
385
|
+
__wbg___wbindgen_is_null_87c3bfe968c6a5ad: function(arg0) {
|
|
386
|
+
const ret = getObject(arg0) === null;
|
|
387
|
+
return ret;
|
|
388
|
+
},
|
|
354
389
|
__wbg___wbindgen_is_object_56732c2bc353f41d: function(arg0) {
|
|
355
390
|
const val = getObject(arg0);
|
|
356
391
|
const ret = typeof(val) === 'object' && val !== null;
|
|
@@ -713,6 +748,16 @@ function isLikeNone(x) {
|
|
|
713
748
|
return x === undefined || x === null;
|
|
714
749
|
}
|
|
715
750
|
|
|
751
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
752
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
753
|
+
const mem = getDataViewMemory0();
|
|
754
|
+
for (let i = 0; i < array.length; i++) {
|
|
755
|
+
mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
|
|
756
|
+
}
|
|
757
|
+
WASM_VECTOR_LEN = array.length;
|
|
758
|
+
return ptr;
|
|
759
|
+
}
|
|
760
|
+
|
|
716
761
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
717
762
|
if (realloc === undefined) {
|
|
718
763
|
const buf = cachedTextEncoder.encode(arg);
|
|
Binary file
|
|
@@ -6,6 +6,7 @@ export const inspect: (a: number, b: number) => void;
|
|
|
6
6
|
export const normalize: (a: number, b: number) => void;
|
|
7
7
|
export const prepare: (a: number, b: number) => void;
|
|
8
8
|
export const read: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
9
|
+
export const renderHooks: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
9
10
|
export const rewriteBlock: (a: number, b: number) => void;
|
|
10
11
|
export const satisfies: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
11
12
|
export const satisfiesRequirement: (a: number, b: number, c: number, d: number, e: number) => void;
|