@meshpoint/cli 1.4.2 → 1.5.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/dist/bin.js CHANGED
@@ -74,7 +74,7 @@ const USAGE = `meshpoint <command>
74
74
  stdin form takes a JSON array of {kind, title, body}
75
75
  items retract <id>... retract items on the current branch; an id may be a prefix
76
76
  items confirm <id>... confirm items on the current branch (counts toward their rank)
77
- import sessions [--since <days>] [--all-repos] [--with-turns] [--apply] [--yes]
77
+ import sessions [--since <days>] [--all-repos] [--with-turns] [--apply | --propose] [--yes]
78
78
  [--runner claude|codex] [--model <m>] [--min-turns <n>] [--from <items.json>]
79
79
  read this machine's harness transcripts (Claude Code, Codex, pi,
80
80
  opencode, Antigravity, Cursor) for the current repo and the last
@@ -84,7 +84,8 @@ const USAGE = `meshpoint <command>
84
84
  --all-repos asks first (--yes skips). --with-turns also uploads
85
85
  the last 30 days of turns as sessions. Review the saved
86
86
  items.json, delete or edit entries, then upload exactly that
87
- file with --apply --from <items.json>.
87
+ file with --apply --from <items.json>; or --propose sends the
88
+ proposal to the console, where it is reviewed and applied.
88
89
  tap claude-code | codex | cursor | antigravity [<event>] | openclaw
89
90
  hook entry point; reads one hook payload on stdin
90
91
  `;
@@ -301,6 +302,7 @@ async function main(argv) {
301
302
  allRepos: rest.includes("--all-repos"),
302
303
  withTurns: rest.includes("--with-turns"),
303
304
  apply: rest.includes("--apply"),
305
+ propose: rest.includes("--propose"),
304
306
  yes: rest.includes("--yes"),
305
307
  minTurns,
306
308
  runner,
@@ -52,7 +52,7 @@ export async function importSessions(opts) {
52
52
  throw new Error("not inside a git repo with an origin remote; pass --all-repos to import every repository");
53
53
  selected = selected.filter((s) => s.project === opts.current.project);
54
54
  }
55
- const empty = { results: [], unmapped, reportFile: "", itemsFiles: [], uploaded: { items: 0, turns: 0 }, cancelled: false };
55
+ const empty = { results: [], unmapped, reportFile: "", itemsFiles: [], uploaded: { items: 0, turns: 0 }, proposals: [], cancelled: false };
56
56
  if (selected.length === 0) {
57
57
  log(`no sessions found${opts.allRepos ? "" : ` for ${opts.current?.project}`} in the last ${opts.sinceDays} days (${inWindow.length} in the window, ${unmapped.length} unmapped)`);
58
58
  return empty;
@@ -77,6 +77,7 @@ export async function importSessions(opts) {
77
77
  const results = [];
78
78
  const itemsFiles = [];
79
79
  const uploaded = { items: 0, turns: 0 };
80
+ const sent = [];
80
81
  const outDir = path.join(opts.stateDir, "import");
81
82
  mkdirSync(outDir, { recursive: true, mode: 0o700 });
82
83
  for (const [project, sessions] of byProject) {
@@ -142,6 +143,23 @@ export async function importSessions(opts) {
142
143
  const file = path.join(outDir, `${safe(project)}.items.json`);
143
144
  writeFileSync(file, `${JSON.stringify(saved, null, 2)}\n`, { mode: 0o600 });
144
145
  itemsFiles.push(file);
146
+ if (opts.propose) {
147
+ try {
148
+ const res = await (opts.fetch ?? fetch)(`${opts.config.baseUrl.replace(/\/+$/, "")}/v1/imports`, {
149
+ method: "POST",
150
+ headers: { authorization: `Bearer ${opts.config.token}`, "content-type": "application/json" },
151
+ body: JSON.stringify({ project, branches: saved, report: renderReport([result], [], {}).slice(0, 60_000), commit_sha: root ? headSha(root) : "" }),
152
+ });
153
+ const data = (await res.json());
154
+ if (!res.ok || !data.id)
155
+ throw new Error(data.error ?? `HTTP ${res.status}`);
156
+ sent.push({ project, id: data.id, url: data.url ?? "" });
157
+ log(` proposal ${data.id} sent for review${data.url ? `: ${data.url}` : ""}`);
158
+ }
159
+ catch (err) {
160
+ result.errors.push(`proposal upload failed (${err instanceof Error ? err.message : String(err)})`);
161
+ }
162
+ }
145
163
  if (opts.apply) {
146
164
  const out = await uploadProposal({ project, root, branches: saved, config: opts.config, runnerName: opts.runner.name, ...(opts.fetch ? { fetch: opts.fetch } : {}), ...(opts.exists ? { exists: opts.exists } : {}), log });
147
165
  uploaded.items += out.items;
@@ -166,10 +184,13 @@ export async function importSessions(opts) {
166
184
  log("");
167
185
  log(report);
168
186
  log("");
169
- log(opts.apply
170
- ? `uploaded ${uploaded.items} items${opts.withTurns ? ` and ${uploaded.turns} turns` : ""}; proposals saved in ${outDir}`
171
- : `dry run, nothing uploaded. Review the proposal: ${itemsFiles.join(", ")}\nDelete or edit entries there, then upload exactly that file with: meshpoint import sessions --apply --from <file>\nOr run again with --apply to distill afresh and upload.`);
172
- return { results, unmapped, reportFile, itemsFiles, uploaded, cancelled: false };
187
+ if (opts.apply)
188
+ log(`uploaded ${uploaded.items} items${opts.withTurns ? ` and ${uploaded.turns} turns` : ""}; proposals saved in ${outDir}`);
189
+ else if (opts.propose)
190
+ log(`sent for review in the console${sent.length ? `: ${sent.map((p) => p.url || p.id).join(", ")}` : ""}. Nothing is written until someone applies it there.`);
191
+ else
192
+ log(`dry run, nothing uploaded. Review the proposal: ${itemsFiles.join(", ")}\nDelete or edit entries there, then upload exactly that file with: meshpoint import sessions --apply --from <file>\nOr send it to the console for review with --propose, or run again with --apply to distill afresh and upload.`);
193
+ return { results, unmapped, reportFile, itemsFiles, uploaded, proposals: sent, cancelled: false };
173
194
  }
174
195
  // Writes a proposal's branches through items put semantics: refs re-read from the item text (the
175
196
  // file may have been edited), HEAD as the commit, import provenance, dates from the sessions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshpoint/cli",
3
- "version": "1.4.2",
3
+ "version": "1.5.0",
4
4
  "description": "Meshpoint CLI and harness adapters: shared agent memory for developer teams",
5
5
  "keywords": [
6
6
  "meshpoint",