local-agent-memory 1.0.3 → 1.0.4

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/README.md CHANGED
@@ -44,7 +44,16 @@ Comprueba el estado de sincronización del proyecto de memoria actual, mostrando
44
44
  memory status
45
45
  ```
46
46
 
47
- ### 4. `reindex` (o `prune`)
47
+ ### 4. `list` (o `projects`)
48
+ Muestra de forma interactiva una lista de todos los proyectos registrados globalmente en tu máquina. Permite seleccionar un proyecto y ver detalles como el total de archivos indexados, los registros de decisiones (ADRs) y los resúmenes de sesión (Ledgers) para ese proyecto.
49
+
50
+ ```bash
51
+ memory list
52
+ # o
53
+ memory projects
54
+ ```
55
+
56
+ ### 5. `reindex` (o `prune`)
48
57
  Reconstruye los índices FTS (texto completo) y vectoriales desde cero. Útil si sospechas que hay corrupción o desincronización en la base de datos local.
49
58
 
50
59
  ```bash
@@ -53,7 +62,7 @@ memory reindex
53
62
  memory prune
54
63
  ```
55
64
 
56
- ### 5. `record-session`
65
+ ### 6. `record-session`
57
66
  Registra un resumen de tu sesión de trabajo actual en el "ledger" (libro mayor) de memoria, documentando las tareas completadas y el contexto para retomarlo más adelante.
58
67
 
59
68
  **Opciones:**
@@ -63,14 +72,14 @@ Registra un resumen de tu sesión de trabajo actual en el "ledger" (libro mayor)
63
72
  memory record-session -s "Implementación del comando sync y corrección de bugs en SQLite"
64
73
  ```
65
74
 
66
- ### 6. `install-hook`
75
+ ### 7. `install-hook`
67
76
  Instala ganchos de Git (Git hooks) en tu repositorio local para recordar automáticamente a los desarrolladores registrar sesiones al hacer commits, o para automatizar el registro.
68
77
 
69
78
  ```bash
70
79
  memory install-hook
71
80
  ```
72
81
 
73
- ### 7. `template <action>`
82
+ ### 8. `template <action>`
74
83
  Gestiona las plantillas de memoria (permite listar, crear o exportar plantillas desde el proyecto).
75
84
 
76
85
  **Opciones:**
@@ -0,0 +1 @@
1
+ export declare function listProjects(): Promise<void>;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.listProjects = listProjects;
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ const inquirer_1 = __importDefault(require("inquirer"));
10
+ const ora_1 = __importDefault(require("ora"));
11
+ const project_1 = require("../../db/project");
12
+ const registry_1 = require("../../db/registry");
13
+ async function listProjects() {
14
+ const spinner = (0, ora_1.default)("Cargando proyectos registrados...").start();
15
+ try {
16
+ const projects = await (0, registry_1.getAllProjectsFromRegistry)();
17
+ if (!projects || projects.length === 0) {
18
+ spinner.info("No hay proyectos registrados en la memoria global.");
19
+ return;
20
+ }
21
+ spinner.stop();
22
+ const { selectedPath } = await inquirer_1.default.prompt([
23
+ {
24
+ type: "list",
25
+ name: "selectedPath",
26
+ message: "Selecciona un proyecto para ver sus detalles:",
27
+ choices: projects.map((p) => ({
28
+ name: `${p.project_id} (${p.file_path}) - Creado: ${new Date(p.created_at).toLocaleString()}`,
29
+ value: p.file_path,
30
+ })),
31
+ },
32
+ ]);
33
+ console.log(`\nCargando datos para el proyecto en: ${selectedPath}`);
34
+ const memoryDir = node_path_1.default.join(selectedPath, ".memory");
35
+ if (!node_fs_1.default.existsSync(memoryDir)) {
36
+ console.log(`❌ La carpeta .memory no existe en el proyecto seleccionado (${memoryDir}).`);
37
+ return;
38
+ }
39
+ const localDbPath = (0, project_1.getLocalDbPath)(selectedPath);
40
+ let manifests = [];
41
+ if (node_fs_1.default.existsSync(localDbPath)) {
42
+ manifests = await (0, project_1.getAllManifests)(localDbPath);
43
+ }
44
+ console.log(`\n=== Registros del Proyecto ===`);
45
+ console.log(`Total de archivos Markdown registrados en la base de datos local: ${manifests.length}`);
46
+ if (manifests.length > 0) {
47
+ console.log(`\nArchivos registrados:`);
48
+ manifests.forEach((m) => {
49
+ console.log(` - ${m.file_path}`);
50
+ });
51
+ }
52
+ // You could also list recent decisions or ledgers specifically if needed
53
+ const decisionsDir = node_path_1.default.join(memoryDir, "decisions");
54
+ if (node_fs_1.default.existsSync(decisionsDir)) {
55
+ const decisions = node_fs_1.default.readdirSync(decisionsDir).filter(f => f.endsWith(".md"));
56
+ if (decisions.length > 0) {
57
+ console.log(`\nDecisiones Arquitectónicas (ADRs):`);
58
+ decisions.forEach(d => console.log(` - decisions/${d}`));
59
+ }
60
+ }
61
+ const ledgerDir = node_path_1.default.join(memoryDir, "ledger");
62
+ if (node_fs_1.default.existsSync(ledgerDir)) {
63
+ const ledgers = node_fs_1.default.readdirSync(ledgerDir).filter(f => f.endsWith(".md"));
64
+ if (ledgers.length > 0) {
65
+ console.log(`\nRegistros de Sesión (Ledger):`);
66
+ ledgers.forEach(l => console.log(` - ledger/${l}`));
67
+ }
68
+ }
69
+ console.log("\n==============================");
70
+ }
71
+ catch (err) {
72
+ spinner.fail("Error al listar proyectos.");
73
+ console.error(err.message);
74
+ process.exit(1);
75
+ }
76
+ }
package/dist/cli/index.js CHANGED
@@ -19,10 +19,16 @@ program
19
19
  .version(require("../../package.json").version);
