Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

prompting to simplify _apply.sh. map loading/updating fixes. v2 > main

Dane Schneiderd47ce5ffb73f
diff --git a/README.md b/README.md
index 5d037c5c..40be9e1e 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@
<b>Website</b>
</a>
·
- <a href="https://docs-plandex.ai/">
+ <a href="https://docs.plandex.ai/">
<b>Docs</b>
</a>
·
@@ -29,7 +29,7 @@
<b>Examples</b>
</a>
· -->
- <a href="https://docs-plandex.ai/hosting/self-hosting/local-mode-quickstart">
+ <a href="https://docs.plandex.ai/hosting/self-hosting/local-mode-quickstart">
<b>Local Self-Hosted Mode</b>
</a>
</p>
@@ -180,7 +180,7 @@ curl -sL https://plandex.ai/install.sh | bash
**Note:** Windows is supported via [WSL](https://learn.microsoft.com/en-us/windows/wsl/install). Plandex only works correctly on Windows in the WSL shell. It doesn't work in the Windows CMD prompt or PowerShell.
-[More installation options.](https://docs-plandex.ai/install)
+[More installation options.](https://docs.plandex.ai/install)
## Hosting  ⚖️
@@ -235,7 +235,7 @@ Then just give the REPL help text a quick read, and you're ready go. The REPL st
## Docs  🛠️
-### [👉  Full documentation.](https://docs-plandex.ai/)
+### [👉  Full documentation.](https://docs.plandex.ai/)
<br/>
@@ -259,4 +259,4 @@ Please feel free to give your feedback, ask questions, report a bug, or just han
⭐️  Please star, fork, explore, and contribute to Plandex. There's a lot of work to do and so much that can be improved.
-[Here's an overview on setting up a development environment.](https://docs-plandex.ai/development)
+[Here's an overview on setting up a development environment.](https://docs.plandex.ai/development)
diff --git a/app/cli/api/clients.go b/app/cli/api/clients.go
index 9d505f4b..3ba98166 100644
--- a/app/cli/api/clients.go
+++ b/app/cli/api/clients.go
@@ -25,7 +25,7 @@ func init() {
CloudApiHost = "http://localhost:8099"
}
} else {
- CloudApiHost = "https://api-plandex.ai"
+ CloudApiHost = "https://api-v2.plandex.ai"
}
}
diff --git a/app/cli/fs/paths.go b/app/cli/fs/paths.go
index 75a334ef..6598dd96 100644
--- a/app/cli/fs/paths.go
+++ b/app/cli/fs/paths.go
@@ -290,15 +290,20 @@ func GetPaths(baseDir, currentDir string) (*types.ProjectPaths, error) {
activePaths[dir] = true
}
+ removeDirs := map[string]bool{}
for dir := range allDirs {
if ShouldSkipDir(dir) {
- delete(allDirs, dir)
- delete(activeDirs, dir)
- delete(allPaths, dir)
- delete(activePaths, dir)
+ removeDirs[dir] = true
}
}
+ for dir := range removeDirs {
+ delete(allDirs, dir)
+ delete(activeDirs, dir)
+ delete(allPaths, dir)
+ delete(activePaths, dir)
+ }
+
// remove deleted files from active paths
for path := range deletedFiles {
delete(activePaths, path)
@@ -308,6 +313,20 @@ func GetPaths(baseDir, currentDir string) (*types.ProjectPaths, error) {
allPaths[path] = true
}
+ removePaths := map[string]bool{}
+ for path := range allPaths {
+ if IsInSkippedDir(path) {
+ removePaths[path] = true
+ }
+ }
+
+ for path := range removePaths {
+ delete(allPaths, path)
+ delete(activePaths, path)
+ delete(activeDirs, path)
+ delete(allDirs, path)
+ }
+
ignoredPaths := map[string]string{}
for path := range allPaths {
if _, ok := activePaths[path]; !ok {
@@ -485,11 +504,11 @@ var skipDirs = map[string]bool{
}
func ShouldSkipDir(path string) bool {
- for k := range skipDirs {
- if k == path {
- return true
- }
+ if skipDirs[path] {
+ return true
+ }
+ for k := range skipDirs {
splitPath := strings.Split(path, string(os.PathSeparator))
for _, p := range splitPath {
if p == k {
@@ -500,3 +519,21 @@ func ShouldSkipDir(path string) bool {
return false
}
+
+func IsInSkippedDir(path string) bool {
+ // Check the direct parent directory
+ dirName := filepath.Dir(path)
+ if skipDirs[dirName] {
+ return true
+ }
+
+ // Handle cases where the directory might include path separators
+ pathComponents := strings.Split(dirName, string(os.PathSeparator))
+ for _, component := range pathComponents {
+ if skipDirs[component] {
+ return true
+ }
+ }
+
+ return false
+}
diff --git a/app/cli/lib/context_load.go b/app/cli/lib/context_load.go
index df946354..77fbb983 100644
--- a/app/cli/lib/context_load.go
+++ b/app/cli/lib/context_load.go
@@ -651,18 +651,19 @@ func MustLoadContext(resources []string, params *types.LoadContextParams) {
}
}
- if len(pathBodies) > 0 {
- loadContextReq = append(loadContextReq, &shared.LoadContextParams{
- ContextType: shared.ContextMapType,
- Name: name,
- MapBodies: pathBodies,
- InputShas: pathShas,
- InputTokens: pathTokens,
- InputSizes: pathSizes,
- FilePath: inputPath,
- AutoLoaded: params.AutoLoaded,
- })
- }
+ // load the map even if it's empty (no paths)
+ // it needs to exist so it can be updated later
+ loadContextReq = append(loadContextReq, &shared.LoadContextParams{
+ ContextType: shared.ContextMapType,
+ Name: name,
+ MapBodies: pathBodies,
+ InputShas: pathShas,
+ InputTokens: pathTokens,
+ InputSizes: pathSizes,
+ FilePath: inputPath,
+ AutoLoaded: params.AutoLoaded,
+ })
+
}
}
diff --git a/app/server/model/prompts/apply_exec.go b/app/server/model/prompts/apply_exec.go
index f98cafa6..112df2c7 100644
--- a/app/server/model/prompts/apply_exec.go
+++ b/app/server/model/prompts/apply_exec.go
@@ -35,6 +35,12 @@ BE CAREFUL AND CONSERVATIVE when making changes to the user's machine:
Avoid user prompts. Make reasonable default choices rather than prompting the user for input. The _apply.sh script MUST be able to run successfully in a non-interactive context.
+#### Keep It Lightweight And Simple
+
+The _apply.sh script should be lightweight and shouldn't do too much work. *Offload to separate files* in the plan if a lot of scripting is needed. _apply.sh doesn't get written to the user's project, so anything that might be valuable to save, reuse, and version control should be in a separate file. You can chmod and execute those separate files from _apply.sh. _apply.sh is for 'throwaway' commands that only need to be run once after the plan is applied to the user's project, like installing dependencies, running tests, or starting servers. It shouldn't be complex.
+
+Do not use fancy bash constructs that can be difficult to debug or cause portability problems. Keep it very straightforward so there's a 0% chance of bugs in the _apply.sh script.
+
#### Command Preservation Rules
The _apply.sh script accumulates commands during the plan:
@@ -677,6 +683,9 @@ Good Practices:
- Update existing commands rather than duplicating
- Consider environment and likely installed tools
- Group related file changes with their commands
+- Keep it lightweight and simple
+- Offload to separate files if a lot of scripting is needed
+- Use basic scripting that is easy to understand and debug
Bad Practices to Avoid:
- Don't write same command multiple times
@@ -685,6 +694,8 @@ Bad Practices to Avoid:
- Don't run same program multiple times
- Don't hide command output
- Don't prompt the user for input
+- Don't use fancy bash constructs that can be difficult to understand and debug
+- Don't do too much work in _apply.sh. If it's getting complex, offload to separate files.
Remember:
- Include _apply.sh in 'Uses:' list when modifying it
@@ -878,6 +889,10 @@ CRITICAL: The script must handle both program execution and security carefully:
- If the plan involves adding a single test or a small number of tests, include commands to run *just those tests* by default in _apply.sh rather than running the entire test suite. Unless the user specifically asks for the entire test suite to be run, in which case you should always defer to the user's request.
- Apply the same principle to other commands. Be minimal and selective when choosing which commands to run.
+7. Keep It Lightweight And Simple
+ - The _apply.sh script should be lightweight and shouldn't do too much work. *Offload to separate files* in the plan if a lot of scripting is needed.
+ - Do not use fancy bash constructs that can be difficult to debug or cause portability problems.
+
Remember:
- Do NOT tell the user to run _apply.sh. It will be run automatically when the plan is applied.
- Do NOT tell the user to make _apply.sh executable or grant it permissions. This will all be done automatically.