@hobocode/thought-layer 0.6.1 → 0.7.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.
@@ -9,7 +9,7 @@ import {
9
9
  aggregateConfidence, statusFromConfidence, gradeFromConfidence,
10
10
  checkDomains, registrarSearchUrl,
11
11
  computeProjection, fmtMoney,
12
- applyStateOp, runScaffold, runDeploy,
12
+ applyStateOp, runScaffold, runDeploy, runSync,
13
13
  type Assumptions, type StateOp,
14
14
  } from "../core/index.ts";
15
15
 
@@ -237,4 +237,35 @@ export default function (pi: ExtensionAPI) {
237
237
  return text(r.message, r.details);
238
238
  },
239
239
  });
240
+
241
+ // tl_sync: store and sync session files in the user's OWN private GitHub repo.
242
+ // Git is transport + history + multi-user; the kit reconciles concurrent edits
243
+ // itself. Collaboration is granted on GitHub (the kit never changes permissions).
244
+ pi.registerTool({
245
+ name: "tl_sync",
246
+ label: "Thought Layer: sync sessions",
247
+ description:
248
+ "Store and sync your Thought Layer session files in your OWN private GitHub repo (BYOK, no central account). " +
249
+ "ops: init (set a repo as a sessions workspace), save (snapshot the current state as a named session, commit, push), list, open (pull and resume a session), pull (reconcile remote edits), push, status. " +
250
+ "Each session is one .thought-layer/<name>.json in the repo; save prompts you for a human name. Git carries history and multi-user; the kit reconciles concurrent edits itself (newest wins per field, conflicts reported), so it never hand-merges JSON. " +
251
+ "Collaboration is granted on GitHub: you add collaborators to the repo, the kit never changes permissions. Needs git installed (gh optional, used to create a repo).",
252
+ parameters: Type.Object({
253
+ op: Type.String({ description: "init | save | list | open | pull | push | status" }),
254
+ name: Type.Optional(Type.String({ description: "Session name (save/open) or workspace label (init). A human name, slugged to <name>.json." })),
255
+ repo: Type.Optional(Type.String({ description: "init only: the private GitHub repo to use (owner/name or a URL)." })),
256
+ dir: Type.Optional(Type.String({ description: "Explicit clone dir for the workspace (overrides the configured one)." })),
257
+ workspace: Type.Optional(Type.String({ description: "Select an existing workspace by its label." })),
258
+ message: Type.Optional(Type.String({ description: "Commit message for save/push." })),
259
+ noPush: Type.Optional(Type.Boolean({ description: "save/push: commit locally without pushing." })),
260
+ path: Type.Optional(Type.String({ description: "save: the current working state file to snapshot (defaults to the session default)." })),
261
+ }),
262
+ async execute(_id, params): Promise<ToolResult> {
263
+ const p = params as { op: string; name?: string; repo?: string; dir?: string; workspace?: string; message?: string; noPush?: boolean; path?: string };
264
+ const r = await runSync(
265
+ { op: p.op, name: p.name, repo: p.repo, dir: p.dir, workspace: p.workspace, message: p.message, noPush: p.noPush, path: p.path },
266
+ { ts: Date.now(), exportedAt: new Date().toISOString() },
267
+ );
268
+ return text(r.message, r.details);
269
+ },
270
+ });
240
271
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hobocode/thought-layer",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "The Thought Layer: rigor for building. Validate an idea, grill it into a buildable spec, then build and deploy it, inside the agent you already use. BYOK, no telemetry.",
5
5
  "license": "MIT",
6
6
  "author": "Hobocode LLC <jerm@hobocode.net>",
@@ -64,6 +64,9 @@
64
64
  "core/stage-map.ts",
65
65
  "core/state-file.ts",
66
66
  "core/state-ops.ts",
67
+ "core/merge.ts",
68
+ "core/sync.ts",
69
+ "core/sync-io.ts",
67
70
  "core/backend.ts",
68
71
  "core/backend-io.ts",
69
72
  "core/scaffold.ts",
@@ -59,6 +59,15 @@ No one finishes this in one sitting. The work lives in a portable file, `.though
59
59
 
60
60
  **At session end or handoff,** run `export` to confirm the file is current, and tell the founder where it is and that they (or a collaborator) can load it into the web app or keep going with the agent.
61
61
 
62
+ ## Sync and collaborate (optional: a private GitHub repo as the home for sessions)
63
+
64
+ For founders juggling several ideas, or collaborating with others, the session files can live in the user's OWN private GitHub repo instead of just locally. The `tl_sync` tool (Pi) or `tl sync` (any shell) manages it, BYOK with no central account:
65
+ - `tl sync init --repo <owner/name>` sets a private repo as a sessions workspace (one repo for the user's own projects, a separate repo per outside founder they help, so each stays isolated).
66
+ - `tl sync save --name <name>` snapshots the current state as a named session (photobooth, peptide, blogging), commits, and pushes. `tl sync list` lists them; `tl sync open --name <name>` pulls and resumes one (it prints the `THOUGHT_LAYER_STATE` line to point the rest of the session at that file).
67
+ - Collaboration is granted on GitHub: the user adds collaborators to the repo themselves; the kit never changes permissions. When two people edit the same session, the kit reconciles the two copies itself (newest wins per field, any coarse tie-break is reported), so git never has to merge the JSON by hand.
68
+
69
+ This is optional. The local default (`.thought-layer/state.json`) and the web-app handoff above work exactly as before without it.
70
+
62
71
  ## Part 1: Validate the idea
63
72
 
64
73
  Altitude: is the idea clear, honest, real, and worth pursuing? Not how it will be built.