@goodnesshq/opencode-notification 0.1.6 → 0.1.7
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/.opencode/notify-init.mjs +10 -15
- package/.opencode/oc-notify.schema.json +1 -1
- package/README.md +30 -12
- package/package.json +1 -1
- package/plugins/opencode-notifications.mjs +13 -18
|
@@ -20,7 +20,7 @@ const SCHEMA_SOURCE_PATH = join(SCRIPT_DIR, "oc-notify.schema.json");
|
|
|
20
20
|
const DEFAULTS = {
|
|
21
21
|
enabled: true,
|
|
22
22
|
title: "",
|
|
23
|
-
tier: "
|
|
23
|
+
tier: "focus",
|
|
24
24
|
detailLevel: "full",
|
|
25
25
|
responseComplete: {
|
|
26
26
|
enabled: true,
|
|
@@ -465,25 +465,20 @@ async function main() {
|
|
|
465
465
|
? await promptSelect({
|
|
466
466
|
message: "Select a tier:",
|
|
467
467
|
choices: [
|
|
468
|
-
{ name: "
|
|
469
|
-
{ name: "
|
|
470
|
-
{ name: "Verbose", value: "verbose" },
|
|
468
|
+
{ name: "Focus (requests + completion)", value: "focus" },
|
|
469
|
+
{ name: "Full (standard + failures + summary)", value: "full" },
|
|
471
470
|
{ name: "Custom", value: "custom" },
|
|
472
471
|
],
|
|
473
|
-
defaultValue: "
|
|
472
|
+
defaultValue: "focus",
|
|
474
473
|
})
|
|
475
474
|
: await (async () => {
|
|
476
|
-
console.log(
|
|
477
|
-
|
|
478
|
-
)
|
|
479
|
-
|
|
480
|
-
return tierInput.trim() === "1"
|
|
481
|
-
? "minimal"
|
|
475
|
+
console.log("\nSelect a tier:\n 1) Focus (requests + completion)\n 2) Full (standard + failures + summary)\n 3) Custom");
|
|
476
|
+
const tierInput = await rl.question("> [1] ");
|
|
477
|
+
return tierInput.trim() === "2"
|
|
478
|
+
? "full"
|
|
482
479
|
: tierInput.trim() === "3"
|
|
483
|
-
? "
|
|
484
|
-
:
|
|
485
|
-
? "custom"
|
|
486
|
-
: "standard";
|
|
480
|
+
? "custom"
|
|
481
|
+
: "focus";
|
|
487
482
|
})();
|
|
488
483
|
|
|
489
484
|
const trigger = interactive
|
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ The config is defined in `.opencode/oc-notify.schema.json` and supports:
|
|
|
32
32
|
|
|
33
33
|
- `enabled`: master switch
|
|
34
34
|
- `title`: override or template (supports `{repo}` and `{branch}`)
|
|
35
|
-
- `tier`: `
|
|
35
|
+
- `tier`: `focus` | `full` | `custom`
|
|
36
36
|
- `detailLevel`: `full` | `title-only`
|
|
37
37
|
- `responseComplete`: trigger for completion notifications
|
|
38
38
|
- `channels`: `mac` and `ntfy` settings
|
|
@@ -41,17 +41,16 @@ The config is defined in `.opencode/oc-notify.schema.json` and supports:
|
|
|
41
41
|
|
|
42
42
|
## Tier Defaults
|
|
43
43
|
|
|
44
|
-
- **
|
|
45
|
-
- **
|
|
46
|
-
- **verbose**: standard + `files`, `todos`, `vcs_worktree`, `pty`, `responses`
|
|
44
|
+
- **focus**: `action_required`
|
|
45
|
+
- **full**: `action_required`, `failures`, `change_summary`, `session_lifecycle`
|
|
47
46
|
|
|
48
47
|
## Example Configs
|
|
49
48
|
|
|
50
|
-
###
|
|
49
|
+
### Focus
|
|
51
50
|
```json
|
|
52
51
|
{
|
|
53
52
|
"enabled": true,
|
|
54
|
-
"tier": "
|
|
53
|
+
"tier": "focus",
|
|
55
54
|
"responseComplete": {
|
|
56
55
|
"enabled": true,
|
|
57
56
|
"trigger": "session.idle"
|
|
@@ -63,11 +62,11 @@ The config is defined in `.opencode/oc-notify.schema.json` and supports:
|
|
|
63
62
|
}
|
|
64
63
|
```
|
|
65
64
|
|
|
66
|
-
###
|
|
65
|
+
### Full
|
|
67
66
|
```json
|
|
68
67
|
{
|
|
69
68
|
"enabled": true,
|
|
70
|
-
"tier": "
|
|
69
|
+
"tier": "full",
|
|
71
70
|
"detailLevel": "full",
|
|
72
71
|
"responseComplete": {
|
|
73
72
|
"enabled": true,
|
|
@@ -76,23 +75,34 @@ The config is defined in `.opencode/oc-notify.schema.json` and supports:
|
|
|
76
75
|
}
|
|
77
76
|
```
|
|
78
77
|
|
|
79
|
-
###
|
|
78
|
+
### Custom (formerly verbose-style)
|
|
80
79
|
```json
|
|
81
80
|
{
|
|
82
81
|
"enabled": true,
|
|
83
|
-
"tier": "
|
|
82
|
+
"tier": "custom",
|
|
84
83
|
"responseComplete": {
|
|
85
84
|
"enabled": true,
|
|
86
85
|
"trigger": "message.part.updated"
|
|
87
86
|
},
|
|
88
87
|
"overrides": {
|
|
89
|
-
"includeGroups": [
|
|
88
|
+
"includeGroups": [
|
|
89
|
+
"action_required",
|
|
90
|
+
"failures",
|
|
91
|
+
"change_summary",
|
|
92
|
+
"session_lifecycle",
|
|
93
|
+
"files",
|
|
94
|
+
"todos",
|
|
95
|
+
"vcs_worktree",
|
|
96
|
+
"pty",
|
|
97
|
+
"responses",
|
|
98
|
+
"commands_tools"
|
|
99
|
+
],
|
|
90
100
|
"excludeGroups": []
|
|
91
101
|
}
|
|
92
102
|
}
|
|
93
103
|
```
|
|
94
104
|
|
|
95
|
-
### Custom
|
|
105
|
+
### Custom (curated)
|
|
96
106
|
```json
|
|
97
107
|
{
|
|
98
108
|
"enabled": true,
|
|
@@ -102,4 +112,12 @@ The config is defined in `.opencode/oc-notify.schema.json` and supports:
|
|
|
102
112
|
"excludeGroups": ["session_lifecycle"]
|
|
103
113
|
}
|
|
104
114
|
}
|
|
115
|
+
|
|
116
|
+
## Migration from legacy tiers
|
|
117
|
+
|
|
118
|
+
Legacy tiers `minimal`, `standard`, and `verbose` are no longer supported. Update existing configs before notifications resume:
|
|
119
|
+
|
|
120
|
+
- `minimal` -> `custom` with includeGroups: `action_required`, `failures`
|
|
121
|
+
- `standard` -> `full`
|
|
122
|
+
- `verbose` -> `custom` with includeGroups: `action_required`, `failures`, `change_summary`, `session_lifecycle`, `files`, `todos`, `vcs_worktree`, `pty`, `responses`
|
|
105
123
|
```
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ const DEFAULTS = {
|
|
|
10
10
|
version: 1,
|
|
11
11
|
enabled: true,
|
|
12
12
|
title: "",
|
|
13
|
-
tier: "
|
|
13
|
+
tier: "focus",
|
|
14
14
|
detailLevel: "full",
|
|
15
15
|
responseComplete: {
|
|
16
16
|
enabled: true,
|
|
@@ -71,19 +71,8 @@ const GROUPS = {
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
const TIER_GROUPS = {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
verbose: [
|
|
77
|
-
"action_required",
|
|
78
|
-
"failures",
|
|
79
|
-
"change_summary",
|
|
80
|
-
"session_lifecycle",
|
|
81
|
-
"files",
|
|
82
|
-
"todos",
|
|
83
|
-
"vcs_worktree",
|
|
84
|
-
"pty",
|
|
85
|
-
"responses",
|
|
86
|
-
],
|
|
74
|
+
focus: ["action_required"],
|
|
75
|
+
full: ["action_required", "failures", "change_summary", "session_lifecycle"],
|
|
87
76
|
custom: [],
|
|
88
77
|
};
|
|
89
78
|
|
|
@@ -118,8 +107,11 @@ function normalizeArray(value) {
|
|
|
118
107
|
}
|
|
119
108
|
|
|
120
109
|
function normalizeTier(value) {
|
|
121
|
-
if (
|
|
122
|
-
|
|
110
|
+
if (value === undefined || value === null) {
|
|
111
|
+
return { value: DEFAULTS.tier, valid: true };
|
|
112
|
+
}
|
|
113
|
+
if (typeof value !== "string") return { value, valid: false };
|
|
114
|
+
return TIER_GROUPS[value] ? { value, valid: true } : { value, valid: false };
|
|
123
115
|
}
|
|
124
116
|
|
|
125
117
|
function normalizeTrigger(value) {
|
|
@@ -147,11 +139,13 @@ function normalizeConfig(raw, globalConfig) {
|
|
|
147
139
|
globalConfig && typeof globalConfig === "object" && !Array.isArray(globalConfig)
|
|
148
140
|
? globalConfig
|
|
149
141
|
: {};
|
|
142
|
+
const tierInfo = normalizeTier(source.tier);
|
|
150
143
|
const config = {
|
|
151
144
|
version: DEFAULTS.version,
|
|
152
145
|
enabled: normalizeBool(source.enabled, DEFAULTS.enabled),
|
|
153
146
|
title: normalizeString(source.title, DEFAULTS.title),
|
|
154
|
-
tier:
|
|
147
|
+
tier: tierInfo.value,
|
|
148
|
+
tierValid: tierInfo.valid,
|
|
155
149
|
detailLevel: source.detailLevel === "title-only" ? "title-only" : "full",
|
|
156
150
|
responseComplete: {
|
|
157
151
|
enabled: normalizeBool(
|
|
@@ -196,7 +190,7 @@ function normalizeConfig(raw, globalConfig) {
|
|
|
196
190
|
}
|
|
197
191
|
|
|
198
192
|
function buildGroupSet(config) {
|
|
199
|
-
const baseGroups = TIER_GROUPS[config.tier] ??
|
|
193
|
+
const baseGroups = TIER_GROUPS[config.tier] ?? [];
|
|
200
194
|
const groupSet = new Set(baseGroups);
|
|
201
195
|
for (const group of config.overrides.includeGroups) {
|
|
202
196
|
if (GROUPS[group]) groupSet.add(group);
|
|
@@ -655,6 +649,7 @@ export default async function opencodeNotify(input) {
|
|
|
655
649
|
console.warn("[opencode-notifications] invalid config detected", repoConfig.errors);
|
|
656
650
|
}
|
|
657
651
|
if (!config.enabled) return;
|
|
652
|
+
if (!config.tierValid) return;
|
|
658
653
|
|
|
659
654
|
if (payload?.type === "vcs.branch.updated" && payload?.properties?.branch) {
|
|
660
655
|
cachedBranch = payload.properties.branch;
|