codrsync 1.0.1

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 ADDED
@@ -0,0 +1,61 @@
1
+ # codrsync
2
+
3
+ Your AI's AI — Context engineering that makes Claude, GPT & Gemini 10x smarter.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g codrsync
9
+ ```
10
+
11
+ This will automatically install the Python package via pipx/pip.
12
+
13
+ ### Requirements
14
+
15
+ - Node.js 16+
16
+ - Python 3.10+
17
+
18
+ ## Quick Start
19
+
20
+ ```bash
21
+ codrsync --help # Show available commands
22
+ codrsync init # Initialize a new project
23
+ codrsync scan # Scan existing project
24
+ codrsync start # Start superego mode
25
+ ```
26
+
27
+ ## Configure AI
28
+
29
+ ```bash
30
+ # Option 1: Login to codrsync cloud
31
+ codrsync auth --cloud
32
+
33
+ # Option 2: Use your own API key
34
+ export ANTHROPIC_API_KEY="your-key"
35
+ ```
36
+
37
+ ## Alternative Installation
38
+
39
+ If npm installation fails, you can install directly via pip:
40
+
41
+ ```bash
42
+ # Using pipx (recommended)
43
+ pipx install codrsync
44
+
45
+ # Using pip
46
+ pip install codrsync
47
+
48
+ # Using Homebrew (macOS)
49
+ brew install ciroarendt/codrsync/codrsync
50
+
51
+ # Using install script
52
+ curl -fsSL https://codrsync.dev/install.sh | bash
53
+ ```
54
+
55
+ ## Documentation
56
+
57
+ Visit [codrsync.dev](https://codrsync.dev) for full documentation.
58
+
59
+ ## License
60
+
61
+ MIT
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * codrsync npm wrapper
5
+ *
6
+ * This is a thin wrapper that calls the Python codrsync CLI.
7
+ * The actual codrsync is installed via pip/pipx during npm postinstall.
8
+ */
9
+
10
+ const { spawn } = require('child_process');
11
+ const path = require('path');
12
+
13
+ // Possible locations for codrsync
14
+ const possiblePaths = [
15
+ 'codrsync', // In PATH
16
+ path.join(process.env.HOME || '', '.local', 'bin', 'codrsync'), // pipx default
17
+ path.join(process.env.HOME || '', 'Library', 'Python', '3.11', 'bin', 'codrsync'), // macOS pip
18
+ path.join(process.env.HOME || '', 'Library', 'Python', '3.12', 'bin', 'codrsync'), // macOS pip
19
+ ];
20
+
21
+ function findCodrsync() {
22
+ const { execSync } = require('child_process');
23
+
24
+ // First try which/where
25
+ try {
26
+ const result = execSync('which codrsync 2>/dev/null || where codrsync 2>nul', {
27
+ encoding: 'utf8',
28
+ }).trim();
29
+ if (result) return result.split('\n')[0];
30
+ } catch (e) {
31
+ // Not in PATH, check other locations
32
+ }
33
+
34
+ // Check known locations
35
+ const fs = require('fs');
36
+ for (const p of possiblePaths) {
37
+ if (p !== 'codrsync' && fs.existsSync(p)) {
38
+ return p;
39
+ }
40
+ }
41
+
42
+ return null;
43
+ }
44
+
45
+ function main() {
46
+ const codrsyncPath = findCodrsync();
47
+
48
+ if (!codrsyncPath) {
49
+ console.error('\x1b[31m[error]\x1b[0m codrsync not found.');
50
+ console.error('');
51
+ console.error('The Python package may not have installed correctly.');
52
+ console.error('Please try installing manually:');
53
+ console.error('');
54
+ console.error(' pipx install codrsync');
55
+ console.error(' # or');
56
+ console.error(' pip install codrsync');
57
+ console.error('');
58
+ process.exit(1);
59
+ }
60
+
61
+ // Pass all arguments to the real codrsync
62
+ const args = process.argv.slice(2);
63
+ const child = spawn(codrsyncPath, args, {
64
+ stdio: 'inherit',
65
+ env: process.env,
66
+ });
67
+
68
+ child.on('error', (err) => {
69
+ console.error(`\x1b[31m[error]\x1b[0m Failed to run codrsync: ${err.message}`);
70
+ process.exit(1);
71
+ });
72
+
73
+ child.on('close', (code) => {
74
+ process.exit(code || 0);
75
+ });
76
+ }
77
+
78
+ main();
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "codrsync",
3
+ "version": "1.0.1",
4
+ "description": "Your AI's AI — Context engineering that makes Claude, GPT & Gemini 10x smarter",
5
+ "keywords": [
6
+ "ai",
7
+ "cli",
8
+ "developer-tools",
9
+ "claude",
10
+ "gpt",
11
+ "gemini",
12
+ "coding-assistant",
13
+ "context-engineering",
14
+ "anthropic",
15
+ "openai"
16
+ ],
17
+ "homepage": "https://codrsync.dev",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/ciroarendt/CE-context-engineering.git"
21
+ },
22
+ "bugs": {
23
+ "url": "https://github.com/ciroarendt/CE-context-engineering/issues"
24
+ },
25
+ "license": "MIT",
26
+ "author": "Ciro Arendt <ciro@codrsync.dev>",
27
+ "bin": {
28
+ "codrsync": "./bin/codrsync.js"
29
+ },
30
+ "scripts": {
31
+ "postinstall": "node ./scripts/postinstall.js"
32
+ },
33
+ "engines": {
34
+ "node": ">=16.0.0"
35
+ },
36
+ "os": [
37
+ "darwin",
38
+ "linux"
39
+ ],
40
+ "files": [
41
+ "bin",
42
+ "scripts",
43
+ "README.md"
44
+ ]
45
+ }
@@ -0,0 +1,136 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync, spawn } = require('child_process');
4
+ const os = require('os');
5
+ const fs = require('fs');
6
+ const path = require('path');
7
+
8
+ const PACKAGE_NAME = 'codrsync';
9
+ const MIN_PYTHON_VERSION = [3, 10];
10
+
11
+ // Colors
12
+ const colors = {
13
+ reset: '\x1b[0m',
14
+ green: '\x1b[32m',
15
+ yellow: '\x1b[33m',
16
+ red: '\x1b[31m',
17
+ cyan: '\x1b[36m',
18
+ bold: '\x1b[1m',
19
+ };
20
+
21
+ const log = {
22
+ info: (msg) => console.log(`${colors.cyan}[info]${colors.reset} ${msg}`),
23
+ success: (msg) => console.log(`${colors.green}[ok]${colors.reset} ${msg}`),
24
+ warn: (msg) => console.log(`${colors.yellow}[warn]${colors.reset} ${msg}`),
25
+ error: (msg) => console.error(`${colors.red}[error]${colors.reset} ${msg}`),
26
+ };
27
+
28
+ function execCommand(cmd, options = {}) {
29
+ try {
30
+ return execSync(cmd, { encoding: 'utf8', stdio: 'pipe', ...options }).trim();
31
+ } catch (e) {
32
+ return null;
33
+ }
34
+ }
35
+
36
+ function commandExists(cmd) {
37
+ const check = os.platform() === 'win32' ? `where ${cmd}` : `which ${cmd}`;
38
+ return execCommand(check) !== null;
39
+ }
40
+
41
+ function getPythonVersion() {
42
+ const pythonCmds = ['python3', 'python'];
43
+
44
+ for (const cmd of pythonCmds) {
45
+ if (commandExists(cmd)) {
46
+ const version = execCommand(`${cmd} -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')" 2>/dev/null`);
47
+ if (version) {
48
+ const [major, minor] = version.split('.').map(Number);
49
+ if (major >= MIN_PYTHON_VERSION[0] && minor >= MIN_PYTHON_VERSION[1]) {
50
+ return { cmd, version, major, minor };
51
+ }
52
+ }
53
+ }
54
+ }
55
+ return null;
56
+ }
57
+
58
+ function installWithPipx(pythonInfo) {
59
+ log.info('Checking for pipx...');
60
+
61
+ if (!commandExists('pipx')) {
62
+ log.info('Installing pipx...');
63
+ try {
64
+ execSync(`${pythonInfo.cmd} -m pip install --user pipx`, { stdio: 'inherit' });
65
+ execSync(`${pythonInfo.cmd} -m pipx ensurepath`, { stdio: 'pipe' });
66
+ } catch (e) {
67
+ log.warn('Could not install pipx, falling back to pip');
68
+ return false;
69
+ }
70
+ }
71
+
72
+ log.info(`Installing ${PACKAGE_NAME} with pipx...`);
73
+ try {
74
+ // Check if already installed
75
+ const installed = execCommand(`pipx list | grep ${PACKAGE_NAME}`);
76
+ if (installed) {
77
+ log.info('Upgrading existing installation...');
78
+ execSync(`pipx upgrade ${PACKAGE_NAME}`, { stdio: 'inherit' });
79
+ } else {
80
+ execSync(`pipx install ${PACKAGE_NAME}`, { stdio: 'inherit' });
81
+ }
82
+ return true;
83
+ } catch (e) {
84
+ return false;
85
+ }
86
+ }
87
+
88
+ function installWithPip(pythonInfo) {
89
+ log.info(`Installing ${PACKAGE_NAME} with pip...`);
90
+ try {
91
+ execSync(`${pythonInfo.cmd} -m pip install --user ${PACKAGE_NAME}`, { stdio: 'inherit' });
92
+ return true;
93
+ } catch (e) {
94
+ return false;
95
+ }
96
+ }
97
+
98
+ function main() {
99
+ console.log('');
100
+ console.log(`${colors.bold}${colors.cyan}Installing codrsync...${colors.reset}`);
101
+ console.log('');
102
+
103
+ // Check Python
104
+ const pythonInfo = getPythonVersion();
105
+ if (!pythonInfo) {
106
+ log.error(`Python ${MIN_PYTHON_VERSION.join('.')}+ is required but not found.`);
107
+ log.info('Please install Python first: https://python.org');
108
+ process.exit(1);
109
+ }
110
+
111
+ log.success(`Python ${pythonInfo.version} found (${pythonInfo.cmd})`);
112
+
113
+ // Try pipx first, then pip
114
+ let success = installWithPipx(pythonInfo);
115
+ if (!success) {
116
+ success = installWithPip(pythonInfo);
117
+ }
118
+
119
+ if (!success) {
120
+ log.error('Installation failed. Please try manually:');
121
+ log.info(' pip install codrsync');
122
+ log.info(' or');
123
+ log.info(' pipx install codrsync');
124
+ process.exit(1);
125
+ }
126
+
127
+ console.log('');
128
+ log.success(`${PACKAGE_NAME} installed successfully!`);
129
+ console.log('');
130
+ console.log(` ${colors.bold}Quick start:${colors.reset}`);
131
+ console.log(` ${colors.cyan}codrsync --help${colors.reset} Show available commands`);
132
+ console.log(` ${colors.cyan}codrsync init${colors.reset} Initialize a new project`);
133
+ console.log('');
134
+ }
135
+
136
+ main();