pingthings 0.7.0 → 0.8.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 (137) hide show
  1. package/bin/pingthings.js +1 -0
  2. package/package.json +1 -1
  3. package/packs/0ad-civilizations/openpeon.json +172 -0
  4. package/packs/7kaa-soldiers/openpeon.json +217 -0
  5. package/packs/droid-announcer/openpeon.json +107 -0
  6. package/packs/fighting-announcer/openpeon.json +132 -0
  7. package/packs/freedoom-arsenal/openpeon.json +117 -0
  8. package/packs/kenney-digital/manifest.json +58 -0
  9. package/packs/kenney-digital/openpeon.json +122 -0
  10. package/packs/kenney-digital/sounds/high-up.ogg +0 -0
  11. package/packs/kenney-digital/sounds/low-down.ogg +0 -0
  12. package/packs/kenney-digital/sounds/pep-1.ogg +0 -0
  13. package/packs/kenney-digital/sounds/pep-2.ogg +0 -0
  14. package/packs/kenney-digital/sounds/phase-jump-1.ogg +0 -0
  15. package/packs/kenney-digital/sounds/phase-jump-2.ogg +0 -0
  16. package/packs/kenney-digital/sounds/phaser-down.ogg +0 -0
  17. package/packs/kenney-digital/sounds/phaser-up-1.ogg +0 -0
  18. package/packs/kenney-digital/sounds/phaser-up-2.ogg +0 -0
  19. package/packs/kenney-digital/sounds/power-up-1.ogg +0 -0
  20. package/packs/kenney-digital/sounds/power-up-2.ogg +0 -0
  21. package/packs/kenney-digital/sounds/power-up-3.ogg +0 -0
  22. package/packs/kenney-digital/sounds/space-trash.ogg +0 -0
  23. package/packs/kenney-digital/sounds/three-tone.ogg +0 -0
  24. package/packs/kenney-digital/sounds/tone.ogg +0 -0
  25. package/packs/kenney-digital/sounds/two-tone.ogg +0 -0
  26. package/packs/kenney-digital/sounds/zap-1.ogg +0 -0
  27. package/packs/kenney-digital/sounds/zap-2.ogg +0 -0
  28. package/packs/kenney-fighter/manifest.json +58 -0
  29. package/packs/kenney-fighter/openpeon.json +122 -0
  30. package/packs/kenney-fighter/sounds/begin.ogg +0 -0
  31. package/packs/kenney-fighter/sounds/combo-breaker.ogg +0 -0
  32. package/packs/kenney-fighter/sounds/combo.ogg +0 -0
  33. package/packs/kenney-fighter/sounds/fight.ogg +0 -0
  34. package/packs/kenney-fighter/sounds/final-round.ogg +0 -0
  35. package/packs/kenney-fighter/sounds/flawless-victory.ogg +0 -0
  36. package/packs/kenney-fighter/sounds/game-over.ogg +0 -0
  37. package/packs/kenney-fighter/sounds/loser.ogg +0 -0
  38. package/packs/kenney-fighter/sounds/multi-kill.ogg +0 -0
  39. package/packs/kenney-fighter/sounds/prepare-yourself.ogg +0 -0
  40. package/packs/kenney-fighter/sounds/ready.ogg +0 -0
  41. package/packs/kenney-fighter/sounds/round-1.ogg +0 -0
  42. package/packs/kenney-fighter/sounds/sudden-death.ogg +0 -0
  43. package/packs/kenney-fighter/sounds/tie-breaker.ogg +0 -0
  44. package/packs/kenney-fighter/sounds/time.ogg +0 -0
  45. package/packs/kenney-fighter/sounds/winner.ogg +0 -0
  46. package/packs/kenney-fighter/sounds/you-lose.ogg +0 -0
  47. package/packs/kenney-fighter/sounds/you-win.ogg +0 -0
  48. package/packs/kenney-impacts/manifest.json +57 -0
  49. package/packs/kenney-impacts/openpeon.json +116 -0
  50. package/packs/kenney-impacts/sounds/bell-heavy-2.ogg +0 -0
  51. package/packs/kenney-impacts/sounds/bell-heavy.ogg +0 -0
  52. package/packs/kenney-impacts/sounds/glass-heavy.ogg +0 -0
  53. package/packs/kenney-impacts/sounds/glass-light.ogg +0 -0
  54. package/packs/kenney-impacts/sounds/glass-medium.ogg +0 -0
  55. package/packs/kenney-impacts/sounds/mining-1.ogg +0 -0
  56. package/packs/kenney-impacts/sounds/mining-2.ogg +0 -0
  57. package/packs/kenney-impacts/sounds/plate-heavy-2.ogg +0 -0
  58. package/packs/kenney-impacts/sounds/plate-heavy.ogg +0 -0
  59. package/packs/kenney-impacts/sounds/plate-light-1.ogg +0 -0
  60. package/packs/kenney-impacts/sounds/plate-light-2.ogg +0 -0
  61. package/packs/kenney-impacts/sounds/plate-medium.ogg +0 -0
  62. package/packs/kenney-impacts/sounds/soft-heavy.ogg +0 -0
  63. package/packs/kenney-impacts/sounds/soft-medium.ogg +0 -0
  64. package/packs/kenney-impacts/sounds/tin-medium.ogg +0 -0
  65. package/packs/kenney-impacts/sounds/wood-heavy.ogg +0 -0
  66. package/packs/kenney-impacts/sounds/wood-light.ogg +0 -0
  67. package/packs/kenney-impacts/sounds/wood-medium.ogg +0 -0
  68. package/packs/kenney-interface/openpeon.json +122 -0
  69. package/packs/kenney-rpg/manifest.json +57 -0
  70. package/packs/kenney-rpg/openpeon.json +117 -0
  71. package/packs/kenney-rpg/sounds/belt-handle-2.ogg +0 -0
  72. package/packs/kenney-rpg/sounds/belt-handle.ogg +0 -0
  73. package/packs/kenney-rpg/sounds/book-close.ogg +0 -0
  74. package/packs/kenney-rpg/sounds/book-flip.ogg +0 -0
  75. package/packs/kenney-rpg/sounds/book-open.ogg +0 -0
  76. package/packs/kenney-rpg/sounds/book-place.ogg +0 -0
  77. package/packs/kenney-rpg/sounds/cloth-belt.ogg +0 -0
  78. package/packs/kenney-rpg/sounds/creak.ogg +0 -0
  79. package/packs/kenney-rpg/sounds/door-close.ogg +0 -0
  80. package/packs/kenney-rpg/sounds/door-open.ogg +0 -0
  81. package/packs/kenney-rpg/sounds/draw-knife.ogg +0 -0
  82. package/packs/kenney-rpg/sounds/leather-drop.ogg +0 -0
  83. package/packs/kenney-rpg/sounds/leather-handle.ogg +0 -0
  84. package/packs/kenney-rpg/sounds/metal-click.ogg +0 -0
  85. package/packs/kenney-rpg/sounds/metal-latch.ogg +0 -0
  86. package/packs/kenney-rpg/sounds/metal-pot-2.ogg +0 -0
  87. package/packs/kenney-rpg/sounds/metal-pot.ogg +0 -0
  88. package/packs/kenney-rpg/sounds/sword-draw.ogg +0 -0
  89. package/packs/kenney-scifi/openpeon.json +122 -0
  90. package/packs/kenney-voiceover/openpeon.json +127 -0
  91. package/packs/openarena-announcer/openpeon.json +107 -0
  92. package/packs/retro-8bit/openpeon.json +122 -0
  93. package/packs/retro-movement/manifest.json +58 -0
  94. package/packs/retro-movement/openpeon.json +122 -0
  95. package/packs/retro-movement/sounds/blip-1.ogg +0 -0
  96. package/packs/retro-movement/sounds/blip-2.ogg +0 -0
  97. package/packs/retro-movement/sounds/door-open-1.ogg +0 -0
  98. package/packs/retro-movement/sounds/door-open-2.ogg +0 -0
  99. package/packs/retro-movement/sounds/door-open-3.ogg +0 -0
  100. package/packs/retro-movement/sounds/jump-1.ogg +0 -0
  101. package/packs/retro-movement/sounds/jump-2.ogg +0 -0
  102. package/packs/retro-movement/sounds/jump-3.ogg +0 -0
  103. package/packs/retro-movement/sounds/menu-select-1.ogg +0 -0
  104. package/packs/retro-movement/sounds/menu-select-2.ogg +0 -0
  105. package/packs/retro-movement/sounds/pause-in-2.ogg +0 -0
  106. package/packs/retro-movement/sounds/pause-in-3.ogg +0 -0
  107. package/packs/retro-movement/sounds/pause-in.ogg +0 -0
  108. package/packs/retro-movement/sounds/pause-out.ogg +0 -0
  109. package/packs/retro-movement/sounds/portal-1.ogg +0 -0
  110. package/packs/retro-movement/sounds/portal-2.ogg +0 -0
  111. package/packs/retro-movement/sounds/portal-3.ogg +0 -0
  112. package/packs/retro-movement/sounds/portal-4.ogg +0 -0
  113. package/packs/retro-weapons/manifest.json +57 -0
  114. package/packs/retro-weapons/openpeon.json +117 -0
  115. package/packs/retro-weapons/sounds/death-android-2.ogg +0 -0
  116. package/packs/retro-weapons/sounds/death-android.ogg +0 -0
  117. package/packs/retro-weapons/sounds/death-human-1.ogg +0 -0
  118. package/packs/retro-weapons/sounds/death-human-2.ogg +0 -0
  119. package/packs/retro-weapons/sounds/death-robot.ogg +0 -0
  120. package/packs/retro-weapons/sounds/explosion-1.ogg +0 -0
  121. package/packs/retro-weapons/sounds/explosion-2.ogg +0 -0
  122. package/packs/retro-weapons/sounds/explosion-long.ogg +0 -0
  123. package/packs/retro-weapons/sounds/explosion-soft.ogg +0 -0
  124. package/packs/retro-weapons/sounds/impact-1.ogg +0 -0
  125. package/packs/retro-weapons/sounds/impact-2.ogg +0 -0
  126. package/packs/retro-weapons/sounds/impact-3.ogg +0 -0
  127. package/packs/retro-weapons/sounds/interact-1.ogg +0 -0
  128. package/packs/retro-weapons/sounds/interact-2.ogg +0 -0
  129. package/packs/retro-weapons/sounds/interact-3.ogg +0 -0
  130. package/packs/retro-weapons/sounds/shot-1.ogg +0 -0
  131. package/packs/retro-weapons/sounds/shot-2.ogg +0 -0
  132. package/packs/retro-weapons/sounds/shot-3.ogg +0 -0
  133. package/packs/warzone2100-command/openpeon.json +137 -0
  134. package/packs/wesnoth-combat/openpeon.json +122 -0
  135. package/packs/xonotic-announcer/openpeon.json +107 -0
  136. package/src/cli/cesp.js +101 -0
  137. package/src/packs.js +66 -9
