@nzpr/kb 0.1.11 → 0.1.12

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
@@ -169,14 +169,7 @@ export KB_EMBEDDING_API_KEY=...
169
169
 
170
170
  If `KB_EMBEDDING_MODE` is omitted, the CLI uses local hash embeddings for development.
171
171
 
172
- Publishing needs one more privileged environment variable:
173
-
174
- ```bash
175
- export KB_GITHUB_REPO=owner/repo
176
- export GITHUB_TOKEN=...
177
- ```
178
-
179
- Publishing is allowed when the provided `GITHUB_TOKEN` can read `KB_GITHUB_REPO`. Normal readers do not need GitHub credentials.
172
+ Publishing uses the local docs directory and the database only. It does not need GitHub credentials.
180
173
 
181
174
  When `kb init-repo` is given `--repo`, it uses the same token to:
182
175
 
@@ -194,8 +187,6 @@ If you run `kb init-repo` without the repo or database inputs, it still scaffold
194
187
 
195
188
  ```bash
196
189
  export KB_DATABASE_URL=postgresql://kb:kb@localhost:5432/kb
197
- export KB_GITHUB_REPO=owner/repo
198
- export GITHUB_TOKEN=...
199
190
  docker compose -f docker-compose.pgvector.yml up -d
200
191
  kb publish --docs-root ./docs
201
192
  kb catalog --json
package/lib/cli-common.js CHANGED
@@ -67,7 +67,9 @@ optional GitHub API override:
67
67
  }
68
68
 
69
69
  export function publishHelp() {
70
- return `required publish authorization:
71
- KB_GITHUB_REPO=OWNER/REPO
72
- GITHUB_TOKEN=...`;
70
+ return `publish runtime:
71
+ KB_DATABASE_URL=postgresql://USER:PASSWORD@HOST:5432/DB
72
+
73
+ publish reads local docs and writes to the database.
74
+ GitHub credentials are not required.`;
73
75
  }
package/lib/cli.js CHANGED
@@ -165,14 +165,6 @@ export async function main(argv) {
165
165
  return 0;
166
166
  }
167
167
  case "publish": {
168
- const repo = flags.repo ?? resolveGitHubRepository();
169
- const apiBaseUrl = resolveGitHubApiBaseUrl();
170
- const token = process.env.GITHUB_TOKEN ?? null;
171
- await requirePublishAccess({
172
- repo,
173
- token,
174
- apiBaseUrl
175
- });
176
168
  const knowledgeRoot = flags["knowledge-root"]
177
169
  ? path.resolve(flags["knowledge-root"])
178
170
  : tryResolveKnowledgeRoot();
@@ -278,7 +270,7 @@ function printCommandHelp(command) {
278
270
  ask: `usage: kb ask <question> [options]\n\n${databaseHelp()}\n --limit N`,
279
271
  list: `usage: kb list\n\n${databaseHelp()}`,
280
272
  catalog: `usage: kb catalog [--json]\n\n${databaseHelp()}`,
281
- publish: `usage: kb publish [--docs-root PATH] [--knowledge-root PATH] [--repo OWNER/REPO]\n\n${databaseHelp()}\n\n${publishHelp()}`,
273
+ publish: `usage: kb publish [--docs-root PATH] [--knowledge-root PATH]\n\n${databaseHelp()}\n\n${publishHelp()}`,
282
274
  doctor: `usage: kb doctor [--knowledge-root PATH] [--docs-root PATH]\n\n${databaseHelp()}`
283
275
  };
284
276
  console.log(commandHelp[command] ?? `unknown command: ${command}`);
@@ -292,40 +284,6 @@ function requireDatabaseUrl() {
292
284
  return databaseUrl;
293
285
  }
294
286
 
295
- async function requirePublishAccess({ repo, token, apiBaseUrl }) {
296
- if (!repo) {
297
- throw new Error("KB_GITHUB_REPO or --repo OWNER/REPO is required to publish knowledge");
298
- }
299
- if (!token) {
300
- throw new Error("GITHUB_TOKEN is required to publish knowledge");
301
- }
302
-
303
- const response = await fetch(`${apiBaseUrl.replace(/\/$/, "")}/repos/${repo}`, {
304
- headers: {
305
- accept: "application/vnd.github+json",
306
- authorization: `Bearer ${token}`,
307
- "user-agent": "@nzpr/kb"
308
- }
309
- });
310
-
311
- if (!response.ok) {
312
- const errorText = await response.text().catch(() => "");
313
- throw new Error(
314
- `failed to verify GitHub repo access: ${response.status} ${response.statusText}${errorText ? ` - ${errorText}` : ""}`
315
- );
316
- }
317
-
318
- const payload = await response.json();
319
- const permissions = payload?.permissions ?? null;
320
- if (!permissions) {
321
- return;
322
- }
323
- if (permissions.admin || permissions.maintain || permissions.push || permissions.triage || permissions.pull) {
324
- return;
325
- }
326
- throw new Error(`GITHUB_TOKEN does not have repository access to ${repo}`);
327
- }
328
-
329
287
  function printInitRepoStatus(result) {
330
288
  console.log("");
331
289
  printInitRepoScaffoldStatus(result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nzpr/kb",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "Knowledge base CLI for proposing, publishing, and querying curated agent knowledge.",
5
5
  "repository": {
6
6
  "type": "git",