@fermindi/pwn-cli 0.1.1 → 0.2.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.
Files changed (46) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +265 -251
  3. package/cli/batch.js +333 -333
  4. package/cli/codespaces.js +303 -303
  5. package/cli/index.js +98 -91
  6. package/cli/inject.js +78 -67
  7. package/cli/knowledge.js +531 -531
  8. package/cli/migrate.js +466 -0
  9. package/cli/notify.js +135 -135
  10. package/cli/patterns.js +665 -665
  11. package/cli/status.js +91 -91
  12. package/cli/validate.js +61 -61
  13. package/package.json +70 -70
  14. package/src/core/inject.js +208 -204
  15. package/src/core/state.js +91 -91
  16. package/src/core/validate.js +202 -202
  17. package/src/core/workspace.js +176 -176
  18. package/src/index.js +20 -20
  19. package/src/knowledge/gc.js +308 -308
  20. package/src/knowledge/lifecycle.js +401 -401
  21. package/src/knowledge/promote.js +364 -364
  22. package/src/knowledge/references.js +342 -342
  23. package/src/patterns/matcher.js +218 -218
  24. package/src/patterns/registry.js +375 -375
  25. package/src/patterns/triggers.js +423 -423
  26. package/src/services/batch-service.js +849 -849
  27. package/src/services/notification-service.js +342 -342
  28. package/templates/codespaces/devcontainer.json +52 -52
  29. package/templates/codespaces/setup.sh +70 -70
  30. package/templates/workspace/.ai/README.md +164 -164
  31. package/templates/workspace/.ai/agents/README.md +204 -204
  32. package/templates/workspace/.ai/agents/claude.md +625 -625
  33. package/templates/workspace/.ai/config/README.md +79 -79
  34. package/templates/workspace/.ai/config/notifications.template.json +20 -20
  35. package/templates/workspace/.ai/memory/deadends.md +79 -79
  36. package/templates/workspace/.ai/memory/decisions.md +58 -58
  37. package/templates/workspace/.ai/memory/patterns.md +65 -65
  38. package/templates/workspace/.ai/patterns/backend/README.md +126 -126
  39. package/templates/workspace/.ai/patterns/frontend/README.md +103 -103
  40. package/templates/workspace/.ai/patterns/index.md +256 -256
  41. package/templates/workspace/.ai/patterns/triggers.json +1087 -1087
  42. package/templates/workspace/.ai/patterns/universal/README.md +141 -141
  43. package/templates/workspace/.ai/state.template.json +8 -8
  44. package/templates/workspace/.ai/tasks/active.md +77 -77
  45. package/templates/workspace/.ai/tasks/backlog.md +95 -95
  46. 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
+ }