[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6C17BK0FR9NDMWE3BNRGZ46":3,"skill-same:01M6C17BK0FR9NDMWE3BNRGZ46":90},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":54,"linkOnly":55,"markdownContent":56,"markdownBody":57,"frontMatter":58,"refName":66,"commitSha":67,"skillDirectory":68,"forksCount":69,"repositoryHtmlUrl":70,"repositoryHomepageUrl":71,"ownerHtmlUrl":72,"ownerBlogUrl":73,"ownerDescription":74,"updatedAt":75,"install":76,"resources":89},"01M6C17BK0FR9NDMWE3BNRGZ46","cleanup-audit","代码库冗余审计","Audit codebase for dead code, unused exports, orphaned files, and stale manifests","审计代码库中的死代码、未使用的导出、孤立文件以及过时的清单文件。","jmagly\u002Faiwg","jmagly","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1159087?v=4","01M6C10AK8N2WCSQN11FYGTJWN","Joseph Magly","01M6C10AQ8A2RMED1Y1BSVY7NF",229,"MIT",null,"https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Fskills\u002Fcleanup-audit\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8CBEPE1MJTS9ARYEK7J8BH4","代码解析与结构分析","SCENARIO","使用场景",[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53],"audit","cleanup","cleanup audit","fix","unused","dry-run","orphaned files","for","manifests","scope","false","dry","type","files","write","read","grep","dead code","json","deps","Bash","code","run","2026-11-10 10:12:30",false,"---\nnamespace: aiwg\nname: cleanup-audit\ndescription: Audit codebase for dead code, unused exports, orphaned files, and stale manifests\ncommandHint:\n  argumentHint: \"[--scope \u003Cpath>] [--type \u003Cexports|files|deps|manifests>] [--json] [--fix] [--dry-run]\"\n  allowedTools: Bash, Read, Write, Glob, Grep\n  category: utilities\n  orchestration: false\nplatforms: [all]\n\n---\n\n# Cleanup Audit\n\nAudits the codebase for accumulated dead weight: unused TypeScript\u002FJS exports, orphaned source files, npm dependencies that are declared but never imported, and manifest entries that point to files that do not exist. Every finding carries a confidence rating. Only HIGH confidence findings are safe to auto-fix.\n\n## Natural Language Triggers\n\nUsers may say:\n- \"cleanup audit\"\n- \"dead code audit\"\n- \"find dead code\"\n- \"orphan files\"\n- \"unused exports\"\n- \"cleanup analysis\"\n- \"find unused dependencies\"\n- \"stale manifest entries\"\n- \"what can I delete\"\n- \"codebase cleanup\"\n\n## Parameters\n\n### --scope `\u003Cpath>`\n\nRestrict analysis to a subtree. Default is the full repository root.\n\n```bash\naiwg cleanup-audit --scope src\u002Fcli\u002F\naiwg cleanup-audit --scope agentic\u002Fcode\u002Faddons\u002F\n```\n\n### --type `\u003Cexports|files|deps|manifests>`\n\nRun only the specified audit type. Omit to run all four.\n\n| Value | Audits |\n|-------|--------|\n| `exports` | TypeScript\u002FJS exports with no importers |\n| `files` | Source files not referenced by any import or manifest |\n| `deps` | npm dependencies declared in package.json but not used in code |\n| `manifests` | Manifest entries (skills, agents) whose source file does not exist |\n\nMultiple types can be combined:\n```bash\naiwg cleanup-audit --type exports --type deps\n```\n\n### --json\n\nEmit findings as newline-delimited JSON to stdout instead of the formatted report. Useful for piping into other tools or CI scripts.\n\n```bash\naiwg cleanup-audit --json | jq 'select(.confidence == \"HIGH\")'\n```\n\n### --fix\n\nAuto-apply removals for all HIGH confidence findings. Has no effect without confirmation when any HIGH finding involves a non-trivial deletion (more than 10 lines or a full file). Combine with `--dry-run` to preview what `--fix` would remove.\n\n### --dry-run\n\nShow what `--fix` would remove without writing any changes. If used without `--fix`, behaves as the default read-only audit.\n\n## Execution Flow\n\n### Phase 1: Determine Analysis Scope\n\n1. Parse `--scope` — default to repo root\n2. Parse `--type` — default to all four types\n3. Parse `--json`, `--fix`, `--dry-run` flags\n4. Build file inventory for the scope:\n   - All `.ts`, `.tsx`, `.js`, `.mjs` files (for exports and files audits)\n   - `package.json` (for deps audit)\n   - All `manifest.json` files under `agentic\u002F` (for manifests audit)\n5. Communicate scope before analysis begins\n\n**Communicate**:\n```\nCleanup Audit\nScope: {scope}\nTypes: {types}\nMode: {read-only | fix | dry-run fix}\n\nBuilding file inventory...\n  Source files: {N}\n  Manifests: {N}\n```\n\n### Phase 2: Analyze Unused Exports\n\nApplies to `--type exports`. Identifies TypeScript and JavaScript named exports that are never imported anywhere in the scope.\n\n**Detection approach**:\n1. Glob all source files in scope: `**\u002F*.ts`, `**\u002F*.tsx`, `**\u002F*.js`, `**\u002F*.mjs`\n2. Extract all export declarations: `export function`, `export class`, `export const`, `export type`, `export interface`, `export enum`\n3. For each exported identifier, grep all source files for imports of that identifier\n4. An export is unused if: zero import matches AND it is not referenced in a manifest entry AND it is not a re-export pattern (`export * from`)\n\n**Confidence rules**:\n\n| Signal | Confidence |\n|--------|-----------|\n| Zero imports found across entire scope | HIGH |\n| Zero imports but identifier is a common name (e.g., `index`, `default`) | MEDIUM |\n| Zero imports but file is an entry point (`index.ts`, `main.ts`) | LOW |\n| Export appears in a barrel file (`index.ts` re-export) | LOW — skip |\n\n**Output per finding**:\n```\n[UNUSED-EXPORT] HIGH\n  File: src\u002Fextensions\u002Fregistry.ts:45\n  Export: registerExtension\n  Declared: export function registerExtension(ext: Extension): void\n  Importers found: 0\n  Safe to remove: yes\n```\n\n### Phase 3: Detect Orphaned Files\n\nApplies to `--type files`. Identifies source files that are not imported by any other file and not listed in any manifest.\n\n**Detection approach**:\n1. Build full file list for scope\n2. For each file, check whether its path appears in:\n   - Any `import` or `require` statement in any other source file\n   - Any `manifest.json` `scripts` or `path` field\n   - Any `package.json` `main`, `exports`, or `bin` field\n3. A file is orphaned if none of the above references exist\n\n**Confidence rules**:\n\n| Signal | Confidence |\n|--------|-----------|\n| No references found anywhere | HIGH |\n| No references but filename matches common entry point pattern | MEDIUM |\n| No references but file is in root of package (may be undiscovered entry) | LOW |\n| Test file with no corresponding source file | MEDIUM (orphaned test) |\n\n**Output per finding**:\n```\n[ORPHANED-FILE] HIGH\n  File: src\u002Flegacy\u002Fold-config-reader.ts\n  References found: 0 (imports: 0, manifests: 0, package.json: 0)\n  Last modified: 2025-11-02\n  Safe to remove: yes\n```\n\n### Phase 4: Audit Dependencies\n\nApplies to `--type deps`. Finds npm packages declared in `package.json` that have no `import` or `require` usage anywhere in the codebase.\n\n**Detection approach**:\n1. Read `dependencies` and `devDependencies` from `package.json`\n2. For each package name, grep source files for:\n   - `import ... from '{package}'`\n   - `require('{package}')`\n   - `import('{package}')`\n   - Scoped sub-path imports: `import ... from '{package}\u002F...'`\n3. Also check config files for tool references: `.eslintrc`, `jest.config.*`, `tsconfig.json`\n\n**Confidence rules**:\n\n| Signal | Confidence |\n|--------|-----------|\n| No import\u002Frequire in source, no config reference | HIGH |\n| No import in source but referenced in a config file | LOW — tool dependency, do not remove |\n| No import but package name matches a `peerDependency` | LOW — required by consumers |\n| No import but package is a type declaration (`@types\u002F...`) | MEDIUM — check if corresponding package is used |\n\n**Output per finding**:\n```\n[UNUSED-DEP] HIGH\n  Package: lodash\n  Version: ^4.17.21\n  Type: dependency\n  Usage in source: 0 files\n  Config references: 0\n  Safe to remove: yes (run: npm uninstall lodash)\n```\n\n### Phase 5: Check Manifest Entries\n\nApplies to `--type manifests`. Finds entries in `manifest.json` files (skills, agents, commands) whose referenced source files or directories do not exist on disk.\n\n**Detection approach**:\n1. Glob all `manifest.json` files: `**\u002Fmanifest.json`\n2. For each manifest, inspect entries that reference file paths:\n   - `skills[].scripts[]`\n   - `agents[].path`\n   - `commands[].handler`\n   - Any field ending in `path`, `file`, or `script`\n3. Resolve each path relative to the manifest file location\n4. Check whether the resolved path exists on disk\n5. Also flag entries where the declared `name` has no corresponding `{name}\u002FSKILL.md` or `{name}\u002FAGENT.md` directory\n\n**Confidence rules**:\n\n| Signal | Confidence |\n|--------|-----------|\n| Declared path does not exist | HIGH |\n| Declared path exists but is empty directory | MEDIUM |\n| Name entry has no corresponding directory | HIGH |\n| Script listed but containing skill directory has no SKILL.md | HIGH |\n\n**Output per finding**:\n```\n[STALE-MANIFEST] HIGH\n  Manifest: agentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Fskills\u002Fmanifest.json\n  Entry: skills[12].name = \"old-voice-converter\"\n  Expected path: skills\u002Fold-voice-converter\u002F\n  Path exists: no\n  Safe to remove: yes (remove entry from manifest)\n```\n\n### Phase 6: Compile Confidence-Rated Report\n\nAggregate all findings from Phases 2–5 into a unified report. Sort by confidence (HIGH first), then by type, then by file path.\n\n**Report format**:\n```markdown\n# Cleanup Audit Report\nGenerated: {timestamp}\nScope: {scope}\nTypes: {types}\n\n## Summary\n\n| Type | HIGH | MEDIUM | LOW | Total |\n|------|------|--------|-----|-------|\n| Unused exports | {N} | {N} | {N} | {N} |\n| Orphaned files | {N} | {N} | {N} | {N} |\n| Unused deps | {N} | {N} | {N} | {N} |\n| Stale manifests | {N} | {N} | {N} | {N} |\n| **Total** | **{N}** | **{N}** | **{N}** | **{N}** |\n\nAuto-fixable (HIGH confidence): {N} findings\n\n## HIGH Confidence Findings\n\n### Unused Exports\n...\n\n### Orphaned Files\n...\n\n### Unused Dependencies\n...\n\n### Stale Manifest Entries\n...\n\n## MEDIUM Confidence Findings (manual review recommended)\n...\n\n## LOW Confidence Findings (informational)\n...\n\n## Recommended Actions\n\n1. Run `aiwg cleanup-audit --fix` to remove {N} HIGH confidence findings automatically\n2. Manually review {N} MEDIUM confidence findings\n3. Ignore or suppress {N} LOW confidence findings if intentional\n```\n\nSave to: `.aiwg\u002Freports\u002Fcleanup-audit-{timestamp}.md`\n\nIf `--json` flag is set, also emit each finding as a JSON object to stdout:\n```json\n{\"type\": \"UNUSED-EXPORT\", \"confidence\": \"HIGH\", \"file\": \"src\u002Fextensions\u002Fregistry.ts\", \"line\": 45, \"detail\": \"registerExtension\", \"safe_to_remove\": true}\n```\n\nIf `--fix` is set (and not `--dry-run`), apply removals for all HIGH findings after report is generated.\n\n## Confidence Rating Reference\n\n| Rating | Meaning | Auto-fix eligible |\n|--------|---------|-------------------|\n| HIGH | Strong evidence of dead code with no false-positive signals | Yes |\n| MEDIUM | Likely dead code but has signals that warrant human review | No |\n| LOW | Informational — pattern matches but may be intentional | No |\n\n**Never auto-fix MEDIUM or LOW findings.** These exist to inform human decisions, not drive automated removal.\n\n## Error Handling\n\n### Scope Path Not Found\n\n```\nError: --scope path does not exist: {path}\nVerify the path is relative to the project root or use an absolute path.\n```\n\n### Parse Failure on Manifest\n\n```\nWarning: Could not parse manifest at {path}\n  Error: {JSON parse error}\n  Action: Skipping this manifest — listed in report as PARSE_ERROR\n```\n\n### Zero Files in Scope\n\n```\nWarning: No source files found in scope: {scope}\n  Checked patterns: **\u002F*.ts, **\u002F*.tsx, **\u002F*.js, **\u002F*.mjs\n  Confirm the scope path contains source files.\n```\n\n## Examples\n\n### Example 1: Full audit before a release\n\n```bash\naiwg cleanup-audit\n```\n\nRuns all four audit types on the full repository. Generates report at `.aiwg\u002Freports\u002Fcleanup-audit-{timestamp}.md`. Prints summary to stdout. No files modified.\n\n### Example 2: Auto-fix high-confidence findings\n\n```bash\naiwg cleanup-audit --fix --dry-run\n```\n\nShows exactly what `--fix` would remove — useful for reviewing before committing. Then:\n\n```bash\naiwg cleanup-audit --fix\n```\n\nRemoves all HIGH confidence findings: unused exports, orphaned files, stale manifest entries. For unused deps, prints the `npm uninstall` commands to run (does not execute them automatically).\n\n### Example 3: CI integration with JSON output\n\n```bash\naiwg cleanup-audit --type manifests --type files --json \\\n  | jq 'select(.confidence == \"HIGH\") | .file' \\\n  | sort -u\n```\n\nExtracts only HIGH confidence file-level findings as a sorted list. Suitable for a CI step that blocks merge if orphaned files are introduced.\n\n### Example 4: Scoped audit during active development\n\n```bash\naiwg cleanup-audit --scope src\u002Fcli\u002F --type exports\n```\n\nTargeted export audit for the CLI subtree only. Fast enough to run after each feature branch merge.\n\n## References\n\n- @$AIWG_ROOT\u002Fsrc\u002Fcli\u002Fhandlers\u002Futilities.ts — Cleanup audit command handler\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Fskills\u002Fmanifest.json — Skills manifest (audited by manifests type)\n- @$AIWG_ROOT\u002Fdocs\u002Fcli-reference.md — CLI reference for this command\n","# Cleanup Audit\n\nAudits the codebase for accumulated dead weight: unused TypeScript\u002FJS exports, orphaned source files, npm dependencies that are declared but never imported, and manifest entries that point to files that do not exist. Every finding carries a confidence rating. Only HIGH confidence findings are safe to auto-fix.\n\n## Natural Language Triggers\n\nUsers may say:\n- \"cleanup audit\"\n- \"dead code audit\"\n- \"find dead code\"\n- \"orphan files\"\n- \"unused exports\"\n- \"cleanup analysis\"\n- \"find unused dependencies\"\n- \"stale manifest entries\"\n- \"what can I delete\"\n- \"codebase cleanup\"\n\n## Parameters\n\n### --scope `\u003Cpath>`\n\nRestrict analysis to a subtree. Default is the full repository root.\n\n```bash\naiwg cleanup-audit --scope src\u002Fcli\u002F\naiwg cleanup-audit --scope agentic\u002Fcode\u002Faddons\u002F\n```\n\n### --type `\u003Cexports|files|deps|manifests>`\n\nRun only the specified audit type. Omit to run all four.\n\n| Value | Audits |\n|-------|--------|\n| `exports` | TypeScript\u002FJS exports with no importers |\n| `files` | Source files not referenced by any import or manifest |\n| `deps` | npm dependencies declared in package.json but not used in code |\n| `manifests` | Manifest entries (skills, agents) whose source file does not exist |\n\nMultiple types can be combined:\n```bash\naiwg cleanup-audit --type exports --type deps\n```\n\n### --json\n\nEmit findings as newline-delimited JSON to stdout instead of the formatted report. Useful for piping into other tools or CI scripts.\n\n```bash\naiwg cleanup-audit --json | jq 'select(.confidence == \"HIGH\")'\n```\n\n### --fix\n\nAuto-apply removals for all HIGH confidence findings. Has no effect without confirmation when any HIGH finding involves a non-trivial deletion (more than 10 lines or a full file). Combine with `--dry-run` to preview what `--fix` would remove.\n\n### --dry-run\n\nShow what `--fix` would remove without writing any changes. If used without `--fix`, behaves as the default read-only audit.\n\n## Execution Flow\n\n### Phase 1: Determine Analysis Scope\n\n1. Parse `--scope` — default to repo root\n2. Parse `--type` — default to all four types\n3. Parse `--json`, `--fix`, `--dry-run` flags\n4. Build file inventory for the scope:\n   - All `.ts`, `.tsx`, `.js`, `.mjs` files (for exports and files audits)\n   - `package.json` (for deps audit)\n   - All `manifest.json` files under `agentic\u002F` (for manifests audit)\n5. Communicate scope before analysis begins\n\n**Communicate**:\n```\nCleanup Audit\nScope: {scope}\nTypes: {types}\nMode: {read-only | fix | dry-run fix}\n\nBuilding file inventory...\n  Source files: {N}\n  Manifests: {N}\n```\n\n### Phase 2: Analyze Unused Exports\n\nApplies to `--type exports`. Identifies TypeScript and JavaScript named exports that are never imported anywhere in the scope.\n\n**Detection approach**:\n1. Glob all source files in scope: `**\u002F*.ts`, `**\u002F*.tsx`, `**\u002F*.js`, `**\u002F*.mjs`\n2. Extract all export declarations: `export function`, `export class`, `export const`, `export type`, `export interface`, `export enum`\n3. For each exported identifier, grep all source files for imports of that identifier\n4. An export is unused if: zero import matches AND it is not referenced in a manifest entry AND it is not a re-export pattern (`export * from`)\n\n**Confidence rules**:\n\n| Signal | Confidence |\n|--------|-----------|\n| Zero imports found across entire scope | HIGH |\n| Zero imports but identifier is a common name (e.g., `index`, `default`) | MEDIUM |\n| Zero imports but file is an entry point (`index.ts`, `main.ts`) | LOW |\n| Export appears in a barrel file (`index.ts` re-export) | LOW — skip |\n\n**Output per finding**:\n```\n[UNUSED-EXPORT] HIGH\n  File: src\u002Fextensions\u002Fregistry.ts:45\n  Export: registerExtension\n  Declared: export function registerExtension(ext: Extension): void\n  Importers found: 0\n  Safe to remove: yes\n```\n\n### Phase 3: Detect Orphaned Files\n\nApplies to `--type files`. Identifies source files that are not imported by any other file and not listed in any manifest.\n\n**Detection approach**:\n1. Build full file list for scope\n2. For each file, check whether its path appears in:\n   - Any `import` or `require` statement in any other source file\n   - Any `manifest.json` `scripts` or `path` field\n   - Any `package.json` `main`, `exports`, or `bin` field\n3. A file is orphaned if none of the above references exist\n\n**Confidence rules**:\n\n| Signal | Confidence |\n|--------|-----------|\n| No references found anywhere | HIGH |\n| No references but filename matches common entry point pattern | MEDIUM |\n| No references but file is in root of package (may be undiscovered entry) | LOW |\n| Test file with no corresponding source file | MEDIUM (orphaned test) |\n\n**Output per finding**:\n```\n[ORPHANED-FILE] HIGH\n  File: src\u002Flegacy\u002Fold-config-reader.ts\n  References found: 0 (imports: 0, manifests: 0, package.json: 0)\n  Last modified: 2025-11-02\n  Safe to remove: yes\n```\n\n### Phase 4: Audit Dependencies\n\nApplies to `--type deps`. Finds npm packages declared in `package.json` that have no `import` or `require` usage anywhere in the codebase.\n\n**Detection approach**:\n1. Read `dependencies` and `devDependencies` from `package.json`\n2. For each package name, grep source files for:\n   - `import ... from '{package}'`\n   - `require('{package}')`\n   - `import('{package}')`\n   - Scoped sub-path imports: `import ... from '{package}\u002F...'`\n3. Also check config files for tool references: `.eslintrc`, `jest.config.*`, `tsconfig.json`\n\n**Confidence rules**:\n\n| Signal | Confidence |\n|--------|-----------|\n| No import\u002Frequire in source, no config reference | HIGH |\n| No import in source but referenced in a config file | LOW — tool dependency, do not remove |\n| No import but package name matches a `peerDependency` | LOW — required by consumers |\n| No import but package is a type declaration (`@types\u002F...`) | MEDIUM — check if corresponding package is used |\n\n**Output per finding**:\n```\n[UNUSED-DEP] HIGH\n  Package: lodash\n  Version: ^4.17.21\n  Type: dependency\n  Usage in source: 0 files\n  Config references: 0\n  Safe to remove: yes (run: npm uninstall lodash)\n```\n\n### Phase 5: Check Manifest Entries\n\nApplies to `--type manifests`. Finds entries in `manifest.json` files (skills, agents, commands) whose referenced source files or directories do not exist on disk.\n\n**Detection approach**:\n1. Glob all `manifest.json` files: `**\u002Fmanifest.json`\n2. For each manifest, inspect entries that reference file paths:\n   - `skills[].scripts[]`\n   - `agents[].path`\n   - `commands[].handler`\n   - Any field ending in `path`, `file`, or `script`\n3. Resolve each path relative to the manifest file location\n4. Check whether the resolved path exists on disk\n5. Also flag entries where the declared `name` has no corresponding `{name}\u002FSKILL.md` or `{name}\u002FAGENT.md` directory\n\n**Confidence rules**:\n\n| Signal | Confidence |\n|--------|-----------|\n| Declared path does not exist | HIGH |\n| Declared path exists but is empty directory | MEDIUM |\n| Name entry has no corresponding directory | HIGH |\n| Script listed but containing skill directory has no SKILL.md | HIGH |\n\n**Output per finding**:\n```\n[STALE-MANIFEST] HIGH\n  Manifest: agentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Fskills\u002Fmanifest.json\n  Entry: skills[12].name = \"old-voice-converter\"\n  Expected path: skills\u002Fold-voice-converter\u002F\n  Path exists: no\n  Safe to remove: yes (remove entry from manifest)\n```\n\n### Phase 6: Compile Confidence-Rated Report\n\nAggregate all findings from Phases 2–5 into a unified report. Sort by confidence (HIGH first), then by type, then by file path.\n\n**Report format**:\n```markdown\n# Cleanup Audit Report\nGenerated: {timestamp}\nScope: {scope}\nTypes: {types}\n\n## Summary\n\n| Type | HIGH | MEDIUM | LOW | Total |\n|------|------|--------|-----|-------|\n| Unused exports | {N} | {N} | {N} | {N} |\n| Orphaned files | {N} | {N} | {N} | {N} |\n| Unused deps | {N} | {N} | {N} | {N} |\n| Stale manifests | {N} | {N} | {N} | {N} |\n| **Total** | **{N}** | **{N}** | **{N}** | **{N}** |\n\nAuto-fixable (HIGH confidence): {N} findings\n\n## HIGH Confidence Findings\n\n### Unused Exports\n...\n\n### Orphaned Files\n...\n\n### Unused Dependencies\n...\n\n### Stale Manifest Entries\n...\n\n## MEDIUM Confidence Findings (manual review recommended)\n...\n\n## LOW Confidence Findings (informational)\n...\n\n## Recommended Actions\n\n1. Run `aiwg cleanup-audit --fix` to remove {N} HIGH confidence findings automatically\n2. Manually review {N} MEDIUM confidence findings\n3. Ignore or suppress {N} LOW confidence findings if intentional\n```\n\nSave to: `.aiwg\u002Freports\u002Fcleanup-audit-{timestamp}.md`\n\nIf `--json` flag is set, also emit each finding as a JSON object to stdout:\n```json\n{\"type\": \"UNUSED-EXPORT\", \"confidence\": \"HIGH\", \"file\": \"src\u002Fextensions\u002Fregistry.ts\", \"line\": 45, \"detail\": \"registerExtension\", \"safe_to_remove\": true}\n```\n\nIf `--fix` is set (and not `--dry-run`), apply removals for all HIGH findings after report is generated.\n\n## Confidence Rating Reference\n\n| Rating | Meaning | Auto-fix eligible |\n|--------|---------|-------------------|\n| HIGH | Strong evidence of dead code with no false-positive signals | Yes |\n| MEDIUM | Likely dead code but has signals that warrant human review | No |\n| LOW | Informational — pattern matches but may be intentional | No |\n\n**Never auto-fix MEDIUM or LOW findings.** These exist to inform human decisions, not drive automated removal.\n\n## Error Handling\n\n### Scope Path Not Found\n\n```\nError: --scope path does not exist: {path}\nVerify the path is relative to the project root or use an absolute path.\n```\n\n### Parse Failure on Manifest\n\n```\nWarning: Could not parse manifest at {path}\n  Error: {JSON parse error}\n  Action: Skipping this manifest — listed in report as PARSE_ERROR\n```\n\n### Zero Files in Scope\n\n```\nWarning: No source files found in scope: {scope}\n  Checked patterns: **\u002F*.ts, **\u002F*.tsx, **\u002F*.js, **\u002F*.mjs\n  Confirm the scope path contains source files.\n```\n\n## Examples\n\n### Example 1: Full audit before a release\n\n```bash\naiwg cleanup-audit\n```\n\nRuns all four audit types on the full repository. Generates report at `.aiwg\u002Freports\u002Fcleanup-audit-{timestamp}.md`. Prints summary to stdout. No files modified.\n\n### Example 2: Auto-fix high-confidence findings\n\n```bash\naiwg cleanup-audit --fix --dry-run\n```\n\nShows exactly what `--fix` would remove — useful for reviewing before committing. Then:\n\n```bash\naiwg cleanup-audit --fix\n```\n\nRemoves all HIGH confidence findings: unused exports, orphaned files, stale manifest entries. For unused deps, prints the `npm uninstall` commands to run (does not execute them automatically).\n\n### Example 3: CI integration with JSON output\n\n```bash\naiwg cleanup-audit --type manifests --type files --json \\\n  | jq 'select(.confidence == \"HIGH\") | .file' \\\n  | sort -u\n```\n\nExtracts only HIGH confidence file-level findings as a sorted list. Suitable for a CI step that blocks merge if orphaned files are introduced.\n\n### Example 4: Scoped audit during active development\n\n```bash\naiwg cleanup-audit --scope src\u002Fcli\u002F --type exports\n```\n\nTargeted export audit for the CLI subtree only. Fast enough to run after each feature branch merge.\n\n## References\n\n- @$AIWG_ROOT\u002Fsrc\u002Fcli\u002Fhandlers\u002Futilities.ts — Cleanup audit command handler\n- @$AIWG_ROOT\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Fskills\u002Fmanifest.json — Skills manifest (audited by manifests type)\n- @$AIWG_ROOT\u002Fdocs\u002Fcli-reference.md — CLI reference for this command\n",{"name":5,"namespace":59,"platforms":60,"commandHint":62,"description":7},"aiwg",[61],"all",{"category":63,"allowedTools":64,"argumentHint":65,"orchestration":55},"utilities","Bash, Read, Write, Glob, Grep","[--scope \u003Cpath>] [--type \u003Cexports|files|deps|manifests>] [--json] [--fix] [--dry-run]","main","6754967c344ccb087a8de06972f55a41067b291b","agentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Fskills\u002Fcleanup-audit",36,"https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg","https:\u002F\u002Faiwg.io","https:\u002F\u002Fgithub.com\u002Fjmagly","https:\u002F\u002Fintegrolabs.io","ml\u002Fai, industrial automation, safety\u002Fsecurity, ssi\r\n\r\nmagly.net\r\nintegrolabs.io\r\naiwg.io\r\nfortemi.com\r\npagenary.com\r\nbytecask.com","2026-11-14 10:46:34",{"source":9,"skillName":5,"commands":77,"prompt":87,"zipAvailable":88},[78,81,84],{"tool":79,"command":80},"npx","npx skills add jmagly\u002Faiwg --skill cleanup-audit",{"tool":82,"command":83},"bunx","bunx skills add jmagly\u002Faiwg --skill cleanup-audit",{"tool":85,"command":86},"pnpm","pnpm dlx skills add jmagly\u002Faiwg --skill cleanup-audit","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Fskills\u002Fcleanup-audit\u002FSKILL.md",true,[],[91,99,104,128,146,151],{"skillNo":92,"name":93,"nameZh":17,"description":94,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":98},"01M78KW7PZJ9YQZQMW84SN2YD4","plugin-search","Search marketplaces for plugins using configured local manifests and directory caches; rank matching plugins by observed installs, review tier and cache dates without installing or fetching anything","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fplugins\u002Futils\u002Fskills\u002Fplugin-search\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":100,"name":93,"nameZh":17,"description":94,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":98},"01M78KSEZS9ZNNFESY9ANW22S0","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Faddons\u002Faiwg-utils\u002Fskills\u002Fplugin-search\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":17,"description":107,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":54},"01M70QA0BSYJ49EES9V4RE8QH1","host-hardening","Read-only system hardening baseline and plan-first host hardening recommendations for SSH, Docker bind addresses, firewall persistence, datastores, exporters and audit retention.","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fplugins\u002Fsecurity-engineering\u002Fskills\u002Fhost-hardening\u002FSKILL.md",[],[111,112,113,114,115,46,116,117,118,31,119,120,121,51,122,123,124,125,126,127],"hardening","host","host hardening","verification","secrets","request","remediation","recommendations","plan","port","bind","access","only","retention","re","never","firewall",{"skillNo":129,"name":130,"nameZh":17,"description":131,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":132,"categories":133,"keywords":134,"publishedAt":54},"01M70PNT2Z4HMZPRBTAF6073NN","exposure-analysis","Read-only firewall analysis and effective host exposure reconstruction for Docker published ports, UFW bypass, stale rules, CDN scope, IPv6 asymmetry and external probe allowlists.","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fplugins\u002Fforensics\u002Fskills\u002Fexposure-analysis\u002FSKILL.md",[],[135,136,137,138,139,45,46,140,120,126,51,141,112,142,123,143,40,127,144,145],"analysis","exposure analysis","collection","reconstruction","operator","credentials","unknown","internet","local","ports","ufw",{"skillNo":147,"name":106,"nameZh":17,"description":107,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":148,"categories":149,"keywords":150,"publishedAt":54},"01M70P8QATMPKA78E4FT5D2TNA","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fframeworks\u002Fsecurity-engineering\u002Fskills\u002Fhost-hardening\u002FSKILL.md",[],[111,112,113,125,126,127,121,124,118,115,46,116,117,31,119,120,114,51,122,123],{"skillNo":152,"name":130,"nameZh":17,"description":131,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":153,"categories":154,"keywords":155,"publishedAt":54},"01M70NMPVJ5H0JH131P60FW4R8","https:\u002F\u002Fgithub.com\u002Fjmagly\u002Faiwg\u002Fblob\u002Fmain\u002Fagentic\u002Fcode\u002Fframeworks\u002Fforensics-complete\u002Fskills\u002Fexposure-analysis\u002FSKILL.md",[],[135,136,145,144,139,40,143,123,138,45,46,140,120,137,51,141,112,127,126,142]]