@skillsmanagerbasetis/skill-manager-local 0.4.2 → 0.4.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/index.js +6 -3
- package/package.json +1 -1
- package/src/commands/detect.js +2 -1
- package/src/commands/init.js +4 -3
- package/src/commands/install.js +2 -1
- package/src/commands/login.js +2 -1
- package/src/commands/search.js +2 -1
- package/src/commands/update.js +3 -2
- package/src/commands/whoami.js +3 -2
- package/src/env.js +1 -0
- package/src/utils/api.js +2 -2
- package/src/utils/auth.js +3 -3
- package/src/utils/config.js +3 -3
- package/src/utils/find-skill.js +16 -15
package/bin/index.js
CHANGED
|
@@ -16,13 +16,16 @@ import { update } from "../src/commands/update.js";
|
|
|
16
16
|
import { remove } from "../src/commands/remove.js";
|
|
17
17
|
import { read } from "../src/commands/read.js";
|
|
18
18
|
import { search } from "../src/commands/search.js";
|
|
19
|
+
import { CMD, ENV_NAME } from "../src/env.js";
|
|
19
20
|
|
|
20
21
|
const program = new Command();
|
|
21
22
|
|
|
23
|
+
const envLabel = ENV_NAME !== "production" ? ` [${ENV_NAME.toUpperCase()}]` : "";
|
|
24
|
+
|
|
22
25
|
program
|
|
23
|
-
.name(
|
|
24
|
-
.description(
|
|
25
|
-
.version("0.4.
|
|
26
|
+
.name(CMD)
|
|
27
|
+
.description(`CLI para gestionar skills de IA en tu editor${envLabel}`)
|
|
28
|
+
.version("0.4.3");
|
|
26
29
|
|
|
27
30
|
program
|
|
28
31
|
.command("init")
|
package/package.json
CHANGED
package/src/commands/detect.js
CHANGED
|
@@ -4,6 +4,7 @@ import inquirer from "inquirer";
|
|
|
4
4
|
import { readFile } from "../utils/fs.js";
|
|
5
5
|
import { getAllSkills } from "../manifest.js";
|
|
6
6
|
import { install } from "./install.js";
|
|
7
|
+
import { CMD } from "../env.js";
|
|
7
8
|
|
|
8
9
|
const PROJECT_FILES = [
|
|
9
10
|
{ file: "package.json", tags: ["node", "javascript", "typescript"] },
|
|
@@ -101,7 +102,7 @@ export async function detect() {
|
|
|
101
102
|
|
|
102
103
|
if (recommendations.length === 0) {
|
|
103
104
|
console.log(chalk.yellow("\nNo se encontraron skills recomendadas para este proyecto."));
|
|
104
|
-
console.log(chalk.dim(
|
|
105
|
+
console.log(chalk.dim(`Usa '${CMD} list' para ver el catálogo completo.`));
|
|
105
106
|
return;
|
|
106
107
|
}
|
|
107
108
|
|
package/src/commands/init.js
CHANGED
|
@@ -3,6 +3,7 @@ import chalk from "chalk";
|
|
|
3
3
|
import ora from "ora";
|
|
4
4
|
import { loadConfig, saveConfig, getConfigPath } from "../utils/config.js";
|
|
5
5
|
import { loadCredentials } from "../utils/auth.js";
|
|
6
|
+
import { CMD } from "../env.js";
|
|
6
7
|
import { apiRequest } from "../utils/api.js";
|
|
7
8
|
import { generateFindSkill } from "../utils/find-skill.js";
|
|
8
9
|
import { getAdapter } from "../adapters/index.js";
|
|
@@ -12,7 +13,7 @@ export async function init() {
|
|
|
12
13
|
const creds = await loadCredentials();
|
|
13
14
|
if (!creds) {
|
|
14
15
|
console.log(
|
|
15
|
-
chalk.red(
|
|
16
|
+
chalk.red(`No estás autenticado. Ejecuta primero: ${CMD} login`)
|
|
16
17
|
);
|
|
17
18
|
process.exit(1);
|
|
18
19
|
}
|
|
@@ -117,7 +118,7 @@ export async function init() {
|
|
|
117
118
|
findSpinner.fail("No se pudo instalar el find-skill");
|
|
118
119
|
console.error(chalk.dim(` ${err.message}`));
|
|
119
120
|
console.log(
|
|
120
|
-
chalk.dim(
|
|
121
|
+
chalk.dim(` Puedes intentarlo más tarde con: ${CMD} sync`)
|
|
121
122
|
);
|
|
122
123
|
}
|
|
123
124
|
|
|
@@ -134,6 +135,6 @@ export async function init() {
|
|
|
134
135
|
)
|
|
135
136
|
);
|
|
136
137
|
console.log(
|
|
137
|
-
chalk.dim(
|
|
138
|
+
chalk.dim(` Para ver skills disponibles: ${CMD} list`)
|
|
138
139
|
);
|
|
139
140
|
}
|
package/src/commands/install.js
CHANGED
|
@@ -6,6 +6,7 @@ import { apiRequest } from "../utils/api.js";
|
|
|
6
6
|
import { getAdapter, detectInstalledTools } from "../adapters/index.js";
|
|
7
7
|
import { trackInstall } from "../utils/installed.js";
|
|
8
8
|
import { readFile } from "../utils/fs.js";
|
|
9
|
+
import { CMD } from "../env.js";
|
|
9
10
|
|
|
10
11
|
export async function install(skillPath, options = {}) {
|
|
11
12
|
const config = await requireConfig();
|
|
@@ -29,7 +30,7 @@ export async function install(skillPath, options = {}) {
|
|
|
29
30
|
if (!target) {
|
|
30
31
|
spinner.fail(`Skill no encontrado: ${skillPath}`);
|
|
31
32
|
console.log(
|
|
32
|
-
chalk.dim(
|
|
33
|
+
chalk.dim(` Usa '${CMD} list' para ver los skills disponibles.`)
|
|
33
34
|
);
|
|
34
35
|
process.exit(1);
|
|
35
36
|
}
|
package/src/commands/login.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import ora from "ora";
|
|
3
3
|
import { startLoginFlow, loadCredentials, parseIdToken } from "../utils/auth.js";
|
|
4
|
+
import { CMD } from "../env.js";
|
|
4
5
|
|
|
5
6
|
export async function login() {
|
|
6
7
|
// Check if already logged in
|
|
@@ -21,7 +22,7 @@ export async function login() {
|
|
|
21
22
|
spinner.succeed(
|
|
22
23
|
chalk.green(`Autenticado como ${chalk.bold(user.email)}`)
|
|
23
24
|
);
|
|
24
|
-
console.log(chalk.dim(
|
|
25
|
+
console.log(chalk.dim(` Token guardado en config dir`));
|
|
25
26
|
} catch (err) {
|
|
26
27
|
spinner.fail(chalk.red("Error de autenticación"));
|
|
27
28
|
throw err;
|
package/src/commands/search.js
CHANGED
|
@@ -2,6 +2,7 @@ import chalk from "chalk";
|
|
|
2
2
|
import ora from "ora";
|
|
3
3
|
import { requireConfig } from "../utils/config.js";
|
|
4
4
|
import { apiRequest } from "../utils/api.js";
|
|
5
|
+
import { CMD } from "../env.js";
|
|
5
6
|
|
|
6
7
|
const LEVEL_ICONS = {
|
|
7
8
|
root: "🏢",
|
|
@@ -102,6 +103,6 @@ export async function search(query, options = {}) {
|
|
|
102
103
|
if (desc) console.log(` ${desc}`);
|
|
103
104
|
}
|
|
104
105
|
console.log();
|
|
105
|
-
console.log(chalk.dim(
|
|
106
|
+
console.log(chalk.dim(` Instalar: ${CMD} install <path>`));
|
|
106
107
|
console.log();
|
|
107
108
|
}
|
package/src/commands/update.js
CHANGED
|
@@ -3,6 +3,7 @@ import ora from "ora";
|
|
|
3
3
|
import inquirer from "inquirer";
|
|
4
4
|
import { requireConfig } from "../utils/config.js";
|
|
5
5
|
import { apiRequest } from "../utils/api.js";
|
|
6
|
+
import { CMD } from "../env.js";
|
|
6
7
|
import { getInstalledSkills, updateInstalledVersion, markChecked } from "../utils/installed.js";
|
|
7
8
|
import { getAdapter } from "../adapters/index.js";
|
|
8
9
|
|
|
@@ -50,7 +51,7 @@ export async function update(options = {}) {
|
|
|
50
51
|
if (upd.description) console.log(chalk.dim(` ${upd.description}`));
|
|
51
52
|
}
|
|
52
53
|
console.log();
|
|
53
|
-
console.log(chalk.dim(` ${updates.length} skill(s) se actualizarían. Usa '
|
|
54
|
+
console.log(chalk.dim(` ${updates.length} skill(s) se actualizarían. Usa '${CMD} update' para aplicar.`));
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
57
|
|
|
@@ -132,7 +133,7 @@ export async function checkUpdatesPassive(config) {
|
|
|
132
133
|
chalk.dim(` ${u.path} ${u.currentVersion} → ${u.latestVersion}`)
|
|
133
134
|
);
|
|
134
135
|
}
|
|
135
|
-
console.log(chalk.dim(
|
|
136
|
+
console.log(chalk.dim(` Ejecuta: ${CMD} update\n`));
|
|
136
137
|
}
|
|
137
138
|
} catch {
|
|
138
139
|
// Silent fail — don't break the main command
|
package/src/commands/whoami.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { loadCredentials, parseIdToken } from "../utils/auth.js";
|
|
3
|
+
import { CMD } from "../env.js";
|
|
3
4
|
|
|
4
5
|
export async function whoami() {
|
|
5
6
|
const creds = await loadCredentials();
|
|
6
7
|
if (!creds) {
|
|
7
8
|
console.log(chalk.yellow("No estás autenticado."));
|
|
8
|
-
console.log(chalk.dim(
|
|
9
|
+
console.log(chalk.dim(`Ejecuta: ${CMD} login`));
|
|
9
10
|
return;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
const user = parseIdToken(creds.id_token);
|
|
13
14
|
if (!user) {
|
|
14
|
-
console.log(chalk.red(
|
|
15
|
+
console.log(chalk.red(`Token inválido. Ejecuta: ${CMD} login`));
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
17
18
|
|
package/src/env.js
CHANGED
package/src/utils/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getValidToken, clearCredentials } from "./auth.js";
|
|
2
2
|
import { loadConfig } from "./config.js";
|
|
3
|
-
import { API_URL } from "../env.js";
|
|
3
|
+
import { API_URL, CMD } from "../env.js";
|
|
4
4
|
|
|
5
5
|
const DEFAULT_API_URL = process.env.SKILL_MANAGER_API_URL || API_URL;
|
|
6
6
|
|
|
@@ -24,7 +24,7 @@ export async function apiRequest(path, options = {}) {
|
|
|
24
24
|
|
|
25
25
|
if (response.status === 401) {
|
|
26
26
|
await clearCredentials();
|
|
27
|
-
throw new Error(
|
|
27
|
+
throw new Error(`Sesión inválida. Ejecuta: ${CMD} login`);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
if (!response.ok) {
|
package/src/utils/auth.js
CHANGED
|
@@ -4,7 +4,7 @@ import { homedir } from "node:os";
|
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { readFile, writeFile, unlink, mkdir, chmod } from "node:fs/promises";
|
|
6
6
|
import { exec } from "node:child_process";
|
|
7
|
-
import { ENV_NAME } from "../env.js";
|
|
7
|
+
import { ENV_NAME, CMD } from "../env.js";
|
|
8
8
|
|
|
9
9
|
// ── Cognito config ──
|
|
10
10
|
|
|
@@ -107,7 +107,7 @@ export async function getValidToken() {
|
|
|
107
107
|
let creds = await loadCredentials();
|
|
108
108
|
if (!creds) {
|
|
109
109
|
throw new Error(
|
|
110
|
-
|
|
110
|
+
`No estás autenticado. Ejecuta primero: ${CMD} login`
|
|
111
111
|
);
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -121,7 +121,7 @@ export async function getValidToken() {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
await clearCredentials();
|
|
124
|
-
throw new Error(
|
|
124
|
+
throw new Error(`Sesión expirada. Ejecuta: ${CMD} login`);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
// ── Parse id_token ──
|
package/src/utils/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { readFile, writeFile, mkdir } from "node:fs/promises";
|
|
4
|
-
import { ENV_NAME } from "../env.js";
|
|
4
|
+
import { ENV_NAME, CMD } from "../env.js";
|
|
5
5
|
|
|
6
6
|
const ENV_SUFFIX = ENV_NAME === "production" ? "" : `-${ENV_NAME}`;
|
|
7
7
|
const CONFIG_DIR = join(homedir(), `.skill-manager${ENV_SUFFIX}`);
|
|
@@ -33,14 +33,14 @@ export async function requireConfig() {
|
|
|
33
33
|
await readFile(credsPath, "utf-8");
|
|
34
34
|
} catch {
|
|
35
35
|
throw new Error(
|
|
36
|
-
|
|
36
|
+
`No estás autenticado. Ejecuta primero: ${CMD} login`
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const config = await loadConfig();
|
|
41
41
|
if (!config || !config.companyId) {
|
|
42
42
|
throw new Error(
|
|
43
|
-
|
|
43
|
+
`No se encontró configuración. Ejecuta primero: ${CMD} init`
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
return config;
|
package/src/utils/find-skill.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { apiRequest } from "./api.js";
|
|
2
|
+
import { CMD } from "../env.js";
|
|
2
3
|
|
|
3
4
|
export async function generateFindSkill(config) {
|
|
4
5
|
const permissions = await apiRequest("/api/me/permissions");
|
|
@@ -51,14 +52,14 @@ para su proyecto usando el CLI de Basetis Skill Manager.
|
|
|
51
52
|
Skills de lenguajes, frameworks, herramientas y buenas prácticas compartidas.
|
|
52
53
|
|
|
53
54
|
\`\`\`bash
|
|
54
|
-
|
|
55
|
+
${CMD} list --filter habilidades
|
|
55
56
|
\`\`\`
|
|
56
57
|
|
|
57
58
|
Ejemplos de cuándo recomendar:
|
|
58
|
-
- Si detectas TypeScript →
|
|
59
|
-
- Si detectas React →
|
|
60
|
-
- Si detectas Express →
|
|
61
|
-
- Si detectas PostgreSQL →
|
|
59
|
+
- Si detectas TypeScript → \`${CMD} install habilidades/typescript\`
|
|
60
|
+
- Si detectas React → \`${CMD} install habilidades/react\`
|
|
61
|
+
- Si detectas Express → \`${CMD} install habilidades/express-api\`
|
|
62
|
+
- Si detectas PostgreSQL → \`${CMD} install habilidades/postgresql\`
|
|
62
63
|
`;
|
|
63
64
|
|
|
64
65
|
// Areas
|
|
@@ -68,7 +69,7 @@ Ejemplos de cuándo recomendar:
|
|
|
68
69
|
#### Áreas: ${areas.map((a) => a.name).join(", ")}
|
|
69
70
|
Skills específicos de las áreas donde eres miembro.
|
|
70
71
|
|
|
71
|
-
${areas.map((a) => `\`\`\`bash\
|
|
72
|
+
${areas.map((a) => `\`\`\`bash\n${CMD} list --filter area/${a.slug}\n\`\`\``).join("\n")}
|
|
72
73
|
`;
|
|
73
74
|
}
|
|
74
75
|
|
|
@@ -79,7 +80,7 @@ ${areas.map((a) => `\`\`\`bash\nskill-manager list --filter area/${a.slug}\n\`\`
|
|
|
79
80
|
#### Equipos: ${teams.map((t) => t.name).join(", ")}
|
|
80
81
|
Skills específicos de tus equipos.
|
|
81
82
|
|
|
82
|
-
${teams.map((t) => `\`\`\`bash\
|
|
83
|
+
${teams.map((t) => `\`\`\`bash\n${CMD} list --filter team/${t.slug}\n\`\`\``).join("\n")}
|
|
83
84
|
`;
|
|
84
85
|
}
|
|
85
86
|
|
|
@@ -89,7 +90,7 @@ ${teams.map((t) => `\`\`\`bash\nskill-manager list --filter team/${t.slug}\n\`\`
|
|
|
89
90
|
md += `
|
|
90
91
|
#### Sectores: ${sectors.map((s) => s.name).join(", ")}
|
|
91
92
|
|
|
92
|
-
${sectors.map((s) => `\`\`\`bash\
|
|
93
|
+
${sectors.map((s) => `\`\`\`bash\n${CMD} list --filter sector/${s.slug}\n\`\`\``).join("\n")}
|
|
93
94
|
`;
|
|
94
95
|
}
|
|
95
96
|
|
|
@@ -99,14 +100,14 @@ ${sectors.map((s) => `\`\`\`bash\nskill-manager list --filter sector/${s.slug}\n
|
|
|
99
100
|
#### Proyectos: ${projects.map((p) => p.name).join(", ")}
|
|
100
101
|
Skills específicos de tus proyectos asignados.
|
|
101
102
|
|
|
102
|
-
${projects.map((p) => `\`\`\`bash\
|
|
103
|
+
${projects.map((p) => `\`\`\`bash\n${CMD} list --filter proyecto/${p.slug}\n\`\`\``).join("\n")}
|
|
103
104
|
`;
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
md += `
|
|
107
108
|
### Mantenimiento automático de skills
|
|
108
109
|
Cuando empieces a trabajar en un proyecto (primera interacción de la sesión),
|
|
109
|
-
ejecuta
|
|
110
|
+
ejecuta \`${CMD} update --yes\` para asegurarte de que las skills están al día.
|
|
110
111
|
Hazlo de forma silenciosa — solo informa al usuario si había actualizaciones.
|
|
111
112
|
No lo repitas más de una vez cada 10 minutos.
|
|
112
113
|
|
|
@@ -118,11 +119,11 @@ No lo repitas más de una vez cada 10 minutos.
|
|
|
118
119
|
- No instales skills tú mismo — siempre recomienda el comando CLI al usuario
|
|
119
120
|
|
|
120
121
|
### Comandos útiles
|
|
121
|
-
- Ver todo lo disponible:
|
|
122
|
-
- Filtrar:
|
|
123
|
-
- Instalar:
|
|
124
|
-
- Ver quién eres:
|
|
125
|
-
- Actualizar este skill:
|
|
122
|
+
- Ver todo lo disponible: \`${CMD} list\`
|
|
123
|
+
- Filtrar: \`${CMD} list --filter <texto>\`
|
|
124
|
+
- Instalar: \`${CMD} install <path>\`
|
|
125
|
+
- Ver quién eres: \`${CMD} whoami\`
|
|
126
|
+
- Actualizar este skill: \`${CMD} sync\`
|
|
126
127
|
`;
|
|
127
128
|
|
|
128
129
|
return md;
|