@grepai/cli 0.2.20 → 0.3.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/bin/.gitkeep ADDED
File without changes
package/install.js ADDED
@@ -0,0 +1,93 @@
1
+ const { existsSync, symlinkSync, mkdirSync, chmodSync } = require('fs')
2
+ const { execSync } = require('child_process')
3
+ const path = require('path')
4
+
5
+ function detectLibc() {
6
+ if (process.platform !== 'linux') {
7
+ return null
8
+ }
9
+
10
+ if (process.report?.getReport()?.header?.glibcVersionRuntime) {
11
+ return 'glibc'
12
+ }
13
+
14
+ try {
15
+ const ldd = execSync('ldd --version 2>&1', { encoding: 'utf8' })
16
+ if (/musl/i.test(ldd)) {
17
+ return 'musl'
18
+ }
19
+ if (/GLIBC|GNU libc/i.test(ldd)) {
20
+ return 'glibc'
21
+ }
22
+ } catch {}
23
+
24
+ if (existsSync('/etc/alpine-release')) {
25
+ return 'musl'
26
+ }
27
+
28
+ try {
29
+ const ldso = execSync('ls /lib/ld-musl-* 2>/dev/null', {
30
+ encoding: 'utf8',
31
+ })
32
+ if (ldso.trim()) {
33
+ return 'musl'
34
+ }
35
+ } catch {}
36
+
37
+ return 'glibc'
38
+ }
39
+
40
+ function getPlatformKey() {
41
+ const os = process.platform
42
+ const arch = process.arch
43
+ const libc = detectLibc()
44
+
45
+ return libc ? `${os}-${arch}-${libc}` : `${os}-${arch}`
46
+ }
47
+
48
+ const PLATFORMS = {
49
+ 'darwin-arm64': '@grepai/cli-darwin-arm64',
50
+ 'linux-arm64-musl': '@grepai/cli-linux-arm64-musl',
51
+ 'linux-x64-glibc': '@grepai/cli-linux-x64',
52
+ 'linux-x64-musl': '@grepai/cli-linux-x64-musl',
53
+ }
54
+
55
+ const key = getPlatformKey()
56
+ const pkg = PLATFORMS[key]
57
+
58
+ if (!pkg) {
59
+ console.error(`@grepai/cli: unsupported platform ${key}`)
60
+ console.error(
61
+ `@grepai/cli: supported platforms: ${Object.keys(PLATFORMS).join(', ')}`,
62
+ )
63
+ process.exit(1)
64
+ }
65
+
66
+ const binDir = path.join(__dirname, 'bin')
67
+ const target = path.join(binDir, 'grepai')
68
+
69
+ let source
70
+ try {
71
+ source = require.resolve(pkg)
72
+ } catch (error) {
73
+ const message = error && error.message ? error.message : String(error)
74
+ console.error(
75
+ `@grepai/cli: failed to resolve platform package ${pkg}: ${message}`,
76
+ )
77
+ process.exit(1)
78
+ }
79
+
80
+ if (!existsSync(target)) {
81
+ mkdirSync(binDir, { recursive: true })
82
+
83
+ try {
84
+ symlinkSync(source, target)
85
+ chmodSync(target, 0o755)
86
+ } catch (error) {
87
+ const message = error && error.message ? error.message : String(error)
88
+ console.error(
89
+ `@grepai/cli: failed to prepare executable at ${target}: ${message}`,
90
+ )
91
+ process.exit(1)
92
+ }
93
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grepai/cli",
3
- "version": "0.2.20",
3
+ "version": "0.3.0",
4
4
  "description": "CLI for semantic code search. It uses vector embeddings to understand code meaning, enabling natural language queries that find relevant code—even when naming conventions vary.",
5
5
  "homepage": "https://github.com/bismuth1991/grepai-ts#readme",
6
6
  "bugs": {
@@ -10,34 +10,26 @@
10
10
  "author": "bismuth1991",
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "git+https://github.com/bismuth1991/grepai-ts.git",
14
- "directory": "packages/cli"
13
+ "url": "git+https://github.com/bismuth1991/grepai-ts.git"
15
14
  },
16
15
  "bin": {
17
- "grepai": "./dist/grepai"
16
+ "grepai": "./bin/grepai"
18
17
  },
19
18
  "files": [
20
- "./dist/grepai",
21
- "README.md"
19
+ "bin/",
20
+ "install.js"
22
21
  ],
23
22
  "publishConfig": {
24
23
  "access": "public"
25
24
  },
26
25
  "scripts": {
27
- "build": "bun build --compile --minify-syntax --bytecode --sourcemap --outfile dist/grepai src/index.ts",
28
- "clean": "git clean -xdf .cache .turbo node_modules dist",
29
- "format": "oxfmt",
30
- "lint": "oxlint",
31
- "typecheck": "tsc --noEmit --emitDeclarationOnly false"
26
+ "postinstall": "node install.js",
27
+ "publish": "bun publish"
32
28
  },
33
- "devDependencies": {
34
- "@clack/prompts": "1.0.0",
35
- "@effect/cli": "0.73.1",
36
- "@effect/platform": "0.94.2",
37
- "@effect/platform-bun": "0.87.1",
38
- "@grepai/core": "0.2.20",
39
- "@grepai/tsconfig": "1.0.0",
40
- "effect": "3.19.15",
41
- "typescript": "5.9.3"
29
+ "optionalDependencies": {
30
+ "@grepai/cli-darwin-arm64": "0.3.0",
31
+ "@grepai/cli-linux-arm64-musl": "0.3.0",
32
+ "@grepai/cli-linux-x64": "0.3.0",
33
+ "@grepai/cli-linux-x64-musl": "0.3.0"
42
34
  }
43
35
  }
package/README.md DELETED
@@ -1,51 +0,0 @@
1
- # @grepai/cli
2
-
3
- Semantic code search CLI. It indexes your codebase using vector embeddings to enable natural language queries that find relevant code by meaning, regardless of naming conventions.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- bun add -g @grepai/cli
9
- ```
10
-
11
- ## Usage
12
-
13
- ```bash
14
- # Index your codebase (run whenever code changes)
15
- grepai index
16
-
17
- # Search using natural language
18
- grepai search "how is user authentication handled?"
19
-
20
- # Options: --topK (default 20)
21
- grepai search "database config" --topK 50
22
- ```
23
-
24
- ## Configuration
25
-
26
- Create a `.grepairc.json` or `grepai-config.json` in your project root. Supports `${ENV_VAR}` substitution.
27
-
28
- ```json
29
- {
30
- "$schema": "https://raw.githubusercontent.com/bismuth1991/grepai-ts/refs/heads/main/packages/core/src/grepai-config-schema.json",
31
- "storage": {
32
- "type": "turso",
33
- "url": "${TURSO_DB_URL}",
34
- "authToken": "${TURSO_DB_AUTH_TOKEN}"
35
- },
36
- "embedding": {
37
- "provider": "google",
38
- "model": "gemini-embedding-001",
39
- "apiKey": "${GEMINI_API_KEY}",
40
- "dimensions": 3072
41
- },
42
- "include": ["src/**/*.ts"],
43
- "exclude": ["node_modules", "dist", "**/*.test.ts"]
44
- }
45
- ```
46
-
47
- Read `https://github.com/bismuth1991/grepai-ts/blob/main/packages/core/src/domain/config.ts` for full configuration details.
48
-
49
- ## Links
50
-
51
- [Repository](https://github.com/bismuth1991/grepai-ts) | [Issues](https://github.com/bismuth1991/grepai-ts/issues) | [License](LICENSE)
package/dist/grepai DELETED
Binary file