package/src/packs.js CHANGED
@@ -12,19 +12,76 @@ function getUserPacksDir() {
12
12
  return join(getConfigDir(), 'packs');
13
13
  }
14
14
 
15
+ // CESP event → pingthings event mapping
16
+ const CESP_EVENT_MAP = {
17
+ 'session.start': 'permission',
18
+ 'task.acknowledge': 'done',
19
+ 'task.complete': 'complete',
20
+ 'task.error': 'error',
21
+ 'input.required': 'permission',
22
+ 'resource.limit': 'blocked',
23
+ 'user.spam': 'blocked',
24
+ 'session.end': 'complete',
25
+ 'task.progress': 'done',
26
+ };
27
+
28
+ function convertCespManifest(cesp) {
29
+ const events = {};
30
+ for (const [cespEvent, sounds] of Object.entries(cesp.categories || {})) {
31
+ const pingEvent = CESP_EVENT_MAP[cespEvent];
32
+ if (!pingEvent) continue;
33
+ const files = (sounds.sounds || []).map(s => s.file);
34
+ if (!events[pingEvent]) events[pingEvent] = [];
35
+ events[pingEvent].push(...files);
36
+ }
37
+
38
+ const allSounds = [];
39
+ for (const sounds of Object.values(cesp.categories || {})) {
40
+ for (const s of sounds.sounds || []) {
41
+ if (!allSounds.includes(s.file)) allSounds.push(s.file);
42
+ }
43
+ }
44
+
45
+ return {
46
+ name: cesp.name,
47
+ description: cesp.display_name || cesp.description || '',
48
+ version: cesp.version || '1.0.0',
49
+ license: cesp.license || 'Unknown',
50
+ credits: cesp.author?.name || '',
51
+ category: cesp.tags?.[0] || 'other',
52
+ sounds: allSounds,
53
+ events,
54
+ _cesp: true,
55
+ };
56
+ }
57
+
15
58
  function readManifest(packDir) {
59
+ // Prefer manifest.json (our native format) — richer metadata
16
60
  const manifestPath = join(packDir, 'manifest.json');
17
- if (!existsSync(manifestPath)) return null;
18
- try {
19
- const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
20
- if (!manifest.name) {
21
- console.error(`Warning: manifest.json in ${packDir} is missing "name" field`);
61
+ if (existsSync(manifestPath)) {
62
+ try {
63
+ const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
64
+ if (!manifest.name) {
65
+ console.error(`Warning: manifest.json in ${packDir} is missing "name" field`);
66
+ }
67
+ return manifest;
68
+ } catch (err) {
69
+ console.error(`Warning: Failed to parse ${manifestPath}: ${err.message}`);
70
+ }
71
+ }
72
+
73
+ // Fall back to CESP format (openpeon.json) for community packs
74
+ const cespPath = join(packDir, 'openpeon.json');
75
+ if (existsSync(cespPath)) {
76
+ try {
77
+ const cesp = JSON.parse(readFileSync(cespPath, 'utf8'));
78
+ return convertCespManifest(cesp);
79
+ } catch (err) {
80
+ console.error(`Warning: Failed to parse ${cespPath}: ${err.message}`);
22
81
  }
23
- return manifest;
24
- } catch (err) {
25
- console.error(`Warning: Failed to parse ${manifestPath}: ${err.message}`);
26
- return null;
27
82
  }
83
+
84
+ return null;
28
85
  }
29
86
 
30
87
  function discoverSounds(packDir) {