Skip to content

Add --source-mode to the bundled ChatGPT/Codex detector script #244

Description

@conorbronsdon

skills/ai-writing-detector/scripts/detect.js supports only --file and --context. scripts/sync-plugin-skill.sh copies patterns.js into that directory but never regenerates detect.js, so it has drifted from bin/avoid-ai-writing.js.

On a Markdown file with YAML frontmatter, the root CLI with --source-mode rendered-markdown reports [0, "Clean", []]. The bundled script reports [15, "Minimal AI signals", ["tier1", "tier1", "tier1"]], all three hits from the frontmatter. Passing the flag throws a raw Node stack trace (unknown argument: --source-mode) instead of the root CLI's exit-2 message.

Rendered-Markdown mode is active work (#123, #189, #190, #196) and the published plugin cannot reach it. The failure it prevents is the repo's worst false-positive class: unedited metadata scored as the author's prose.

Scope

Make detect.js a thin wrapper over the root CLI's parser, or add it to the files the sync script generates, so the two cannot drift again. Add --source-mode with matching validation and exit codes. Mirror the flag in skills/ai-writing-detector/SKILL.md with guidance on when to use it. Run the sync script and python3 scripts/validate-openai-plugin.py . --json.

Acceptance criteria

  • The bundled script gives identical results to the root CLI for the same flags.
  • An unknown flag exits 2 without a stack trace.
  • The sub-skill's SKILL.md documents --source-mode.
  • Either the sync script generates detect.js (git diff empty after running it) or a test pins parser parity.
  • npm test and the OpenAI plugin validator pass.

Add an ## [Unreleased] changelog entry: this changes the published plugin.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfalse-positiveA rule fired on writing that was not machine-generatedgood first issueGood for newcomershelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions