agentic-kdd 3.0.3 → 3.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/bin/akdd.js CHANGED
@@ -64,7 +64,8 @@ const HELP = `
64
64
 
65
65
  Collaborative Mode (Legion):
66
66
  akdd collab init Activate collaborative mode — creates shared DB automatically
67
- akdd collab join <url> <token> Join an existing team's shared memory
67
+ akdd collab invite Generate a 6-char invite code for a team member (24h, one-use)
68
+ akdd collab join <code> Join the team with an invite code (e.g. LUMO-X7K2P4)
68
69
  akdd collab push Push your learnings to the team
69
70
  akdd collab pull Pull team's latest learnings
70
71
  akdd collab status Check collaborative sync status
@@ -224,12 +225,15 @@ switch (command) {
224
225
  const sub = arg1 || 'status';
225
226
  if (sub === 'init') {
226
227
  runModule('collab-manager.cjs', 'init');
228
+ } else if (sub === 'invite') {
229
+ runModule('collab-manager.cjs', 'invite');
227
230
  } else if (sub === 'join') {
228
- if (!arg2 || !args[3]) {
229
- console.log('\n Uso: akdd collab join <url> <token>\n');
231
+ if (!arg2) {
232
+ console.log('\n Uso: akdd collab join <código>\n');
233
+ console.log(' El código lo genera el jefe con: akdd collab invite\n');
230
234
  break;
231
235
  }
232
- runModule('collab-manager.cjs', 'join', `"${arg2}" "${args[3]}"`);
236
+ runModule('collab-manager.cjs', 'join', `"${arg2}"`);
233
237
  } else if (sub === 'push') {
234
238
  runModule('collab-manager.cjs', 'push');
235
239
  } else if (sub === 'pull') {
@@ -153,13 +153,43 @@ async function collabInit(projectRoot) {
153
153
 
154
154
  // ─── JOIN — PARA EL DEV QUE SE UNE AL EQUIPO ─────────────────────────────────
155
155
 
156
- async function collabJoin(projectRoot, url, token) {
156
+ async function collabJoin(projectRoot, urlOrCode, token) {
157
157
  console.log('\n[COLLAB] Uniéndose al equipo...\n');
158
158
 
159
+ let finalUrl = urlOrCode;
160
+ let finalToken = token;
161
+
162
+ // Detectar si es un código de invitación (formato: PREFIX-XXXXXX)
163
+ const isInviteCode = !urlOrCode?.startsWith('libsql://') && !urlOrCode?.startsWith('http');
164
+
165
+ if (isInviteCode) {
166
+ console.log(`[COLLAB] Resolviendo código: ${urlOrCode}`);
167
+ try {
168
+ const response = await fetch(`${PROVISIONER_URL}/join`, {
169
+ method: 'POST',
170
+ headers: { 'Content-Type': 'application/json' },
171
+ body: JSON.stringify({ code: urlOrCode }),
172
+ });
173
+ const result = await response.json();
174
+
175
+ if (!result.ok) {
176
+ console.error(`[COLLAB] ❌ ${result.error}`);
177
+ process.exit(1);
178
+ }
179
+
180
+ finalUrl = result.url;
181
+ finalToken = result.token;
182
+ console.log(`[COLLAB] ✅ Código válido. Conectando a: ${result.db}`);
183
+ } catch (e) {
184
+ console.error('[COLLAB] Error resolviendo código:', e.message);
185
+ process.exit(1);
186
+ }
187
+ }
188
+
159
189
  const config = {
160
190
  enabled: true,
161
- url,
162
- token,
191
+ url: finalUrl,
192
+ token: finalToken,
163
193
  member_id: os.userInfo().username,
164
194
  sync_on_cycle_end: true,
165
195
  last_sync: null,
@@ -176,6 +206,48 @@ async function collabJoin(projectRoot, url, token) {
176
206
  console.log('[COLLAB] ✅ Listo. Ya tienes toda la memoria del equipo.\n');
177
207
  }
178
208
 
209
+ // ─── INVITE ───────────────────────────────────────────────────────────────────
210
+
211
+ async function collabInvite(projectRoot) {
212
+ const config = loadConfig(projectRoot);
213
+ if (!config?.enabled) {
214
+ console.log('\n[COLLAB] Modo colaborativo no activado. Correr: akdd collab init\n');
215
+ return;
216
+ }
217
+
218
+ const projectId = config.project_id || getProjectId(projectRoot);
219
+ console.log('\n[COLLAB] Generando código de invitación...');
220
+
221
+ let result;
222
+ try {
223
+ const response = await fetch(`${PROVISIONER_URL}/invite`, {
224
+ method: 'POST',
225
+ headers: { 'Content-Type': 'application/json' },
226
+ body: JSON.stringify({ projectId }),
227
+ });
228
+ result = await response.json();
229
+ } catch (e) {
230
+ console.error('[COLLAB] Error:', e.message);
231
+ return;
232
+ }
233
+
234
+ if (!result.ok) {
235
+ console.error('[COLLAB] Error generando código:', result.error);
236
+ return;
237
+ }
238
+
239
+ console.log('\n' + '═'.repeat(50));
240
+ console.log(' 🔑 Código de invitación Agentic KDD');
241
+ console.log('═'.repeat(50));
242
+ console.log(`\n Código: ${result.code}`);
243
+ console.log(` Expira: ${result.expires_in}`);
244
+ console.log(` Un solo uso — expira al usarse o en 24h`);
245
+ console.log('\n Comparte este código por Slack/WhatsApp.');
246
+ console.log(' El miembro del equipo corre:');
247
+ console.log(`\n akdd collab join ${result.code}\n`);
248
+ console.log('═'.repeat(50) + '\n');
249
+ }
250
+
179
251
  // ─── SYNC UP (local → Turso) ──────────────────────────────────────────────────
180
252
 
181
253
  async function syncUp(projectRoot) {
@@ -368,9 +440,13 @@ if (require.main === module) {
368
440
  case 'init':
369
441
  collabInit(projectRoot).catch(console.error);
370
442
  break;
443
+ case 'invite':
444
+ collabInvite(projectRoot).catch(console.error);
445
+ break;
371
446
  case 'join':
372
- if (!arg1 || !arg2) {
373
- console.error('Uso: collab-manager.cjs join <url> <token>');
447
+ if (!arg1) {
448
+ console.error('Uso: collab-manager.cjs join <código>');
449
+ console.error(' o: collab-manager.cjs join <url> <token>');
374
450
  process.exit(1);
375
451
  }
376
452
  collabJoin(projectRoot, arg1, arg2).catch(console.error);
@@ -396,6 +472,7 @@ if (require.main === module) {
396
472
  module.exports = {
397
473
  collabInit,
398
474
  collabJoin,
475
+ collabInvite,
399
476
  syncUp,
400
477
  syncDown,
401
478
  status,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-kdd",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "description": "Autonomous development pipeline — aa: · ag: · audit: · AST graph · Harness · Specs · Impact analysis · Decision trail · Metrics · MCP server. Works with Cursor and Claude Code.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -44,7 +44,8 @@
44
44
  "chalk": "^4.1.2",
45
45
  "ora": "^5.4.1",
46
46
  "inquirer": "^8.2.6",
47
- "sql.js": "^1.10.3"
47
+ "sql.js": "^1.10.3",
48
+ "@libsql/client": "^0.14.0"
48
49
  },
49
50
  "optionalDependencies": {
50
51
  "better-sqlite3": "^9.4.3"