nexakit 0.5.1 → 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.
- package/.claude-plugin/marketplace.json +5 -0
- package/README.md +2 -1
- package/assets/runtime/package-lock.json +25 -1109
- package/package.json +3 -6
- package/plugins/huellas.json +4 -0
- package/plugins/nexakit-guardarrailes/.claude-plugin/plugin.json +1 -0
- package/plugins/nexakit-guardarrailes/README.md +63 -0
- package/plugins/nexakit-guardarrailes/hooks/guardarrailes.js +466 -0
- package/plugins/nexakit-guardarrailes/hooks/hooks.json +1 -0
- package/plugins/nexakit-guardarrailes/hooks/register.js +26 -0
- package/plugins/nexakit-guardarrailes/tests/register.test.ts +228 -0
- package/schemas/project-memory.schema.json +21 -0
- package/src/connect.js +53 -30
- package/src/memory-connection-plan.js +9 -3
- package/src/memory-mcp-server.js +26 -16
- package/src/memory-mcp-transport.js +1 -1
- package/src/mods.js +93 -0
- package/src/setup-apply.js +6 -1
- package/src/setup-plan.js +69 -3
- package/src/setup-state.js +3 -0
- package/src/setup-tui.js +74 -15
- package/src/skill-recommendations.js +2 -0
- package/src/stable-install.js +1 -1
- package/src/superpowers.js +1 -1
- package/src/sync-inspect.js +15 -6
- package/src/toolkit-cli.js +29 -3
- package/src/toolkit-commands-guide.js +1 -1
- package/src/toolkit-setup.js +10 -2
package/src/setup-apply.js
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
import { planStableCommand, writeStableCommand } from './stable-command.js';
|
|
22
22
|
import { ensureStableInstall, nexakitDir } from './stable-install.js';
|
|
23
23
|
import { packageVersion, setupToolkit } from './toolkit-setup.js';
|
|
24
|
+
import { applyMod } from './mods.js';
|
|
24
25
|
import { applySuperpowers } from './superpowers.js';
|
|
25
26
|
|
|
26
27
|
const RETRY = 'Vuelve a ejecutar `npx nexakit` para reintentar.';
|
|
@@ -199,6 +200,9 @@ export async function applySetup(
|
|
|
199
200
|
if (kind === 'superpowers') {
|
|
200
201
|
return applySuperpowers(agent, state.superpowers?.[agent], { environment, ...(runCommand && { runCommand }) });
|
|
201
202
|
}
|
|
203
|
+
if (kind === 'mod') {
|
|
204
|
+
return applyMod(agent, state.mods?.[agent], { environment, ...(runCommand && { runCommand }) });
|
|
205
|
+
}
|
|
202
206
|
if (kind === 'memory-connect') {
|
|
203
207
|
await withLock(homeDirectory, acquire, (lock) =>
|
|
204
208
|
ensureMemoryAgent(memoryPath, agent, state.project.root, lock),
|
|
@@ -229,7 +233,8 @@ export async function applySetup(
|
|
|
229
233
|
onProgress(id, 'failed', message);
|
|
230
234
|
// Superpowers comes from each agent's own marketplace: when that fails, the memory, the rules and the other
|
|
231
235
|
// agents are still worth leaving ready. The run ends as not ready and the final check lists it as pending.
|
|
232
|
-
|
|
236
|
+
// The mods come from the same kind of plugin marketplace: one that fails does not stop the rest either.
|
|
237
|
+
if (id.startsWith('superpowers:') || id.startsWith('mod:')) {
|
|
233
238
|
skipped.push({ id, message });
|
|
234
239
|
continue;
|
|
235
240
|
}
|
package/src/setup-plan.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Pure: turns what nexakit found (setup-state.js) and the person's answers into the confirmation summary, in short
|
|
2
2
|
// sentences, and the ordered blocks that apply it. No I/O, so every screen and every decision is testable.
|
|
3
|
+
import { MODS } from './mods.js';
|
|
3
4
|
|
|
4
5
|
export const AGENTS = Object.freeze(['claude', 'codex', 'antigravity']);
|
|
5
6
|
export const AGENT_NAMES = Object.freeze({
|
|
@@ -23,6 +24,19 @@ export const shortPath = (target, homeDirectory) =>
|
|
|
23
24
|
target.startsWith(`${homeDirectory}\\`))
|
|
24
25
|
? `~${target.slice(homeDirectory.length)}`
|
|
25
26
|
: target;
|
|
27
|
+
|
|
28
|
+
// The confirmation screen groups its lines under these headings, in this order, skipping empty sections.
|
|
29
|
+
export const SECTION_TITLES = Object.freeze({
|
|
30
|
+
proyecto: 'Proyecto',
|
|
31
|
+
ia: 'Tus IA',
|
|
32
|
+
mods: 'Mods de Claude Code',
|
|
33
|
+
memoria: 'Memoria',
|
|
34
|
+
});
|
|
35
|
+
export function groupLines(lines) {
|
|
36
|
+
return Object.entries(SECTION_TITLES)
|
|
37
|
+
.map(([section, title]) => ({ section, title, lines: lines.filter((line) => line.section === section) }))
|
|
38
|
+
.filter((group) => group.lines.length);
|
|
39
|
+
}
|
|
26
40
|
const plural = (count, one, many) => (count === 1 ? one : many);
|
|
27
41
|
|
|
28
42
|
// "frontend usa React", "el README menciona Tauri": the reason for a suggestion, from where the signal was found.
|
|
@@ -53,6 +67,7 @@ export function suggestedAnswers(state) {
|
|
|
53
67
|
skills: { chosen, discarded: saved.skills.discarded.filter((name) => names.has(name)) },
|
|
54
68
|
agents: [...saved.agents],
|
|
55
69
|
memory: { ...saved.memory },
|
|
70
|
+
...modAnswers(state, saved.agents, saved),
|
|
56
71
|
};
|
|
57
72
|
}
|
|
58
73
|
const installed = (skill) => Object.values(skill.links ?? {}).includes('installed');
|
|
@@ -70,15 +85,42 @@ export function suggestedAnswers(state) {
|
|
|
70
85
|
},
|
|
71
86
|
agents: found.length ? found : [...AGENTS],
|
|
72
87
|
memory,
|
|
88
|
+
...modAnswers(state, found.length ? found : AGENTS, null),
|
|
73
89
|
};
|
|
74
90
|
}
|
|
75
91
|
|
|
76
|
-
const
|
|
92
|
+
const MOD_NAMES = MODS.map((mod) => mod.name);
|
|
93
|
+
const NOT_SUGGESTED = new Set(['activo', 'desconocido']);
|
|
94
|
+
|
|
95
|
+
// The mods the person wants: what they chose before, plus every mod that still needs something (missing, disabled,
|
|
96
|
+
// outdated) unless they discarded it. Without a mods state (no Claude Code) there is nothing to ask, but what was
|
|
97
|
+
// saved is kept. Answers saved before the mods step have no `mods` and read as no discards.
|
|
98
|
+
function modAnswers(state, agents, saved) {
|
|
99
|
+
const before = saved?.mods;
|
|
100
|
+
if (!state.mods) return before ? { mods: { chosen: [...before.chosen], discarded: [...before.discarded] } } : {};
|
|
101
|
+
const suggest = agents.includes('claude');
|
|
102
|
+
const decided = new Set([...(before?.chosen ?? []), ...(before?.discarded ?? [])]);
|
|
103
|
+
const chosen = MOD_NAMES.filter(
|
|
104
|
+
(name) =>
|
|
105
|
+
before?.chosen.includes(name) ||
|
|
106
|
+
(suggest && !decided.has(name) && !NOT_SUGGESTED.has(state.mods[name] ?? 'desconocido')),
|
|
107
|
+
);
|
|
108
|
+
return { mods: { chosen, discarded: MOD_NAMES.filter((name) => before?.discarded.includes(name)) } };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Answers saved before the mods step have no `mods`: they read as no mods chosen and none discarded.
|
|
112
|
+
const withMods = (answers) => ({
|
|
113
|
+
...answers,
|
|
114
|
+
mods: { chosen: [...(answers.mods?.chosen ?? [])].sort(), discarded: [...(answers.mods?.discarded ?? [])].sort() },
|
|
115
|
+
});
|
|
116
|
+
const sameAnswers = (a, b) => JSON.stringify(withMods(a)) === JSON.stringify(withMods(b));
|
|
77
117
|
|
|
78
118
|
export function buildConfirmation(state, answers) {
|
|
79
119
|
const lines = [];
|
|
80
120
|
const blocks = [];
|
|
81
|
-
|
|
121
|
+
// `section` groups the confirmation screen: 'proyecto', 'ia', 'mods' or 'memoria'.
|
|
122
|
+
let section = 'proyecto';
|
|
123
|
+
const add = (mark, text) => lines.push({ mark, text, section });
|
|
82
124
|
const block = (id, label) => blocks.push({ id, label });
|
|
83
125
|
const answersChanged = !state.savedAnswers || !sameAnswers(state.savedAnswers, answers);
|
|
84
126
|
const agents = AGENTS.filter((agent) => answers.agents.includes(agent));
|
|
@@ -128,6 +170,7 @@ export function buildConfirmation(state, answers) {
|
|
|
128
170
|
if (toInstall.length || removeSkills.length) block('project-skills', 'Skills del proyecto');
|
|
129
171
|
|
|
130
172
|
// Base skills of each chosen agent: only what is missing or repairable; conflicts are reported.
|
|
173
|
+
section = 'ia';
|
|
131
174
|
const globalBlocks = [];
|
|
132
175
|
for (const agent of agents) {
|
|
133
176
|
const global = state.globalSkills[agent] ?? { pending: 0, conflicts: 0 };
|
|
@@ -170,7 +213,27 @@ export function buildConfirmation(state, answers) {
|
|
|
170
213
|
}
|
|
171
214
|
if (activeIn.length) add('✓', `Superpowers activo en ${joinNames(activeIn)}`);
|
|
172
215
|
|
|
216
|
+
// Mods: nexakit's own Claude Code plugins. Only the ones the person chose are installed, updated or enabled.
|
|
217
|
+
section = 'mods';
|
|
218
|
+
if (agents.includes('claude') && state.mods) {
|
|
219
|
+
const mods = state.mods;
|
|
220
|
+
const chosenMods = MODS.filter((mod) => answers.mods?.chosen.includes(mod.name));
|
|
221
|
+
for (const mod of chosenMods) {
|
|
222
|
+
const status = mods[mod.name];
|
|
223
|
+
if (status === 'falta') add('+', `Mod ${mod.name} en Claude Code`);
|
|
224
|
+
else if (status === 'actualizable') add('↻', `Actualizar el mod ${mod.name}`);
|
|
225
|
+
else if (status === 'desactivado') add('↻', `Activar el mod ${mod.name}`);
|
|
226
|
+
else continue;
|
|
227
|
+
block(`mod:${mod.name}`, `Mod ${mod.name}`);
|
|
228
|
+
}
|
|
229
|
+
const activeMods = MODS.filter((mod) => mods[mod.name] === 'activo');
|
|
230
|
+
if (activeMods.length) add('✓', `Mods activos en Claude Code: ${joinNames(activeMods.map((mod) => mod.name))}`);
|
|
231
|
+
if (MODS.some((mod) => (mods[mod.name] ?? 'desconocido') === 'desconocido'))
|
|
232
|
+
add('!', 'No pude comprobar los mods de Claude Code; revisa /plugin');
|
|
233
|
+
}
|
|
234
|
+
|
|
173
235
|
// Memory: create it if needed, then connect it to each chosen agent.
|
|
236
|
+
section = 'memoria';
|
|
174
237
|
if (answers.memory.decision === 'path') {
|
|
175
238
|
const target = answers.memory.path;
|
|
176
239
|
const kind = state.memory.kinds?.[target] ?? 'new';
|
|
@@ -213,6 +276,7 @@ export function buildConfirmation(state, answers) {
|
|
|
213
276
|
}
|
|
214
277
|
}
|
|
215
278
|
|
|
279
|
+
section = 'ia';
|
|
216
280
|
const instructionNames = new Set(
|
|
217
281
|
agents.map((agent) => ({ claude: 'CLAUDE.md', codex: 'AGENTS.md', antigravity: 'GEMINI.md' })[agent]),
|
|
218
282
|
);
|
|
@@ -232,8 +296,10 @@ export function buildConfirmation(state, answers) {
|
|
|
232
296
|
if (answersChanged && (blocks.length || state.savedAnswers)) {
|
|
233
297
|
// Saved first, before any block that can fail, so a retry starts from what the person decided.
|
|
234
298
|
blocks.unshift({ id: 'answers', label: 'Respuestas guardadas' });
|
|
235
|
-
if (!blocks.some((item) => item.id === 'project-skills'))
|
|
299
|
+
if (!blocks.some((item) => item.id === 'project-skills')) {
|
|
300
|
+
section = 'proyecto';
|
|
236
301
|
add('+', 'Guardar tus respuestas en .agent-toolkit (ignorado en Git)');
|
|
302
|
+
}
|
|
237
303
|
}
|
|
238
304
|
if (blocks.length) block('final-check', 'Comprobación final');
|
|
239
305
|
const allReady = !lines.some((line) => ['+', '−', '↻'].includes(line.mark));
|
package/src/setup-state.js
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
uncoveredSignals,
|
|
29
29
|
} from './skill-recommendations.js';
|
|
30
30
|
import { planStableCommand } from './stable-command.js';
|
|
31
|
+
import { inspectMods } from './mods.js';
|
|
31
32
|
import { inspectSuperpowers } from './superpowers.js';
|
|
32
33
|
import { compareVersions, readActualVersion } from './stable-install.js';
|
|
33
34
|
import {
|
|
@@ -263,6 +264,7 @@ export async function gatherSetupState({
|
|
|
263
264
|
|
|
264
265
|
const reviewInstructions = await planReviewInstructions({ homeDirectory, environment, codexHome });
|
|
265
266
|
const superpowers = await inspectSuperpowers({ agentsFound, runCommand, environment });
|
|
267
|
+
const mods = await inspectMods({ agentsFound, runCommand, environment, toolkitRoot });
|
|
266
268
|
return {
|
|
267
269
|
folder:await inspectFolder(start),
|
|
268
270
|
creationRoot:await fs.realpath(start),
|
|
@@ -270,6 +272,7 @@ export async function gatherSetupState({
|
|
|
270
272
|
cleanProject:await readCleanProjectAnswers(project.root),
|
|
271
273
|
reviewInstructions,
|
|
272
274
|
superpowers,
|
|
275
|
+
mods,
|
|
273
276
|
homeDirectory,
|
|
274
277
|
version,
|
|
275
278
|
project,
|
package/src/setup-tui.js
CHANGED
|
@@ -8,7 +8,8 @@ import { planCleanProject, checkRequirements } from './clean-project.js';
|
|
|
8
8
|
import { runCleanCommand } from './clean-command.js';
|
|
9
9
|
import path from 'node:path';
|
|
10
10
|
import { applySetup } from './setup-apply.js';
|
|
11
|
-
import {
|
|
11
|
+
import { MODS } from './mods.js';
|
|
12
|
+
import { AGENTS, AGENT_NAMES, buildConfirmation, groupLines, joinNames, shortPath, suggestedAnswers } from './setup-plan.js';
|
|
12
13
|
import { gatherSetupState, inspectMemoryPath, memoryConnections } from './setup-state.js';
|
|
13
14
|
import { applyToolkitDetach, planToolkitDetach } from './skill-recommendations.js';
|
|
14
15
|
import { LOGO_WIDTH, colorLevel, levelOf, paint, renderLogo } from './brand.js';
|
|
@@ -19,9 +20,16 @@ const KEYS = Object.freeze({
|
|
|
19
20
|
back: ['\x7f', '\x08', '\x1b[D'], left: ['\x1b[D'], right: ['\x1b[C'], quit: ['q', 'Q', '\x03']
|
|
20
21
|
});
|
|
21
22
|
const is = (key, name) => KEYS[name].includes(key);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
// The mods entry only shows with Claude Code chosen and its plugin list readable.
|
|
24
|
+
const hasModsStep = model => Boolean(model.state.mods && model.answers.agents.includes('claude'));
|
|
25
|
+
const menuEntries = model => [
|
|
26
|
+
['exit', 'No, salir'], ['skills', 'Añadir o quitar skills'], ['agents', 'Cambiar agentes'],
|
|
27
|
+
...(hasModsStep(model) ? [['mods', 'Mods de Claude Code']] : []), ['detach', 'Quitar nexakit de este proyecto']
|
|
28
|
+
];
|
|
29
|
+
const MOD_STATUS_WORDS = Object.freeze({ activo: 'instalado', falta: 'falta', actualizable: 'hay versión nueva', desactivado: 'desactivado', desconocido: 'sin comprobar' });
|
|
30
|
+
const OFFERED_MOD_STATES = new Set(['falta', 'desactivado', 'actualizable']);
|
|
31
|
+
const modMarked = (model, mod) => model.state.mods[mod.name] === 'activo' || model.answers.mods.chosen.includes(mod.name);
|
|
32
|
+
const MOD_ALREADY_INSTALLED = 'Ya está instalado; se quita desde /plugin en Claude Code';
|
|
25
33
|
const MAX_DETECTED = 4;
|
|
26
34
|
// Languages and generic signals go after the frameworks the person will recognise.
|
|
27
35
|
const GENERIC_SIGNALS = new Set(['nodejs', 'python', 'rust', 'rest-api', 'vitest', 'mcp-sdk']);
|
|
@@ -93,6 +101,17 @@ function closeSkills(model) {
|
|
|
93
101
|
return { ...model.answers, skills: { chosen, discarded: model.state.skills.map(s => s.name).filter(name => discarded.has(name)) } };
|
|
94
102
|
}
|
|
95
103
|
|
|
104
|
+
// Leaving the mods question: an offered mod left unchecked is remembered as discarded, so it is not offered again.
|
|
105
|
+
function closeMods(model) {
|
|
106
|
+
const { chosen } = model.answers.mods;
|
|
107
|
+
const discarded = new Set(model.answers.mods.discarded);
|
|
108
|
+
for (const mod of MODS) {
|
|
109
|
+
if (chosen.includes(mod.name)) discarded.delete(mod.name);
|
|
110
|
+
else if (OFFERED_MOD_STATES.has(model.state.mods[mod.name])) discarded.add(mod.name);
|
|
111
|
+
}
|
|
112
|
+
return { ...model.answers, mods: { chosen: MODS.map(mod => mod.name).filter(name => chosen.includes(name)), discarded: MODS.map(mod => mod.name).filter(name => discarded.has(name)) } };
|
|
113
|
+
}
|
|
114
|
+
|
|
96
115
|
function memoryAnswer(model, choice) {
|
|
97
116
|
const { state } = model;
|
|
98
117
|
if (choice === 'later') return { decision: 'later' };
|
|
@@ -104,11 +123,13 @@ function memoryAnswer(model, choice) {
|
|
|
104
123
|
const go = (model, step, extra = {}) => ({ ...model, step, cursor: 0, info: false, detail: false, message: null, ...extra });
|
|
105
124
|
const nextAfter = (model, step) => {
|
|
106
125
|
if (model.flow === 'menu') return 'confirm';
|
|
107
|
-
|
|
126
|
+
if (step === 'agents') return hasModsStep(model) ? 'mods' : 'confirm';
|
|
127
|
+
return { skills: 'memory', memory: 'agents', 'memory-path': 'agents', mods: 'confirm' }[step];
|
|
108
128
|
};
|
|
109
129
|
const previousOf = (model, step) => {
|
|
110
130
|
if (model.flow === 'menu') return step === 'confirm' ? model.menuEntry : 'menu';
|
|
111
|
-
|
|
131
|
+
if (step === 'confirm') return hasModsStep(model) ? 'mods' : 'agents';
|
|
132
|
+
return { memory: 'skills', 'memory-path': 'memory', agents: 'memory', mods: 'agents' }[step];
|
|
112
133
|
};
|
|
113
134
|
|
|
114
135
|
export function handleSetupKey(model, key) {
|
|
@@ -180,9 +201,10 @@ export function handleSetupKey(model, key) {
|
|
|
180
201
|
|
|
181
202
|
if (step === 'menu') {
|
|
182
203
|
if (is(key, 'up')) return { model: { ...model, cursor: Math.max(0, model.cursor - 1) } };
|
|
183
|
-
|
|
204
|
+
const entries = menuEntries(model);
|
|
205
|
+
if (is(key, 'down')) return { model: { ...model, cursor: Math.min(entries.length - 1, model.cursor + 1) } };
|
|
184
206
|
if (is(key, 'enter')) {
|
|
185
|
-
const [choice] =
|
|
207
|
+
const [choice] = entries[model.cursor];
|
|
186
208
|
if (choice === 'exit') return { model, effect: 'exit' };
|
|
187
209
|
if (choice === 'detach') return { model, effect: 'detach-preview' };
|
|
188
210
|
return { model: go(model, choice, { menuEntry: choice, expanded: choice === 'skills' }) };
|
|
@@ -245,6 +267,23 @@ export function handleSetupKey(model, key) {
|
|
|
245
267
|
return { model };
|
|
246
268
|
}
|
|
247
269
|
|
|
270
|
+
if (step === 'mods') {
|
|
271
|
+
if (is(key, 'up')) return { model: { ...model, cursor: Math.max(0, model.cursor - 1), message: null } };
|
|
272
|
+
if (is(key, 'down')) return { model: { ...model, cursor: Math.min(MODS.length - 1, model.cursor + 1), message: null } };
|
|
273
|
+
if (is(key, 'toggle')) {
|
|
274
|
+
const mod = MODS[model.cursor];
|
|
275
|
+
const status = model.state.mods[mod.name];
|
|
276
|
+
if (status === 'activo') return { model: { ...model, message: MOD_ALREADY_INSTALLED } };
|
|
277
|
+
if (status === 'desconocido') return { model: { ...model, message: 'No pude comprobar este mod; revisa /plugin en Claude Code' } };
|
|
278
|
+
const { chosen } = model.answers.mods;
|
|
279
|
+
const next = chosen.includes(mod.name) ? chosen.filter(name => name !== mod.name) : [...chosen, mod.name];
|
|
280
|
+
return { model: { ...model, message: null, answers: { ...model.answers, mods: { ...model.answers.mods, chosen: next } } } };
|
|
281
|
+
}
|
|
282
|
+
if (is(key, 'enter')) return { model: go({ ...model, answers: closeMods(model) }, nextAfter(model, 'mods')) };
|
|
283
|
+
if (is(key, 'back')) return { model: go(model, previousOf(model, 'mods')) };
|
|
284
|
+
return { model };
|
|
285
|
+
}
|
|
286
|
+
|
|
248
287
|
if (step === 'confirm') {
|
|
249
288
|
if (key === 'd') return { model: { ...model, detail: !model.detail } };
|
|
250
289
|
if (is(key, 'left') || is(key, 'right') || is(key, 'toggle')) return { model: { ...model, confirmYes: !model.confirmYes } };
|
|
@@ -272,7 +311,7 @@ export function applyMemoryPathCheck(model, target, kind, connections) {
|
|
|
272
311
|
function folded(model) {
|
|
273
312
|
const { state, answers } = model;
|
|
274
313
|
const lines = [`Proyecto: ${state.project.displayName}${state.project.fromSubfolder ? ' (repositorio completo)' : ''}`];
|
|
275
|
-
const order = ['skills', 'memory', 'memory-path', 'agents', 'confirm'];
|
|
314
|
+
const order = ['skills', 'memory', 'memory-path', 'agents', 'mods', 'confirm'];
|
|
276
315
|
const at = order.indexOf(model.step);
|
|
277
316
|
if (model.step === 'skills' || at < 0) {
|
|
278
317
|
if (state.signals.length && model.step === 'skills') {
|
|
@@ -288,6 +327,10 @@ function folded(model) {
|
|
|
288
327
|
if ((model.flow === 'full' && at > order.indexOf('agents')) || model.menuEntry === 'agents' && model.step === 'confirm') {
|
|
289
328
|
lines.push(`IA: ${joinNames(answers.agents.map(agent => AGENT_NAMES[agent]))}`);
|
|
290
329
|
}
|
|
330
|
+
if (hasModsStep(model) && ((model.flow === 'full' && at > order.indexOf('mods')) || (model.menuEntry === 'mods' && model.step === 'confirm'))) {
|
|
331
|
+
const count = MODS.filter(mod => modMarked(model, mod)).length;
|
|
332
|
+
lines.push(`Mods: ${count} ${count === 1 ? 'elegido' : 'elegidos'}`);
|
|
333
|
+
}
|
|
291
334
|
return lines;
|
|
292
335
|
}
|
|
293
336
|
|
|
@@ -358,12 +401,25 @@ function question(model) {
|
|
|
358
401
|
if (model.message) info.push('', model.message);
|
|
359
402
|
return { title: '¿Con qué IA trabajas?', body, info, keys: 'espacio marcar · Enter seguir · ← volver · q salir' };
|
|
360
403
|
}
|
|
404
|
+
case 'mods': {
|
|
405
|
+
// The state sits in its own column next to the name, so a long description wraps without splitting it off.
|
|
406
|
+
const width = Math.max(...MODS.map(mod => mod.name.length));
|
|
407
|
+
const statusWidth = Math.max(...MODS.map(mod => MOD_STATUS_WORDS[state.mods[mod.name]].length));
|
|
408
|
+
const body = MODS.map((mod, index) => ({
|
|
409
|
+
cursor: index === model.cursor,
|
|
410
|
+
text: `${modMarked(model, mod) ? '◼' : '◻'} ${mod.name.padEnd(width)} ${MOD_STATUS_WORDS[state.mods[mod.name]].padEnd(statusWidth)} ${mod.label}`
|
|
411
|
+
}));
|
|
412
|
+
const info = ['', 'Los mods cambian cómo trabaja Claude Code en todos tus proyectos.', 'Se instalan con tu cuenta y se quitan desde /plugin.'];
|
|
413
|
+
if (model.message) info.push('', model.message);
|
|
414
|
+
return { title: '¿Qué mods de Claude Code quieres?', body, info, keys: 'espacio marcar · Enter seguir · ← volver · q salir' };
|
|
415
|
+
}
|
|
361
416
|
case 'confirm': {
|
|
362
417
|
const confirmation = buildConfirmation(state, answers);
|
|
418
|
+
const grouped = () => groupLines(confirmation.lines).flatMap(group => [{ text: group.title, header: true }, ...group.lines.map(line => ({ text: ` ${line.mark} ${line.text}` }))]);
|
|
363
419
|
if (!confirmation.blocks.length) {
|
|
364
|
-
return { title: 'No hay nada que preparar', body:
|
|
420
|
+
return { title: 'No hay nada que preparar', body: grouped(), info: [], keys: 'Enter salir · ← volver' };
|
|
365
421
|
}
|
|
366
|
-
const body = model.detail ? detailLines(model, confirmation) :
|
|
422
|
+
const body = model.detail ? detailLines(model, confirmation) : grouped();
|
|
367
423
|
const info = ['', 'No toco archivos tuyos. Se puede deshacer con', '`npx nexakit quitar`.', '',
|
|
368
424
|
`¿Lo preparo? ${model.confirmYes ? '● Sí / ○ No' : '○ Sí / ● No'}`];
|
|
369
425
|
return { title: 'Voy a preparar:', body, info, keys: 'Enter elegir · ←/→ cambiar · d detalle · Retroceso volver' };
|
|
@@ -426,7 +482,7 @@ function renderBody(model, { columns, level }) {
|
|
|
426
482
|
for (const text of ready) push(`│ ${text}`, c.dim);
|
|
427
483
|
push('│');
|
|
428
484
|
push('◆ ¿Quieres cambiar algo?', c.accent);
|
|
429
|
-
|
|
485
|
+
menuEntries(model).forEach(([, label], index) => push(`│ ${index === model.cursor ? '❯' : ' '} ${index === model.cursor ? '●' : '○'} ${label}`, index === model.cursor ? c.accent : undefined));
|
|
430
486
|
push('└ Enter elegir · q salir', c.dim);
|
|
431
487
|
return out.join('\n');
|
|
432
488
|
}
|
|
@@ -481,6 +537,7 @@ function renderBody(model, { columns, level }) {
|
|
|
481
537
|
const q = question(model);
|
|
482
538
|
push(`◆ ${q.title}`, c.accent);
|
|
483
539
|
for (const row of q.body) {
|
|
540
|
+
if (row.header) { push(`│ ${row.text}`, c.bold); continue; }
|
|
484
541
|
const text = row.text.startsWith(' ') ? row.text.slice(1) : row.text;
|
|
485
542
|
const marker = row.text.startsWith(' ') && /^ [+−↻!✓] /u.test(row.text) ? `│ ${text.slice(0, 2)}` : `│ ${row.cursor ? '❯' : ' '} `;
|
|
486
543
|
const shown = marker.startsWith('│ ') && /^[+−↻!✓] /u.test(text) ? text.slice(2) : text;
|
|
@@ -498,8 +555,9 @@ function renderBody(model, { columns, level }) {
|
|
|
498
555
|
|
|
499
556
|
// ── Loop ─────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
500
557
|
|
|
501
|
-
const STEP_NUMBER = Object.freeze({ skills: 1, memory: 2, 'memory-path': 2, agents: 3,
|
|
502
|
-
|
|
558
|
+
const STEP_NUMBER = Object.freeze({ skills: 1, memory: 2, 'memory-path': 2, agents: 3, mods: 4 });
|
|
559
|
+
// The mods question only exists with Claude Code chosen and a readable plugin list: five steps then, four otherwise.
|
|
560
|
+
const stepCount = model => (hasModsStep(model) ? 5 : 4);
|
|
503
561
|
const TAGLINE = 'Tus skills. Tu memoria. Tus IA trabajando juntas.';
|
|
504
562
|
const TAGLINE_SHORT = 'Skills, memoria e IA, juntas.';
|
|
505
563
|
|
|
@@ -508,7 +566,8 @@ function renderHeader(model, { columns, rows, level, bodyRows }) {
|
|
|
508
566
|
const c = paint(level);
|
|
509
567
|
const width = Math.max(30, columns - 1);
|
|
510
568
|
const version = model.state.version ? ` v${model.state.version}` : '';
|
|
511
|
-
const
|
|
569
|
+
const STEP_COUNT = stepCount(model);
|
|
570
|
+
const number = model.flow === 'full' ? (model.step === 'confirm' ? STEP_COUNT : STEP_NUMBER[model.step]) : undefined;
|
|
512
571
|
const steps = number ? `Paso ${number} de ${STEP_COUNT}` : '';
|
|
513
572
|
const dots = number ? Array.from({ length: STEP_COUNT }, (_, index) => (index < number ? '●' : '○')).join('') : '';
|
|
514
573
|
const celebrates = model.step === 'done' && model.result?.ok;
|
|
@@ -1146,6 +1146,8 @@ const isNameList = value => Array.isArray(value) && value.every(item => typeof i
|
|
|
1146
1146
|
function validSetupAnswers(answers) {
|
|
1147
1147
|
return Boolean(answers && (answers.cleanProject === undefined || validCleanProject(answers.cleanProject)) && answers.version === 1 &&
|
|
1148
1148
|
isNameList(answers.skills?.chosen) && isNameList(answers.skills?.discarded) &&
|
|
1149
|
+
// Mods are optional: answers saved before the mods step existed have none.
|
|
1150
|
+
(answers.mods === undefined || (isNameList(answers.mods.chosen) && isNameList(answers.mods.discarded))) &&
|
|
1149
1151
|
Array.isArray(answers.agents) && answers.agents.every(agent => ['claude', 'codex', 'antigravity'].includes(agent)) &&
|
|
1150
1152
|
(answers.memory?.decision === 'later' ||
|
|
1151
1153
|
(answers.memory?.decision === 'path' && typeof answers.memory.path === 'string' && path.isAbsolute(answers.memory.path))));
|
package/src/stable-install.js
CHANGED
|
@@ -8,7 +8,7 @@ import { IS_WINDOWS } from './platform.js';
|
|
|
8
8
|
const PACKAGE_NAME = 'nexakit';
|
|
9
9
|
const VERSION_RE = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/u;
|
|
10
10
|
const COMPLETE_MARKER = '.completa';
|
|
11
|
-
const PROBED_IMPORTS = ['ajv', 'zod', '@modelcontextprotocol/
|
|
11
|
+
const PROBED_IMPORTS = ['ajv', 'zod', '@modelcontextprotocol/client'];
|
|
12
12
|
const NPM_TIMEOUT_MS = 10 * 60 * 1000;
|
|
13
13
|
const PROBE_TIMEOUT_MS = 30 * 1000;
|
|
14
14
|
|
package/src/superpowers.js
CHANGED
|
@@ -81,7 +81,7 @@ const notFound = () => ({ status: null, stdout: '', stderr: '', errorCode: 'ENOE
|
|
|
81
81
|
|
|
82
82
|
// The CLI is looked up in the given environment's PATH, not this process's, so a test HOME never reaches the
|
|
83
83
|
// person's real agents.
|
|
84
|
-
async function defaultRunner(command, environment = process.env) {
|
|
84
|
+
export async function defaultRunner(command, environment = process.env) {
|
|
85
85
|
if (!IS_WINDOWS) {
|
|
86
86
|
for (const folder of (environment.PATH ?? '').split(path.delimiter).filter(Boolean)) {
|
|
87
87
|
const file = path.join(folder, command);
|
package/src/sync-inspect.js
CHANGED
|
@@ -90,7 +90,7 @@ export async function inspectMemorySync(options = {}, context = {}) {
|
|
|
90
90
|
};
|
|
91
91
|
const inventory = await collectFiles(query, repository, prNumber, maxFiles, raw.changedFiles, warn);
|
|
92
92
|
const checks = await collectChecks(query, repository, raw.headRefOid, safeText, safeUrl, warn);
|
|
93
|
-
const { candidateAreas, unmappedFiles } = resolveCandidateAreas(doctor.vaultPath, manifest.memory?.layout, inventory.files, warn);
|
|
93
|
+
const { candidateAreas, unmappedFiles } = resolveCandidateAreas(doctor.vaultPath, manifest.memory?.layout, inventory.files, warn, manifest.automation?.areas);
|
|
94
94
|
const report = {
|
|
95
95
|
command: "sync inspect", status: checks.summary.adverse > 0 ? "blocked" : warnings.length ? "partial" : "ready",
|
|
96
96
|
repository, branch, ledgerPath, alreadyReviewed: reviewed.has(prNumber), pullRequest,
|
|
@@ -311,12 +311,18 @@ const RULES = [
|
|
|
311
311
|
{ id: "frontend-path", category: "frontend", test: /(?:^|\/)[^/]*(?:frontend|client|web|ui)[^/]*(?:\/|$)/i, destinations: /(?:FRONTEND|IMPLEMENTACION)$/ },
|
|
312
312
|
{ id: "firmware-path", category: "hardware", test: /(?:^|\/)[^/]*(?:firmware|hardware|iot|esp32)[^/]*(?:\/|$)|\.(?:ino)$/i, destinations: /(?:IOT|HARDWARE|IMPLEMENTACION)$/ },
|
|
313
313
|
{ id: "docs-path", category: "documentation", test: /(?:^|\/)(?:docs|documentation)(?:\/|$)|\.(?:md|mdx)$/i, destinations: /(?:PRODUCTO|ARQUITECTURA|IMPLEMENTACION)$/ },
|
|
314
|
-
{ id: "operations-path", category: "operations", test: /(?:^|\/)(?:\.github|infra|deploy|docker|scripts)(?:\/|$)|(?:^|\/)(?:Dockerfile|docker-compose[^/]
|
|
315
|
-
{ id: "tests-path", category: "tests", test: /(?:^|\/)(?:test|tests|__tests__)(?:\/|$)|\.(?:test|spec)\.[^/]+$/i, destinations: /(?:IMPLEMENTACION|ENTREGAS|SPRINTS)$/ },
|
|
316
|
-
{ id: "decisions-path", category: "decisions", test: /(?:^|\/)(?:adr|decisions|decisiones)(?:\/|$)/i, destinations: /(?:DECISIONES)$/ }
|
|
314
|
+
{ id: "operations-path", category: "operations", test: /(?:^|\/)(?:\.github|\.claude-plugin|infra|deploy|docker|scripts)(?:\/|$)|(?:^|\/)(?:Dockerfile|docker-compose[^/]*|\.gitignore|\.gitattributes|package(?:-lock)?\.json)$/i, destinations: /(?:OPERACION)$/ },
|
|
315
|
+
{ id: "tests-path", category: "tests", test: /(?:^|\/)(?:test|tests|__tests__|test-support|testing)(?:\/|$)|\.(?:test|spec)\.[^/]+$/i, destinations: /(?:IMPLEMENTACION|ENTREGAS|SPRINTS)$/ },
|
|
316
|
+
{ id: "decisions-path", category: "decisions", test: /(?:^|\/)(?:adr|decisions|decisiones)(?:\/|$)/i, destinations: /(?:DECISIONES)$/ },
|
|
317
|
+
// Solo carpetas de código en la raíz: así no se solapa con las reglas por nombre de carpeta (frontend/src/...).
|
|
318
|
+
{ id: "source-path", category: "implementation", test: /^(?:src|lib|app|bin|packages|plugins|schemas|templates|examples)\//i, destinations: /(?:IMPLEMENTACION)$/ }
|
|
317
319
|
];
|
|
318
320
|
|
|
319
|
-
|
|
321
|
+
// automation.areas permite al proyecto elegir la carpeta de una categoría que tiene varias candidatas.
|
|
322
|
+
const declaredAreas = (areas) => (areas && typeof areas === "object" && !Array.isArray(areas) ? areas : {});
|
|
323
|
+
|
|
324
|
+
function resolveCandidateAreas(vault, layout, files, warn, areas) {
|
|
325
|
+
const declared = declaredAreas(areas);
|
|
320
326
|
const dirs = layout?.profile === "declared" ? layout.requiredDirectories : CANONICAL_DIRS;
|
|
321
327
|
const allowed = [];
|
|
322
328
|
for (const dir of dirs ?? []) {
|
|
@@ -339,7 +345,10 @@ function resolveCandidateAreas(vault, layout, files, warn) {
|
|
|
339
345
|
// Prefer a precise area (e.g. BACKEND), otherwise a single generic match.
|
|
340
346
|
const exact = destinations.filter((dir) => dir.toLowerCase().endsWith(rule.category) || rule.category === "hardware" && /(?:iot|hardware)$/i.test(dir));
|
|
341
347
|
const choices = exact.length ? exact : destinations;
|
|
342
|
-
const
|
|
348
|
+
const chosen = declared[rule.category];
|
|
349
|
+
const usesDeclared = typeof chosen === "string" && allowed.includes(chosen);
|
|
350
|
+
if (chosen !== undefined && !usesDeclared) warn("area-override-invalid", `El mapeo declarado para ${rule.category} no apunta a una carpeta permitida de la bóveda.`);
|
|
351
|
+
const directory = usesDeclared ? chosen : choices.length === 1 ? choices[0] : null;
|
|
343
352
|
const notes = [];
|
|
344
353
|
let omittedNotes = 0;
|
|
345
354
|
if (directory === null) warn("area-unresolved", "Una categoría no tiene carpeta inequívoca; requiere revisión manual.");
|
package/src/toolkit-cli.js
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from './skill-recommendations.js';
|
|
21
21
|
import { formatRecommendationReport } from './recommend-report.js';
|
|
22
22
|
import { applySetup } from './setup-apply.js';
|
|
23
|
-
import { buildConfirmation, suggestedAnswers } from './setup-plan.js';
|
|
23
|
+
import { buildConfirmation, groupLines, joinNames, suggestedAnswers } from './setup-plan.js';
|
|
24
24
|
import { gatherSetupState } from './setup-state.js';
|
|
25
25
|
import { runSetupTui } from './setup-tui.js';
|
|
26
26
|
import { doctorToolkit, setupToolkit } from './toolkit-setup.js';
|
|
@@ -318,10 +318,35 @@ export async function runToolkitCli(
|
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
const plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
321
|
+
// The plan under the same headings as the screen; the lines keep their two-space indent below each heading.
|
|
322
|
+
const groupedLines = (lines) =>
|
|
323
|
+
groupLines(lines)
|
|
324
|
+
.map((group) => [group.title, ...group.lines.map((line) => ` ${line.mark} ${line.text}`)].join('\n'))
|
|
325
|
+
.join('\n');
|
|
321
326
|
// Required: missing or disabled fails the check; a list that could not be read is reported but does not fail.
|
|
322
327
|
const superpowersReady = (result) =>
|
|
323
328
|
!Object.values(result.superpowers?.states ?? {}).some((state) => ['falta', 'desactivado'].includes(state));
|
|
324
329
|
|
|
330
|
+
// nexakit's Claude Code mods: warnings only, a missing mod never fails the check.
|
|
331
|
+
function modsReport(mods) {
|
|
332
|
+
if (!mods) return [];
|
|
333
|
+
const names = (state) => Object.keys(mods).filter((name) => mods[name] === state);
|
|
334
|
+
const missing = names('falta'), outdated = names('actualizable'), disabled = names('desactivado');
|
|
335
|
+
const active = names('activo');
|
|
336
|
+
if (names('desconocido').length) return ['! No pude comprobar los mods de Claude Code; revisa /plugin'];
|
|
337
|
+
const lines = [];
|
|
338
|
+
const prefix = '! Mods de Claude Code:';
|
|
339
|
+
const one = (list) => list.length === 1;
|
|
340
|
+
if (missing.length)
|
|
341
|
+
lines.push(`${prefix} ${one(missing) ? 'falta' : 'faltan'} ${joinNames(missing)} (ejecuta npx nexakit para ${one(missing) ? 'instalarlo' : 'instalarlos'})`);
|
|
342
|
+
if (outdated.length)
|
|
343
|
+
lines.push(`${prefix} hay versión nueva de ${joinNames(outdated)} (ejecuta npx nexakit para ${one(outdated) ? 'actualizarlo' : 'actualizarlos'})`);
|
|
344
|
+
if (disabled.length)
|
|
345
|
+
lines.push(`${prefix} ${one(disabled) ? 'desactivado' : 'desactivados'} ${joinNames(disabled)}; ${one(disabled) ? 'actívalo' : 'actívalos'} desde /plugin`);
|
|
346
|
+
if (!lines.length) lines.push(`✓ Mods de Claude Code activos (${active.length} de ${Object.keys(mods).length})`);
|
|
347
|
+
return lines;
|
|
348
|
+
}
|
|
349
|
+
|
|
325
350
|
function formatComprobarReport(result, { homeDirectory }) {
|
|
326
351
|
const short = (value) =>
|
|
327
352
|
value === homeDirectory ||
|
|
@@ -385,6 +410,7 @@ function formatComprobarReport(result, { homeDirectory }) {
|
|
|
385
410
|
: `! No pude comprobar Superpowers en ${name}`,
|
|
386
411
|
);
|
|
387
412
|
}
|
|
413
|
+
lines.push(...modsReport(result.mods));
|
|
388
414
|
for (const item of result.obsolete ?? []) {
|
|
389
415
|
lines.push(`! ${item.message} ${item.command}`);
|
|
390
416
|
}
|
|
@@ -515,13 +541,13 @@ async function runSetup(parsed, { out, err, input, output, isTTY, options }) {
|
|
|
515
541
|
const title = `nexakit · ${state.project.displayName}${state.project.fromSubfolder ? ' (repositorio completo)' : ''}`;
|
|
516
542
|
if (confirmation.allReady) {
|
|
517
543
|
await out(
|
|
518
|
-
`${title}\nTodo está listo.\n${confirmation.lines
|
|
544
|
+
`${title}\nTodo está listo.\n${groupedLines(confirmation.lines)}\n`,
|
|
519
545
|
);
|
|
520
546
|
return 0;
|
|
521
547
|
}
|
|
522
548
|
if (!parsed.yes) {
|
|
523
549
|
await out(
|
|
524
|
-
`${title}\nCon las respuestas sugeridas prepararía:\n${confirmation.lines
|
|
550
|
+
`${title}\nCon las respuestas sugeridas prepararía:\n${groupedLines(confirmation.lines)}\n\n` +
|
|
525
551
|
'No hay una terminal interactiva para preguntarte.\nPara aplicarlo sin preguntas: npx nexakit --si\n',
|
|
526
552
|
);
|
|
527
553
|
return 2;
|
|
@@ -65,7 +65,7 @@ export function getToolkitCommandsGuide({ clients = {} } = {}) {
|
|
|
65
65
|
const cliCommands = [
|
|
66
66
|
{
|
|
67
67
|
command: 'npx nexakit',
|
|
68
|
-
description: 'Abre el asistente de
|
|
68
|
+
description: 'Abre el asistente de instalación, que ofrece mods como nexakit-guardarrailes para Claude Code. Usa --si para aplicar las opciones sugeridas.',
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
command: 'npx nexakit comprobar',
|
package/src/toolkit-setup.js
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
relinkIfUnchanged,
|
|
22
22
|
} from './link-states.js';
|
|
23
23
|
import { actualRoot, ensureStableInstall, nexakitDir } from './stable-install.js';
|
|
24
|
+
import { inspectMods } from './mods.js';
|
|
24
25
|
import { inspectSuperpowers } from './superpowers.js';
|
|
25
26
|
|
|
26
27
|
import packageJson from '../package.json' with { type: 'json' };
|
|
@@ -572,13 +573,13 @@ export async function doctorToolkit({
|
|
|
572
573
|
const require = createRequire(path.join(toolkitRoot, 'package.json'));
|
|
573
574
|
for (const name of [
|
|
574
575
|
'@modelcontextprotocol/server',
|
|
575
|
-
'@modelcontextprotocol/
|
|
576
|
+
'@modelcontextprotocol/client',
|
|
576
577
|
'zod',
|
|
577
578
|
'ajv',
|
|
578
579
|
'toml-eslint-parser',
|
|
579
580
|
]) {
|
|
580
581
|
try {
|
|
581
|
-
require.resolve(name
|
|
582
|
+
require.resolve(name);
|
|
582
583
|
dependencies[name] = true;
|
|
583
584
|
} catch {
|
|
584
585
|
dependencies[name] = false;
|
|
@@ -609,6 +610,13 @@ export async function doctorToolkit({
|
|
|
609
610
|
...(runCommand && { runCommand }),
|
|
610
611
|
}),
|
|
611
612
|
},
|
|
613
|
+
// nexakit's own Claude Code plugins (null without Claude Code). Missing ones are reported, never an error.
|
|
614
|
+
mods: await inspectMods({
|
|
615
|
+
agentsFound: { claude: clients.claude?.available },
|
|
616
|
+
environment,
|
|
617
|
+
toolkitRoot,
|
|
618
|
+
...(runCommand && { runCommand }),
|
|
619
|
+
}),
|
|
612
620
|
nativeConnectionVerified: false,
|
|
613
621
|
};
|
|
614
622
|
}
|