paperfit-cli 1.0.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 (65) hide show
  1. package/.claude/commands/adjust-length.md +21 -0
  2. package/.claude/commands/check-visual.md +27 -0
  3. package/.claude/commands/fix-layout.md +31 -0
  4. package/.claude/commands/migrate-template.md +23 -0
  5. package/.claude/commands/repair-table.md +21 -0
  6. package/.claude/commands/show-status.md +32 -0
  7. package/.claude-plugin/README.md +77 -0
  8. package/.claude-plugin/marketplace.json +41 -0
  9. package/.claude-plugin/plugin.json +39 -0
  10. package/CLAUDE.md +266 -0
  11. package/CONTRIBUTING.md +131 -0
  12. package/LICENSE +21 -0
  13. package/README.md +164 -0
  14. package/agents/code-surgeon-agent.md +214 -0
  15. package/agents/layout-detective-agent.md +229 -0
  16. package/agents/orchestrator-agent.md +254 -0
  17. package/agents/quality-gatekeeper-agent.md +270 -0
  18. package/agents/rule-engine-agent.md +224 -0
  19. package/agents/semantic-polish-agent.md +250 -0
  20. package/bin/paperfit.js +176 -0
  21. package/config/agent_roles.yaml +56 -0
  22. package/config/layout_rules.yaml +54 -0
  23. package/config/templates.yaml +241 -0
  24. package/config/vto_taxonomy.yaml +489 -0
  25. package/config/writing_rules.yaml +64 -0
  26. package/install.sh +30 -0
  27. package/package.json +52 -0
  28. package/requirements.txt +5 -0
  29. package/scripts/benchmark_runner.py +629 -0
  30. package/scripts/compile.sh +244 -0
  31. package/scripts/config_validator.py +339 -0
  32. package/scripts/cv_detector.py +600 -0
  33. package/scripts/evidence_collector.py +167 -0
  34. package/scripts/float_fixers.py +861 -0
  35. package/scripts/inject_defects.py +549 -0
  36. package/scripts/install-claude-global.js +148 -0
  37. package/scripts/install.js +66 -0
  38. package/scripts/install.sh +106 -0
  39. package/scripts/overflow_fixers.py +656 -0
  40. package/scripts/package-for-opensource.sh +138 -0
  41. package/scripts/parse_log.py +260 -0
  42. package/scripts/postinstall.js +38 -0
  43. package/scripts/pre_tool_use.py +265 -0
  44. package/scripts/render_pages.py +244 -0
  45. package/scripts/session_logger.py +329 -0
  46. package/scripts/space_util_fixers.py +773 -0
  47. package/scripts/state_manager.py +352 -0
  48. package/scripts/test_commands.py +187 -0
  49. package/scripts/test_cv_detector.py +214 -0
  50. package/scripts/test_integration.py +290 -0
  51. package/skills/consistency-polisher/SKILL.md +337 -0
  52. package/skills/float-optimizer/SKILL.md +284 -0
  53. package/skills/latex_fixers/__init__.py +82 -0
  54. package/skills/latex_fixers/float_fixers.py +392 -0
  55. package/skills/latex_fixers/fullwidth_fixers.py +375 -0
  56. package/skills/latex_fixers/overflow_fixers.py +250 -0
  57. package/skills/latex_fixers/semantic_micro_tuning.py +362 -0
  58. package/skills/latex_fixers/space_util_fixers.py +389 -0
  59. package/skills/latex_fixers/utils.py +55 -0
  60. package/skills/overflow-repair/SKILL.md +304 -0
  61. package/skills/space-util-fixer/SKILL.md +307 -0
  62. package/skills/taxonomy-vto/SKILL.md +486 -0
  63. package/skills/template-migrator/SKILL.md +251 -0
  64. package/skills/visual-inspector/SKILL.md +217 -0
  65. package/skills/writing-polish/SKILL.md +289 -0
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * PaperFit Install Script
5
+ * Runs during npm install to verify dependencies and prepare the environment
6
+ */
7
+
8
+ const { execSync } = require('child_process');
9
+ const path = require('path');
10
+ const fs = require('fs');
11
+
12
+ console.log('šŸ“¦ PaperFit Install Script\n');
13
+
14
+ const projectRoot = path.join(__dirname, '..');
15
+
16
+ // Check Python availability
17
+ console.log('šŸ” Checking Python...');
18
+ try {
19
+ execSync('python3 --version', { stdio: 'pipe' });
20
+ const pythonVersion = execSync('python3 --version', { encoding: 'utf-8' }).trim();
21
+ console.log(`āœ… ${pythonVersion}`);
22
+ } catch (e) {
23
+ console.log('āš ļø Python 3 not found. Please install Python 3.8+');
24
+ console.log(' macOS: brew install python@3.11');
25
+ console.log(' Linux: apt-get install python3 python3-pip');
26
+ }
27
+
28
+ // Check latexmk
29
+ console.log('\nšŸ” Checking LaTeX...');
30
+ try {
31
+ execSync('which latexmk', { stdio: 'pipe' });
32
+ console.log('āœ… latexmk detected');
33
+ } catch (e) {
34
+ console.log('āš ļø latexmk not found. Install MacTeX or TeX Live');
35
+ console.log(' macOS: brew install --cask mactex');
36
+ console.log(' Linux: apt-get install texlive-full latexmk');
37
+ }
38
+
39
+ // Check poppler
40
+ try {
41
+ execSync('which pdfinfo', { stdio: 'pipe' });
42
+ console.log('āœ… Poppler utilities detected');
43
+ } catch (e) {
44
+ console.log('āš ļø Poppler not found. Required for PDF rendering.');
45
+ console.log(' macOS: brew install poppler');
46
+ console.log(' Linux: apt-get install poppler-utils');
47
+ }
48
+
49
+ // Install Python dependencies
50
+ console.log('\nšŸ“¦ Installing Python dependencies...');
51
+ const requirementsPath = path.join(projectRoot, 'requirements.txt');
52
+ if (fs.existsSync(requirementsPath)) {
53
+ try {
54
+ execSync('pip3 install -r requirements.txt', {
55
+ cwd: projectRoot,
56
+ stdio: 'inherit'
57
+ });
58
+ console.log('āœ… Python dependencies installed');
59
+ } catch (e) {
60
+ console.log('āš ļø Failed to install Python dependencies. Run manually: pip3 install -r requirements.txt');
61
+ }
62
+ } else {
63
+ console.log('āš ļø requirements.txt not found. Skipping Python dependencies.');
64
+ }
65
+
66
+ console.log('\nāœ… Install script completed');
@@ -0,0 +1,106 @@
1
+ #!/bin/bash
2
+ # PaperFit Installation Script
3
+ # Usage: ./install.sh [components...]
4
+ # Example: ./install.sh rules hooks agents
5
+
6
+ set -e
7
+
8
+ # Colors for output
9
+ RED='\033[0;31m'
10
+ GREEN='\033[0;32m'
11
+ YELLOW='\033[1;33m'
12
+ BLUE='\033[0;34m'
13
+ NC='\033[0m' # No Color
14
+
15
+ # Project root
16
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
17
+ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
18
+
19
+ echo -e "${BLUE}šŸš€ PaperFit Installation${NC}"
20
+ echo "========================"
21
+ echo ""
22
+
23
+ # Check Python
24
+ if ! command -v python3 &> /dev/null; then
25
+ echo -e "${RED}āŒ Python 3 not found. Please install Python 3.8+${NC}"
26
+ exit 1
27
+ fi
28
+ echo -e "${GREEN}āœ… Python 3: $(python3 --version)${NC}"
29
+
30
+ # Check pip
31
+ if ! command -v pip3 &> /dev/null; then
32
+ echo -e "${YELLOW}āš ļø pip3 not found. Attempting to install Python dependencies may fail.${NC}"
33
+ fi
34
+
35
+ # Install Python dependencies
36
+ echo ""
37
+ echo -e "${BLUE}šŸ“¦ Installing Python dependencies...${NC}"
38
+ if [ -f "$PROJECT_ROOT/requirements.txt" ]; then
39
+ pip3 install -r "$PROJECT_ROOT/requirements.txt"
40
+ echo -e "${GREEN}āœ… Python dependencies installed${NC}"
41
+ else
42
+ echo -e "${YELLOW}āš ļø requirements.txt not found. Skipping Python dependencies.${NC}"
43
+ fi
44
+
45
+ # Check system dependencies
46
+ echo ""
47
+ echo -e "${BLUE}šŸ” Checking system dependencies...${NC}"
48
+
49
+ # Check poppler
50
+ if command -v pdfinfo &> /dev/null; then
51
+ echo -e "${GREEN}āœ… Poppler utilities${NC}"
52
+ else
53
+ echo -e "${YELLOW}āš ļø Poppler not found. Install with: brew install poppler${NC}"
54
+ fi
55
+
56
+ # Check latexmk
57
+ if command -v latexmk &> /dev/null; then
58
+ echo -e "${GREEN}āœ… latexmk${NC}"
59
+ else
60
+ echo -e "${YELLOW}āš ļø latexmk not found. Install MacTeX or TeX Live${NC}"
61
+ fi
62
+
63
+ # Install rules (optional)
64
+ echo ""
65
+ read -p "Install rules to ~/.claude/rules? (y/n) " -n 1 -r
66
+ echo
67
+ if [[ $REPLY =~ ^[Yy]$ ]]; then
68
+ mkdir -p "$HOME/.claude/rules"
69
+ cp -r "$PROJECT_ROOT/rules" "$HOME/.claude/rules/" 2>/dev/null || {
70
+ cp -r "$SCRIPT_DIR/../rules" "$HOME/.claude/rules/" 2>/dev/null || {
71
+ echo -e "${YELLOW}āš ļø rules directory not found. Skipping.${NC}"
72
+ }
73
+ }
74
+ echo -e "${GREEN}āœ… Rules installed to ~/.claude/rules${NC}"
75
+ fi
76
+
77
+ # Install hooks (optional)
78
+ echo ""
79
+ echo -e "${BLUE}šŸŖ Configuring hooks...${NC}"
80
+ if [ -f "$PROJECT_ROOT/.claude/settings.json" ]; then
81
+ echo -e "${GREEN}āœ… Claude Code settings found${NC}"
82
+ else
83
+ echo -e "${YELLOW}āš ļø .claude/settings.json not found. Hooks will not be configured automatically.${NC}"
84
+ fi
85
+
86
+ # Create symlinks for global access
87
+ echo ""
88
+ read -p "Create global 'paperfit' command? (requires sudo) (y/n) " -n 1 -r
89
+ echo
90
+ if [[ $REPLY =~ ^[Yy]$ ]]; then
91
+ sudo ln -sf "$SCRIPT_DIR/paperfit" /usr/local/bin/paperfit 2>/dev/null || {
92
+ ln -sf "$SCRIPT_DIR/paperfit" ~/bin/paperfit 2>/dev/null || {
93
+ echo -e "${YELLOW}āš ļø Could not create symlink. Add $SCRIPT_DIR to PATH manually.${NC}"
94
+ }
95
+ }
96
+ echo -e "${GREEN}āœ… Global command installed${NC}"
97
+ fi
98
+
99
+ echo ""
100
+ echo -e "${GREEN}āœ… Installation complete!${NC}"
101
+ echo ""
102
+ echo "Next steps:"
103
+ echo " 1. Run: paperfit doctor"
104
+ echo " 2. Run: paperfit init"
105
+ echo " 3. Open your LaTeX project in Claude Code"
106
+ echo ""