planflow-plugin 0.1.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 (66) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +93 -0
  3. package/bin/cli.js +169 -0
  4. package/bin/postinstall.js +87 -0
  5. package/commands/pfActivity/SKILL.md +725 -0
  6. package/commands/pfAssign/SKILL.md +623 -0
  7. package/commands/pfCloudLink/SKILL.md +192 -0
  8. package/commands/pfCloudList/SKILL.md +222 -0
  9. package/commands/pfCloudNew/SKILL.md +187 -0
  10. package/commands/pfCloudUnlink/SKILL.md +152 -0
  11. package/commands/pfComment/SKILL.md +227 -0
  12. package/commands/pfComments/SKILL.md +159 -0
  13. package/commands/pfConnectionStatus/SKILL.md +433 -0
  14. package/commands/pfDiscord/SKILL.md +740 -0
  15. package/commands/pfGithubBranch/SKILL.md +672 -0
  16. package/commands/pfGithubIssue/SKILL.md +963 -0
  17. package/commands/pfGithubLink/SKILL.md +859 -0
  18. package/commands/pfGithubPr/SKILL.md +1335 -0
  19. package/commands/pfGithubUnlink/SKILL.md +401 -0
  20. package/commands/pfLive/SKILL.md +185 -0
  21. package/commands/pfLogin/SKILL.md +249 -0
  22. package/commands/pfLogout/SKILL.md +155 -0
  23. package/commands/pfMyTasks/SKILL.md +198 -0
  24. package/commands/pfNotificationSettings/SKILL.md +619 -0
  25. package/commands/pfNotifications/SKILL.md +420 -0
  26. package/commands/pfNotificationsClear/SKILL.md +421 -0
  27. package/commands/pfReact/SKILL.md +232 -0
  28. package/commands/pfSlack/SKILL.md +659 -0
  29. package/commands/pfSyncPull/SKILL.md +210 -0
  30. package/commands/pfSyncPush/SKILL.md +299 -0
  31. package/commands/pfSyncStatus/SKILL.md +212 -0
  32. package/commands/pfTeamInvite/SKILL.md +161 -0
  33. package/commands/pfTeamList/SKILL.md +253 -0
  34. package/commands/pfTeamRemove/SKILL.md +115 -0
  35. package/commands/pfTeamRole/SKILL.md +160 -0
  36. package/commands/pfTestWebhooks/SKILL.md +722 -0
  37. package/commands/pfUnassign/SKILL.md +134 -0
  38. package/commands/pfWhoami/SKILL.md +258 -0
  39. package/commands/pfWorkload/SKILL.md +219 -0
  40. package/commands/planExportCsv/SKILL.md +106 -0
  41. package/commands/planExportGithub/SKILL.md +222 -0
  42. package/commands/planExportJson/SKILL.md +159 -0
  43. package/commands/planExportSummary/SKILL.md +158 -0
  44. package/commands/planNew/SKILL.md +641 -0
  45. package/commands/planNext/SKILL.md +1200 -0
  46. package/commands/planSettingsAutoSync/SKILL.md +199 -0
  47. package/commands/planSettingsLanguage/SKILL.md +201 -0
  48. package/commands/planSettingsReset/SKILL.md +237 -0
  49. package/commands/planSettingsShow/SKILL.md +482 -0
  50. package/commands/planSpec/SKILL.md +929 -0
  51. package/commands/planUpdate/SKILL.md +2518 -0
  52. package/commands/team/SKILL.md +740 -0
  53. package/locales/en.json +1499 -0
  54. package/locales/ka.json +1499 -0
  55. package/package.json +48 -0
  56. package/templates/PROJECT_PLAN.template.md +157 -0
  57. package/templates/backend-api.template.md +562 -0
  58. package/templates/frontend-spa.template.md +610 -0
  59. package/templates/fullstack.template.md +397 -0
  60. package/templates/ka/backend-api.template.md +562 -0
  61. package/templates/ka/frontend-spa.template.md +610 -0
  62. package/templates/ka/fullstack.template.md +397 -0
  63. package/templates/sections/architecture.md +21 -0
  64. package/templates/sections/overview.md +15 -0
  65. package/templates/sections/tasks.md +22 -0
  66. package/templates/sections/tech-stack.md +19 -0
