@floomhq/floom 1.0.57 → 1.0.59

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.
@@ -163,6 +163,9 @@ function isFloomCacheRoot(root, target) {
163
163
  function isExplicitlyPublished(entry) {
164
164
  return entry?.source === "published" || entry?.source === "updated";
165
165
  }
166
+ function isBaselineAdopted(entry) {
167
+ return entry?.source === "adopted";
168
+ }
166
169
  function slugFromPushManifest(key, pushManifest) {
167
170
  return pushManifest.files[key]?.slug ?? null;
168
171
  }
@@ -259,6 +262,17 @@ export async function pushWatchOnce(opts) {
259
262
  const pushedSlug = slugFromPushManifest(pushKey, pushManifest);
260
263
  const fallbackSlug = fallbackSlugFromPath(packagePath);
261
264
  const slug = pushedSlug ?? syncedSlug ?? fallbackSlug;
265
+ if (isBaselineAdopted(pushed) && !syncedSlug) {
266
+ pushManifest.files[pushKey] = {
267
+ hash,
268
+ slug: pushed.slug,
269
+ path: key,
270
+ pushedAt: new Date().toISOString(),
271
+ source: "adopted",
272
+ };
273
+ adopted += 1;
274
+ continue;
275
+ }
262
276
  if (!pushed && syncedSlug && isUnchangedSyncedPackage(root, skillPackage, syncManifest)) {
263
277
  pushManifest.files[pushKey] = {
264
278
  hash,
package/dist/sync.js CHANGED
@@ -152,6 +152,7 @@ function syncPackageFiles(target, body, files) {
152
152
  }
153
153
  async function planPackageSync(root, files, manifest) {
154
154
  let missing = 0;
155
+ let missingTracked = 0;
155
156
  let unchanged = 0;
156
157
  let remoteChanged = 0;
157
158
  let firstMissingTarget = null;
@@ -176,6 +177,10 @@ async function planPackageSync(root, files, manifest) {
176
177
  return { kind: "conflict", target: state.conflictTarget ?? file.target, reason: state.reason };
177
178
  if (state.kind === "missing") {
178
179
  firstMissingTarget ??= file.target;
180
+ if (tracked) {
181
+ missingTracked += 1;
182
+ continue;
183
+ }
179
184
  missing += 1;
180
185
  continue;
181
186
  }
@@ -195,15 +200,20 @@ async function planPackageSync(root, files, manifest) {
195
200
  }
196
201
  if (unchanged === files.length)
197
202
  return { kind: "unchanged" };
203
+ if (missing + missingTracked === files.length)
204
+ return { kind: "write" };
205
+ if (missingTracked > 0) {
206
+ return {
207
+ kind: "conflict",
208
+ target: firstMissingTarget ?? files[0]?.target ?? root,
209
+ reason: "local package is only partially installed",
210
+ };
211
+ }
198
212
  if (missing === 0 && remoteChanged > 0)
199
213
  return { kind: "update" };
200
214
  if (missing === files.length)
201
215
  return { kind: "write" };
202
- return {
203
- kind: "conflict",
204
- target: firstMissingTarget ?? files[0]?.target ?? root,
205
- reason: "local package is only partially installed",
206
- };
216
+ return { kind: "update" };
207
217
  }
208
218
  async function overwriteTrackedFile(root, target, body, expectedHash) {
209
219
  const parent = await openSafeParentDirectory(root, target, false);
@@ -410,9 +420,20 @@ export async function sync(opts = {}) {
410
420
  for (const file of packageFiles) {
411
421
  const targetKey = manifestKey(root, file.target);
412
422
  const tracked = manifest.files[targetKey];
413
- if (!tracked)
414
- throw conflictError("existing file is not tracked by Floom sync", "EEXIST");
415
- await overwriteTrackedFile(root, file.target, file.bytes, tracked.hash);
423
+ if (tracked) {
424
+ await overwriteTrackedFile(root, file.target, file.bytes, tracked.hash);
425
+ continue;
426
+ }
427
+ const state = await localState(file.target);
428
+ if (state.kind === "missing") {
429
+ await writeSyncedFile(root, file.target, file.bytes);
430
+ continue;
431
+ }
432
+ if (state.kind === "conflict")
433
+ throw conflictError(state.reason, "EEXIST");
434
+ if (state.hash === file.hash)
435
+ continue;
436
+ throw conflictError("existing file is not tracked by Floom sync", "EEXIST");
416
437
  }
417
438
  }
418
439
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floomhq/floom",
3
- "version": "1.0.57",
3
+ "version": "1.0.59",
4
4
  "description": "Sync AI skills across agents and machines.",
5
5
  "license": "MIT",
6
6
  "type": "module",