Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions apps/jscpd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,16 @@ npx skills add kucherenko/jscpd --skill jscpd
npx skills add kucherenko/jscpd --skill dry-refactoring
```

To install both skills for Codex explicitly:

```bash
npx skills add kucherenko/jscpd --skill jscpd --skill dry-refactoring --agent codex
```

Add `--global` to install into Codex's user skills directory
(`~/.codex/skills/`) instead of the current project's `.agents/skills/`
directory.
Comment on lines +632 to +640

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Make the Codex install example self-contained. The new Codex section says the command is the explicit install, but --global is only mentioned afterward. As written, copy-paste users can miss the Codex user-directory install the surrounding text is describing.

Suggested edit
-npx skills add kucherenko/jscpd --skill jscpd --skill dry-refactoring --agent codex
+npx skills add kucherenko/jscpd --skill jscpd --skill dry-refactoring --agent codex --global

Apply the same wording in both docs.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
To install both skills for Codex explicitly:
```bash
npx skills add kucherenko/jscpd --skill jscpd --skill dry-refactoring --agent codex
```
Add `--global` to install into Codex's user skills directory
(`~/.codex/skills/`) instead of the current project's `.agents/skills/`
directory.
To install both skills for Codex explicitly:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/jscpd/README.md` around lines 632 - 640, Update the Codex install
example so it's self-contained by including the --global variant in the command
snippet itself and matching the surrounding explanatory sentence; specifically
modify the command shown (`npx skills add kucherenko/jscpd --skill jscpd --skill
dry-refactoring --agent codex`) to also show the global form (`npx skills add
... --agent codex --global`) and adjust the adjacent text so both the inline
example and the explanatory line consistently state that adding --global
installs to Codex's user skills directory (~/.codex/skills/) while omitting it
installs to the project's .agents/skills/ directory.


### PMD CPD XML
```xml
<?xml version="1.0" encoding="utf-8"?>
Expand Down
20 changes: 19 additions & 1 deletion apps/jscpd/__tests__/options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as fs from 'fs';
import * as path from 'path';
import {IClone} from '@jscpd/core';
import {jscpd, detectClones, detectClonesAndStatistic} from '../src';
import {bold, yellow} from 'colors/safe';
import {bold, grey, yellow} from 'colors/safe';

const pathToFixtures = __dirname + '/../../../fixtures';

Expand Down Expand Up @@ -205,6 +205,24 @@ describe('jscpd options', () => {
});
});

describe('tips', () => {
it('should print the dry-refactoring skill install command by default', async () => {
await jscpd(['', '', fileWithClones]);
const log = (console.log as any);
expect(log).toHaveBeenCalledWith(
grey('💡 Auto-refactor with AI: npx skills add kucherenko/jscpd --skill dry-refactoring'),
);
});

it('should not print skill install tips when --noTips is enabled', async () => {
await jscpd(['', '', fileWithClones, '--noTips']);
const log = (console.log as any);
expect(log).not.toHaveBeenCalledWith(
expect.stringContaining('npx skills add'),
);
});
});

describe('Not Supported Format', () => {
it('should skip files with not supported formats', async () => {
const clones: IClone[] = await jscpd(['', '',
Expand Down
6 changes: 5 additions & 1 deletion apps/jscpd/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { registerHooks } from "./init/hooks";
import { readJSONSync } from "fs-extra";

const TIMER_LABEL = "time";
const DRY_REFACTORING_SKILL_INSTALL_COMMAND =
"npx skills add kucherenko/jscpd --skill dry-refactoring";

export const detectClones = (
opts: IOptions,
Expand Down Expand Up @@ -63,7 +65,9 @@ export const detectClones = (
if (!options.noTips) {
console.log("");
console.log(
grey("💡 Auto-refactor with AI: npx skills add kucherenko/jscpd"),
grey(
`💡 Auto-refactor with AI: ${DRY_REFACTORING_SKILL_INSTALL_COMMAND}`,
),
);
console.log(
grey(
Expand Down
14 changes: 13 additions & 1 deletion docs/ai-ready.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ A guided process for reading clone output, choosing the right extraction strateg
npx skills add kucherenko/jscpd --skill dry-refactoring
```

### Codex

To install both skills for Codex explicitly:

```bash
npx skills add kucherenko/jscpd --skill jscpd --skill dry-refactoring --agent codex
```

Use `--global` to install them into the Codex user skills directory
(`~/.codex/skills/`) instead of the current project's `.agents/skills/`
directory.

After installation, ask your agent to "find and fix code duplication" and it will invoke jscpd with the right options and act on the results.

## MCP Server
Expand Down Expand Up @@ -118,4 +130,4 @@ Available MCP tools exposed via the `/mcp` endpoint:
- `get_statistics` — Get project stats (no inputs)
- `check_current_directory` — Re-scan the working directory (no inputs)

Snippet checking uses an ephemeral in-memory store per request for isolation — no cross-request contamination, automatic cleanup, concurrent-request safe.
Snippet checking uses an ephemeral in-memory store per request for isolation — no cross-request contamination, automatic cleanup, concurrent-request safe.