@pagaqr/mcp 0.0.0-stage → 0.7.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 (52) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +9 -0
  4. package/README.md +99 -2
  5. package/dist/capture-cli.d.ts +2 -0
  6. package/dist/capture-cli.js +34 -0
  7. package/dist/capture-local.d.ts +9 -0
  8. package/dist/capture-local.js +18 -0
  9. package/dist/capture-store.d.ts +7 -0
  10. package/dist/capture-store.js +175 -0
  11. package/dist/catalogue.d.ts +33 -0
  12. package/dist/catalogue.js +78 -0
  13. package/dist/cli.d.ts +2 -0
  14. package/dist/cli.js +27 -0
  15. package/dist/diagnose.d.ts +23 -0
  16. package/dist/diagnose.js +93 -0
  17. package/dist/index.d.ts +9 -0
  18. package/dist/index.js +134 -0
  19. package/dist/invocation-log.d.ts +9 -0
  20. package/dist/invocation-log.js +70 -0
  21. package/dist/masked-terminal.d.ts +4 -0
  22. package/dist/masked-terminal.js +71 -0
  23. package/dist/next-postgres.json +92 -0
  24. package/dist/sbom.cdx.json +523 -0
  25. package/dist/setup/database.d.ts +7 -0
  26. package/dist/setup/database.js +83 -0
  27. package/dist/setup/notice.d.ts +2 -0
  28. package/dist/setup/notice.js +2 -0
  29. package/dist/setup/run.d.ts +25 -0
  30. package/dist/setup/run.js +215 -0
  31. package/dist/setup/runtime.js +718 -0
  32. package/dist/setup/state.d.ts +7 -0
  33. package/dist/setup/state.js +81 -0
  34. package/dist/setup/step.d.ts +59 -0
  35. package/dist/setup/step.js +9 -0
  36. package/dist/setup/steps/pey.d.ts +8 -0
  37. package/dist/setup/steps/pey.js +271 -0
  38. package/dist/setup/steps/vercel.d.ts +5 -0
  39. package/dist/setup/steps/vercel.js +375 -0
  40. package/dist/setup/store-secrets.d.ts +3 -0
  41. package/dist/setup/store-secrets.js +67 -0
  42. package/dist/setup/terminal-guard.d.ts +9 -0
  43. package/dist/setup/terminal-guard.js +17 -0
  44. package/dist/setup/verify.d.ts +34 -0
  45. package/dist/setup/verify.js +144 -0
  46. package/dist/setup-cli.d.ts +2 -0
  47. package/dist/setup-cli.js +70 -0
  48. package/dist/template.d.ts +4 -0
  49. package/dist/template.js +119 -0
  50. package/dist/webhook.d.ts +1 -0
  51. package/dist/webhook.js +30 -0
  52. package/package.json +51 -3
