@ureck/alexandria 1.0.0 → 1.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.
@@ -1,18 +1,20 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  hybridSearch
4
- } from "./chunk-RZI7TYAG.js";
4
+ } from "./chunk-UWB6RKVN.js";
5
5
 
6
6
  // src/core/planning.ts
7
+ var MAX_ITEMS = 2;
8
+ var EXCERPT_CHARS = 150;
7
9
  async function planContext(vault, query) {
8
10
  const out = { similarPlans: [], lessons: [] };
9
11
  try {
10
12
  const results = await hybridSearch(vault, query, 8);
11
13
  for (const r of results) {
12
- const excerpt = (r.excerpts[0] ?? "").replace(/\n+/g, " ").slice(0, 300);
13
- if (r.note.type === "plan" && out.similarPlans.length < 3) {
14
- out.similarPlans.push(`\xAB${r.note.title}\xBB (${r.note.status ?? "sin status"}): ${excerpt}`);
15
- } else if ((r.note.type === "lesson" || r.note.type === "solution") && out.lessons.length < 3) {
14
+ const excerpt = (r.excerpts[0] ?? "").replace(/\n+/g, " ").slice(0, EXCERPT_CHARS);
15
+ if (r.note.type === "plan" && out.similarPlans.length < MAX_ITEMS) {
16
+ out.similarPlans.push(`\xAB${r.note.title}\xBB (${r.note.status ?? "?"}): ${excerpt}`);
17
+ } else if ((r.note.type === "lesson" || r.note.type === "solution") && out.lessons.length < MAX_ITEMS) {
16
18
  out.lessons.push(`\xAB${r.note.title}\xBB: ${excerpt}`);
17
19
  }
18
20
  }
@@ -21,39 +23,23 @@ async function planContext(vault, query) {
21
23
  return out;
22
24
  }
23
25
  var FAT_TASK_CHARS = 140;
26
+ var MAX_HINTS = 3;
24
27
  function planQualityHints(dod, tasks, design) {
25
28
  const hints = [];
26
- if (dod.length < 2) {
27
- hints.push("DoD con menos de 2 criterios \u2014 agrega criterios verificables por comando (tests, build, curl).");
28
- }
29
- const vague = dod.filter((d) => /funcione bien|quede bonito|esté listo|sea mejor/i.test(d));
30
- if (vague.length) {
31
- hints.push(`Criterios no verificables (${vague.length}): reescr\xEDbelos como algo que un comando pueda confirmar.`);
32
- }
33
29
  const fat = tasks.filter((t) => t.length > FAT_TASK_CHARS);
34
- if (fat.length) {
35
- hints.push(`${fat.length} tarea(s) muy grandes (>${FAT_TASK_CHARS} chars) \u2014 div\xEDdelas: una tarea = un task_verify.`);
36
- }
37
- if (tasks.length > 5 && !design?.trim()) {
38
- hints.push("Plan grande sin secci\xF3n de dise\xF1o \u2014 considera pasar `design` (stack/decisiones de arquitectura) para fijar el rumbo antes de ejecutar.");
39
- }
40
- return hints;
30
+ if (fat.length) hints.push(`${fat.length} tarea(s) gorda(s) (>${FAT_TASK_CHARS}c) \u2014 1 tarea = 1 task_verify`);
31
+ if (dod.length < 2) hints.push("DoD <2 criterios verificables");
32
+ const vague = dod.filter((d) => /funcione bien|quede bonito|esté listo|sea mejor/i.test(d));
33
+ if (vague.length) hints.push(`${vague.length} criterio(s) no verificable(s) por comando`);
34
+ if (tasks.length > 5 && !design?.trim()) hints.push("sin `design` (plan grande)");
35
+ return hints.slice(0, MAX_HINTS);
41
36
  }
42
37
  function architectBlock(ctx, hints) {
43
38
  const parts = [];
44
- if (ctx.similarPlans.length) {
45
- parts.push(`PLANES SIMILARES PREVIOS (resume, no dupliques):
46
- ${ctx.similarPlans.map((p) => `- ${p}`).join("\n")}`);
47
- }
48
- if (ctx.lessons.length) {
49
- parts.push(`LECCIONES RELEVANTES (consid\xE9ralas al planear):
50
- ${ctx.lessons.map((l) => `- ${l}`).join("\n")}`);
51
- }
52
- if (hints.length) {
53
- parts.push(`SUGERENCIAS DE CALIDAD (el plan qued\xF3 guardado; mej\xF3ralo si aplican):
54
- ${hints.map((h) => `- ${h}`).join("\n")}`);
55
- }
56
- return parts.join("\n\n");
39
+ for (const p of ctx.similarPlans) parts.push(`Similar: ${p}`);
40
+ for (const l of ctx.lessons) parts.push(`Lecci\xF3n: ${l}`);
41
+ if (hints.length) parts.push(`Hints: ${hints.join(" \xB7 ")}`);
42
+ return parts.join("\n");
57
43
  }
58
44
 
59
45
  // src/core/register.ts
@@ -187,12 +173,12 @@ export {
187
173
  planContext,
188
174
  planQualityHints,
189
175
  architectBlock,
190
- distDir,
191
176
  registerHooks,
192
177
  unregisterHooks,
193
178
  projectSettingsPath,
194
179
  globalSettingsPath,
195
180
  hooksRegistered,
181
+ serverCommand,
196
182
  registerMcpProject,
197
183
  registerMcpGlobal,
198
184
  mcpRegisteredProject,