@smartsoft001-mobilems/claude-plugins 2.83.0 → 2.85.0
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.
- package/README.md +97 -0
- package/package.json +1 -1
- package/plugins/flow/.claude-plugin/plugin.json +1 -1
- package/plugins/flow/agents/shared-impl-reporter.md +31 -2
- package/plugins/flow/scripts/compute-session-tokens.sh +39 -0
- package/plugins/flow/scripts/refresh-mobilems-api-spec.sh +372 -0
- package/plugins/flow/skills/mobilems-docs-reader/SKILL.md +116 -0
- package/plugins/flow/skills/plan/SKILL.md +73 -9
- package/plugins/flow/skills/push/SKILL.md +22 -0
- package/plugins/flow-external/.claude-plugin/plugin.json +1 -1
- package/plugins/flow-external/agents/shared-impl-reporter.md +39 -11
- package/plugins/flow-external/scripts/compute-session-tokens.sh +39 -0
- package/plugins/flow-external/scripts/refresh-mobilems-api-spec.sh +372 -0
- package/plugins/flow-external/skills/mobilems-docs-reader/SKILL.md +116 -0
- package/plugins/flow-external/skills/plan/SKILL.md +79 -9
- package/plugins/flow-external/skills/push/SKILL.md +23 -1
- package/plugins/flow-legacy/.claude-plugin/plugin.json +1 -1
- package/plugins/flow-legacy/agents/shared-impl-reporter.md +29 -1
- package/plugins/flow-legacy/scripts/compute-session-tokens.sh +39 -0
- package/plugins/flow-legacy/scripts/refresh-mobilems-api-spec.sh +372 -0
- package/plugins/flow-legacy/skills/mobilems-docs-reader/SKILL.md +116 -0
- package/plugins/flow-legacy/skills/plan/SKILL.md +75 -7
- package/plugins/flow-legacy/skills/push/SKILL.md +22 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mobilems-docs-reader
|
|
3
|
+
description: Answer questions about the MuzaCMS / MobileMS indexer API by reading a freshly-fetched OpenAPI spec. Use whenever the user asks about endpoints, request/response shapes, status codes, auth, or behavior of the indexer API (host develop-indexer-api.mobilems.pl). Read-only — never fabricates endpoints.
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Bash
|
|
6
|
+
- Read
|
|
7
|
+
- Glob
|
|
8
|
+
- Grep
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
You answer questions about the **MuzaCMS / MobileMS indexer API** strictly from the OpenAPI (Swagger 2.0) specification. You never invent endpoints, schemas, or status codes — if it is not in the spec, you say so plainly.
|
|
12
|
+
|
|
13
|
+
The spec is **not bundled**. It is fetched from the live MuzaCMS instance by a refresh script that lives next to this skill, using credentials supplied via environment variables. The script caches the fetched spec per Claude Code session (with an 8-hour TTL safety net), so it may skip the actual network call and reuse a cached copy on follow-up invocations within the same session.
|
|
14
|
+
|
|
15
|
+
## Step 1 — Run the refresh script (mandatory)
|
|
16
|
+
|
|
17
|
+
On every invocation, run the refresh script via Bash. The script itself decides whether to actually fetch — it owns the cache. Your job is only to run it and react to the result. A successful run may be either:
|
|
18
|
+
|
|
19
|
+
- A real fetch (`Refreshing MuzaCMS API spec from ... → GET /admin/login → POST /admin/login → GET /docs/api → ✓ Refreshed N bytes ...`), or
|
|
20
|
+
- A cache hit (`✓ spec cached for this Claude Code session (refreshed N min ago at ...), skipping fetch`).
|
|
21
|
+
|
|
22
|
+
Both are exit-code-0 successes. Treat them identically and proceed to Step 2. **Do not** attempt to bypass the cache, delete the cache file, or force a refetch — the cache is intentional and the script's decision is authoritative.
|
|
23
|
+
|
|
24
|
+
### Invocation
|
|
25
|
+
|
|
26
|
+
The refresh script is shipped per plugin variant under `plugins/<variant>/scripts/`. Invoke it through `bash` so the executable bit is irrelevant:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
bash ./node_modules/@smartsoft001-mobilems/claude-plugins/plugins/flow/scripts/refresh-mobilems-api-spec.sh --quiet
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Outcomes:
|
|
33
|
+
|
|
34
|
+
- **Success (exit 0)** → jump to Step 2.
|
|
35
|
+
- **Script-level error** (missing env vars, missing tooling, auth rejected, HTTP error, parse failure, etc.) → jump to the matching Fail mode below.
|
|
36
|
+
- **Permission denied by Claude Code** → jump to "Fail mode — permission denied".
|
|
37
|
+
|
|
38
|
+
The script reads two environment variables — `MOBILEMS_LOGIN` and `MOBILEMS_PASSWORD` — performs the Symfony CSRF + session login against `https://develop-indexer.mobilems.pl`, fetches `/docs/api`, and writes the spec to `shared-assets/mobilems-api.json` inside the installed package. It also auto-loads `.env` from the current working directory; no shell sourcing is needed.
|
|
39
|
+
|
|
40
|
+
### Fail mode — permission denied by Claude Code
|
|
41
|
+
|
|
42
|
+
If the Bash call is rejected by Claude Code's permission system, stop and tell the user verbatim:
|
|
43
|
+
|
|
44
|
+
> The MuzaCMS spec could not be refreshed because Claude Code denied permission to run the refresh script. To allow it, add this entry to your project's `.claude/settings.json` (committed) or `.claude/settings.local.json` (per-dev, gitignored) under `permissions.allow`, then ask again:
|
|
45
|
+
>
|
|
46
|
+
> - `"Bash(bash ./node_modules/@smartsoft001-mobilems/claude-plugins/plugins/flow/scripts/refresh-mobilems-api-spec.sh:*)"`
|
|
47
|
+
|
|
48
|
+
Do not attempt to answer the user's question from training knowledge. Do not invent alternative invocation patterns to try to bypass the denial.
|
|
49
|
+
|
|
50
|
+
### Fail mode — missing env vars
|
|
51
|
+
|
|
52
|
+
If the script exits non-zero with a message starting `✗ Brak wymaganych zmiennych środowiskowych` (or English equivalent listing `MOBILEMS_LOGIN` / `MOBILEMS_PASSWORD`), **stop immediately**. Relay the script's message verbatim to the user.
|
|
53
|
+
|
|
54
|
+
Do not attempt to answer the user's question from training knowledge. Do not guess. Do not read any pre-existing `mobilems-api.json` that may be lying around in `node_modules/` — without a successful refresh you have no confirmation it is current.
|
|
55
|
+
|
|
56
|
+
### Fail mode — missing tooling
|
|
57
|
+
|
|
58
|
+
If the script exits with a message about missing `curl` or `jq`, relay it verbatim. The script tells the user exactly how to install the missing dependency (`brew install jq` / `apt install jq`).
|
|
59
|
+
|
|
60
|
+
### Fail mode — other script failures
|
|
61
|
+
|
|
62
|
+
If the script fails for any other reason (HTTP error, auth rejected, parse failure), report the exact error message from the script back to the user and stop. Do not answer the API question.
|
|
63
|
+
|
|
64
|
+
## Step 2 — Locate the freshly-written spec
|
|
65
|
+
|
|
66
|
+
Use `Glob` with this pattern:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
**/claude-plugins/**/shared-assets/mobilems-api.json
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The hit lives under `node_modules/@smartsoft001-mobilems/claude-plugins/shared-assets/` after a successful refresh. Exclude `dist/` and `tmp/` from the Glob, but **do** allow `node_modules/`.
|
|
73
|
+
|
|
74
|
+
If the Glob returns nothing after the refresh script reported success, something is wrong with the install layout — tell the user and stop.
|
|
75
|
+
|
|
76
|
+
## Step 3 — Answer from the spec
|
|
77
|
+
|
|
78
|
+
The spec is **Swagger 2.0** with this wrapping shape:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
{ "spec": { "swagger": "2.0", "paths": {...}, "definitions": {...} } }
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Always traverse into `.spec` first.
|
|
85
|
+
|
|
86
|
+
When the user asks about endpoints:
|
|
87
|
+
|
|
88
|
+
1. **Locate the path** in `spec.paths`. Look for the exact path the user mentioned, including any path parameters (`{id}`).
|
|
89
|
+
2. **Quote the HTTP method(s) and path verbatim.** Example: `GET /api/objects/{id}`.
|
|
90
|
+
3. For request bodies and responses, cite the `$ref` target by name and (briefly) summarize its shape from `spec.definitions`.
|
|
91
|
+
4. For status codes, list each documented response from `responses` with its `description`.
|
|
92
|
+
5. For auth, check both the operation-level `security` and the global `spec.securityDefinitions`.
|
|
93
|
+
|
|
94
|
+
If the user asks about a path that is **not in the spec**, say so explicitly:
|
|
95
|
+
|
|
96
|
+
> The spec does not document a `DELETE /api/articles/{id}` endpoint. The articles paths in the spec are: `[list actual paths]`. If you've seen this endpoint elsewhere, it may exist in the running service without being documented — verify with a live request.
|
|
97
|
+
|
|
98
|
+
## Known caveats — always surface when relevant
|
|
99
|
+
|
|
100
|
+
- **Response schemas occasionally diverge from runtime.** Documented response shapes have, in practice, not always matched what the live API actually returns. When the user is about to implement against a response schema, add a brief reminder to verify with a real request before relying on the documented shape.
|
|
101
|
+
- **Spec is regenerated server-side from PHP annotations.** Newly added endpoints in the live service may not appear until the next backend deployment, even with a fresh fetch.
|
|
102
|
+
- **Auth flow nuance:** the spec describes the indexer API itself; the `/admin/login` flow used by the refresh script is separate and not documented in the spec.
|
|
103
|
+
|
|
104
|
+
## Answering style
|
|
105
|
+
|
|
106
|
+
- Be terse. The user wants a specific fact, not a tutorial on Swagger.
|
|
107
|
+
- Always include exact path + method + relevant status codes when applicable.
|
|
108
|
+
- When quoting definitions, use the schema name (e.g., `Object`, `Unauthorised`) as it appears in `spec.definitions`.
|
|
109
|
+
- If multiple endpoints match a vague question, list them — don't pick one arbitrarily.
|
|
110
|
+
|
|
111
|
+
## When NOT to use this skill
|
|
112
|
+
|
|
113
|
+
- Non-MobileMS APIs (any other host).
|
|
114
|
+
- Generic REST/OpenAPI guidance unrelated to the indexer.
|
|
115
|
+
- Schema design decisions ("should I add X field?") — this skill only describes what exists.
|
|
116
|
+
- Anything requiring a live network call to the API itself.
|
|
@@ -31,7 +31,7 @@ Create an implementation plan for a Linear task and save it as a `plan.md` attac
|
|
|
31
31
|
|
|
32
32
|
These rules override ANY other instruction, ANY surrounding example, and ANY default habit. Violating them is a skill failure.
|
|
33
33
|
|
|
34
|
-
1. **The plan MUST be saved via `mcp__linear__create_attachment` — NEVER as a Linear comment.** `mcp__linear__save_comment` MUST NOT be called with plan content as the body. Comments are reserved for status notifications (e.g., "no plan attachment found, run /plan again"),
|
|
34
|
+
1. **The plan body MUST be saved via `mcp__linear__create_attachment` — NEVER as a Linear comment.** `mcp__linear__save_comment` MUST NOT be called with plan content as the body. Comments are reserved for: (a) status notifications (e.g., "no plan attachment found, run /plan again"), and (b) the single token-usage comment posted in Step 9c. No other comment may carry plan content. If you find yourself about to call `save_comment` with `## Implementation Plan` in the body — STOP. That's a bug.
|
|
35
35
|
|
|
36
36
|
2. **One call, no fallback.** The first Linear write for the plan is `mcp__linear__create_attachment`. If it fails, surface the error to the user — do NOT silently fall back to `save_comment`.
|
|
37
37
|
|
|
@@ -55,7 +55,7 @@ Execute each step in order. Do not skip any step marked as MANDATORY.
|
|
|
55
55
|
- [ ] **8. Analyze external library deps** — check if `@smartsoft001` or `@smartsoft001-mobilems` changes are needed (mark as separate process)
|
|
56
56
|
- [ ] **9. Create implementation plans** — generate structured plans per task/subtask with all required sections
|
|
57
57
|
- [ ] **10. MANDATORY: Write plans in Polish** — all plan content must be in Polish language
|
|
58
|
-
- [ ] **11.
|
|
58
|
+
- [ ] **11. MANDATORY: Get user approval of generated plan** — present the full plan content in the chat, then call `AskUserQuestion` with three options: save / regenerate / cancel. Save and label steps below MUST NOT run without approval. Skipped only in `--auto` (auto-approved; logged in audit comment).
|
|
59
59
|
- [ ] **12. MANDATORY: Confirm old plan deletion** — if replacing existing `plan.md`, ask user to confirm deletion of old attachment before proceeding (skipped in `--auto`; delete old attachment automatically)
|
|
60
60
|
- [ ] **13. MANDATORY: Save plan as native Linear attachment** — base64-encode `plan.md` content and upload via `mcp__linear__create_attachment`. **Calling `mcp__linear__save_comment` for the plan body is FORBIDDEN.** Linear hosts the file natively; no external storage.
|
|
61
61
|
- [ ] **14. MANDATORY: Add "AI Plan" label** — ensure `AI Plan` label exists on the team and apply it to the invoked issue (the `linearTaskId` passed to `/plan` — parent task or subtask, whichever was called)
|
|
@@ -132,13 +132,13 @@ You create plans that are:
|
|
|
132
132
|
|
|
133
133
|
| Default behavior | `--auto` override |
|
|
134
134
|
| ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
135
|
-
|
|
|
135
|
+
| Final approval of generated plan content before saving | Skip the approval gate; proceed directly to attachment save (auto-approve) |
|
|
136
136
|
| Ask user to confirm deletion of old `plan.md` attachments | Delete old attachments automatically before saving new ones |
|
|
137
137
|
| Ask "regenerate anyway?" when all plans are up-to-date | Exit cleanly with a Linear comment noting all plans are current; no regeneration |
|
|
138
138
|
| Secondary signal prompt (keyword-triggered confirmation to regen) | Ignore the secondary signal; only the mtime rule decides regeneration |
|
|
139
139
|
| `AskUserQuestion` for any decision | Use the option marked **(Recommended)**; if none, fail fast with a Linear comment explaining why |
|
|
140
140
|
|
|
141
|
-
**Hard requirement in `--auto`**: every decision (save, replace, skip) MUST be logged as a Linear comment in Polish so the run remains auditable after the fact. The mtime rule remains authoritative — `--auto` does not change
|
|
141
|
+
**Hard requirement in `--auto`**: every decision (save, replace, skip) MUST be logged as a Linear comment in Polish so the run remains auditable after the fact. The mtime rule remains authoritative — `--auto` does not change _what_ gets regenerated, only that no human is asked.
|
|
142
142
|
|
|
143
143
|
**Detection**: The flag `--auto` is provided as a positional/named arg. Treat any of `--auto`, `--ci`, `--non-interactive` as equivalent. Combinable with `--deep` (deep team mode runs without the final approval prompt).
|
|
144
144
|
|
|
@@ -675,13 +675,47 @@ When using `--deep` flag and the Planning Team has completed its analysis, appen
|
|
|
675
675
|
- 2: Significant disagreements on approach
|
|
676
676
|
- 1: Fundamental disagreements — plan needs revision
|
|
677
677
|
|
|
678
|
+
### Step 8a: User Approval of Generated Plan
|
|
679
|
+
|
|
680
|
+
**MANDATORY.** Before any Linear write (deletion of old `plan.md`, creation of new `plan.md`, label apply), the user MUST approve the generated plan content. This is the gate FRA-126 added.
|
|
681
|
+
|
|
682
|
+
**`--auto` mode**: Skip this entire step. The plan is auto-approved. Record the auto-approval in the final Linear audit comment (e.g. `Plan zaakceptowany automatycznie (--auto)`). Proceed to Step 9.
|
|
683
|
+
|
|
684
|
+
**Default mode** (interactive):
|
|
685
|
+
|
|
686
|
+
1. **Render the full plan(s) in chat.** Print the markdown produced in Step 8 for every task/subtask that needs planning. The `AskUserQuestion` option labels alone do not give the user enough context — the full text must be visible above the prompt.
|
|
687
|
+
|
|
688
|
+
2. **Ask for approval** via `AskUserQuestion`:
|
|
689
|
+
|
|
690
|
+
```markdown
|
|
691
|
+
## Akceptacja planu
|
|
692
|
+
|
|
693
|
+
Powyżej znajduje się wygenerowany plan dla zadania <linearTaskId> (oraz <N> podzadań, jeśli dotyczy).
|
|
694
|
+
Czy akceptujesz plan i mogę zapisać go jako załącznik `plan.md` w Linear?
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
Options (use exactly these labels for consistency with Step 9):
|
|
698
|
+
|
|
699
|
+
- **"Tak, zapisz plan do Linear"** _(Recommended)_ — user accepts. Proceed to Step 9 (delete old attachment if replacing, then save). Existing flow continues unchanged from here.
|
|
700
|
+
- **"Wygeneruj plan ponownie"** — user wants a different plan. Go to step 3 (regeneration loop) below.
|
|
701
|
+
- **"Anuluj"** — user rejects. Stop the whole skill. Do NOT delete the existing `plan.md` attachment. Do NOT save a new one. Do NOT apply the `AI Plan` label. Print a short status in Polish (`Plan nie został zapisany. Anulowano na żądanie użytkownika.`) and exit.
|
|
702
|
+
|
|
703
|
+
3. **Regeneration branch**: if the user chose "Wygeneruj plan ponownie":
|
|
704
|
+
|
|
705
|
+
- Ask a follow-up `AskUserQuestion` (or accept the free-text the user typed alongside the rejection) to capture what should change: scope, structure, missed files, wrong approach, etc.
|
|
706
|
+
- Loop back to **Step 7 (Create implementation plans)** with the user's feedback in mind. Do NOT re-run Steps 1–6 — the Linear task, comments, commits, and codebase analysis have not changed.
|
|
707
|
+
- On the regenerated plan, return to **Step 8a step 1** (render + ask again).
|
|
708
|
+
- **Cap the loop at 3 regenerations.** On the 3rd rejection, surface the situation to the user (`Plan został odrzucony 3 razy. Przerywam, abyś mógł doprecyzować wymagania.`) and exit without saving.
|
|
709
|
+
|
|
710
|
+
4. **State invariants on entry to Step 9**: the only path that reaches Step 9 is the explicit "Tak, zapisz plan do Linear" choice (or `--auto`). Treat plan content as final.
|
|
711
|
+
|
|
678
712
|
### Step 9: Confirm and Delete Old Plan Attachments
|
|
679
713
|
|
|
680
714
|
**This step applies only when replacing existing plans** (i.e., `oldPlanAttachments` from Step 3a is not empty).
|
|
681
715
|
|
|
682
716
|
**`--auto` mode**: Skip the confirmation prompt. For each task in `oldPlanAttachments`, delete the Linear attachment via `mcp__linear__delete_attachment({ id: attachmentId })` and proceed directly to Step 9a. Log the deletions in the final summary comment.
|
|
683
717
|
|
|
684
|
-
**Default mode** (interactive):
|
|
718
|
+
**Default mode** (interactive): The plan content was already approved in Step 8a; this prompt is strictly about confirming deletion of the **existing** Linear attachment that will be overwritten. Ask the user:
|
|
685
719
|
|
|
686
720
|
```markdown
|
|
687
721
|
## Zastąpienie istniejących planów
|
|
@@ -711,15 +745,13 @@ Use `AskUserQuestion` tool with options:
|
|
|
711
745
|
|
|
712
746
|
### Step 9a: Save Plan as Linear Attachment
|
|
713
747
|
|
|
714
|
-
**⛔ DO NOT call `mcp__linear__save_comment` with plan content here. The ONLY allowed Linear write for the plan body is `mcp__linear__create_attachment`. Re-read Hard Rule #1 if tempted.**
|
|
748
|
+
**⛔ DO NOT call `mcp__linear__save_comment` with plan content here. The ONLY allowed Linear write for the plan body is `mcp__linear__create_attachment`. Re-read Hard Rule #1 if tempted.** (Token usage is posted via `save_comment` in Step 9c — that's the one allowed exception.)
|
|
715
749
|
|
|
716
750
|
For each task that needs planning, upload the plan content directly to Linear via `mcp__linear__create_attachment` — Linear hosts the file itself, no intermediate storage.
|
|
717
751
|
|
|
718
752
|
#### 9a.1 — Prepare plan content
|
|
719
753
|
|
|
720
|
-
The plan content is exactly the markdown produced in Step 8 (the same block that would previously have been posted as a comment).
|
|
721
|
-
|
|
722
|
-
Write it to a temp file so it can be base64-encoded:
|
|
754
|
+
The plan content is exactly the markdown produced in Step 8 (the same block that would previously have been posted as a comment). Write it to the temp file:
|
|
723
755
|
|
|
724
756
|
```bash
|
|
725
757
|
mkdir -p /tmp/claude-plans
|
|
@@ -781,6 +813,38 @@ Steps:
|
|
|
781
813
|
|
|
782
814
|
3. **Failure handling**: if label lookup/apply fails, surface the error but do not roll back the plan attachment. The plan is the primary deliverable; the label is a marker.
|
|
783
815
|
|
|
816
|
+
### Step 9c: Post Token-Usage Comment
|
|
817
|
+
|
|
818
|
+
After the plan attachment(s) and `AI Plan` label have been applied, post a single Linear comment on the **invoked issue** (the same `linearTaskId` passed to `/plan`, identical to the labelling target) reporting the session's token usage.
|
|
819
|
+
|
|
820
|
+
1. Run the per-plugin token-summing script:
|
|
821
|
+
|
|
822
|
+
```bash
|
|
823
|
+
bash "$CLAUDE_PLUGIN_ROOT/scripts/compute-session-tokens.sh"
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
The script prints four whitespace-separated integers on one line: `<input> <output> <cache_creation> <cache_read>`. If no transcript can be located it prints `0 0 0 0` and exits non-zero — treat that as a graceful skip (do NOT block; skip posting the comment).
|
|
827
|
+
|
|
828
|
+
2. Compute `<TOTAL> = <input> + <output> + <cache_creation> + <cache_read>`.
|
|
829
|
+
|
|
830
|
+
3. Call `mcp__linear__save_comment` with `issueId: invokedTaskId` and `body` equal to:
|
|
831
|
+
|
|
832
|
+
```markdown
|
|
833
|
+
## Zużycie tokenów — etap /plan
|
|
834
|
+
|
|
835
|
+
| Metryka | Wartość |
|
|
836
|
+
| -------------- | -------------- |
|
|
837
|
+
| Input | <INPUT> |
|
|
838
|
+
| Output | <OUTPUT> |
|
|
839
|
+
| Cache creation | <CACHE_CREATE> |
|
|
840
|
+
| Cache read | <CACHE_READ> |
|
|
841
|
+
| **Łącznie** | **<TOTAL>** |
|
|
842
|
+
```
|
|
843
|
+
|
|
844
|
+
4. **Subtask rule**: post ONLY to the invoked issue. Do NOT fan the comment out to every subtask — tokens are a per-session total, not per-subtask. Same scoping rule as Step 9b.
|
|
845
|
+
|
|
846
|
+
5. **Failure handling**: if the comment fails to post, surface the error to the user but do not roll back the plan attachment or the label.
|
|
847
|
+
|
|
784
848
|
### Step 10: Confirm to User
|
|
785
849
|
|
|
786
850
|
After successfully saving the plans, confirm to the user:
|
|
@@ -194,6 +194,28 @@ Use `AskUserQuestion` tool with options:
|
|
|
194
194
|
1. **For tasks with subtasks**: Update all completed subtasks to "In Review"
|
|
195
195
|
2. **For tasks without subtasks**: Update the task itself to "In Review"
|
|
196
196
|
|
|
197
|
+
**Before posting**, run the token-summing script and capture its output:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
bash "$CLAUDE_PLUGIN_ROOT/scripts/compute-session-tokens.sh"
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
It prints four whitespace-separated integers on one line: `<INPUT> <OUTPUT> <CACHE_CREATE> <CACHE_READ>`. If no transcript can be located it prints `0 0 0 0` and exits non-zero — treat that as a graceful skip (still post the comment, with zeros in the table).
|
|
204
|
+
|
|
205
|
+
Compute `<TOTAL> = <INPUT> + <OUTPUT> + <CACHE_CREATE> + <CACHE_READ>`. Append exactly one copy of the following Polish block to the bottom of the comment body, after the existing `_Raport wygenerowany przez Claude Code_` footer. Do not create a second Linear comment — the block belongs in **this** comment.
|
|
206
|
+
|
|
207
|
+
```markdown
|
|
208
|
+
## Zużycie tokenów — etap /push
|
|
209
|
+
|
|
210
|
+
| Metryka | Wartość |
|
|
211
|
+
| -------------- | -------------- |
|
|
212
|
+
| Input | <INPUT> |
|
|
213
|
+
| Output | <OUTPUT> |
|
|
214
|
+
| Cache creation | <CACHE_CREATE> |
|
|
215
|
+
| Cache read | <CACHE_READ> |
|
|
216
|
+
| **Łącznie** | **<TOTAL>** |
|
|
217
|
+
```
|
|
218
|
+
|
|
197
219
|
Create a comment on the **parent task** summarizing:
|
|
198
220
|
|
|
199
221
|
```markdown
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: shared-impl-reporter
|
|
3
3
|
description: Generate implementation reports for Linear comments. Creates Polish-language summaries of completed work.
|
|
4
|
-
tools: Read, Glob, Grep
|
|
4
|
+
tools: Read, Glob, Grep, Bash
|
|
5
5
|
model: sonnet
|
|
6
|
-
color:
|
|
6
|
+
color: '#5E6AD2'
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
You are an implementation reporter that generates Polish-language summaries for Linear comments.
|
|
@@ -12,6 +12,34 @@ You are an implementation reporter that generates Polish-language summaries for
|
|
|
12
12
|
|
|
13
13
|
Create structured implementation reports in Polish for Linear task comments.
|
|
14
14
|
|
|
15
|
+
## Token Usage Step (MANDATORY)
|
|
16
|
+
|
|
17
|
+
Every report you emit MUST end with exactly one Polish token-usage block — the one defined below. Append it after the report's existing `_Raport wygenerowany przez Claude Code_` footer; do NOT embed the block inside any of the report templates that follow.
|
|
18
|
+
|
|
19
|
+
1. Run the token-summing script once:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
bash "$CLAUDE_PLUGIN_ROOT/scripts/compute-session-tokens.sh"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
It prints four whitespace-separated integers on one line: `<INPUT> <OUTPUT> <CACHE_CREATE> <CACHE_READ>`. If no transcript can be located it prints `0 0 0 0` and exits non-zero — treat that as a graceful skip (still emit the block, with zeros).
|
|
26
|
+
|
|
27
|
+
2. Compute `<TOTAL> = <INPUT> + <OUTPUT> + <CACHE_CREATE> + <CACHE_READ>`.
|
|
28
|
+
|
|
29
|
+
3. Append this block to the end of the report:
|
|
30
|
+
|
|
31
|
+
```markdown
|
|
32
|
+
## Zużycie tokenów — etap /impl
|
|
33
|
+
|
|
34
|
+
| Metryka | Wartość |
|
|
35
|
+
| -------------- | -------------- |
|
|
36
|
+
| Input | <INPUT> |
|
|
37
|
+
| Output | <OUTPUT> |
|
|
38
|
+
| Cache creation | <CACHE_CREATE> |
|
|
39
|
+
| Cache read | <CACHE_READ> |
|
|
40
|
+
| **Łącznie** | **<TOTAL>** |
|
|
41
|
+
```
|
|
42
|
+
|
|
15
43
|
## Report Templates
|
|
16
44
|
|
|
17
45
|
### Completed Implementation
|
|
@@ -25,12 +53,12 @@ Create structured implementation reports in Polish for Linear task comments.
|
|
|
25
53
|
|
|
26
54
|
### Zmiany
|
|
27
55
|
|
|
28
|
-
| Plik
|
|
29
|
-
|
|
30
|
-
| `src/app/components/feature.component.ts`
|
|
31
|
-
| `src/app/components/feature.component.html`
|
|
32
|
-
| `src/app/components/feature.component.scss`
|
|
33
|
-
| `src/app/components/feature.component.spec.ts` | Nowy
|
|
56
|
+
| Plik | Typ zmiany | Opis |
|
|
57
|
+
| ---------------------------------------------- | ---------- | --------------------- |
|
|
58
|
+
| `src/app/components/feature.component.ts` | Nowy | Komponent widoku |
|
|
59
|
+
| `src/app/components/feature.component.html` | Nowy | Szablon z Bootstrap 4 |
|
|
60
|
+
| `src/app/components/feature.component.scss` | Nowy | Style SCSS |
|
|
61
|
+
| `src/app/components/feature.component.spec.ts` | Nowy | Testy Karma/Jasmine |
|
|
34
62
|
|
|
35
63
|
### Testy
|
|
36
64
|
|
|
@@ -63,9 +91,9 @@ _Raport wygenerowany przez Claude Code_
|
|
|
63
91
|
|
|
64
92
|
### Niezrealizowane
|
|
65
93
|
|
|
66
|
-
| Element | Powod
|
|
67
|
-
|
|
68
|
-
| [item]
|
|
94
|
+
| Element | Powod |
|
|
95
|
+
| ------- | -------- |
|
|
96
|
+
| [item] | [reason] |
|
|
69
97
|
|
|
70
98
|
### Nastepne kroki
|
|
71
99
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Sum token usage from the current Claude Code session's JSONL transcript.
|
|
3
|
+
# Prints four whitespace-separated integers on one line:
|
|
4
|
+
# <input> <output> <cache_creation> <cache_read>
|
|
5
|
+
# Prints "0 0 0 0" and exits non-zero if no transcript can be found.
|
|
6
|
+
#
|
|
7
|
+
# Resolution order:
|
|
8
|
+
# 1. $CLAUDE_CONFIG_DIR (set by Claude Code) or ~/.claude as fallback.
|
|
9
|
+
# 2. Inside <config>/projects/<encoded-cwd>/, pick the file matching
|
|
10
|
+
# $CLAUDE_CODE_SESSION_ID.jsonl when that env var is set.
|
|
11
|
+
# 3. Otherwise pick the most-recently-modified *.jsonl (current session).
|
|
12
|
+
|
|
13
|
+
set -u
|
|
14
|
+
|
|
15
|
+
CONFIG_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
|
|
16
|
+
ENCODED_CWD="$(pwd | sed 's|/|-|g')"
|
|
17
|
+
TRANSCRIPT_DIR="$CONFIG_DIR/projects/$ENCODED_CWD"
|
|
18
|
+
|
|
19
|
+
if [[ -n "${CLAUDE_CODE_SESSION_ID:-}" && -f "$TRANSCRIPT_DIR/$CLAUDE_CODE_SESSION_ID.jsonl" ]]; then
|
|
20
|
+
TRANSCRIPT_FILE="$TRANSCRIPT_DIR/$CLAUDE_CODE_SESSION_ID.jsonl"
|
|
21
|
+
else
|
|
22
|
+
TRANSCRIPT_FILE="$(ls -t "$TRANSCRIPT_DIR"/*.jsonl 2>/dev/null | head -1)"
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
if [[ -z "${TRANSCRIPT_FILE:-}" || ! -f "$TRANSCRIPT_FILE" ]]; then
|
|
26
|
+
echo "0 0 0 0"
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
jq -s '
|
|
31
|
+
reduce .[] as $m (
|
|
32
|
+
{i:0, o:0, cc:0, cr:0};
|
|
33
|
+
.i += ($m.message.usage.input_tokens // 0)
|
|
34
|
+
| .o += ($m.message.usage.output_tokens // 0)
|
|
35
|
+
| .cc += ($m.message.usage.cache_creation_input_tokens // 0)
|
|
36
|
+
| .cr += ($m.message.usage.cache_read_input_tokens // 0)
|
|
37
|
+
)
|
|
38
|
+
| "\(.i) \(.o) \(.cc) \(.cr)"
|
|
39
|
+
' "$TRANSCRIPT_FILE" | tr -d '"'
|