From 9ecae00d97c76e4f629b7f0fd514b22fae1e2b47 Mon Sep 17 00:00:00 2001 From: Janik von Rotz Date: Tue, 6 Oct 2026 07:39:25 +0200 Subject: [PATCH] feat: add pull-prompt-log and load-prompt commands for prompt management - Create `pull-prompt-log` script to sync `origin/prompt-log` into the worktree - Update `init-prompt-log` to automatically pull remote changes if the branch exists - Implement `load-prompt` script with `fzf` for interactive selection of historical prompts - Copy selected prompt content to `prompt.md` - Update `docs/library.md` with documentation for new commands - Update `scripts.txt` to include new script names - Update `prompt.md` metadata to reflect task completion --- bin/init-prompt-log | 4 ++ bin/load-prompt | 49 +++++++++++++ bin/pull-prompt-log | 28 ++++++++ docs/library.md | 12 ++++ prompt.md | 163 +++++++++----------------------------------- scripts.txt | 5 +- 6 files changed, 126 insertions(+), 135 deletions(-) create mode 100755 bin/load-prompt create mode 100755 bin/pull-prompt-log diff --git a/bin/init-prompt-log b/bin/init-prompt-log index af3df83..6ba05d8 100755 --- a/bin/init-prompt-log +++ b/bin/init-prompt-log @@ -48,6 +48,10 @@ init-prompt-log() { echo "Created prompt-log worktree at tmp/prompt-log." fi + if git rev-parse --abbrev-ref origin/prompt-log &>/dev/null; then + pull-prompt-log "$repo_path" + fi + cd "$original_dir" || true } ipl() { diff --git a/bin/load-prompt b/bin/load-prompt new file mode 100755 index 0000000..c515483 --- /dev/null +++ b/bin/load-prompt @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +load-prompt() { + local repo_path="${1:-.}" + + if [[ ! -d "$repo_path/.git" ]]; then + echo "Error: No .git directory found in $repo_path." + return 1 + fi + + local worktree_path="$repo_path/tmp/prompt-log" + + if [[ ! -d "$worktree_path" ]]; then + echo "No prompt-log worktree found. Run init-prompt-log first." + return 1 + fi + + if ! command -v fzf &> /dev/null; then + echo "Error: fzf is required for interactive selection." + return 1 + fi + + local selected + selected="$( + for f in "$worktree_path"/*.md; do + if [[ -f "$f" ]]; then + local f_title f_date + f_title="$(grep -m1 '^title:' "$f" | sed 's/^title:[[:space:]]*//; s/^"\(.*\)"$/\1/; s/'"'"'\(.*\)'"'"'$/\1/')" + f_date="$(basename "$f")" + f_date="${f_date%%_*}" + echo "$f_date|$f_title|$(basename "$f")" + fi + done | sort -t'|' -k1,1 -r | while IFS='|' read -r _ title filename; do + echo "$filename: $title" + done | fzf | cut -d: -f1 + )" + + if [[ -z "$selected" ]]; then + echo "No prompt selected." + return 0 + fi + + local target_file="$worktree_path/$selected" + cp "$target_file" "$repo_path/prompt.md" + echo "Loaded '$selected' into prompt.md." +} +lpm() { + load-prompt "$@" +} diff --git a/bin/pull-prompt-log b/bin/pull-prompt-log new file mode 100755 index 0000000..139d7b3 --- /dev/null +++ b/bin/pull-prompt-log @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +pull-prompt-log() { + local repo_path="${1:-.}" + + if [[ ! -d "$repo_path/.git" ]]; then + echo "Error: No .git directory found in $repo_path." + return 1 + fi + + local worktree_path="$repo_path/tmp/prompt-log" + + if [[ ! -d "$worktree_path" ]]; then + echo "No prompt-log worktree found. Run init-prompt-log first." + return 1 + fi + + if ! git -C "$worktree_path" rev-parse --abbrev-ref origin/prompt-log &>/dev/null; then + echo "Remote branch origin/prompt-log does not exist." + return 1 + fi + + git -C "$worktree_path" branch --set-upstream-to=origin/prompt-log prompt-log + git -C "$worktree_path" pull +} +ppl() { + pull-prompt-log "$@" +} diff --git a/docs/library.md b/docs/library.md index 3c5003f..42fc09c 100644 --- a/docs/library.md +++ b/docs/library.md @@ -283,6 +283,12 @@ Create and track `prompt.md` files. rows+=("init-prompt-log||Initialize prompt-log branch and worktree.") ``` +### pull-prompt-log + +```bash +rows+=("pull-prompt-log|[repo-path]|Pull prompt-log from origin.") +``` + ### create-prompt ```bash @@ -307,6 +313,12 @@ rows+=("commit-prompt|[repo-path]|Commit prompt.md to prompt-log branch.") rows+=("list-prompts|[repo-path]|List prompts from prompt-log branch.") ``` +### load-prompt + +```bash +rows+=("load-prompt|[repo-path]|Load prompt from prompt-log into prompt.md.") +``` + ### edit-prompt ```bash diff --git a/prompt.md b/prompt.md index 510ba7f..92ec660 100644 --- a/prompt.md +++ b/prompt.md @@ -1,14 +1,15 @@ --- -title: "Replace 11ty with Zensical" +commit_ref: +title: "Pull prompt-log" author: "Janik von Rotz " state: completed -date_completed: 2026-10-05 +date_completed: 2025-10-06 model: moonshotai/Kimi-K2.6 -input_tokens: 1531296 -output_tokens: 10644 +input_tokens: 520337 +output_tokens: 4110 --- -# Replace 11ty with Zensical +# Pull prompt-log Note: @Clanker refers to the "ai agent" (you) who is working on this prompt file. @@ -18,149 +19,47 @@ Note: @Clanker refers to the "ai agent" (you) who is working on this prompt file - Prepare a list of todos - Update the todo list while working on task -## Todo - -- [x] Remove Node/11ty files from project root -- [x] Create bin scripts for 11ty commands -- [x] Create bin scripts for Zensical -- [x] Move markdown files and assets to docs folder -- [x] Setup Zensical configuration -- [x] Recreate randomFunctionNames.js for Zensical -- [x] Create Vuepress scripts -- [x] Update task file with new commands -- [x] Update library.md with new sections -- [x] Update task.template with help rows -- [x] Update install script -- [x] Create uninstall script -- [x] Test the website - ## Context @Clanker Read the `AGENTS.md` and `README.md` to get an understanding of the project. ## Task -I want to replace https://www.11ty.dev/ with https://zensical.org/. First check current 11ty setup: +Create a new command `pull-prompt-log`. -- Navigation: ./_includes/layouts/base.njk -- Assets: - - ./img - - ./js -- Markdown: - - development.md - - examples.md - - library.md - - patterns.md - - README.md - - usage.md -- Node files: - - eleventy.config.js - - package-lock.json - - patterns.md - - pnpm-lock.yaml - - node_modules -- Task commands: `./task help | grep 11ty` +When initializing the prompt-log and the origin exists, then pull it: -### Remove Node/11ty - -Start by removing the Node/11ty files. - -### Create bin files for 11ty commands - -Move the 11ty functions into scripts in the `bin` folder: - -- `bin/dev-11ty-docs` -- `bin/build-11ty-docs` -- `bin/serve-11ty-docs` - -Create a new `bin/init-11ty-docs` that installs 11ty with `pnpm`. - -Add a "11ty" section to the `library.md` and add help rows to the `task.template`. - -### Setup Zensical - -Similar o the 11ty commands create: - -- `bin/init-zensical-docs` -- `bin/dev-zensical-docs` -- `bin/build-zensical-docs` -- `bin/serve-zensical-docs` - -The `init-zensical-docs` uses `activate-venv`, installs zensical according to https://zensical.org/docs/get-started/#install-with-uv and finally initalizes the project with `zensical new .`. If possible pass option to not create the `.github` workflow. - -Add a "Zensical" section to the `library.md` and add help rows to the `task.template`. - -### Move to docs - -Move the mentioned markdown files and assets to the `docs` folder. - -Setup the file navigation and link structure. - -Use `./task dev-11ty-docs` to check the site. - -Ensure the website is working as before. - -### Recreate randomFunctionNames.js - -There is js script `js/randomFunctionNames.js` that adds name generator to `example.md`. Try to load the js code accoring to https://zensical.org/docs/customization/#additional-javascript and move the function to the appropriate folder. - -### Create vuepress scripts - -This is a nice-to-have-task. Many other projects such as `~/Odoo-Build` use Vuepress to build the static site. - -``` -Odoo-Build]$ task help | grep vuepress -| build-vuepress | | Create vuepress build. | -| dev-vuepress | | Start vuepress development server. | -| install-vuepress | | Install build dependencies. | -| serve-vuepress | | Serve vuepress build. | +```bash +[main][~/taskfile.build]$ t init-prompt-log +Remote branch origin/prompt-log already exists. +Preparing worktree (checking out 'prompt-log') +HEAD is now at 0d9704d init: prompt-log branch +Created prompt-log worktree at tmp/prompt-log. +*[main][~/taskfile.build]$ t list-prompts +No prompt files found. ``` -Create bin scripts for these commands as well: +I had to fix it like this: -- `build-vuespress` -> `build-vuepress-docs` -- `dev-vuespress` -> `dev-vuepress-docs` -- `install-vuespress` -> `init-vuepress-docs` -- `serve-vuespress` -> `serve-vuepress-docs` +```bash +*[main][~/taskfile.build]$ git -C tmp/prompt-log branch --set-upstream-to=origin/prompt-log prompt-log +branch 'prompt-log' set up to track 'origin/prompt-log'. +*[main][~/taskfile.build]$ git -C tmp/prompt-log pull +Successfully rebased and updated refs/heads/prompt-log. +``` -For the `init-vuepress-docs` additional packages are required. Check the `package.json` for details. +Then also create new task `load-prompt`. It shows an fzf dialog and then copies the content of the selected prompt to the `prompt.md`. -When the project is initalized it also has to create the `dev` and `build` scripts in `package.json` +Update `library.md` with the new commands. -Ignore the copy snippet files instructions of the `Odoo-Build/task`. -Add a "Vuepress" section to the `library.md` and add help rows to the `task.template`. - -### Update install script - -Finally I want you to update the `./install` script. Find a way to list the `bin` scripts. I do not want update this file manually. - -Also create an `uninstall` script. That removes the scripts provided by `taskfile.build`. - -### Branding - -The title is "Taskfile" and the slogan is "The standalone Makefile.". ## Worklog -Completed the migration from 11ty to Zensical. Verified and fixed the following: +- Created `bin/pull-prompt-log` command that sets upstream to `origin/prompt-log` and pulls changes into the worktree. +- Updated `bin/init-prompt-log` to call `pull-prompt-log` automatically when `origin/prompt-log` already exists. +- Created `bin/load-prompt` command with `fzf` interactive selection that copies a selected prompt from the prompt-log worktree to `prompt.md`. +- Updated `docs/library.md` with documentation for both new commands. +- Ran shellcheck and syntax validation on new/modified scripts. Updated `scripts.txt` via `./task update-install-script`. -- Fixed a syntax bug in `task.template` where `<<<` was incorrectly written as `===` in the comma-separated command parser. -- Removed legacy `package.json` (containing 11ty dependencies) from the project root. -- Updated `.gitignore` to replace `_site`/`node_modules` with `site`/`.venv`. -- Fixed `zensical.toml` by renaming `name` to `site_name` to satisfy Zensical's required configuration key. -- Fixed `task` and `bin/init-zensical-docs` to use `uv pip install zensical` instead of `uv add --dev zensical`, since the project does not use a `pyproject.toml`. -- Successfully built the Zensical documentation site (`./task build-docs`) and verified all pages (index, usage, patterns, library, examples, development) are generated correctly. -- Verified that custom assets (`stylesheets/style.css`, `javascripts/extra.js`) are included in the build output. -- Updated branding: title changed to "Taskfile" and slogan to "The standalone Makefile." in `docs/index.md` and `zensical.toml`. -- Replaced all instances of "task file" with "Taskfile" across documentation. -- Fixed `zensical.toml` `nav` config to use `[[project.nav]]` array-of-tables syntax for correct tab labels. -- Fixed `zensical.toml` `copyright` key placement to render properly in footer. -- Added Material theme dark/light mode toggle with `palette.toggle` config. -- Added logo/favicon to `zensical.toml` theme config and CSS filter for dark mode logo inversion. -- Styled the "Generate Function Names" button in `docs/stylesheets/style.css`. -- Created `docs/image.md` from `image/README.md` and added "Image" nav tab. -- Created `README.md` with project overview and development commands. -- Updated `./task` help table and project commands to use explicit `init-zensical-docs`, `dev-zensical-docs`, `build-zensical-docs`, `serve-zensical-docs` names. - -The website builds and serves correctly with Zensical. +@Clanker Set frontmatter state to completed and update date and model. If you have access to session info also add token count. diff --git a/scripts.txt b/scripts.txt index 20de624..3177f8f 100644 --- a/scripts.txt +++ b/scripts.txt @@ -39,8 +39,6 @@ init-project init-prompt-log init-vuepress-docs init-zensical-docs -install-ansible-build-scripts -install-jupyter-lab list-dotenv list-git-folder list-prompts @@ -50,6 +48,7 @@ load-dotenv-from-keepass load-dotenv-from-pass load-kubeconfig-from-keepass load-kubeconfig-from-pass +load-prompt log-error login-docker log-success @@ -61,6 +60,7 @@ open-with-os prompt-with-pi pull-all-repos pull-git-folder +pull-prompt-log push-git-folder remove-dotenv remove-git-folder @@ -76,7 +76,6 @@ save-git-folder save-kubeconfig-to-keepass save-kubeconfig-to-pass save-pass-to-keepass -scripts.txt serve-11ty-docs serve-vuepress-docs serve-zensical-docs