@cerebriline/core 4.100.240 → 4.100.242

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/assets/skills/README.md +14 -0
  2. package/assets/skills/build-project/SKILL.md +103 -0
  3. package/assets/skills/docker-compose-deploy/SKILL.md +239 -0
  4. package/assets/skills/librarian/SKILL.md +177 -0
  5. package/assets/skills/mandatory-qa-prompt-and-issue-resolution/SKILL.md +58 -0
  6. package/assets/skills/run-project/SKILL.md +103 -0
  7. package/assets/skills/sdd-discuss/SKILL.md +129 -0
  8. package/assets/skills/sdd-execute/SKILL.md +146 -0
  9. package/assets/skills/sdd-plan/SKILL.md +140 -0
  10. package/assets/skills/sdd-quick/SKILL.md +40 -0
  11. package/assets/skills/sdd-status/SKILL.md +75 -0
  12. package/assets/skills/sdd-verify/SKILL.md +122 -0
  13. package/assets/skills/sdd-wizard/SKILL.md +105 -0
  14. package/assets/skills/tdd-coverage/SKILL.md +88 -0
  15. package/assets/skills/tdd-gen/SKILL.md +82 -0
  16. package/assets/skills/tdd-test/SKILL.md +61 -0
  17. package/assets/skills/tdd-wizard/SKILL.md +162 -0
  18. package/dist/document-reader-child.js +23 -0
  19. package/dist/extensions/config/bundled-skills.d.ts +24 -0
  20. package/dist/extensions/config/index.d.ts +2 -1
  21. package/dist/extensions/config/unified-config-file-watcher.d.ts +15 -0
  22. package/dist/extensions/config/user-instruction-config-loader.d.ts +15 -0
  23. package/dist/extensions/tools/executors/document/ebook.d.ts +10 -0
  24. package/dist/extensions/tools/executors/document/formats.d.ts +25 -0
  25. package/dist/extensions/tools/executors/document/ocr.d.ts +8 -0
  26. package/dist/extensions/tools/executors/document/read-job.d.ts +68 -0
  27. package/dist/extensions/tools/executors/document/read-process.d.ts +52 -0
  28. package/dist/extensions/tools/executors/document/read-protocol.d.ts +65 -0
  29. package/dist/extensions/tools/executors/document/recognition.d.ts +14 -5
  30. package/dist/extensions/tools/executors/document-extract.d.ts +120 -1
  31. package/dist/extensions/tools/librarian-tools.d.ts +32 -0
  32. package/dist/extensions/tools/library-import-run.d.ts +79 -0
  33. package/dist/extensions/tools/library-tools.d.ts +88 -0
  34. package/dist/extensions/tools/memory-tools.d.ts +41 -0
  35. package/dist/extensions/tools/sdd-tool.d.ts +215 -0
  36. package/dist/extensions/tools/team/create-agent-tool.d.ts +5 -4
  37. package/dist/hub/daemon/entry.js +607 -603
  38. package/dist/hub/index.js +595 -591
  39. package/dist/index.d.ts +17 -1
  40. package/dist/index.js +1080 -695
  41. package/dist/services/global-settings.d.ts +9 -0
  42. package/dist/services/llms/provider-settings.d.ts +15 -15
  43. package/dist/services/retrieval/catalogue.d.ts +397 -0
  44. package/dist/services/retrieval/chunker.d.ts +44 -0
  45. package/dist/services/retrieval/embedding-client.d.ts +78 -0
  46. package/dist/services/retrieval/fingerprint.d.ts +21 -0
  47. package/dist/services/retrieval/firecrawl.d.ts +77 -0
  48. package/dist/services/retrieval/lancedb-runtime.d.ts +84 -0
  49. package/dist/services/retrieval/lancedb-runtime.manifest.d.ts +17 -0
  50. package/dist/services/retrieval/library-store.d.ts +148 -0
  51. package/dist/services/retrieval/library.d.ts +139 -0
  52. package/dist/services/retrieval/memory-recall.d.ts +97 -0
  53. package/dist/services/retrieval/memory.d.ts +184 -0
  54. package/dist/services/retrieval/retrieve.d.ts +85 -0
  55. package/dist/services/retrieval/running-heads.d.ts +38 -0
  56. package/dist/services/retrieval/tar-extract.d.ts +14 -0
  57. package/dist/services/retrieval/tar-write.d.ts +20 -0
  58. package/dist/services/retrieval/vector-index.d.ts +82 -0
  59. package/dist/services/sdd/sdd-engine.d.ts +248 -0
  60. package/dist/services/telemetry/index.js +1 -1
  61. package/dist/types/config.d.ts +7 -0
  62. package/dist/types/session.d.ts +2 -0
  63. package/package.json +4 -4
  64. package/dist/extensions/tools/code-intel.d.ts +0 -131
