Skip to content

Commit 53625bc

Browse files
Validation code changes to handle paths
1 parent e66f900 commit 53625bc

1 file changed

Lines changed: 3 additions & 61 deletions

File tree

packages/altimate-code/src/cli/cmd/validate.ts

Lines changed: 3 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ async function getAssets(): Promise<ValidateAssets> {
3434
}
3535
}
3636
// Development fallback: read from disk relative to this source file
37-
const hooksDir = path.join(import.meta.dir, "../hooks")
38-
const skillsDir = path.join(import.meta.dir, "../skills/validate")
37+
const hooksDir = path.join(import.meta.dir, "../../hooks")
38+
const skillsDir = path.join(import.meta.dir, "../../skills/validate")
3939
const [loggerContent, settingsContent, skillMd, batchPy] = await Promise.all([
4040
fs.readFile(path.join(hooksDir, "langfuse_logger.py"), "utf-8"),
4141
fs.readFile(path.join(hooksDir, "settings.json"), "utf-8"),
@@ -108,29 +108,6 @@ async function mergeHooks(sourceSettingsContent: string, targetSettingsPath: str
108108
return mergedCount
109109
}
110110

111-
async function mergeEnvFile(envPath: string, vars: Record<string, string>): Promise<void> {
112-
const existing: Record<string, string> = {}
113-
114-
const fileExists = await fs
115-
.access(envPath)
116-
.then(() => true)
117-
.catch(() => false)
118-
if (fileExists) {
119-
const content = await fs.readFile(envPath, "utf-8")
120-
for (const line of content.split("\n")) {
121-
const trimmed = line.trim()
122-
if (!trimmed || trimmed.startsWith("#")) continue
123-
const eqIdx = trimmed.indexOf("=")
124-
if (eqIdx === -1) continue
125-
const key = trimmed.slice(0, eqIdx).trim()
126-
const value = trimmed.slice(eqIdx + 1).trim()
127-
existing[key] = value
128-
}
129-
}
130-
131-
Object.assign(existing, vars)
132-
await fs.writeFile(envPath, Object.entries(existing).map(([k, v]) => `${k}=${v}`).join("\n") + "\n")
133-
}
134111

135112
const InstallSubcommand = cmd({
136113
command: "install",
@@ -166,42 +143,7 @@ const InstallSubcommand = cmd({
166143
await fs.writeFile(path.join(skillTargetDir, "batch_validate.py"), batchPy)
167144
spinner.stop(`Installed /validate skill → ${skillTargetDir}`)
168145

169-
// 3. Prompt for Langfuse credentials
170-
prompts.log.message("")
171-
const configureLangfuse = await prompts.confirm({
172-
message: "Do you have a Langfuse account and want to configure your own credentials?",
173-
initialValue: false,
174-
})
175-
176-
if (!prompts.isCancel(configureLangfuse) && configureLangfuse) {
177-
const secretKey = await prompts.text({
178-
message: "LANGFUSE_SECRET_KEY_VALIDATION:",
179-
placeholder: "sk-lf-...",
180-
})
181-
const publicKey = await prompts.text({
182-
message: "LANGFUSE_PUBLIC_KEY_VALIDATION:",
183-
placeholder: "pk-lf-...",
184-
})
185-
const baseUrl = await prompts.text({
186-
message: "LANGFUSE_BASE_URL_VALIDATION:",
187-
placeholder: "https://cloud.langfuse.com",
188-
defaultValue: "https://cloud.langfuse.com",
189-
})
190-
191-
if (!prompts.isCancel(secretKey) && !prompts.isCancel(publicKey) && !prompts.isCancel(baseUrl)) {
192-
spinner.start("Writing Langfuse credentials to ~/.claude/.env...")
193-
const envPath = path.join(claudeDir, ".env")
194-
await mergeEnvFile(envPath, {
195-
LANGFUSE_SECRET_KEY_VALIDATION: secretKey as string,
196-
LANGFUSE_PUBLIC_KEY_VALIDATION: publicKey as string,
197-
LANGFUSE_BASE_URL_VALIDATION: (baseUrl as string) || "https://cloud.langfuse.com",
198-
})
199-
spinner.stop(`Credentials written to ${envPath}`)
200-
}
201-
} else {
202-
prompts.log.info("Skipping Langfuse configuration — default keys will be used.")
203-
}
204-
146+
prompts.log.info(`Place your credentials in ${path.join(claudeDir, ".env")}`)
205147
prompts.outro("Altimate validation hooks installed successfully!")
206148
},
207149
})

0 commit comments

Comments
 (0)