@ntlinkmx/nt 0.0.0-stage → 0.2.1

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/package.json CHANGED
@@ -1,6 +1,41 @@
1
- {
2
- "name": "@ntlinkmx/nt",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@ntlinkmx/nt",
3
+ "version": "0.2.1",
4
+ "description": "CLI ntlink para el backend Go de NTLink IA Invoice",
5
+ "type": "module",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/NTlink/ntlink-ia-invoice.git",
9
+ "directory": "cli"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "bin": {
15
+ "nt": "dist/cli.js"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md",
20
+ "scripts"
21
+ ],
22
+ "engines": {
23
+ "node": ">=22.12"
24
+ },
25
+ "scripts": {
26
+ "build": "tsc",
27
+ "typecheck": "tsc --noEmit",
28
+ "test": "npm run build && node --test tests/*.test.mjs",
29
+ "start": "node dist/cli.js",
30
+ "routes:sync": "node scripts/sync-routes.mjs",
31
+ "prepare": "npm run build",
32
+ "postinstall": "node scripts/postinstall.mjs"
33
+ },
34
+ "dependencies": {
35
+ "commander": "^12.1.0"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^22.0.0",
39
+ "typescript": "^5.9.3"
40
+ }
41
+ }
@@ -0,0 +1,7 @@
1
+ console.log(`
2
+ NTLink CLI listo - MODO PRUEBAS
3
+ La sesión de demostración se inicia automáticamente al usar un comando protegido.
4
+ Correo: URE180429TM6@ntlink.com.mx
5
+ Contraseña: NTPruebas.2021*?
6
+ El CLI apunta al servidor remoto de pruebas; producción estará disponible próximamente.
7
+ `);
@@ -0,0 +1,17 @@
1
+ import { readFileSync, writeFileSync } from 'node:fs';
2
+ const root = new URL('../../', import.meta.url);
3
+ const routes = JSON.parse(readFileSync(new URL('backend/internal/legacy/routes.json', root), 'utf8'));
4
+ const current = JSON.parse(readFileSync(new URL('doc/reference/native-routes.json', root), 'utf8')).routes;
5
+ const mapped = routes.map(({ method, path, controller, action, anonymous }) => ({
6
+ method, path, controller, action, anonymous,
7
+ registered: !!current.find(r => r.method === method && r.path === path)?.go_registration,
8
+ }));
9
+ writeFileSync(new URL('../src/native-routes.json', import.meta.url), JSON.stringify(mapped, null, 2) + '\n');
10
+ const readmeUrl = new URL('../README.md', import.meta.url);
11
+ const readme = readFileSync(readmeUrl, 'utf8');
12
+ const table = ['| Comando (`ntlink native …`) | HTTP | Ruta Go |', '|---|---|---|', ...mapped.map(r => {
13
+ const action = r.action.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
14
+ return `| \`${r.controller.toLowerCase()} ${action}\` | ${r.method} | \`${r.path}\` |`;
15
+ })].join('\n');
16
+ writeFileSync(readmeUrl, readme.replace(/<!-- native-routes:start -->[\s\S]*?<!-- native-routes:end -->/, `<!-- native-routes:start -->\n${table}\n<!-- native-routes:end -->`));
17
+ console.log(`Mapeadas ${mapped.length} rutas nativas desde el registro del backend.`);