Skip to content

Commit 22df511

Browse files
feat: upgrade to V2 APIs, enhance prompt system, and add branch management tools
- Migrated from V1 to V2 ValTown APIs across all tool implementations - Renamed prompt system to "valley" with configurable path override - Added comprehensive branch management tools (create, delete, list, merge) - Enhanced file operations with better error handling and validation - Expanded vals tools with new V2 API endpoints and features - Updated configuration interface to support new API structure - Improved documentation and integration guides 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6b07d93 commit 22df511

File tree

11 files changed

+1740
-748
lines changed

11 files changed

+1740
-748
lines changed

config.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {config as dotenvConfig} from "https://deno.land/x/dotenv@v3.2.2/mod.ts"
22
import * as path from "jsr:@std/path"
3-
export function loadConfig() {
3+
import {getCliAvailability} from "./lib/vtCli.ts"
4+
export async function loadConfig() {
45
dotenvConfig({export: true})
56

67
const API_TOKEN = Deno.env.get("VAL_TOWN_API_TOKEN")
@@ -14,12 +15,16 @@ export function loadConfig() {
1415
const CLI_PATH = Deno.env.get("VAL_TOWN_CLI_PATH") || "vt" // Default to "vt" in PATH
1516
// Prompt file paths (can be absolute or relative to CWD)
1617
const VALLEY_PROMPT_PATH = Deno.env.get("VALLEY_PROMPT_PATH")
18+
const useCliIfAvailable = PREFER_CLI ?? false
19+
const cliAvailable = useCliIfAvailable && await getCliAvailability(CLI_PATH)
20+
const defaultPromptPath = `${import.meta.dirname}/prompts/${cliAvailable ? "valley.txt" : "valley_local.txt"}`
21+
1722

1823
// Resolve paths relative to the current working directory if they're not absolute
1924
const resolvedValleyPath = VALLEY_PROMPT_PATH
2025
? (path.isAbsolute(VALLEY_PROMPT_PATH)
2126
? VALLEY_PROMPT_PATH
22-
: `${import.meta.dirname}/valley.txt`)
27+
: defaultPromptPath)
2328
: undefined
2429
return {
2530
apiToken: API_TOKEN,
@@ -31,7 +36,7 @@ export function loadConfig() {
3136
prompts: {
3237
valleyPath: resolvedValleyPath,
3338
// Default paths included with the binary
34-
defaultValleyPath: `${import.meta.dirname}/valley.txt`
39+
defaultValleyPath: defaultPromptPath
3540
}
3641
}
3742
}

0 commit comments

Comments
 (0)