argonctl 1.0.2 → 2.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # argonctl
1
+ # Argon CLI
2
2
 
3
- Git-like MongoDB branching for ML/AI workflows.
3
+ The official CLI for Argon — Git for MongoDB: branch, time-travel, merge and undo with real drivers and versioned history underneath.
4
4
 
5
5
  ## Installation
6
6
 
@@ -11,22 +11,22 @@ npm install -g argonctl
11
11
  ## Usage
12
12
 
13
13
  ```bash
14
- # Verify installation
15
- argon --version
14
+ # Enable time travel
15
+ export ENABLE_WAL=true
16
16
 
17
- # Create a project
18
- argon projects create --name my-project
17
+ # Create project
18
+ argon projects create my-app
19
19
 
20
- # List projects
21
- argon projects list
20
+ # Create instant branch
21
+ argon branches create feature-x
22
22
 
23
- # Get help
24
- argon --help
23
+ # Time travel queries
24
+ argon time-travel info --time "1h ago"
25
25
  ```
26
26
 
27
27
  ## Documentation
28
28
 
29
- Visit [https://github.com/argon-lab/argon](https://github.com/argon-lab/argon) for full documentation.
29
+ Full documentation: https://github.com/argon-lab/argon
30
30
 
31
31
  ## License
32
32
 
package/bin/argon.js ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+ // Thin launcher: the real binary is downloaded by scripts/install.js at
3
+ // install time (per platform). npm requires bin targets to exist inside
4
+ // the published tarball, so the entry point is this wrapper, not the
5
+ // binary itself.
6
+
7
+ const { spawnSync } = require('child_process');
8
+ const path = require('path');
9
+ const fs = require('fs');
10
+
11
+ const binaryName = process.platform === 'win32' ? 'argon-bin.exe' : 'argon-bin';
12
+ const binaryPath = path.join(__dirname, binaryName);
13
+
14
+ if (!fs.existsSync(binaryPath)) {
15
+ console.error('The Argon binary is missing. Reinstall with: npm install -g argonctl');
16
+ console.error('(The installer downloads it from https://github.com/argon-lab/argon/releases)');
17
+ process.exit(1);
18
+ }
19
+
20
+ const result = spawnSync(binaryPath, process.argv.slice(2), { stdio: 'inherit' });
21
+ process.exit(result.status === null ? 1 : result.status);
package/package.json CHANGED
@@ -1,37 +1,42 @@
1
1
  {
2
2
  "name": "argonctl",
3
- "version": "1.0.2",
4
- "description": "Git-like MongoDB branching for ML/AI workflows",
5
- "main": "index.js",
6
- "bin": {
7
- "argon": "./bin/argon",
8
- "argonctl": "./bin/argon"
9
- },
10
- "scripts": {
11
- "postinstall": "node install.js",
12
- "test": "echo \"Error: no test specified\" && exit 1"
13
- },
14
- "repository": {
15
- "type": "git",
16
- "url": "git+https://github.com/argon-lab/argon.git"
17
- },
3
+ "version": "2.0.0",
4
+ "description": "Git for MongoDB: branch, time-travel, merge and undo - CLI",
18
5
  "keywords": [
19
6
  "mongodb",
20
- "branching",
21
7
  "database",
8
+ "branching",
9
+ "time-travel",
22
10
  "ml",
23
11
  "ai",
24
- "data-science",
25
12
  "cli"
26
13
  ],
27
- "author": "Argon Lab",
28
- "license": "MIT",
14
+ "homepage": "https://github.com/argon-lab/argon",
29
15
  "bugs": {
30
16
  "url": "https://github.com/argon-lab/argon/issues"
31
17
  },
32
- "homepage": "https://github.com/argon-lab/argon#readme",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/argon-lab/argon.git"
21
+ },
22
+ "license": "MIT",
23
+ "author": "Argon Lab",
24
+ "main": "index.js",
25
+ "bin": {
26
+ "argon": "bin/argon.js",
27
+ "argonctl": "bin/argon.js"
28
+ },
29
+ "files": [
30
+ "bin/",
31
+ "scripts/",
32
+ "README.md"
33
+ ],
34
+ "scripts": {
35
+ "postinstall": "node scripts/install.js",
36
+ "preuninstall": "node scripts/uninstall.js"
37
+ },
33
38
  "engines": {
34
- "node": ">=16"
39
+ "node": ">=14.0.0"
35
40
  },
36
41
  "os": [
37
42
  "darwin",
@@ -41,10 +46,5 @@
41
46
  "cpu": [
42
47
  "x64",
43
48
  "arm64"
44
- ],
45
- "files": [
46
- "bin/",
47
- "install.js",
48
- "README.md"
49
49
  ]
50
50
  }
@@ -0,0 +1,100 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const https = require('https');
6
+ const { execSync } = require('child_process');
7
+
8
+ const version = require('../package.json').version;
9
+
10
+ // Platform mapping
11
+ const PLATFORM_MAP = {
12
+ 'darwin-x64': 'darwin-amd64',
13
+ 'darwin-arm64': 'darwin-arm64',
14
+ 'linux-x64': 'linux-amd64',
15
+ 'linux-arm64': 'linux-arm64',
16
+ 'win32-x64': 'windows-amd64',
17
+ };
18
+
19
+ function getPlatform() {
20
+ const platform = `${process.platform}-${process.arch}`;
21
+ if (!PLATFORM_MAP[platform]) {
22
+ throw new Error(`Unsupported platform: ${platform}`);
23
+ }
24
+ return PLATFORM_MAP[platform];
25
+ }
26
+
27
+ function getBinaryName() {
28
+ // The wrapper bin/argon.js execs this; distinct from the wrapper name.
29
+ return process.platform === 'win32' ? 'argon-bin.exe' : 'argon-bin';
30
+ }
31
+
32
+ function downloadBinary(url, dest) {
33
+ return new Promise((resolve, reject) => {
34
+ const file = fs.createWriteStream(dest);
35
+ https.get(url, (response) => {
36
+ if (response.statusCode === 302 || response.statusCode === 301) {
37
+ // Follow redirect
38
+ https.get(response.headers.location, (redirectResponse) => {
39
+ redirectResponse.pipe(file);
40
+ file.on('finish', () => {
41
+ file.close(resolve);
42
+ });
43
+ }).on('error', reject);
44
+ } else if (response.statusCode === 200) {
45
+ response.pipe(file);
46
+ file.on('finish', () => {
47
+ file.close(resolve);
48
+ });
49
+ } else {
50
+ reject(new Error(`Failed to download: ${response.statusCode}`));
51
+ }
52
+ }).on('error', reject);
53
+ });
54
+ }
55
+
56
+ async function install() {
57
+ try {
58
+ const platform = getPlatform();
59
+ const binaryName = getBinaryName();
60
+ const assetName = process.platform === 'win32' ? `argon-${platform}.exe` : `argon-${platform}`;
61
+ const downloadUrl = `https://github.com/argon-lab/argon/releases/download/v${version}/${assetName}`;
62
+
63
+ const binDir = path.join(__dirname, '..', 'bin');
64
+ const binaryPath = path.join(binDir, binaryName);
65
+
66
+ // Create bin directory
67
+ if (!fs.existsSync(binDir)) {
68
+ fs.mkdirSync(binDir, { recursive: true });
69
+ }
70
+
71
+ console.log(`Downloading Argon CLI v${version} for ${platform}...`);
72
+ console.log(`From: ${downloadUrl}`);
73
+
74
+ await downloadBinary(downloadUrl, binaryPath);
75
+
76
+ // Make binary executable on Unix-like systems
77
+ if (process.platform !== 'win32') {
78
+ fs.chmodSync(binaryPath, '755');
79
+ }
80
+
81
+ // Verify installation
82
+ try {
83
+ const output = execSync(`"${binaryPath}" --version`, { encoding: 'utf8' });
84
+ console.log('✅ Argon CLI installed successfully!');
85
+ console.log(output.trim());
86
+ } catch (e) {
87
+ console.error('⚠️ Binary downloaded but verification failed');
88
+ console.error('Please check if the binary is working correctly');
89
+ }
90
+
91
+ } catch (error) {
92
+ console.error('Failed to install Argon CLI:', error.message);
93
+ console.error('\nYou can manually download from:');
94
+ console.error('https://github.com/argon-lab/argon/releases');
95
+ process.exit(1);
96
+ }
97
+ }
98
+
99
+ // Run installation
100
+ install();
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ console.log('Cleaning up Argon CLI...');
7
+
8
+ const binDir = path.join(__dirname, '..', 'bin');
9
+ if (fs.existsSync(binDir)) {
10
+ fs.rmSync(binDir, { recursive: true, force: true });
11
+ console.log('✅ Argon CLI removed');
12
+ }
package/install.js DELETED
@@ -1,117 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
- const https = require('https');
6
- const { execSync } = require('child_process');
7
-
8
- const GITHUB_REPO = 'argon-lab/argon';
9
- const VERSION = '1.0.0'; // Use fixed version since that's where binaries are
10
-
11
- function getPlatform() {
12
- const platform = process.platform;
13
- const arch = process.arch;
14
-
15
- let platformName;
16
- switch (platform) {
17
- case 'darwin':
18
- platformName = 'darwin';
19
- break;
20
- case 'linux':
21
- platformName = 'linux';
22
- break;
23
- case 'win32':
24
- platformName = 'windows';
25
- break;
26
- default:
27
- throw new Error(`Unsupported platform: ${platform}`);
28
- }
29
-
30
- let archName;
31
- switch (arch) {
32
- case 'x64':
33
- archName = 'amd64';
34
- break;
35
- case 'arm64':
36
- archName = 'arm64';
37
- break;
38
- default:
39
- throw new Error(`Unsupported architecture: ${arch}`);
40
- }
41
-
42
- return `${platformName}-${archName}`;
43
- }
44
-
45
- function downloadBinary() {
46
- const platform = getPlatform();
47
- const binaryName = platform === 'windows-amd64' ? 'argon.exe' : 'argon';
48
- const downloadUrl = `https://github.com/${GITHUB_REPO}/releases/download/v${VERSION}/argon-${platform}${platform.includes('windows') ? '.exe' : ''}`;
49
-
50
- const binDir = path.join(__dirname, 'bin');
51
- const binaryPath = path.join(binDir, binaryName);
52
-
53
- // Create bin directory
54
- if (!fs.existsSync(binDir)) {
55
- fs.mkdirSync(binDir, { recursive: true });
56
- }
57
-
58
- console.log(`Downloading Argon CLI for ${platform}...`);
59
- console.log(`URL: ${downloadUrl}`);
60
-
61
- return new Promise((resolve, reject) => {
62
- const file = fs.createWriteStream(binaryPath);
63
-
64
- function handleResponse(response) {
65
- // Handle redirects
66
- if (response.statusCode === 302 || response.statusCode === 301) {
67
- const redirectUrl = response.headers.location;
68
- console.log(`Following redirect to: ${redirectUrl}`);
69
- const url = require('url');
70
- const parsed = url.parse(redirectUrl);
71
- const client = parsed.protocol === 'https:' ? https : require('http');
72
-
73
- client.get(redirectUrl, handleResponse).on('error', (err) => {
74
- fs.unlink(binaryPath, () => {}); // Delete partial file
75
- reject(err);
76
- });
77
- return;
78
- }
79
-
80
- if (response.statusCode !== 200) {
81
- reject(new Error(`Failed to download binary: HTTP ${response.statusCode}`));
82
- return;
83
- }
84
-
85
- response.pipe(file);
86
-
87
- file.on('finish', () => {
88
- file.close();
89
-
90
- // Make binary executable on Unix systems
91
- if (process.platform !== 'win32') {
92
- try {
93
- fs.chmodSync(binaryPath, '755');
94
- } catch (err) {
95
- console.warn('Warning: Could not make binary executable:', err.message);
96
- }
97
- }
98
-
99
- console.log('Argon CLI installed successfully!');
100
- console.log('Run "argon --version" to verify installation.');
101
- resolve();
102
- });
103
- }
104
-
105
- https.get(downloadUrl, handleResponse).on('error', (err) => {
106
- fs.unlink(binaryPath, () => {}); // Delete partial file
107
- reject(err);
108
- });
109
- });
110
- }
111
-
112
- // Install binary
113
- downloadBinary().catch((err) => {
114
- console.error('Installation failed:', err.message);
115
- console.error('Please install manually from: https://github.com/argon-lab/argon/releases');
116
- process.exit(1);
117
- });