@almadar/workspace 0.3.0 → 0.4.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.
@@ -21,5 +21,8 @@ export declare class LocalBackend implements WorkspaceBackend {
21
21
  }>;
22
22
  rename(srcAbs: string, dstAbs: string): Promise<void>;
23
23
  chmod(absPath: string, mode: number): Promise<void>;
24
+ rm(absPath: string, opts?: {
25
+ recursive?: boolean;
26
+ }): Promise<void>;
24
27
  watch(absPath: string, onChange: (kind: 'change' | 'rename') => void): () => void;
25
28
  }
@@ -23,6 +23,9 @@ export declare class MemoryBackend implements WorkspaceBackend {
23
23
  rename(srcAbs: string, dstAbs: string): Promise<void>;
24
24
  chmod(): Promise<void>;
25
25
  watch(): () => void;
26
+ rm(absPath: string, opts?: {
27
+ recursive?: boolean;
28
+ }): Promise<void>;
26
29
  getAll(): Map<string, string>;
27
30
  clear(): void;
28
31
  }
@@ -46,6 +46,14 @@ export interface WorkspaceBackend {
46
46
  * way (poll/webhook) — consumers never see the difference.
47
47
  */
48
48
  watch(absPath: string, onChange: (kind: 'change' | 'rename') => void): () => void;
49
+ /**
50
+ * Remove a path. With `{ recursive: true }` removes a directory tree; always
51
+ * idempotent (no-op if absent). The `'local'` backend uses `fs.rm`; memory
52
+ * drops the matching key(s). Used by `deleteWorkspace`.
53
+ */
54
+ rm(absPath: string, opts?: {
55
+ recursive?: boolean;
56
+ }): Promise<void>;
49
57
  }
50
58
  /**
51
59
  * The persisted marker that pins an `appId` to a workspace dir on disk.
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `listWorkspaces` — enumerate the app-workspaces a user has under a root.
3
+ *
4
+ * The single source for "which projects exist locally": scans
5
+ * `<root>/<userId>/*` for dirs carrying an `app-marker.json` (minted or
6
+ * adopted-as-app workspaces) and reports `{ appId, workDir, name?, updatedAt? }`.
7
+ * Bare-adopted loose files (no marker) are intentionally excluded — they aren't
8
+ * projects. Consumers (apps/builder's offline AppStore, orbital-agent-cli) use
9
+ * this instead of fs-scanning the layout themselves.
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ import type { ListWorkspacesOptions, WorkspaceSummary } from './types.js';
14
+ export declare function listWorkspaces(opts: ListWorkspacesOptions): Promise<WorkspaceSummary[]>;
package/dist/types.d.ts CHANGED
@@ -190,6 +190,26 @@ export interface OpenWorkspaceOptions {
190
190
  */
191
191
  embedder?: EmbedderPort;
192
192
  }
193
+ /** Input for {@link listWorkspaces}. */
194
+ export interface ListWorkspacesOptions {
195
+ /** Workspaces root, e.g. `/workspaces` — user dirs nest under it. */
196
+ root: string;
197
+ /** Owning user id. */
198
+ userId: string;
199
+ /** Storage selector. `'memory'` is for tests; `'local'` is default. */
200
+ backend?: 'local' | 'memory';
201
+ }
202
+ /** One project workspace returned by {@link listWorkspaces}. */
203
+ export interface WorkspaceSummary {
204
+ /** Pinned app id from `.almadar/app-marker.json`. */
205
+ appId: string;
206
+ /** Absolute workspace directory. */
207
+ workDir: string;
208
+ /** Schema display name (`schema.orb` `name`), when present. */
209
+ name?: string;
210
+ /** `schema.orb` mtime if present, else the marker's `createdAt`. */
211
+ updatedAt?: number;
212
+ }
193
213
  /**
194
214
  * The single workspace I/O surface. Every consumer (rabit, apps/builder,
195
215
  * cli, future tools) operates through this. Methods are grouped per
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/workspace",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "Storage-agnostic workspace primitives shared by Almadar consumers. One service, six exports, hidden paths, single observer. See docs/Almadar_Workspace.md.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",