staffos 0.1.4 → 0.1.5
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 +14 -0
- package/bin/cli.js +41 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,6 +31,20 @@ Para **analizar y estimar el ahorro exacto de tokens** y el costo proyectado de
|
|
|
31
31
|
npx staffos estimate
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
Puedes especificar un modelo de IA en particular mediante el flag `--model` para obtener estimaciones de costos exactas basadas en las tarifas de 2026:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx staffos estimate --model=gemini-pro
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Los modelos de IA soportados son:
|
|
41
|
+
* `claude-sonnet` (Claude 4.8 Sonnet - predeterminado)
|
|
42
|
+
* `claude-opus` (Claude 4.8 Opus)
|
|
43
|
+
* `gemini-pro` (Gemini 3.1 Pro)
|
|
44
|
+
* `gemini-flash` (Gemini 3.5 Flash)
|
|
45
|
+
* `gpt-5.5` (GPT 5.5)
|
|
46
|
+
* `local` (Modelos locales de Ollama/Llama sin costo de API)
|
|
47
|
+
|
|
34
48
|
Este comando escaneará la base de código de tu proyecto local y generará una tabla detallada con los cálculos en tiempo real.
|
|
35
49
|
|
|
36
50
|
---
|
package/bin/cli.js
CHANGED
|
@@ -121,10 +121,36 @@ function getFilesRecursive(dir, fileList = []) {
|
|
|
121
121
|
return fileList;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
// Model Pricing Registry (2026 Standard Rates per 1M tokens)
|
|
125
|
+
const modelsPricing = {
|
|
126
|
+
'claude-sonnet': { name: 'Claude 4.8 Sonnet', input: 3.00, output: 15.00 },
|
|
127
|
+
'claude-opus': { name: 'Claude 4.8 Opus', input: 15.00, output: 75.00 },
|
|
128
|
+
'gemini-pro': { name: 'Gemini 3.1 Pro', input: 2.00, output: 12.00 },
|
|
129
|
+
'gemini-flash': { name: 'Gemini 3.5 Flash', input: 0.075, output: 0.30 },
|
|
130
|
+
'gpt-5.5': { name: 'GPT 5.5', input: 5.00, output: 30.00 },
|
|
131
|
+
'local': { name: 'Modelos Locales (Ollama/DeepSeek)', input: 0.00, output: 0.00 }
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
function getModelFromArgs() {
|
|
135
|
+
const modelArg = process.argv.find(arg => arg.startsWith('--model='));
|
|
136
|
+
if (modelArg) {
|
|
137
|
+
return modelArg.split('=')[1].toLowerCase();
|
|
138
|
+
}
|
|
139
|
+
const modelIndex = process.argv.indexOf('-m');
|
|
140
|
+
if (modelIndex !== -1 && process.argv[modelIndex + 1]) {
|
|
141
|
+
return process.argv[modelIndex + 1].toLowerCase();
|
|
142
|
+
}
|
|
143
|
+
return 'claude-sonnet'; // default
|
|
144
|
+
}
|
|
145
|
+
|
|
124
146
|
// Estimate token savings for the current workspace
|
|
125
147
|
function runEstimator() {
|
|
148
|
+
const modelKey = getModelFromArgs();
|
|
149
|
+
const pricing = modelsPricing[modelKey] || modelsPricing['claude-sonnet'];
|
|
150
|
+
|
|
126
151
|
console.log(`${colors.cyan}${colors.bold}=== StaffOS Token & Cost Estimator ===${colors.reset}\n`);
|
|
127
152
|
console.log(`Scanning workspace at: ${colors.gray}${targetDir}${colors.reset}`);
|
|
153
|
+
console.log(`Target AI Model: ${colors.yellow}${colors.bold}${pricing.name}${colors.reset} (Input: $${pricing.input}/1M, Output: $${pricing.output}/1M)`);
|
|
128
154
|
|
|
129
155
|
const files = getFilesRecursive(targetDir);
|
|
130
156
|
let totalCharacters = 0;
|
|
@@ -145,21 +171,14 @@ function runEstimator() {
|
|
|
145
171
|
const codebaseTokens = Math.round(totalCharacters / 3.8);
|
|
146
172
|
|
|
147
173
|
// Scenario A: Traditional Agent (Unconstrained)
|
|
148
|
-
// - Performs a full repository scan to start.
|
|
149
|
-
// - Runs 4 iterative repair cycles, re-reading context.
|
|
150
|
-
// - Rewrites complete files (avg. 1,500 tokens output) on each cycle.
|
|
151
174
|
const tradInputTokens = codebaseTokens * 4;
|
|
152
175
|
const tradOutputTokens = 1500 * 4;
|
|
153
176
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
const tradInputCost = (tradInputTokens / 1_000_000) * 3.00;
|
|
157
|
-
const tradOutputCost = (tradOutputTokens / 1_000_000) * 15.00;
|
|
177
|
+
const tradInputCost = (tradInputTokens / 1_000_000) * pricing.input;
|
|
178
|
+
const tradOutputCost = (tradOutputTokens / 1_000_000) * pricing.output;
|
|
158
179
|
const tradTotalCost = tradInputCost + tradOutputCost;
|
|
159
180
|
|
|
160
181
|
// Scenario B: StaffOS Agent
|
|
161
|
-
// - Reads AI_CONTEXT.md + AGENTS.md + SKILL.md.
|
|
162
|
-
// - If they exist, read actual length. If not, default to 1,500 tokens baseline.
|
|
163
182
|
let staffOsContextLength = 0;
|
|
164
183
|
const docsToCheck = [
|
|
165
184
|
path.join(targetDir, 'AGENTS.md'),
|
|
@@ -182,11 +201,10 @@ function runEstimator() {
|
|
|
182
201
|
? Math.round(staffOsContextLength / 3.8)
|
|
183
202
|
: 1500; // default baseline
|
|
184
203
|
|
|
185
|
-
// StaffOS restricts changes to minimal patches (avg. 100 tokens output per task) over 1 cycle
|
|
186
204
|
const staffOsOutputTokens = 100;
|
|
187
205
|
|
|
188
|
-
const staffOsInputCost = (staffOsInputTokens / 1_000_000) *
|
|
189
|
-
const staffOsOutputCost = (staffOsOutputTokens / 1_000_000) *
|
|
206
|
+
const staffOsInputCost = (staffOsInputTokens / 1_000_000) * pricing.input;
|
|
207
|
+
const staffOsOutputCost = (staffOsOutputTokens / 1_000_000) * pricing.output;
|
|
190
208
|
const staffOsTotalCost = staffOsInputCost + staffOsOutputCost;
|
|
191
209
|
|
|
192
210
|
// Savings
|
|
@@ -209,8 +227,11 @@ function runEstimator() {
|
|
|
209
227
|
console.log(`${colors.bold}${'COSTO TOTAL ESTIMADO / TAREA'.padEnd(28)} | $${tradTotalCost.toFixed(4).padEnd(19)} | $${staffOsTotalCost.toFixed(4).padEnd(13)} | ${colors.green}${savingsPercent.toFixed(1)}%${colors.reset}`);
|
|
210
228
|
console.log('--------------------------------------------------------------------------------');
|
|
211
229
|
|
|
212
|
-
|
|
213
|
-
|
|
230
|
+
if (pricing.input === 0) {
|
|
231
|
+
console.log(`\n${colors.green}${colors.bold}🎉 Ahorro Estimado: ~${savingsPercent.toFixed(0)}% en tokens por tarea (ejecución local gratuita).${colors.reset}\n`);
|
|
232
|
+
} else {
|
|
233
|
+
console.log(`\n${colors.green}${colors.bold}🎉 Ahorro Estimado: ~${savingsPercent.toFixed(0)}% en costos de API por tarea.${colors.reset}\n`);
|
|
234
|
+
}
|
|
214
235
|
}
|
|
215
236
|
|
|
216
237
|
// Help command
|
|
@@ -218,8 +239,13 @@ function runHelp() {
|
|
|
218
239
|
console.log(`\n${colors.cyan}${colors.bold}StaffOS CLI v${currentVersion}${colors.reset}`);
|
|
219
240
|
console.log('Uso:');
|
|
220
241
|
console.log(` ${colors.bold}npx staffos${colors.reset} - Instala e inicializa StaffOS en el proyecto actual.`);
|
|
221
|
-
console.log(` ${colors.bold}npx staffos estimate${colors.reset} - Escanea el proyecto
|
|
242
|
+
console.log(` ${colors.bold}npx staffos estimate${colors.reset} - Escanea el proyecto y calcula los ahorros usando el modelo predeterminado.`);
|
|
243
|
+
console.log(` ${colors.bold}npx staffos estimate --model=<tipo>${colors.reset} - Estima usando un modelo de IA específico.`);
|
|
222
244
|
console.log(` ${colors.bold}npx staffos help${colors.reset} - Muestra este menú de ayuda.`);
|
|
245
|
+
console.log('\nModelos de IA soportados para estimación (`--model=`):');
|
|
246
|
+
Object.keys(modelsPricing).forEach(key => {
|
|
247
|
+
console.log(` - ${colors.yellow}${key.padEnd(15)}${colors.reset} : ${modelsPricing[key].name}`);
|
|
248
|
+
});
|
|
223
249
|
console.log();
|
|
224
250
|
}
|
|
225
251
|
|