MCPcopy Index your code
hub / github.com/garrytan/gstack / readVersionString

Function readVersionString

design/src/daemon-state.ts:67–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65 * back. This keeps client.expectedVersion and daemon.VERSION coherent.
66 */
67export function readVersionString(): string {
68 const env = process.env.DESIGN_DAEMON_VERSION;
69 if (env) return env;
70 const candidates = [
71 // Compiled binary: design/dist/design lives alongside design/dist/.version
72 path.join(path.dirname(process.execPath), ".version"),
73 // Dev: design/src/* → repo root is two levels up
74 path.join(import.meta.dir, "..", "..", "VERSION"),
75 // Defensive: design/dist sibling of source tree
76 path.join(import.meta.dir, "..", "dist", ".version"),
77 ];
78 for (const p of candidates) {
79 try {
80 const v = fs.readFileSync(p, "utf-8").trim();
81 if (v) return v;
82 } catch {
83 // try next
84 }
85 }
86 return "unknown";
87}
88
89export function readStateFile(stateFile: string = resolveStateFilePath()): DaemonState | null {
90 try {

Callers 2

daemon.tsFile · 0.90
readPackageVersionFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected