cups-web: Instructions file for Codex

AGENTS.md

cups-web AGENTS.md is an instructions file for Codex, OpenCode from hanxi/cups-web. It costs 14,873 tokens per session, scanned C, original, MIT.

A developer guide for CUPS Web, a web application that manages printing through CUPS, the common Unix printing system. It documents the Go backend, Vue frontend, APIs, deployment options, and supporting tools.

In plain words
What is it for?
Use it when changing the web interface, print management backend, PDF or document conversion, Docker setup, printer drivers, or CUPS and IPP integration.
Why use it?
It gives agents the project's architecture and development rules in one place, while directing deeper explanations and historical decisions to the documentation folder.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md.

This is hanxi/cups-web's own configuration. It tells Codex and OpenCode how to work on cups-web itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything cups-web configures →

About the project

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.

hanxi/cups-web · 1,509 stars · on GitHub

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/hanxi/cups-web/master/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/hanxi/cups-web

Made for: Codex, OpenCode.

Wrote 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.

agentmods badge for cups-web AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/hanxi/cups-web/agents-md/github.svg)](https://agentmods.dev/instructions/hanxi/cups-web/agents-md)
Your own site
<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.

agentmods 80×15 button for cups-web AGENTS.md

Your own site · 80×15
<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>
Per session 14,873 This file is loaded in full into every session.
When invoked 14,873 The same file — it is already loaded in full.
Security scan C 2 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 8d ago against content hash ced7b601f819, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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 直接崩)。
AGENTS.md · 615 lines

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                       # 构建脚本

Read the full file on GitHub · 615 lines

Changes

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.

  1. 8d ago Changed · +7 lines · +266 tokens per session ced7b601f819
  2. 16d ago Changed · +19 lines · +504 tokens per session 5d201f61e102
  3. 19d ago Changed · +7 lines · +299 tokens per session d82c866b7b09
  4. 20d ago Changed · +6 lines · +213 tokens per session 785ed1db7e7f
  5. 22d ago Changed · +1 lines · +88 tokens per session 429fd846da93
  6. 23d ago Changed · +30 lines · +1,297 tokens per session aa6284a883bd
  7. 25d ago Changed · +3 lines · +187 tokens per session 8d5b1fd325c8
  8. 1mo ago Changed · +1 lines · +221 tokens per session ff58bee91547
  9. 1mo ago Changed · +5 lines · +273 tokens per session 0c1f92230dcf
  10. 1mo ago First seen · 536 lines · 11,525 tokens per session scan C 1a3883acb399

Subscribe to this mod's changes

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.

Related

cups-web AGENTS.md compared with instructions from other repositories

cups-web AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
cups-web AGENTS.mdhanxi/cups-webInstructions file1.5k4d agoMITC14,873Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode