Restructured project from nested workspace pattern to flat single-repo layout. This eliminates redundant nesting and consolidates all project files under version control. ## Migration Summary **Before:** ``` alex/ (workspace, not versioned) ├── chess-game/ (git repo) │ ├── js/, css/, tests/ │ └── index.html └── docs/ (planning, not versioned) ``` **After:** ``` alex/ (git repo, everything versioned) ├── js/, css/, tests/ ├── index.html ├── docs/ (project documentation) ├── planning/ (historical planning docs) ├── .gitea/ (CI/CD) └── CLAUDE.md (configuration) ``` ## Changes Made ### Structure Consolidation - Moved all chess-game/ contents to root level - Removed redundant chess-game/ subdirectory - Flattened directory structure (eliminated one nesting level) ### Documentation Organization - Moved chess-game/docs/ → docs/ (project documentation) - Moved alex/docs/ → planning/ (historical planning documents) - Added CLAUDE.md (workspace configuration) - Added IMPLEMENTATION_PROMPT.md (original project prompt) ### Version Control Improvements - All project files now under version control - Planning documents preserved in planning/ folder - Merged .gitignore files (workspace + project) - Added .claude/ agent configurations ### File Updates - Updated .gitignore to include both workspace and project excludes - Moved README.md to root level - All import paths remain functional (relative paths unchanged) ## Benefits ✅ **Simpler Structure** - One level of nesting removed ✅ **Complete Versioning** - All documentation now in git ✅ **Standard Layout** - Matches open-source project conventions ✅ **Easier Navigation** - Direct access to all project files ✅ **CI/CD Compatible** - All workflows still functional ## Technical Validation - ✅ Node.js environment verified - ✅ Dependencies installed successfully - ✅ Dev server starts and responds - ✅ All core files present and accessible - ✅ Git repository functional ## Files Preserved **Implementation Files:** - js/ (3,517 lines of code) - css/ (4 stylesheets) - tests/ (87 test cases) - index.html - package.json **CI/CD Pipeline:** - .gitea/workflows/ci.yml - .gitea/workflows/release.yml **Documentation:** - docs/ (12+ documentation files) - planning/ (historical planning materials) - README.md **Configuration:** - jest.config.js, babel.config.cjs, playwright.config.js - .gitignore (merged) - CLAUDE.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
107 lines
2.9 KiB
JavaScript
Executable File
107 lines
2.9 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Safe GitHub CLI Helper
|
|
* Prevents timeout issues when using gh commands with special characters
|
|
*
|
|
* Usage:
|
|
* ./github-safe.js issue comment 123 "Message with `backticks`"
|
|
* ./github-safe.js pr create --title "Title" --body "Complex body"
|
|
*/
|
|
|
|
import { execSync } from 'child_process';
|
|
import { writeFileSync, unlinkSync } from 'fs';
|
|
import { tmpdir } from 'os';
|
|
import { join } from 'path';
|
|
import { randomBytes } from 'crypto';
|
|
|
|
const args = process.argv.slice(2);
|
|
|
|
if (args.length < 2) {
|
|
console.log(`
|
|
Safe GitHub CLI Helper
|
|
|
|
Usage:
|
|
./github-safe.js issue comment <number> <body>
|
|
./github-safe.js pr comment <number> <body>
|
|
./github-safe.js issue create --title <title> --body <body>
|
|
./github-safe.js pr create --title <title> --body <body>
|
|
|
|
This helper prevents timeout issues with special characters like:
|
|
- Backticks in code examples
|
|
- Command substitution \$(...)
|
|
- Directory paths
|
|
- Special shell characters
|
|
`);
|
|
process.exit(1);
|
|
}
|
|
|
|
const [command, subcommand, ...restArgs] = args;
|
|
|
|
// Handle commands that need body content
|
|
if ((command === 'issue' || command === 'pr') &&
|
|
(subcommand === 'comment' || subcommand === 'create')) {
|
|
|
|
let bodyIndex = -1;
|
|
let body = '';
|
|
|
|
if (subcommand === 'comment' && restArgs.length >= 2) {
|
|
// Simple format: github-safe.js issue comment 123 "body"
|
|
body = restArgs[1];
|
|
bodyIndex = 1;
|
|
} else {
|
|
// Flag format: --body "content"
|
|
bodyIndex = restArgs.indexOf('--body');
|
|
if (bodyIndex !== -1 && bodyIndex < restArgs.length - 1) {
|
|
body = restArgs[bodyIndex + 1];
|
|
}
|
|
}
|
|
|
|
if (body) {
|
|
// Use temporary file for body content
|
|
const tmpFile = join(tmpdir(), `gh-body-${randomBytes(8).toString('hex')}.tmp`);
|
|
|
|
try {
|
|
writeFileSync(tmpFile, body, 'utf8');
|
|
|
|
// Build new command with --body-file
|
|
const newArgs = [...restArgs];
|
|
if (subcommand === 'comment' && bodyIndex === 1) {
|
|
// Replace body with --body-file
|
|
newArgs[1] = '--body-file';
|
|
newArgs.push(tmpFile);
|
|
} else if (bodyIndex !== -1) {
|
|
// Replace --body with --body-file
|
|
newArgs[bodyIndex] = '--body-file';
|
|
newArgs[bodyIndex + 1] = tmpFile;
|
|
}
|
|
|
|
// Execute safely
|
|
const ghCommand = `gh ${command} ${subcommand} ${newArgs.join(' ')}`;
|
|
console.log(`Executing: ${ghCommand}`);
|
|
|
|
const result = execSync(ghCommand, {
|
|
stdio: 'inherit',
|
|
timeout: 30000 // 30 second timeout
|
|
});
|
|
|
|
} catch (error) {
|
|
console.error('Error:', error.message);
|
|
process.exit(1);
|
|
} finally {
|
|
// Clean up
|
|
try {
|
|
unlinkSync(tmpFile);
|
|
} catch (e) {
|
|
// Ignore cleanup errors
|
|
}
|
|
}
|
|
} else {
|
|
// No body content, execute normally
|
|
execSync(`gh ${args.join(' ')}`, { stdio: 'inherit' });
|
|
}
|
|
} else {
|
|
// Other commands, execute normally
|
|
execSync(`gh ${args.join(' ')}`, { stdio: 'inherit' });
|
|
}
|