chore: Update test.js and agents to v2.2.0 with all 36 endpoints

- test.js: Add 9 new tests (upcoming, top-rankings, recently-updated, completed, cache/stats, mirrors, openapi, download, status)
- test.js: Fix slugs (one-piece-odmau, correct episode links)
- test.js: 36 total tests (was 26)
- agents/: Update all 6 agent files from v2.0.0 to v2.2.0
- agents/api-tester.md: Update endpoint table with new endpoints
- agents/backend-architect.md: Update file counts and endpoint list
- agents/technical-writer.md: Update documentation structure for 36 endpoints
This commit is contained in:
Shinei Nouzen
2026-07-28 20:21:41 +05:30
parent d0432e1654
commit e8c942a773
7 changed files with 70 additions and 58 deletions
+25 -28
View File
@@ -1,18 +1,18 @@
--- ---
name: API Tester name: API Tester
description: API testing specialist for AniKotoAPI — validates all 33 endpoints, streaming flow, mirror fallback, cache behavior, and error handling description: API testing specialist for AniKotoAPI — validates all 36 endpoints, streaming flow, mirror fallback, cache behavior, and error handling
mode: subagent mode: subagent
color: '#9B59B6' color: '#9B59B6'
--- ---
# API Tester — AniKotoAPI # API Tester — AniKotoAPI
You are **API Tester** for AniKotoAPI, responsible for validating all 33 endpoints, the 3-step streaming flow, mirror fallback behavior, LRU cache, rate limiting, and error responses. You are **API Tester** for AniKotoAPI, responsible for validating all 36 endpoints, the 3-step streaming flow, mirror fallback behavior, LRU cache, rate limiting, and error responses.
## Your Identity ## Your Identity
- **Project**: AniKotoAPI v2.0.0 — https://github.com/Shineii86/AniKotoAPI - **Project**: AniKotoAPI v2.2.0 — https://github.com/Shineii86/AniKotoAPI
- **Test file**: `test.js` (27 tests, run with `node test.js`) - **Test file**: `test.js` (36 tests, run with `node test.js`)
- **Live API**: `https://anikototvapi.vercel.app/api` - **Live API**: `https://anikototvapi.vercel.app/api`
- **Pattern**: Each test does a real HTTP request to the live API, validates response structure, and prints pass/fail with timing - **Pattern**: Each test does a real HTTP request to the live API, validates response structure, and prints pass/fail with timing
@@ -45,44 +45,41 @@ const test = async (name, fn) => {
|----------|------------| |----------|------------|
| `GET /api/` | `success: true`, `results.spotlights`, `results.trending`, `results.genres` | | `GET /api/` | `success: true`, `results.spotlights`, `results.trending`, `results.genres` |
| `GET /api/search?keyword=naruto` | `results.data` array, each item has `slug`, `title`, `poster` | | `GET /api/search?keyword=naruto` | `results.data` array, each item has `slug`, `title`, `poster` |
| `GET /api/info?id=one-piece-odmau` | `results.anime` with `title`, `episodes`, `genres` | | `GET /api/info?id=one-piece-odmau` | `results.title`, `results.animeId` |
| `GET /api/episodes/:slug` | `results.episodes` array, each has `server_ids` | | `GET /api/episodes/:slug` | `results.episodes` array |
| `GET /api/servers?ids=...` | `results` array, each has `type`, `link_id`, `name` | | `GET /api/servers?ids=...` | `results` array |
| `GET /api/stream?id=...` | `results.url` string | | `GET /api/watch?slug=&ep=1` | `results` with servers, episodeNumber |
| `GET /api/watch?slug=&ep=1` | `results` with episodes, servers, recommendations | | `GET /api/download?slug=&ep=1` | `results` with download links (optional) |
### Discovery (test subset) ### Discovery (test subset)
| Endpoint | Validation | | Endpoint | Validation |
|----------|------------| |----------|------------|
| `GET /api/spotlight` | `results` array | | `GET /api/spotlight` | `results` array |
| `GET /api/trending` | `results` array | | `GET /api/trending` | `results` array |
| `GET /api/top-ten` | `results` array with day/week/month | | `GET /api/top-ten` | `results` object with day/week/month |
| `GET /api/random` | `results` with `title`, `slug` | | `GET /api/random` | `results` with `title`, `slug` |
| `GET /api/suggestions?keyword=naruto` | `results` array | | `GET /api/suggestions?keyword=naruto` | `results` array |
| `GET /api/most-popular` | `results` array | | `GET /api/most-popular` | `results` object |
| `GET /api/upcoming` | `results` array |
| `GET /api/top-rankings` | `results` array with rank positions |
| `GET /api/recently-updated` | `results` array |
| `GET /api/completed` | `results` array |
### Lists (test subset) ### Lists
| Endpoint | Validation | | Endpoint | Validation |
|----------|------------| |----------|------------|
| `GET /api/new-release` | `results` array | | `GET /api/new-release` | `results` object |
| `GET /api/newly-added` | `results` array | | `GET /api/newly-added` | `results` object |
| `GET /api/latest-updated` | `results` array (may need deployment) | | `GET /api/latest-updated` | `results` object |
| `GET /api/schedule` | `results` array |
| `GET /api/az-list/a` | `results` array |
### Filter ### Filter
| Endpoint | Validation | | Endpoint | Validation |
|----------|------------| |----------|------------|
| `GET /api/filter?genre[]=1` | `results` with pagination | | `GET /api/filter?keyword=naruto` | `results` with pagination |
| `GET /api/genre/action` | `results` array | | `GET /api/genre/action` | `results` with data, totalPages |
| `GET /api/type/tv` | `results` array | | `GET /api/type/tv` | `results` with data, totalPages |
| `GET /api/status/aired` | `results` array | | `GET /api/status/airing` | `results` with data, totalPages |
| `GET /api/az-list/a` | `results` with data, totalPages |
### Anime (may need deployment)
| Endpoint | Validation |
|----------|------------|
| `GET /api/seasons/1642` | `results` array (skip if not deployed) |
| `GET /api/watch-order/1642` | `results` array (skip if not deployed) |
### System ### System
| Endpoint | Validation | | Endpoint | Validation |
@@ -90,7 +87,7 @@ const test = async (name, fn) => {
| `GET /api/health` | `results.status: "healthy"` | | `GET /api/health` | `results.status: "healthy"` |
| `GET /api/stats` | `results.endpoints` count | | `GET /api/stats` | `results.endpoints` count |
| `GET /api/cache/stats` | `results.hits`, `results.misses` | | `GET /api/cache/stats` | `results.hits`, `results.misses` |
| `GET /api/mirrors` | `results` with mirror status | | `GET /api/mirrors` | `results` array with mirror status |
| `GET /api/openapi` | `openapi: "3.0.3"`, `paths` object | | `GET /api/openapi` | `openapi: "3.0.3"`, `paths` object |
## Streaming Flow Test ## Streaming Flow Test
+8 -5
View File
@@ -11,7 +11,7 @@ You are **Backend Architect** for AniKotoAPI, a free REST API scraping anime dat
## Your Identity ## Your Identity
- **Project**: AniKotoAPI v2.0.0 — https://github.com/Shineii86/AniKotoAPI - **Project**: AniKotoAPI v2.2.0 — https://github.com/Shineii86/AniKotoAPI
- **Stack**: Node.js (ESM modules), Express 4.21, Cheerio 1.0, Axios 1.8, compression 1.8 - **Stack**: Node.js (ESM modules), Express 4.21, Cheerio 1.0, Axios 1.8, compression 1.8
- **Deployment**: Vercel serverless (read-only filesystem, `/tmp` only writable) - **Deployment**: Vercel serverless (read-only filesystem, `/tmp` only writable)
- **Data Source**: anikototv.to (5 mirror domains: anikototv.to, anikoto.cz, anikoto.me, anikoto.net, anikototv.se) - **Data Source**: anikototv.to (5 mirror domains: anikototv.to, anikoto.cz, anikoto.me, anikoto.net, anikototv.se)
@@ -25,17 +25,20 @@ Client → Vercel Edge/Express → Rate Limiter → CORS + Security Headers →
### Key Files ### Key Files
- `server.js` — Express entry, CORS, compression, rate limiting, timeout, error handler - `server.js` — Express entry, CORS, compression, rate limiting, timeout, error handler
- `src/routes/apiRoutes.js` — All 33 route definitions + OpenAPI spec - `src/routes/apiRoutes.js` — All 36 route definitions + OpenAPI spec
- `src/helper/cache.helper.js` — LRU cache with per-endpoint TTL (3min-60min) - `src/helper/cache.helper.js` — LRU cache with per-endpoint TTL (3min-60min)
- `src/helper/mirror.helper.js` — Multi-mirror fallback with health checks, session caching - `src/helper/mirror.helper.js` — Multi-mirror fallback with health checks, session caching
- `src/helper/extractPages.helper.js` — Page fetching using `fetchWithMirror()` - `src/helper/extractPages.helper.js` — Page fetching using `fetchWithMirror()`
- `src/extractors/` — 22 HTML scrapers using Cheerio selectors - `src/helper/parseListItem.helper.js` — Shared list item parser (DRY across extractors)
- `src/controllers/` — 22 route handlers - `src/extractors/` — 26 HTML scrapers using Cheerio selectors
- `src/controllers/` — 26 route handlers
- `src/configs/ids.config.js` — Genre/Type/Status/Rating/Sort/Source/Season ID mappings
### Endpoints (33 total) ### Endpoints (36 total)
**Core**: `/` (home), `/search`, `/info`, `/watch`, `/episodes/:id`, `/episodes-ajax/:id` **Core**: `/` (home), `/search`, `/info`, `/watch`, `/episodes/:id`, `/episodes-ajax/:id`
**Streaming**: `/servers`, `/stream`, `/download`, `/mapper-servers` **Streaming**: `/servers`, `/stream`, `/download`, `/mapper-servers`
**Discovery**: `/spotlight`, `/trending`, `/top-ten`, `/random`, `/suggestions`, `/most-popular` **Discovery**: `/spotlight`, `/trending`, `/top-ten`, `/random`, `/suggestions`, `/most-popular`
**New**: `/upcoming`, `/top-rankings`, `/recently-updated`, `/completed`
**Lists**: `/new-release`, `/newly-added`, `/latest-updated`, `/trending-sidebar`, `/az-list/:letter` **Lists**: `/new-release`, `/newly-added`, `/latest-updated`, `/trending-sidebar`, `/az-list/:letter`
**Filter**: `/filter`, `/genre/:name`, `/type/:name`, `/status/:name` **Filter**: `/filter`, `/genre/:name`, `/type/:name`, `/status/:name`
**Anime**: `/seasons/:id`, `/watch-order/:id`, `/schedule` **Anime**: `/seasons/:id`, `/watch-order/:id`, `/schedule`
+1 -1
View File
@@ -11,7 +11,7 @@ You are **DevOps Automator** for AniKotoAPI, responsible for Vercel deployment,
## Your Identity ## Your Identity
- **Project**: AniKotoAPI v2.0.0 — https://github.com/Shineii86/AniKotoAPI - **Project**: AniKotoAPI v2.2.0 — https://github.com/Shineii86/AniKotoAPI
- **Deployment**: Vercel (auto-deploys from main branch) - **Deployment**: Vercel (auto-deploys from main branch)
- **Git remote**: `https://github.com/Shineii86/AniKotoAPI.git` - **Git remote**: `https://github.com/Shineii86/AniKotoAPI.git`
- **Git identity**: `Shinei Nouzen <157171073+Shineii86@users.noreply.github.com>` - **Git identity**: `Shinei Nouzen <157171073+Shineii86@users.noreply.github.com>`
+2 -2
View File
@@ -11,7 +11,7 @@ You are **Performance Benchmarker** for AniKotoAPI, responsible for measuring an
## Your Identity ## Your Identity
- **Project**: AniKotoAPI v2.0.0 — https://github.com/Shineii86/AniKotoAPI - **Project**: AniKotoAPI v2.2.0 — https://github.com/Shineii86/AniKotoAPI
- **Live API**: `https://anikototvapi.vercel.app/api` - **Live API**: `https://anikototvapi.vercel.app/api`
- **Deployment**: Vercel serverless (cold starts, memory limits, execution time limits) - **Deployment**: Vercel serverless (cold starts, memory limits, execution time limits)
@@ -133,7 +133,7 @@ compression({
## What You Do ## What You Do
1. **Benchmark endpoints** — Measure response times for all 33 endpoints 1. **Benchmark endpoints** — Measure response times for all 36 endpoints
2. **Profile cache** — Track hit/miss ratios, measure TTL effectiveness 2. **Profile cache** — Track hit/miss ratios, measure TTL effectiveness
3. **Test compression** — Compare compressed vs uncompressed sizes 3. **Test compression** — Compare compressed vs uncompressed sizes
4. **Load test** — Simulate concurrent users, check rate limiting 4. **Load test** — Simulate concurrent users, check rate limiting
+1 -1
View File
@@ -11,7 +11,7 @@ You are **Security Architect** for AniKotoAPI, responsible for securing a public
## Your Identity ## Your Identity
- **Project**: AniKotoAPI v2.0.0 — https://github.com/Shineii86/AniKotoAPI - **Project**: AniKotoAPI v2.2.0 — https://github.com/Shineii86/AniKotoAPI
- **Risk profile**: Public API, no auth, scrapes external site, deployed on Vercel - **Risk profile**: Public API, no auth, scrapes external site, deployed on Vercel
- **Attack surface**: SSRF via mapper API, XSS in error messages, rate limit bypass, header injection - **Attack surface**: SSRF via mapper API, XSS in error messages, rate limit bypass, header injection
+5 -5
View File
@@ -11,7 +11,7 @@ You are **Technical Writer** for AniKotoAPI, responsible for maintaining all doc
## Your Identity ## Your Identity
- **Project**: AniKotoAPI v2.0.0 — https://github.com/Shineii86/AniKotoAPI - **Project**: AniKotoAPI v2.2.0 — https://github.com/Shineii86/AniKotoAPI
- **Author format**: `Shinei Nouzen <157171073+Shineii86@users.noreply.github.com>` - **Author format**: `Shinei Nouzen <157171073+Shineii86@users.noreply.github.com>`
- **Changelog rule**: Append at top, never delete/edit old entries - **Changelog rule**: Append at top, never delete/edit old entries
@@ -24,7 +24,7 @@ AniKotoAPI/
├── CONTRIBUTING.md # Contribution guidelines ├── CONTRIBUTING.md # Contribution guidelines
├── docs/ ├── docs/
│ ├── index.md # Overview, quick start │ ├── index.md # Overview, quick start
│ ├── endpoints.md # Full API reference (33 endpoints) │ ├── endpoints.md # Full API reference (36 endpoints)
│ ├── streaming.md # 3-step streaming flow guide │ ├── streaming.md # 3-step streaming flow guide
│ ├── examples.md # cURL, JS, Python examples │ ├── examples.md # cURL, JS, Python examples
│ └── architecture.md # Project structure, tech stack │ └── architecture.md # Project structure, tech stack
@@ -69,7 +69,7 @@ AniKotoAPI/
## Project Structure (tree) ## Project Structure (tree)
## API Endpoints ## API Endpoints
## Streaming Flow ## Streaming Flow
## Endpoint Documentation (33 sections) ## Endpoint Documentation (36 sections)
## API Response Schema ## API Response Schema
## Configuration (.env) ## Configuration (.env)
## Deployment ## Deployment
@@ -106,7 +106,7 @@ curl "https://anikototvapi.vercel.app/api/endpoint"
### Version Bumping ### Version Bumping
1. Update `package.json` version 1. Update `package.json` version
2. Update README.md badge: `Version-2.0.0` 2. Update README.md badge: `Version-2.2.0`
3. Update OpenAPI spec version in `apiRoutes.js` 3. Update OpenAPI spec version in `apiRoutes.js`
4. Add CHANGELOG.md entry (prepend, never delete) 4. Add CHANGELOG.md entry (prepend, never delete)
@@ -140,7 +140,7 @@ flowchart TD
1. **Update CHANGELOG** — Add entries for every version bump 1. **Update CHANGELOG** — Add entries for every version bump
2. **Maintain README** — Keep endpoint list, badges, examples current 2. **Maintain README** — Keep endpoint list, badges, examples current
3. **Document endpoints** — Full docs for each of 33 endpoints 3. **Document endpoints** — Full docs for each of 36 endpoints
4. **Write examples** — cURL, JS, Python for common use cases 4. **Write examples** — cURL, JS, Python for common use cases
5. **Update OpenAPI** — Keep spec in sync with actual routes 5. **Update OpenAPI** — Keep spec in sync with actual routes
6. **Review docs/ folder** — Keep all 5 markdown files current 6. **Review docs/ folder** — Keep all 5 markdown files current
+25 -13
View File
@@ -19,10 +19,10 @@ const tests = [
// Core endpoints // Core endpoints
{ name: "Home", url: "/", check: (d) => d.results?.spotlights || d.results?.trending }, { name: "Home", url: "/", check: (d) => d.results?.spotlights || d.results?.trending },
{ name: "Search", url: "/search?keyword=naruto", check: (d) => d.results?.data }, { name: "Search", url: "/search?keyword=naruto", check: (d) => d.results?.data },
{ name: "Info", url: "/info?id=road-of-naruto-ggjw8", check: (d) => d.results?.title }, { name: "Info", url: "/info?id=one-piece-odmau", check: (d) => d.results?.title },
{ name: "Episodes", url: "/episodes/road-of-naruto-ggjw8", check: (d) => d.results?.episodes }, { name: "Episodes", url: "/episodes/one-piece-odmau", check: (d) => d.results?.episodes },
{ name: "Servers", url: "/servers?ids=1", check: (d) => d.results }, { name: "Servers", url: "/servers?ids=1", check: (d) => d.results },
{ name: "Watch", url: "/watch?slug=road-of-naruto-ggjw8&ep=1", check: (d) => d.results?.servers || d.results?.episodeNumber }, { name: "Watch", url: "/watch?slug=one-piece-odmau&ep=1", check: (d) => d.results?.servers || d.results?.episodeNumber },
// Discovery endpoints // Discovery endpoints
{ name: "Suggestions", url: "/suggestions?keyword=naruto", check: (d) => d.results }, { name: "Suggestions", url: "/suggestions?keyword=naruto", check: (d) => d.results },
@@ -31,27 +31,39 @@ const tests = [
{ name: "Top 10", url: "/top-ten", check: (d) => d.results }, { name: "Top 10", url: "/top-ten", check: (d) => d.results },
{ name: "Random", url: "/random", check: (d) => d.results }, { name: "Random", url: "/random", check: (d) => d.results },
{ name: "Most Popular", url: "/most-popular", check: (d) => d.results }, { name: "Most Popular", url: "/most-popular", check: (d) => d.results },
{ name: "Upcoming", url: "/upcoming", check: (d) => Array.isArray(d.results) },
{ name: "Top Rankings", url: "/top-rankings", check: (d) => Array.isArray(d.results) },
{ name: "Recently Updated", url: "/recently-updated", check: (d) => Array.isArray(d.results) },
{ name: "Completed", url: "/completed", check: (d) => Array.isArray(d.results) },
// Release lists
{ name: "New Release", url: "/new-release", check: (d) => d.results }, { name: "New Release", url: "/new-release", check: (d) => d.results },
{ name: "Newly Added", url: "/newly-added", check: (d) => d.results }, { name: "Newly Added", url: "/newly-added", check: (d) => d.results },
{ name: "Latest Updated", url: "/latest-updated", check: (d) => d.results, optional: true }, { name: "Latest Updated", url: "/latest-updated", check: (d) => d.results },
// Category endpoints // Category endpoints
{ name: "Genre", url: "/genre/action", check: (d) => d.results }, { name: "Genre", url: "/genre/action", check: (d) => d.results },
{ name: "Type", url: "/type/tv", check: (d) => d.results }, { name: "Type", url: "/type/tv", check: (d) => d.results },
{ name: "Status", url: "/status/airing", check: (d) => d.results },
{ name: "AZ List", url: "/az-list/a", check: (d) => d.results }, { name: "AZ List", url: "/az-list/a", check: (d) => d.results },
{ name: "Filter", url: "/filter?keyword=&genre[]=1", check: (d) => d.results }, { name: "Filter", url: "/filter?keyword=naruto", check: (d) => d.results },
// Utility endpoints
{ name: "Health", url: "/health", check: (d) => d.status || d.results?.status },
{ name: "Stats", url: "/stats", check: (d) => d.results },
// Search variants // Search variants
{ name: "Search Suggest", url: "/search/suggest?keyword=naruto", check: (d) => d.results }, { name: "Search Suggest", url: "/search/suggest?keyword=naruto", check: (d) => d.results },
{ name: "Episodes Ajax", url: "/episodes-ajax/7174", check: (d) => d.results }, { name: "Episodes Ajax", url: "/episodes-ajax/one-piece-odmau", check: (d) => d.results },
{ name: "Trending Sidebar", url: "/trending-sidebar", check: (d) => d.results }, { name: "Trending Sidebar", url: "/trending-sidebar", check: (d) => d.results },
{ name: "Mapper Servers", url: "/mapper-servers?malId=21&slug=one-piece-100&timestamp=1234567890", check: (d) => d.results },
{ name: "Seasons", url: "/seasons/7174", check: (d) => d.results?.seasons || d.results?.totalSeasons, optional: true }, // Anime detail
{ name: "Watch Order", url: "/watch-order/7174", check: (d) => d.results?.related || d.results?.totalRelated, optional: true }, { name: "Seasons", url: "/seasons/one-piece-odmau", check: (d) => d.results?.seasons || d.results?.totalSeasons, optional: true },
{ name: "Watch Order", url: "/watch-order/one-piece-odmau", check: (d) => d.results?.related || d.results?.totalRelated, optional: true },
{ name: "Download", url: "/download?slug=one-piece-odmau&ep=1", check: (d) => d.results, optional: true },
// Utility endpoints
{ name: "Health", url: "/health", check: (d) => d.results?.status === "healthy" },
{ name: "Stats", url: "/stats", check: (d) => d.results?.endpoints },
{ name: "Cache Stats", url: "/cache/stats", check: (d) => d.results?.hits !== undefined },
{ name: "Mirrors", url: "/mirrors", check: (d) => Array.isArray(d.results) },
{ name: "OpenAPI", url: "/openapi", check: (d) => d.openapi === "3.0.3" },
]; ];
let passed = 0; let passed = 0;