@pasosdejesus/mpdj 0.1.1 → 0.2.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/SKILL.md CHANGED
@@ -159,6 +159,14 @@ If you have direct terminal and filesystem access (Crush, Cursor, etc.), **do no
159
159
  ./bin/m db:check # Verifies expected DB schemas (WBA, credentials) against actual DB
160
160
  ```
161
161
 
162
+ ### DB Environment Variables
163
+
164
+ | Variable | Default | Purpose |
165
+ |----------|---------|---------|
166
+ | `PG_TIMEOUT` | `30` | Migration timeout in seconds |
167
+ | `M_POST_MIGRATE` | — | Command to run after `db:migrate`/`db:rollback` |
168
+ ```
169
+
162
170
  ### Engine Commands
163
171
 
164
172
  ```bash
package/dist/SKILL.md CHANGED
@@ -159,6 +159,14 @@ If you have direct terminal and filesystem access (Crush, Cursor, etc.), **do no
159
159
  ./bin/m db:check # Verifies expected DB schemas (WBA, credentials) against actual DB
160
160
  ```
161
161
 
162
+ ### DB Environment Variables
163
+
164
+ | Variable | Default | Purpose |
165
+ |----------|---------|---------|
166
+ | `PG_TIMEOUT` | `30` | Migration timeout in seconds |
167
+ | `M_POST_MIGRATE` | — | Command to run after `db:migrate`/`db:rollback` |
168
+ ```
169
+
162
170
  ### Engine Commands
163
171
 
164
172
  ```bash
@@ -26,6 +26,7 @@ import { problem } from '@pasosdejesus/m/dist/util/colors.js';
26
26
  import { createTranslator } from '@pasosdejesus/m/dist/i18n/createTranslator.js';
27
27
  import { detectLocale } from '@pasosdejesus/m/dist/util/locale.js';
28
28
  import commonCli from '@pasosdejesus/m/dist/i18n/common-cli.js';
29
+ import { runHooks } from '@pasosdejesus/m/dist/plugin.js';
29
30
  const require = createRequire(import.meta.url);
30
31
  const locale = detectLocale();
31
32
  const ct = createTranslator(locale, {
@@ -335,8 +336,10 @@ async function registerType(args) {
335
336
  console.warn(ct('cred.image_failed', String(tokenId), err.message));
336
337
  }
337
338
  }
339
+ // Save to credential_metadata cache
340
+ let db = null;
338
341
  try {
339
- const db = await newDb();
342
+ db = await newDb();
340
343
  await db
341
344
  .insertInto('credential_metadata')
342
345
  .values({
@@ -359,6 +362,10 @@ async function registerType(args) {
359
362
  catch (err) {
360
363
  console.warn(ct('cred.cache_failed', err.message));
361
364
  }
365
+ // Notify extensions (learn.tg#200: course_id handling)
366
+ if (courseId > 0 && db) {
367
+ await runHooks('credentials:post-register-type', { tokenId, courseId, db });
368
+ }
362
369
  console.log(ct('cred.register_success', String(tokenId), site, type, display));
363
370
  }
364
371
  async function recomposeImage(args) {
@@ -475,6 +482,16 @@ async function syncCache(network) {
475
482
  .execute();
476
483
  count++;
477
484
  console.log(ct('cred.sync_row', String(i), String(name)));
485
+ // Notify extensions (learn.tg#200: course_id handling)
486
+ let courseId = 0;
487
+ try {
488
+ courseId = Number(await pc.readContract({
489
+ address: addr, abi: credentialsAbi,
490
+ functionName: 'tokenIdToCourseId', args: [BigInt(i)],
491
+ }));
492
+ }
493
+ catch { }
494
+ await runHooks('credentials:post-sync-cache', { tokenId: i, courseId, db });
478
495
  }
479
496
  catch { /* skip */ }
480
497
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pasosdejesus/mpdj",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Extensión Pasos de Jesús para m CLI — marco cristiano, credenciales, requerimientos",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -55,7 +55,7 @@
55
55
  "REQ"
56
56
  ],
57
57
  "dependencies": {
58
- "@pasosdejesus/m": "0.16.1"
58
+ "@pasosdejesus/m": "0.17.0"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "vitest": "^2.1.9"