Symptom
packages/ts-cloud/bin/commands/cost.ts registers five commands that return hardcoded mock data despite looking real at the CLI surface:
| Command | Behavior today |
|---|---|
cost | Hardcoded "current month" total + projected, fake per-service breakdown, all marked // TODO: Fetch from AWS Cost Explorer API |
cost:breakdown | Hardcoded service rankings + trends, // TODO |
resources | Hardcoded resource counts + costs, // TODO: Fetch resources from AWS Resource Groups or CloudFormation |
resources:unused | Hardcoded "unused resources" list with fake savings numbers, // TODO: Analyze CloudWatch metrics, CloudFormation stacks, etc. |
optimize | Hardcoded recommendations with fake dollar savings, // TODO: Analyze resource usage, CloudWatch metrics, Cost Explorer data |
Why this matters
A user runs cloud cost to check this month's bill. Output looks legit:
Current Month (Estimated):
Total: $247.89
Projected: $325.00
Service Current Projected Change
EC2 $89.23 $120.00 +12%
S3 $12.45 $15.00 +8%
...…but every number is fake. We saw real April spend was $352 on default and $307 on stacks (#103) — nothing close to $247. Someone will trust these numbers and act on them.
Two acceptable paths
Option A — Implement them properly
Use the real Cost Explorer client (now exists for cost:analyze). Each command becomes a thin shaping of real data:
cost— current MTD spend + naive linear projectioncost:breakdown— N-day window, by service, with previous-window trend comparisonresources— Resource Groups Tagging API or a per-service-type sweepresources:unused— CloudWatch metrics-based heuristic per resource typeoptimize— opinionated recommendations on top of cost + resource data
This is several issues' worth of work. Probably worth filing each as its own follow-up.
Option B — Guard them as not-yet-implemented (tactical fix)
Replace the body of each with:
cli.warn('Not yet implemented — see ts-cloud#NN for tracking')
returnThis is honest, preserves the command surface so we don't break docs/help, and prevents acting on mock numbers. Real implementation lands as separate issues per command.
Recommendation
Do Option B now (one PR, prevents the active footgun) and file Option A as 5 separate follow-up issues that link back here. Don't leave mock data sitting in production-shaped commands.
Acceptance
- No
cloud cost*/cloud resources*/cloud optimizecommand returns mock numbers in its current form. - Either each is implemented with real data (Option A) or each prints a clear "not implemented" warning and a tracking-issue link (Option B).
cost:analyze(the one real command) is not affected.