edusquads-cli 0.2.0 → 0.2.1

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
@@ -19,6 +19,8 @@ Comandos:
19
19
  npx edusquads-cli install
20
20
  ```
21
21
 
22
+ > Se `--ide` não for informado, o instalador pergunta no terminal qual(s) IDE(s) você quer.
23
+
22
24
  Opções úteis:
23
25
 
24
26
  ```bash
package/bin/edusquads.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  const fs = require("fs");
4
4
  const path = require("path");
5
+ const readline = require("readline");
5
6
 
6
7
  const args = process.argv.slice(2);
7
8
  const command = args.find((a) => !a.startsWith("-")) || "install";
@@ -14,16 +15,17 @@ const targetDir =
14
15
  : process.cwd();
15
16
 
16
17
  const ideArgIndex = args.findIndex((a) => a === "--ide");
17
- const ideArg = ideArgIndex >= 0 ? args[ideArgIndex + 1] : "claude";
18
+ const ideArg = ideArgIndex >= 0 ? args[ideArgIndex + 1] : null;
18
19
 
19
20
  const PACKAGE_ROOT = path.resolve(__dirname, "..");
21
+ const PKG = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT, "package.json"), "utf-8"));
20
22
 
21
23
  const IDE_SKILL_PATHS = {
22
24
  claude: ".claude/skills/edusquads",
23
25
  codex: ".codex/skills/edusquads",
24
26
  opencode: ".opencode/skills/edusquads",
25
27
  kilocode: ".kilocode/skills/edusquads",
26
- antigravity: ".antigravity/skills/edusquads"
28
+ antigravity: ".antigravity/skills/edusquads",
27
29
  };
28
30
 