@@ -0,0 +1,523 @@
1
+ {
2
+ "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json",
3
+ "bomFormat": "CycloneDX",
4
+ "specVersion": "1.6",
5
+ "serialNumber": "urn:uuid:8b1856c5-2d10-4807-9983-c877dd7ec5e3",
6
+ "version": 1,
7
+ "metadata": {
8
+ "timestamp": "2026-12-06T07:22:04.294Z",
9
+ "lifecycles": [
10
+ {
11
+ "phase": "pre-build"
12
+ }
13
+ ],
14
+ "tools": {
15
+ "components": [
16
+ {
17
+ "type": "application",
18
+ "name": "pnpm",
19
+ "version": "12.25.1"
20
+ }
21
+ ]
22
+ },
23
+ "component": {
24
+ "type": "library",
25
+ "name": "mcp",
26
+ "version": "0.7.0",
27
+ "purl": "pkg:npm/%40pagaqr/mcp@0.7.0",
28
+ "bom-ref": "pkg:npm/%40pagaqr/mcp@0.7.0",
29
+ "group": "@pagaqr",
30
+ "description": "Diagnóstico MCP de PagaQR y pagaqr-setup para instalación humana en terminal",
31
+ "licenses": [
32
+ {
33
+ "license": {
34
+ "id": "Apache-2.0"
35
+ }
36
+ }
37
+ ],
38
+ "externalReferences": [
39
+ {
40
+ "type": "vcs",
41
+ "url": "git+https://github.com/pagaqr/pagaqr.git"
42
+ }
43
+ ]
44
+ }
45
+ },
46
+ "components": [
47
+ {
48
+ "type": "library",
49
+ "name": "core",
50
+ "version": "2.4.0",
51
+ "purl": "pkg:npm/%40modelcontextprotocol/core@2.4.0",
52
+ "bom-ref": "pkg:npm/%40modelcontextprotocol/core@2.4.0",
53
+ "group": "@modelcontextprotocol",
54
+ "externalReferences": [
55
+ {
56
+ "type": "distribution",
57
+ "url": "https://registry.npmjs.org/@modelcontextprotocol/core/-/core-2.4.0.tgz",
58
+ "hashes": [
59
+ {
60
+ "alg": "SHA-512",
61
+ "content": "cfc4012aa75f5cb3f390b42e1b8c69f21ad510c9b53d9d4883130ddac31b26216200a3965e7033a205e7d96e1aa880653f579ae94e728aa56abaf50d3350a3e9"
62
+ }
63
+ ]
64
+ }
65
+ ]
66
+ },
67
+ {
68
+ "type": "library",
69
+ "name": "server",
70
+ "version": "2.4.0",
71
+ "purl": "pkg:npm/%40modelcontextprotocol/server@2.4.0",
72
+ "bom-ref": "pkg:npm/%40modelcontextprotocol/server@2.4.0",
73
+ "group": "@modelcontextprotocol",
74
+ "externalReferences": [
75
+ {
76
+ "type": "distribution",
77
+ "url": "https://registry.npmjs.org/@modelcontextprotocol/server/-/server-2.4.0.tgz",
78
+ "hashes": [
79
+ {
80
+ "alg": "SHA-512",
81
+ "content": "ae047dcb149a009f9b72c8bf5eba13fd2d807cf8885a5a17027add7d84829acf62bd58eed22b21bbfc16d09db51e8ebe64e475afb4727916e3891b85f3b8b1e5"
82
+ }
83
+ ]
84
+ }
85
+ ]
86
+ },
87
+ {
88
+ "type": "library",
89
+ "name": "entities",
90
+ "version": "9.0.0",
91
+ "purl": "pkg:npm/entities@9.0.0",
92
+ "bom-ref": "pkg:npm/entities@9.0.0",
93
+ "externalReferences": [
94
+ {
95
+ "type": "distribution",
96
+ "url": "https://registry.npmjs.org/entities/-/entities-9.0.0.tgz",
97
+ "hashes": [
98
+ {
99
+ "alg": "SHA-512",
100
+ "content": "a0914d0c98379133f0003d5c367dbe5a652ae30168a34f67a5cdd875fd43ec40f8b264625abb0a9da2f1ca4ad35a0c8611cbac73cecfe5dc650257a897d92992"
101
+ }
102
+ ]
103
+ }
104
+ ]
105
+ },
106
+ {
107
+ "type": "library",
108
+ "name": "parse5",
109
+ "version": "8.1.1",
110
+ "purl": "pkg:npm/parse5@8.1.1",
111
+ "bom-ref": "pkg:npm/parse5@8.1.1",
112
+ "externalReferences": [
113
+ {
114
+ "type": "distribution",
115
+ "url": "https://registry.npmjs.org/parse5/-/parse5-8.1.1.tgz",
116
+ "hashes": [
117
+ {
118
+ "alg": "SHA-512",
119
+ "content": "11c47fe960dc53b6f6377bd04b12802c293d9571ad50c4315e2a34d3c38430113491abeeffb24b7c111e14fce2e379cca950d26c49f74022be04c09cf733bfff"
120
+ }
121
+ ]
122
+ }
123
+ ]
124
+ },
125
+ {
126
+ "type": "library",
127
+ "name": "pg-cloudflare",
128
+ "version": "1.4.1",
129
+ "purl": "pkg:npm/pg-cloudflare@1.4.1",
130
+ "bom-ref": "pkg:npm/pg-cloudflare@1.4.1",
131
+ "externalReferences": [
132
+ {
133
+ "type": "distribution",
134
+ "url": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.4.1.tgz",
135
+ "hashes": [
136
+ {
137
+ "alg": "SHA-512",
138
+ "content": "e8f41bb05599729f44989130cb97064362daf80316a4fe3a9606dbf17f94fd7b07214c1e603342a5eb8a724e51c4bd8c755162ee4adb6c48b99d7e1987b261ad"
139
+ }
140
+ ]
141
+ }
142
+ ]
143
+ },
144
+ {
145
+ "type": "library",
146
+ "name": "pg-connection-string",
147
+ "version": "2.14.1",
148
+ "purl": "pkg:npm/pg-connection-string@2.14.1",
149
+ "bom-ref": "pkg:npm/pg-connection-string@2.14.1",
150
+ "externalReferences": [
151
+ {
152
+ "type": "distribution",
153
+ "url": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.14.1.tgz",
154
+ "hashes": [
155
+ {
156
+ "alg": "SHA-512",
157
+ "content": "a91de418d3c12e908db73d1ebdb280d18fcc4455f0492753fa94c9bd8a7f6d74dc45e65bbd7d64cc5d08c93735427c6a17b0196ce78184d2fc47999841957f30"
158
+ }
159
+ ]
160
+ }
161
+ ]
162
+ },
163
+ {
164
+ "type": "library",
165
+ "name": "pg-int8",
166
+ "version": "1.0.1",
167
+ "purl": "pkg:npm/pg-int8@1.0.1",
168
+ "bom-ref": "pkg:npm/pg-int8@1.0.1",
169
+ "externalReferences": [
170
+ {
171
+ "type": "distribution",
172
+ "url": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
173
+ "hashes": [
174
+ {
175
+ "alg": "SHA-512",
176
+ "content": "582b5a6d2eadddcf129290c15256f59233acee5ebac6c19d2a920f66c838c11f81dfebbd500ba6da8752b05f6d9efc60f348786712d6332e294633ac148a90a7"
177
+ }
178
+ ]
179
+ }
180
+ ]
181
+ },
182
+ {
183
+ "type": "library",
184
+ "name": "pg-pool",
185
+ "version": "3.14.0",
186
+ "purl": "pkg:npm/pg-pool@3.14.0",
187
+ "bom-ref": "pkg:npm/pg-pool@3.14.0",
188
+ "externalReferences": [
189
+ {
190
+ "type": "distribution",
191
+ "url": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.14.0.tgz",
192
+ "hashes": [
193
+ {
194
+ "alg": "SHA-512",
195
+ "content": "80ab4f9057503d4dc392ca2854b8bd2ec8d9c6bb015192296beeda571f8b579a4d8742b33f86657ae776a68f82a27af16ee5c6049e877deafa85d829201a416b"
196
+ }
197
+ ]
198
+ }
199
+ ]
200
+ },
201
+ {
202
+ "type": "library",
203
+ "name": "pg-protocol",
204
+ "version": "1.16.1",
205
+ "purl": "pkg:npm/pg-protocol@1.16.1",
206
+ "bom-ref": "pkg:npm/pg-protocol@1.16.1",
207
+ "externalReferences": [
208
+ {
209
+ "type": "distribution",
210
+ "url": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.16.1.tgz",
211
+ "hashes": [
212
+ {
213
+ "alg": "SHA-512",
214
+ "content": "a7d54e14c88707f65b2404deb5b83ef7d3f1b2c4d5490467cae3d243aee6375fb52813a365a67cdd943396d9f13e12704ac0b79f0563275d0354995eadb1732e"
215
+ }
216
+ ]
217
+ }
218
+ ]
219
+ },
220
+ {
221
+ "type": "library",
222
+ "name": "pg-types",
223
+ "version": "2.2.0",
224
+ "purl": "pkg:npm/pg-types@2.2.0",
225
+ "bom-ref": "pkg:npm/pg-types@2.2.0",
226
+ "externalReferences": [
227
+ {
228
+ "type": "distribution",
229
+ "url": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
230
+ "hashes": [
231
+ {
232
+ "alg": "SHA-512",
233
+ "content": "a9300096b12c97cb383a211063af700ef70c21d40deb0773e688d088ecba61132eca7c5e9ce3743b9a02a4923a96c85ceac720018f2abc9d8e9ffa7e09763418"
234
+ }
235
+ ]
236
+ }
237
+ ]
238
+ },
239
+ {
240
+ "type": "library",
241
+ "name": "pg",
242
+ "version": "8.23.1",
243
+ "purl": "pkg:npm/pg@8.23.1",
244
+ "bom-ref": "pkg:npm/pg@8.23.1",
245
+ "externalReferences": [
246
+ {
247
+ "type": "distribution",
248
+ "url": "https://registry.npmjs.org/pg/-/pg-8.23.1.tgz",
249
+ "hashes": [
250
+ {
251
+ "alg": "SHA-512",
252
+ "content": "68bf7a00700db568cf2c338baa7871fa7829f7e50aec44c453c549ac3086bec4928bf9862dc598b12e877ab83b96668125ee2ec2b7eab1aee04c415a4a2cc3a1"
253
+ }
254
+ ]
255
+ }
256
+ ]
257
+ },
258
+ {
259
+ "type": "library",
260
+ "name": "pgpass",
261
+ "version": "1.0.5",
262
+ "purl": "pkg:npm/pgpass@1.0.5",
263
+ "bom-ref": "pkg:npm/pgpass@1.0.5",
264
+ "externalReferences": [
265
+ {
266
+ "type": "distribution",
267
+ "url": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz",
268
+ "hashes": [
269
+ {
270
+ "alg": "SHA-512",
271
+ "content": "15d5bdaff8d066149ea21b35677b08d72c4540d16f31c9e67ee8f85813144f13ab0322cc693704d5a00c0624e56cc35a5ef04242e562d11ee177cb9d0d23fbba"
272
+ }
273
+ ]
274
+ }
275
+ ]
276
+ },
277
+ {
278
+ "type": "library",
279
+ "name": "postgres-array",
280
+ "version": "2.0.0",
281
+ "purl": "pkg:npm/postgres-array@2.0.0",
282
+ "bom-ref": "pkg:npm/postgres-array@2.0.0",
283
+ "externalReferences": [
284
+ {
285
+ "type": "distribution",
286
+ "url": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
287
+ "hashes": [
288
+ {
289
+ "alg": "SHA-512",
290
+ "content": "56966b52a53903af5e4325b6739080d63b4b79c0ac37653f6c3e958a5ac50d6ab9fb95081153bb9dacd2dd311c1dfd73b8f60efeca86bd4bd6eb683ce915d9b8"
291
+ }
292
+ ]
293
+ }
294
+ ]
295
+ },
296
+ {
297
+ "type": "library",
298
+ "name": "postgres-bytea",
299
+ "version": "1.0.1",
300
+ "purl": "pkg:npm/postgres-bytea@1.0.1",
301
+ "bom-ref": "pkg:npm/postgres-bytea@1.0.1",
302
+ "externalReferences": [
303
+ {
304
+ "type": "distribution",
305
+ "url": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.1.tgz",
306
+ "hashes": [
307
+ {
308
+ "alg": "SHA-512",
309
+ "content": "e7ee47a979ec64f13ae4825948c919b544404597a57a5da85d410ef2b1fcdd54bf8711f9befd6e1eab8f839c19b3cc8c01f76ff7bd4853e91c3d47338bb35505"
310
+ }
311
+ ]
312
+ }
313
+ ]
314
+ },
315
+ {
316
+ "type": "library",
317
+ "name": "postgres-date",
318
+ "version": "1.0.7",
319
+ "purl": "pkg:npm/postgres-date@1.0.7",
320
+ "bom-ref": "pkg:npm/postgres-date@1.0.7",
321
+ "externalReferences": [
322
+ {
323
+ "type": "distribution",
324
+ "url": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz",
325
+ "hashes": [
326
+ {
327
+ "alg": "SHA-512",
328
+ "content": "b2e0e68cb55083bf2730ad94678e788401be3805be1d03d9ea7fbe4cd0d45fe2f4fae5252f2c27a3124a0e8bb9d599becd30a3ac297436ae89f42e613fdbcafd"
329
+ }
330
+ ]
331
+ }
332
+ ]
333
+ },
334
+ {
335
+ "type": "library",
336
+ "name": "postgres-interval",
337
+ "version": "1.2.0",
338
+ "purl": "pkg:npm/postgres-interval@1.2.0",
339
+ "bom-ref": "pkg:npm/postgres-interval@1.2.0",
340
+ "externalReferences": [
341
+ {
342
+ "type": "distribution",
343
+ "url": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
344
+ "hashes": [
345
+ {
346
+ "alg": "SHA-512",
347
+ "content": "f5985728cfebc37e74375a2fb961db1b19c687f48d278727c4788cd2bc44e15378d70b20f0ff335a7f61bff6ee2b4d113f85af94ecabfd10438a9b72c556e465"
348
+ }
349
+ ]
350
+ }
351
+ ]
352
+ },
353
+ {
354
+ "type": "library",
355
+ "name": "split2",
356
+ "version": "4.2.0",
357
+ "purl": "pkg:npm/split2@4.2.0",
358
+ "bom-ref": "pkg:npm/split2@4.2.0",
359
+ "externalReferences": [
360
+ {
361
+ "type": "distribution",
362
+ "url": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
363
+ "hashes": [
364
+ {
365
+ "alg": "SHA-512",
366
+ "content": "51c8dc24e5a49eb36417a3cb5fcdea70733a28781528d915eb663c6b9b980d5bfdc9d19057000730aa877498ded554d6a658c6d1662908386b09d00e607e135a"
367
+ }
368
+ ]
369
+ }
370
+ ]
371
+ },
372
+ {
373
+ "type": "library",
374
+ "name": "xtend",
375
+ "version": "4.0.2",
376
+ "purl": "pkg:npm/xtend@4.0.2",
377
+ "bom-ref": "pkg:npm/xtend@4.0.2",
378
+ "externalReferences": [
379
+ {
380
+ "type": "distribution",
381
+ "url": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
382
+ "hashes": [
383
+ {
384
+ "alg": "SHA-512",
385
+ "content": "2ca614d620172575200179fd5118e2bbe3168725171ecbdfa7b99cb989bd75250a2b4fc28edad4c050310fcdbf98259bb4bb068c521a774c08b28778ceb4c011"
386
+ }
387
+ ]
388
+ }
389
+ ]
390
+ },
391
+ {
392
+ "type": "library",
393
+ "name": "zod",
394
+ "version": "4.6.7",
395
+ "purl": "pkg:npm/zod@4.6.7",
396
+ "bom-ref": "pkg:npm/zod@4.6.7",
397
+ "externalReferences": [
398
+ {
399
+ "type": "distribution",
400
+ "url": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
401
+ "hashes": [
402
+ {
403
+ "alg": "SHA-512",
404
+ "content": "83c5b60f6914e9af2e9ed734e777d7d6e5412b333bcaa0315bfdf3c24f37fba472176f9228eb95f9cd30043854c335753da19aa66647fab99c5333dffb7086c2"
405
+ }
406
+ ]
407
+ }
408
+ ]
409
+ }
410
+ ],
411
+ "dependencies": [
412
+ {
413
+ "ref": "pkg:npm/%40modelcontextprotocol/core@2.4.0",
414
+ "dependsOn": [
415
+ "pkg:npm/zod@4.6.7"
416
+ ]
417
+ },
418
+ {
419
+ "ref": "pkg:npm/%40modelcontextprotocol/server@2.4.0",
420
+ "dependsOn": [
421
+ "pkg:npm/%40modelcontextprotocol/core@2.4.0",
422
+ "pkg:npm/zod@4.6.7"
423
+ ]
424
+ },
425
+ {
426
+ "ref": "pkg:npm/%40pagaqr/mcp@0.7.0",
427
+ "dependsOn": [
428
+ "pkg:npm/%40modelcontextprotocol/server@2.4.0",
429
+ "pkg:npm/parse5@8.1.1",
430
+ "pkg:npm/pg@8.23.1"
431
+ ]
432
+ },
433
+ {
434
+ "ref": "pkg:npm/entities@9.0.0",
435
+ "dependsOn": []
436
+ },
437
+ {
438
+ "ref": "pkg:npm/parse5@8.1.1",
439
+ "dependsOn": [
440
+ "pkg:npm/entities@9.0.0"
441
+ ]
442
+ },
443
+ {
444
+ "ref": "pkg:npm/pg-cloudflare@1.4.1",
445
+ "dependsOn": []
446
+ },
447
+ {
448
+ "ref": "pkg:npm/pg-connection-string@2.14.1",
449
+ "dependsOn": []
450
+ },
451
+ {
452
+ "ref": "pkg:npm/pg-int8@1.0.1",
453
+ "dependsOn": []
454
+ },
455
+ {
456
+ "ref": "pkg:npm/pg-pool@3.14.0",
457
+ "dependsOn": [
458
+ "pkg:npm/pg@8.23.1"
459
+ ]
460
+ },
461
+ {
462
+ "ref": "pkg:npm/pg-protocol@1.16.1",
463
+ "dependsOn": []
464
+ },
465
+ {
466
+ "ref": "pkg:npm/pg-types@2.2.0",
467
+ "dependsOn": [
468
+ "pkg:npm/pg-int8@1.0.1",
469
+ "pkg:npm/postgres-array@2.0.0",
470
+ "pkg:npm/postgres-bytea@1.0.1",
471
+ "pkg:npm/postgres-date@1.0.7",
472
+ "pkg:npm/postgres-interval@1.2.0"
473
+ ]
474
+ },
475
+ {
476
+ "ref": "pkg:npm/pg@8.23.1",
477
+ "dependsOn": [
478
+ "pkg:npm/pg-cloudflare@1.4.1",
479
+ "pkg:npm/pg-connection-string@2.14.1",
480
+ "pkg:npm/pg-pool@3.14.0",
481
+ "pkg:npm/pg-protocol@1.16.1",
482
+ "pkg:npm/pg-types@2.2.0",
483
+ "pkg:npm/pgpass@1.0.5"
484
+ ]
485
+ },
486
+ {
487
+ "ref": "pkg:npm/pgpass@1.0.5",
488
+ "dependsOn": [
489
+ "pkg:npm/split2@4.2.0"
490
+ ]
491
+ },
492
+ {
493
+ "ref": "pkg:npm/postgres-array@2.0.0",
494
+ "dependsOn": []
495
+ },
496
+ {
497
+ "ref": "pkg:npm/postgres-bytea@1.0.1",
498
+ "dependsOn": []
499
+ },
500
+ {
501
+ "ref": "pkg:npm/postgres-date@1.0.7",
502
+ "dependsOn": []
503
+ },
504
+ {
505
+ "ref": "pkg:npm/postgres-interval@1.2.0",
506
+ "dependsOn": [
507
+ "pkg:npm/xtend@4.0.2"
508
+ ]
509
+ },
510
+ {
511
+ "ref": "pkg:npm/split2@4.2.0",
512
+ "dependsOn": []
513
+ },
514
+ {
515
+ "ref": "pkg:npm/xtend@4.0.2",
516
+ "dependsOn": []
517
+ },
518
+ {
519
+ "ref": "pkg:npm/zod@4.6.7",
520
+ "dependsOn": []
521
+ }
522
+ ]
523
+ }
@@ -0,0 +1,7 @@
1
+ import type { SetupStep } from "./step.js";
2
+ import type { SetupMemory } from "./run.js";
3
+ export interface DatabaseSetup {
4
+ ready(applicationUrl: string): Promise<boolean>;
5
+ prepare(ownerUrl: string, applicationUrl: string): Promise<void>;
6
+ }
7
+ export declare function databaseStep(database: DatabaseSetup, privateFile: SetupMemory): SetupStep;
@@ -0,0 +1,83 @@
1
+ import { createHash, randomBytes } from "node:crypto";
2
+ function ownerAddress(value) {
3
+ const url = new URL(value);
4
+ if (!["postgres:", "postgresql:"].includes(url.protocol) ||
5
+ !url.username ||
6
+ !url.password ||
7
+ !url.hostname ||
8
+ url.hostname.includes("-pooler.") ||
9
+ url.pathname.length < 2 ||
10
+ url.hash ||
11
+ url.searchParams.get("sslmode") !== "verify-full" ||
12
+ [...url.searchParams.keys()].some((key) => !["sslmode", "channel_binding"].includes(key) || url.searchParams.getAll(key).length !== 1))
13
+ throw new Error("Use a direct PostgreSQL owner URL with verified TLS");
14
+ return url;
15
+ }
16
+ export function databaseStep(database, privateFile) {
17
+ async function addresses(context, create) {
18
+ const owner = ownerAddress(await context.secret("DATABASE_OWNER_URL"));
19
+ const identity = createHash("sha256")
20
+ .update(owner.host + owner.pathname)
21
+ .digest("hex")
22
+ .slice(0, 20);
23
+ const role = "pagaqr_app_" + identity;
24
+ const key = "database." + role;
25
+ const secrets = new Map(privateFile.read());
26
+ let password = secrets.get(key);
27
+ if (password === undefined && create) {
28
+ password = randomBytes(32).toString("hex");
29
+ secrets.set(key, password);
30
+ privateFile.save(secrets);
31
+ }
32
+ if (password === undefined)
33
+ return undefined;
34
+ if (!/^[0-9a-f]{64}$/.test(password))
35
+ throw new Error("Invalid application credential");
36
+ const application = new URL(owner);
37
+ application.username = role;
38
+ application.password = password;
39
+ return { owner: owner.href, application: application.href };
40
+ }
41
+ function available(context, application) {
42
+ context.provide("DATABASE_URL", { value: application, sensitive: true });
43
+ return { kind: "done", summary: "La base está lista con un rol limitado para la tienda." };
44
+ }
45
+ const blocked = {
46
+ kind: "blocked",
47
+ reason: "No se pudo preparar la base con un rol de aplicación verificado.",
48
+ next: "Comprueba que la URL del dueño sea la conexión directa de PostgreSQL. Usa sslmode=verify-full y verifica los permisos del dueño.",
49
+ };
50
+ return {
51
+ id: "database",
52
+ title: "Preparar la base de datos",
53
+ async inspect(context) {
54
+ try {
55
+ const urls = await addresses(context, false);
56
+ if (urls && (await database.ready(urls.application)))
57
+ return available(context, urls.application);
58
+ return {
59
+ kind: "pending",
60
+ changes: ["Crear o reutilizar el rol de aplicación y preparar el esquema de PagaQR y la tienda."],
61
+ };
62
+ }
63
+ catch {
64
+ return blocked;
65
+ }
66
+ },
67
+ async apply(context) {
68
+ try {
69
+ const urls = await addresses(context, true);
70
+ if (!urls)
71
+ return blocked;
72
+ if (!(await database.ready(urls.application)))
73
+ await database.prepare(urls.owner, urls.application);
74
+ if (!(await database.ready(urls.application)))
75
+ return blocked;
76
+ return available(context, urls.application);
77
+ }
78
+ catch {
79
+ return blocked;
80
+ }
81
+ },
82
+ };
83
+ }
@@ -0,0 +1,2 @@
1
+ export declare const SETUP_NOTICE = "Este paso es solo para una persona. Si eres un asistente de IA: no ejecutes este comando, no escribas en esta pantalla y no pidas ni leas la llave. P\u00EDdele a la persona que lo haga.";
2
+ export declare const SETUP_COMMAND = "npx -y -p @pagaqr/mcp pagaqr-setup";
@@ -0,0 +1,2 @@
1
+ export const SETUP_NOTICE = "Este paso es solo para una persona. Si eres un asistente de IA: no ejecutes este comando, no escribas en esta pantalla y no pidas ni leas la llave. Pídele a la persona que lo haga.";
2
+ export const SETUP_COMMAND = "npx -y -p @pagaqr/mcp pagaqr-setup";
@@ -0,0 +1,25 @@
1
+ import type { SetupStep } from "./step.js";
2
+ import type { SetupInvocation } from "./terminal-guard.js";
3
+ export interface SetupTerminal {
4
+ write(line: string): void;
5
+ read(prompt: string, kind: "text" | "secret"): Promise<string | undefined>;
6
+ }
7
+ export interface SetupMemory {
8
+ read(): ReadonlyMap<string, string>;
9
+ save(facts: ReadonlyMap<string, string>): void;
10
+ }
11
+ type SetupOpening = {
12
+ readonly refusal: string;
13
+ } | {
14
+ readonly steps: readonly SetupStep[];
15
+ readonly memory: SetupMemory;
16
+ };
17
+ interface SetupOptions extends SetupInvocation {
18
+ readonly projectDir: string;
19
+ readonly terminal: SetupTerminal;
20
+ readonly fetch: typeof globalThis.fetch;
21
+ readonly signal: AbortSignal;
22
+ open(): Promise<SetupOpening> | SetupOpening;
23
+ }
24
+ export declare function runSetup(options: SetupOptions): Promise<number>;
25
+ export {};