conare 0.24.0 → 0.25.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
@@ -301,7 +301,7 @@ name is left alone, and that repository's sync stops with an error.
301
301
  bun install
302
302
  bun run build
303
303
  bun test # local fake API
304
- CONARE_API_KEY=sk-conare-... bun test # also runs test/live.test.ts against the real API
304
+ CONARE_BENCH_API_KEY=sk-conare-... bun test # also runs test/live.test.ts against the real API (a test organization's key)
305
305
  ```
306
306
 
307
307
  Releases: push a tag `sdk-v<version>` matching `package.json`; CI tests and publishes to npm.
package/dist/cli/args.js CHANGED
@@ -5,7 +5,9 @@ export const HELP = `Usage:
5
5
  conare sync github <owner/repo>... [opts] issues, PRs and markdown docs -> "<repo>-github", "<repo>-docs"
6
6
 
7
7
  Run it as npx conare … or bunx conare …. Only new or changed sessions, threads and docs are
8
- sent; secrets in sessions are redacted first.
8
+ sent; secrets are redacted first. To leave a project's sessions out, put its name (its git
9
+ repository's, else its directory's) on a line of ~/.conare/sync-exclude; sessions it already
10
+ uploaded stay until you delete them.
9
11
 
10
12
  Options:
11
13
  --dry-run count what would upload; upload nothing
@@ -11,6 +11,7 @@ export function resolvePaths(env = process.env, home = homedir()) {
11
11
  lockFile: join(dir, "sync.lock"),
12
12
  logFile: join(dir, "sync.log"),
13
13
  statusFile: join(dir, "sync-status.json"),
14
+ excludeFile: join(dir, "sync-exclude"),
14
15
  githubStateFile: join(dir, "github-state.json"),
15
16
  installRoot: join(dir, "sync"),
16
17
  claudeDir: env.CLAUDE_CONFIG_DIR || join(home, ".claude"),
@@ -26,6 +27,20 @@ export function readSavedKey(keyFile) {
26
27
  return undefined;
27
28
  }
28
29
  }
