@inerrata-corporation/errata 2.0.7-dev.2821 → 2.0.7-dev.2822

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.
Files changed (2) hide show
  1. package/errata.mjs +44 -2
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -79931,7 +79931,7 @@ function createWatchBreaker(deps) {
79931
79931
  }
79932
79932
 
79933
79933
  // src/engine.ts
79934
- var DAEMON_VERSION = true ? "2.0.7-dev.2821" : "2.0.0-alpha.0";
79934
+ var DAEMON_VERSION = true ? "2.0.7-dev.2822" : "2.0.0-alpha.0";
79935
79935
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
79936
79936
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
79937
79937
  var GIT_OP_MUTE_MS = 4e3;
@@ -82219,6 +82219,14 @@ B: ${b}`,
82219
82219
  const pending = existsSync25(paths.outbox) ? readdirSync10(paths.outbox).filter((f) => f.endsWith(".json")).length : 0;
82220
82220
  return { uploaded: 0, failed: 0, remaining: pending };
82221
82221
  }
82222
+ const onDisk = loadProfile(opts.workspaceRoot);
82223
+ if (!onDisk?.projectId && onDisk?.projectLinkHold) {
82224
+ console.log(
82225
+ "[errata] sync held \u2014 this repo is already on errata in another workspace; run `errata link` to join it or create your own project"
82226
+ );
82227
+ const pending = existsSync25(paths.outbox) ? readdirSync10(paths.outbox).filter((f) => f.endsWith(".json")).length : 0;
82228
+ return { uploaded: 0, failed: 0, remaining: pending };
82229
+ }
82222
82230
  try {
82223
82231
  const ignorePatterns = loadClaimIgnorePatterns(opts.workspaceRoot);
82224
82232
  const claimPayload = buildClaimIngest(store, profile, DAEMON_VERSION, 1, ignorePatterns);
@@ -83715,6 +83723,11 @@ init_profile2();
83715
83723
  import { execFile as execFile3 } from "node:child_process";
83716
83724
  import { promisify } from "node:util";
83717
83725
  var execFileAsync = promisify(execFile3);
83726
+ function isClaimedElsewhere(err2) {
83727
+ if (!err2 || typeof err2 !== "object") return false;
83728
+ const e = err2;
83729
+ return e.status === 409 && e.code === "claimed_elsewhere";
83730
+ }
83718
83731
  async function readRootCommit(root) {
83719
83732
  try {
83720
83733
  const { stdout } = await execFileAsync("git", ["rev-list", "--max-parents=0", "HEAD"], {
@@ -83753,9 +83766,21 @@ async function ensureProjectLink(root, profile, client, rootCommit = readRootCom
83753
83766
  profile.projectId = res.project.id;
83754
83767
  profile.projectLocator = locator;
83755
83768
  if (sha2) profile.rootCommitReportedFor = res.project.id;
83769
+ delete profile.projectLinkHold;
83756
83770
  saveProfile(root, profile);
83757
83771
  return { linked: true, projectId: res.project.id, created: res.created };
83758
83772
  } catch (err2) {
83773
+ if (isClaimedElsewhere(err2)) {
83774
+ if (profile.projectLinkHold?.locator !== locator) {
83775
+ profile.projectLinkHold = { reason: "claimed-elsewhere", locator, since: Date.now() };
83776
+ saveProfile(root, profile);
83777
+ }
83778
+ return {
83779
+ linked: false,
83780
+ reason: "held",
83781
+ detail: "this repo is already on errata in another workspace \u2014 run `errata link` to join it or create your own project"
83782
+ };
83783
+ }
83759
83784
  return {
83760
83785
  linked: false,
83761
83786
  reason: "error",
@@ -86477,6 +86502,8 @@ async function startMultiDaemon(opts = {}) {
86477
86502
  );
86478
86503
  } else if (out2.reason === "error") {
86479
86504
  console.warn(`[errata] project link failed for ${r.engine.profile.name}: ${out2.detail}`);
86505
+ } else if (out2.reason === "held") {
86506
+ noteProjectHold(r.id, r.engine.profile.name, out2.detail);
86480
86507
  }
86481
86508
  let primeSalt = null;
86482
86509
  if (r.engine.profile.projectId && !r.engine.profile.projectHydratedAt) {
@@ -86934,7 +86961,16 @@ async function startMultiDaemon(opts = {}) {
86934
86961
  const client = poolFor(recordIdentity);
86935
86962
  const store = r.engine.store;
86936
86963
  const projectName = r.engine.profile.name ?? r.engine.profile.id;
86937
- const onDiskProjectId = loadProfile(r.root)?.projectId;
86964
+ const onDisk = loadProfile(r.root);
86965
+ const onDiskProjectId = onDisk?.projectId;
86966
+ if (!onDiskProjectId && onDisk?.projectLinkHold) {
86967
+ noteProjectHold(
86968
+ r.id,
86969
+ r.entry.name,
86970
+ "this repo is already on errata in another workspace \u2014 run `errata link` to join it or create your own project"
86971
+ );
86972
+ continue;
86973
+ }
86938
86974
  if (onDiskProjectId !== r.engine.profile.projectId) {
86939
86975
  if (onDiskProjectId) r.engine.profile.projectId = onDiskProjectId;
86940
86976
  else delete r.engine.profile.projectId;
@@ -88694,6 +88730,11 @@ async function cmdStatus() {
88694
88730
  console.log(
88695
88731
  ` repo: ${profile.repoLocator ? `${profile.repoLocator}${link}` : "(no git remote \u2014 unlinked)"}`
88696
88732
  );
88733
+ if (!profile.projectId && profile.projectLinkHold) {
88734
+ console.log(
88735
+ ` HELD: this repo is already on errata in another workspace. Nothing syncs until you decide: run \`errata link\` to join it or create your own project.`
88736
+ );
88737
+ }
88697
88738
  for (const h of await daemonHolds()) {
88698
88739
  if (h.workspace !== profile.name && h.workspace !== profile.id) continue;
88699
88740
  console.log(
@@ -89339,6 +89380,7 @@ async function cmdLink(args2) {
89339
89380
  return;
89340
89381
  }
89341
89382
  delete profile.projectLinkDisabled;
89383
+ delete profile.projectLinkHold;
89342
89384
  const remote = flag("--remote");
89343
89385
  if (remote) {
89344
89386
  const loc = detectRepoLocator(ROOT, remote);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.7-dev.2821",
3
+ "version": "2.0.7-dev.2822",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {