predators-protocol 0.3.0-beta.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 (153) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +104 -0
  3. package/bin/predators-cli.js +490 -0
  4. package/bundle/.claude/commands/auditoria-tubarao.md +104 -0
  5. package/bundle/.claude/commands/briefing.md +84 -0
  6. package/bundle/.claude/commands/cyber-squad.md +71 -0
  7. package/bundle/.claude/commands/encarnar.md +63 -0
  8. package/bundle/.claude/commands/onda-fenix.md +71 -0
  9. package/bundle/.claude/commands/predador.md +67 -0
  10. package/bundle/.claude/commands/synapse-trace.md +92 -0
  11. package/bundle/CLAUDE.md +373 -0
  12. package/bundle/QUICKSTART-SOCIO.md +45 -0
  13. package/bundle/docs/CANON/DIRETRIZ-1-LEI-DO-TOM-CONVERSACIONAL.md +77 -0
  14. package/bundle/docs/CANON/DIRETRIZ-2-AUTONOMIA-SEQUENCIAL-LEI-9.md +85 -0
  15. package/bundle/docs/CANON/DIRETRIZ-3-LEI-8-PASSO-0-EVERY-ONDA.md +69 -0
  16. package/bundle/docs/CANON/DIRETRIZ-4-SEPARACAO-CANON-DOC-COMUNICACAO-DIRETA.md +69 -0
  17. package/bundle/docs/CANON/LEI-14-PERFEITO-OU-FIX-GERAL.md +113 -0
  18. package/bundle/docs/CYBER_SQUAD.md +367 -0
  19. package/bundle/docs/ENCARNACAO.md +291 -0
  20. package/bundle/docs/SYNAPSE.md +241 -0
  21. package/bundle/predators/apex/aguia-real/constitution.md +330 -0
  22. package/bundle/predators/apex/aguia-real/predator.json +28 -0
  23. package/bundle/predators/apex/leao/constitution.md +283 -0
  24. package/bundle/predators/apex/leao/predator.json +34 -0
  25. package/bundle/predators/apex/orca/constitution.md +279 -0
  26. package/bundle/predators/apex/orca/predator.json +43 -0
  27. package/bundle/predators/apex/tigre-siberiano/constitution.md +276 -0
  28. package/bundle/predators/apex/tigre-siberiano/predator.json +37 -0
  29. package/bundle/predators/builder/camaleao/constitution.md +171 -0
  30. package/bundle/predators/builder/camaleao/predator.json +36 -0
  31. package/bundle/predators/builder/coruja/constitution.md +169 -0
  32. package/bundle/predators/builder/coruja/predator.json +38 -0
  33. package/bundle/predators/builder/falcao-peregrino/constitution.md +171 -0
  34. package/bundle/predators/builder/falcao-peregrino/predator.json +37 -0
  35. package/bundle/predators/builder/gaviao/constitution.md +169 -0
  36. package/bundle/predators/builder/gaviao/predator.json +38 -0
  37. package/bundle/predators/builder/jaguar/constitution.md +181 -0
  38. package/bundle/predators/builder/jaguar/predator.json +51 -0
  39. package/bundle/predators/builder/onca-pintada/constitution.md +175 -0
  40. package/bundle/predators/builder/onca-pintada/predator.json +38 -0
  41. package/bundle/predators/builder/pantera-negra/constitution.md +307 -0
  42. package/bundle/predators/builder/pantera-negra/predator.json +23 -0
  43. package/bundle/predators/builder/polvo/constitution.md +182 -0
  44. package/bundle/predators/builder/polvo/predator.json +37 -0
  45. package/bundle/predators/builder/tatu-bola/constitution.md +299 -0
  46. package/bundle/predators/builder/tatu-bola/predator.json +43 -0
  47. package/bundle/predators/copy/corvo/constitution.md +156 -0
  48. package/bundle/predators/copy/corvo/predator.json +40 -0
  49. package/bundle/predators/copy/golfinho/constitution.md +199 -0
  50. package/bundle/predators/copy/golfinho/predator.json +38 -0
  51. package/bundle/predators/copy/lobo-cinzento/constitution.md +209 -0
  52. package/bundle/predators/copy/lobo-cinzento/predator.json +37 -0
  53. package/bundle/predators/copy/papagaio/constitution.md +194 -0
  54. package/bundle/predators/copy/papagaio/predator.json +38 -0
  55. package/bundle/predators/copy/rouxinol/constitution.md +196 -0
  56. package/bundle/predators/copy/rouxinol/predator.json +37 -0
  57. package/bundle/predators/copy/serpente-coral/constitution.md +210 -0
  58. package/bundle/predators/copy/serpente-coral/predator.json +37 -0
  59. package/bundle/predators/designer/aguia-harpia/constitution.md +199 -0
  60. package/bundle/predators/designer/aguia-harpia/predator.json +45 -0
  61. package/bundle/predators/designer/aranha-tecela/constitution.md +173 -0
  62. package/bundle/predators/designer/aranha-tecela/predator.json +37 -0
  63. package/bundle/predators/designer/borboleta-azul/constitution.md +171 -0
  64. package/bundle/predators/designer/borboleta-azul/predator.json +35 -0
  65. package/bundle/predators/designer/cisne-negro/constitution.md +172 -0
  66. package/bundle/predators/designer/cisne-negro/predator.json +36 -0
  67. package/bundle/predators/designer/mantis/constitution.md +182 -0
  68. package/bundle/predators/designer/mantis/predator.json +37 -0
  69. package/bundle/predators/designer/pavao/constitution.md +167 -0
  70. package/bundle/predators/designer/pavao/predator.json +23 -0
  71. package/bundle/predators/designer/tucano-toco/constitution.md +357 -0
  72. package/bundle/predators/designer/tucano-toco/predator.json +51 -0
  73. package/bundle/predators/governance/cavalo-marinho/constitution.md +216 -0
  74. package/bundle/predators/governance/cavalo-marinho/predator.json +35 -0
  75. package/bundle/predators/governance/elefante/constitution.md +236 -0
  76. package/bundle/predators/governance/elefante/predator.json +23 -0
  77. package/bundle/predators/governance/gorila-prata/constitution.md +225 -0
  78. package/bundle/predators/governance/gorila-prata/predator.json +43 -0
  79. package/bundle/predators/governance/lince/constitution.md +224 -0
  80. package/bundle/predators/governance/lince/predator.json +35 -0
  81. package/bundle/predators/governance/raposa/constitution.md +213 -0
  82. package/bundle/predators/governance/raposa/predator.json +35 -0
  83. package/bundle/predators/governance/tartaruga-gigante/constitution.md +218 -0
  84. package/bundle/predators/governance/tartaruga-gigante/predator.json +35 -0
  85. package/bundle/predators/growth/abelha-rainha/constitution.md +222 -0
  86. package/bundle/predators/growth/abelha-rainha/predator.json +36 -0
  87. package/bundle/predators/growth/albatroz/constitution.md +218 -0
  88. package/bundle/predators/growth/albatroz/predator.json +36 -0
  89. package/bundle/predators/growth/condor/constitution.md +203 -0
  90. package/bundle/predators/growth/condor/predator.json +23 -0
  91. package/bundle/predators/growth/coruja-de-igreja/constitution.md +236 -0
  92. package/bundle/predators/growth/coruja-de-igreja/predator.json +36 -0
  93. package/bundle/predators/growth/formiga-sauva/constitution.md +243 -0
  94. package/bundle/predators/growth/formiga-sauva/predator.json +45 -0
  95. package/bundle/predators/growth/lobo-do-artico/constitution.md +229 -0
  96. package/bundle/predators/growth/lobo-do-artico/predator.json +36 -0
  97. package/bundle/predators/hunter/crocodilo/constitution.md +293 -0
  98. package/bundle/predators/hunter/crocodilo/predator.json +39 -0
  99. package/bundle/predators/hunter/escorpiao/constitution.md +327 -0
  100. package/bundle/predators/hunter/escorpiao/predator.json +34 -0
  101. package/bundle/predators/hunter/hiena/constitution.md +343 -0
  102. package/bundle/predators/hunter/hiena/predator.json +34 -0
  103. package/bundle/predators/hunter/piranha/constitution.md +283 -0
  104. package/bundle/predators/hunter/piranha/predator.json +35 -0
  105. package/bundle/predators/hunter/tubarao-branco/constitution.md +527 -0
  106. package/bundle/predators/hunter/tubarao-branco/predator.json +36 -0
  107. package/bundle/predators/intel/alcateia/constitution.md +217 -0
  108. package/bundle/predators/intel/alcateia/predator.json +35 -0
  109. package/bundle/predators/intel/guepardo/constitution.md +201 -0
  110. package/bundle/predators/intel/guepardo/predator.json +36 -0
  111. package/bundle/predators/intel/jiboia/constitution.md +243 -0
  112. package/bundle/predators/intel/jiboia/predator.json +38 -0
  113. package/bundle/predators/intel/lobo-solitario/constitution.md +275 -0
  114. package/bundle/predators/intel/lobo-solitario/predator.json +23 -0
  115. package/bundle/predators/intel/morcego/constitution.md +217 -0
  116. package/bundle/predators/intel/morcego/predator.json +35 -0
  117. package/bundle/predators/intel/pirarucu/constitution.md +309 -0
  118. package/bundle/predators/intel/pirarucu/predator.json +40 -0
  119. package/bundle/predators/intel/polvo-mimico/constitution.md +220 -0
  120. package/bundle/predators/intel/polvo-mimico/predator.json +35 -0
  121. package/bundle/predators/intel/tarantula/constitution.md +222 -0
  122. package/bundle/predators/intel/tarantula/predator.json +37 -0
  123. package/bundle/predators/meta/aranha-d-agua/constitution.md +264 -0
  124. package/bundle/predators/meta/aranha-d-agua/predator.json +37 -0
  125. package/bundle/predators/meta/camaleao-real/constitution.md +245 -0
  126. package/bundle/predators/meta/camaleao-real/predator.json +36 -0
  127. package/bundle/predators/meta/coruja-real/constitution.md +255 -0
  128. package/bundle/predators/meta/coruja-real/predator.json +36 -0
  129. package/bundle/predators/meta/dragao-ancestral/constitution.md +297 -0
  130. package/bundle/predators/meta/dragao-ancestral/predator.json +23 -0
  131. package/bundle/predators/meta/fenix/constitution.md +282 -0
  132. package/bundle/predators/meta/fenix/predator.json +35 -0
  133. package/bundle/predators/meta/lince-das-neves/constitution.md +252 -0
  134. package/bundle/predators/meta/lince-das-neves/predator.json +35 -0
  135. package/bundle/predators/web3/caranguejo-ferradura/constitution.md +245 -0
  136. package/bundle/predators/web3/caranguejo-ferradura/predator.json +36 -0
  137. package/bundle/predators/web3/medusa/constitution.md +236 -0
  138. package/bundle/predators/web3/medusa/predator.json +39 -0
  139. package/bundle/predators/web3/orca-alfa/constitution.md +227 -0
  140. package/bundle/predators/web3/orca-alfa/predator.json +23 -0
  141. package/bundle/predators/web3/polvo-gigante/constitution.md +240 -0
  142. package/bundle/predators/web3/polvo-gigante/predator.json +36 -0
  143. package/bundle/predators/web3/raia-eletrica/constitution.md +236 -0
  144. package/bundle/predators/web3/raia-eletrica/predator.json +36 -0
  145. package/bundle/predators/web3/tubarao-martelo/constitution.md +236 -0
  146. package/bundle/predators/web3/tubarao-martelo/predator.json +36 -0
  147. package/lib/ascii-art.js +224 -0
  148. package/lib/audio.js +137 -0
  149. package/lib/colors.js +168 -0
  150. package/lib/config.js +114 -0
  151. package/lib/spinners.js +146 -0
  152. package/lib/splash.js +114 -0
  153. package/package.json +51 -0
