@lynq-knowledge/knowledge-native-cli 0.0.0-stage → 0.1.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,3 +1,34 @@
1
- # Temporary Holding Version
1
+ # Knowledge Native CLI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Install `kb` and `kb-graph` together (Node.js 22 or newer):
4
+
5
+ ```sh
6
+ npm install --global @lynq-knowledge/knowledge-native-cli --registry=https://registry.npmmirror.com
7
+ kb --help
8
+ kb-graph --help
9
+ ```
10
+
11
+ For beta builds, install the beta channel:
12
+
13
+ ```sh
14
+ npm install --global @lynq-knowledge/knowledge-native-cli@beta --registry=https://registry.npmmirror.com
15
+ ```
16
+
17
+ Supports macOS and Linux, on arm64 and x64. The npm platform packages contain the Go binaries; installation does not download assets from GitHub. Keep npm optional dependencies enabled.
18
+
19
+ ```sh
20
+ kb auth login --server https://kb.example.com
21
+ kb auth login --server https://kb.example.com --token-stdin
22
+ kb search 'your query'
23
+ kb-graph model get --json
24
+ ```
25
+
26
+ Both commands share login settings. Output defaults to Markdown; `--json` returns structured data and next tips.
27
+
28
+ Global npm installations silently check for updates after explicit `--help` or `-h`. A successful check or installation starts a 24-hour cooldown shared by both commands. Stable builds follow the `latest` npm tag; beta builds follow `beta`. Updates take effect on the next invocation. Project-local and npx installations keep their selected version.
29
+
30
+ The update registry defaults to `https://registry.npmmirror.com`. Set `KB_CLI_REGISTRY=https://registry.npmjs.org` to use the official registry. You can also update manually:
31
+
32
+ ```sh
33
+ npm install --global @lynq-knowledge/knowledge-native-cli@latest --registry=https://registry.npmmirror.com
34
+ ```
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('./run.cjs')('kb-graph');
package/bin/kb.cjs ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('./run.cjs')('kb');
package/bin/run.cjs ADDED
@@ -0,0 +1,32 @@
1
+ const { spawnSync } = require('node:child_process');
2
+ const { realpathSync } = require('node:fs');
3
+ const path = require('node:path');
4
+ const { name } = require('../package.json');
5
+
6
+ module.exports = (command) => {
7
+ const platformPackage = `${name}-${process.platform}-${process.arch}`;
8
+ let executable;
9
+ try {
10
+ const manifest = require.resolve(`${platformPackage}/package.json`);
11
+ executable = path.join(path.dirname(manifest), 'bin', command);
12
+ } catch {
13
+ console.error(`Could not load ${platformPackage}. Install ${name} with optional dependencies enabled on macOS or Linux (arm64 or x64).`);
14
+ process.exitCode = 1;
15
+ return;
16
+ }
17
+ const result = spawnSync(executable, process.argv.slice(2), {
18
+ stdio: 'inherit',
19
+ env: {
20
+ ...process.env,
21
+ KB_CLI_NPM_PACKAGE_DIR: realpathSync(path.join(__dirname, '..')),
22
+ },
23
+ });
24
+ if (result.error) {
25
+ console.error(`Could not start ${command}: ${result.error.message}`);
26
+ process.exitCode = 1;
27
+ } else if (result.signal) {
28
+ process.kill(process.pid, result.signal);
29
+ } else {
30
+ process.exitCode = result.status;
31
+ }
32
+ };
package/package.json CHANGED
@@ -1,6 +1,38 @@
1
1
  {
2
2
  "name": "@lynq-knowledge/knowledge-native-cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Knowledge Native knowledge and graph command-line tools",
5
+ "license": "UNLICENSED",
6
+ "bin": {
7
+ "kb": "bin/kb.cjs",
8
+ "kb-graph": "bin/kb-graph.cjs"
9
+ },
10
+ "files": [
11
+ "bin"
12
+ ],
13
+ "engines": {
14
+ "node": ">=22"
15
+ },
16
+ "os": [
17
+ "darwin",
18
+ "linux"
19
+ ],
20
+ "cpu": [
21
+ "arm64",
22
+ "x64"
23
+ ],
24
+ "publishConfig": {
25
+ "access": "public",
26
+ "registry": "https://registry.npmjs.org"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/Lynq93/knowledge-native.git"
31
+ },
32
+ "optionalDependencies": {
33
+ "@lynq-knowledge/knowledge-native-cli-darwin-arm64": "0.1.0",
34
+ "@lynq-knowledge/knowledge-native-cli-darwin-x64": "0.1.0",
35
+ "@lynq-knowledge/knowledge-native-cli-linux-arm64": "0.1.0",
36
+ "@lynq-knowledge/knowledge-native-cli-linux-x64": "0.1.0"
37
+ }
38
+ }