29
31
  const SHARED_INSTALL_ITEMS = [
@@ -35,7 +37,7 @@ const SHARED_INSTALL_ITEMS = [
35
37
  { src: "_edusquads/runs/RUN-MODELO.md", dest: "_edusquads/runs/RUN-MODELO.md" },
36
38
  { src: "_edusquads/runs/RUNS-INDEX.md", dest: "_edusquads/runs/RUNS-INDEX.md" },
37
39
  { src: "_edusquads/evidencias/EVIDENCIA-MODELO.md", dest: "_edusquads/evidencias/EVIDENCIA-MODELO.md" },
38
- { src: "carrosseis.md", dest: "carrosseis.md" }
40
+ { src: "carrosseis.md", dest: "carrosseis.md" },
39
41
  ];
40
42
 
41
43
  function help() {
@@ -48,35 +50,15 @@ Uso:
48
50
 
49
51
  Opções:
50
52
  --target <dir> Diretório do projeto de destino (default: diretório atual)
51
- --ide <lista> IDE(s) para instalar a skill (default: claude)
53
+ --ide <lista> IDE(s) para instalar a skill
52
54
  Valores: claude,codex,opencode,kilocode,antigravity,all
53
55
  Exemplo: --ide claude,codex,opencode
56
+ Se omitido, o CLI pergunta no terminal.
54
57
  --force Sobrescreve arquivos existentes
55
58
  --dry-run Simula instalação sem gravar arquivos
56
59
  `);
57
60
  }
58
61
 
59
- function parseIdes(input) {
60
- const raw = (input || "claude").toLowerCase().trim();
61
- if (!raw) return ["claude"];
62
-
63
- if (raw === "all") return Object.keys(IDE_SKILL_PATHS);
64
-
65
- const picked = raw
66
- .split(",")
67
- .map((x) => x.trim())
68
- .filter(Boolean);
69
-
70
- const unknown = picked.filter((x) => !IDE_SKILL_PATHS[x]);
71
- if (unknown.length) {
72
- console.error(`IDE(s) inválida(s): ${unknown.join(", ")}`);
73
- console.error(`Use: ${Object.keys(IDE_SKILL_PATHS).join(", ")} ou all`);
74
- process.exit(1);
75
- }
76
-
77
- return [...new Set(picked)];
78
- }
79
-
80
62
  function ensureDir(p) {
81
63
  if (dryRun) return;
82
64
  fs.mkdirSync(p, { recursive: true });
@@ -134,28 +116,106 @@ function writeInstallMarker(target, ides) {
134
116
  const payload = {
135
117
  installedAt: new Date().toISOString(),
136
118
  package: "edusquads-cli",
137
- version: "0.2.0",
138
- ides
119
+ version: PKG.version,
120
+ ides,
139
121
  };
140
122
  ensureDir(path.dirname(markerPath));
141
123
  if (!dryRun) fs.writeFileSync(markerPath, JSON.stringify(payload, null, 2), "utf-8");
142
124
  }
143
125
 
126
+ function parseIdes(input) {
127
+ const raw = (input || "claude").toLowerCase().trim();
128
+ if (!raw) return ["claude"];
129
+
130
+ if (raw === "all") return Object.keys(IDE_SKILL_PATHS);
131
+
132
+ const picked = raw
133
+ .split(",")
134
+ .map((x) => x.trim())
135
+ .filter(Boolean);
136
+
137
+ const unknown = picked.filter((x) => !IDE_SKILL_PATHS[x]);
138
+ if (unknown.length) {
139
+ throw new Error(
140
+ `IDE(s) inválida(s): ${unknown.join(", ")}. Use: ${Object.keys(IDE_SKILL_PATHS).join(", ")} ou all`
141
+ );
142
+ }
143
+
144
+ return [...new Set(picked)];
145
+ }
146
+
144
147
  function buildInstallItems(ides) {
145
148
  const skillItems = ides.map((ide) => ({
146
149
  src: ".claude/skills/edusquads",
147
- dest: IDE_SKILL_PATHS[ide]
150
+ dest: IDE_SKILL_PATHS[ide],
148
151
  }));
149
152
  return [...skillItems, ...SHARED_INSTALL_ITEMS];
150
153
  }
151
154
 
152
- function install() {
155
+ function ask(promptText) {
156
+ const rl = readline.createInterface({
157
+ input: process.stdin,
158
+ output: process.stdout,
159
+ });
160
+ return new Promise((resolve) => {
161
+ rl.question(promptText, (answer) => {
162
+ rl.close();
163
+ resolve(answer);
164
+ });
165
+ });
166
+ }
167
+
168
+ async function resolveIdes() {
169
+ if (ideArg) return parseIdes(ideArg);
170
+
171
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
172
+ return ["claude"];
173
+ }
174
+
175
+ console.log("\nSelecione a(s) IDE(s) para instalar o EduSquads:");
176
+ console.log(" 1) claude (Claude Code)");
177
+ console.log(" 2) codex");
178
+ console.log(" 3) opencode");
179
+ console.log(" 4) kilocode");
180
+ console.log(" 5) antigravity");
181
+ console.log(" 6) all (todas)");
182
+
183
+ const answer = (await ask("Digite número(s) separados por vírgula (default: 1): ")).trim();
184
+ if (!answer) return ["claude"];
185
+
186
+ const numberMap = {
187
+ "1": "claude",
188
+ "2": "codex",
189
+ "3": "opencode",
190
+ "4": "kilocode",
191
+ "5": "antigravity",
192
+ "6": "all",
193
+ };
194
+
195
+ const converted = answer
196
+ .split(",")
197
+ .map((x) => x.trim())
198
+ .filter(Boolean)
199
+ .map((x) => numberMap[x] || x)
200
+ .join(",");
201
+
202
+ return parseIdes(converted);
203
+ }
204
+
205
+ async function install() {
153
206
  if (!fs.existsSync(targetDir)) {
154
207
  console.error(`Diretório alvo não existe: ${targetDir}`);
155
208
  process.exit(1);
156
209
  }
157
210
 
158
- const ides = parseIdes(ideArg);
211
+ let ides;
212
+ try {
213
+ ides = await resolveIdes();
214
+ } catch (err) {
215
+ console.error(err.message);
216
+ process.exit(1);
217
+ }
218
+
159
219
  const installItems = buildInstallItems(ides);
160
220
  const report = { created: 0, overwritten: 0, skipped: 0 };
161
221
 
@@ -195,15 +255,17 @@ function install() {
195
255
  console.log("");
196
256
  }
197
257
 
198
- if (args.includes("--help") || args.includes("-h")) {
199
- help();
200
- process.exit(0);
201
- }
258
+ (async () => {
259
+ if (args.includes("--help") || args.includes("-h")) {
260
+ help();
261
+ process.exit(0);
262
+ }
202
263
 
203
- if (!["install", "init"].includes(command)) {
204
- console.error(`Comando inválido: ${command}`);
205
- help();
206
- process.exit(1);
207
- }
264
+ if (!["install", "init"].includes(command)) {
265
+ console.error(`Comando inválido: ${command}`);
266
+ help();
267
+ process.exit(1);
268
+ }
208
269
 
209
- install();
270
+ await install();
271
+ })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edusquads-cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Instalador do framework EduSquads para Claude Code via npx.",
5
5
  "bin": {
6
6
  "edusquads": "bin/edusquads.js"