swarm-tickets 1.0.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.txt +21 -0
- package/README.md +238 -0
- package/SKILL.md +235 -0
- package/backup-tickets.sh +39 -0
- package/package.json +54 -0
- package/setup.js +60 -0
- package/ticket-cli.js +120 -0
- package/ticket-server.js +327 -0
- package/ticket-tracker.html +755 -0
- package/tickets.example.json +74 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Swarm Tickets
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# š« Swarm Tickets
|
|
2
|
+
|
|
3
|
+
Lightweight ticket tracking system designed for AI-powered bug fixing workflows with Claude-flow/Claude Code.
|
|
4
|
+
|
|
5
|
+
Track bugs, errors, and issues in a simple JSON file that both humans and AI agents can read and update. Perfect for projects where you want Claude to autonomously fix tickets.
|
|
6
|
+
|
|
7
|
+
## ⨠Features
|
|
8
|
+
|
|
9
|
+
- š **Simple JSON-based storage** - No database required
|
|
10
|
+
- š¤ **AI-friendly format** - Designed for Claude swarm workflows
|
|
11
|
+
- šØ **Beautiful web UI** - View and manage tickets in your browser
|
|
12
|
+
- š¾ **Automatic backups** - Never lose ticket history
|
|
13
|
+
- š§ **RESTful API** - Integrate with any tool
|
|
14
|
+
- āļø **Configurable labels** - Customize field names for your project
|
|
15
|
+
- š **Quick prompt generation** - Copy Claude-ready prompts with one click
|
|
16
|
+
- š **Auto port detection** - No conflicts with existing services
|
|
17
|
+
|
|
18
|
+
## š¦ Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install swarm-tickets
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
After installation, the package will automatically set up:
|
|
25
|
+
- `.claude/skills/swarm-tickets/` - Claude skill documentation
|
|
26
|
+
- `ticket-tracker.html` - Web interface (in your project root)
|
|
27
|
+
- `tickets.json` - Ticket storage file
|
|
28
|
+
|
|
29
|
+
## š Quick Start
|
|
30
|
+
|
|
31
|
+
### 1. Start the server
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx swarm-tickets
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
This starts the API server on port 3456 (or next available port).
|
|
38
|
+
|
|
39
|
+
### 2. Open the web UI
|
|
40
|
+
|
|
41
|
+
Navigate to `http://localhost:3456/ticket-tracker.html`
|
|
42
|
+
|
|
43
|
+
### 3. Create your first ticket
|
|
44
|
+
|
|
45
|
+
Use the web UI or API:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
curl -X POST http://localhost:3456/api/tickets \
|
|
49
|
+
-H "Content-Type: application/json" \
|
|
50
|
+
-d '{
|
|
51
|
+
"route": "/dashboard/users",
|
|
52
|
+
"f12Errors": "TypeError: Cannot read property...",
|
|
53
|
+
"serverErrors": "Error connecting to database",
|
|
54
|
+
"description": "User list not loading",
|
|
55
|
+
"status": "open"
|
|
56
|
+
}'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 4. Let Claude fix it
|
|
60
|
+
|
|
61
|
+
Click the "š Quick Prompt" button on any ticket, paste into Claude Code/flow, and watch it work!
|
|
62
|
+
|
|
63
|
+
## š¤ Using with Claude
|
|
64
|
+
|
|
65
|
+
The package includes a Claude skill that teaches Claude how to:
|
|
66
|
+
- Read and update tickets from `tickets.json`
|
|
67
|
+
- Set priorities and track related tickets
|
|
68
|
+
- Add swarm actions documenting fixes
|
|
69
|
+
- Update status as work progresses
|
|
70
|
+
|
|
71
|
+
Just reference the ticket ID in your prompt:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
Please investigate and fix ticket TKT-1234567890
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Claude will:
|
|
78
|
+
1. Read the ticket details from `tickets.json`
|
|
79
|
+
2. Investigate the errors
|
|
80
|
+
3. Fix the issue
|
|
81
|
+
4. Update the ticket with status and actions taken
|
|
82
|
+
|
|
83
|
+
## āļø Configuration
|
|
84
|
+
|
|
85
|
+
### Custom Project Name & Labels
|
|
86
|
+
|
|
87
|
+
Go to Settings in the web UI to customize:
|
|
88
|
+
- Project name
|
|
89
|
+
- Field labels (e.g., "Location" instead of "Route/Webpage")
|
|
90
|
+
- Error section names
|
|
91
|
+
- Quick prompt template
|
|
92
|
+
|
|
93
|
+
Settings are saved to localStorage and persist across sessions.
|
|
94
|
+
|
|
95
|
+
### Custom Port
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
PORT=4000 npx swarm-tickets
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Or the server will automatically find the next available port if 3456 is busy.
|
|
102
|
+
|
|
103
|
+
## š API Reference
|
|
104
|
+
|
|
105
|
+
### Get all tickets
|
|
106
|
+
```
|
|
107
|
+
GET /api/tickets
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Get single ticket
|
|
111
|
+
```
|
|
112
|
+
GET /api/tickets/:id
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Create ticket
|
|
116
|
+
```
|
|
117
|
+
POST /api/tickets
|
|
118
|
+
Content-Type: application/json
|
|
119
|
+
|
|
120
|
+
{
|
|
121
|
+
"route": "/page/path",
|
|
122
|
+
"f12Errors": "Browser console errors",
|
|
123
|
+
"serverErrors": "Server console errors",
|
|
124
|
+
"description": "Optional description",
|
|
125
|
+
"status": "open|in-progress|fixed|closed"
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Update ticket
|
|
130
|
+
```
|
|
131
|
+
PATCH /api/tickets/:id
|
|
132
|
+
Content-Type: application/json
|
|
133
|
+
|
|
134
|
+
{
|
|
135
|
+
"status": "fixed",
|
|
136
|
+
"priority": "high",
|
|
137
|
+
"namespace": "components/UserList",
|
|
138
|
+
"swarmActions": [...]
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Add swarm action
|
|
143
|
+
```
|
|
144
|
+
POST /api/tickets/:id/swarm-action
|
|
145
|
+
Content-Type: application/json
|
|
146
|
+
|
|
147
|
+
{
|
|
148
|
+
"action": "Fixed null reference in UserList component",
|
|
149
|
+
"result": "Tested and verified working"
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Delete ticket
|
|
154
|
+
```
|
|
155
|
+
DELETE /api/tickets/:id
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Get stats
|
|
159
|
+
```
|
|
160
|
+
GET /api/stats
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## š File Structure
|
|
164
|
+
|
|
165
|
+
After installation:
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
your-project/
|
|
169
|
+
āāā .claude/
|
|
170
|
+
ā āāā skills/
|
|
171
|
+
ā āāā swarm-tickets/
|
|
172
|
+
ā āāā SKILL.md # Claude skill documentation
|
|
173
|
+
āāā ticket-backups/ # Automatic backups (last 10)
|
|
174
|
+
āāā ticket-tracker.html # Web UI
|
|
175
|
+
āāā tickets.json # Your tickets
|
|
176
|
+
āāā node_modules/
|
|
177
|
+
āāā swarm-tickets/
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## š§ Local Development
|
|
181
|
+
|
|
182
|
+
Testing the package locally before publishing:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# In your test project
|
|
186
|
+
npm install /path/to/swarm-tickets
|
|
187
|
+
|
|
188
|
+
# If files weren't copied automatically (local install issue)
|
|
189
|
+
node node_modules/swarm-tickets/setup.js
|
|
190
|
+
|
|
191
|
+
# Start the server
|
|
192
|
+
npx swarm-tickets
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## šļø .gitignore
|
|
196
|
+
|
|
197
|
+
Add to your `.gitignore` if you don't want to commit tickets:
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
tickets.json
|
|
201
|
+
ticket-backups/
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## š License
|
|
205
|
+
|
|
206
|
+
MIT
|
|
207
|
+
|
|
208
|
+
## š¤ Contributing
|
|
209
|
+
|
|
210
|
+
Built for the Claude community! Issues and PRs welcome.
|
|
211
|
+
|
|
212
|
+
## š” Tips
|
|
213
|
+
|
|
214
|
+
- Use the **Quick Prompt** button to generate Claude-ready prompts
|
|
215
|
+
- Set **priorities** to help Claude focus on critical issues first
|
|
216
|
+
- Add **swarm actions** to document what was fixed and how
|
|
217
|
+
- Use **namespaces** to track which files/components were modified
|
|
218
|
+
- Link **related tickets** to help Claude understand patterns
|
|
219
|
+
|
|
220
|
+
## š Troubleshooting
|
|
221
|
+
|
|
222
|
+
### Postinstall script didn't run (local install)
|
|
223
|
+
```bash
|
|
224
|
+
node node_modules/swarm-tickets/setup.js
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Port 3456 is busy
|
|
228
|
+
The server will automatically find the next available port. Or set a custom port:
|
|
229
|
+
```bash
|
|
230
|
+
PORT=4000 npx swarm-tickets
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Files not showing up
|
|
234
|
+
Make sure you're in your project directory when running `npx swarm-tickets`. The server looks for `tickets.json` in the current directory.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
Made with ā¤ļø for Claude-powered development workflows
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Swarm Tickets
|
|
3
|
+
description: Track and manage bug tickets for swarm-based development. Use when working with project tickets, bugs, or when asked to check open issues, fix tickets, or update ticket status.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Swarm Tickets Skill
|
|
7
|
+
|
|
8
|
+
This skill enables you to track and manage bug tickets in the project.
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
The project uses `swarm-tickets` for bug tracking. Tickets are stored in `./tickets.json` at the project root.
|
|
13
|
+
|
|
14
|
+
## Ticket Structure
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"tickets": [
|
|
19
|
+
{
|
|
20
|
+
"id": "TKT-1234567890",
|
|
21
|
+
"route": "/dashboard/users",
|
|
22
|
+
"f12Errors": "Browser console errors",
|
|
23
|
+
"serverErrors": "Server-side errors",
|
|
24
|
+
"description": "Additional context",
|
|
25
|
+
"status": "open|in-progress|fixed|closed",
|
|
26
|
+
"priority": "critical|high|medium|low",
|
|
27
|
+
"relatedTickets": ["TKT-xxx"],
|
|
28
|
+
"swarmActions": [
|
|
29
|
+
{
|
|
30
|
+
"timestamp": "ISO timestamp",
|
|
31
|
+
"action": "What you did",
|
|
32
|
+
"result": "What happened"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"namespace": "where/fixes/applied",
|
|
36
|
+
"createdAt": "ISO timestamp",
|
|
37
|
+
"updatedAt": "ISO timestamp"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Working with Tickets
|
|
44
|
+
|
|
45
|
+
### Before You Start
|
|
46
|
+
|
|
47
|
+
Always create a backup before modifying tickets.json:
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
const fs = require('fs').promises;
|
|
51
|
+
await fs.copyFile('tickets.json', `tickets.backup.${Date.now()}.json`);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Reading Tickets
|
|
55
|
+
|
|
56
|
+
```javascript
|
|
57
|
+
const fs = require('fs').promises;
|
|
58
|
+
const data = JSON.parse(await fs.readFile('tickets.json', 'utf8'));
|
|
59
|
+
const tickets = data.tickets;
|
|
60
|
+
|
|
61
|
+
// Find open tickets
|
|
62
|
+
const openTickets = tickets.filter(t => t.status === 'open');
|
|
63
|
+
|
|
64
|
+
// Find high priority tickets
|
|
65
|
+
const highPriority = tickets.filter(t => t.priority === 'high' || t.priority === 'critical');
|
|
66
|
+
|
|
67
|
+
// Find tickets for a specific route
|
|
68
|
+
const routeTickets = tickets.filter(t => t.route.includes('/dashboard'));
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Updating Tickets
|
|
72
|
+
|
|
73
|
+
When working on a ticket:
|
|
74
|
+
|
|
75
|
+
```javascript
|
|
76
|
+
// 1. Set status to in-progress
|
|
77
|
+
ticket.status = 'in-progress';
|
|
78
|
+
|
|
79
|
+
// 2. Add a swarm action
|
|
80
|
+
ticket.swarmActions.push({
|
|
81
|
+
timestamp: new Date().toISOString(),
|
|
82
|
+
action: 'Investigating database connection error',
|
|
83
|
+
result: null
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// 3. Update timestamp
|
|
87
|
+
ticket.updatedAt = new Date().toISOString();
|
|
88
|
+
|
|
89
|
+
// 4. Write back
|
|
90
|
+
await fs.writeFile('tickets.json', JSON.stringify(data, null, 2));
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
When you fix a ticket:
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
ticket.status = 'fixed';
|
|
97
|
+
ticket.namespace = 'database/connection';
|
|
98
|
+
ticket.swarmActions.push({
|
|
99
|
+
timestamp: new Date().toISOString(),
|
|
100
|
+
action: 'Added connection retry logic and proper error handling',
|
|
101
|
+
result: 'Fixed - tested with 3 connection failures, all recovered successfully'
|
|
102
|
+
});
|
|
103
|
+
ticket.updatedAt = new Date().toISOString();
|
|
104
|
+
|
|
105
|
+
await fs.writeFile('tickets.json', JSON.stringify(data, null, 2));
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Setting Priority
|
|
109
|
+
|
|
110
|
+
Assign priority based on severity:
|
|
111
|
+
|
|
112
|
+
- **critical**: System down, auth broken, payment failures, data loss
|
|
113
|
+
- **high**: Major features broken, uncaught errors, crashes
|
|
114
|
+
- **medium**: Minor features broken, non-critical errors
|
|
115
|
+
- **low**: UI issues, warnings, optimization opportunities
|
|
116
|
+
|
|
117
|
+
```javascript
|
|
118
|
+
if (!ticket.priority) {
|
|
119
|
+
// Analyze errors and set priority
|
|
120
|
+
if (ticket.route.includes('auth') || ticket.route.includes('payment')) {
|
|
121
|
+
ticket.priority = 'critical';
|
|
122
|
+
} else if (ticket.serverErrors.includes('crash') || ticket.f12Errors.includes('Uncaught')) {
|
|
123
|
+
ticket.priority = 'high';
|
|
124
|
+
} else if (ticket.serverErrors.includes('Error') || ticket.f12Errors.includes('Error')) {
|
|
125
|
+
ticket.priority = 'medium';
|
|
126
|
+
} else {
|
|
127
|
+
ticket.priority = 'low';
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Linking Related Tickets
|
|
133
|
+
|
|
134
|
+
Find and link related tickets:
|
|
135
|
+
|
|
136
|
+
```javascript
|
|
137
|
+
// Find tickets on the same route
|
|
138
|
+
const related = tickets
|
|
139
|
+
.filter(t => t.id !== ticket.id && t.route === ticket.route)
|
|
140
|
+
.map(t => t.id);
|
|
141
|
+
|
|
142
|
+
if (related.length > 0) {
|
|
143
|
+
ticket.relatedTickets = related;
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Setting Namespace
|
|
148
|
+
|
|
149
|
+
Document where fixes were applied:
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
// Examples:
|
|
153
|
+
ticket.namespace = 'auth/login';
|
|
154
|
+
ticket.namespace = 'database/connection';
|
|
155
|
+
ticket.namespace = 'ui/dashboard';
|
|
156
|
+
ticket.namespace = 'api/users';
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Best Practices
|
|
160
|
+
|
|
161
|
+
1. **Always backup before modifying** - Copy tickets.json before changes
|
|
162
|
+
2. **Update timestamps** - Set `updatedAt` when changing tickets
|
|
163
|
+
3. **Log your actions** - Add entries to `swarmActions` for everything you do
|
|
164
|
+
4. **Set priorities** - Help triage by assigning priority levels
|
|
165
|
+
5. **Link related tickets** - Connect tickets that affect the same area
|
|
166
|
+
6. **Document namespaces** - Record where fixes were applied
|
|
167
|
+
7. **Be specific** - In swarm actions, explain what you did and why
|
|
168
|
+
|
|
169
|
+
## Workflow Example
|
|
170
|
+
|
|
171
|
+
```javascript
|
|
172
|
+
const fs = require('fs').promises;
|
|
173
|
+
|
|
174
|
+
// 1. Backup
|
|
175
|
+
await fs.copyFile('tickets.json', `tickets.backup.${Date.now()}.json`);
|
|
176
|
+
|
|
177
|
+
// 2. Read tickets
|
|
178
|
+
const data = JSON.parse(await fs.readFile('tickets.json', 'utf8'));
|
|
179
|
+
|
|
180
|
+
// 3. Find open tickets
|
|
181
|
+
const openTickets = data.tickets.filter(t => t.status === 'open');
|
|
182
|
+
|
|
183
|
+
// 4. Work on highest priority first
|
|
184
|
+
openTickets.sort((a, b) => {
|
|
185
|
+
const priority = { critical: 4, high: 3, medium: 2, low: 1 };
|
|
186
|
+
return (priority[b.priority] || 0) - (priority[a.priority] || 0);
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
// 5. Update ticket as you work
|
|
190
|
+
const ticket = openTickets[0];
|
|
191
|
+
ticket.status = 'in-progress';
|
|
192
|
+
ticket.swarmActions.push({
|
|
193
|
+
timestamp: new Date().toISOString(),
|
|
194
|
+
action: 'Started fixing database column issue',
|
|
195
|
+
result: null
|
|
196
|
+
});
|
|
197
|
+
ticket.updatedAt = new Date().toISOString();
|
|
198
|
+
|
|
199
|
+
// 6. Write back after each change
|
|
200
|
+
await fs.writeFile('tickets.json', JSON.stringify(data, null, 2));
|
|
201
|
+
|
|
202
|
+
// ... do the fix ...
|
|
203
|
+
|
|
204
|
+
// 7. Mark as fixed
|
|
205
|
+
ticket.status = 'fixed';
|
|
206
|
+
ticket.namespace = 'database/schema';
|
|
207
|
+
ticket.swarmActions.push({
|
|
208
|
+
timestamp: new Date().toISOString(),
|
|
209
|
+
action: 'Added missing org_id column to committees table',
|
|
210
|
+
result: 'Fixed - column added via migration, tested successfully'
|
|
211
|
+
});
|
|
212
|
+
ticket.updatedAt = new Date().toISOString();
|
|
213
|
+
|
|
214
|
+
await fs.writeFile('tickets.json', JSON.stringify(data, null, 2));
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## UI Access
|
|
218
|
+
|
|
219
|
+
Users can view and create tickets via the web UI:
|
|
220
|
+
|
|
221
|
+
- Start server: `npm start` (in project root or `npx swarm-tickets`)
|
|
222
|
+
- Open: http://localhost:3456/ticket-tracker.html
|
|
223
|
+
|
|
224
|
+
The UI allows users to:
|
|
225
|
+
- Create new tickets with F12 and server errors
|
|
226
|
+
- View all tickets with filtering and search
|
|
227
|
+
- See ticket status, priority, and swarm actions
|
|
228
|
+
|
|
229
|
+
## Notes
|
|
230
|
+
|
|
231
|
+
- Tickets persist in `tickets.json` at project root
|
|
232
|
+
- The server auto-backs up to `ticket-backups/` before writes (if running)
|
|
233
|
+
- Manual backups recommended: Copy tickets.json before major changes
|
|
234
|
+
- Recovery: Restore from `ticket-backups/` folder (keeps last 10)
|
|
235
|
+
- The UI and the swarm both work with the same `tickets.json` file
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Ticket tracker backup script
|
|
4
|
+
# Keeps last 20 backups, rotates automatically
|
|
5
|
+
|
|
6
|
+
BACKUP_DIR="./ticket-backups"
|
|
7
|
+
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
|
|
8
|
+
|
|
9
|
+
# Create backup directory if it doesn't exist
|
|
10
|
+
mkdir -p "$BACKUP_DIR"
|
|
11
|
+
|
|
12
|
+
# Check if tickets.json exists
|
|
13
|
+
if [ ! -f "tickets.json" ]; then
|
|
14
|
+
echo "ā tickets.json not found"
|
|
15
|
+
exit 1
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# Create backup
|
|
19
|
+
cp tickets.json "$BACKUP_DIR/tickets-$TIMESTAMP.json"
|
|
20
|
+
|
|
21
|
+
if [ $? -eq 0 ]; then
|
|
22
|
+
echo "ā
Backup created: $BACKUP_DIR/tickets-$TIMESTAMP.json"
|
|
23
|
+
else
|
|
24
|
+
echo "ā Backup failed"
|
|
25
|
+
exit 1
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# Keep only last 20 backups
|
|
29
|
+
BACKUP_COUNT=$(ls -1 "$BACKUP_DIR"/tickets-*.json 2>/dev/null | wc -l)
|
|
30
|
+
|
|
31
|
+
if [ "$BACKUP_COUNT" -gt 20 ]; then
|
|
32
|
+
REMOVE_COUNT=$((BACKUP_COUNT - 20))
|
|
33
|
+
ls -t "$BACKUP_DIR"/tickets-*.json | tail -n "$REMOVE_COUNT" | xargs rm
|
|
34
|
+
echo "šļø Removed $REMOVE_COUNT old backup(s)"
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
# Show backup count
|
|
38
|
+
FINAL_COUNT=$(ls -1 "$BACKUP_DIR"/tickets-*.json 2>/dev/null | wc -l)
|
|
39
|
+
echo "š¦ Total backups: $FINAL_COUNT"
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "swarm-tickets",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Lightweight ticket tracking system for AI-powered bug fixing with Claude-flow/Claude Code",
|
|
5
|
+
"main": "ticket-server.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"swarm-tickets": "./ticket-server.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "node ticket-server.js",
|
|
11
|
+
"ticket": "node ticket-cli.js",
|
|
12
|
+
"postinstall": "node setup.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"ticket-server.js",
|
|
16
|
+
"ticket-cli.js",
|
|
17
|
+
"ticket-tracker.html",
|
|
18
|
+
"backup-tickets.sh",
|
|
19
|
+
"tickets.example.json",
|
|
20
|
+
"setup.js",
|
|
21
|
+
"SKILL.md",
|
|
22
|
+
"README.md",
|
|
23
|
+
"LICENSE"
|
|
24
|
+
],
|
|
25
|
+
"keywords": [
|
|
26
|
+
"tickets",
|
|
27
|
+
"bug-tracker",
|
|
28
|
+
"issue-tracker",
|
|
29
|
+
"swarm",
|
|
30
|
+
"claude",
|
|
31
|
+
"claude-flow",
|
|
32
|
+
"claude-code",
|
|
33
|
+
"ai",
|
|
34
|
+
"automation",
|
|
35
|
+
"development-tools"
|
|
36
|
+
],
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"express": "^4.18.2",
|
|
39
|
+
"cors": "^2.8.5"
|
|
40
|
+
},
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/AIWhispererGal/swarm-tickets.git"
|
|
44
|
+
},
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/AIWhispererGal/swarm-tickets/issues"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://github.com/AIWhispererGal/swarm-tickets#readme",
|
|
49
|
+
"author": "AIWhispererGal and Claude Sonnet 4.5",
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=14.0.0"
|
|
53
|
+
}
|
|
54
|
+
}
|
package/setup.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
console.log('\nš« Setting up Swarm Tickets...\n');
|
|
7
|
+
|
|
8
|
+
// Get the project root (where package.json is)
|
|
9
|
+
const projectRoot = process.cwd();
|
|
10
|
+
|
|
11
|
+
// Create .claude/skills/swarm-tickets directory (correct location!)
|
|
12
|
+
const skillsDir = path.join(projectRoot, '.claude', 'skills', 'swarm-tickets');
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
// Create directories
|
|
16
|
+
fs.mkdirSync(skillsDir, { recursive: true });
|
|
17
|
+
console.log('ā
Created .claude/skills/swarm-tickets/');
|
|
18
|
+
|
|
19
|
+
// Copy SKILL.md to the skills directory
|
|
20
|
+
const skillSource = path.join(__dirname, 'SKILL.md');
|
|
21
|
+
const skillDest = path.join(skillsDir, 'SKILL.md');
|
|
22
|
+
|
|
23
|
+
if (fs.existsSync(skillSource)) {
|
|
24
|
+
fs.copyFileSync(skillSource, skillDest);
|
|
25
|
+
console.log('ā
Installed swarm skill');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Copy ticket-tracker.html to project root
|
|
29
|
+
const htmlSource = path.join(__dirname, 'ticket-tracker.html');
|
|
30
|
+
const htmlDest = path.join(projectRoot, 'ticket-tracker.html');
|
|
31
|
+
|
|
32
|
+
if (!fs.existsSync(htmlDest)) {
|
|
33
|
+
fs.copyFileSync(htmlSource, htmlDest);
|
|
34
|
+
console.log('ā
Copied ticket-tracker.html to project root');
|
|
35
|
+
} else {
|
|
36
|
+
console.log('ā ļø ticket-tracker.html already exists, skipping');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Create tickets.json if it doesn't exist
|
|
40
|
+
const ticketsFile = path.join(projectRoot, 'tickets.json');
|
|
41
|
+
if (!fs.existsSync(ticketsFile)) {
|
|
42
|
+
fs.writeFileSync(ticketsFile, JSON.stringify({ tickets: [] }, null, 2));
|
|
43
|
+
console.log('ā
Created tickets.json');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
console.log('\nš Setup complete!\n');
|
|
47
|
+
console.log('To start the ticket tracker:');
|
|
48
|
+
console.log(' npm start\n');
|
|
49
|
+
console.log('Then open: http://localhost:3456/ticket-tracker.html\n');
|
|
50
|
+
console.log('The swarm can now access tickets via ./tickets.json');
|
|
51
|
+
console.log('Skill documentation: .claude/skills/swarm-tickets/SKILL.md\n');
|
|
52
|
+
|
|
53
|
+
console.log('š Note: Add these to your .gitignore if you don\'t want to commit tickets:');
|
|
54
|
+
console.log(' tickets.json');
|
|
55
|
+
console.log(' ticket-backups/\n');
|
|
56
|
+
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.error('ā Setup failed:', error.message);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|