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.
Files changed (29) hide show
  1. package/README.md +220 -220
  2. package/bin/paddleocr-skills.js +33 -20
  3. package/lib/copy.js +39 -39
  4. package/lib/installer.js +76 -70
  5. package/lib/prompts.js +67 -67
  6. package/lib/python.js +75 -75
  7. package/lib/verify.js +121 -121
  8. package/package.json +42 -42
  9. package/templates/.env.example +12 -12
  10. package/templates/{paddleocr-vl/references/paddleocr-vl → paddleocr-vl-1.5/references/paddleocr-vl-1.5}/layout_schema.md +64 -64
  11. package/templates/{paddleocr-vl/references/paddleocr-vl → paddleocr-vl-1.5/references/paddleocr-vl-1.5}/output_format.md +154 -154
  12. package/templates/{paddleocr-vl/references/paddleocr-vl → paddleocr-vl-1.5/references/paddleocr-vl-1.5}/vl_model_spec.md +157 -157
  13. package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/_lib.py +780 -780
  14. package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/configure.py +270 -270
  15. package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/optimize_file.py +226 -226
  16. package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/requirements-optimize.txt +8 -8
  17. package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/requirements.txt +7 -7
  18. package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/smoke_test.py +199 -199
  19. package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/vl_caller.py +232 -232
  20. package/templates/{paddleocr-vl/skills/paddleocr-vl → paddleocr-vl-1.5/skills/paddleocr-vl-1.5}/SKILL.md +481 -481
  21. package/templates/ppocrv5/references/ppocrv5/agent_policy.md +258 -258
  22. package/templates/ppocrv5/references/ppocrv5/normalized_schema.md +257 -257
  23. package/templates/ppocrv5/references/ppocrv5/provider_api.md +140 -140
  24. package/templates/ppocrv5/scripts/ppocrv5/_lib.py +635 -635
  25. package/templates/ppocrv5/scripts/ppocrv5/configure.py +346 -346
  26. package/templates/ppocrv5/scripts/ppocrv5/ocr_caller.py +684 -684
  27. package/templates/ppocrv5/scripts/ppocrv5/requirements.txt +4 -4
  28. package/templates/ppocrv5/scripts/ppocrv5/smoke_test.py +139 -139
  29. 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: Prompt user for which skills to install
19
- const { skills } = await promptForSkills();
20
-
21
- if (skills.length === 0) {
22
- console.log(chalk.yellow('\n⚠️ No skills selected. Exiting.'));
23
- return;
24
- }
25
-
26
- console.log(chalk.green(`\n✓ Selected skills: ${skills.join(', ')}\n`));
27
-
28
- // Step 2: Copy skill files to target directory
29
- console.log(chalk.cyan('📁 Copying skill files...'));
30
- await copySkillFiles(skills, targetDir);
31
- console.log(chalk.green('✓ Files copied successfully\n'));
32
-
33
- // Step 3: Install Python dependencies
34
- console.log(chalk.cyan('🐍 Installing Python dependencies...'));
35
- await installPythonDeps(skills, targetDir);
36
- console.log(chalk.green('✓ Python dependencies installed\n'));
37
-
38
- // Step 4: Ask if user wants to configure now
39
- const { configureNow } = await promptForConfiguration();
40
-
41
- if (configureNow) {
42
- console.log(chalk.cyan('⚙️ Running configuration wizard...\n'));
43
- await runConfigurationWizard(skills, targetDir);
44
- console.log(chalk.green('✓ Configuration complete\n'));
45
-
46
- // Step 5: Run verification
47
- console.log(chalk.cyan('🔍 Verifying installation...\n'));
48
- await runVerification(skills, targetDir);
49
- } else {
50
- console.log(chalk.yellow('\n⚠️ Skipped configuration. You can configure later by running:'));
51
- if (skills.includes('ppocrv5')) {
52
- console.log(chalk.gray(` python scripts/ppocrv5/configure.py`));
53
- }
54
- if (skills.includes('paddleocr-vl')) {
55
- console.log(chalk.gray(` python scripts/paddleocr-vl/configure.py`));
56
- }
57
- }
58
-
59
- // Success message
60
- console.log(chalk.bold.green('\n✅ Installation complete!\n'));
61
- console.log(chalk.cyan('Next steps:'));
62
- console.log(chalk.gray(' 1. Get your API credentials at: https://aistudio.baidu.com/paddleocr/task'));
63
- if (!configureNow) {
64
- console.log(chalk.gray(' 2. Run the configuration scripts shown above'));
65
- }
66
- console.log(chalk.gray(` ${configureNow ? '2' : '3'}. Use the skills in your Claude Code session`));
67
- console.log(chalk.gray('\nFor more information, see the skill documentation in the skills/ directory.\n'));
68
- }
69
-
70
- module.exports = { runInstaller };
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 };