fix: make global task autocomplete work by calling shell function instead of ./task
This commit is contained in:
6 files changed
+50
-40
No files matched your search
@@ -78,7 +78,7 @@ output_completion_script() {
|
||||
# Taskfile completion for fish
|
||||
|
||||
function __task_commands
|
||||
./task help 2>/dev/null | grep -A100 -e '---' | awk '{print $2}' | sed 's/^[[:space:]]*//' | grep -v '^$'
|
||||
task help 2>/dev/null | grep -A100 -e '---' | awk '{print $2}' | sed 's/^[[:space:]]*//' | grep -v '^$'
|
||||
end
|
||||
|
||||
# First argument position: offer the list of task commands.
|
||||
@@ -100,7 +100,7 @@ _task_completions() {
|
||||
# $CURRENT is zsh's 1-indexed equivalent of bash's COMP_CWORD.
|
||||
# CURRENT == 2 means we're completing the first argument after `task`/`t`.
|
||||
if [[ $CURRENT -eq 2 ]]; then
|
||||
IFS=$'\n' reply=($(./task help | grep -A999 -e '---' | awk '{print $2}' | sed 's/^[[:space:]]*//' | grep -v '^$'))
|
||||
IFS=$'\n' reply=($(task help | grep -A999 -e '---' | awk '{print $2}' | sed 's/^[[:space:]]*//' | grep -v '^$'))
|
||||
IFS=$si
|
||||
if (( ${#reply} > 0 )); then
|
||||
_describe 'task' reply
|
||||
@@ -125,7 +125,7 @@ _task_completions() {
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
# compgen -W wants a single space-separated string, so tr is fine here.
|
||||
commands=$(./task help | grep -A999 -e '---' | awk '{print $2}' | sed 's/^[[:space:]]*//' | grep -v '^$' | tr '\n' ' ')
|
||||
commands=$(task help | grep -A999 -e '---' | awk '{print $2}' | sed 's/^[[:space:]]*//' | grep -v '^$' | tr '\n' ' ')
|
||||
|
||||
if [[ ${COMP_CWORD} == 1 ]]; then
|
||||
COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") )
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
show-dotenv-setup() {
|
||||
show-project-setup() {
|
||||
TASK_DOTENV_DIR=${TASK_DOTENV_DIR:="$HOME/.config/taskfile.build"}
|
||||
|
||||
local project_name
|
||||
@@ -44,6 +44,6 @@ show-dotenv-setup() {
|
||||
echo "Age key file: not found"
|
||||
fi
|
||||
}
|
||||
sds() {
|
||||
show-dotenv-setup "$@"
|
||||
sps() {
|
||||
show-project-setup "$@"
|
||||
}
|
||||
+9
-9
@@ -85,15 +85,6 @@ rows+=("open-with-os|<path>|Open file or url with default application.")
|
||||
rows+=("open-url|<url>|Open url.")
|
||||
```
|
||||
|
||||
### show-dotenv-setup
|
||||
|
||||
```bash
|
||||
rows+=("show-dotenv-setup||Show info about the dotenv setup.")
|
||||
```
|
||||
|
||||
Displays the dotenv, KeePass / Pass entries, age key file, age public key,
|
||||
`.sops.yaml` config and `SOPS_AGE_KEY` status.
|
||||
|
||||
### setup-completion
|
||||
|
||||
```bash
|
||||
@@ -279,6 +270,15 @@ rows+=("list-agekeys||List age keys from the default key file.")
|
||||
|
||||
Lists the public keys, names and creation dates from `~/.config/sops/age/keys.txt`.
|
||||
|
||||
### show-project-setup
|
||||
|
||||
```bash
|
||||
rows+=("show-project-setup||Show project setup info.")
|
||||
```
|
||||
|
||||
Displays the project name, dotenv, KeePass / Pass entries, age key file, age public key,
|
||||
`.sops.yaml` config and `SOPS_AGE_KEY` status.
|
||||
|
||||
### rename-dotenv
|
||||
|
||||
```bash
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ task init-dotenv-sops taskfile.build
|
||||
Show the current setup with:
|
||||
|
||||
```bash
|
||||
task show-dotenv-setup
|
||||
task show-project-setup
|
||||
```
|
||||
|
||||
List age keys in the default key file:
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
---
|
||||
title: "Prompt-log improvements"
|
||||
title: "Make global autocomplete work"
|
||||
author: "Janik von Rotz <login@janikvonrotz.ch>"
|
||||
state: completed
|
||||
date_completed: 2026-10-13
|
||||
state: review
|
||||
date_completed:
|
||||
harness: pi
|
||||
model: moonshotai/Kimi-K2.6
|
||||
input_tokens: 36301
|
||||
output_tokens: 11701
|
||||
input_tokens:
|
||||
output_tokens:
|
||||
---
|
||||
|
||||
# Prompt-log improvements
|
||||
# Make global autocomplete work
|
||||
|
||||
Note: @Clanker refers to the "ai agent" (you) who is working on this prompt file.
|
||||
|
||||
@@ -25,28 +25,38 @@ Note: @Clanker refers to the "ai agent" (you) who is working on this prompt file
|
||||
|
||||
## Task
|
||||
|
||||
Here are some improvements for the work with `prompt-log`.
|
||||
If I try to run the zsh `task` autocomplete in a folder without `task` file. Then the autocomplete does not work:
|
||||
|
||||
When I run `create-prompt` and there is already a `prompt.md` I want you to run `commit-prompt` in order to store the current prompt file.
|
||||
|
||||
This prompt file has been updated with new instructions. When the task is completed the state of the prompt file must be `review`. The clanker then asks the user if the result checks. The worklog is used whether the author confirms or not. I added this text to the prompt.md:
|
||||
|
||||
```markdown
|
||||
@Clanker When task is completed set frontmatter to review. Prompt the author to verify the results.
|
||||
|
||||
## Worklog
|
||||
|
||||
@Clanker Add a summary here once the task has been completed.
|
||||
|
||||
@Clanker If author confirms results set frontmatter state to completed, otherwise to aborted. Update date, harness and model. If you have access to session info also add token count.
|
||||
```
|
||||
task <tab> ini_task_completions:7: no such file or directory: ./task
|
||||
_task_completions:7: no such file or directory: ./task
|
||||
_task_completions:7: no such file or directory: ./task
|
||||
```
|
||||
|
||||
Check the text for typos and logical issues. Then update `prompt.md.template`.
|
||||
The `task` command is function loaded into the profile
|
||||
|
||||
@Clanker When task is completed set frontmatter to review. Prompt the author to verify the results.
|
||||
```bash
|
||||
[~]$ which task
|
||||
task () {
|
||||
if [[ -f "./task" && -x "./task" ]]
|
||||
then
|
||||
./task "$@"
|
||||
else
|
||||
"$HOME/.local/bin/task" "$@"
|
||||
fi
|
||||
}
|
||||
```
|
||||
|
||||
See `docs/usage.md` for details.
|
||||
|
||||
@Clanker When task is completed set frontmatter state to review. Prompt the author to verify the results.
|
||||
|
||||
## Worklog
|
||||
|
||||
Consolidated Worklog and Backlog sections into a single Worklog section. Removed the Backlog section from both `prompt.md` and `prompt.md.template`. The Worklog now handles all outcomes: add a summary upon task completion, set frontmatter state to `completed` if author confirms or `aborted` if not, and update metadata accordingly. Also fixed typos in `prompt.md` ("fiel" → "file", "upated" → "updated", "to state" → "the state", "th results" → "the results").
|
||||
The shell completion scripts in `bin/setup-completion` were calling `./task help` directly instead of the user's `task()` shell function. When no local `./task` file existed, this produced `_task_completions:7: no such file or directory: ./task`.
|
||||
|
||||
Updated `bin/create-prompt` to automatically run `commit-prompt` when the target prompt file already exists, ensuring the current prompt is stored before a new one is created. Verified `prompt.md.template` contains the new instructions for setting state to `review` upon task completion and handling author confirmation in the Worklog.
|
||||
Fixed by replacing `./task help` with `task help` in all three completion scripts (bash, zsh, fish). This lets the shell function resolve the correct task binary — local `./task` if present, otherwise `$HOME/.local/bin/task` — making completions work in any directory.
|
||||
|
||||
File changed: `bin/setup-completion`.
|
||||
|
||||
@Clanker If author confirms results set frontmatter state to completed, otherwise to aborted. Update date, harness and model. If you have access to session info also add token count.
|
||||
+1
-1
@@ -18,7 +18,6 @@ help-table() {
|
||||
rows+=("template-dotenv||Generate .env from .env.template.")
|
||||
rows+=("open-with-os|<path>|Open file or url with default application.")
|
||||
rows+=("open-url|<url>|Open url.")
|
||||
rows+=("show-dotenv-setup||Show info about the dotenv setup.")
|
||||
rows+=("setup-completion|[shell]|Show shell completion instructions.")
|
||||
rows+=("list-aliases||List all library command aliases.")
|
||||
rows+=("check-help-width||Show help lines that exceed terminal width.")
|
||||
@@ -43,6 +42,7 @@ help-table() {
|
||||
rows+=("load-dotenv|<env>|Load and export .env file.")
|
||||
rows+=("init-dotenv-sops||Initialize age key and sops config for the project.")
|
||||
rows+=("list-agekeys||List age keys from the default key file.")
|
||||
rows+=("show-project-setup||Show project setup info.")
|
||||
rows+=("rename-dotenv|<env><env>|Rename .env file.")
|
||||
rows+=("remove-dotenv|<env>|Remove .env file.")
|
||||
rows+=("backup-dotenv-files|<path>|Archive and copy .env files to target location.")
|
||||
|
||||
Reference in new issue
Block a user