lolly/docs/lua/AGENTS.md
xfy 4f6a7be44c docs: 更新 AGENTS.md 项目文档
- 更新各目录 AGENTS.md 的子目录信息
- 添加新增目录的 AGENTS.md 文件
- 更新 docs/prompts.md 添加新的提示词

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 13:15:39 +08:00

48 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- Parent: ../AGENTS.md -->
<!-- Generated: 2026-04-13 | Updated: 2026-04-13 -->
# lua
## Purpose
Lua 功能文档目录,包含 API 参考、使用指南和最佳实践示例。
## Key Files
| File | Description |
|------|-------------|
| `API.md` | Lua Engine API 参考(定时器限制、安全/不安全 API 区分) |
## Subdirectories
| Directory | Purpose |
|-----------|---------|
| `api-gateway/` | API 网关使用示例 |
| `authentication/` | 认证功能示例 |
| `caching/` | 缓存使用示例 |
| `dynamic-routing/` | 动态路由示例 |
| `logging-monitoring/` | 日志和监控示例 |
| `middleware/` | 中间件使用示例 |
| `rate-limiting/` | 限流功能示例 |
| `websocket/` | WebSocket 功能示例 |
## For AI Agents
### Working In This Directory
- `API.md` 是关键参考,说明定时器回调限制和 API 可用性
- 定时器回调不能捕获闭包变量,必须使用 `ngx.shared.DICT` 传递数据
- Request-scoped APIngx.req、ngx.resp、ngx.var、ngx.ctx在定时器回调中不可用
### Testing Requirements
- Lua 功能通过 `../../internal/lua` 测试验证
### Common Patterns
- 安全 APItimer 可用):`ngx.shared.DICT.*`, `ngx.log`, `ngx.timer.*`
- 不安全 API仅请求协程`ngx.req.*`, `ngx.resp.*`, `ngx.var.*`, `ngx.ctx.*`
## Dependencies
### Internal
- `../../internal/lua` - Lua 引擎实现
- `../../examples/lua-scripts` - 脚本示例
<!-- MANUAL: -->