@meshpoint/cli 1.0.0-rc.4 → 1.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.
@@ -0,0 +1,44 @@
1
+ import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ // Files the agent edited on a project branch, with the time, so a checkpoint can attach the
4
+ // paths worked on since the previous one. Hooks run as separate processes and `items put` runs
5
+ // as the agent's own command, so this lives on disk per project and branch, not per session.
6
+ export const TOUCHED_CAP = 500;
7
+ export class Touched {
8
+ dir;
9
+ constructor(dir) {
10
+ this.dir = dir;
11
+ }
12
+ file(project, branch) {
13
+ return path.join(this.dir, "touched", `${`${project}--${branch}`.replace(/[^A-Za-z0-9._-]/g, "_")}.json`);
14
+ }
15
+ read(file) {
16
+ try {
17
+ const parsed = JSON.parse(readFileSync(file, "utf8"));
18
+ return Array.isArray(parsed) ? parsed.filter((e) => typeof e?.path === "string" && typeof e?.at === "number") : [];
19
+ }
20
+ catch {
21
+ return [];
22
+ }
23
+ }
24
+ // One entry per path, newest time wins; the oldest entries fall off past the cap.
25
+ append(project, branch, paths, at) {
26
+ if (paths.length === 0)
27
+ return;
28
+ const file = this.file(project, branch);
29
+ const byPath = new Map(this.read(file).map((e) => [e.path, e.at]));
30
+ for (const p of paths)
31
+ byPath.set(p, Math.max(at, byPath.get(p) ?? 0));
32
+ const entries = [...byPath].map(([p, t]) => ({ path: p, at: t })).sort((a, b) => a.at - b.at).slice(-TOUCHED_CAP);
33
+ mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
34
+ writeFileSync(file, `${JSON.stringify(entries)}\n`, { mode: 0o600 });
35
+ }
36
+ since(project, branch, at) {
37
+ return this.read(this.file(project, branch))
38
+ .filter((e) => e.at > at)
39
+ .map((e) => e.path);
40
+ }
41
+ clear(project, branch) {
42
+ rmSync(this.file(project, branch), { force: true });
43
+ }
44
+ }
package/dist/verify.js ADDED
@@ -0,0 +1,52 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { existsSync } from "node:fs";
3
+ import path from "node:path";
4
+ export const VERIFY_BUDGET_MS = 2000;
5
+ export function gitRunner(root) {
6
+ return (args) => {
7
+ try {
8
+ return execFileSync("git", args, { cwd: root, stdio: ["ignore", "pipe", "ignore"], timeout: 2000 }).toString();
9
+ }
10
+ catch {
11
+ return null;
12
+ }
13
+ };
14
+ }
15
+ export function verifyItems(items, root, opts = {}) {
16
+ const git = opts.git ?? gitRunner(root);
17
+ const exists = opts.exists ?? existsSync;
18
+ const now = opts.now ?? Date.now;
19
+ const started = now();
20
+ const out = new Map();
21
+ let headKnown = null;
22
+ for (const item of items) {
23
+ if (item.retracted || item.refs.length === 0)
24
+ continue;
25
+ if (now() - started > (opts.budgetMs ?? VERIFY_BUDGET_MS))
26
+ break;
27
+ if (item.commit_sha) {
28
+ if (headKnown === null)
29
+ headKnown = git(["rev-parse", "HEAD"]) !== null;
30
+ if (headKnown && git(["merge-base", "--is-ancestor", item.commit_sha, "HEAD"]) === null) {
31
+ out.set(item.id, "skipped");
32
+ continue;
33
+ }
34
+ }
35
+ if (item.refs.some((ref) => !exists(path.join(root, ref)))) {
36
+ out.set(item.id, "stale");
37
+ continue;
38
+ }
39
+ const since = new Date(item.created_at).toISOString();
40
+ const log = git(["log", "-1", "--format=%H", `--since=${since}`, "--", ...item.refs]);
41
+ out.set(item.id, log === null || log.trim() === "" ? "verified" : "suspect");
42
+ }
43
+ return out;
44
+ }
45
+ // Only real verdicts travel to the platform.
46
+ export function sightings(verdicts) {
47
+ const out = [];
48
+ for (const [id, result] of verdicts)
49
+ if (result !== "skipped")
50
+ out.push({ id, result });
51
+ return out;
52
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meshpoint/cli",
3
- "version": "1.0.0-rc.4",
4
- "description": "Meshpoint CLI and harness adapters",
3
+ "version": "1.1.0",
4
+ "description": "Meshpoint CLI and harness adapters: shared agent memory for developer teams",
5
5
  "keywords": [
6
6
  "meshpoint",
7
7
  "coding-agents",
@@ -10,7 +10,7 @@
10
10
  "cursor",
11
11
  "memory"
12
12
  ],
13
- "license": "Apache-2.0",
13
+ "license": "MIT",
14
14
  "homepage": "https://meshpoint.dev",
15
15
  "repository": {
16
16
  "type": "git",
@@ -38,7 +38,7 @@
38
38
  "prepublishOnly": "npm run check && npm run build"
39
39
  },
40
40
  "dependencies": {
41
- "@meshpoint/sdk": "^1.0.0-rc.3"
41
+ "@meshpoint/sdk": "^1.1.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/node": "^22.0.0",