UNPKG

claudes-office

Version:

CLI tool to initialize Claude's office in your project

71 lines (58 loc) 2.66 kB
#!/usr/bin/env node const fs = require('fs-extra'); const path = require('path'); const os = require('os'); const { spawnSync } = require('child_process'); const chalk = require('chalk'); async function debugInstallation() { try { // Create a temporary test directory const testDir = path.join(os.tmpdir(), `claudes-office-debug-${Date.now()}`); await fs.ensureDir(testDir); console.log(chalk.blue(`Created test directory: ${testDir}`)); // Create a dummy package.json in the test directory await fs.writeJson(path.join(testDir, 'package.json'), { name: 'debug-project', version: '1.0.0' }); // Run the CLI command in the test directory with debug flags console.log(chalk.blue('Running the CLI command with debugging...')); const cliPath = path.join(__dirname, 'bin', 'claudes-office'); // Run the command synchronously to see all output const result = spawnSync('node', ['--trace-warnings', cliPath, 'init', '--force', '--no-interactive'], { cwd: testDir, stdio: 'inherit', env: { ...process.env, DEBUG: '*' } }); // Log the exit code console.log(chalk.cyan(`Command exited with code: ${result.status}`)); // Check if the docs directory was created properly const docsPath = path.join(testDir, 'claudes-office', 'references', 'docs'); if (await fs.pathExists(docsPath)) { console.log(chalk.green(`✓ The docs directory was created at: ${docsPath}`)); // Check for files in the docs directory const files = await fs.readdir(docsPath); console.log(chalk.cyan(`Files in docs directory: ${files.join(', ') || 'No files'}`)); } else { console.log(chalk.red(`✗ The docs directory does not exist at: ${docsPath}`)); } // Check references directory const referencesPath = path.join(testDir, 'claudes-office', 'references'); if (await fs.pathExists(referencesPath)) { console.log(chalk.green(`✓ The references directory was created at: ${referencesPath}`)); // List all files in references const refFiles = await fs.readdir(referencesPath); console.log(chalk.cyan(`Files/dirs in references directory: ${refFiles.join(', ')}`)); } // Keep the test directory for manual inspection console.log(chalk.yellow(`\nTest directory has been kept for inspection: ${testDir}`)); console.log(chalk.yellow('Please delete it manually when you are done.')); } catch (error) { console.error(chalk.red('Debug process failed with error:'), error); } } // Run the debug process debugInstallation();