@ghyper9023/oy 0.1.2 → 0.2.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/bin/install.js CHANGED
@@ -7,17 +7,14 @@ const { https } = require('follow-redirects');
7
7
 
8
8
  const pkgJson = require('../package.json');
9
9
  const version = pkgJson.version;
10
-
11
- // 从 repository.url 中提取 "owner/repo"
12
10
  const repoUrl = pkgJson.repository && pkgJson.repository.url;
13
11
  if (!repoUrl) {
14
- console.error('package.json repository.url ');
12
+ console.error('Missing repository.url in package.json');
15
13
  process.exit(1);
16
14
  }
17
-
18
15
  const match = repoUrl.match(/github\.com[\/:]([^\/]+\/[^\/]+)(\.git)?$/);
19
16
  if (!match) {
20
- console.error(` repository.url owner/repo: ${repoUrl}`);
17
+ console.error(`Failed to parse owner/repo from repository.url: ${repoUrl}`);
21
18
  process.exit(1);
22
19
  }
23
20
  const repo = match[1];
@@ -26,14 +23,36 @@ const tag = `v${version}`;
26
23
  function getPlatformAsset() {
27
24
  const platform = os.platform();
28
25
  const arch = os.arch();
29
- if (platform === 'linux' && arch === 'x64') {
30
- return 'oy-x86_64-unknown-linux-gnu';
31
- } else if (platform === 'darwin' && arch === 'arm64') {
32
- return 'oy-aarch64-apple-darwin';
33
- } else if (platform === 'win32' && arch === 'x64') {
34
- return 'oy-x86_64-pc-windows-msvc.exe';
26
+ console.log(`Detected platform: ${platform}, arch: ${arch}`);
27
+
28
+ if (platform === 'win32') {
29
+ // Windows: currently only x64 builds are provided.
30
+ if (arch === 'x64' || arch === 'ia32' || arch === 'arm64') {
31
+ console.log('Using Windows x64 binary (compatible with all Windows architectures)');
32
+ return 'oy-x86_64-pc-windows-msvc.exe';
33
+ } else {
34
+ throw new Error(`Unsupported Windows architecture: ${arch}`);
35
+ }
36
+ } else if (platform === 'linux') {
37
+ if (arch === 'x64') {
38
+ return 'oy-x86_64-unknown-linux-gnu';
39
+ } else if (arch === 'arm64') {
40
+ // Placeholder if you build for Linux ARM64 in the future
41
+ throw new Error('Linux ARM64 is not yet supported');
42
+ } else {
43
+ throw new Error(`Unsupported Linux architecture: ${arch}`);
44
+ }
45
+ } else if (platform === 'darwin') {
46
+ if (arch === 'arm64') {
47
+ return 'oy-aarch64-apple-darwin';
48
+ } else if (arch === 'x64') {
49
+ // If you build Intel macOS binaries, add them here
50
+ throw new Error('macOS x64 is not yet supported');
51
+ } else {
52
+ throw new Error(`Unsupported macOS architecture: ${arch}`);
53
+ }
35
54
  } else {
36
- throw new Error(`Unsupported platform: ${platform} ${arch}`);
55
+ throw new Error(`Unsupported platform: ${platform}`);
37
56
  }
38
57
  }
39
58
 
@@ -61,4 +80,4 @@ https.get(url, (response) => {
61
80
  }).on('error', (err) => {
62
81
  console.error(err);
63
82
  process.exit(1);
64
- });
83
+ });
package/bin/oy-wrapper.js CHANGED
@@ -1,11 +1,9 @@
1
1
  #!/usr/bin/env node
2
-
3
2
  const { spawn } = require('child_process');
4
3
  const path = require('path');
5
4
  const os = require('os');
6
5
 
7
6
  const exePath = path.join(__dirname, 'native', os.platform() === 'win32' ? 'oy.exe' : 'oy');
8
7
  const args = process.argv.slice(2);
9
-
10
8
  const child = spawn(exePath, args, { stdio: 'inherit' });
11
- child.on('exit', (code) => process.exit(code));
9
+ child.on('exit', (code) => process.exit(code));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ghyper9023/oy",
3
- "version": "0.1.2",
4
- "description": "Ai-Agent CLI tool named oy",
3
+ "version": "0.2.1",
4
+ "description": "AI-Agent CLI tool named oy",
5
5
  "bin": {
6
6
  "oy": "bin/oy-wrapper.js"
7
7
  },
@@ -9,7 +9,8 @@
9
9
  "follow-redirects": "^1.16.0"
10
10
  },
11
11
  "publishConfig": {
12
- "access": "public"
12
+ "access": "public",
13
+ "provenance": true
13
14
  },
14
15
  "scripts": {
15
16
  "postinstall": "node bin/install.js"
@@ -17,14 +18,15 @@
17
18
  "files": [
18
19
  "bin"
19
20
  ],
20
- "keywords": [
21
- "cli",
22
- "oy"
23
- ],
21
+ "keywords": ["cli", "oy"],
24
22
  "author": "Your Name",
25
23
  "license": "MIT",
26
24
  "repository": {
27
25
  "type": "git",
28
- "url": "https://github.com/cherish-ltt/oy"
26
+ "url": "git+https://github.com/cherish-ltt/oy"
27
+ },
28
+ "homepage": "https://github.com/cherish-ltt/oy#readme",
29
+ "bugs": {
30
+ "url": "https://github.com/cherish-ltt/oy/issues"
29
31
  }
30
32
  }
package/bin/native/oy DELETED
Binary file