drop the unused hawser stacks-dir column and layout

This commit is contained in:
Jarek Krochmalski committed 2026-09-02 15:52:44 +02:00
1 parent 5af4e69eb2
commit 3fa75c9702
10 files changed
+2 -7528

No files matched your search

-1
View File
@@ -44,7 +44,6 @@ export const environments = sqliteTable('environments', {
hawserAgentName: text('hawser_agent_name'),
hawserVersion: text('hawser_version'),
hawserCapabilities: text('hawser_capabilities'), // JSON array: ["compose", "exec", "metrics"]
hawserStacksDir: text('hawser_stacks_dir'), // Remote STACKS_DIR reported by agent
createdAt: text('created_at').default(sql`CURRENT_TIMESTAMP`),
updatedAt: text('updated_at').default(sql`CURRENT_TIMESTAMP`)
});
-1
View File
@@ -47,7 +47,6 @@ export const environments = pgTable('environments', {
hawserAgentName: text('hawser_agent_name'),
hawserVersion: text('hawser_version'),
hawserCapabilities: text('hawser_capabilities'), // JSON array: ["compose", "exec", "metrics"]
hawserStacksDir: text('hawser_stacks_dir'), // Remote STACKS_DIR reported by agent
createdAt: timestamp('created_at', { mode: 'string' }).defaultNow(),
updatedAt: timestamp('updated_at', { mode: 'string' }).defaultNow()
});
-72
View File
@@ -1,72 +0,0 @@
import { join, relative, resolve } from 'node:path';
import { isPathUnderRoot } from './path-utils';
function remapPathBetweenStackDirs(fromDir: string, toDir: string, path: string): string {
const fromResolved = resolve(fromDir);
const toResolved = resolve(toDir);
const resolved = resolve(path);
if (isPathUnderRoot(resolved, fromResolved)) {
return join(toResolved, relative(fromResolved, resolved));
}
return path;
}
function remapPathsBetweenStackDirs(fromDir: string, toDir: string, paths: string[]): string[] {
return paths.map((p) => remapPathBetweenStackDirs(fromDir, toDir, p));
}
function remapComposeContentsBetweenStackDirs(
fromDir: string,
toDir: string,
contents: Record<string, string>
): Record<string, string> {
const remapped: Record<string, string> = {};
for (const [path, content] of Object.entries(contents)) {
remapped[remapPathBetweenStackDirs(fromDir, toDir, path)] = content;
}
return remapped;
}
/**
* Remap absolute paths from Dockhand's Hawser staging dir to the remote host stack dir.
*/
export function remapPathsFromStagingToRemote(
stagingStackDir: string,
remoteStackDir: string,
paths: string[]
): string[] {
return remapPathsBetweenStackDirs(stagingStackDir, remoteStackDir, paths);
}
/**
* Remap absolute paths from the Hawser remote stack dir back to Dockhand staging.
*/
export function remapPathsFromRemoteToStaging(
stagingStackDir: string,
remoteStackDir: string,
paths: string[]
): string[] {
return remapPathsBetweenStackDirs(remoteStackDir, stagingStackDir, paths);
}
/**
* Remap composeContents keys from staging paths to remote display paths.
*/
export function remapComposeContentsFromStagingToRemote(
stagingStackDir: string,
remoteStackDir: string,
contents: Record<string, string>
): Record<string, string> {
return remapComposeContentsBetweenStackDirs(stagingStackDir, remoteStackDir, contents);
}
/**
* Remap composeContents keys from remote display paths back to staging paths.
*/
export function remapComposeContentsFromRemoteToStaging(
stagingStackDir: string,
remoteStackDir: string,
contents: Record<string, string>
): Record<string, string> {
return remapComposeContentsBetweenStackDirs(remoteStackDir, stagingStackDir, contents);
}