@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.
Files changed (48) 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 +112 -91
  6. package/cli/inject.js +90 -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/save.js +206 -0
  12. package/cli/status.js +91 -91
  13. package/cli/update.js +189 -0
  14. package/cli/validate.js +61 -61
  15. package/package.json +70 -70
  16. package/src/core/inject.js +300 -204
  17. package/src/core/state.js +91 -91
  18. package/src/core/validate.js +202 -202
  19. package/src/core/workspace.js +176 -176
  20. package/src/index.js +20 -20
  21. package/src/knowledge/gc.js +308 -308
  22. package/src/knowledge/lifecycle.js +401 -401
  23. package/src/knowledge/promote.js +364 -364
  24. package/src/knowledge/references.js +342 -342
  25. package/src/patterns/matcher.js +218 -218
  26. package/src/patterns/registry.js +375 -375
  27. package/src/patterns/triggers.js +423 -423
  28. package/src/services/batch-service.js +849 -849
  29. package/src/services/notification-service.js +342 -342
  30. package/templates/codespaces/devcontainer.json +52 -52
  31. package/templates/codespaces/setup.sh +70 -70
  32. package/templates/workspace/.ai/README.md +164 -164
  33. package/templates/workspace/.ai/agents/README.md +204 -204
  34. package/templates/workspace/.ai/agents/claude.md +625 -625
  35. package/templates/workspace/.ai/config/README.md +79 -79
  36. package/templates/workspace/.ai/config/notifications.template.json +20 -20
  37. package/templates/workspace/.ai/memory/deadends.md +79 -79
  38. package/templates/workspace/.ai/memory/decisions.md +58 -58
  39. package/templates/workspace/.ai/memory/patterns.md +65 -65
  40. package/templates/workspace/.ai/patterns/backend/README.md +126 -126
  41. package/templates/workspace/.ai/patterns/frontend/README.md +103 -103
  42. package/templates/workspace/.ai/patterns/index.md +256 -256
  43. package/templates/workspace/.ai/patterns/triggers.json +1087 -1087
  44. package/templates/workspace/.ai/patterns/universal/README.md +141 -141
  45. package/templates/workspace/.ai/state.template.json +8 -8
  46. package/templates/workspace/.ai/tasks/active.md +77 -77
  47. package/templates/workspace/.ai/tasks/backlog.md +95 -95
  48. package/templates/workspace/.ai/workflows/batch-task.md +356 -356
