Skip to content

Commit 9e48dcf

Browse files
author
Dong Nguyen
committed
v4.1.0
- Update packages - Update provider list - Fix type definitions - Fix some minor issues - Add AI Agents Guides
1 parent d31badf commit 9e48dcf

19 files changed

Lines changed: 1349 additions & 222 deletions

.aiignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
node_modules
2+
coverage
3+
coverage.lcov
4+
5+
package-lock.json
6+
pnpm-lock.yaml
7+
bun.lock
8+
9+
.env
10+
11+
dist
12+
storage
13+
14+
# AI Session Files (Private Context)
15+
.sessions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ yarn.lock
1616
pnpm-lock.yaml
1717
package-lock.json
1818
deno.lock
19+
bun.lock

AGENTS.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# AI Agent Instructions
2+
3+
Coding guidelines for AI agents working in this project.
4+
5+
## Philosophy
6+
7+
- Minimalism. Simple is better. KISS (Keep It Simple, Stupid).
8+
- Clean code, easy to read, easy to delete.
9+
- Functional Programming — pure functions, immutability, no side effects.
10+
- MVP mindset — deliver the smallest thing that works, then iterate.
11+
12+
## Security Rules (CRITICAL — no exceptions)
13+
14+
- NEVER output or request .env and example.env file contents
15+
- NEVER hardcode API credentials, secret tokens, private keys or passwords in source code
16+
- NEVER send sensitive data to external AI services
17+
- Follow `.aiignore` and `.gitignore` for excluded files — do not read or reference them
18+
- When asking for help, sanitize data (replace real IDs, emails, tokens with placeholders)
19+
- Do not log sensitive information
20+
21+
## Coding Standards (Strict)
22+
- Language: JavaScript (ESM syntax). No TypeScript.
23+
- Style: No semicolons, single quotes, 2-space indentation.
24+
- Respect `eslint.config.js` — do not suggest rule changes
25+
- Patterns:
26+
- Functional Programming only. No Classes or OOP.
27+
- Arrow functions are preferred.
28+
- Maximum 3 parameters per function. Use objects for more.
29+
- Naming: camelCase for variables/functions, SNAKE_CASE for constants.
30+
- Documentation:
31+
- Add JSDocs before all functions and exported variables.
32+
- Language: Use American English for all comments and JSDocs.
33+
- Constraint: NEVER use Vietnamese or other languages in the source code.
34+
35+
### Error Handling
36+
37+
- Handle errors explicitly — never swallow silently
38+
- Use try/catch with proper logging
39+
- Return null or throw meaningful errors
40+
41+
```javascript
42+
export const send = async (params) => {
43+
try {
44+
const response = await ai.ask(params)
45+
logger.info(`send() -> success: ${response.id}`)
46+
return response
47+
} catch (err) {
48+
logger.error(`send() -> failed: ${err.message}`)
49+
console.error(err)
50+
return null
51+
}
52+
}
53+
```
54+
55+
## Testing Standards
56+
57+
- Write tests for critical business logic, all error cases
58+
- Use simple test runners (node:test, bun:test, vitest)
59+
- No complex mocking frameworks unless necessary
60+
- Tests live alongside source: `[module].test.js` next to `[module].js`
61+
62+
## Dependency Rules
63+
64+
- Prefer built-in APIs over external packages
65+
- Before adding dependency, explain:
66+
- Why it is needed
67+
- Alternatives considered
68+
- Bundle size impact
69+
- Never add dependency for trivial utilities
70+
- Avoid packages with large dependency trees
71+
72+
## Architecture Rules
73+
74+
- Do NOT change existing project architecture without explicit approval
75+
- Do NOT move or rename core modules unless requested
76+
- Respect module boundaries
77+
- Avoid cross-module coupling
78+
- New modules must follow existing folder structure
79+
80+
## When Making Changes
81+
82+
1. Read existing patterns first
83+
2. Follow current coding style strictly
84+
3. Keep dependencies minimal
85+
4. Handle errors explicitly
86+
5. Add JSDoc comments for new functions
87+
6. Run `npm run lint` before committing
88+
7. Do NOT refactor unrelated code
89+
8. Do NOT modify working code outside task scope
90+
9. Prefer minimal diff changes
91+
10. Preserve existing behavior unless explicitly requested
92+
93+
## When in Doubt
94+
95+
- Ask for clarification before generating code
96+
- State your assumption explicitly if proceeding without confirmation
97+
- Prefer doing less and asking over doing more and guessing
98+
99+
## Git Workflow
100+
101+
- Work only inside the current branch
102+
- Do NOT create or delete branches
103+
- Do NOT rewrite git history
104+
- Do NOT modify commit messages
105+
- Changes must correspond to the current issue
106+
107+
## Agent References
108+
109+
Reference these URLs when working on related topics:
110+
111+
- Bun: https://bun.sh/llms-full.txt
112+
- oEmbed: https://oembed.com
113+
114+
---

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,21 @@ Extract oEmbed content from given URL.
99

1010
## Demo
1111

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

1414
## Install & Usage
1515

16-
### Node.js
16+
### Bun & Node.js
1717

1818
```bash
19+
# bun
20+
bun add @extractus/oembed-extractor
21+
22+
# npm
1923
npm i @extractus/oembed-extractor
2024

2125
# pnpm
22-
pnpm i @extractus/oembed-extractor
26+
pnpm install @extractus/oembed-extractor
2327

2428
# yarn
2529
yarn add @extractus/oembed-extractor
@@ -38,12 +42,6 @@ console.log(result)
3842
import { extract } from 'npm:@extractus/oembed-extractor'
3943
```
4044

41-
### Browser
42-
43-
```ts
44-
import { extract } from "https://esm.sh/@extractus/oembed-extractor@latest"
45-
```
46-
4745
## APIs
4846

4947
### `.extract()`

eval.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
import { extract } from './src/main.js'
55

6+
/**
7+
* Extract and log oEmbed data from a URL.
8+
*
9+
* @param {string} url - URL to extract oEmbed from
10+
*/
611
const run = async (url) => {
712
try {
813
console.time('extract-oembed')
@@ -14,6 +19,12 @@ const run = async (url) => {
1419
}
1520
}
1621

22+
/**
23+
* Parse CLI arguments and run extraction.
24+
*
25+
* @param {Array} argv - Process argument array
26+
* @returns {Promise|string} Extraction promise or info message
27+
*/
1728
const init = (argv) => {
1829
if (argv.length === 3) {
1930
const url = argv[2]

0 commit comments

Comments
 (0)