@fermindi/pwn-cli 0.1.1 ā 0.3.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/LICENSE +21 -21
- package/README.md +265 -251
- package/cli/batch.js +333 -333
- package/cli/codespaces.js +303 -303
- package/cli/index.js +112 -91
- package/cli/inject.js +90 -67
- package/cli/knowledge.js +531 -531
- package/cli/migrate.js +466 -0
- package/cli/notify.js +135 -135
- package/cli/patterns.js +665 -665
- package/cli/save.js +206 -0
- package/cli/status.js +91 -91
- package/cli/update.js +189 -0
- package/cli/validate.js +61 -61
- package/package.json +70 -70
- package/src/core/inject.js +300 -204
- package/src/core/state.js +91 -91
- package/src/core/validate.js +202 -202
- package/src/core/workspace.js +176 -176
- package/src/index.js +20 -20
- package/src/knowledge/gc.js +308 -308
- package/src/knowledge/lifecycle.js +401 -401
- package/src/knowledge/promote.js +364 -364
- package/src/knowledge/references.js +342 -342
- package/src/patterns/matcher.js +218 -218
- package/src/patterns/registry.js +375 -375
- package/src/patterns/triggers.js +423 -423
- package/src/services/batch-service.js +849 -849
- package/src/services/notification-service.js +342 -342
- package/templates/codespaces/devcontainer.json +52 -52
- package/templates/codespaces/setup.sh +70 -70
- package/templates/workspace/.ai/README.md +164 -164
- package/templates/workspace/.ai/agents/README.md +204 -204
- package/templates/workspace/.ai/agents/claude.md +625 -625
- package/templates/workspace/.ai/config/README.md +79 -79
- package/templates/workspace/.ai/config/notifications.template.json +20 -20
- package/templates/workspace/.ai/memory/deadends.md +79 -79
- package/templates/workspace/.ai/memory/decisions.md +58 -58
- package/templates/workspace/.ai/memory/patterns.md +65 -65
- package/templates/workspace/.ai/patterns/backend/README.md +126 -126
- package/templates/workspace/.ai/patterns/frontend/README.md +103 -103
- package/templates/workspace/.ai/patterns/index.md +256 -256
- package/templates/workspace/.ai/patterns/triggers.json +1087 -1087
- package/templates/workspace/.ai/patterns/universal/README.md +141 -141
- package/templates/workspace/.ai/state.template.json +8 -8
- package/templates/workspace/.ai/tasks/active.md +77 -77
- package/templates/workspace/.ai/tasks/backlog.md +95 -95
- package/templates/workspace/.ai/workflows/batch-task.md +356 -356
package/cli/notify.js
CHANGED
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import * as notifications from '../src/services/notification-service.js';
|
|
3
|
-
|
|
4
|
-
export default async function notifyCommand(args = []) {
|
|
5
|
-
const subcommand = args[0];
|
|
6
|
-
const restArgs = args.slice(1);
|
|
7
|
-
|
|
8
|
-
switch (subcommand) {
|
|
9
|
-
case 'test':
|
|
10
|
-
await testNotification(restArgs);
|
|
11
|
-
break;
|
|
12
|
-
|
|
13
|
-
case 'send':
|
|
14
|
-
await sendNotification(restArgs);
|
|
15
|
-
break;
|
|
16
|
-
|
|
17
|
-
case 'config':
|
|
18
|
-
showConfig();
|
|
19
|
-
break;
|
|
20
|
-
|
|
21
|
-
default:
|
|
22
|
-
showHelp();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Test notification channel
|
|
28
|
-
*/
|
|
29
|
-
async function testNotification(args) {
|
|
30
|
-
const channel = args[0] || 'desktop';
|
|
31
|
-
|
|
32
|
-
console.log(`š Testing ${channel} notifications...\n`);
|
|
33
|
-
|
|
34
|
-
const result = await notifications.test(channel);
|
|
35
|
-
|
|
36
|
-
if (result.success) {
|
|
37
|
-
console.log(`ā
${channel} notification sent successfully!`);
|
|
38
|
-
} else {
|
|
39
|
-
console.log(`ā ${channel} notification failed: ${result.error}`);
|
|
40
|
-
|
|
41
|
-
if (channel === 'ntfy' && result.error.includes('not configured')) {
|
|
42
|
-
console.log('\nš” To configure ntfy:');
|
|
43
|
-
console.log(' 1. Edit .ai/config/notifications.json');
|
|
44
|
-
console.log(' 2. Set channels.ntfy.enabled = true');
|
|
45
|
-
console.log(' 3. Set channels.ntfy.topic = "your-unique-topic"');
|
|
46
|
-
console.log(' 4. Subscribe to your topic at https://ntfy.sh/your-unique-topic');
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Send custom notification
|
|
53
|
-
*/
|
|
54
|
-
async function sendNotification(args) {
|
|
55
|
-
if (args.length === 0) {
|
|
56
|
-
console.log('ā Message required');
|
|
57
|
-
console.log(' Usage: pwn notify send "Your message" [--title "Title"] [--channel desktop]');
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Parse args
|
|
62
|
-
let message = '';
|
|
63
|
-
let title = 'PWN Notification';
|
|
64
|
-
let channel = undefined;
|
|
65
|
-
|
|
66
|
-
for (let i = 0; i < args.length; i++) {
|
|
67
|
-
if (args[i] === '--title' || args[i] === '-t') {
|
|
68
|
-
title = args[++i];
|
|
69
|
-
} else if (args[i] === '--channel' || args[i] === '-c') {
|
|
70
|
-
channel = args[++i];
|
|
71
|
-
} else if (!message) {
|
|
72
|
-
message = args[i];
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (!message) {
|
|
77
|
-
console.log('ā Message required');
|
|
78
|
-
process.exit(1);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
console.log(`š Sending notification...\n`);
|
|
82
|
-
|
|
83
|
-
const result = await notifications.send({ title, message }, { channel });
|
|
84
|
-
|
|
85
|
-
if (result.success) {
|
|
86
|
-
console.log(`ā
Notification sent via ${result.channel}`);
|
|
87
|
-
} else {
|
|
88
|
-
console.log(`ā Failed: ${result.error}`);
|
|
89
|
-
process.exit(1);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Show current configuration
|
|
95
|
-
*/
|
|
96
|
-
function showConfig() {
|
|
97
|
-
const config = notifications.loadConfig();
|
|
98
|
-
|
|
99
|
-
console.log('š Notification Configuration\n');
|
|
100
|
-
console.log(` Enabled: ${config.enabled ? 'Yes' : 'No'}`);
|
|
101
|
-
console.log(` Default Channel: ${config.defaultChannel}\n`);
|
|
102
|
-
console.log(' Channels:');
|
|
103
|
-
|
|
104
|
-
for (const [name, channelConfig] of Object.entries(config.channels)) {
|
|
105
|
-
const status = channelConfig.enabled ? 'ā' : 'ā';
|
|
106
|
-
console.log(` ${status} ${name}`);
|
|
107
|
-
|
|
108
|
-
if (name === 'ntfy' && channelConfig.enabled) {
|
|
109
|
-
console.log(` Server: ${channelConfig.server}`);
|
|
110
|
-
console.log(` Topic: ${channelConfig.topic || '(not set)'}`);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
console.log('\nš Config file: .ai/config/notifications.json');
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Show help
|
|
119
|
-
*/
|
|
120
|
-
function showHelp() {
|
|
121
|
-
console.log('š PWN Notifications\n');
|
|
122
|
-
console.log('Usage: pwn notify <command> [options]\n');
|
|
123
|
-
console.log('Commands:');
|
|
124
|
-
console.log(' test [channel] Test notifications (default: desktop)');
|
|
125
|
-
console.log(' send "message" [options] Send a notification');
|
|
126
|
-
console.log(' config Show current configuration\n');
|
|
127
|
-
console.log('Options for send:');
|
|
128
|
-
console.log(' --title, -t "Title" Set notification title');
|
|
129
|
-
console.log(' --channel, -c <name> Use specific channel (desktop, ntfy, pushover)\n');
|
|
130
|
-
console.log('Examples:');
|
|
131
|
-
console.log(' pwn notify test');
|
|
132
|
-
console.log(' pwn notify test ntfy');
|
|
133
|
-
console.log(' pwn notify send "Build complete!"');
|
|
134
|
-
console.log(' pwn notify send "Deploy done" --title "Production" --channel ntfy');
|
|
135
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as notifications from '../src/services/notification-service.js';
|
|
3
|
+
|
|
4
|
+
export default async function notifyCommand(args = []) {
|
|
5
|
+
const subcommand = args[0];
|
|
6
|
+
const restArgs = args.slice(1);
|
|
7
|
+
|
|
8
|
+
switch (subcommand) {
|
|
9
|
+
case 'test':
|
|
10
|
+
await testNotification(restArgs);
|
|
11
|
+
break;
|
|
12
|
+
|
|
13
|
+
case 'send':
|
|
14
|
+
await sendNotification(restArgs);
|
|
15
|
+
break;
|
|
16
|
+
|
|
17
|
+
case 'config':
|
|
18
|
+
showConfig();
|
|
19
|
+
break;
|
|
20
|
+
|
|
21
|
+
default:
|
|
22
|
+
showHelp();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Test notification channel
|
|
28
|
+
*/
|
|
29
|
+
async function testNotification(args) {
|
|
30
|
+
const channel = args[0] || 'desktop';
|
|
31
|
+
|
|
32
|
+
console.log(`š Testing ${channel} notifications...\n`);
|
|
33
|
+
|
|
34
|
+
const result = await notifications.test(channel);
|
|
35
|
+
|
|
36
|
+
if (result.success) {
|
|
37
|
+
console.log(`ā
${channel} notification sent successfully!`);
|
|
38
|
+
} else {
|
|
39
|
+
console.log(`ā ${channel} notification failed: ${result.error}`);
|
|
40
|
+
|
|
41
|
+
if (channel === 'ntfy' && result.error.includes('not configured')) {
|
|
42
|
+
console.log('\nš” To configure ntfy:');
|
|
43
|
+
console.log(' 1. Edit .ai/config/notifications.json');
|
|
44
|
+
console.log(' 2. Set channels.ntfy.enabled = true');
|
|
45
|
+
console.log(' 3. Set channels.ntfy.topic = "your-unique-topic"');
|
|
46
|
+
console.log(' 4. Subscribe to your topic at https://ntfy.sh/your-unique-topic');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Send custom notification
|
|
53
|
+
*/
|
|
54
|
+
async function sendNotification(args) {
|
|
55
|
+
if (args.length === 0) {
|
|
56
|
+
console.log('ā Message required');
|
|
57
|
+
console.log(' Usage: pwn notify send "Your message" [--title "Title"] [--channel desktop]');
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Parse args
|
|
62
|
+
let message = '';
|
|
63
|
+
let title = 'PWN Notification';
|
|
64
|
+
let channel = undefined;
|
|
65
|
+
|
|
66
|
+
for (let i = 0; i < args.length; i++) {
|
|
67
|
+
if (args[i] === '--title' || args[i] === '-t') {
|
|
68
|
+
title = args[++i];
|
|
69
|
+
} else if (args[i] === '--channel' || args[i] === '-c') {
|
|
70
|
+
channel = args[++i];
|
|
71
|
+
} else if (!message) {
|
|
72
|
+
message = args[i];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (!message) {
|
|
77
|
+
console.log('ā Message required');
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
console.log(`š Sending notification...\n`);
|
|
82
|
+
|
|
83
|
+
const result = await notifications.send({ title, message }, { channel });
|
|
84
|
+
|
|
85
|
+
if (result.success) {
|
|
86
|
+
console.log(`ā
Notification sent via ${result.channel}`);
|
|
87
|
+
} else {
|
|
88
|
+
console.log(`ā Failed: ${result.error}`);
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Show current configuration
|
|
95
|
+
*/
|
|
96
|
+
function showConfig() {
|
|
97
|
+
const config = notifications.loadConfig();
|
|
98
|
+
|
|
99
|
+
console.log('š Notification Configuration\n');
|
|
100
|
+
console.log(` Enabled: ${config.enabled ? 'Yes' : 'No'}`);
|
|
101
|
+
console.log(` Default Channel: ${config.defaultChannel}\n`);
|
|
102
|
+
console.log(' Channels:');
|
|
103
|
+
|
|
104
|
+
for (const [name, channelConfig] of Object.entries(config.channels)) {
|
|
105
|
+
const status = channelConfig.enabled ? 'ā' : 'ā';
|
|
106
|
+
console.log(` ${status} ${name}`);
|
|
107
|
+
|
|
108
|
+
if (name === 'ntfy' && channelConfig.enabled) {
|
|
109
|
+
console.log(` Server: ${channelConfig.server}`);
|
|
110
|
+
console.log(` Topic: ${channelConfig.topic || '(not set)'}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
console.log('\nš Config file: .ai/config/notifications.json');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Show help
|
|
119
|
+
*/
|
|
120
|
+
function showHelp() {
|
|
121
|
+
console.log('š PWN Notifications\n');
|
|
122
|
+
console.log('Usage: pwn notify <command> [options]\n');
|
|
123
|
+
console.log('Commands:');
|
|
124
|
+
console.log(' test [channel] Test notifications (default: desktop)');
|
|
125
|
+
console.log(' send "message" [options] Send a notification');
|
|
126
|
+
console.log(' config Show current configuration\n');
|
|
127
|
+
console.log('Options for send:');
|
|
128
|
+
console.log(' --title, -t "Title" Set notification title');
|
|
129
|
+
console.log(' --channel, -c <name> Use specific channel (desktop, ntfy, pushover)\n');
|
|
130
|
+
console.log('Examples:');
|
|
131
|
+
console.log(' pwn notify test');
|
|
132
|
+
console.log(' pwn notify test ntfy');
|
|
133
|
+
console.log(' pwn notify send "Build complete!"');
|
|
134
|
+
console.log(' pwn notify send "Deploy done" --title "Production" --channel ntfy');
|
|
135
|
+
}
|