@@ -1,79 +1,79 @@
1
- # PWN Configuration
2
-
3
- This directory contains personal configuration files (git-ignored).
4
-
5
- ## notifications.json
6
-
7
- Configure how you receive notifications when tasks complete.
8
-
9
- ### Channels
10
-
11
- #### Desktop (default)
12
- Native OS notifications. Works out of the box on Windows, macOS, and Linux.
13
-
14
- ```json
15
- {
16
- "channels": {
17
- "desktop": {
18
- "enabled": true
19
- }
20
- }
21
- }
22
- ```
23
-
24
- #### ntfy.sh
25
- Free, open-source push notifications. Great for mobile alerts.
26
-
27
- ```json
28
- {
29
- "channels": {
30
- "ntfy": {
31
- "enabled": true,
32
- "server": "https://ntfy.sh",
33
- "topic": "pwn-abc12345",
34
- "priority": "default"
35
- }
36
- }
37
- }
38
- ```
39
-
40
- **Setup:**
41
- 1. A unique topic is auto-generated during `pwn inject`
42
- 2. Subscribe to your topic:
43
- - Browser: `https://ntfy.sh/YOUR_TOPIC`
44
- - Mobile: Install ntfy app and subscribe to your topic
45
- 3. Enable: set `enabled: true`
46
- 4. Test: `pwn notify test ntfy`
47
-
48
- **Privacy:** Topics are public by default. Your auto-generated topic uses a random ID making it hard to guess. For private topics, create an account at ntfy.sh or self-host.
49
-
50
- #### Pushover (paid)
51
- Premium push notification service with more features.
52
-
53
- ```json
54
- {
55
- "channels": {
56
- "pushover": {
57
- "enabled": true,
58
- "userKey": "your-user-key",
59
- "apiToken": "your-api-token"
60
- }
61
- }
62
- }
63
- ```
64
-
65
- ### Priority Levels
66
-
67
- - `low` - Silent, no sound
68
- - `default` - Normal notification
69
- - `high` - Important, may bypass DND
70
- - `urgent` - Critical, persistent alert
71
-
72
- ### Commands
73
-
74
- ```bash
75
- pwn notify test # Test default channel (desktop)
76
- pwn notify test ntfy # Test specific channel
77
- pwn notify send "Message" # Send custom notification
78
- pwn notify config # Show current configuration
79
- ```
1
+ # PWN Configuration
2
+
3
+ This directory contains personal configuration files (git-ignored).
4
+
5
+ ## notifications.json
6
+
7
+ Configure how you receive notifications when tasks complete.
8
+
9
+ ### Channels
10
+
11
+ #### Desktop (default)
12
+ Native OS notifications. Works out of the box on Windows, macOS, and Linux.
13
+
14
+ ```json
15
+ {
16
+ "channels": {
17
+ "desktop": {
18
+ "enabled": true
19
+ }
20
+ }
21
+ }
22
+ ```
23
+
24
+ #### ntfy.sh
25
+ Free, open-source push notifications. Great for mobile alerts.
26
+
27
+ ```json
28
+ {
29
+ "channels": {
30
+ "ntfy": {
31
+ "enabled": true,
32
+ "server": "https://ntfy.sh",
33
+ "topic": "pwn-abc12345",
34
+ "priority": "default"
35
+ }
36
+ }
37
+ }
38
+ ```
39
+
40
+ **Setup:**
41
+ 1. A unique topic is auto-generated during `pwn inject`
42
+ 2. Subscribe to your topic:
43
+ - Browser: `https://ntfy.sh/YOUR_TOPIC`
44
+ - Mobile: Install ntfy app and subscribe to your topic
45
+ 3. Enable: set `enabled: true`
46
+ 4. Test: `pwn notify test ntfy`
47
+
48
+ **Privacy:** Topics are public by default. Your auto-generated topic uses a random ID making it hard to guess. For private topics, create an account at ntfy.sh or self-host.
49
+
50
+ #### Pushover (paid)
51
+ Premium push notification service with more features.
52
+
53
+ ```json
54
+ {
55
+ "channels": {
56
+ "pushover": {
57
+ "enabled": true,
58
+ "userKey": "your-user-key",
59
+ "apiToken": "your-api-token"
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ ### Priority Levels
66
+
67
+ - `low` - Silent, no sound
68
+ - `default` - Normal notification
69
+ - `high` - Important, may bypass DND
70
+ - `urgent` - Critical, persistent alert
71
+
72
+ ### Commands
73
+
74
+ ```bash
75
+ pwn notify test # Test default channel (desktop)
76
+ pwn notify test ntfy # Test specific channel
77
+ pwn notify send "Message" # Send custom notification
78
+ pwn notify config # Show current configuration
79
+ ```
@@ -1,20 +1,20 @@
1
- {
2
- "enabled": true,
3
- "defaultChannel": "desktop",
4
- "channels": {
5
- "ntfy": {
6
- "enabled": false,
7
- "server": "https://ntfy.sh",
8
- "topic": "your-unique-topic-here",
9
- "priority": "default"
10
- },
11
- "desktop": {
12
- "enabled": true
13
- },
14
- "pushover": {
15
- "enabled": false,
16
- "userKey": "",
17
- "apiToken": ""
18
- }
19
- }
20
- }
1
+ {
2
+ "enabled": true,
3
+ "defaultChannel": "desktop",
4
+ "channels": {
5
+ "ntfy": {
6
+ "enabled": false,
7
+ "server": "https://ntfy.sh",
8
+ "topic": "your-unique-topic-here",
9
+ "priority": "default"
10
+ },
11
+ "desktop": {
12
+ "enabled": true
13
+ },
14
+ "pushover": {
15
+ "enabled": false,
16
+ "userKey": "",
17
+ "apiToken": ""
18
+ }
19
+ }
20
+ }
@@ -1,79 +1,79 @@
1
- # Failed Approaches & Dead Ends
2
-
3
- This file documents approaches that failed, to avoid repeating mistakes.
4
-
5
- ## Format
6
-
7
- Each dead end follows this structure:
8
-
9
- ```markdown
10
- ## DE-XXX: Failed Approach Title
11
- **Date:** YYYY-MM-DD
12
- **Attempted:** What we tried
13
- **Problem:** Why it failed
14
- **Solution:** What worked instead
15
- **Time Spent:** Approximate hours
16
- **Reference:** Related decision or issue
17
- ```
18
-
19
- ---
20
-
21
- ## Adding New Dead Ends
22
-
23
- When an approach fails:
24
-
25
- 1. Assign next DE number (DE-001, DE-002, etc.)
26
- 2. Fill in all sections while fresh in memory
27
- 3. Commit with message: `docs: add DE-XXX dead end`
28
- 4. Reference in code: `// See DE-XXX - why we don't use X`
29
-
30
- ---
31
-
32
- ## Categories
33
-
34
- - **Architecture:** Structural decisions that didn't work
35
- - **Performance:** Optimization attempts that backfired
36
- - **Dependencies:** Library choices that caused problems
37
- - **Testing:** Test strategies that were too brittle
38
- - **Integration:** External service integrations that failed
39
- - **Data Modeling:** Schema or object structure issues
40
- - **DevOps:** Deployment/infrastructure approaches
41
-
42
- ---
43
-
44
- ## Template for New Dead End
45
-
46
- ```markdown
47
- ## DE-XXX: [Title]
48
- **Date:** YYYY-MM-DD
49
- **Attempted:** (What we tried and why we thought it would work)
50
- **Problem:** (Why it failed - specific errors, limitations, etc.)
51
- **Solution:** (What we did instead - working approach)
52
- **Time Spent:** X hours
53
- **Reference:** (Link to related DEC, issue, or PR)
54
- ```
55
-
56
- ---
57
-
58
- ## Tips for Recording Dead Ends
59
-
60
- - Be honest about what failed
61
- - Include error messages and specific blockers
62
- - Document the solution for future reference
63
- - Note if this is a category-wide dead end or specific case
64
- - Update if you discover new info about why it failed
65
-
66
- ---
67
-
68
- ## Archiving
69
-
70
- Dead ends are archived to `/context/dead-ends/archive/` after:
71
- - 90 days with no new references
72
- - Superseded by later approaches
73
- - External changes (library update) invalidate the issue
74
-
75
- ---
76
-
77
- ## Current Backlog
78
-
79
- Document new dead ends as they occur. Keep the most recent 5-10 active.
1
+ # Failed Approaches & Dead Ends
2
+
3
+ This file documents approaches that failed, to avoid repeating mistakes.
4
+
5
+ ## Format
6
+
7
+ Each dead end follows this structure:
8
+
9
+ ```markdown
10
+ ## DE-XXX: Failed Approach Title
11
+ **Date:** YYYY-MM-DD
12
+ **Attempted:** What we tried
13
+ **Problem:** Why it failed
14
+ **Solution:** What worked instead
15
+ **Time Spent:** Approximate hours
16
+ **Reference:** Related decision or issue
17
+ ```
18
+
19
+ ---
20
+
21
+ ## Adding New Dead Ends
22
+
23
+ When an approach fails:
24
+
25
+ 1. Assign next DE number (DE-001, DE-002, etc.)
26
+ 2. Fill in all sections while fresh in memory
27
+ 3. Commit with message: `docs: add DE-XXX dead end`
28
+ 4. Reference in code: `// See DE-XXX - why we don't use X`
29
+
30
+ ---
31
+
32
+ ## Categories
33
+
34
+ - **Architecture:** Structural decisions that didn't work
35
+ - **Performance:** Optimization attempts that backfired
36
+ - **Dependencies:** Library choices that caused problems
37
+ - **Testing:** Test strategies that were too brittle
38
+ - **Integration:** External service integrations that failed
39
+ - **Data Modeling:** Schema or object structure issues
40
+ - **DevOps:** Deployment/infrastructure approaches
41
+
42
+ ---
43
+
44
+ ## Template for New Dead End
45
+
46
+ ```markdown
47
+ ## DE-XXX: [Title]
48
+ **Date:** YYYY-MM-DD
49
+ **Attempted:** (What we tried and why we thought it would work)
50
+ **Problem:** (Why it failed - specific errors, limitations, etc.)
51
+ **Solution:** (What we did instead - working approach)
52
+ **Time Spent:** X hours
53
+ **Reference:** (Link to related DEC, issue, or PR)
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Tips for Recording Dead Ends
59
+
60
+ - Be honest about what failed
61
+ - Include error messages and specific blockers
62
+ - Document the solution for future reference
63
+ - Note if this is a category-wide dead end or specific case
64
+ - Update if you discover new info about why it failed
65
+
66
+ ---
67
+
68
+ ## Archiving
69
+
70
+ Dead ends are archived to `/context/dead-ends/archive/` after:
71
+ - 90 days with no new references
72
+ - Superseded by later approaches
73
+ - External changes (library update) invalidate the issue
74
+
75
+ ---
76
+
77
+ ## Current Backlog
78
+
79
+ Document new dead ends as they occur. Keep the most recent 5-10 active.
@@ -1,58 +1,58 @@
1
- # Architectural Decisions
2
-
3
- This file tracks major architectural decisions made for this project.
4
-
5
- ## Format
6
-
7
- Each decision follows this structure:
8
-
9
- ```markdown
10
- ## DEC-XXX: Decision Title
11
- **Date:** YYYY-MM-DD
12
- **Status:** Active | Superseded | Deprecated
13
- **Context:** Why this decision was needed
14
- **Decision:** What was decided
15
- **Rationale:** Why this is the best choice
16
- **Impact:** What this affects
17
- **Alternatives Considered:** Other options we evaluated
18
- ```
19
-
20
- ---
21
-
22
- ## DEC-001: Example Decision
23
- **Date:** 2026-01-21
24
- **Status:** Active
25
- **Context:** (Describe the situation that required this decision)
26
- **Decision:** (State what was decided)
27
- **Rationale:** (Explain why this is the right choice)
28
- **Impact:** (List what this affects - files, patterns, dependencies)
29
- **Alternatives Considered:**
30
- - Option A: (why rejected)
31
- - Option B: (why rejected)
32
-
33
- ---
34
-
35
- ## Adding New Decisions
36
-
37
- When making significant architectural choices:
38
- 1. Assign next DEC number (DEC-002, DEC-003, etc.)
39
- 2. Fill in all sections
40
- 3. Commit with message: `docs: add DEC-XXX decision`
41
- 4. Reference in code comments: `// See DEC-XXX`
42
-
43
- ## Decision Categories
44
-
45
- - **Technology Choices:** Frameworks, libraries, tools
46
- - **Architecture Patterns:** How systems interact
47
- - **Data Models:** Database schemas, API contracts
48
- - **Security:** Authentication, authorization, encryption
49
- - **Performance:** Caching, optimization strategies
50
- - **DevOps:** Deployment, CI/CD, monitoring
51
-
52
- ## Superseding Decisions
53
-
54
- When a decision changes:
55
- 1. Update status to "Superseded"
56
- 2. Link to new decision: "Superseded by DEC-XXX"
57
- 3. Don't delete - keep for historical context
58
- 4. Move to `.ai/memory/archive/` after 90 days unused
1
+ # Architectural Decisions
2
+
3
+ This file tracks major architectural decisions made for this project.
4
+
5
+ ## Format
6
+
7
+ Each decision follows this structure:
8
+
9
+ ```markdown
10
+ ## DEC-XXX: Decision Title
11
+ **Date:** YYYY-MM-DD
12
+ **Status:** Active | Superseded | Deprecated
13
+ **Context:** Why this decision was needed
14
+ **Decision:** What was decided
15
+ **Rationale:** Why this is the best choice
16
+ **Impact:** What this affects
17
+ **Alternatives Considered:** Other options we evaluated
18
+ ```
19
+
20
+ ---
21
+
22
+ ## DEC-001: Example Decision
23
+ **Date:** 2026-01-21
24
+ **Status:** Active
25
+ **Context:** (Describe the situation that required this decision)
26
+ **Decision:** (State what was decided)
27
+ **Rationale:** (Explain why this is the right choice)
28
+ **Impact:** (List what this affects - files, patterns, dependencies)
29
+ **Alternatives Considered:**
30
+ - Option A: (why rejected)
31
+ - Option B: (why rejected)
32
+
33
+ ---
34
+
35
+ ## Adding New Decisions
36
+
37
+ When making significant architectural choices:
38
+ 1. Assign next DEC number (DEC-002, DEC-003, etc.)
39
+ 2. Fill in all sections
40
+ 3. Commit with message: `docs: add DEC-XXX decision`
41
+ 4. Reference in code comments: `// See DEC-XXX`
42
+
43
+ ## Decision Categories
44
+
45
+ - **Technology Choices:** Frameworks, libraries, tools
46
+ - **Architecture Patterns:** How systems interact
47
+ - **Data Models:** Database schemas, API contracts
48
+ - **Security:** Authentication, authorization, encryption
49
+ - **Performance:** Caching, optimization strategies
50
+ - **DevOps:** Deployment, CI/CD, monitoring
51
+
52
+ ## Superseding Decisions
53
+
54
+ When a decision changes:
55
+ 1. Update status to "Superseded"
56
+ 2. Link to new decision: "Superseded by DEC-XXX"
57
+ 3. Don't delete - keep for historical context
58
+ 4. Move to `.ai/memory/archive/` after 90 days unused
@@ -1,65 +1,65 @@
1
- # Codebase Patterns
2
-
3
- This file documents recurring patterns discovered during development.
4
-
5
- ## Format
6
-
7
- Each pattern follows this structure:
8
-
9
- ```markdown
10
- ## Pattern Category
11
-
12
- ### Pattern Name
13
- **Context:** When this pattern applies
14
- **Pattern:** Code example or description
15
- **Rationale:** Why this is the better approach
16
- **Example Location:** Where to find real examples
17
- ```
18
-
19
- ---
20
-
21
- ## Add New Patterns
22
-
23
- When you discover a useful pattern:
24
-
25
- 1. Identify the category (Frontend, Backend, Testing, etc.)
26
- 2. Fill in all sections
27
- 3. Add code example if possible
28
- 4. Commit with message: `docs: add pattern - [name]`
29
- 5. Update `patterns/index.md` if this should be auto-applied
30
-
31
- ---
32
-
33
- ## Pattern Categories
34
-
35
- - **Frontend:** React, TypeScript, styling, component patterns
36
- - **Backend:** API design, database queries, middleware
37
- - **Testing:** Unit tests, integration tests, fixtures
38
- - **Performance:** Caching, memoization, optimization
39
- - **Security:** Input validation, authentication, authorization
40
- - **Error Handling:** Exception patterns, recovery strategies
41
- - **Data Structures:** Modeling domain objects effectively
42
-
43
- ---
44
-
45
- ## Template for New Pattern
46
-
47
- ```markdown
48
- ## [Category]
49
-
50
- ### [Pattern Name]
51
- **Context:** (When to use this pattern)
52
- **Pattern:** (Description or code example)
53
- **Rationale:** (Why this is better)
54
- **Example Location:** (Where in codebase)
55
- ```
56
-
57
- ---
58
-
59
- ## Notes
60
-
61
- - Patterns should be language-agnostic when possible
62
- - Prioritize patterns that prevent common bugs
63
- - Link related patterns together
64
- - Update this file as team learns new approaches
65
- - Archive rarely-used patterns after 3 months of no references
1
+ # Codebase Patterns
2
+
3
+ This file documents recurring patterns discovered during development.
4
+
5
+ ## Format
6
+
7
+ Each pattern follows this structure:
8
+
9
+ ```markdown
10
+ ## Pattern Category
11
+
12
+ ### Pattern Name
13
+ **Context:** When this pattern applies
14
+ **Pattern:** Code example or description
15
+ **Rationale:** Why this is the better approach
16
+ **Example Location:** Where to find real examples
17
+ ```
18
+
19
+ ---
20
+
21
+ ## Add New Patterns
22
+
23
+ When you discover a useful pattern:
24
+
25
+ 1. Identify the category (Frontend, Backend, Testing, etc.)
26
+ 2. Fill in all sections
27
+ 3. Add code example if possible
28
+ 4. Commit with message: `docs: add pattern - [name]`
29
+ 5. Update `patterns/index.md` if this should be auto-applied
30
+
31
+ ---
32
+
33
+ ## Pattern Categories
34
+
35
+ - **Frontend:** React, TypeScript, styling, component patterns
36
+ - **Backend:** API design, database queries, middleware
37
+ - **Testing:** Unit tests, integration tests, fixtures
38
+ - **Performance:** Caching, memoization, optimization
39
+ - **Security:** Input validation, authentication, authorization
40
+ - **Error Handling:** Exception patterns, recovery strategies
41
+ - **Data Structures:** Modeling domain objects effectively
42
+
43
+ ---
44
+
45
+ ## Template for New Pattern
46
+
47
+ ```markdown
48
+ ## [Category]
49
+
50
+ ### [Pattern Name]
51
+ **Context:** (When to use this pattern)
52
+ **Pattern:** (Description or code example)
53
+ **Rationale:** (Why this is better)
54
+ **Example Location:** (Where in codebase)
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Notes
60
+
61
+ - Patterns should be language-agnostic when possible
62
+ - Prioritize patterns that prevent common bugs
63
+ - Link related patterns together
64
+ - Update this file as team learns new approaches
65
+ - Archive rarely-used patterns after 3 months of no references