@lume.produtos/intelidente-agent-tools 1.0.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.
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import process from 'node:process';
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
|--------------------------------------------------------------------------
|
|
10
|
+
| Helpers
|
|
11
|
+
|--------------------------------------------------------------------------
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
function copyDir(source, target) {
|
|
15
|
+
fs.mkdirSync(target, { recursive: true });
|
|
16
|
+
|
|
17
|
+
const entries = fs.readdirSync(source, {
|
|
18
|
+
withFileTypes: true
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
for (const entry of entries) {
|
|
22
|
+
const sourcePath = path.join(source, entry.name);
|
|
23
|
+
const targetPath = path.join(target, entry.name);
|
|
24
|
+
|
|
25
|
+
if (entry.isDirectory()) {
|
|
26
|
+
copyDir(sourcePath, targetPath);
|
|
27
|
+
} else {
|
|
28
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function fileExists(filePath) {
|
|
34
|
+
return fs.existsSync(filePath);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function dirExists(dirPath) {
|
|
38
|
+
return fs.existsSync(dirPath);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/*
|
|
42
|
+
|--------------------------------------------------------------------------
|
|
43
|
+
| Args
|
|
44
|
+
|--------------------------------------------------------------------------
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
const args = process.argv.slice(2);
|
|
48
|
+
|
|
49
|
+
const command = args[0];
|
|
50
|
+
const name = args[1];
|
|
51
|
+
|
|
52
|
+
const targetArg = args.find(arg =>
|
|
53
|
+
arg.startsWith('--targets=')
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const targets = targetArg
|
|
57
|
+
? targetArg
|
|
58
|
+
.replace('--targets=', '')
|
|
59
|
+
.split(/[,\s]+/)
|
|
60
|
+
.map(item => item.trim())
|
|
61
|
+
.filter(Boolean)
|
|
62
|
+
: ['claude', 'codex'];
|
|
63
|
+
|
|
64
|
+
console.log(targets);
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
|--------------------------------------------------------------------------
|
|
68
|
+
| Validation
|
|
69
|
+
|--------------------------------------------------------------------------
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
if (command !== 'install') {
|
|
73
|
+
console.log('');
|
|
74
|
+
console.log('Comando inválido.');
|
|
75
|
+
console.log('');
|
|
76
|
+
console.log('Uso:');
|
|
77
|
+
console.log(
|
|
78
|
+
'intelidente-agent-tools install criar-testes'
|
|
79
|
+
);
|
|
80
|
+
console.log('');
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (!name) {
|
|
85
|
+
console.log('');
|
|
86
|
+
console.log('Informe o nome da skill.');
|
|
87
|
+
console.log('');
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/*
|
|
92
|
+
|--------------------------------------------------------------------------
|
|
93
|
+
| Paths
|
|
94
|
+
|--------------------------------------------------------------------------
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
const projectPath = process.cwd();
|
|
98
|
+
|
|
99
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
100
|
+
const __dirname = path.dirname(__filename);
|
|
101
|
+
|
|
102
|
+
const packagePath = path.resolve(__dirname, '..');
|
|
103
|
+
|
|
104
|
+
/*
|
|
105
|
+
|--------------------------------------------------------------------------
|
|
106
|
+
| Claude
|
|
107
|
+
|--------------------------------------------------------------------------
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
if (targets.includes('claude')) {
|
|
111
|
+
|
|
112
|
+
const claudeSource = path.join(
|
|
113
|
+
packagePath,
|
|
114
|
+
'templates',
|
|
115
|
+
name,
|
|
116
|
+
'claude',
|
|
117
|
+
'commands',
|
|
118
|
+
`${name}.md`
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
const claudeTarget = path.join(
|
|
122
|
+
projectPath,
|
|
123
|
+
'.claude',
|
|
124
|
+
'commands',
|
|
125
|
+
`${name}.md`
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
if (!fileExists(claudeSource)) {
|
|
129
|
+
console.log('');
|
|
130
|
+
console.log(
|
|
131
|
+
`Template Claude não encontrado: ${name}`
|
|
132
|
+
);
|
|
133
|
+
console.log('');
|
|
134
|
+
process.exit(1);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
fs.mkdirSync(path.dirname(claudeTarget), {
|
|
138
|
+
recursive: true
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
fs.copyFileSync(claudeSource, claudeTarget);
|
|
142
|
+
|
|
143
|
+
console.log(
|
|
144
|
+
`✓ Claude command instalado: ${name}`
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/*
|
|
149
|
+
|--------------------------------------------------------------------------
|
|
150
|
+
| Codex
|
|
151
|
+
|--------------------------------------------------------------------------
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
if (targets.includes('codex')) {
|
|
155
|
+
|
|
156
|
+
const codexSource = path.join(
|
|
157
|
+
packagePath,
|
|
158
|
+
'templates',
|
|
159
|
+
name,
|
|
160
|
+
'codex',
|
|
161
|
+
'skills',
|
|
162
|
+
name
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
const codexTarget = path.join(
|
|
166
|
+
projectPath,
|
|
167
|
+
'.codex',
|
|
168
|
+
'skills',
|
|
169
|
+
name
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
if (!dirExists(codexSource)) {
|
|
173
|
+
console.log('');
|
|
174
|
+
console.log(
|
|
175
|
+
`Template Codex não encontrado: ${name}`
|
|
176
|
+
);
|
|
177
|
+
console.log('');
|
|
178
|
+
process.exit(1);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
copyDir(codexSource, codexTarget);
|
|
182
|
+
|
|
183
|
+
console.log(
|
|
184
|
+
`✓ Codex skill instalada: ${name}`
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/*
|
|
189
|
+
|--------------------------------------------------------------------------
|
|
190
|
+
| Done
|
|
191
|
+
|--------------------------------------------------------------------------
|
|
192
|
+
*/
|
|
193
|
+
|
|
194
|
+
console.log('');
|
|
195
|
+
console.log('Instalação concluída!');
|
|
196
|
+
console.log('');
|
package/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lume.produtos/intelidente-agent-tools",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Installer for Intelidente Claude commands and Codex skills",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"intelidente-agent-tools": "bin/intelidente-agent-tools.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"templates"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT"
|
|
14
|
+
}
|
|
File without changes
|