UNPKG

@hasna/projects

Version:

High-level project management CLI, MCP server, SDK, and AI SDK agent loop for coding agents

62 lines • 2.96 kB
import type { Workspace } from "../types/workspace.js"; /** * One-time migration for the retired singular in-project layout. * * The only convention for project metadata is the plural store: * `~/.hasna/projects/` with per-workspace files under * `~/.hasna/projects/workspaces/<workspace_id>/`. Before that convention was * final, a stray singular directory inside project folders (holding * `dashboard.render.json`, `snapshots/`, `evidence/`, `private/`) was baked * into schemas, docs, and agent instructions. This module is the ONLY place * in the projects app that still mentions that singular directory: it moves * any leftover content into the plural workspace store and never reads the * singular path for anything else. */ export declare const LEGACY_PROJECT_LAYOUT_DIR_SEGMENTS: readonly [".hasna", "project"]; export interface LegacyProjectLayoutInfo { workspace_id: string; /** The retired singular in-project directory, or null when the workspace has no primary path. */ singular_path: string | null; /** The canonical plural per-workspace store for the workspace. */ plural_path: string; present: boolean; } export interface LegacyProjectLayoutMigrationResult { workspace_id: string; singular_path: string | null; plural_path: string; detected: boolean; dry_run: boolean; /** Entries moved (or planned to move in a dry run), relative to the singular directory. */ moved: string[]; /** Entries left in place because a same-named target already exists or the entry is a symlink. */ skipped: string[]; errors: string[]; /** Whether the now-empty singular directory was removed (never true in a dry run). */ removed_singular_dir: boolean; } /** * The retired singular directory for a workspace, absolute. Returns null when * the workspace has no primary path. */ export declare function legacyProjectLayoutPath(project: Pick<Workspace, "primary_path">): string | null; /** * Whether a workspace still carries the retired singular directory. This is * the only read of the singular path and it is used solely to feed the * migration. */ export declare function inspectLegacyProjectLayout(project: Workspace): LegacyProjectLayoutInfo; /** * Move the retired singular in-project directory (see * `LEGACY_PROJECT_LAYOUT_DIR_SEGMENTS`) into the plural per-workspace store * (`~/.hasna/projects/workspaces/<id>/`), preserving * each entry's relative position. Entries whose plural target already exists * are skipped, never overwritten. Symlinked entries are skipped. When the * whole directory moves, the now-empty singular directory is removed; a * surrounding `.hasna` parent that still holds other entries (for example * `goals/`) is left untouched. */ export declare function migrateLegacyProjectLayout(project: Workspace, options?: { dryRun?: boolean; }): LegacyProjectLayoutMigrationResult; //# sourceMappingURL=project-layout-migration.d.ts.map