edusquads-cli 0.1.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 +4 -0
- package/bin/edusquads.js +150 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,10 +19,14 @@ 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
|
|
25
27
|
npx edusquads-cli install --target <pasta-do-projeto>
|
|
28
|
+
npx edusquads-cli install --ide claude,codex,opencode,kilocode,antigravity
|
|
29
|
+
npx edusquads-cli install --ide all
|
|
26
30
|
npx edusquads-cli install --force
|
|
27
31
|
npx edusquads-cli install --dry-run
|
|
28
32
|
```
|
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";
|
|
@@ -13,10 +14,21 @@ const targetDir =
|
|
|
13
14
|
? path.resolve(args[targetArgIndex + 1])
|
|
14
15
|
: process.cwd();
|
|
15
16
|
|
|
17
|
+
const ideArgIndex = args.findIndex((a) => a === "--ide");
|
|
18
|
+
const ideArg = ideArgIndex >= 0 ? args[ideArgIndex + 1] : null;
|
|
19
|
+
|
|
16
20
|
const PACKAGE_ROOT = path.resolve(__dirname, "..");
|
|
21
|
+
const PKG = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT, "package.json"), "utf-8"));
|
|
22
|
+
|
|
23
|
+
const IDE_SKILL_PATHS = {
|
|
24
|
+
claude: ".claude/skills/edusquads",
|
|
25
|
+
codex: ".codex/skills/edusquads",
|
|
26
|
+
opencode: ".opencode/skills/edusquads",
|
|
27
|
+
kilocode: ".kilocode/skills/edusquads",
|
|
28
|
+
antigravity: ".antigravity/skills/edusquads",
|
|
29
|
+
};
|
|
17
30
|
|
|
18
|
-
const
|
|
19
|
-
{ src: ".claude/skills/edusquads", dest: ".claude/skills/edusquads" },
|
|
31
|
+
const SHARED_INSTALL_ITEMS = [
|
|
20
32
|
{ src: "base", dest: "base" },
|
|
21
33
|
{ src: "especialistas", dest: "especialistas" },
|
|
22
34
|
{ src: "pesquisa", dest: "pesquisa" },
|
|
@@ -25,11 +37,26 @@ const INSTALL_ITEMS = [
|
|
|
25
37
|
{ src: "_edusquads/runs/RUN-MODELO.md", dest: "_edusquads/runs/RUN-MODELO.md" },
|
|
26
38
|
{ src: "_edusquads/runs/RUNS-INDEX.md", dest: "_edusquads/runs/RUNS-INDEX.md" },
|
|
27
39
|
{ src: "_edusquads/evidencias/EVIDENCIA-MODELO.md", dest: "_edusquads/evidencias/EVIDENCIA-MODELO.md" },
|
|
28
|
-
{ src: "carrosseis.md", dest: "carrosseis.md" }
|
|
40
|
+
{ src: "carrosseis.md", dest: "carrosseis.md" },
|
|
29
41
|
];
|
|
30
42
|
|
|
31
43
|
function help() {
|
|
32
|
-
console.log(
|
|
44
|
+
console.log(`
|
|
45
|
+
EduSquads CLI
|
|
46
|
+
|
|
47
|
+
Uso:
|
|
48
|
+
npx edusquads-cli install [--target <dir>] [--ide <lista>] [--force] [--dry-run]
|
|
49
|
+
npx edusquads-cli --help
|
|
50
|
+
|
|
51
|
+
Opções:
|
|
52
|
+
--target <dir> Diretório do projeto de destino (default: diretório atual)
|
|
53
|
+
--ide <lista> IDE(s) para instalar a skill
|
|
54
|
+
Valores: claude,codex,opencode,kilocode,antigravity,all
|
|
55
|
+
Exemplo: --ide claude,codex,opencode
|
|
56
|
+
Se omitido, o CLI pergunta no terminal.
|
|
57
|
+
--force Sobrescreve arquivos existentes
|
|
58
|
+
--dry-run Simula instalação sem gravar arquivos
|
|
59
|
+
`);
|
|
33
60
|
}
|
|
34
61
|
|
|
35
62
|
function ensureDir(p) {
|
|
@@ -62,10 +89,7 @@ function copyDir(src, dest, report) {
|
|
|
62
89
|
|
|
63
90
|
function patchGitignore(target) {
|
|
64
91
|
const gitignorePath = path.join(target, ".gitignore");
|
|
65
|
-
const required = [
|
|
66
|
-
"_edusquads/browser_profile/",
|
|
67
|
-
"_edusquads/evidencias/"
|
|
68
|
-
];
|
|
92
|
+
const required = ["_edusquads/browser_profile/", "_edusquads/evidencias/"];
|
|
69
93
|
|
|
70
94
|
let current = "";
|
|
71
95
|
if (fs.existsSync(gitignorePath)) {
|
|
@@ -75,7 +99,10 @@ function patchGitignore(target) {
|
|
|
75
99
|
let changed = false;
|
|
76
100
|
for (const line of required) {
|
|
77
101
|
if (!current.includes(line)) {
|
|
78
|
-
current +=
|
|
102
|
+
current +=
|
|
103
|
+
(current.endsWith("\n") || current.length === 0 ? "" : "\n") +
|
|
104
|
+
line +
|
|
105
|
+
"\n";
|
|
79
106
|
changed = true;
|
|
80
107
|
}
|
|
81
108
|
}
|
|
@@ -84,26 +111,115 @@ function patchGitignore(target) {
|
|
|
84
111
|
return changed;
|
|
85
112
|
}
|
|
86
113
|
|
|
87
|
-
function writeInstallMarker(target) {
|
|
114
|
+
function writeInstallMarker(target, ides) {
|
|
88
115
|
const markerPath = path.join(target, "_edusquads", "INSTALLATION.json");
|
|
89
116
|
const payload = {
|
|
90
117
|
installedAt: new Date().toISOString(),
|
|
91
118
|
package: "edusquads-cli",
|
|
92
|
-
version:
|
|
119
|
+
version: PKG.version,
|
|
120
|
+
ides,
|
|
93
121
|
};
|
|
94
122
|
ensureDir(path.dirname(markerPath));
|
|
95
123
|
if (!dryRun) fs.writeFileSync(markerPath, JSON.stringify(payload, null, 2), "utf-8");
|
|
96
124
|
}
|
|
97
125
|
|
|
98
|
-
function
|
|
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
|
+
|
|
147
|
+
function buildInstallItems(ides) {
|
|
148
|
+
const skillItems = ides.map((ide) => ({
|
|
149
|
+
src: ".claude/skills/edusquads",
|
|
150
|
+
dest: IDE_SKILL_PATHS[ide],
|
|
151
|
+
}));
|
|
152
|
+
return [...skillItems, ...SHARED_INSTALL_ITEMS];
|
|
153
|
+
}
|
|
154
|
+
|
|
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() {
|
|
99
206
|
if (!fs.existsSync(targetDir)) {
|
|
100
207
|
console.error(`Diretório alvo não existe: ${targetDir}`);
|
|
101
208
|
process.exit(1);
|
|
102
209
|
}
|
|
103
210
|
|
|
211
|
+
let ides;
|
|
212
|
+
try {
|
|
213
|
+
ides = await resolveIdes();
|
|
214
|
+
} catch (err) {
|
|
215
|
+
console.error(err.message);
|
|
216
|
+
process.exit(1);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const installItems = buildInstallItems(ides);
|
|
104
220
|
const report = { created: 0, overwritten: 0, skipped: 0 };
|
|
105
221
|
|
|
106
|
-
for (const item of
|
|
222
|
+
for (const item of installItems) {
|
|
107
223
|
const src = path.join(PACKAGE_ROOT, item.src);
|
|
108
224
|
const dest = path.join(targetDir, item.dest);
|
|
109
225
|
|
|
@@ -122,25 +238,34 @@ function install() {
|
|
|
122
238
|
}
|
|
123
239
|
|
|
124
240
|
const gitignoreChanged = patchGitignore(targetDir);
|
|
125
|
-
writeInstallMarker(targetDir);
|
|
241
|
+
writeInstallMarker(targetDir, ides);
|
|
126
242
|
|
|
127
243
|
console.log(`\nEduSquads ${dryRun ? "(simulação) " : ""}instalado em: ${targetDir}`);
|
|
244
|
+
console.log(`IDEs instaladas: ${ides.join(", ")}`);
|
|
128
245
|
console.log(`Arquivos criados: ${report.created}`);
|
|
129
246
|
console.log(`Arquivos sobrescritos: ${report.overwritten}`);
|
|
130
247
|
console.log(`Arquivos ignorados (já existiam): ${report.skipped}`);
|
|
131
248
|
console.log(`.gitignore atualizado: ${gitignoreChanged ? "sim" : "não"}`);
|
|
132
|
-
console.log(`\nNo Claude Code, abra este projeto e use: /edusquads\n`);
|
|
133
|
-
}
|
|
134
249
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
250
|
+
console.log("\nComandos esperados por IDE (após abrir o projeto na IDE):");
|
|
251
|
+
for (const ide of ides) {
|
|
252
|
+
if (ide === "claude") console.log("- Claude Code: /edusquads");
|
|
253
|
+
else console.log(`- ${ide}: skill 'edusquads' instalada em ${IDE_SKILL_PATHS[ide]}`);
|
|
254
|
+
}
|
|
255
|
+
console.log("");
|
|
138
256
|
}
|
|
139
257
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
258
|
+
(async () => {
|
|
259
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
260
|
+
help();
|
|
261
|
+
process.exit(0);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (!["install", "init"].includes(command)) {
|
|
265
|
+
console.error(`Comando inválido: ${command}`);
|
|
266
|
+
help();
|
|
267
|
+
process.exit(1);
|
|
268
|
+
}
|
|
145
269
|
|
|
146
|
-
install();
|
|
270
|
+
await install();
|
|
271
|
+
})();
|