30
+ /**
31
+ * The projects in an exclude file: one name a line (a session's project is its git repository's name,
32
+ * else its directory's), blank lines and "#" comments ignored. No file: none.
33
+ */
34
+ export function readExcluded(file) {
35
+ let text;
36
+ try {
37
+ text = readFileSync(file, "utf8");
38
+ }
39
+ catch {
40
+ return new Set();
41
+ }
42
+ return new Set(text.split(/\r?\n/).map((l) => l.replace(/#.*/, "").trim()).filter(Boolean));
43
+ }
29
44
  export function saveKey(keyFile, key) {
30
45
  writePrivate(keyFile, `${JSON.stringify({ api_key: key }, null, 2)}\n`);
31
46
  }
@@ -2,8 +2,10 @@
2
2
  // conare-docs (build_corpus.py, gs://conare-results/pointer/corpus-2026-10-02/): a thread is
3
3
  // one document "pr-<n>" / "issue-<n>" in "<repo>-github" (head line, state line, body, then
4
4
  // every kept comment in time order); a markdown file is one document in "<repo>-docs" whose id
5
- // is its path with / as : and whose text starts with the path. Pure: no network.
5
+ // is its path with / as : and whose text starts with the path. Text and title pass scrub() first, as a
6
+ // session's do: people paste tokens into issues and docs. Pure: no network.
6
7
  import { createHash } from "node:crypto";
8
+ import { scrub } from "../scrub.js";
7
9
  /** Bots whose comments are review findings agents answered; other bots are CI noise. */
8
10
  export const KEEP_BOTS = new Set(["greptile-apps[bot]", "claude[bot]"]);
9
11
  /** Bytes; the API takes 256 KiB per text. */
@@ -53,7 +55,7 @@ export function threadDocument(repo, issue, comments) {
53
55
  .sort(compareTuples);
54
56
  const parts = [head, clean(issue.body), ...entries.map(([at, who, where, body]) => `--- ${who} on ${at.slice(0, 10)}${where}:\n${clean(body)}`)];
55
57
  const metadata = {
56
- title: issue.title,
58
+ title: scrub(issue.title),
57
59
  author,
58
60
  date: issue.created_at,
59
61
  updated_at: issue.updated_at,
@@ -66,7 +68,7 @@ export function threadDocument(repo, issue, comments) {
66
68
  };
67
69
  if (merged)
68
70
  metadata.merged_at = merged;
69
- return { id: threadId(issue), text: fit(parts.filter(Boolean).join("\n\n")), metadata };
71
+ return { id: threadId(issue), text: fit(scrub(parts.filter(Boolean).join("\n\n"))), metadata };
70
72
  }
71
73
  // Python's tuple order: created_at, then login, then where, then body.
72
74
  function compareTuples(a, b) {
@@ -102,11 +104,12 @@ export function docTitle(path, text) {
102
104
  export function docDocument(repo, branch, f) {
103
105
  if (!f.text.trim())
104
106
  return undefined;
107
+ const text = scrub(f.text);
105
108
  return {
106
109
  id: docId(f.path),
107
- text: fit(`${f.path}\n\n${f.text}`),
110
+ text: fit(`${f.path}\n\n${text}`),
108
111
  metadata: {
109
- title: docTitle(f.path, f.text),
112
+ title: docTitle(f.path, text),
110
113
  author: f.author,
111
114
  date: f.date,
112
115
  path: f.path,
package/dist/cli/main.js CHANGED
@@ -9,7 +9,7 @@ import { homedir } from "node:os";
9
9
  import { fileURLToPath } from "node:url";
10
10
  import { Conare, ConareError, VERSION } from "../index.js";
11
11
  import { HELP, parseArgs, repoNamespace } from "./args.js";
12
- import { readSavedKey, resolvePaths, saveKey } from "./config.js";
12
+ import { readExcluded, readSavedKey, resolvePaths, saveKey } from "./config.js";
13
13
  import { GitHub, GitHubError, githubToken } from "./github/api.js";
14
14
  import { loadGitHubState, saveGitHubState, syncRepo } from "./github/sync.js";
15
15
  import { PASSED_ENV, installCopy, installSchedule, installedSchedule, pruneVersions, stableRuntime, uninstallSchedule } from "./schedule.js";
@@ -151,7 +151,10 @@ async function syncSessions(args, paths, apiKey, say, fail) {
151
151
  account: client ? accountOf(client.baseURL, apiKey) : "",
152
152
  client: args.dryRun ? undefined : client,
153
153
  log: say,
154
+ exclude: readExcluded(paths.excludeFile),
154
155
  });
156
+ if (report.excluded > 0)
157
+ say(`Left out ${report.excluded} sessions of the projects in ${tilde(paths.excludeFile)}.`);
155
158
  if (args.dryRun) {
156
159
  for (const p of report.planned)
157
160
  say(` ${p.id} ${formatBytes(p.bytes)}`);
package/dist/cli/sync.js CHANGED
@@ -18,7 +18,7 @@ export async function runSync(opts) {
18
18
  const ns = opts.client?.namespace(NAMESPACE);
19
19
  const log = opts.log ?? (() => { });
20
20
  const state = loadState(opts.stateFile, opts.account);
21
- const report = { sessions: 0, documents: 0, bytes: 0, unchanged: 0, deleted: 0, rejected: [], planned: [] };
21
+ const report = { sessions: 0, documents: 0, bytes: 0, unchanged: 0, excluded: 0, deleted: 0, rejected: [], planned: [] };
22
22
  // The layout the server holds for a session: what the state said this tool stored last;
23
23
  // on a fresh state (the first sync, after the migration of older history), or for a session
24
24
  // whose upload an earlier run cut short after some of its documents were accepted (0: any
@@ -122,8 +122,14 @@ export async function runSync(opts) {
122
122
  let base;
123
123
  try {
124
124
  const transcript = file.read();
125
+ const project = projectName(transcript.cwd);
126
+ // Not stamped: taken off the list, the project's sessions upload on the next run.
127
+ if (project !== undefined && opts.exclude?.has(project)) {
128
+ report.excluded++;
129
+ return;
130
+ }
125
131
  base = baseId(transcript);
126
- docs = transcript.messages.length > 0 ? toDocuments(transcript, projectName(transcript.cwd)) : [];
132
+ docs = transcript.messages.length > 0 ? toDocuments(transcript, project) : [];
127
133
  }
128
134
  catch (err) {
129
135
  log(`Skipped ${file.path}: ${err instanceof Error ? err.message : String(err)}`);
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "0.24.0";
1
+ export declare const VERSION = "0.25.0";
2
2
  /** A metadata value: string, number, boolean or an array of strings. */
3
3
  export type MetadataValue = string | number | boolean | string[];
4
4
  export type Metadata = Record<string, MetadataValue>;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // conare: TypeScript client for the Conare API. Zero dependencies; uses global fetch.
2
- export const VERSION = "0.24.0";
2
+ export const VERSION = "0.25.0";
3
3
  const DEFAULT_BASE_URL = "https://api.conare.ai";
4
4
  const BATCH_SIZE = 100;
5
5
  // A JSON body this long or longer goes gzip-encoded: past the first ~14 KB a new connection may send,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conare",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "description": "TypeScript client for Conare: add documents, query them, connect apps.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",