@foss.global/codefeed

a module to create codefeeds

readme.md for @foss.global/codefeed

Generate an activity feed from a Gitea instance. Scans orgs and repos, retrieves commits since a configurable timestamp, enriches with tags, optional npm publish detection, and CHANGELOG snippets.

Install

pnpm add @foss.global/codefeed
# or
npm i @foss.global/codefeed

Requires Node.js 18+ (global fetch/Request/Response) and ESM.

Quick Start

import { CodeFeed } from '@foss.global/codefeed';

// Fetch commits since one week ago (default), no caching
const feed = new CodeFeed('https://code.example.com', 'gitea_token');
const commits = await feed.fetchAllCommitsFromInstance();
console.log(commits);

With options

const thirtyDays = 30 * 24 * 60 * 60 * 1000;
const since = new Date(Date.now() - thirtyDays).toISOString();

const feed = new CodeFeed('https://code.example.com', 'gitea_token', since, {
  enableCache: true,          // keep results in memory
  cacheWindowMs: thirtyDays,  // trim cache to this window
  enableNpmCheck: true,       // check npm for published versions
  taggedOnly: false,          // return all commits (or only tagged)
  orgAllowlist: ['myorg'],    // only scan these orgs
  orgDenylist: ['archive'],   // skip these orgs
  repoAllowlist: ['myorg/app1', 'myorg/app2'], // only these repos
  repoDenylist: ['myorg/old-repo'],            // skip these repos
  untilTimestamp: new Date().toISOString(),    // optional upper bound
  verbose: true,               // print a short metrics summary
});

const commits = await feed.fetchAllCommitsFromInstance();

Each returned item follows this shape:

interface ICommitResult {
  baseUrl: string;
  org: string;
  repo: string;
  timestamp: string;        // ISO date
  hash: string;             // commit SHA
  commitMessage: string;
  tagged: boolean;          // commit is pointed to by a tag
  publishedOnNpm: boolean;  // only when npm check enabled and tag matches
  prettyAgoTime: string;    // human-readable diff
  changelog: string | undefined; // snippet for matching tag version
}

Features

Environment

Testing

The repo contains:

Run tests:

pnpm test

For the integration test, ensure GITEA_TOKEN is provided (e.g., via .nogit/ as used in test/test.ts).

Notes

changelog.md for @foss.global/codefeed

2025-09-14 - 1.7.2 - fix(core)

Stabilize pagination, tag mapping, changelog parsing, and HTTP retry/backoff; add tests and caching improvements

2025-04-25 - 1.7.1 - fix(CodeFeed)

Improve commit fetching concurrency and add tagged-only commit filtering along with updated documentation and tests

2025-04-25 - 1.7.0 - feat(core)

Enhance commit fetching with caching, concurrency improvements, and dependency upgrades

2024-12-16 - 1.6.5 - fix(CodeFeed)

Fixed timestamp initialization and commit fetching timeframe

2024-12-14 - 1.6.4 - fix(core)

Refactor fetch logic to use a unified fetchFunction for API calls

2024-12-14 - 1.6.3 - fix(codefeed)

Refactor and fix formatting issues in the CodeFeed module

2024-12-14 - 1.6.2 - fix(core)

Fix sorting order of tagged commits by timestamp

2024-12-14 - 1.6.1 - fix(docs)

Updated project metadata and expanded documentation for installation and usage.

2024-12-14 - 1.6.0 - feat(core)

Add changelog fetching and parsing functionality

2024-12-14 - 1.5.3 - fix(core)

Fix filtering logic for returning only tagged commits

2024-12-14 - 1.5.2 - fix(core)

Ensure stability of core functionalities.

2024-12-14 - 1.5.1 - fix(core)

Refine logging format in CodeFeed class

2024-12-14 - 1.5.0 - feat(core)

Refactor TypeScript interfaces and improve module exports

2024-12-13 - 1.4.1 - fix(core)

Corrected log formatting for commit information output in CodeFeed

2024-12-13 - 1.4.0 - feat(CodeFeed)

Enhance commit results with human-readable time

2024-12-13 - 1.3.0 - feat(core)

Export CommitResult interface for external use.

2024-12-13 - 1.2.1 - fix(core)

No changes detected

2024-12-13 - 1.2.0 - feat(core)

Add organization-level activity fetching and RSS parsing

2024-12-13 - 1.1.0 - feat(core)

Add tracking of commits published on npm

2024-12-13 - 1.0.2 - fix(core)

Improve error handling in fetchRecentCommitsForRepo method

2024-12-13 - 1.0.1 - initial release

Initial release of the project