🌳
pt0/serverF/libF/ptAnchorPathF.mts
1// Branded types for pt_mv-trackable vs intentionally dynamic paths
2export type AnchoredPtPath = string & { readonly __anchored: true }
3export type DynamicPtPath = string & { readonly __dynamic: true }
4export type CopyablePtPath = AnchoredPtPath | DynamicPtPath
6// Mark a pt-relative path as move-trackable. When the referenced file is moved via pt_mv,
7// this string literal will be auto-updated.
8// Usage: const certMgrPath = ptAnchorPath('pt0/deployF/k8sF/initialSetupF/certmanager/doSyncCertManagerF.mts')
9export const ptAnchorPath = <T extends string>(ptRelativePath: T): T & AnchoredPtPath =>
10 ptRelativePath as T & AnchoredPtPath
12// Mark a path as intentionally dynamic (computed at runtime). These won't be tracked by pt_mv.
13// Use when path comes from a parameter, config, or is computed - acknowledges the risk explicitly.
14export const ptDynamicPath = <T extends string>(path: T): T & DynamicPtPath =>
15 path as T & DynamicPtPath