CUPS Web is a browser-based print management service that lets users upload documents, choose a printer, and submit print jobs through a CUPS server. Families and small offices use it to share a USB printer over a network, manage users, and track printing history. The catalogue contains instructions for operating the service.
Borrowing it
Nothing to install: this file belongs to hanxi/cups-web. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/hanxi/cups-web/master/AGENTS.mdgit clone --depth 1 https://github.com/hanxi/cups-webWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/hanxi/cups-web/agents-md)<a href="https://agentmods.dev/instructions/hanxi/cups-web/agents-md"><img src="https://agentmods.dev/badge/instructions/hanxi/cups-web/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/hanxi/cups-web/agents-md"><img src="https://agentmods.dev/badge/instructions/hanxi/cups-web/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.14873 | $0.14873 |
| Opus 5.5 | $0.05949 | $0.05949 |
| Sonnet 5.5 | $0.02975 | $0.02975 |
| Haiku 4.5 | $0.01487 | $0.01487 |
Grade C, and why
cups-web AGENTS.md scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
> ⚠️ 编译型脚本**只允许一个 `trap _cleanup EXIT`**(bash 同信号只保留最后注册的 handler)。AIO 模式下只 `apt-get clean`,**绝不 `rm -rf /var/lib/apt/lists/*`**。详见 [docs/driver-management.md](docs/driver-management.md#-aio-编译脚本的单一-exit-trap约定)。 Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
> 🚨 `cups-builder` 的 `ca-certificates` 请勿删除(wget TLS 校验,删了 CI 直接崩)。 How it starts
The opening of the file, as written. The whole thing — 615 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CUPS Web 开发者指南
本文档面向开发者,介绍项目架构、API、开发流程与扩展方式。用户文档请参阅 README.md。
📚 深度文档:原理说明、故障案例与历史决策已移至 docs/,本文件只保留可快速扫读的规则与契约。
📦 项目概述
- 项目定位:基于 CUPS 的 Web 打印管理工具,前后端分离
- 技术栈:Go 1.26(后端)+ Vue 3(前端)+ SQLite(存储)+ IPP(打印协议)
- 部署形态:单二进制(前端
go:embed)连接外部 CUPS;单容器(AIO)Docker 镜像(cupsd+cups-web同容器,内置 LibreOffice + Java 21 + OFD 转换器 + Ghostscript + 打印驱动生态) - 仅 Web 镜像:同一
Dockerfile的web-runtime目标,保留文档转换依赖,通过CUPS_HOST或CUPS_SOCKET_PATH连接外部 CUPS;标签带-web后缀,使用docker-compose.web.yml,不运行 cupsd 或安装驱动/扫描工具。
⚠️ 历史形态提示:仓库曾经是「cups 镜像 + cups-web 镜像」双容器(
cups/目录),已在合并提交里删除。现在只有根目录的一份Dockerfile/entrypoint.sh,构建脚本在scripts/build/、驱动脚本在scripts/driver/。
🛠️ 技术栈
后端
| 组件 | 说明 |
|---|---|
| Go 1.26 | 见 go.mod |
gorilla/mux |
HTTP 路由 |
gorilla/securecookie |
会话管理 |
modernc.org/sqlite |
纯 Go SQLite,无 CGO |
OpenPrinting/goipp |
IPP 协议 |
rsc.io/pdf + phpdave11/gofpdf |
PDF 解析 / 生成 |
golang.org/x/image/draw |
大图下采样(CatmullRom) |
golang.org/x/crypto/bcrypt |
密码哈希 |
前端
| 组件 | 说明 |
|---|---|
| Vue 3.5 + Vue Router | hash 模式 |
| Vite 7 | 构建 |
@nuxt/ui v4 + Tailwind CSS v4 |
UI / 样式 |
pdfjs-dist |
预览(PDF 生成由后端 /api/convert 负责) |
| Bun(本地)/ npm(CI + Docker) | 包管理。npm 用于覆盖 linux/arm/v7(Bun 不支持 32-bit ARM) |
外部依赖
CUPS(IPP 通信)、LibreOffice(Office → PDF)、Java 21 + ofd-converter.jar(OFD → PDF)、Ghostscript(PDF 标准化)、dpkg/apt-get(运行时驱动安装)。
各依赖的坑位说明(LibreOffice 可写 HOME、gs 字体破坏性改造、runtime 无
dpkg-dev)见 docs/architecture.md。
📁 项目结构
cups-web/
├── cmd/server/ # 后端主程序
│ ├── main.go # 入口与路由注册
│ ├── app.go # 全局变量
│ ├── bootstrap.go # 默认 admin 初始化
│ ├── auth_handlers.go # 登录 / 登出 / session / csrf
│ ├── login_limiter.go # 登录失败限流
│ ├── admin_handlers.go # 管理员:用户 / 设置 / 清理
│ ├── user_handlers.go # /api/me
│ ├── print_handlers.go # /api/print(主打印入口)
│ ├── print_records_handlers.go # 打印记录查询 / 下载 / 重打
│ ├── printer_info_handler.go # 打印机属性查询
│ ├── convert_handler.go # /api/convert
│ ├── convert_utils.go # LibreOffice / OFD 转换工具
│ ├── compose_handler.go # /api/compose(多页拼版)
│ ├── estimate_handler.go # /api/estimate(预估页数)
│ ├── preview_handler.go # /api/preview-page(预览兜底:PDF 单页 → PNG)
│ ├── driver_handlers.go # /api/admin/drivers/* + 后台任务
│ ├── driver_registry.go # 驱动注册表
│ ├── file_utils.go # 文件保存 / 类型识别 / 页数
│ ├── pdf_utils.go # 图片 / 文本 → PDF
│ ├── pdf_compose.go # 多页拼版
│ ├── pdf_reorder.go # 页序重排 + 测试
│ ├── watermark.go # 水印
│ ├── pdf_normalize.go # PDF 标准化管线
│ ├── fonts.go # 中文字体加载
│ ├── maintenance.go # 后台维护任务
│ └── version.go # 构建期版本号
├── internal/
│ ├── auth/session.go # securecookie 会话 + CSRF
│ ├── middleware/ # csrf / security 中间件
│ ├── ipp/ # IPP 客户端 + URI 校验
│ ├── server/static.go # 静态资源嵌入(SPA fallback)
│ └── store/ # 数据层(users / prints / settings)
├── frontend/ # Vue 3 前端(go:embed dist)
├── ofd-converter/ # Java OFD → PDF
├── scripts/
│ ├── build/install-cups.sh # 源码编译 CUPS
│ └── driver/ # 驱动管理命令 + 安装脚本 + capture-debs.sh(apt 钩子)
├── docker-fonts/ # 构建期字体与 gs/fontconfig 配置
├── entrypoint.sh # AIO 容器启动脚本
├── Dockerfile # 共享转换依赖 + AIO / 仅 Web 两个目标
├── docker-compose.yml # 单服务 AIO
├── docker-compose.web.yml # 仅 Web,连接外部 CUPS
└── Makefile # 构建脚本
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 8d ago Changed · +7 lines · +266 tokens per session ced7b601f819
- 16d ago Changed · +19 lines · +504 tokens per session 5d201f61e102
- 19d ago Changed · +7 lines · +299 tokens per session d82c866b7b09
- 20d ago Changed · +6 lines · +213 tokens per session 785ed1db7e7f
- 22d ago Changed · +1 lines · +88 tokens per session 429fd846da93
- 23d ago Changed · +30 lines · +1,297 tokens per session aa6284a883bd
- 25d ago Changed · +3 lines · +187 tokens per session 8d5b1fd325c8
- 1mo ago Changed · +1 lines · +221 tokens per session ff58bee91547
- 1mo ago Changed · +5 lines · +273 tokens per session 0c1f92230dcf
- 1mo ago First seen · 536 lines · 11,525 tokens per session scan C 1a3883acb399
cups-web AGENTS.md is an instructions file published in the GitHub repository hanxi/cups-web (1,509 stars, last pushed 4d ago), licensed MIT. It adds 14,873 tokens to every session, about $0.0595 per session on Opus 5.5. A static security scan graded it C with 2 findings (recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
cups-web AGENTS.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| cups-web AGENTS.mdhanxi/cups-web | Instructions file | 1.5k | 4d ago | MIT | C | 14,873 | Codex, OpenCode |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | today | MIT | A | 7,461 | Codex, OpenCode |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | yesterday | MIT | A | 4,680 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 5,516 | GitHub Copilot |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 3,093 | GitHub Copilot |
| deepseek-harness AGENTS.mddeepseek-ai/deepseek-harness | Instructions file | 274k | 2d ago | MIT | A | 4,313 | Codex, OpenCode |