بنقرة واحدة
cli-feature-worker
Implements Node.js CLI features with TDD for the codex-quota project
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Implements Node.js CLI features with TDD for the codex-quota project
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | cli-feature-worker |
| description | Implements Node.js CLI features with TDD for the codex-quota project |
NOTE: Startup and cleanup are handled by worker-base. This skill defines the WORK PROCEDURE.
Use for any feature that involves creating or modifying lib/*.js modules, updating codex-quota.js (routing, barrel re-exports), adding tests to codex-quota.test.js, or modifying lib/display.js / lib/handlers.js / lib/constants.js.
Read the feature description, preconditions, expectedBehavior, and verificationSteps carefully. Read AGENTS.md for conventions and boundaries. Read any referenced library files in .factory/library/.
Before writing any code, read the existing parallel modules to understand patterns:
lib/codex-accounts.js or lib/claude-accounts.jslib/codex-usage.js or lib/claude-usage.jslib/codex-tokens.js or lib/claude-tokens.jslib/handlers.js (look at handleCodex/handleClaude switch statements)lib/display.js (look at buildAccountUsageLines/buildClaudeUsageLines)lib/constants.js for naming conventionscodex-quota.test.js for test patterns, mock helpers, cleanup patternsMatch the existing patterns exactly. Do not invent new patterns.
Add test cases to codex-quota.test.js (or the appropriate test file) BEFORE writing implementation:
./codex-quota.js (barrel re-exports), NOT from lib/ directlydescribe/test/expect structurebeforeEach/afterEach for environment cleanupos.tmpdir() for temp filesRun bun test to confirm the new tests FAIL (since implementation doesn't exist yet).
Write the implementation in lib/*.js modules:
node: prefix for Node.js built-in importscodex-quota.js for ALL new exportshandlers.js, add routing in the correct switch statementconstants.js, follow UPPER_SNAKE_CASE namingdrawBox, printBar, shortenPath helpersRun bun test to confirm all tests PASS (both new and existing).
bun test — ALL tests must pass (existing + new), zero failuresnode codex-quota.js to verify the CLI still works for existing providersnode scripts/preflight.js to verify package integrityCommit with a descriptive message following the project's commit style (see git log --oneline).
{
"salientSummary": "Implemented lib/factory-usage.js with fetchFactoryUsage() supporting both JWT and API key auth, billing period calculation with configurable start day, and monthly token aggregation. Added 18 tests covering happy path, billing edge cases, auth fallback, and error handling. All 224 tests pass (206 existing + 18 new).",
"whatWasImplemented": "Created lib/factory-usage.js with fetchFactoryUsage(account, billingDay), computeBillingPeriod(billingDay, now), and sumDailyTokens(data) functions. Added FACTORY_USAGE_URL, FACTORY_TIMEOUT_MS constants. Added barrel re-exports. Integrated into handleQuota for scope 'factory' and 'all'.",
"whatWasLeftUndone": "",
"verification": {
"commandsRun": [
{ "command": "bun test", "exitCode": 0, "observation": "224 tests passed, 0 failed" },
{ "command": "node codex-quota.js factory quota --json", "exitCode": 0, "observation": "Outputs valid JSON with Factory usage data structure" },
{ "command": "node codex-quota.js", "exitCode": 0, "observation": "Default view shows Codex, Claude, and Factory sections" },
{ "command": "node scripts/preflight.js", "exitCode": 0, "observation": "All preflight checks pass, lib/ included in files array" }
],
"interactiveChecks": [
{ "action": "Ran cq factory quota with mock account", "observed": "Box rendered with usage bar, billing period, model breakdown" },
{ "action": "Ran cq factory quota --billing-day 15", "observed": "Billing period adjusted to 15th-to-15th window" },
{ "action": "Ran cq codex quota after changes", "observed": "Codex output unchanged from before" }
]
},
"tests": {
"added": [
{
"file": "codex-quota.test.js",
"cases": [
{ "name": "fetchFactoryUsage returns parsed usage data", "verifies": "Happy path API call" },
{ "name": "fetchFactoryUsage falls back to API key", "verifies": "JWT unavailable, uses fk- key" },
{ "name": "computeBillingPeriod defaults to day 1", "verifies": "Default billing period" },
{ "name": "computeBillingPeriod handles day 31 in February", "verifies": "Clamp to last day" }
]
}
]
},
"discoveredIssues": []
}