From 92b752550434cc56341516052c227053b141ee48 Mon Sep 17 00:00:00 2001 From: Pavel Fadeev Date: Sun, 29 Mar 2026 21:42:46 +0200 Subject: [PATCH] Scope package to @fiale-plus/fred-cli, fix code review issues - Rename npm package to @fiale-plus/fred-cli (fred-cli is taken) - Fix FredSeriesResponse: add FredSingleSeriesResponse for non-paginated single-series endpoint, keeping FredSeriesResponse for paginated lists - Remove dead "elements" from ARRAY_FIELDS (FredReleaseTable.elements is Record, not an array) - Update README badges and install commands for scoped package - Update npm-publish workflow verify step --- .github/workflows/npm-publish.yml | 2 +- README.md | 18 +++++++++--------- package.json | 2 +- src/api/client.ts | 3 ++- src/api/types.ts | 7 +++++++ src/cli/formatters.ts | 1 - src/index.ts | 1 + 7 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 1725ec8..7173647 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -40,4 +40,4 @@ jobs: run: | VERSION="${GITHUB_REF_NAME#v}" sleep 10 - npm view fred-cli@"$VERSION" + npm view @fiale-plus/fred-cli@"$VERSION" diff --git a/README.md b/README.md index 291f029..ce1d3e1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# fred-cli +# @fiale-plus/fred-cli -[![npm version](https://img.shields.io/npm/v/fred-cli.svg)](https://www.npmjs.com/package/fred-cli) -[![npm downloads](https://img.shields.io/npm/dm/fred-cli.svg)](https://www.npmjs.com/package/fred-cli) +[![npm version](https://img.shields.io/npm/v/@fiale-plus/fred-cli.svg)](https://www.npmjs.com/package/@fiale-plus/fred-cli) +[![npm downloads](https://img.shields.io/npm/dm/@fiale-plus/fred-cli.svg)](https://www.npmjs.com/package/@fiale-plus/fred-cli) [![Test](https://github.com/fiale-plus/fred-cli/actions/workflows/test.yml/badge.svg)](https://github.com/fiale-plus/fred-cli/actions/workflows/test.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) @@ -20,7 +20,7 @@ ## Quick Start ```bash -npm install -g fred-cli +npm install -g @fiale-plus/fred-cli export FRED_API_KEY=your-key-here fred series search "consumer price index" --limit 5 @@ -34,10 +34,10 @@ Get a free API key at: https://fred.stlouisfed.org/docs/api/api_key.html ```bash # Global (CLI usage) -npm install -g fred-cli +npm install -g @fiale-plus/fred-cli # Local (library usage) -npm install fred-cli +npm install @fiale-plus/fred-cli ``` Requires Node.js >= 18.0.0. @@ -148,7 +148,7 @@ The CLI respects FRED API defaults per endpoint. When results are paginated: ## Library Usage ```typescript -import { FredClient } from "fred-cli"; +import { FredClient } from "@fiale-plus/fred-cli"; const fred = new FredClient(process.env.FRED_API_KEY!); @@ -191,7 +191,7 @@ fred series GDP --api-key your-key-here ```bash git clone https://github.com/fiale-plus/fred-cli.git -cd fred-cli +cd @fiale-plus/fred-cli npm install npm run build npm test @@ -219,7 +219,7 @@ This software is provided "AS IS" under the MIT License, without warranty of any - [FRED API Documentation](https://fred.stlouisfed.org/docs/api/fred/) - [API Key Registration](https://fred.stlouisfed.org/docs/api/api_key.html) - [GitHub Repository](https://github.com/fiale-plus/fred-cli) -- [npm Package](https://www.npmjs.com/package/fred-cli) +- [npm Package](https://www.npmjs.com/package/@fiale-plus/fred-cli) ## License diff --git a/package.json b/package.json index fd3c45c..5a7d89e 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "fred-cli", + "name": "@fiale-plus/fred-cli", "version": "0.0.0-dev", "description": "Unofficial CLI and TypeScript client for the FRED API (Federal Reserve Economic Data) — designed for AI agents", "type": "module", diff --git a/src/api/client.ts b/src/api/client.ts index a56f30d..73bcb90 100644 --- a/src/api/client.ts +++ b/src/api/client.ts @@ -6,6 +6,7 @@ import type { TagFilterParams, RelatedTagParams, FredSeriesResponse, + FredSingleSeriesResponse, FredObservationsResponse, FredCategoryResponse, FredReleasesResponse, @@ -74,7 +75,7 @@ export class FredClient { // ── Series ────────────────────────────────────────────────────── - async getSeries(seriesId: string, opts: RealtimeParams = {}): Promise { + async getSeries(seriesId: string, opts: RealtimeParams = {}): Promise { return this.request("series", { series_id: seriesId, ...opts }); } diff --git a/src/api/types.ts b/src/api/types.ts index e617989..723b065 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -81,6 +81,13 @@ export interface FredSeriesResponse extends FredPaginatedEnvelope { seriess: FredSeries[]; } +/** Response for single-series lookup (no pagination envelope) */ +export interface FredSingleSeriesResponse { + realtime_start: string; + realtime_end: string; + seriess: FredSeries[]; +} + // ── Observation types ─────────────────────────────────────────────── export interface FredObservation { diff --git a/src/cli/formatters.ts b/src/cli/formatters.ts index a127f7d..e307523 100644 --- a/src/cli/formatters.ts +++ b/src/cli/formatters.ts @@ -10,7 +10,6 @@ const ARRAY_FIELDS = [ "sources", "tags", "vintage_dates", - "elements", ] as const; type DataRecord = Record; diff --git a/src/index.ts b/src/index.ts index 99ad0bd..4ddae78 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,6 +9,7 @@ export type { FredSource, FredTag, FredSeriesResponse, + FredSingleSeriesResponse, FredObservationsResponse, FredCategoryResponse, FredReleasesResponse,