@@ -0,0 +1,14 @@
1
+ # Built-in skills
2
+
3
+ The skills that ship with Cerebriline: the extension, the CLI and the SDK all
4
+ carry this folder. One folder per skill, each with a `SKILL.md`.
5
+
6
+ - `name` and `description` in the frontmatter are required here. The
7
+ description is all the model sees when it decides whether to load the skill.
8
+ - `disabled: true` means the skill ships turned off. That is only the default:
9
+ the user's choice is kept in the global settings (`bundledSkills`), because
10
+ an update replaces these files.
11
+ - A skill of the same name in the user's own or the workspace's skills folder
12
+ replaces the built-in one.
13
+
14
+ Each skill here is listed in `docs/customization/skills.mdx` under "Built-in Skills": add a row there when adding a folder here.
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: build-project
3
+ description: >-
4
+ Builds the project open in the workspace, and its Docker image when the repo
5
+ has a Dockerfile or a compose file. Discovers the build from the repo itself
6
+ (its README, CI workflow, scripts, manifest), runs it, and reports the
7
+ artifacts and the image tag. Use when the user asks to build or compile the
8
+ project or its image, or before a deploy that needs an image.
9
+ disabled: true
10
+ ---
11
+
12
+ # Skill: Build the Current Project
13
+
14
+ Builds whatever repository is open in the workspace. Nothing here assumes a language, a framework, a path or a tag: every value is **discovered from the repo first**, and the repo's own way of building always wins over a generic one.
15
+
16
+ Related skills, used when they are enabled; each also works alone:
17
+
18
+ - `docker-compose-deploy` runs the image or stack this skill builds.
19
+ - `run-project` builds if needed, starts the project and opens it.
20
+
21
+ ## Step 0: Discover how this repo is built
22
+
23
+ Look, in this order, and stop at the first that answers:
24
+
25
+ 1. **What the repo says.** `README*`, `CONTRIBUTING*`, `docs/`, an `AGENTS.md` or similar. A documented build command is the answer.
26
+ 2. **What CI runs.** `.github/workflows/*.yml`, `.gitlab-ci.yml`, `azure-pipelines.yml`, `Jenkinsfile`. The build job is a build known to work.
27
+ 3. **Task runners.** `Makefile`, `justfile`, `Taskfile.yml`, the `scripts` in `package.json`.
28
+ 4. **The manifest**, when nothing above names a command:
29
+
30
+ | Found | Install | Build |
31
+ |---|---|---|
32
+ | `package.json` | the manager whose lockfile exists: `npm ci`, `pnpm install --frozen-lockfile`, `yarn install --frozen-lockfile`, `bun install --frozen-lockfile` | the `build` script, with the same manager |
33
+ | `*.sln`, `*.csproj` | `dotnet restore` | `dotnet build -c Release` |
34
+ | `pyproject.toml`, `requirements.txt` | the tool the repo uses (`uv`, `poetry`, `pip` in a virtual environment) | usually none; `python -m build` only if it ships a package |
35
+ | `go.mod` | — | `go build ./...` |
36
+ | `Cargo.toml` | — | `cargo build --release` |
37
+ | `pom.xml` | — | `mvn -B package` (use `./mvnw` if present) |
38
+ | `build.gradle*` | — | `./gradlew build` |
39
+
40
+ Also find, because the image build needs them:
41
+
42
+ | Value | Where |
43
+ |---|---|
44
+ | Dockerfile(s) | any `Dockerfile*`, and a compose service's `build:` (`context`, `dockerfile`, `target`, `args`) |
45
+ | Build context | the compose `build.context`, else the folder the Dockerfile's `COPY` paths are relative to; often the repo root even when the Dockerfile is in a subfolder |
46
+ | Image name | a compose `image:`, else a name the repo's scripts or CI use, else `<repo-folder-name>` in lower case |
47
+ | Build arguments | `ARG` lines with no default in the Dockerfile; compose `build.args` |
48
+
49
+ If the repo is a monorepo, build the part the user is working on or asked for; ask only when that is not clear.
50
+
51
+ ## Step 1: Build the project
52
+
53
+ Run the install step, then the build, from the folder the manifest is in.
54
+
55
+ - Use the lockfile as it is. Do not delete it, regenerate it or upgrade dependencies to get a build through.
56
+ - Do not install tools globally or change the machine. If a required tool or version is missing, say which and stop.
57
+ - A build that fails on the code is a result to report with its error, not something to work around by disabling checks.
58
+
59
+ Skip this step when the Dockerfile builds the project itself (a multi-stage Dockerfile that runs the install and build inside the image) and the user asked only for the image.
60
+
61
+ ## Step 2: Build the image
62
+
63
+ Only when the repo has a Dockerfile or a compose file. First check that Docker answers: `docker info`. If it does not, say that Docker is not running and stop.
64
+
65
+ **The repo has a compose file with `build:`** — let compose build it, so the context, the Dockerfile, the target and the arguments are the ones the repo defines:
66
+
67
+ ```
68
+ docker compose build
69
+ docker compose build <service> # one service
70
+ ```
71
+
72
+ Run it from the folder the compose file is in, or pass `-f <path>`.
73
+
74
+ **Only a Dockerfile:**
75
+
76
+ ```
77
+ docker build -f <path/to/Dockerfile> -t <image-name>:dev <build-context>
78
+ ```
79
+
80
+ - `<image-name>:dev` is one name and one tag, for example `myapp:dev`. Use the same value everywhere afterwards.
81
+ - Pass each required build argument with `--build-arg NAME=value`. Never pass a secret as a build argument; it stays in the image history.
82
+ - If `COPY` fails with "not found", the build context is wrong, not the Dockerfile: the paths in `COPY` are relative to the context given as the last argument.
83
+
84
+ ## Step 3: Verify
85
+
86
+ - The project build: the command exited 0 and the artifact it should produce exists (`dist/`, `bin/Release/`, `target/`, the binary).
87
+ - The image: `docker image ls <image-name>` lists the tag just built, with a creation time of now.
88
+
89
+ ## Step 4: Report
90
+
91
+ Say what was built, in a form the next step can use:
92
+
93
+ - the build command that was run, and where;
94
+ - the artifacts and their path;
95
+ - the image as `<image-name>:<tag>`, or the compose services that were built;
96
+ - the port the Dockerfile `EXPOSE`s, if any.
97
+
98
+ ## What goes wrong
99
+
100
+ - **The image build is slow or huge.** There is no `.dockerignore`, so `node_modules`, `.git` and build output are sent as context. Say so; add one only if the user agrees.
101
+ - **It builds locally and fails in the image.** A file the build needs is listed in `.dockerignore`, or the image has a different tool version than the machine.
102
+ - **A different architecture is needed.** An image built on an Apple Silicon or ARM machine is `arm64`. For an `amd64` target add `--platform linux/amd64`.
103
+ - **Compose ignores a code change.** `docker compose up` reuses an existing image; it is `docker compose build` or `up --build` that rebuilds.
@@ -0,0 +1,239 @@
1
+ ---
2
+ name: docker-compose-deploy
3
+ description: >-
4
+ Deploys the project open in the workspace to local Docker (Docker Desktop or
5
+ a local engine). Covers choosing the deployment method (docker compose up, or
6
+ docker run of an image built from the repo's Dockerfile), running the stack
7
+ or container exactly as the repo's compose file or Dockerfile defines, and
8
+ verifying the deployment. Use when the user asks to deploy, redeploy or tear
9
+ down the project's containers.
10
+ disabled: true
11
+ ---
12
+
13
+ # Skill: Deploy the Current Project to Docker Desktop
14
+
15
+ This skill **deploys** the **current project** (whatever repo is open in the workspace) to **local Docker** (Docker Desktop, or a local Docker engine). It is deliberately **project-agnostic**: it first **discovers** how the repo defines its containers (compose file and/or Dockerfile + image), then stands them up and verifies them.
16
+
17
+ Commands are written once where they are the same in every shell. Where PowerShell and bash differ, both forms are given: use the one for the shell you are in.
18
+
19
+ > **Two deployment paths (choose based on discovery):**
20
+ > 1. **Compose stack** — the repo ships a `docker-compose*.yml` or `compose*.yml`. Use `docker compose up -d` (preferred; the compose file encodes services, build, ports, volumes, env for you).
21
+ > 2. **Single container** — the repo has only a Dockerfile. Build the image from it, then use `docker run` with the discovered image name, container name, ports, and env.
22
+
23
+ > **Related skills** (built in; used when they are enabled, and this skill works without them):
24
+ > - `build-project` — build the project + Docker image (the image must exist before a single-container deploy; a compose `up` builds it on demand). If it is not enabled, build the image with the `docker build` command in Step 1, Path B.
25
+ > - `run-project` — "run the project" (deploy if needed, then open the app in the default browser). Use that one when the user wants to run/open the app.
26
+
27
+ ---
28
+
29
+ ## When to Use This Skill
30
+
31
+ - You need to stand the app(s) up on local Docker Desktop the way the repo defines them.
32
+ - You need to deploy a specific environment (Development / QA / Staging / Production) that the repo's config supports.
33
+ - You need to redeploy after a code change in one command.
34
+ - You need to verify the running container(s) (startup logs + HTTP reachability).
35
+
36
+ ---
37
+
38
+ ## Prerequisites
39
+
40
+ 1. **Docker** must be running: `docker info` succeeds. If it does not, say that Docker is not running and stop; do not try to start or install it.
41
+ 2. The image must exist (build it first if it is missing, see Path B) — or, for a compose stack, the compose file builds it on `up`.
42
+ 3. The repo must be checked out at the desired branch/tag.
43
+
44
+ ---
45
+
46
+ ## Step 0 -- Discover the Project's Deploy & Container Facts
47
+
48
+ Do **not** assume any project name, framework, path, image tag, or port. **Discover them from the repo** each time:
49
+
50
+ | Concern | How to discover | Command |
51
+ |---------|-----------------|---------|
52
+ | **Compose file** | Find any `docker-compose*.yml`/`.yaml` or `compose*.yml`/`.yaml`. If present, the compose path is preferred. | `list_files` patterns `**/docker-compose*` and `**/compose*.y*ml` |
53
+ | **Image name** | A compose `image:`, else the name already built for this repo, else `<repo-folder-name>` in lower case. Written with its tag as `<image-name>:dev`, e.g. `myapp:dev`. | Compose / `docker image ls` |
54
+ | **Container name(s)** | Compose service name(s); or your own `<repo-name>-<svc>` convention for a single container. | Compose `services:` keys / derive |
55
+ | **Ports / published ports** | Read `ports:` in the compose file, or the Dockerfile `EXPOSE` lines. The **web/front-end port** (the one to open in a browser) is usually the first published port or the service named `web`. | Compose `ports:` / Dockerfile `EXPOSE` |
56
+ | **Environment** | Compose `environment:`/`env_file`, or env vars the app reads (`NODE_ENV`, `ASPNETCORE_ENVIRONMENT`, etc.). | Compose / `.env` |
57
+ | **Required secrets** | Compose uses `${VAR:?...}` for required secrets. Provide them from the host env / secret manager — never invent or bake them. | Compose `environment:` |
58
+
59
+ > State the discovered values in your reply (especially **image name**, **container name(s)**, and **web port**): nothing is remembered between skills, so whatever runs next reads them from there.
60
+
61
+ ---
62
+
63
+ ## Step 1 -- Deploy
64
+
65
+ ### Path A: Compose stack (preferred when a compose file exists)
66
+
67
+ ```
68
+ # From the directory that contains the compose file (commonly repo-root or docker/),
69
+ # or from anywhere with: docker compose -f <path/to/compose-file> up -d
70
+ docker compose up -d
71
+ ```
72
+
73
+ - `up -d` builds images from `build:` where needed, creates the networks/volumes, and starts the services in dependency order.
74
+ - To rebuild images from current source and recreate containers after a code change:
75
+ ```
76
+ docker compose up -d --build
77
+ ```
78
+ - To target a single service:
79
+ ```
80
+ docker compose up -d <service-name>
81
+ ```
82
+ - If `docker compose` is not a known command, the machine has the older standalone tool: use `docker-compose` with the same arguments.
83
+ - **Required secrets:** if the compose file uses `${SOME_VAR:?SOME_VAR is required}`, set `SOME_VAR` in the shell/environment first (or provide an `.env` alongside the compose file). Docker Compose fails fast if a required variable is unset — that is the safety net.
84
+
85
+ ### Path B: Single container (`docker run` of an image built from the Dockerfile)
86
+
87
+ Use the values discovered in Step 0 (image name, container name, host port, container port, env). Each command is one line, so it is the same in every shell:
88
+
89
+ ```
90
+ # Build the image if it does not exist yet, or the source changed
91
+ # (the last argument is the build context: the folder COPY paths are relative to)
92
+ docker build -f <path/to/Dockerfile> -t <image-name>:dev <build-context>
93
+
94
+ # Remove an earlier container of the same name. Only one this deployment created:
95
+ # if the name belongs to something else, pick another name instead.
96
+ docker rm -f <container-name>
97
+
98
+ # One -e per variable the app needs (environment selection, connection strings, secrets)
99
+ docker run -d --name <container-name> -p <hostPort>:<containerPort> -e <KEY>=<value> <image-name>:dev
100
+ ```
101
+
102
+ `docker rm -f` prints "No such container" when there was none; that is not a failure.
103
+
104
+ > Example (repo-root Dockerfile, HTTP port 8080 mapped to host 32798):
105
+ > ```
106
+ > docker build -t myapp:dev .
107
+ > docker rm -f myapp
108
+ > docker run -d --name myapp -p 32798:8080 -e NODE_ENV=production myapp:dev
109
+ > ```
110
+ >
111
+ > For a stack with a front-end and backing services, prefer **Path A** (compose) — `docker run` only makes sense for a single self-contained service.
112
+
113
+ ---
114
+
115
+ ## Step 2 -- Verify the Deployment
116
+
117
+ ```
118
+ # Compose stack: every service should be "running" (or "healthy")
119
+ docker compose ps
120
+ docker compose logs --tail 100 <service-name>
121
+
122
+ # Single container
123
+ docker ps --filter "name=<container-name>"
124
+ docker logs --tail 100 <container-name>
125
+
126
+ # Confirm the web server answers from the host
127
+ curl -s -o /dev/null -w "%{http_code}" --retry 15 --retry-delay 2 --retry-all-errors http://localhost:<hostPort>/ # bash, zsh
128
+ curl.exe -s -o NUL -w "%{http_code}" --retry 15 --retry-delay 2 --retry-all-errors http://localhost:<hostPort>/ # PowerShell, cmd
129
+ ```
130
+
131
+ In PowerShell write `curl.exe`: plain `curl` there can be an alias for a different command that does not take these options. An app needs some seconds after its container starts, and a request sent at once fails: the `--retry` options make curl ask again for up to about half a minute, so run the check as written.
132
+
133
+ A `200` or `3xx` (e.g. a redirect to login) means the web server is up; a `401` or `403` also means it is answering. Look in the logs for lines like `Now listening on:`, `Server listening on`, or the app's startup banner. Access the app at `http://localhost:<hostPort>/` (and any documented sub-route such as `/login`).
134
+
135
+ > Background-service connection warnings in the logs are often **non-fatal** — the web server may still run and serve traffic. Confirm reachability over HTTP rather than assuming a log warning means the app is down.
136
+
137
+ ---
138
+
139
+ ## Step 3 -- Make a Change and Redeploy (iterative loop)
140
+
141
+ ```
142
+ # Compose stack: rebuild images + recreate containers
143
+ docker compose up -d --build
144
+
145
+ # Single container: rebuild the image, then recreate the container
146
+ docker build -f <path/to/Dockerfile> -t <image-name>:dev <build-context>
147
+ docker rm -f <container-name>
148
+ docker run -d --name <container-name> -p <hostPort>:<containerPort> <image-name>:dev
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Step 4 -- Tear Down
154
+
155
+ ```
156
+ # Compose stack (removes containers/networks; keeps named volumes by default)
157
+ docker compose down
158
+
159
+ # Single container
160
+ docker rm -f <container-name>
161
+ ```
162
+
163
+ Do not add `-v` / `--volumes` to `down`, and do not prune volumes, unless the user asks: that deletes the stack's data (databases, uploads).
164
+
165
+ ---
166
+
167
+ ## What Does NOT Work -- Universal Lessons
168
+
169
+ These hold for most containerised apps regardless of framework:
170
+
171
+ ### HTTPS does not work out of the box in a CLI-started container
172
+
173
+ Many runtime base images (`dotnet/aspnet`, `node:*-slim`) do not include development HTTPS certificates — an IDE's own "run in Docker" injects them via volume mounts, but a CLI `docker run` does not. The container often serves **HTTP only** from the CLI. Use **HTTP** (`http://localhost:<hostPort>`) for a script/CLI deployment, or mount a real certificate for the app's scheme.
174
+
175
+ ### Missing required environment is a silent or immediate failure
176
+
177
+ If the app needs an env var/secret and it is not provided, it either **fails to start** (compose `${VAR:?}` refuses to run) or **starts but never serves** (the app waits/blocks on a missing config). Always set required env vars from the host env / secret manager before `up`/`run`, and verify over HTTP rather than trusting `docker ps` — a container can look "up" while serving nothing.
178
+
179
+ ### The published port and the container port are different things
180
+
181
+ `-p <hostPort>:<containerPort>` maps a **host** port to the app's **container** port (the one from `EXPOSE`/the runtime default). Reach the app at the **host port**, not the container port: the host port is what you open in a browser. If the host port is already taken (`port is already allocated`), choose another host port for a single container; for a compose stack, tell the user what holds the port rather than editing the compose file or stopping something this deployment did not start.
182
+
183
+ ### Secrets must never be baked into the image or a committed `.env`
184
+
185
+ For a production deployment, prefer environment overrides injected at run time. Never commit a new `.env` with real secrets.
186
+
187
+ ---
188
+
189
+ ## Quick Reference -- Full Working Sequence
190
+
191
+ ```
192
+ # 0. Discover: compose file? image name? container name? web port? required env?
193
+ # - list_files for docker-compose* / compose*.y*ml / Dockerfile*
194
+ docker info # Docker must answer
195
+
196
+ # 1. Deploy
197
+ cd <dir-with-compose-or-repo-root>
198
+ docker compose up -d # Path A: compose stack (builds on demand)
199
+ # or (single container):
200
+ # docker build -f <path/to/Dockerfile> -t <image-name>:dev <build-context>
201
+ # docker rm -f <container-name>
202
+ # docker run -d --name <container-name> -p <hostPort>:<containerPort> <image-name>:dev
203
+
204
+ # 2. Verify
205
+ docker compose ps # or: docker ps --filter "name=<container-name>"
206
+ docker compose logs --tail 100 <service-name> # or: docker logs --tail 100 <container-name>
207
+ curl -s -o /dev/null -w "%{http_code}" --retry 15 --retry-delay 2 --retry-all-errors http://localhost:<hostPort>/ # bash, zsh
208
+ curl.exe -s -o NUL -w "%{http_code}" --retry 15 --retry-delay 2 --retry-all-errors http://localhost:<hostPort>/ # PowerShell, cmd
209
+
210
+ # 3. Redeploy after a code change
211
+ docker compose up -d --build
212
+
213
+ # 4. Tear down
214
+ docker compose down
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Discovery Checklist -- Where to Find Each Value
220
+
221
+ | Value | Where to find it | How to find it |
222
+ |-------|------------------|----------------|
223
+ | Compose file | `**/docker-compose*.y*ml`, `**/compose*.y*ml` | `list_files` with those patterns |
224
+ | Container HTTP/web port | Compose `ports:` (host side) or Dockerfile `EXPOSE` | Read the compose file / Dockerfile |
225
+ | Container-internal port | Compose `ports:` (container side) or Dockerfile `EXPOSE` | Read the compose file / Dockerfile |
226
+ | Image name | Compose `image:`, or the name the image was built with | Compose / `docker image ls` |
227
+ | Required backing services | Compose `services:` / app config binding | Read the compose file / app config |
228
+ | Required env/secrets | Compose `environment:` (`${VAR:?...}`) / `.env` | Read the compose file |
229
+
230
+ ---
231
+
232
+ ## Key Files to Check
233
+
234
+ | File | Role |
235
+ |------|------|
236
+ | `**/docker-compose*.y*ml`, `**/compose*.y*ml` | Services, build, ports, volumes, env — the primary source of truth for a stack deploy. |
237
+ | `**/Dockerfile` | Multi-stage image build; `EXPOSE` ports; `ENTRYPOINT`/`CMD` (used at build time). |
238
+ | `.env` (if any) | Environment variables / secrets referenced by the compose file. |
239
+ | App manifest / config | Per-environment config and the runtime port/env defaults. |
@@ -0,0 +1,177 @@
1
+ ---
2
+ name: librarian
3
+ description: >-
4
+ Runs the user's Library as its librarian: catalogues ebooks and documents
5
+ into books on the right shelf, checks first whether a book is already there
6
+ or is another edition, makes books from web pages and keeps them up to date,
7
+ and reorganises sections, shelves and books. Use when the user asks to act
8
+ as a librarian, to catalogue, add, import, export, move, rename, merge or
9
+ remove books, to make a book from links or on a topic, or to check a book
10
+ for updates.
11
+ disabled: true
12
+ ---
13
+
14
+ # Librarian
15
+
16
+ You keep the user's Library. It has **sections**, each section has
17
+ **shelves**, and on the shelves stand **books**. A book is whatever was put
18
+ in it: an ebook, a manual, a set of web pages. Each book keeps its original
19
+ files, the text read out of them, their pictures with a description of each,
20
+ and a short description of the book itself.
21
+
22
+ Your tools:
23
+
24
+ | Tool | For |
25
+ |---|---|
26
+ | `list_library` | What is there: the shelves, a shelf's books, one book in full, the trash, problems |
27
+ | `search_library` | Passages in the books |
28
+ | `library_check` | Is this file, link or title already in the Library, and as what |
29
+ | `library_add` | One book from files, or more files into an existing book |
30
+ | `library_organize` | Sections, shelves, moving, renaming, deleting, restoring, merging |
31
+ | `library_transfer` | Export and import |
32
+ | `web_scrape` | Search the web, list a site's pages, read one page |
33
+ | `library_web_book` | A book from web pages; check it for news; update it |
34
+
35
+ `web_scrape` and `library_web_book` exist only when the user has set up web
36
+ scraping. If they are not in your tools, say so and work with files.
37
+
38
+ ## Rules that always hold
39
+
40
+ 1. **Look before you add.** `list_library` first, so you know the sections
41
+ and shelves there are. Then `library_check` on every file or link.
42
+ 2. **Never add a duplicate.** What `library_check` reports as *already here*
43
+ or *the same book* is skipped, and you say so in your report.
44
+ 3. **Another version is the user's decision.** When `library_check` says
45
+ *another version*, stop and ask: keep both, replace the old one, or leave
46
+ it. Say which book it matches, each one's edition, and how much of the
47
+ text they share. Only then call `library_add` with `if_exists`.
48
+ 4. **Nothing is deleted for good by you.** Deleted books and removed sources
49
+ go to the trash for 30 days. Emptying it is the user's. If you made a
50
+ mistake, restore it and say what happened.
51
+ 5. **Prefer an existing shelf.** Make a new shelf or section only when no
52
+ existing one fits. Do not make a shelf for one book when a broader shelf
53
+ exists.
54
+ 6. **Report what you did**, book by book, at the end: added where, skipped
55
+ and why, what you need the user to decide.
56
+
57
+ ## Pictures with no description
58
+
59
+ A book added while no vision model was set has pictures without
60
+ descriptions. Do not add the book again for that. Use `library_organize`
61
+ with action `describe_pictures` and the `book`: it describes the pictures
62
+ already kept with the book and writes the descriptions into its text. One
63
+ call describes a limited number and says how many are left; call it again
64
+ to go on. It is one request to the vision model per picture, so for a book
65
+ with hundreds of pictures tell the user the number before starting.
66
+
67
+ ## Reports, and cancelled calls
68
+
69
+ `library_check`, `library_add` and `library_web_book` end with a `REPORT`:
70
+ a line for every file or link, and under it a `left out:` line for each page or picture that is
71
+ not in the book, with the reason. Read it. Pass on to the user every
72
+ file that failed and everything that was left out; do not say a book was
73
+ added in full when the report says otherwise.
74
+
75
+ The user can cancel a call while it runs. It then fails, and its error is
76
+ the report: what was read, what was not, where the file in progress had
77
+ got to, and whether anything is in the Library. Do not retry it by
78
+ yourself and do not go on to the next book. Tell the user what the report
79
+ says and ask how to go on.
80
+
81
+ ## Cataloguing files ("catalogue these ebooks")
82
+
83
+ For a folder or a list of files:
84
+
85
+ 1. `list_library` with nothing, to see the sections and shelves.
86
+ 2. `library_check` with the paths. It reads each file and reports its title,
87
+ author, ISBN, size and pictures, and whether it is in the Library.
88
+ 3. For each file that is **not in the Library**, decide:
89
+ - **Title and authors**: from the file. If the file has none, read the
90
+ first pages (`extract_document` or `read_files`) rather than guess from
91
+ the file name. Use the title as printed, without the file's suffixes.
92
+ - **Edition, year, language, publisher, ISBN**: when the file says. Leave
93
+ out what it does not say; never invent an ISBN.
94
+ - **Description**: two or three sentences on what the book is and covers,
95
+ written from its contents or table of contents, not from its title.
96
+ - **Section and shelf**: the most specific existing shelf that fits. A
97
+ book on Godot's tilemaps goes on a Godot shelf, not on "Programming".
98
+ 4. `library_add`, one call per book. Files that are the same book (two
99
+ formats, or several volumes of one work) go in one call as its sources.
100
+ 5. For each file that is **another version**: collect them and ask the user
101
+ once, listing them all, before adding any of them.
102
+ 6. Report.
103
+
104
+ One call is one book. Do not put unrelated files in one `library_add` call.
105
+
106
+ ### Telling a duplicate from another version
107
+
108
+ `library_check` compares four things, and reports which matched:
109
+
110
+ - **same file**: byte for byte the file already kept. A duplicate.
111
+ - **same ISBN**: the same edition, in whatever format. With matching text, a
112
+ duplicate in another format: skip it, or add it to that book as a second
113
+ source if the user wants both formats.
114
+ - **same title** (and author): may be the same book or another edition. Look
115
+ at the share of text in common.
116
+ - **similar text**, as a percentage: 90% and more is the same book in another
117
+ file. Between about 30% and 90% is another edition or a revision. Below
118
+ that it is a different book that shares a title or quotes the other.
119
+
120
+ When the percentage and the title disagree (the same title with little text
121
+ in common, or another title with most of the text in common), read both
122
+ books' first pages and tables of contents before you decide, and tell the
123
+ user what you found.
124
+
125
+ ## A book from the web
126
+
127
+ "Create a book on GitHub recipes for Godot development, call it
128
+ Godot-Github":
129
+
130
+ 1. `library_check` with the title, to see that no such book exists.
131
+ 2. Find the links. If the user gave them, use those. Otherwise
132
+ `web_scrape` action `search` with the topic, in two or three wordings, and
133
+ `map` on a site that looks like the source. `read` a page when you cannot
134
+ tell from its title whether it belongs.
135
+ 3. Choose the links that are about the topic: primary sources and
136
+ documentation before aggregators and listicles. Drop link farms, login
137
+ pages and search-result pages.
138
+ 4. `library_web_book` action `create`, with the title, a description, the
139
+ section and shelf, the **`query`** exactly as the user asked it, and the
140
+ **`links`**. Use `depth` 0 for a list of individual pages; `depth` 1 or 2
141
+ when a link is the front page of documentation whose pages you want.
142
+ 5. Report how many pages were read and which links could not be.
143
+
144
+ The query and the links are kept in the book. That is what makes it possible
145
+ to update the book later and to recognise a second request for the same
146
+ book, so always give both.
147
+
148
+ ### Keeping it up to date
149
+
150
+ - "Is there anything new for Godot-Github?" is `library_web_book` action
151
+ `check`: it reads the book's links again and lists pages that are new or
152
+ changed. It changes nothing.
153
+ - "Update it" is action `update`. Pages that no longer exist stay in the book.
154
+ - New links for an existing book are action `add`.
155
+ - To look for *new sources*, search the book's stored query again with
156
+ `web_scrape`, compare the results with the links `list_library` shows for
157
+ the book, and propose the new ones to the user before adding them.
158
+
159
+ ## Reorganising
160
+
161
+ `library_organize` does one thing a call. Before a larger reorganisation,
162
+ say what you plan (which shelves are made, which books move where) and wait
163
+ for the user to agree; then carry it out and report.
164
+
165
+ - Rename with `update_section`, `update_shelf`, `update_book`.
166
+ - Move a shelf to another section with `update_shelf` and `to_section`.
167
+ - `merge_books` when two books are parts of one work.
168
+ - `delete_shelf` and `delete_section` send every book on them to the trash.
169
+ Move the books you want to keep first.
170
+ - `list_library` view `problems` finds books with no sources and files gone
171
+ missing; view `trash` shows what can still be restored.
172
+
173
+ ## Export and import
174
+
175
+ `library_transfer` writes the whole Library, a section, a shelf or one book
176
+ to a file, and reads such a file in. An import leaves alone a book that is
177
+ already there; `existing` changes that, and is the user's call.
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: mandatory-qa-prompt-and-issue-resolution
3
+ description: >-
4
+ After any change to code or configuration, asks whether to run QA on it
5
+ (yes, no, or always for the session), runs a QA plan fitted to the change and
6
+ reports the result, then asks whether to fix what the QA found. Use whenever
7
+ you create, modify or delete a code or configuration file.
8
+ disabled: true
9
+ ---
10
+
11
+ # Rule: Mandatory QA Prompt & Issue Resolution Flow
12
+
13
+ Whenever you modify, create, or delete any code or configuration file in the project, you must manage post-change validation using the following two-stage process.
14
+
15
+ ---
16
+
17
+ ## Stage 1: QA Process Execution
18
+
19
+ Unless "QA Always" mode is active, ask the user:
20
+ > "Would you like to run the QA process on this change?"
21
+ > 1: Yes
22
+ > 2: No
23
+ > 3: Always
24
+
25
+ ### Stage 1 Action Matrix
26
+ * **Choice 1 (Yes):**
27
+ 1. Formulate a tailored QA plan (e.g., unit tests, type checks, linting, CLI validation).
28
+ 2. Implement and execute the QA plan.
29
+ 3. Compile all test outputs into a **QA Report**.
30
+ 4. Proceed immediately to **Stage 2**.
31
+ * **Choice 2 (No):** Skip QA and proceed with normal task execution.
32
+ * **Choice 3 (Always):** Flag `QA_ALWAYS = true` for the session. Execute the QA plan, generate the QA Report, and proceed directly to **Stage 2** without prompting Stage 1 in subsequent edits.
33
+
34
+ ---
35
+
36
+ ## Stage 2: Issue Resolution Flow
37
+
38
+ Evaluate the generated **QA Report**:
39
+ * **If No Issues Found:** Report clean status to the user and continue normal workflow.
40
+ * **If Issues Found:**
41
+ * If `FIX_ALWAYS = true`, automatically fix all identified issues.
42
+ * Otherwise, present the issues summary and ask the user:
43
+ > "Issues were detected during QA. Would you like me to fix them?"
44
+ > 1: Yes
45
+ > 2: No
46
+ > 3: Always
47
+
48
+ ### Stage 2 Action Matrix
49
+ * **Choice 1 (Yes):** Plan and implement fixes for all identified issues, then re-run the QA plan to confirm resolution.
50
+ * **Choice 2 (No):** Do not modify any code. Leave the existing changes and QA findings as-is.
51
+ * **Choice 3 (Always):** Flag `FIX_ALWAYS = true` for the session. Fix all current issues immediately, and automatically fix any future QA failures without asking.
52
+
53
+ ---
54
+
55
+ ## Session State Flags
56
+ Maintain two independent flags during the session context:
57
+ - `QA_ALWAYS`: Bypasses Stage 1 prompt.
58
+ - `FIX_ALWAYS`: Bypasses Stage 2 prompt when errors exist.