@dsh-workbench/adapter-probe 1.0.0-beta.1 → 1.0.1

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.
@@ -1,7 +1,7 @@
1
1
  import writeFileAtomic from 'write-file-atomic';
2
2
  import { quoteShellArg } from '@dsh-workbench/shared/host';
3
3
  import { hostSurface } from './platform.js';
4
- import { chmodSync, closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, statSync, } from 'node:fs';
4
+ import { chmodSync, closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, statSync, } from 'node:fs';
5
5
  import { dirname, join } from 'node:path';
6
6
  import { runDetached } from './runtime-seed.js';
7
7
  import { SELF_UPDATE_STATES, } from '@dsh-workbench/shared/contract/protocol/bundle-install';
@@ -241,6 +241,19 @@ function readTail(file) {
241
241
  return undefined;
242
242
  }
243
243
  }
244
+ function hasEntries(dir) {
245
+ try {
246
+ return readdirSync(dir).some((name) => name !== '.DS_Store');
247
+ }
248
+ catch {
249
+ return false;
250
+ }
251
+ }
252
+ function legacyDataIn(dir) {
253
+ return (existsSync(join(dir, 'storages', 'workspace.json')) ||
254
+ hasEntries(join(dir, 'sessions')) ||
255
+ hasEntries(join(dir, 'attachments')));
256
+ }
244
257
  export function readSelfUpdateView(home, profile) {
245
258
  const paths = selfUpdatePaths(home);
246
259
  let raw;
@@ -264,6 +277,9 @@ export function readSelfUpdateView(home, profile) {
264
277
  const version = asText(record.version);
265
278
  const at = asText(record.at);
266
279
  const tail = readTail(paths.log);
280
+ const migration = state === 'ok' && legacyDataIn(paths.dir) && !existsSync(join(paths.dir, '.data-root-shared'))
281
+ ? 'needed'
282
+ : undefined;
267
283
  return {
268
284
  state: state,
269
285
  ...(owner === undefined ? {} : { profile: owner }),
@@ -272,6 +288,7 @@ export function readSelfUpdateView(home, profile) {
272
288
  ...(version === undefined ? {} : { version }),
273
289
  ...(at === undefined ? {} : { at }),
274
290
  ...(tail === undefined ? {} : { tail }),
291
+ ...(migration === undefined ? {} : { migration }),
275
292
  };
276
293
  }
277
294
  export { runningVersionOf } from '@dsh-workbench/shared/host';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-workbench/adapter-probe",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.1",
4
4
  "description": "Workbench adapter-probe adapter.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -16,10 +16,10 @@
16
16
  "execa": "^10.2.0",
17
17
  "proper-lockfile": "^4.1.2",
18
18
  "write-file-atomic": "^8.0.0",
19
- "@dsh-workbench/adapter-profile": "1.0.0-beta.1",
20
- "@dsh-workbench/adapter-runtime": "1.0.0-beta.1",
21
- "@dsh-workbench/shared": "1.0.0-beta.1",
22
- "@dsh-workbench/adapter-supply": "1.0.0-beta.1"
19
+ "@dsh-workbench/adapter-profile": "1.0.1",
20
+ "@dsh-workbench/adapter-runtime": "1.0.1",
21
+ "@dsh-workbench/shared": "1.0.1",
22
+ "@dsh-workbench/adapter-supply": "1.0.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^24.19.0",