@@ -0,0 +1,433 @@
1
+ # PlanFlow Connection Status
2
+
3
+ Show the current WebSocket connection status with detailed information about connectivity, team presence, and real-time features.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ /pfConnectionStatus
9
+ ```
10
+
11
+ No arguments required.
12
+
13
+ ## Process
14
+
15
+ ### Step 0: Load User Language & Translations
16
+
17
+ **CRITICAL: Execute this step FIRST, before any output!**
18
+
19
+ Load user's language preference and translations.
20
+
21
+ **Pseudo-code:**
22
+ ```javascript
23
+ function getMergedConfig() {
24
+ let globalConfig = {}
25
+ let localConfig = {}
26
+
27
+ const globalPath = expandPath("~/.config/claude/plan-plugin-config.json")
28
+ if (fileExists(globalPath)) {
29
+ try { globalConfig = JSON.parse(readFile(globalPath)) } catch (e) {}
30
+ }
31
+
32
+ if (fileExists("./.plan-config.json")) {
33
+ try { localConfig = JSON.parse(readFile("./.plan-config.json")) } catch (e) {}
34
+ }
35
+
36
+ return {
37
+ ...globalConfig,
38
+ ...localConfig,
39
+ cloud: {
40
+ ...(globalConfig.cloud || {}),
41
+ ...(localConfig.cloud || {})
42
+ }
43
+ }
44
+ }
45
+
46
+ const config = getMergedConfig()
47
+ const language = config.language || "en"
48
+ const cloudConfig = config.cloud || {}
49
+ const t = JSON.parse(readFile(`locales/${language}.json`))
50
+ ```
51
+
52
+ ### Step 1: Check Authentication
53
+
54
+ Verify user is authenticated before showing connection status.
55
+
56
+ **Pseudo-code:**
57
+ ```javascript
58
+ const isAuthenticated = !!cloudConfig.apiToken
59
+ const isLinked = !!cloudConfig.projectId
60
+
61
+ if (!isAuthenticated) {
62
+ console.log(t.commands.whoami.notLoggedIn)
63
+ console.log(t.commands.whoami.loginHint)
64
+ return
65
+ }
66
+
67
+ if (!isLinked) {
68
+ console.log(t.commands.sync.notLinked)
69
+ return
70
+ }
71
+ ```
72
+
73
+ ### Step 2: Read WebSocket State
74
+
75
+ Read the current connection state from the state file.
76
+
77
+ **Bash Implementation:**
78
+ ```bash
79
+ STATE_FILE="${HOME}/.planflow-ws-state.json"
80
+
81
+ if [ -f "$STATE_FILE" ]; then
82
+ STATE=$(jq -r '.state // "disconnected"' "$STATE_FILE")
83
+ CONNECTED_AT=$(jq -r '.connectedAt // null' "$STATE_FILE")
84
+ LAST_PING=$(jq -r '.lastPing // null' "$STATE_FILE")
85
+ LAST_PONG=$(jq -r '.lastPong // null' "$STATE_FILE")
86
+ RETRY_COUNT=$(jq -r '.retryCount // 0' "$STATE_FILE")
87
+ PRESENCE_TASK=$(jq -r '.presence.taskId // null' "$STATE_FILE")
88
+ PRESENCE_NAME=$(jq -r '.presence.taskName // null' "$STATE_FILE")
89
+ FALLBACK=$(jq -r '.fallback // false' "$STATE_FILE")
90
+ else
91
+ STATE="disconnected"
92
+ CONNECTED_AT="null"
93
+ RETRY_COUNT="0"
94
+ FALLBACK="false"
95
+ fi
96
+ ```
97
+
98
+ ### Step 3: Fetch Team Online Status (Optional)
99
+
100
+ If connected, fetch how many team members are online.
101
+
102
+ **Bash Implementation:**
103
+ ```bash
104
+ API_URL="https://api.planflow.tools"
105
+ TOKEN="$API_TOKEN"
106
+ PROJECT_ID="$PROJECT_ID"
107
+
108
+ TEAM_ONLINE=0
109
+
110
+ if [ "$STATE" = "connected" ] || [ "$STATE" = "polling" ]; then
111
+ RESPONSE=$(curl -s --connect-timeout 3 --max-time 5 \
112
+ -X GET \
113
+ -H "Accept: application/json" \
114
+ -H "Authorization: Bearer $TOKEN" \
115
+ "${API_URL}/projects/${PROJECT_ID}/presence" 2>/dev/null)
116
+
117
+ if [ $? -eq 0 ]; then
118
+ TEAM_ONLINE=$(echo "$RESPONSE" | jq -r '.data.online // 0' 2>/dev/null || echo "0")
119
+ fi
120
+ fi
121
+ ```
122
+
123
+ ### Step 4: Display Connection Status
124
+
125
+ Show a detailed status card with all connection information.
126
+
127
+ **Output Format:**
128
+
129
+ ```
130
+ ╭──────────────────────────────────────────────────────────────────────────────╮
131
+ │ 🔌 Connection Status │
132
+ ├──────────────────────────────────────────────────────────────────────────────┤
133
+ │ │
134
+ │ ── Real-time Connection ────────────────────────────────────────────────── │
135
+ │ │
136
+ │ Status: đŸŸĸ Connected to PlanFlow │
137
+ │ Connected: 15 minutes ago │
138
+ │ Last Ping: 5 seconds ago │
139
+ │ Team Online: 3 members │
140
+ │ │
141
+ │ ── Your Presence ───────────────────────────────────────────────────────── │
142
+ │ │
143
+ │ Status: Working on T12.4 │
144
+ │ Since: 10 minutes ago │
145
+ │ │
146
+ │ ── Connection Details ──────────────────────────────────────────────────── │
147
+ │ │
148
+ │ Mode: WebSocket (real-time) │
149
+ │ Server: wss://api.planflow.tools/ws │
150
+ │ Project: Plan Flow Plugin │
151
+ │ │
152
+ ├──────────────────────────────────────────────────────────────────────────────┤
153
+ │ │
154
+ │ 💡 Real-time features active: │
155
+ │ â€ĸ Task updates broadcast to team │
156
+ │ â€ĸ Presence status visible to teammates │
157
+ │ â€ĸ Instant notifications │
158
+ │ │
159
+ ╰──────────────────────────────────────────────────────────────────────────────╯
160
+ ```
161
+
162
+ **State-Specific Displays:**
163
+
164
+ #### Connected State (đŸŸĸ)
165
+ ```
166
+ Status: đŸŸĸ Connected to PlanFlow
167
+ Connected: {time_ago}
168
+ Last Ping: {time_ago}
169
+ Team Online: {count} members
170
+ ```
171
+
172
+ #### Connecting State (🟡)
173
+ ```
174
+ Status: 🟡 Connecting to real-time server...
175
+
176
+ âŗ Please wait...
177
+ ```
178
+
179
+ #### Reconnecting State (🟡)
180
+ ```
181
+ Status: 🟡 Reconnecting (attempt {n}/{max})...
182
+
183
+ Connection was lost. Attempting to reconnect...
184
+ ```
185
+
186
+ #### Polling State (🟡)
187
+ ```
188
+ Status: 🟡 Polling mode (WebSocket unavailable)
189
+ Last Poll: {time_ago}
190
+ Poll Interval: 30 seconds
191
+
192
+ âš ī¸ Limited real-time features
193
+ WebSocket tools not installed.
194
+
195
+ 💡 For full real-time support, install websocat:
196
+ macOS: brew install websocat
197
+ Linux: cargo install websocat
198
+ ```
199
+
200
+ #### Failed State (🔴)
201
+ ```
202
+ Status: 🔴 Connection failed
203
+
204
+ Unable to connect after {n} attempts.
205
+ Last Error: {error_message}
206
+
207
+ 💡 To reconnect:
208
+ /pfReconnect
209
+
210
+ 💡 Check your network connection and try again.
211
+ ```
212
+
213
+ #### Disconnected/Offline State (âšĒ)
214
+ ```
215
+ Status: âšĒ Offline
216
+
217
+ Not connected to real-time server.
218
+
219
+ 💡 Real-time features are disabled:
220
+ â€ĸ Task updates won't be broadcast
221
+ â€ĸ You won't see team activity live
222
+ â€ĸ Changes will sync on next command
223
+
224
+ 💡 To connect:
225
+ Run any cloud command to auto-connect
226
+ ```
227
+
228
+ ### Step 5: Show Offline Queue (if applicable)
229
+
230
+ If there are queued messages, show them.
231
+
232
+ **Bash Implementation:**
233
+ ```bash
234
+ QUEUE_FILE="${HOME}/.planflow-offline-queue.json"
235
+
236
+ if [ -f "$QUEUE_FILE" ]; then
237
+ QUEUE_COUNT=$(jq -r '.messages | length' "$QUEUE_FILE" 2>/dev/null || echo "0")
238
+
239
+ if [ "$QUEUE_COUNT" -gt 0 ]; then
240
+ echo ""
241
+ echo "📤 Offline Queue: $QUEUE_COUNT messages pending"
242
+ echo " These will be sent when connection is restored."
243
+ fi
244
+ fi
245
+ ```
246
+
247
+ ## Translation Keys
248
+
249
+ Use these translation keys from `locales/{language}.json`:
250
+
251
+ ```javascript
252
+ // Status display
253
+ t.skills.websocket.connected // "Connected to PlanFlow"
254
+ t.skills.websocket.connecting // "Connecting to real-time server..."
255
+ t.skills.websocket.reconnecting // "Reconnecting (attempt {count}/{max})..."
256
+ t.skills.websocket.disconnected // "Offline"
257
+ t.skills.websocket.failed // "Connection failed"
258
+ t.skills.websocket.polling // "Polling mode (WebSocket unavailable)"
259
+
260
+ // Status with emoji
261
+ t.skills.websocket.status.online // "đŸŸĸ Online"
262
+ t.skills.websocket.status.connecting // "🟡 Connecting"
263
+ t.skills.websocket.status.reconnecting // "🟡 Reconnecting"
264
+ t.skills.websocket.status.polling // "🟡 Polling"
265
+ t.skills.websocket.status.offline // "âšĒ Offline"
266
+ t.skills.websocket.status.failed // "🔴 Failed"
267
+
268
+ // Presence
269
+ t.skills.websocket.workingOn // "Working on {taskId}"
270
+ t.skills.websocket.idle // "Idle"
271
+
272
+ // Team
273
+ t.skills.websocket.teamOnline // "{count} team members online"
274
+
275
+ // Hints
276
+ t.skills.websocket.reconnectHint // "Run /pfReconnect to retry connection."
277
+ t.skills.websocket.offlineMode // "Offline — changes will sync when connected"
278
+ t.skills.websocket.installWebsocat // "For real-time features, install websocat:"
279
+ t.skills.websocket.installMac // "brew install websocat"
280
+ t.skills.websocket.installLinux // "cargo install websocat"
281
+ t.skills.websocket.pollingFallback // "Using polling fallback (30s interval)"
282
+
283
+ // Queue
284
+ t.skills.websocket.queuedMessages // "{count} messages queued"
285
+ ```
286
+
287
+ ## Time Formatting
288
+
289
+ Format timestamps as relative time:
290
+
291
+ ```javascript
292
+ function formatTimeAgo(timestamp) {
293
+ if (!timestamp || timestamp === "null") return "Never"
294
+
295
+ const now = new Date()
296
+ const then = new Date(timestamp)
297
+ const seconds = Math.floor((now - then) / 1000)
298
+
299
+ if (seconds < 60) return "just now"
300
+ if (seconds < 3600) return `${Math.floor(seconds / 60)} min ago`
301
+ if (seconds < 86400) return `${Math.floor(seconds / 3600)} hours ago`
302
+ return `${Math.floor(seconds / 86400)} days ago`
303
+ }
304
+ ```
305
+
306
+ ## Error Handling
307
+
308
+ ### Network Error
309
+ ```
310
+ âš ī¸ Could not fetch connection details.
311
+ Using cached state information.
312
+ ```
313
+
314
+ ### State File Missing
315
+ ```
316
+ â„šī¸ No connection history found.
317
+ Real-time features haven't been used yet.
318
+
319
+ 💡 Run any cloud command to establish connection.
320
+ ```
321
+
322
+ ## Complete Example Output
323
+
324
+ ### Example 1: Connected with Presence
325
+
326
+ ```
327
+ ╭──────────────────────────────────────────────────────────────────────────────╮
328
+ │ 🔌 Connection Status │
329
+ ├──────────────────────────────────────────────────────────────────────────────┤
330
+ │ │
331
+ │ ── Real-time Connection ────────────────────────────────────────────────── │
332
+ │ │
333
+ │ Status: đŸŸĸ Connected to PlanFlow │
334
+ │ Connected: 15 min ago │
335
+ │ Last Ping: 5 sec ago │
336
+ │ Team Online: 3 members │
337
+ │ │
338
+ │ ── Your Presence ───────────────────────────────────────────────────────── │
339
+ │ │
340
+ │ Working on: T12.4 - Add connection status indicator │
341
+ │ Since: 10 min ago │
342
+ │ │
343
+ │ ── Connection Details ──────────────────────────────────────────────────── │
344
+ │ │
345
+ │ Mode: WebSocket (real-time) │
346
+ │ Server: wss://api.planflow.tools/ws │
347
+ │ Project: Plan Flow Plugin │
348
+ │ │
349
+ ├──────────────────────────────────────────────────────────────────────────────┤
350
+ │ │
351
+ │ 💡 Real-time features active: │
352
+ │ â€ĸ Task updates broadcast to team │
353
+ │ â€ĸ Presence status visible to teammates │
354
+ │ â€ĸ Instant notifications │
355
+ │ │
356
+ ╰──────────────────────────────────────────────────────────────────────────────╯
357
+ ```
358
+
359
+ ### Example 2: Offline with Queue
360
+
361
+ ```
362
+ ╭──────────────────────────────────────────────────────────────────────────────╮
363
+ │ 🔌 Connection Status │
364
+ ├──────────────────────────────────────────────────────────────────────────────┤
365
+ │ │
366
+ │ ── Real-time Connection ────────────────────────────────────────────────── │
367
+ │ │
368
+ │ Status: âšĒ Offline │
369
+ │ Last Online: 2 hours ago │
370
+ │ │
371
+ │ ── Offline Queue ───────────────────────────────────────────────────────── │
372
+ │ │
373
+ │ 📤 3 messages queued │
374
+ │ These will be sent when connection is restored. │
375
+ │ │
376
+ ├──────────────────────────────────────────────────────────────────────────────┤
377
+ │ │
378
+ │ 💡 To reconnect: │
379
+ │ Run any cloud command to auto-connect │
380
+ │ │
381
+ │ âš ī¸ While offline: │
382
+ │ â€ĸ Task updates won't be broadcast │
383
+ │ â€ĸ You won't see team activity live │
384
+ │ â€ĸ Changes are queued for sync │
385
+ │ │
386
+ ╰──────────────────────────────────────────────────────────────────────────────╯
387
+ ```
388
+
389
+ ### Example 3: Polling Fallback
390
+
391
+ ```
392
+ ╭──────────────────────────────────────────────────────────────────────────────╮
393
+ │ 🔌 Connection Status │
394
+ ├──────────────────────────────────────────────────────────────────────────────┤
395
+ │ │
396
+ │ ── Real-time Connection ────────────────────────────────────────────────── │
397
+ │ │
398
+ │ Status: 🟡 Polling mode │
399
+ │ Last Poll: 10 sec ago │
400
+ │ Poll Interval: 30 seconds │
401
+ │ Team Online: 2 members │
402
+ │ │
403
+ │ ── Connection Details ──────────────────────────────────────────────────── │
404
+ │ │
405
+ │ Mode: HTTP Polling (fallback) │
406
+ │ Server: https://api.planflow.tools │
407
+ │ Project: Plan Flow Plugin │
408
+ │ │
409
+ ├──────────────────────────────────────────────────────────────────────────────┤
410
+ │ │
411
+ │ âš ī¸ Limited real-time features │
412
+ │ WebSocket tools not installed. │
413
+ │ │
414
+ │ 💡 For full real-time support, install websocat: │
415
+ │ macOS: brew install websocat │
416
+ │ Linux: cargo install websocat │
417
+ │ │
418
+ ╰──────────────────────────────────────────────────────────────────────────────╯
419
+ ```
420
+
421
+ ## Related Commands
422
+
423
+ - `/pfReconnect` - Force reconnection to WebSocket
424
+ - `/pfWhoami` - Show current user info (includes basic connection status)
425
+ - `/team` - Show team members (includes online status)
426
+ - `/pfNotifications` - View notifications (requires connection for real-time)
427
+
428
+ ## Notes
429
+
430
+ - Connection status is read from local state file (no API call required)
431
+ - Team online count requires a quick API call (optional, fails gracefully)
432
+ - State file is updated by WebSocket background process
433
+ - Polling mode is fallback when WebSocket tools unavailable