@@ -0,0 +1,224 @@
1
+ // lib/ascii-art.js · canon ASCII art Predators Protocol
2
+ // Lei #13 Pureza: canon próprio · zero clone Matrix-style
3
+ // Sub-etapa A · Borboleta-azul visual + Aranha-tecelã animação
4
+
5
+ "use strict";
6
+
7
+ const { colorize, colorByLayer, bold, dim, RESET } = require("./colors");
8
+
9
+ // ═══════════════════════════════════════════════════════════════════
10
+ // THE EYE · logo principal canon Predators Protocol
11
+ // "The eye that never closes"
12
+ // ═══════════════════════════════════════════════════════════════════
13
+ const THE_EYE = `
14
+ ▄▄▄▄▄▄▄▄▄▄▄
15
+ ▄▄█████████████████▄▄
16
+ ▄████▀▀░░░░░░░░░░░░▀▀████▄
17
+ ████▀░░░░░░░░░░░░░░░░░░░░▀████
18
+ ███▀░░░░░░░░░░░░░░░░░░░░░░░░░░▀███
19
+ ██▀░░░░░░░░░░▄▄▄▄▄▄▄▄▄░░░░░░░░░░░▀██
20
+ ██░░░░░░░▄████▀▀▀▀▀▀▀▀████▄░░░░░░░░░██
21
+ ██░░░░░▄███▀░░░░░░░░░░░░░░▀███▄░░░░░░░██
22
+ ██░░░░██▀░░░░░░▄▄▄▄▄▄▄░░░░░░░▀██░░░░░░██
23
+ ██░░░██░░░░░▄████▀▀▀▀████▄░░░░░██░░░░░██
24
+ ██░░░██░░░░██▀░░░░░░░░░░▀██░░░░██░░░░░██
25
+ ██░░░██░░░██░░░░ ██████ ░░░██░░░██░░░░░██
26
+ ██░░░██░░░██░░░░██████████░░██░░░██░░░░██
27
+ ██░░░██░░░██░░░░██████████░░██░░░██░░░░██
28
+ ██░░░██░░░██░░░░ ██████ ░░░██░░░██░░░░░██
29
+ ██░░░██░░░░██▄░░░░░░░░░░▄██░░░░██░░░░░██
30
+ ██░░░██░░░░░▀████▄▄▄▄████▀░░░░░██░░░░░██
31
+ ██░░░░██░░░░░░░▀▀▀▀▀▀▀▀░░░░░░░██░░░░░░██
32
+ ██░░░░▀███▄░░░░░░░░░░░░░░▄███▀░░░░░░██
33
+ ██░░░░░░░▀████▄▄▄▄▄▄▄▄████▀░░░░░░░░░██
34
+ ██▄░░░░░░░░░▀▀▀▀▀▀▀▀▀▀░░░░░░░░░░░▄██
35
+ ███▄░░░░░░░░░░░░░░░░░░░░░░░░░░░███
36
+ ████▄░░░░░░░░░░░░░░░░░░░░░░████
37
+ ▀████▄▄░░░░░░░░░░░░░░▄▄████▀
38
+ ▀▀█████████████████▀▀
39
+ ▀▀▀▀▀▀▀▀▀▀▀
40
+ `;
41
+
42
+ // ═══════════════════════════════════════════════════════════════════
43
+ // Predator signature cards · stylized · per-camada color
44
+ // ═══════════════════════════════════════════════════════════════════
45
+
46
+ const PREDATOR_CARDS = {
47
+ "aguia-real": {
48
+ layer: "apex",
49
+ glyph: "🦅",
50
+ sigil: `
51
+ ╔════════════════════════════════════════╗
52
+ ║ ÁGUIA-REAL · Apex T5 · soaring ║
53
+ ║ ║
54
+ ║ \\\\ // ║
55
+ ║ \\\\______// ║
56
+ ║ === ▼ === ▼ === ║
57
+ ║ ║
58
+ ║ "De onde eu vôo, tudo é território" ║
59
+ ╚════════════════════════════════════════╝`,
60
+ tagline: "Visão de topo · orquestração estratégica cross-domain",
61
+ },
62
+
63
+ "tubarao-branco": {
64
+ layer: "hunter",
65
+ glyph: "🦈",
66
+ sigil: `
67
+ ╔════════════════════════════════════════╗
68
+ ║ TUBARÃO-BRANCO · Hunter T5 · JUIZ ║
69
+ ║ ║
70
+ ║ ▄▄▄▄▄ ║
71
+ ║ ▄▄█████████▄▄ ║
72
+ ║ ██ ▼ ▼ ██▄▄▄▄▄▄ ║
73
+ ║ ▀████████████████████ ║
74
+ ║ ║
75
+ ║ "Não passa nem gota de sangue" ║
76
+ ╚════════════════════════════════════════╝`,
77
+ tagline: "Lei do Sangue · JUIZ FINAL N2 BINARY canon Art. 14",
78
+ },
79
+
80
+ "hiena": {
81
+ layer: "hunter",
82
+ glyph: "🐺",
83
+ sigil: `
84
+ ╔════════════════════════════════════════╗
85
+ ║ HIENA · Hunter T4 · forense ║
86
+ ║ ║
87
+ ║ ╱╲ ║
88
+ ║ ╱██╲ ▄▄▄▄▄ ║
89
+ ║ ╱████╲ ████████ ║
90
+ ║ ╱██████╲▀▀▀▀▀▀▀▀ ║
91
+ ║ ║
92
+ ║ "Onde houve incidente, há rastro" ║
93
+ ╚════════════════════════════════════════╝`,
94
+ tagline: "Forense pós-incidente · self-healing root-cause",
95
+ },
96
+
97
+ "polvo": {
98
+ layer: "builder",
99
+ glyph: "🐙",
100
+ sigil: `
101
+ ╔════════════════════════════════════════╗
102
+ ║ POLVO · Builder T3 · integrações ║
103
+ ║ ║
104
+ ║ ◯◯ ║
105
+ ║ ╱╲╱██╲╱╲ ║
106
+ ║ ╱ ████ ╲ ║
107
+ ║ ╱ ╱╲██╱╲ ╲ ║
108
+ ║ ◜ ◜ ◜ ◜ ◜ ║
109
+ ║ ║
110
+ ║ "Oito tentáculos, oito integrações" ║
111
+ ╚════════════════════════════════════════╝`,
112
+ tagline: "HTTP clients · webhooks · OAuth · MCP servers",
113
+ },
114
+
115
+ "elefante": {
116
+ layer: "governance",
117
+ glyph: "🐘",
118
+ sigil: `
119
+ ╔════════════════════════════════════════╗
120
+ ║ ELEFANTE · Governance T4 · memória ║
121
+ ║ ║
122
+ ║ ▄▄▄▄▄▄▄ ║
123
+ ║ ▄██████████▄ ║
124
+ ║ ██ ◉ ◉ ██ ║
125
+ ║ ██ ██╗ ║
126
+ ║ ██▀▀▀▀▀▀▀▀▀▀▀██▀ ║
127
+ ║ ██ ██ ║
128
+ ║ ║
129
+ ║ "Memória institucional canon" ║
130
+ ╚════════════════════════════════════════╝`,
131
+ tagline: "Append-only · retention 7 anos · audit trail completo",
132
+ },
133
+
134
+ "dragao-ancestral": {
135
+ layer: "meta",
136
+ glyph: "🐉",
137
+ sigil: `
138
+ ╔════════════════════════════════════════╗
139
+ ║ DRAGÃO-ANCESTRAL · Meta T5 · veto ║
140
+ ║ ║
141
+ ║ ╱╲ ║
142
+ ║ ╱══╱██╲══╲ ║
143
+ ║ ╱══╱ ████ ╲══╲ ║
144
+ ║ ◤██◢ ▄ ████ ▄ ◤██◢ ║
145
+ ║ ╲▄▄▄▄▄▄╱ ║
146
+ ║ ║
147
+ ║ "Matéria constitucional inviolável" ║
148
+ ╚════════════════════════════════════════╝`,
149
+ tagline: "Veto constitucional · matéria canon vigente · 14 leis",
150
+ },
151
+
152
+ "fenix": {
153
+ layer: "meta",
154
+ glyph: "🔥",
155
+ sigil: `
156
+ ╔════════════════════════════════════════╗
157
+ ║ FÊNIX · Meta T5 · Art. 5 imutável ║
158
+ ║ ║
159
+ ║ ╱╲╱╲ ║
160
+ ║ ╱╲╱██████╲╱╲ ║
161
+ ║ ╱██▲████████▲██╲ ║
162
+ ║ ◤██████████████████◢ ║
163
+ ║ ╲▄▄▄▄▄▄▄▄▄▄▄▄╱ ║
164
+ ║ ║
165
+ ║ "Propõe, ratifica, ressurge" ║
166
+ ╚════════════════════════════════════════╝`,
167
+ tagline: "Predador novo via Fênix Protocol · Art. 5 imutável",
168
+ },
169
+
170
+ "lince-das-neves": {
171
+ layer: "meta",
172
+ glyph: "🐆",
173
+ sigil: `
174
+ ╔════════════════════════════════════════╗
175
+ ║ LINCE-DAS-NEVES · Meta T4 · N1 audit ║
176
+ ║ ║
177
+ ║ ▄▄▄ ║
178
+ ║ ▄██████▄ ║
179
+ ║ ██ ◉ ◉ ██ ║
180
+ ║ ██▀████▀██ ║
181
+ ║ ╱██╲████╱██╲ ║
182
+ ║ ║
183
+ ║ "Olhar afiado · consistência canon" ║
184
+ ╚════════════════════════════════════════╝`,
185
+ tagline: "N1 auditor · 89+ audits consecutive · Lei #4 byte-canon",
186
+ },
187
+ };
188
+
189
+ function renderEye(theme = "default") {
190
+ const lines = THE_EYE.split("\n").filter(l => l.length > 0);
191
+ return lines.map(l => colorize(l, "APEX_GOLD", theme)).join("\n");
192
+ }
193
+
194
+ function renderPredatorCard(predatorId, theme = "default") {
195
+ const card = PREDATOR_CARDS[predatorId];
196
+ if (!card) return "";
197
+ const lines = card.sigil.split("\n").filter(l => l.length > 0);
198
+ const colored = lines.map(l => colorByLayer(l, card.layer, theme)).join("\n");
199
+ const tagline = colorize(card.tagline, "APEX_GOLD", theme);
200
+ return `${colored}\n ${dim(card.tagline)}\n`;
201
+ }
202
+
203
+ function listPredatorsWithCards() {
204
+ return Object.keys(PREDATOR_CARDS);
205
+ }
206
+
207
+ function renderHeroBanner(theme = "default") {
208
+ const banner = `
209
+ ${colorize("█▀█ █▀█ █▀▀ █▀▄ ▄▀█ ▀█▀ █▀█ █▀█ █▀", "APEX_GOLD", theme)}
210
+ ${colorize("█▀▀ █▀▄ ██▄ █▄▀ █▀█ █ █▄█ █▀▄ ▄█", "APEX_GOLD", theme)}
211
+ ${colorize("█▀█ █▀█ █▀█ ▀█▀ █▀█ █▀▀ █▀█ █ ", "BUILDER_CYAN", theme)}
212
+ ${colorize("█▀▀ █▀▄ █▄█ █ █▄█ █▄▄ █▄█ █▄▄", "BUILDER_CYAN", theme)}
213
+ `;
214
+ return banner;
215
+ }
216
+
217
+ module.exports = {
218
+ THE_EYE,
219
+ PREDATOR_CARDS,
220
+ renderEye,
221
+ renderPredatorCard,
222
+ renderHeroBanner,
223
+ listPredatorsWithCards,
224
+ };
package/lib/audio.js ADDED
@@ -0,0 +1,137 @@
1
+ // lib/audio.js · player infra cross-platform · audio signatures predator
2
+ // HONEST UPFRONT (Lei #11): arquivos .mp3 reais pendentes Fênix Protocol futura
3
+ // (predador "audio designer ambient" será criado · 5 sons signature reais)
4
+ // Esta camada entrega: player + toggle + cross-platform detection + graceful degradation
5
+
6
+ "use strict";
7
+
8
+ const fs = require("fs");
9
+ const path = require("path");
10
+ const os = require("os");
11
+ const { spawn } = require("child_process");
12
+ const { getAudioEnabled } = require("./config");
13
+
14
+ // Map signature name → file path canon
15
+ // PENDENTE Fênix futura: arquivos .mp3 reais ambient signature
16
+ const SOUNDS_CANON = {
17
+ "tubarao-signature": {
18
+ file: "tubarao-signature.mp3",
19
+ description: "Deep bass · audit Tubarão JUIZ FINAL",
20
+ duration_ms: 2000,
21
+ },
22
+ "aguia-signature": {
23
+ file: "aguia-signature.mp3",
24
+ description: "Sharp + clean · análise estratégica Águia",
25
+ duration_ms: 1500,
26
+ },
27
+ "hiena-signature": {
28
+ file: "hiena-signature.mp3",
29
+ description: "Forensic ambient · pós-incidente Hiena",
30
+ duration_ms: 2500,
31
+ },
32
+ "sinapse-pulse": {
33
+ file: "sinapse-pulse.mp3",
34
+ description: "Ambient cerebral · sinapse fire",
35
+ duration_ms: 1000,
36
+ },
37
+ "fenix-rebirth": {
38
+ file: "fenix-rebirth.mp3",
39
+ description: "Resurgir · self-healing Fênix Art. 5",
40
+ duration_ms: 3000,
41
+ },
42
+ };
43
+
44
+ const SOUNDS_DIR = path.join(__dirname, "..", "assets", "sounds");
45
+
46
+ function isWSL() {
47
+ if (process.platform !== "linux") return false;
48
+ try {
49
+ const release = fs.readFileSync("/proc/version", "utf-8").toLowerCase();
50
+ return release.includes("microsoft") || release.includes("wsl");
51
+ } catch {
52
+ return false;
53
+ }
54
+ }
55
+
56
+ function detectPlayer() {
57
+ if (isWSL()) return null; // WSL audio often broken · graceful skip
58
+ if (process.platform === "win32") return { cmd: "powershell", args: ["-c"] };
59
+ if (process.platform === "darwin") return { cmd: "afplay", args: [] };
60
+ if (process.platform === "linux") {
61
+ // prefer paplay (PulseAudio) then aplay (ALSA)
62
+ return { cmd: "paplay", args: [], fallback: { cmd: "aplay", args: ["-q"] } };
63
+ }
64
+ return null;
65
+ }
66
+
67
+ function soundFileExists(signatureName) {
68
+ const sound = SOUNDS_CANON[signatureName];
69
+ if (!sound) return false;
70
+ return fs.existsSync(path.join(SOUNDS_DIR, sound.file));
71
+ }
72
+
73
+ function play(signatureName, options = {}) {
74
+ // Honor user preference + graceful degradation
75
+ if (!options.force && !getAudioEnabled()) {
76
+ return { played: false, reason: "audio_disabled_user_pref" };
77
+ }
78
+ const sound = SOUNDS_CANON[signatureName];
79
+ if (!sound) {
80
+ return { played: false, reason: "unknown_signature" };
81
+ }
82
+ const filePath = path.join(SOUNDS_DIR, sound.file);
83
+ if (!fs.existsSync(filePath)) {
84
+ return { played: false, reason: "sound_file_pending_fenix_audio_designer" };
85
+ }
86
+ const player = detectPlayer();
87
+ if (!player) {
88
+ return { played: false, reason: "no_player_or_wsl_environment" };
89
+ }
90
+ try {
91
+ let cmd = player.cmd;
92
+ let args = [...player.args];
93
+ if (cmd === "powershell") {
94
+ args.push(`(New-Object Media.SoundPlayer '${filePath}').PlaySync()`);
95
+ } else {
96
+ args.push(filePath);
97
+ }
98
+ spawn(cmd, args, { detached: true, stdio: "ignore" }).unref();
99
+ return { played: true, signature: signatureName };
100
+ } catch (err) {
101
+ return { played: false, reason: "spawn_failed", error: String(err) };
102
+ }
103
+ }
104
+
105
+ function listSignatures() {
106
+ return Object.keys(SOUNDS_CANON).map(name => ({
107
+ name,
108
+ description: SOUNDS_CANON[name].description,
109
+ duration_ms: SOUNDS_CANON[name].duration_ms,
110
+ file_present: soundFileExists(name),
111
+ }));
112
+ }
113
+
114
+ function getStatusReport() {
115
+ const player = detectPlayer();
116
+ const enabled = getAudioEnabled();
117
+ return {
118
+ enabled,
119
+ platform: process.platform,
120
+ is_wsl: isWSL(),
121
+ player_available: player !== null,
122
+ player_cmd: player ? player.cmd : null,
123
+ sounds: listSignatures(),
124
+ canon_note: "5 sons signature pendentes Fênix Protocol audio designer (HONEST UPFRONT Lei #11)",
125
+ };
126
+ }
127
+
128
+ module.exports = {
129
+ SOUNDS_CANON,
130
+ SOUNDS_DIR,
131
+ detectPlayer,
132
+ isWSL,
133
+ soundFileExists,
134
+ play,
135
+ listSignatures,
136
+ getStatusReport,
137
+ };
package/lib/colors.js ADDED
@@ -0,0 +1,168 @@
1
+ // lib/colors.js · canon palette Predators Protocol
2
+ // Lei #13 Pureza: zero deps externas · ANSI truecolor escape codes puros
3
+ // Sub-etapa A + C · Mantis a11y + Pavão visual
4
+
5
+ "use strict";
6
+
7
+ // ANSI escape codes canônicos
8
+ const ESC = "\x1b[";
9
+ const RESET = `${ESC}0m`;
10
+ const BOLD = `${ESC}1m`;
11
+ const DIM = `${ESC}2m`;
12
+ const ITALIC = `${ESC}3m`;
13
+ const UNDERLINE = `${ESC}4m`;
14
+
15
+ // Truecolor RGB foreground · suportado em terminais modernos (Windows Terminal, iTerm2, gnome-terminal, etc)
16
+ function rgb(r, g, b) {
17
+ return `${ESC}38;2;${r};${g};${b}m`;
18
+ }
19
+
20
+ // Background truecolor
21
+ function bgRgb(r, g, b) {
22
+ return `${ESC}48;2;${r};${g};${b}m`;
23
+ }
24
+
25
+ // 8-color basic fallback (universal compat)
26
+ const BASIC = {
27
+ black: `${ESC}30m`,
28
+ red: `${ESC}31m`,
29
+ green: `${ESC}32m`,
30
+ yellow: `${ESC}33m`,
31
+ blue: `${ESC}34m`,
32
+ magenta: `${ESC}35m`,
33
+ cyan: `${ESC}36m`,
34
+ white: `${ESC}37m`,
35
+ gray: `${ESC}90m`,
36
+ brightRed: `${ESC}91m`,
37
+ brightGreen: `${ESC}92m`,
38
+ brightYellow: `${ESC}93m`,
39
+ brightBlue: `${ESC}94m`,
40
+ brightMagenta: `${ESC}95m`,
41
+ brightCyan: `${ESC}96m`,
42
+ brightWhite: `${ESC}97m`,
43
+ };
44
+
45
+ // Canon palette por camada · WCAG AA contrast em fundo terminal escuro
46
+ const PALETTE_CANON = {
47
+ APEX_GOLD: { rgb: [255, 215, 0], hex: "#FFD700", basic: BASIC.yellow },
48
+ HUNTER_RED: { rgb: [220, 20, 60], hex: "#DC143C", basic: BASIC.red },
49
+ BUILDER_CYAN: { rgb: [0, 206, 209], hex: "#00CED1", basic: BASIC.cyan },
50
+ DESIGNER_PURPLE: { rgb: [147, 112, 219], hex: "#9370DB", basic: BASIC.magenta },
51
+ INTEL_GREEN: { rgb: [50, 205, 50], hex: "#32CD32", basic: BASIC.green },
52
+ META_BLUE: { rgb: [65, 105, 225], hex: "#4169E1", basic: BASIC.blue },
53
+ WEB3_ORANGE: { rgb: [255, 140, 0], hex: "#FF8C00", basic: BASIC.brightYellow },
54
+ COPY_PINK: { rgb: [255, 105, 180], hex: "#FF69B4", basic: BASIC.brightMagenta },
55
+ GOVERNANCE_TEAL: { rgb: [0, 128, 128], hex: "#008080", basic: BASIC.cyan },
56
+ GROWTH_LIME: { rgb: [173, 255, 47], hex: "#ADFF2F", basic: BASIC.brightGreen },
57
+ };
58
+
59
+ // Map predator layer → palette key
60
+ const LAYER_COLOR = {
61
+ apex: "APEX_GOLD",
62
+ hunter: "HUNTER_RED",
63
+ builder: "BUILDER_CYAN",
64
+ designer: "DESIGNER_PURPLE",
65
+ intel: "INTEL_GREEN",
66
+ meta: "META_BLUE",
67
+ web3: "WEB3_ORANGE",
68
+ copy: "COPY_PINK",
69
+ governance: "GOVERNANCE_TEAL",
70
+ growth: "GROWTH_LIME",
71
+ };
72
+
73
+ // Themes canon · 4 variants
74
+ const THEMES = {
75
+ default: {
76
+ useTrueColor: true,
77
+ accent: "APEX_GOLD",
78
+ text: BASIC.white,
79
+ dim: BASIC.gray,
80
+ },
81
+ dark: {
82
+ useTrueColor: true,
83
+ accent: "BUILDER_CYAN",
84
+ text: BASIC.brightWhite,
85
+ dim: BASIC.gray,
86
+ },
87
+ light: {
88
+ useTrueColor: true,
89
+ accent: "META_BLUE",
90
+ text: BASIC.black,
91
+ dim: BASIC.gray,
92
+ },
93
+ monochrome: {
94
+ useTrueColor: false,
95
+ accent: BASIC.white,
96
+ text: BASIC.white,
97
+ dim: BASIC.gray,
98
+ },
99
+ };
100
+
101
+ // Detect color support (best-effort · TTY check + env vars)
102
+ function supportsTrueColor() {
103
+ if (process.env.NO_COLOR) return false;
104
+ if (process.env.FORCE_COLOR) return true;
105
+ if (!process.stdout.isTTY) return false;
106
+ const colorterm = (process.env.COLORTERM || "").toLowerCase();
107
+ if (colorterm === "truecolor" || colorterm === "24bit") return true;
108
+ // Windows Terminal + ConEmu + recent cmd support truecolor
109
+ if (process.platform === "win32") return true;
110
+ return false;
111
+ }
112
+
113
+ function colorize(text, paletteKey, theme = "default") {
114
+ const themeConfig = THEMES[theme] || THEMES.default;
115
+ if (theme === "monochrome" || !themeConfig.useTrueColor || !supportsTrueColor()) {
116
+ const color = PALETTE_CANON[paletteKey];
117
+ if (!color) return text;
118
+ return `${color.basic}${text}${RESET}`;
119
+ }
120
+ const color = PALETTE_CANON[paletteKey];
121
+ if (!color) return text;
122
+ const [r, g, b] = color.rgb;
123
+ return `${rgb(r, g, b)}${text}${RESET}`;
124
+ }
125
+
126
+ function colorByLayer(text, layer, theme = "default") {
127
+ const paletteKey = LAYER_COLOR[layer];
128
+ if (!paletteKey) return text;
129
+ return colorize(text, paletteKey, theme);
130
+ }
131
+
132
+ function bold(text) {
133
+ return `${BOLD}${text}${RESET}`;
134
+ }
135
+
136
+ function dim(text) {
137
+ return `${DIM}${text}${RESET}`;
138
+ }
139
+
140
+ function italic(text) {
141
+ return `${ITALIC}${text}${RESET}`;
142
+ }
143
+
144
+ function underline(text) {
145
+ return `${UNDERLINE}${text}${RESET}`;
146
+ }
147
+
148
+ module.exports = {
149
+ ESC,
150
+ RESET,
151
+ BOLD,
152
+ DIM,
153
+ ITALIC,
154
+ UNDERLINE,
155
+ BASIC,
156
+ PALETTE_CANON,
157
+ LAYER_COLOR,
158
+ THEMES,
159
+ rgb,
160
+ bgRgb,
161
+ colorize,
162
+ colorByLayer,
163
+ bold,
164
+ dim,
165
+ italic,
166
+ underline,
167
+ supportsTrueColor,
168
+ };
package/lib/config.js ADDED
@@ -0,0 +1,114 @@
1
+ // lib/config.js · ~/.predators-config.json read/write canon
2
+ // Lei #1 reign: zero credencial · só preferências user-side
3
+ // Sub-etapa D + E · Tatu-bola cross-platform + Polvo integração
4
+
5
+ "use strict";
6
+
7
+ const fs = require("fs");
8
+ const path = require("path");
9
+ const os = require("os");
10
+
11
+ const CONFIG_PATH = path.join(os.homedir(), ".predators-config.json");
12
+
13
+ const DEFAULT_CONFIG = {
14
+ version: 1,
15
+ firstConnectionAt: null,
16
+ lastConnectionAt: null,
17
+ theme: "default",
18
+ audio: {
19
+ enabled: false,
20
+ volume: 0.5,
21
+ },
22
+ splash: {
23
+ enabled: true,
24
+ minimal: false,
25
+ },
26
+ telemetry: {
27
+ enabled: false,
28
+ },
29
+ };
30
+
31
+ function readConfig() {
32
+ try {
33
+ if (!fs.existsSync(CONFIG_PATH)) {
34
+ return { ...DEFAULT_CONFIG, firstConnectionAt: null };
35
+ }
36
+ const raw = fs.readFileSync(CONFIG_PATH, "utf-8");
37
+ const parsed = JSON.parse(raw);
38
+ return { ...DEFAULT_CONFIG, ...parsed };
39
+ } catch (err) {
40
+ return { ...DEFAULT_CONFIG };
41
+ }
42
+ }
43
+
44
+ function writeConfig(config) {
45
+ try {
46
+ const merged = { ...readConfig(), ...config };
47
+ fs.writeFileSync(CONFIG_PATH, JSON.stringify(merged, null, 2), "utf-8");
48
+ return merged;
49
+ } catch (err) {
50
+ return null;
51
+ }
52
+ }
53
+
54
+ function isFirstConnection() {
55
+ const config = readConfig();
56
+ return config.firstConnectionAt === null;
57
+ }
58
+
59
+ function markConnected() {
60
+ const config = readConfig();
61
+ const now = new Date().toISOString();
62
+ const update = { lastConnectionAt: now };
63
+ if (config.firstConnectionAt === null) {
64
+ update.firstConnectionAt = now;
65
+ }
66
+ return writeConfig(update);
67
+ }
68
+
69
+ function setAudioEnabled(enabled) {
70
+ const config = readConfig();
71
+ config.audio.enabled = Boolean(enabled);
72
+ return writeConfig(config);
73
+ }
74
+
75
+ function getAudioEnabled() {
76
+ return readConfig().audio.enabled;
77
+ }
78
+
79
+ function setTheme(theme) {
80
+ const validThemes = ["default", "dark", "light", "monochrome"];
81
+ if (!validThemes.includes(theme)) {
82
+ return null;
83
+ }
84
+ return writeConfig({ theme });
85
+ }
86
+
87
+ function getTheme() {
88
+ return readConfig().theme;
89
+ }
90
+
91
+ function setSplashEnabled(enabled) {
92
+ const config = readConfig();
93
+ config.splash.enabled = Boolean(enabled);
94
+ return writeConfig(config);
95
+ }
96
+
97
+ function getConfigPath() {
98
+ return CONFIG_PATH;
99
+ }
100
+
101
+ module.exports = {
102
+ CONFIG_PATH,
103
+ DEFAULT_CONFIG,
104
+ readConfig,
105
+ writeConfig,
106
+ isFirstConnection,
107
+ markConnected,
108
+ setAudioEnabled,
109
+ getAudioEnabled,
110
+ setTheme,
111
+ getTheme,
112
+ setSplashEnabled,
113
+ getConfigPath,
114
+ };