omni-context-cli 0.0.9 → 0.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-context-cli",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "Omx is a small, helpful, zero-telemetry coding assistant.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,7 +12,8 @@
12
12
  "dev": "node build.mjs --watch",
13
13
  "start": "node dist/cli.js",
14
14
  "format": "dprint fmt",
15
- "format:check": "dprint check"
15
+ "format:check": "dprint check",
16
+ "postinstall": "node scripts/fix-bin-permissions.js"
16
17
  },
17
18
  "keywords": [
18
19
  "cli",
@@ -22,7 +23,8 @@
22
23
  "author": "bluenoah1991",
23
24
  "license": "MIT",
24
25
  "files": [
25
- "dist"
26
+ "dist",
27
+ "scripts"
26
28
  ],
27
29
  "dependencies": {
28
30
  "figlet": "^1.8.0"
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { chmodSync, existsSync, readdirSync, statSync } from 'fs';
4
+ import { dirname, join } from 'path';
5
+ import { fileURLToPath } from 'url';
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const binDir = join(__dirname, '..', 'dist', 'bin');
9
+
10
+ if (!existsSync(binDir)) {
11
+ process.exit(0);
12
+ }
13
+
14
+ function fixPermissions(dir) {
15
+ const files = readdirSync(dir);
16
+ for (const file of files) {
17
+ const filePath = join(dir, file);
18
+ const stat = statSync(filePath);
19
+
20
+ if (stat.isDirectory()) {
21
+ fixPermissions(filePath);
22
+ } else if (stat.isFile()) {
23
+ if (!file.includes('.') || file.endsWith('.exe')) {
24
+ chmodSync(filePath, 0o755);
25
+ }
26
+ }
27
+ }
28
+ }
29
+
30
+ try {
31
+ fixPermissions(binDir);
32
+ } catch (err) {
33
+ process.exit(0);
34
+ }