# ethosagent/tools-india-news architecture

> Architecture diagram of the GitHub repository ethosagent/tools-india-news, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ethosagent/tools-india-news
- Repository: https://github.com/ethosagent/tools-india-news

## Overview

This package gathers Indian corporate announcements, earnings dates, and financial RSS news, caches them locally, and serves them through Ethos tools or a standalone CLI. The main workflow is a tool or CLI request, stale-cache refresh from the relevant source fetchers, persistence in SQLite, then filtered/searchable results. The graph also shows the direct BSE, NSE, and RSS ingestion paths and the schema layer. Some tool and CLI implementation is excerpted only in part; edges reflect shown calls or README-documented capabilities.

Main entry points: [`src/tools.ts`](https://github.com/ethosagent/tools-india-news/blob/main/src/tools.ts) (Agent news tools), [`src/cli.ts`](https://github.com/ethosagent/tools-india-news/blob/main/src/cli.ts) (CLI commands), [`src/store.ts`](https://github.com/ethosagent/tools-india-news/blob/main/src/store.ts) (NewsStore), [`src/bse-fetcher.ts`](https://github.com/ethosagent/tools-india-news/blob/main/src/bse-fetcher.ts) (BSE announcements)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["CLI commands<br/>[cli.ts]"]
  node_agent_tools["Agent news tools<br/>[tools.ts]"]
end

subgraph group_ingestion["Source ingestion"]
  node_bse_fetcher["BSE announcements<br/>[bse-fetcher.ts]"]
  node_nse_fetcher["NSE filings and earnings<br/>[nse-fetcher.ts]"]
  node_rss_fetcher["RSS news feeds<br/>[rss-fetcher.ts]"]
end

subgraph group_persistence["Local data"]
  node_store["NewsStore<br/>[store.ts]"]
  node_schema["SQLite schema<br/>[schema.ts]"]
end

subgraph group_integrations["External systems"]
  node_sqlite[("Local SQLite database")]
  node_bse["BSE India"]
  node_nse["NSE India"]
  node_rss_sources["ET, BS, Moneycontrol"]
  node_ethos_host["Ethos tool host"]
end

node_cli_user(("CLI user"))
node_agent(("Ethos agent"))

node_cli_user -->|"runs commands"| node_cli
node_cli -->|"fetches filings"| node_bse_fetcher
node_cli -->|"fetches filings and dates"| node_nse_fetcher
node_cli -->|"fetches news"| node_rss_fetcher
node_cli -->|"reads and updates"| node_store
node_agent -->|"requests news tools"| node_agent_tools
node_agent_tools -->|"fetches filings"| node_bse_fetcher
node_agent_tools -->|"fetches filings and dates"| node_nse_fetcher
node_agent_tools -->|"fetches news"| node_rss_fetcher
node_agent_tools -->|"reads and updates"| node_store
node_agent_tools -->|"registers tools"| node_ethos_host
node_bse_fetcher -->|"requests announcements"| node_bse
node_nse_fetcher -->|"requests filings and calendar"| node_nse
node_rss_fetcher -->|"fetches feeds"| node_rss_sources
node_store -->|"runs migrations"| node_schema
node_store -->|"reads and writes"| node_sqlite

click node_cli "https://github.com/ethosagent/tools-india-news/blob/main/src/cli.ts"
click node_agent_tools "https://github.com/ethosagent/tools-india-news/blob/main/src/tools.ts"
click node_bse_fetcher "https://github.com/ethosagent/tools-india-news/blob/main/src/bse-fetcher.ts"
click node_nse_fetcher "https://github.com/ethosagent/tools-india-news/blob/main/src/nse-fetcher.ts"
click node_rss_fetcher "https://github.com/ethosagent/tools-india-news/blob/main/src/rss-fetcher.ts"
click node_store "https://github.com/ethosagent/tools-india-news/blob/main/src/store.ts"
click node_schema "https://github.com/ethosagent/tools-india-news/blob/main/src/schema.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_agent_tools,node_cli_user toneBlue
class node_bse_fetcher,node_nse_fetcher,node_rss_fetcher toneAmber
class node_store,node_schema toneMint
class node_sqlite,node_bse,node_nse,node_rss_sources,node_ethos_host toneRose
class node_agent toneIndigo
```

## Components

### User interfaces

- [CLI commands](https://github.com/ethosagent/tools-india-news/blob/main/src/cli.ts): `src/cli.ts`
- [Agent news tools](https://github.com/ethosagent/tools-india-news/blob/main/src/tools.ts): `src/tools.ts`

### Source ingestion

- [BSE announcements](https://github.com/ethosagent/tools-india-news/blob/main/src/bse-fetcher.ts): `src/bse-fetcher.ts`
- [NSE filings and earnings](https://github.com/ethosagent/tools-india-news/blob/main/src/nse-fetcher.ts): `src/nse-fetcher.ts`
- [RSS news feeds](https://github.com/ethosagent/tools-india-news/blob/main/src/rss-fetcher.ts): `src/rss-fetcher.ts`

### Local data

- [NewsStore](https://github.com/ethosagent/tools-india-news/blob/main/src/store.ts): `src/store.ts`
- [SQLite schema](https://github.com/ethosagent/tools-india-news/blob/main/src/schema.ts): `src/schema.ts`

### External systems

- **Local SQLite database**
- **BSE India**
- **NSE India**
- **ET, BS, Moneycontrol**
- **Ethos tool host**

### Other components

- **CLI user**
- **Ethos agent**

## Connections

- CLI user → CLI commands: runs commands (evidence: `README.md`)
- CLI commands → BSE announcements: fetches filings (evidence: `src/cli.ts`)
- CLI commands → NSE filings and earnings: fetches filings and dates (evidence: `src/cli.ts`)
- CLI commands → RSS news feeds: fetches news (evidence: `src/cli.ts`)
- CLI commands → NewsStore: reads and updates (evidence: `src/cli.ts`)
- Ethos agent → Agent news tools: requests news tools (evidence: `README.md`)
- Agent news tools → BSE announcements: fetches filings (evidence: `src/tools.ts`)
- Agent news tools → NSE filings and earnings: fetches filings and dates (evidence: `src/tools.ts`)
- Agent news tools → RSS news feeds: fetches news (evidence: `src/tools.ts`)
- Agent news tools → NewsStore: reads and updates (evidence: `src/tools.ts`)
- Agent news tools → Ethos tool host: registers tools (evidence: `src/tools.ts`)
- BSE announcements → BSE India: requests announcements (evidence: `src/bse-fetcher.ts`)
- NSE filings and earnings → NSE India: requests filings and calendar (evidence: `src/nse-fetcher.ts`)
- RSS news feeds → ET, BS, Moneycontrol: fetches feeds (evidence: `src/rss-fetcher.ts`)
- NewsStore → SQLite schema: runs migrations (evidence: `src/store.ts`)
- NewsStore → Local SQLite database: reads and writes (evidence: `src/store.ts`)
