From 05510bde5b55a42fac145a9aa4a85e61910de0c6 Mon Sep 17 00:00:00 2001 From: Gautam Kumar Date: Thu, 18 Jun 2026 19:40:08 +0530 Subject: [PATCH 1/2] feat: add detailed help text to CLI commands Adds Long descriptions to root, scan, and text commands providing usage examples and detailed explanations of what each command does. Closes #46 Signed-off-by: Gautam Kumar --- cmd/cmd.go | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/cmd/cmd.go b/cmd/cmd.go index f96d94e..a714963 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -45,6 +45,18 @@ func Run(args []string, stdout, stderr io.Writer) int { rootCmd := &cobra.Command{ Use: "disclosure", Short: "Detect AI-generated contributions", + Long: `Disclosure is a standalone CLI tool that detects AI-generated contributions +in git repositories. It works entirely from git-level data (commit emails, +messages, trailers) with no platform API dependencies. + +The tool detects when AI tools are disclosed in contributions — not whether +AI was actually used. It checks for known AI bot emails, Co-Authored-By +trailers, git-ai notes, and tool name mentions in commit messages and text. + +Exit codes: + 0 No AI detected + 1 AI detected + 2 Error`, SilenceUsage: true, SilenceErrors: true, } @@ -75,7 +87,32 @@ func scanCommand(stdout, stderr io.Writer, exitCode *int) *cobra.Command { cmd := &cobra.Command{ Use: "scan [repo-path]", Short: "Scan commits for AI signals", - Args: cobra.MaximumNArgs(1), + Long: `Scan commits in a git repository for signals of AI tool usage. + +Checks each commit for: + - Known AI bot committer emails (Claude, Copilot, Cursor, etc.) + - Co-Authored-By trailers with AI tool emails + - git-ai authorship logs in git notes + - AI session ID trailers + - Commit message patterns (aider:, Generated with Claude Code, etc.) + - Tool name mentions in commit messages`, + Example: ` # Scan current directory + disclosure scan + + # Scan a specific commit range with JSON output + disclosure scan --range=abc123..def456 --format=json + + # Only show high-confidence findings + disclosure scan --min-confidence=high /path/to/repo + + # Scan and use in CI pipeline + if disclosure scan --range=$BASE..HEAD --min-confidence=medium; then + echo "No AI detected" + else + echo "AI involvement detected" + exit 1 + fi`, + Args: cobra.MaximumNArgs(1), RunE: func(_ *cobra.Command, args []string) error { repoPath := "." if len(args) > 0 { @@ -140,6 +177,24 @@ func textCommand(stdout, stderr io.Writer, exitCode *int) *cobra.Command { cmd := &cobra.Command{ Use: "text", Short: "Scan text input for AI signals", + Long: `Scan arbitrary text for AI tool name mentions and signals. + +Useful for scanning PR descriptions, issue comments, or any text input +for mentions of AI tools like Claude, Copilot, Cursor, ChatGPT, etc. + +The text scanner uses word-boundary matching to find tool names and +is the primary detector for non-commit text analysis.`, + Example: ` # Scan text from stdin + echo "I used Claude to write this" | disclosure text --format=json + + # Scan a file + disclosure text --input=pr-body.txt + + # Scan with medium confidence threshold + cat comment.txt | disclosure text --min-confidence=medium + + # Use in a pipeline + disclosure text --input=review.txt --format=json | jq '.findings'`, RunE: func(_ *cobra.Command, args []string) error { var textBytes []byte var err error @@ -195,6 +250,8 @@ func versionCommand(stdout io.Writer, exitCode *int) *cobra.Command { return &cobra.Command{ Use: "version", Short: "Print version", + Example: ` disclosure version + disclosure version --format=json`, Run: func(_ *cobra.Command, _ []string) { fmt.Fprintf(stdout, "disclosure %s\n", Version) *exitCode = ExitNoAI From 7f5a008bb6a9b74220729f7ea109e1ee76450a9e Mon Sep 17 00:00:00 2001 From: Gautam Kumar Date: Fri, 19 Jun 2026 13:29:04 +0530 Subject: [PATCH 2/2] docs: add usage examples to scan, text, version commands and fix stale name Signed-off-by: Gautam Kumar --- cmd/cmd.go | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/cmd/cmd.go b/cmd/cmd.go index a714963..c49ec24 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -95,7 +95,13 @@ Checks each commit for: - git-ai authorship logs in git notes - AI session ID trailers - Commit message patterns (aider:, Generated with Claude Code, etc.) - - Tool name mentions in commit messages`, + - Tool name mentions in commit messages + +Examples: + disclosure scan + disclosure scan --range=abc123..def456 --format=json + disclosure scan --min-confidence=high /path/to/repo + disclosure scan --range=$BASE..HEAD --min-confidence=medium`, Example: ` # Scan current directory disclosure scan @@ -183,7 +189,13 @@ Useful for scanning PR descriptions, issue comments, or any text input for mentions of AI tools like Claude, Copilot, Cursor, ChatGPT, etc. The text scanner uses word-boundary matching to find tool names and -is the primary detector for non-commit text analysis.`, +is the primary detector for non-commit text analysis. + +Examples: + echo "I used Claude to write this" | disclosure text --format=json + disclosure text --input=pr-body.txt + cat comment.txt | disclosure text --min-confidence=medium + disclosure text --input=review.txt --format=json | jq '.findings'`, Example: ` # Scan text from stdin echo "I used Claude to write this" | disclosure text --format=json @@ -250,6 +262,11 @@ func versionCommand(stdout io.Writer, exitCode *int) *cobra.Command { return &cobra.Command{ Use: "version", Short: "Print version", + Long: `Print the disclosure version information. + +Examples: + disclosure version + disclosure version --format=json`, Example: ` disclosure version disclosure version --format=json`, Run: func(_ *cobra.Command, _ []string) { @@ -306,13 +323,13 @@ func generateDocs(exitCode *int) *cobra.Command { Use: "docs", Short: fmt.Sprintf("Build docs in %s formats", strings.Join(supportedFormats, ", ")), Example: fmt.Sprintf(` # simply build markdown docs at default output dir (%s) - ai-detection-action docs + disclosure docs # build rest docs at default output dir - ai-detection-action docs --format rest + disclosure docs --format rest # build manpages docs at a specific 'documentation' dir - ai-detection-action docs --format manpages --out %s`, defaultOutputDir, exampleCustomDir), + disclosure docs --format manpages --out %s`, defaultOutputDir, exampleCustomDir), Args: cobra.MaximumNArgs(0), RunE: func(cmd *cobra.Command, args []string) error { prepareError := func(err error) error {