20
20
  const hook_1 = require("./commands/hook");
21
21
  const init_1 = require("./commands/init");
22
+ const list_1 = require("./commands/list");
22
23
  const record_1 = require("./commands/record");
23
24
  const status_1 = require("./commands/status");
24
25
  const sync_1 = require("./commands/sync");
25
26
  const template_1 = require("./commands/template");
27
+ program
28
+ .command("list")
29
+ .alias("projects")
30
+ .description("List registered projects and view their records")
31
+ .action(list_1.listProjects);
26
32
  program
27
33
  .command("init")
28
34
  .description("Initialize a new memory project")
@@ -7,3 +7,9 @@ export declare function getProjectRootFromRegistry(activePath: string, dbPath?:
7
7
  path: string;
8
8
  fallback: boolean;
9
9
  } | null>;
10
+ export interface RegistryProject {
11
+ project_id: string;
12
+ file_path: string;
13
+ created_at: string;
14
+ }
15
+ export declare function getAllProjectsFromRegistry(dbPath?: string): Promise<RegistryProject[]>;
@@ -8,6 +8,7 @@ exports.initRegistryDb = initRegistryDb;
8
8
  exports.registerProject = registerProject;
9
9
  exports.getProjectByPath = getProjectByPath;
10
10
  exports.getProjectRootFromRegistry = getProjectRootFromRegistry;
11
+ exports.getAllProjectsFromRegistry = getAllProjectsFromRegistry;
11
12
  const node_fs_1 = __importDefault(require("node:fs"));
12
13
  const node_path_1 = __importDefault(require("node:path"));
13
14
  const sqlite3_1 = __importDefault(require("sqlite3"));
@@ -90,3 +91,15 @@ async function getProjectRootFromRegistry(activePath, dbPath = getRegistryDbPath
90
91
  });
91
92
  });
92
93
  }
94
+ async function getAllProjectsFromRegistry(dbPath = getRegistryDbPath()) {
95
+ return new Promise((resolve, reject) => {
96
+ const db = initRegistryDb(dbPath);
97
+ db.all("SELECT project_id, file_path, created_at FROM projects ORDER BY created_at DESC", [], (err, rows) => {
98
+ db.close();
99
+ if (err) {
100
+ return reject(err);
101
+ }
102
+ resolve(rows);
103
+ });
104
+ });
105
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "local-agent-memory",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",