Skip to content

hyp chkcomment_en.md

maoxiaoyue edited this page May 14, 2026 · 1 revision

hyp chkcomment — Comment Completeness Check

Scan Go source files and check whether all exported blocks have standardized documentation comments.

Usage

hyp chkcomment <file.go>             # Check and report
hyp chkcomment --fix <file.go>       # Auto-add suggested comments

Flags

Flag Description
--fix Auto-add suggested comments (creates .bak backup)

Checked Blocks

Type Example
Package package controllers
Type type UserController struct
Func func CreateUser(...)
Method func (ctrl *UserController) Create(...)
Const const MaxItems = 100
Var var ErrNotFound = ...

--fix Output

When --fix is used, comments include @ai: annotations:

  • All blocks: @ai:owner ai-generated
  • Create/Update/Delete functions: @ai:impact routes=/api/
  • Auth/Login/Token functions: @ai:security requires_auth

Annotation Protocol

The checker recognizes @ai: annotations:

// @ai:constraint max_items=100
// @ai:deprecated use V2 instead
// @ai:security requires_auth
// @ai:impact routes=/api/users
// @ai:owner team=backend

Safety

  • Pure AST analysis, never executes code
  • Only accepts .go files, rejects symlinks
  • --fix creates .bak backup before modifying

Related Commands

  • hyp impact — Analyze change impact before modifying

HypGo

繁體中文 | English


中文文件

設計文件

套件

AI 協作工具鏈

CLI 命令


English Docs

Design Docs

Packages

AI Collaboration Toolchain

CLI Commands

Clone this wiki locally