@hearsay-tools/squawk 0.17.0-pr3285.5787 → 0.18.0-dev.5793
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.
- package/dist/artifacts/reports-index.js +1 -3
- package/dist/artifacts/reports-index.js.map +1 -1
- package/dist/artifacts/store.d.ts +1 -1
- package/dist/artifacts/store.js +1 -3
- package/dist/artifacts/store.js.map +1 -1
- package/dist/autosave-cleanup.d.ts +1 -2
- package/dist/autosave-cleanup.js +6 -8
- package/dist/autosave-cleanup.js.map +1 -1
- package/dist/delegation/context.js +2 -4
- package/dist/delegation/context.js.map +1 -1
- package/dist/delegation/results.js +2 -3
- package/dist/delegation/results.js.map +1 -1
- package/dist/delegation/routes.d.ts +75 -75
- package/dist/delegation/transport.d.ts +73 -73
- package/dist/handoff.js +1 -2
- package/dist/handoff.js.map +1 -1
- package/dist/preview/agent-marker.js +6 -9
- package/dist/preview/agent-marker.js.map +1 -1
- package/dist/preview/dev-server.js +10 -31
- package/dist/preview/dev-server.js.map +1 -1
- package/dist/preview/host.js +2 -3
- package/dist/preview/host.js.map +1 -1
- package/dist/project-migration/answer.d.ts +0 -2
- package/dist/project-migration/answer.js +5 -7
- package/dist/project-migration/answer.js.map +1 -1
- package/dist/project-migration/auto.d.ts +8 -15
- package/dist/project-migration/auto.js +26 -24
- package/dist/project-migration/auto.js.map +1 -1
- package/dist/project-migration/cli.js +2 -3
- package/dist/project-migration/cli.js.map +1 -1
- package/dist/project-migration/containment.d.ts +1 -1
- package/dist/project-migration/containment.js +2 -4
- package/dist/project-migration/containment.js.map +1 -1
- package/dist/project-migration/engine.d.ts +1 -5
- package/dist/project-migration/engine.js +1 -18
- package/dist/project-migration/engine.js.map +1 -1
- package/dist/project-migration/journal.d.ts +2 -8
- package/dist/project-migration/journal.js +2 -9
- package/dist/project-migration/journal.js.map +1 -1
- package/dist/project-migration/live.d.ts +5 -20
- package/dist/project-migration/live.js +5 -47
- package/dist/project-migration/live.js.map +1 -1
- package/dist/project-migration/offline.d.ts +4 -6
- package/dist/project-migration/offline.js +6 -8
- package/dist/project-migration/offline.js.map +1 -1
- package/dist/project-migration/plan.d.ts +2 -28
- package/dist/project-migration/plan.js +36 -151
- package/dist/project-migration/plan.js.map +1 -1
- package/dist/project-migration/steps.js +3 -56
- package/dist/project-migration/steps.js.map +1 -1
- package/dist/project-paths.d.ts +1 -3
- package/dist/project-paths.js +2 -9
- package/dist/project-paths.js.map +1 -1
- package/dist/runs/agent-tmpdir.js +3 -4
- package/dist/runs/agent-tmpdir.js.map +1 -1
- package/dist/runs/history-file.js +3 -6
- package/dist/runs/history-file.js.map +1 -1
- package/dist/runs/store.d.ts +72 -72
- package/dist/runs/store.js +6 -6
- package/dist/runs/store.js.map +1 -1
- package/dist/runs/worker-execution.d.ts +1 -3
- package/dist/runs/worker-execution.js +6 -23
- package/dist/runs/worker-execution.js.map +1 -1
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/self-update-routes.d.ts +19 -19
- package/dist/server/server.d.ts +2929 -2929
- package/dist/voice/routes.d.ts +19 -19
- package/dist/workflows/attachment-path.js +1 -2
- package/dist/workflows/attachment-path.js.map +1 -1
- package/dist/workflows/run/attachment-writer.js +1 -2
- package/dist/workflows/run/attachment-writer.js.map +1 -1
- package/dist/workflows/run/continuation-session.js +1 -2
- package/dist/workflows/run/continuation-session.js.map +1 -1
- package/dist/workflows/run/queued-input.js +1 -2
- package/dist/workflows/run/queued-input.js.map +1 -1
- package/dist/workflows/run/step-session.js +1 -2
- package/dist/workflows/run/step-session.js.map +1 -1
- package/dist/workflows/run/wait-engine.d.ts +72 -72
- package/package.json +4 -4
- package/dist/legacy-runs.d.ts +0 -56
- package/dist/legacy-runs.js +0 -122
- package/dist/legacy-runs.js.map +0 -1
|
@@ -11,9 +11,8 @@ import { migrateProjectOffline } from './offline.js';
|
|
|
11
11
|
*/
|
|
12
12
|
const HELP = commandText(`Usage: cez migrate-project [--dry-run] [--repo <dir>]
|
|
13
13
|
Move this project's runtime state from .ai/cezar/ to .ai/squawk/, offline. Stop every
|
|
14
|
-
cockpit that serves the project
|
|
15
|
-
|
|
16
|
-
.ai/cezar/ until it is archived; run the command again, or start a cockpit, to move them then. It cannot see a cockpit of another home that
|
|
14
|
+
cockpit that serves the project and finish or cancel every task first; the command
|
|
15
|
+
names what it finds still running. It cannot see a cockpit of another home that
|
|
17
16
|
lists the project but never opened it: stop it yourself, and keep older binaries off
|
|
18
17
|
the project. Tracked files are never moved: the command prints the
|
|
19
18
|
git mv commands to run and commit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/project-migration/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAGrD;;;GAGG;AAEH,MAAM,IAAI,GAAG,WAAW,CAAC
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/project-migration/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAA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CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAChJ,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACnE,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,oBAAoB,CAAC,KAAkD;IACrF,OAAO,CAAC,IAAc,EAAE,GAAsB,EAAE,EAAE,CAAC,wBAAwB,CAAC,IAAI,EAAE;QAChF,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;KAC7H,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -8,7 +8,7 @@ import type { ProjectMigrationJournal } from './journal.ts';
|
|
|
8
8
|
* `<root>/.ai` is a real directory.
|
|
9
9
|
* - A move goes from inside `source` to the same place inside `destination`; so does a worktree.
|
|
10
10
|
* - A receipt or cleanup checkpoint lies in `<git common dir>/cezar-owned-workspaces/`; every other
|
|
11
|
-
* rewritten file lies in `<destination>/runs
|
|
11
|
+
* rewritten file lies in `<destination>/runs/`.
|
|
12
12
|
* - A rewritten value moves a path from a form of the project root's `.ai/cezar` to the same place
|
|
13
13
|
* under `.ai/squawk`; a tracked file is a relative `.ai/cezar/...` path printed as a `git mv`.
|
|
14
14
|
* - No existing directory on the way to a checked path resolves elsewhere (a symlink out), and a
|
|
@@ -15,7 +15,7 @@ import { RUNS_DB_FILE } from '../runs/run-database.js';
|
|
|
15
15
|
* `<root>/.ai` is a real directory.
|
|
16
16
|
* - A move goes from inside `source` to the same place inside `destination`; so does a worktree.
|
|
17
17
|
* - A receipt or cleanup checkpoint lies in `<git common dir>/cezar-owned-workspaces/`; every other
|
|
18
|
-
* rewritten file lies in `<destination>/runs
|
|
18
|
+
* rewritten file lies in `<destination>/runs/`.
|
|
19
19
|
* - A rewritten value moves a path from a form of the project root's `.ai/cezar` to the same place
|
|
20
20
|
* under `.ai/squawk`; a tracked file is a relative `.ai/cezar/...` path printed as a `git mv`.
|
|
21
21
|
* - No existing directory on the way to a checked path resolves elsewhere (a symlink out), and a
|
|
@@ -141,9 +141,7 @@ async function rewritesRefusal(journal) {
|
|
|
141
141
|
const fileRefusal = (rewrite) => {
|
|
142
142
|
if (!('file' in rewrite))
|
|
143
143
|
return undefined;
|
|
144
|
-
|
|
145
|
-
const directory = isReceipt(rewrite) ? receipts : rewrite.file.startsWith(join(journal.source, 'runs') + sep) ? join(journal.source, 'runs') : runs;
|
|
146
|
-
return outsideOf(directory, rewrite.file) ?? notRegularFile(rewrite.file);
|
|
144
|
+
return outsideOf(isReceipt(rewrite) ? receipts : runs, rewrite.file) ?? notRegularFile(rewrite.file);
|
|
147
145
|
};
|
|
148
146
|
return firstRefusal(journal.rewrites, (rewrite) => { return fileRefusal(rewrite) ?? valueMoved(journal.repoRoot, real, rewrite); })
|
|
149
147
|
?? firstRefusal(stores, notRegularFile);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containment.js","sourceRoot":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
|
@@ -5,9 +5,7 @@ import { type MigrationFault } from './steps.ts';
|
|
|
5
5
|
/**
|
|
6
6
|
* The project state migration engine (P4b2, hearsay-tools/cezarion#3088): it moves a project's
|
|
7
7
|
* runtime state from `.ai/cezar/` to `.ai/squawk/` under the exclusive project fence. A migration
|
|
8
|
-
* runs offline (hearsay-tools/cezarion#3089): no cockpit serves the project and no
|
|
9
|
-
* claims a task of it. A task that can still resume (live or not archived) keeps its own items in
|
|
10
|
-
* `.ai/cezar/` (`legacy-runs.ts`); a later migration carries them once it is archived or deleted.
|
|
8
|
+
* runs offline (hearsay-tools/cezarion#3089): no cockpit serves the project and no task is live.
|
|
11
9
|
*
|
|
12
10
|
* Order: the caller takes the fence (`fenceProject`); the engine checks that this process holds
|
|
13
11
|
* it, runs as its holder (`asFenceHolder`), closes the store the caller opened (`closeProject`),
|
|
@@ -46,6 +44,4 @@ export declare function resumeProjectMigration(options: ProjectMigrationOptions)
|
|
|
46
44
|
*/
|
|
47
45
|
export declare function migrateProject(options: ProjectMigrationOptions & {
|
|
48
46
|
closeProject?: () => void | Promise<void>;
|
|
49
|
-
/** The tasks that keep their items (live or not archived), read after `closeProject`; by default read from the project's run stores. */
|
|
50
|
-
keptRunIds?: () => ReadonlySet<string>;
|
|
51
47
|
}): Promise<ProjectMigrationResult>;
|
|
@@ -7,7 +7,6 @@ import { gitMvCommands, LEGACY_PROJECT_DIR, planProjectMigration } from './plan.
|
|
|
7
7
|
import { GIT_MIGRATION_STEPS, MIGRATION_STEP_RUNNERS } from './steps.js';
|
|
8
8
|
import { withWorktreeMutation } from '../git-worktree-lock.js';
|
|
9
9
|
import { assertJournalContained, assertJournalFile } from './containment.js';
|
|
10
|
-
import { projectKeptRunIds } from './live.js';
|
|
11
10
|
/** The plan had conflicts or blockers: nothing was written and no journal exists. */
|
|
12
11
|
export class ProjectMigrationRefusedError extends Error {
|
|
13
12
|
plan;
|
|
@@ -71,21 +70,6 @@ async function resumeHeld(options) {
|
|
|
71
70
|
await assertJournalContained(options.fence.journal, journal);
|
|
72
71
|
return runJournal(options.fence.journal, journal, true, options.fault ?? (() => undefined));
|
|
73
72
|
}
|
|
74
|
-
/**
|
|
75
|
-
* The tasks that can still resume: live or not archived. When their records cannot be read, a plan that is refused anyway reports its
|
|
76
|
-
* own conflicts and blockers rather than the read failure.
|
|
77
|
-
*/
|
|
78
|
-
async function resolveKeptRunIds(options) {
|
|
79
|
-
try {
|
|
80
|
-
return (options.keptRunIds ?? (() => projectKeptRunIds(options.repoRoot)))();
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
const plan = await planProjectMigration(options.repoRoot);
|
|
84
|
-
if (plan.blockers.length > 0 || plan.conflicts.length > 0)
|
|
85
|
-
throw new ProjectMigrationRefusedError(plan);
|
|
86
|
-
throw error;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
73
|
/**
|
|
90
74
|
* Migrate the project, or finish its unfinished journal first. `closeProject` runs before the
|
|
91
75
|
* plan: the CLI closes the store it opened for its live-task check. A refused plan writes nothing.
|
|
@@ -98,13 +82,12 @@ export async function migrateProject(options) {
|
|
|
98
82
|
const unfinished = await resumeHeld(options);
|
|
99
83
|
if (unfinished)
|
|
100
84
|
return unfinished;
|
|
101
|
-
const plan = await planProjectMigration(options.repoRoot
|
|
85
|
+
const plan = await planProjectMigration(options.repoRoot);
|
|
102
86
|
if (plan.blockers.length > 0 || plan.conflicts.length > 0)
|
|
103
87
|
throw new ProjectMigrationRefusedError(plan);
|
|
104
88
|
const journal = {
|
|
105
89
|
version: 1, id: randomUUID(), createdAt: new Date().toISOString(), repoRoot: plan.repoRoot, source: plan.source,
|
|
106
90
|
destination: plan.destination, done: [], moves: plan.moves, tracked: plan.tracked, worktrees: plan.worktrees, rewrites: plan.rewrites,
|
|
107
|
-
leftovers: plan.leftovers,
|
|
108
91
|
};
|
|
109
92
|
// The same rule as a resume, before the journal exists, so a refused plan leaves nothing behind.
|
|
110
93
|
await assertJournalContained(plan.journal, journal);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/project-migration/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAA8B,MAAM,gCAAgC,CAAC;AACnI,OAAO,EACL,uBAAuB,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,4BAA4B,GAElH,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,oBAAoB,EAA6B,MAAM,WAAW,CAAC;AAC/G,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAuB,MAAM,YAAY,CAAC;AAC9F,OAAO,EAAE,oBAAoB,EAAoB,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/project-migration/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAA8B,MAAM,gCAAgC,CAAC;AACnI,OAAO,EACL,uBAAuB,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,4BAA4B,GAElH,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,oBAAoB,EAA6B,MAAM,WAAW,CAAC;AAC/G,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAu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,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;QACjG,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACjD,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACxB,4BAA4B,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACzB,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -8,12 +8,8 @@ import { z } from 'zod';
|
|
|
8
8
|
* rewrite twice. While the file exists, P4b1's admission refuses the project to everyone but the
|
|
9
9
|
* fence holder.
|
|
10
10
|
*/
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
* removes the old directories the move emptied. `mark-moved` is last: from its marker on,
|
|
14
|
-
* `projectPaths` writes the project under `.ai/squawk/`.
|
|
15
|
-
*/
|
|
16
|
-
export declare const PROJECT_MIGRATION_STEPS: readonly ['lock-worktrees', 'move', 'repair-worktrees', 'receipts', 'run-store', 'run-files', 'leftovers', 'mark-moved'];
|
|
11
|
+
/** `mark-moved` is last: from its marker on, `projectPaths` writes the project under `.ai/squawk/`. */
|
|
12
|
+
export declare const PROJECT_MIGRATION_STEPS: readonly ['lock-worktrees', 'move', 'repair-worktrees', 'receipts', 'run-store', 'run-files', 'mark-moved'];
|
|
17
13
|
export type ProjectMigrationStep = typeof PROJECT_MIGRATION_STEPS[number];
|
|
18
14
|
/** One runtime item renamed from the legacy directory into the new one. */
|
|
19
15
|
export declare const migrationMoveSchema: z.ZodObject<{
|
|
@@ -77,7 +73,6 @@ export declare const projectMigrationJournalSchema: z.ZodObject<{
|
|
|
77
73
|
source: z.ZodString;
|
|
78
74
|
destination: z.ZodString;
|
|
79
75
|
done: z.ZodArray<z.ZodEnum<{
|
|
80
|
-
leftovers: "leftovers";
|
|
81
76
|
"lock-worktrees": "lock-worktrees";
|
|
82
77
|
"mark-moved": "mark-moved";
|
|
83
78
|
move: "move";
|
|
@@ -135,7 +130,6 @@ export declare const projectMigrationJournalSchema: z.ZodObject<{
|
|
|
135
130
|
column: z.ZodLiteral<"worktree_path">;
|
|
136
131
|
}, z.core.$strict>]>;
|
|
137
132
|
}, z.core.$strict>], "kind">>;
|
|
138
|
-
leftovers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
139
133
|
}, z.core.$strict>;
|
|
140
134
|
export type ProjectMigrationJournal = z.infer<typeof projectMigrationJournalSchema>;
|
|
141
135
|
export declare function readProjectMigrationJournal(path: string): ProjectMigrationJournal | undefined;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { readFileSync, rmSync } from 'node:fs';
|
|
2
2
|
import { dirname } from 'node:path';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { runIdParamSchema } from '../contract/index.js';
|
|
5
4
|
import { replaceAtomically, settle } from './durable.js';
|
|
6
5
|
/**
|
|
7
6
|
* The project migration journal, `<root>/.ai/squawk-migration.json` (P4b1's
|
|
@@ -12,12 +11,8 @@ import { replaceAtomically, settle } from './durable.js';
|
|
|
12
11
|
* rewrite twice. While the file exists, P4b1's admission refuses the project to everyone but the
|
|
13
12
|
* fence holder.
|
|
14
13
|
*/
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
* removes the old directories the move emptied. `mark-moved` is last: from its marker on,
|
|
18
|
-
* `projectPaths` writes the project under `.ai/squawk/`.
|
|
19
|
-
*/
|
|
20
|
-
export const PROJECT_MIGRATION_STEPS = ['lock-worktrees', 'move', 'repair-worktrees', 'receipts', 'run-store', 'run-files', 'leftovers', 'mark-moved'];
|
|
14
|
+
/** `mark-moved` is last: from its marker on, `projectPaths` writes the project under `.ai/squawk/`. */
|
|
15
|
+
export const PROJECT_MIGRATION_STEPS = ['lock-worktrees', 'move', 'repair-worktrees', 'receipts', 'run-store', 'run-files', 'mark-moved'];
|
|
21
16
|
const absolute = z.string().min(1).refine(path => path.startsWith('/') || /^[a-z]:[\\/]/i.test(path), 'absolute path');
|
|
22
17
|
const pathChange = { from: absolute, to: absolute };
|
|
23
18
|
/** One runtime item renamed from the legacy directory into the new one. */
|
|
@@ -48,8 +43,6 @@ export const projectMigrationJournalSchema = z.object({
|
|
|
48
43
|
tracked: z.array(trackedFileSchema),
|
|
49
44
|
worktrees: z.array(worktreeRepairSchema),
|
|
50
45
|
rewrites: z.array(pathRewriteSchema),
|
|
51
|
-
/** The kept tasks (live or not archived) whose own items stay in `source`; absent in a journal of an older build: none. */
|
|
52
|
-
leftovers: z.array(runIdParamSchema.shape.id).optional(),
|
|
53
46
|
}).strict();
|
|
54
47
|
export function readProjectMigrationJournal(path) {
|
|
55
48
|
let text;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal.js","sourceRoot":"","sources":["../../src/project-migration/journal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"journal.js","sourceRoot":"","sources":["../../src/project-migration/journal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEzD;;;;;;;;GAQG;AAEH,uGAAuG;AACvG,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAA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C;IAC7G,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,6BAA6B,CAAC,IAAY;IACxD,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { Home } from '../home/home.ts';
|
|
2
|
-
import { type
|
|
2
|
+
import { type RunStore } from '../runs/store.ts';
|
|
3
3
|
import { type LiveProjectTask } from '../server/cockpit-ownership.ts';
|
|
4
4
|
/**
|
|
5
5
|
* Whether anything is live for a project (hearsay-tools/cezarion#3089). A project migration runs
|
|
6
|
-
* offline: it refuses while a cockpit serves the project or
|
|
7
|
-
*
|
|
8
|
-
* unfinished) does not refuse it: its own items stay in `.ai/cezar/` (`projectLiveRunIds`).
|
|
9
|
-
* Shared by every caller that starts a migration.
|
|
6
|
+
* offline: it refuses while a cockpit serves the project or a task of it is live, and names what to
|
|
7
|
+
* stop. Shared by every caller that starts a migration.
|
|
10
8
|
*
|
|
11
9
|
* Seen: the cockpit that owns the project's `cockpit.lock` (any home), every live cockpit of the
|
|
12
10
|
* given homes whose registry lists the project (their presence leases, `home/leases.ts`), and live
|
|
@@ -43,21 +41,8 @@ export declare function projectCockpits(root: string, homes: readonly Home[], se
|
|
|
43
41
|
* JSON. The legacy directory wins an id both hold. Live: rows not terminal, and the runs of
|
|
44
42
|
* families a live process claims. Throws when a live id's record cannot be read.
|
|
45
43
|
*/
|
|
46
|
-
export declare function readLiveTaskView(root: string): Pick<RunStore, 'listRuns' | 'persistedLiveRunIds' | 'getRun'
|
|
47
|
-
allRuns: () => RunRecord[];
|
|
48
|
-
/** Ids of rows not archived whose record does not parse: whether they can resume is unknown. */
|
|
49
|
-
unreadableUnarchived: () => string[];
|
|
50
|
-
};
|
|
44
|
+
export declare function readLiveTaskView(root: string): Pick<RunStore, 'listRuns' | 'persistedLiveRunIds' | 'getRun'>;
|
|
51
45
|
/** Refuse when a cockpit serves the project; include live tasks in that first refusal. The fence checks them again. */
|
|
52
46
|
export declare function assertNoProjectCockpit(root: string, homes: readonly Home[], self?: number): Promise<void>;
|
|
53
|
-
/** The project's live tasks, read without writing anything. */
|
|
47
|
+
/** The project's live tasks, read without writing anything: the fence's live-task check. */
|
|
54
48
|
export declare function projectLiveTasksOffline(root: string): LiveProjectTask[];
|
|
55
|
-
/** The tasks of families another live process claims, read without writing anything: the fence's check. */
|
|
56
|
-
export declare function projectForeignTasksOffline(root: string): LiveProjectTask[];
|
|
57
|
-
/**
|
|
58
|
-
* The ids of every task of the project that can still resume: each live task, and each task not
|
|
59
|
-
* archived, since a human can Continue a done, review, failed or cancelled task from its stored
|
|
60
|
-
* worktree. A migration leaves their own items in place. A deleted task has no record, so its
|
|
61
|
-
* items move.
|
|
62
|
-
*/
|
|
63
|
-
export declare function projectKeptRunIds(root: string): ReadonlySet<string>;
|
|
@@ -88,19 +88,15 @@ function record(value) {
|
|
|
88
88
|
*/
|
|
89
89
|
export function readLiveTaskView(root) {
|
|
90
90
|
const runs = new Map();
|
|
91
|
-
const live = new Set(), foreign = new Set()
|
|
91
|
+
const live = new Set(), foreign = new Set();
|
|
92
92
|
const add = (run) => { if (run && !runs.has(run.id))
|
|
93
93
|
runs.set(run.id, run); };
|
|
94
94
|
for (const directory of projectPaths(root).reads) {
|
|
95
95
|
const database = join(directory, RUNS_DB_FILE);
|
|
96
96
|
if (pathPresent(database)) {
|
|
97
97
|
readQuiescentRunDatabase(database, (db) => {
|
|
98
|
-
for (const row of db.listAll())
|
|
99
|
-
|
|
100
|
-
add(run);
|
|
101
|
-
if (!run && !row.archived)
|
|
102
|
-
unparsed.add(row.id);
|
|
103
|
-
}
|
|
98
|
+
for (const row of db.listAll())
|
|
99
|
+
add(record(JSON.parse(row.data)));
|
|
104
100
|
for (const row of db.listLive())
|
|
105
101
|
live.add(row.id);
|
|
106
102
|
for (const claim of db.listClaims(true)) {
|
|
@@ -121,9 +117,6 @@ export function readLiveTaskView(root) {
|
|
|
121
117
|
add(run);
|
|
122
118
|
if (run && isLiveRecord(run))
|
|
123
119
|
live.add(run.id);
|
|
124
|
-
const raw = entry;
|
|
125
|
-
if (!run && typeof raw?.id === 'string' && raw.archived !== true)
|
|
126
|
-
unparsed.add(raw.id);
|
|
127
120
|
}
|
|
128
121
|
}
|
|
129
122
|
// A live task whose record cannot be read is still live: the check refuses what it cannot prove safe.
|
|
@@ -132,16 +125,7 @@ export function readLiveTaskView(root) {
|
|
|
132
125
|
throw new Error(`Cannot migrate ${root}: these tasks are marked live but their records cannot be read: ${unreadable.join(', ')}. `
|
|
133
126
|
+ 'Open the project with the binary that wrote them, finish or cancel each one, then retry');
|
|
134
127
|
}
|
|
135
|
-
return { listRuns: () => [], persistedLiveRunIds: () => ({ live: [...live], foreign: [...foreign] }), getRun: (id) => runs.get(id)
|
|
136
|
-
allRuns: () => [...runs.values()], unreadableUnarchived: () => [...unparsed].filter(id => !runs.has(id)).sort() };
|
|
137
|
-
}
|
|
138
|
-
function parseJson(text) {
|
|
139
|
-
try {
|
|
140
|
-
return JSON.parse(text);
|
|
141
|
-
}
|
|
142
|
-
catch {
|
|
143
|
-
return undefined;
|
|
144
|
-
}
|
|
128
|
+
return { listRuns: () => [], persistedLiveRunIds: () => ({ live: [...live], foreign: [...foreign] }), getRun: (id) => runs.get(id) };
|
|
145
129
|
}
|
|
146
130
|
/** Refuse when a cockpit serves the project; include live tasks in that first refusal. The fence checks them again. */
|
|
147
131
|
export async function assertNoProjectCockpit(root, homes, self = process.pid) {
|
|
@@ -157,34 +141,8 @@ export async function assertNoProjectCockpit(root, homes, self = process.pid) {
|
|
|
157
141
|
}
|
|
158
142
|
throw new ProjectInUseError(root, cockpits, tasks);
|
|
159
143
|
}
|
|
160
|
-
/** The project's live tasks, read without writing anything. */
|
|
144
|
+
/** The project's live tasks, read without writing anything: the fence's live-task check. */
|
|
161
145
|
export function projectLiveTasksOffline(root) {
|
|
162
146
|
return projectLiveTasks(readLiveTaskView(root));
|
|
163
147
|
}
|
|
164
|
-
/** The tasks of families another live process claims, read without writing anything: the fence's check. */
|
|
165
|
-
export function projectForeignTasksOffline(root) {
|
|
166
|
-
const view = readLiveTaskView(root);
|
|
167
|
-
const { foreign } = view.persistedLiveRunIds();
|
|
168
|
-
return projectLiveTasks({ ...view, persistedLiveRunIds: () => ({ live: [], foreign }) });
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* The ids of every task of the project that can still resume: each live task, and each task not
|
|
172
|
-
* archived, since a human can Continue a done, review, failed or cancelled task from its stored
|
|
173
|
-
* worktree. A migration leaves their own items in place. A deleted task has no record, so its
|
|
174
|
-
* items move.
|
|
175
|
-
*/
|
|
176
|
-
export function projectKeptRunIds(root) {
|
|
177
|
-
const view = readLiveTaskView(root);
|
|
178
|
-
// A task not archived may still be continued; with its record unreadable, its files cannot be proven safe to move.
|
|
179
|
-
const unreadable = view.unreadableUnarchived();
|
|
180
|
-
if (unreadable.length > 0) {
|
|
181
|
-
throw new Error(`Cannot migrate ${root}: these tasks are not archived but their records cannot be read: ${unreadable.join(', ')}. `
|
|
182
|
-
+ 'Open the project with the binary that wrote them and archive or delete each one, then retry');
|
|
183
|
-
}
|
|
184
|
-
const kept = new Set(projectLiveTasks(view).map(task => task.id));
|
|
185
|
-
for (const run of view.allRuns())
|
|
186
|
-
if (!run.archived)
|
|
187
|
-
kept.add(run.id);
|
|
188
|
-
return kept;
|
|
189
|
-
}
|
|
190
148
|
//# sourceMappingURL=live.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live.js","sourceRoot":"","sources":["../../src/project-migration/live.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM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KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1G,CAAC;IACD,MAAM,IAAI,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AACrD,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,uBAAuB,CAAC,IAAY;IAClD,OAAO,gBAAgB,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -6,8 +6,7 @@ import type { MigrationFault } from './steps.ts';
|
|
|
6
6
|
* One offline project migration (hearsay-tools/cezarion#3089). It refuses while any cockpit it can
|
|
7
7
|
* see serves the project (`live.ts`). It then takes the project's `cockpit.lock` and its migration
|
|
8
8
|
* fence, so no cockpit boots on the project and no process that checks admission is admitted; under the fence it
|
|
9
|
-
* refuses while
|
|
10
|
-
* Every other task that is not archived keeps its own items in `.ai/cezar/`. An unfinished
|
|
9
|
+
* refuses while any task is live, then runs the engine and releases both claims. An unfinished
|
|
11
10
|
* journal finishes first and is reported as the migration. A dry run holds only `cockpit.lock`
|
|
12
11
|
* while it plans and writes nothing.
|
|
13
12
|
*/
|
|
@@ -19,9 +18,8 @@ export declare function migrateProjectOffline(root: string, options: {
|
|
|
19
18
|
}): Promise<ProjectMigrationAnswer>;
|
|
20
19
|
/**
|
|
21
20
|
* The move itself, shared by the command and the cockpit's automatic move: take the fence with
|
|
22
|
-
* `ownership` (which owns, or then owns, `cockpit.lock`), refuse while
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* keeps or releases `cockpit.lock`.
|
|
21
|
+
* `ownership` (which owns, or then owns, `cockpit.lock`), refuse while any task is live (the check
|
|
22
|
+
* reads the run stores without writing, so a refusal writes nothing), run the engine, release the
|
|
23
|
+
* fence. The caller keeps or releases `cockpit.lock`.
|
|
26
24
|
*/
|
|
27
25
|
export declare function moveUnderFence(root: string, ownership: CockpitOwnership, fault?: MigrationFault): Promise<ProjectMigrationAnswer>;
|
|
@@ -2,14 +2,13 @@ import { pathPresent, projectPaths } from '../project-paths.js';
|
|
|
2
2
|
import { assertProjectAdmitted, CockpitOwnership } from '../server/cockpit-ownership.js';
|
|
3
3
|
import { dryRunAnswer, migrationAnswer } from './answer.js';
|
|
4
4
|
import { migrateProject } from './engine.js';
|
|
5
|
-
import { assertNoProjectCockpit,
|
|
5
|
+
import { assertNoProjectCockpit, projectLiveTasksOffline } from './live.js';
|
|
6
6
|
import { recoverProjectMigration } from './recovery.js';
|
|
7
7
|
/**
|
|
8
8
|
* One offline project migration (hearsay-tools/cezarion#3089). It refuses while any cockpit it can
|
|
9
9
|
* see serves the project (`live.ts`). It then takes the project's `cockpit.lock` and its migration
|
|
10
10
|
* fence, so no cockpit boots on the project and no process that checks admission is admitted; under the fence it
|
|
11
|
-
* refuses while
|
|
12
|
-
* Every other task that is not archived keeps its own items in `.ai/cezar/`. An unfinished
|
|
11
|
+
* refuses while any task is live, then runs the engine and releases both claims. An unfinished
|
|
13
12
|
* journal finishes first and is reported as the migration. A dry run holds only `cockpit.lock`
|
|
14
13
|
* while it plans and writes nothing.
|
|
15
14
|
*/
|
|
@@ -39,13 +38,12 @@ export async function migrateProjectOffline(root, options) {
|
|
|
39
38
|
}
|
|
40
39
|
/**
|
|
41
40
|
* The move itself, shared by the command and the cockpit's automatic move: take the fence with
|
|
42
|
-
* `ownership` (which owns, or then owns, `cockpit.lock`), refuse while
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* keeps or releases `cockpit.lock`.
|
|
41
|
+
* `ownership` (which owns, or then owns, `cockpit.lock`), refuse while any task is live (the check
|
|
42
|
+
* reads the run stores without writing, so a refusal writes nothing), run the engine, release the
|
|
43
|
+
* fence. The caller keeps or releases `cockpit.lock`.
|
|
46
44
|
*/
|
|
47
45
|
export async function moveUnderFence(root, ownership, fault) {
|
|
48
|
-
const fence = await ownership.fenceProject(projectPaths(root).write, { liveTasks: () =>
|
|
46
|
+
const fence = await ownership.fenceProject(projectPaths(root).write, { liveTasks: () => projectLiveTasksOffline(root) });
|
|
49
47
|
try {
|
|
50
48
|
return migrationAnswer(await migrateProject({ repoRoot: root, fence, ...(fault ? { fault } : {}) }));
|
|
51
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offline.js","sourceRoot":"","sources":["../../src/project-migration/offline.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,eAAe,EAA+B,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"offline.js","sourceRoot":"","sources":["../../src/project-migration/offline.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,eAAe,EAA+B,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAGxD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,IAAY,EAAE,OAEzD;IACC,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;IACzC,MAAM,sBAAsB,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,MAAM,SAAS,GAAG,IAAI,gBAAgB,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C,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACvG,CAAC;YAAS,CAAC;QAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IAAC,CAAC;AAChC,CAAC"}
|
|
@@ -6,12 +6,6 @@ import type { PathRewrite } from './journal.ts';
|
|
|
6
6
|
* file left in place with the `git mv` that moves it, every worktree repair and every path rewrite,
|
|
7
7
|
* plus what blocks it. Planning writes nothing: no directory, Git metadata, receipt, run record or
|
|
8
8
|
* journal changes, and the run store is read so that no SQLite sidecar is created.
|
|
9
|
-
*
|
|
10
|
-
* The own items of a task that can still resume at planning (`keep`: live or not archived; its
|
|
11
|
-
* worktree, `runs/<id>…` files and scratch directories, `legacy-runs.ts`) stay in `.ai/cezar/`, and
|
|
12
|
-
* no stored path into them is rewritten. A moved project whose `.ai/cezar/` still holds items plans
|
|
13
|
-
* again: what no kept task owns now moves, so the items of a task archived or deleted since follow
|
|
14
|
-
* the rest.
|
|
15
9
|
*/
|
|
16
10
|
export declare const LEGACY_PROJECT_DIR = ".ai/cezar";
|
|
17
11
|
export declare const MIGRATED_PROJECT_DIR = ".ai/squawk";
|
|
@@ -48,14 +42,8 @@ export interface ProjectMigrationPlan {
|
|
|
48
42
|
/** Shell commands, run from any directory, that move the tracked files for the user to commit. */
|
|
49
43
|
gitMv: string[];
|
|
50
44
|
notRewritten: readonly string[];
|
|
51
|
-
/** A completed migration marked the project moved
|
|
45
|
+
/** A completed migration marked the project moved: the plan moves and rewrites nothing. */
|
|
52
46
|
alreadyMoved: boolean;
|
|
53
|
-
/** The kept tasks (live or not archived) whose own items stay in the old directory after this plan, sorted. */
|
|
54
|
-
leftovers: string[];
|
|
55
|
-
}
|
|
56
|
-
export interface ProjectMigrationPlanOptions {
|
|
57
|
-
/** The tasks that can still resume at planning (live or not archived): their own items stay where they are. */
|
|
58
|
-
keep?: ReadonlySet<string>;
|
|
59
47
|
}
|
|
60
48
|
/** Git in `cwd`; undefined when it fails. */
|
|
61
49
|
export declare function gitOutput(cwd: string, args: string[]): Promise<string | undefined>;
|
|
@@ -76,8 +64,6 @@ export interface PathMapping {
|
|
|
76
64
|
moves: readonly MigrationMove[];
|
|
77
65
|
/** Tracked files, relative to the root with `/`. */
|
|
78
66
|
tracked: ReadonlySet<string>;
|
|
79
|
-
/** Tasks whose own items stay: no path into one moves. */
|
|
80
|
-
keep?: ReadonlySet<string>;
|
|
81
67
|
}
|
|
82
68
|
/**
|
|
83
69
|
* Where a stored path goes, in the root form it was written in; undefined when it stays. A path
|
|
@@ -92,12 +78,6 @@ type JsonField = string[];
|
|
|
92
78
|
export declare function valueAt(value: unknown, field: readonly string[]): unknown;
|
|
93
79
|
/** Every stored path field of a run record that a migration rewrites. */
|
|
94
80
|
export declare function runRecordPathFields(record: unknown): JsonField[];
|
|
95
|
-
/**
|
|
96
|
-
* Whether a run record field feeds an owned worker's private identity: `workerWorkflowHash` hashes
|
|
97
|
-
* the whole `workflowDef`, `workerContextHash` the whole `delegation.context`. The identity file is
|
|
98
|
-
* immutable evidence, so a kept task keeps these fields as they were written.
|
|
99
|
-
*/
|
|
100
|
-
export declare function identityBoundField(field: readonly string[]): boolean;
|
|
101
81
|
export declare function handoffWorktreeLine(text: string): string | undefined;
|
|
102
82
|
/** `text` with its seeded worktree line naming `to`, when it still names `from`; else unchanged. */
|
|
103
83
|
export declare function rewriteHandoffWorktreeLine(text: string, from: string, to: string): string;
|
|
@@ -105,13 +85,7 @@ export declare function redirectedComponent(base: string, path: string): string
|
|
|
105
85
|
/** A path Git printed, in this platform's form: Git for Windows prints forward slashes. */
|
|
106
86
|
export declare function gitReportedPath(path: string, api?: Pick<typeof nodePath, 'normalize'>): string;
|
|
107
87
|
/** The dry run, and the plan a real migration writes into its journal. Writes nothing. */
|
|
108
|
-
export declare function planProjectMigration(repoRoot: string
|
|
109
|
-
/** Whether the old directory `source` holds anything but the `cockpit.lock*` ownership claims.
|
|
110
|
-
* One that cannot be listed may: the planner then reports why. */
|
|
111
|
-
export declare function legacyItemsPresent(source: string): boolean;
|
|
112
|
-
/** Whether a moved project still has work for a move: items in the old directory `source`, or an
|
|
113
|
-
* unreadable kept-task list in `destination`, which a move rewrites from the run store. */
|
|
114
|
-
export declare function legacyStateLeft(source: string, destination: string): boolean;
|
|
88
|
+
export declare function planProjectMigration(repoRoot: string): Promise<ProjectMigrationPlan>;
|
|
115
89
|
/** The dry run as text: every move, repair, rewrite, tracked file and conflict, and the boundary. */
|
|
116
90
|
export declare function describeProjectMigrationPlan(plan: ProjectMigrationPlan): string;
|
|
117
91
|
export {};
|