paddleocr-skills 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +220 -220
- package/bin/paddleocr-skills.js +33 -20
- package/lib/copy.js +39 -39
- package/lib/installer.js +76 -70
- package/lib/prompts.js +67 -67
- package/lib/python.js +75 -75
- package/lib/verify.js +121 -121
- package/package.json +42 -42
- package/templates/.env.example +12 -12
- package/templates/{paddleocr-vl/references/paddleocr-vl → paddleocr-vl-1.5/references/paddleocr-vl-1.5}/layout_schema.md +64 -64
- package/templates/{paddleocr-vl/references/paddleocr-vl → paddleocr-vl-1.5/references/paddleocr-vl-1.5}/output_format.md +154 -154
- package/templates/{paddleocr-vl/references/paddleocr-vl → paddleocr-vl-1.5/references/paddleocr-vl-1.5}/vl_model_spec.md +157 -157
- package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/_lib.py +780 -780
- package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/configure.py +270 -270
- package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/optimize_file.py +226 -226
- package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/requirements-optimize.txt +8 -8
- package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/requirements.txt +7 -7
- package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/smoke_test.py +199 -199
- package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/vl_caller.py +232 -232
- package/templates/{paddleocr-vl/skills/paddleocr-vl → paddleocr-vl-1.5/skills/paddleocr-vl-1.5}/SKILL.md +481 -481
- package/templates/ppocrv5/references/ppocrv5/agent_policy.md +258 -258
- package/templates/ppocrv5/references/ppocrv5/normalized_schema.md +257 -257
- package/templates/ppocrv5/references/ppocrv5/provider_api.md +140 -140
- package/templates/ppocrv5/scripts/ppocrv5/_lib.py +635 -635
- package/templates/ppocrv5/scripts/ppocrv5/configure.py +346 -346
- package/templates/ppocrv5/scripts/ppocrv5/ocr_caller.py +684 -684
- package/templates/ppocrv5/scripts/ppocrv5/requirements.txt +4 -4
- package/templates/ppocrv5/scripts/ppocrv5/smoke_test.py +139 -139
- package/templates/ppocrv5/skills/ppocrv5/SKILL.md +272 -272
package/lib/installer.js
CHANGED
|
@@ -1,70 +1,76 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const chalk = require('chalk');
|
|
3
|
-
const { promptForSkills, promptForConfiguration } = require('./prompts');
|
|
4
|
-
const { copySkillFiles } = require('./copy');
|
|
5
|
-
const { installPythonDeps } = require('./python');
|
|
6
|
-
const { runConfigurationWizard, runVerification } = require('./verify');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Main installer workflow
|
|
10
|
-
*/
|
|
11
|
-
async function runInstaller() {
|
|
12
|
-
console.log(chalk.bold.cyan('\n🎨 PaddleOCR Skills for Claude Code\n'));
|
|
13
|
-
|
|
14
|
-
// Get current working directory (where user ran the command)
|
|
15
|
-
const targetDir = process.cwd();
|
|
16
|
-
console.log(chalk.gray(`Installing to: ${targetDir}\n`));
|
|
17
|
-
|
|
18
|
-
// Step 1:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
console.log(chalk.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
console.log(chalk.
|
|
67
|
-
console.log(chalk.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const chalk = require('chalk');
|
|
3
|
+
const { promptForSkills, promptForConfiguration } = require('./prompts');
|
|
4
|
+
const { copySkillFiles } = require('./copy');
|
|
5
|
+
const { installPythonDeps } = require('./python');
|
|
6
|
+
const { runConfigurationWizard, runVerification } = require('./verify');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Main installer workflow
|
|
10
|
+
*/
|
|
11
|
+
async function runInstaller(preselectedSkills) {
|
|
12
|
+
console.log(chalk.bold.cyan('\n🎨 PaddleOCR Skills for Claude Code\n'));
|
|
13
|
+
|
|
14
|
+
// Get current working directory (where user ran the command)
|
|
15
|
+
const targetDir = process.cwd();
|
|
16
|
+
console.log(chalk.gray(`Installing to: ${targetDir}\n`));
|
|
17
|
+
|
|
18
|
+
// Step 1: Use preselected skills or prompt user
|
|
19
|
+
let skills;
|
|
20
|
+
if (preselectedSkills) {
|
|
21
|
+
skills = preselectedSkills;
|
|
22
|
+
} else {
|
|
23
|
+
const result = await promptForSkills();
|
|
24
|
+
skills = result.skills;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!skills || skills.length === 0) {
|
|
28
|
+
console.log(chalk.yellow('\n⚠️ No skills selected. Exiting.'));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
console.log(chalk.green(`\n✓ Selected skills: ${skills.join(', ')}\n`));
|
|
33
|
+
|
|
34
|
+
// Step 2: Copy skill files to target directory
|
|
35
|
+
console.log(chalk.cyan('📁 Copying skill files...'));
|
|
36
|
+
await copySkillFiles(skills, targetDir);
|
|
37
|
+
console.log(chalk.green('✓ Files copied successfully\n'));
|
|
38
|
+
|
|
39
|
+
// Step 3: Install Python dependencies
|
|
40
|
+
console.log(chalk.cyan('🐍 Installing Python dependencies...'));
|
|
41
|
+
await installPythonDeps(skills, targetDir);
|
|
42
|
+
console.log(chalk.green('✓ Python dependencies installed\n'));
|
|
43
|
+
|
|
44
|
+
// Step 4: Ask if user wants to configure now
|
|
45
|
+
const { configureNow } = await promptForConfiguration();
|
|
46
|
+
|
|
47
|
+
if (configureNow) {
|
|
48
|
+
console.log(chalk.cyan('⚙️ Running configuration wizard...\n'));
|
|
49
|
+
await runConfigurationWizard(skills, targetDir);
|
|
50
|
+
console.log(chalk.green('✓ Configuration complete\n'));
|
|
51
|
+
|
|
52
|
+
// Step 5: Run verification
|
|
53
|
+
console.log(chalk.cyan('🔍 Verifying installation...\n'));
|
|
54
|
+
await runVerification(skills, targetDir);
|
|
55
|
+
} else {
|
|
56
|
+
console.log(chalk.yellow('\n⚠️ Skipped configuration. You can configure later by running:'));
|
|
57
|
+
if (skills.includes('ppocrv5')) {
|
|
58
|
+
console.log(chalk.gray(` python scripts/ppocrv5/configure.py`));
|
|
59
|
+
}
|
|
60
|
+
if (skills.includes('paddleocr-vl-1.5')) {
|
|
61
|
+
console.log(chalk.gray(` python scripts/paddleocr-vl-1.5/configure.py`));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Success message
|
|
66
|
+
console.log(chalk.bold.green('\n✅ Installation complete!\n'));
|
|
67
|
+
console.log(chalk.cyan('Next steps:'));
|
|
68
|
+
console.log(chalk.gray(' 1. Get your API credentials at: https://aistudio.baidu.com/paddleocr'));
|
|
69
|
+
if (!configureNow) {
|
|
70
|
+
console.log(chalk.gray(' 2. Run the configuration scripts shown above'));
|
|
71
|
+
}
|
|
72
|
+
console.log(chalk.gray(` ${configureNow ? '2' : '3'}. Use the skills in your Claude Code session`));
|
|
73
|
+
console.log(chalk.gray('\nFor more information, see the skill documentation in the skills/ directory.\n'));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
module.exports = { runInstaller };
|
package/lib/prompts.js
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
const prompts = require('prompts');
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Prompt user to select which skills to install
|
|
5
|
-
*/
|
|
6
|
-
async function promptForSkills() {
|
|
7
|
-
return await prompts({
|
|
8
|
-
type: 'multiselect',
|
|
9
|
-
name: 'skills',
|
|
10
|
-
message: 'Which PaddleOCR skills do you want to install?',
|
|
11
|
-
choices: [
|
|
12
|
-
{
|
|
13
|
-
title: 'PP-OCRv5 (Text OCR)',
|
|
14
|
-
value: 'ppocrv5',
|
|
15
|
-
description: 'Fast text recognition for images and documents',
|
|
16
|
-
selected: true
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
title: 'PaddleOCR-VL (Document Parsing)',
|
|
20
|
-
value: 'paddleocr-vl',
|
|
21
|
-
description: 'Advanced parsing with tables, formulas, charts, and layout',
|
|
22
|
-
selected: true
|
|
23
|
-
}
|
|
24
|
-
],
|
|
25
|
-
hint: '- Space to select. Return to submit'
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Prompt user for configuration preferences
|
|
31
|
-
*/
|
|
32
|
-
async function promptForConfiguration() {
|
|
33
|
-
return await prompts({
|
|
34
|
-
type: 'confirm',
|
|
35
|
-
name: 'configureNow',
|
|
36
|
-
message: 'Do you want to configure API credentials now?',
|
|
37
|
-
initial: true
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Prompt user for API credentials
|
|
43
|
-
*/
|
|
44
|
-
async function promptForCredentials(skillName) {
|
|
45
|
-
const displayName = skillName === 'ppocrv5' ? 'PP-OCRv5' : 'PaddleOCR-VL';
|
|
46
|
-
|
|
47
|
-
return await prompts([
|
|
48
|
-
{
|
|
49
|
-
type: 'text',
|
|
50
|
-
name: 'apiUrl',
|
|
51
|
-
message: `Enter ${displayName} API URL:`,
|
|
52
|
-
validate: value => value.length > 0 ? true : 'API URL is required'
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
type: 'text',
|
|
56
|
-
name: 'token',
|
|
57
|
-
message: `Enter ${displayName} TOKEN:`,
|
|
58
|
-
validate: value => value.length > 0 ? true : 'TOKEN is required'
|
|
59
|
-
}
|
|
60
|
-
]);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
module.exports = {
|
|
64
|
-
promptForSkills,
|
|
65
|
-
promptForConfiguration,
|
|
66
|
-
promptForCredentials
|
|
67
|
-
};
|
|
1
|
+
const prompts = require('prompts');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Prompt user to select which skills to install
|
|
5
|
+
*/
|
|
6
|
+
async function promptForSkills() {
|
|
7
|
+
return await prompts({
|
|
8
|
+
type: 'multiselect',
|
|
9
|
+
name: 'skills',
|
|
10
|
+
message: 'Which PaddleOCR skills do you want to install?',
|
|
11
|
+
choices: [
|
|
12
|
+
{
|
|
13
|
+
title: 'PP-OCRv5 (Text OCR)',
|
|
14
|
+
value: 'ppocrv5',
|
|
15
|
+
description: 'Fast text recognition for images and documents',
|
|
16
|
+
selected: true
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
title: 'PaddleOCR-VL 1.5 (Document Parsing)',
|
|
20
|
+
value: 'paddleocr-vl-1.5',
|
|
21
|
+
description: 'Advanced parsing with tables, formulas, charts, and layout',
|
|
22
|
+
selected: true
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
hint: '- Space to select. Return to submit'
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Prompt user for configuration preferences
|
|
31
|
+
*/
|
|
32
|
+
async function promptForConfiguration() {
|
|
33
|
+
return await prompts({
|
|
34
|
+
type: 'confirm',
|
|
35
|
+
name: 'configureNow',
|
|
36
|
+
message: 'Do you want to configure API credentials now?',
|
|
37
|
+
initial: true
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Prompt user for API credentials
|
|
43
|
+
*/
|
|
44
|
+
async function promptForCredentials(skillName) {
|
|
45
|
+
const displayName = skillName === 'ppocrv5' ? 'PP-OCRv5' : 'PaddleOCR-VL 1.5';
|
|
46
|
+
|
|
47
|
+
return await prompts([
|
|
48
|
+
{
|
|
49
|
+
type: 'text',
|
|
50
|
+
name: 'apiUrl',
|
|
51
|
+
message: `Enter ${displayName} API URL:`,
|
|
52
|
+
validate: value => value.length > 0 ? true : 'API URL is required'
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: 'text',
|
|
56
|
+
name: 'token',
|
|
57
|
+
message: `Enter ${displayName} TOKEN:`,
|
|
58
|
+
validate: value => value.length > 0 ? true : 'TOKEN is required'
|
|
59
|
+
}
|
|
60
|
+
]);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
module.exports = {
|
|
64
|
+
promptForSkills,
|
|
65
|
+
promptForConfiguration,
|
|
66
|
+
promptForCredentials
|
|
67
|
+
};
|
package/lib/python.js
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
const { spawn } = require('child_process');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const chalk = require('chalk');
|
|
4
|
-
const ora = require('ora');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Check if Python is available
|
|
8
|
-
*/
|
|
9
|
-
async function checkPython() {
|
|
10
|
-
return new Promise((resolve) => {
|
|
11
|
-
const python = spawn('python', ['--version']);
|
|
12
|
-
python.on('close', (code) => {
|
|
13
|
-
resolve(code === 0);
|
|
14
|
-
});
|
|
15
|
-
python.on('error', () => {
|
|
16
|
-
resolve(false);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Install Python dependencies for selected skills
|
|
23
|
-
*/
|
|
24
|
-
async function installPythonDeps(skills, targetDir) {
|
|
25
|
-
// Check if Python is available
|
|
26
|
-
const hasPython = await checkPython();
|
|
27
|
-
|
|
28
|
-
if (!hasPython) {
|
|
29
|
-
console.log(chalk.yellow('⚠️ Python not found. Skipping dependency installation.'));
|
|
30
|
-
console.log(chalk.gray(' Please install Python dependencies manually:'));
|
|
31
|
-
for (const skill of skills) {
|
|
32
|
-
console.log(chalk.gray(` pip install -r scripts/${skill}/requirements.txt`));
|
|
33
|
-
}
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Install dependencies for each skill
|
|
38
|
-
for (const skill of skills) {
|
|
39
|
-
const requirementsPath = path.join(targetDir, 'scripts', skill, 'requirements.txt');
|
|
40
|
-
const spinner = ora(`Installing ${skill} dependencies...`).start();
|
|
41
|
-
|
|
42
|
-
try {
|
|
43
|
-
await runPipInstall(requirementsPath);
|
|
44
|
-
spinner.succeed(`${skill} dependencies installed`);
|
|
45
|
-
} catch (error) {
|
|
46
|
-
spinner.fail(`Failed to install ${skill} dependencies`);
|
|
47
|
-
console.log(chalk.yellow(` You can install manually: pip install -r ${requirementsPath}`));
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Run pip install for a requirements file
|
|
54
|
-
*/
|
|
55
|
-
function runPipInstall(requirementsPath) {
|
|
56
|
-
return new Promise((resolve, reject) => {
|
|
57
|
-
const pip = spawn('pip', ['install', '-r', requirementsPath], {
|
|
58
|
-
stdio: 'inherit'
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
pip.on('close', (code) => {
|
|
62
|
-
if (code === 0) {
|
|
63
|
-
resolve();
|
|
64
|
-
} else {
|
|
65
|
-
reject(new Error(`pip install exited with code ${code}`));
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
pip.on('error', (error) => {
|
|
70
|
-
reject(error);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
module.exports = { installPythonDeps };
|
|
1
|
+
const { spawn } = require('child_process');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
const ora = require('ora');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Check if Python is available
|
|
8
|
+
*/
|
|
9
|
+
async function checkPython() {
|
|
10
|
+
return new Promise((resolve) => {
|
|
11
|
+
const python = spawn('python', ['--version']);
|
|
12
|
+
python.on('close', (code) => {
|
|
13
|
+
resolve(code === 0);
|
|
14
|
+
});
|
|
15
|
+
python.on('error', () => {
|
|
16
|
+
resolve(false);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Install Python dependencies for selected skills
|
|
23
|
+
*/
|
|
24
|
+
async function installPythonDeps(skills, targetDir) {
|
|
25
|
+
// Check if Python is available
|
|
26
|
+
const hasPython = await checkPython();
|
|
27
|
+
|
|
28
|
+
if (!hasPython) {
|
|
29
|
+
console.log(chalk.yellow('⚠️ Python not found. Skipping dependency installation.'));
|
|
30
|
+
console.log(chalk.gray(' Please install Python dependencies manually:'));
|
|
31
|
+
for (const skill of skills) {
|
|
32
|
+
console.log(chalk.gray(` pip install -r scripts/${skill}/requirements.txt`));
|
|
33
|
+
}
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Install dependencies for each skill
|
|
38
|
+
for (const skill of skills) {
|
|
39
|
+
const requirementsPath = path.join(targetDir, 'scripts', skill, 'requirements.txt');
|
|
40
|
+
const spinner = ora(`Installing ${skill} dependencies...`).start();
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
await runPipInstall(requirementsPath);
|
|
44
|
+
spinner.succeed(`${skill} dependencies installed`);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
spinner.fail(`Failed to install ${skill} dependencies`);
|
|
47
|
+
console.log(chalk.yellow(` You can install manually: pip install -r ${requirementsPath}`));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Run pip install for a requirements file
|
|
54
|
+
*/
|
|
55
|
+
function runPipInstall(requirementsPath) {
|
|
56
|
+
return new Promise((resolve, reject) => {
|
|
57
|
+
const pip = spawn('pip', ['install', '-r', requirementsPath], {
|
|
58
|
+
stdio: 'inherit'
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
pip.on('close', (code) => {
|
|
62
|
+
if (code === 0) {
|
|
63
|
+
resolve();
|
|
64
|
+
} else {
|
|
65
|
+
reject(new Error(`pip install exited with code ${code}`));
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
pip.on('error', (error) => {
|
|
70
|
+
reject(error);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
module.exports = { installPythonDeps };
|