Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .aiignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules
coverage
coverage.lcov

package-lock.json
pnpm-lock.yaml
bun.lock

.env

dist
storage

# AI Session Files (Private Context)
.sessions
12 changes: 5 additions & 7 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,25 @@ jobs:

strategy:
matrix:
node_version: [20.x, 22.x, 24.x]
node_version: [22.x, 24.x, 25.x]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: setup Node.js v${{ matrix.node_version }}
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node_version }}

- name: run npm scripts
env:
PROXY_SERVER: ${{ secrets.PROXY_SERVER }}
run: |
npm install
npm run lint
npm run build --if-present
#npm run build --if-present
npm run test

- name: cache node modules
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ yarn.lock
coverage.lcov
pnpm-lock.yaml
lcov.info

bun.lock
deno.lock

evaluation

.sessions
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ pnpm-lock.yaml
examples
test-data
lcov.info

.aiignore
.sessions
113 changes: 113 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# AI Agent Instructions

Coding guidelines for AI agents working in this project.

## Philosophy

- Minimalism. Simple is better. KISS (Keep It Simple, Stupid).
- Clean code, easy to read, easy to delete.
- Functional Programming — pure functions, immutability, no side effects.
- MVP mindset — deliver the smallest thing that works, then iterate.

## Security Rules (CRITICAL — no exceptions)

- NEVER output or request .env and example.env file contents
- NEVER hardcode API credentials, secret tokens, private keys or passwords in source code
- NEVER send sensitive data to external AI services
- Follow `.aiignore` and `.gitignore` for excluded files — do not read or reference them
- When asking for help, sanitize data (replace real IDs, emails, tokens with placeholders)
- Do not log sensitive information

## Coding Standards (Strict)
- Language: JavaScript (ESM syntax). No TypeScript.
- Style: No semicolons, single quotes, 2-space indentation.
- Respect `eslint.config.js` — do not suggest rule changes
- Patterns:
- Functional Programming only. No Classes or OOP.
- Arrow functions are preferred.
- Maximum 3 parameters per function. Use objects for more.
- Naming: camelCase for variables/functions, SNAKE_CASE for constants.
- Documentation:
- Add JSDocs before all functions and exported variables.
- Language: Use American English for all comments and JSDocs.
- Constraint: NEVER use Vietnamese or other languages in the source code.

### Error Handling

- Handle errors explicitly — never swallow silently
- Use try/catch with proper logging
- Return null or throw meaningful errors

```javascript
export const send = async (params) => {
try {
const response = await ai.ask(params)
logger.info(`send() -> success: ${response.id}`)
return response
} catch (err) {
logger.error(`send() -> failed: ${err.message}`)
console.error(err)
return null
}
}
```

## Testing Standards

- Write tests for critical business logic, all error cases
- Use simple test runners (node:test, bun:test, vitest)
- No complex mocking frameworks unless necessary
- Tests live alongside source: `[module].test.js` next to `[module].js`

## Dependency Rules

- Prefer built-in APIs over external packages
- Before adding dependency, explain:
- Why it is needed
- Alternatives considered
- Bundle size impact
- Never add dependency for trivial utilities
- Avoid packages with large dependency trees

## Architecture Rules

- Do NOT change existing project architecture without explicit approval
- Do NOT move or rename core modules unless requested
- Respect module boundaries
- Avoid cross-module coupling
- New modules must follow existing folder structure

## When Making Changes

1. Read existing patterns first
2. Follow current coding style strictly
3. Keep dependencies minimal
4. Handle errors explicitly
5. Add JSDoc comments for new functions
6. Run `npm run lint` before committing
7. Do NOT refactor unrelated code
8. Do NOT modify working code outside task scope
9. Prefer minimal diff changes
10. Preserve existing behavior unless explicitly requested

## When in Doubt

- Ask for clarification before generating code
- State your assumption explicitly if proceeding without confirmation
- Prefer doing less and asking over doing more and guessing

## Git Workflow

- Work only inside the current branch
- Do NOT create or delete branches
- Do NOT rewrite git history
- Do NOT modify commit messages
- Changes must correspond to the current issue

## Agent References

Reference these URLs when working on related topics:

- Bun: https://bun.sh/llms-full.txt

---
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,22 @@ Extract main article, main image and meta data from URL.

## Demo

- [Give it a try!](https://extractus-demo.vercel.app/article)
- [Give it a try!](https://extractus.pwshub.com/article)

## Install

```bash
# npm, pnpm, yarn
npm i @extractus/article-extractor

# bun
bun add @extractus/article-extractor

# npm
npm i @extractus/article-extractor

# pnpm
pnpm install @extractus/article-extractor

# yarn
yarn add @extractus/article-extractor
```

## Usage
Expand Down
Loading
Loading