@vocdoni/skills 0.5.2 → 0.6.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.
Files changed (30) hide show
  1. package/.claude-plugin/marketplace.json +5 -15
  2. package/CHANGELOG.md +26 -0
  3. package/README.md +32 -21
  4. package/bin/install.js +22 -5
  5. package/package.json +2 -1
  6. package/plugins/agentic-dev/.claude-plugin/plugin.json +2 -2
  7. package/plugins/agentic-dev/agents/model-router.md +105 -0
  8. package/plugins/agentic-dev/skills/subagent-driven-development/SKILL.md +22 -12
  9. package/plugins/agentic-dev/skills/subagent-driven-development/references/audits.md +20 -13
  10. package/plugins/agentic-dev/skills/subagent-driven-development/references/dispatch.md +37 -1
  11. package/plugins/agentic-dev/skills/subagent-driven-development/references/ledger.md +5 -3
  12. package/plugins/agentic-dev/skills/subagent-driven-development/references/model-catalog.md +118 -0
  13. package/plugins/agentic-dev/skills/subagent-driven-development/references/models.md +93 -70
  14. package/plugins/agentic-dev/skills/subagent-driven-development/scripts/init-workspace.sh +1 -1
  15. package/plugins/agentic-dev/skills/subagent-driven-development/scripts/model-inventory.sh +140 -0
  16. package/plugins/claude-pi-subagent/plugins/pi-subagent/package-lock.json +6 -6
  17. package/plugins/vocdoni-comments/.claude-plugin/plugin.json +2 -2
  18. package/plugins/vocdoni-comments/hooks/hooks.json +28 -0
  19. package/plugins/vocdoni-comments/hooks/session-start.sh +45 -0
  20. package/plugins/vocdoni-contributing/.claude-plugin/plugin.json +3 -2
  21. package/plugins/vocdoni-contributing/hooks/hooks.json +14 -2
  22. package/plugins/vocdoni-contributing/hooks/session-start.sh +18 -6
  23. package/plugins/vocdoni-contributing/skills/contributing/SKILL.md +26 -2
  24. package/plugins/vocdoni-stripe/.claude-plugin/plugin.json +0 -22
  25. package/plugins/vocdoni-stripe/skills/stripe-subscription/SKILL.md +0 -276
  26. package/plugins/vocdoni-stripe/skills/stripe-subscription/references/backend-contract.md +0 -142
  27. package/plugins/vocdoni-stripe/skills/stripe-subscription/references/product-templates.md +0 -132
  28. package/plugins/vocdoni-stripe/skills/stripe-subscription/references/stripe-cli.md +0 -212
  29. package/plugins/vocdoni-stripe/skills/stripe-subscription/scripts/clone-product.sh +0 -247
  30. package/plugins/vocdoni-stripe/skills/stripe-subscription/scripts/stripe-json.sh +0 -223
@@ -1,223 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Thin wrapper around the Stripe CLI that (1) checks the CLI is installed and
3
- # logged in, (2) enforces the environment you asked for (live vs sandbox) by
4
- # reading the banner the CLI prints, and (3) strips that banner so the output
5
- # is clean JSON you can pipe into jq.
6
- #
7
- # Usage:
8
- # stripe-json.sh env # print detected mode + account name
9
- # stripe-json.sh <stripe args...> # e.g. stripe-json.sh customers list --email a@b.c
10
- #
11
- # Environment:
12
- # STRIPE_ENV=live|sandbox which environment you intend to hit (required, no
13
- # default: agent shells often do not keep exported
14
- # variables between calls, and a silent fallback to
15
- # live would turn a forgotten prefix into a live
16
- # write)
17
- # STRIPE_ACCOUNT_NAME=<name> optional: the account name the banner must show.
18
- # The mode alone cannot tell two live accounts (or
19
- # two sandboxes) apart.
20
- #
21
- # Why the banner matters: the CLI keeps ONE active account in its config. A
22
- # `stripe switch` or `stripe login` in another terminal silently changes what
23
- # every later command hits. `--live` is refused when the active account is a
24
- # sandbox, but a sandbox command run while the live account is active would
25
- # hit live test mode without complaint. So we never trust the flag alone: we
26
- # read "▸ Running in <name> · <mode>" from the output and compare it with what
27
- # STRIPE_ENV says you wanted.
28
- set -euo pipefail
29
-
30
- want="${STRIPE_ENV:-}"
31
- want_name="${STRIPE_ACCOUNT_NAME:-}"
32
- case "$want" in
33
- live|sandbox) ;;
34
- # `env` alone may run unset: it is the preflight, before the user has chosen.
35
- "")
36
- if [[ "${1:-}" != env ]]; then
37
- echo "STRIPE_ENV is not set; prefix every call with STRIPE_ENV=live or STRIPE_ENV=sandbox" >&2
38
- exit 2
39
- fi ;;
40
- *) echo "STRIPE_ENV must be 'live' or 'sandbox' (got '$want')" >&2; exit 2 ;;
41
- esac
42
-
43
- if ! command -v jq >/dev/null 2>&1; then
44
- cat >&2 <<'EOF'
45
- jq not found on PATH. This wrapper and the skill's cookbook rely on it to
46
- parse Stripe's JSON output.
47
-
48
- Install it (https://jqlang.org/download/), for example:
49
- brew install jq # macOS
50
- sudo apt install jq # Debian / Ubuntu
51
- sudo pacman -S jq # Arch
52
- winget install jqlang.jq # Windows
53
- EOF
54
- exit 2
55
- fi
56
-
57
- if ! command -v stripe >/dev/null 2>&1; then
58
- cat >&2 <<'EOF'
59
- Stripe CLI not found on PATH.
60
-
61
- Install it (https://docs.stripe.com/stripe-cli), then:
62
- stripe login # start a session on the account you need
63
- stripe agent setup # install the Stripe CLI agent skill
64
-
65
- Alternatively connect a Stripe MCP server and use its tools; see references/stripe-cli.md.
66
- EOF
67
- exit 2
68
- fi
69
-
70
- if ! stripe config --list 2>/dev/null | grep -q '^account_id'; then
71
- cat >&2 <<'EOF'
72
- Stripe CLI is installed but has no active session.
73
-
74
- stripe login # start a session
75
- stripe agent setup # install the Stripe CLI agent skill (once)
76
- EOF
77
- exit 2
78
- fi
79
-
80
- if [[ $# -eq 0 ]]; then
81
- echo "usage: stripe-json.sh env | <stripe args...>" >&2
82
- exit 2
83
- fi
84
-
85
- # Refuse un-confirmed destructive commands: without --confirm the CLI opens an
86
- # interactive prompt that eats stdin and looks like a hang from inside an
87
- # agent (observed with `subscriptions cancel` and `coupons delete`).
88
- # Match whole arguments, not the joined string, so a `-d "description=… cancel …"`
89
- # value is not mistaken for the command word.
90
- # `delete_*` covers the DELETE endpoints named after what they remove
91
- # (`customers delete_discount`, `subscriptions delete_discount`), which prompt too.
92
- confirmed=0 destructive="" read_only=0
93
- for arg in "$@"; do
94
- case "$arg" in
95
- --confirm|-c) confirmed=1 ;;
96
- delete|delete_*|cancel|void_invoice|mark_uncollectible|detach) destructive="$arg" ;;
97
- list|retrieve|search) read_only=1 ;;
98
- esac
99
- done
100
- if [[ -n "$destructive" && $confirmed -eq 0 ]]; then
101
- echo "refusing '$destructive' without --confirm (the CLI would prompt interactively)" >&2
102
- exit 2
103
- fi
104
-
105
- # stdin is closed so a confirmation prompt the verb list above missed fails
106
- # fast on EOF instead of hanging the agent.
107
- run_stripe() {
108
- if [[ "$want" == live ]]; then
109
- stripe "$@" --live </dev/null
110
- else
111
- stripe "$@" </dev/null
112
- fi
113
- }
114
-
115
- # Detect the mode the CLI is actually in from its banner line.
116
- detect() {
117
- local out
118
- out="$(printf '%s' "$1" | grep -m1 'Running in' || true)"
119
- if [[ -z "$out" ]]; then
120
- echo "unknown|unknown"
121
- return
122
- fi
123
- # "▸ Running in <name> · <mode> (acct_...)"
124
- local name mode
125
- name="$(printf '%s' "$out" | sed -E 's/.*Running in (.*) · .*/\1/')"
126
- mode="$(printf '%s' "$out" | sed -E 's/.* · ([a-z]+).*/\1/')"
127
- echo "${mode}|${name}"
128
- }
129
-
130
- matches() { [[ "$1" == "$want" && ( -z "$want_name" || "$2" == "$want_name" ) ]]; }
131
-
132
- mismatch() {
133
- echo "wanted STRIPE_ENV=$want${want_name:+ on '$want_name'} but the CLI is in: $1 ($2)" >&2
134
- echo "run '! stripe switch' to change the active account, then retry" >&2
135
- }
136
-
137
- # Sets raw, rc, mode and name from a harmless read.
138
- probe() {
139
- set +e
140
- raw="$(run_stripe balance retrieve 2>&1)"
141
- rc=$?
142
- set -e
143
- IFS='|' read -r mode name <<<"$(detect "$raw")"
144
- }
145
-
146
- # Exits 3 unless the probe succeeded in the wanted environment.
147
- require_env() {
148
- if [[ $rc -ne 0 && "$mode" == unknown ]]; then
149
- # The CLI failed before printing a banner (expired key, network, missing
150
- # permission): its own error is the diagnosis, not an account mismatch.
151
- echo "stripe CLI probe failed (exit $rc):" >&2
152
- printf '%s\n' "$raw" >&2
153
- exit 3
154
- fi
155
- if [[ $rc -ne 0 ]] || ! matches "$mode" "$name"; then
156
- mismatch "$mode" "$name"
157
- if [[ $rc -ne 0 ]]; then printf '%s\n' "$raw" | grep -v 'Running in' >&2 || true; fi
158
- exit 3
159
- fi
160
- }
161
-
162
- if [[ "$1" == "env" ]]; then
163
- probe
164
- if [[ -z "$want" && $rc -eq 0 ]]; then
165
- # Preflight only: tooling and session work. No environment was asked for,
166
- # so nothing is enforced (a live account shows its test mode here).
167
- echo "$mode ($name); set STRIPE_ENV before any real command"
168
- exit 0
169
- fi
170
- require_env
171
- echo "$mode ($name)"
172
- exit 0
173
- fi
174
-
175
- # The banner check below runs after the command. For a read that is enough;
176
- # a write in the wrong environment has already happened by then, so check
177
- # first for anything that is not a read.
178
- if [[ $read_only -eq 0 ]]; then
179
- probe
180
- require_env
181
- fi
182
-
183
- tmp_err="$(mktemp)"
184
- trap 'rm -f "$tmp_err"' EXIT
185
- set +e
186
- raw="$(run_stripe "$@" 2>"$tmp_err")"
187
- rc=$?
188
- set -e
189
-
190
- # The banner lands on stderr for most commands and on stdout for a few, so
191
- # look at both.
192
- IFS='|' read -r mode name <<<"$(detect "$(cat "$tmp_err"; printf '%s' "$raw")")"
193
- if [[ $rc -ne 0 && "$mode" == unknown ]]; then
194
- # Failed before reaching the API (usage error, bad flag): show that, not an
195
- # environment complaint.
196
- cat "$tmp_err" >&2
197
- printf '%s\n' "$raw" >&2
198
- exit "$rc"
199
- fi
200
- if ! matches "$mode" "$name"; then
201
- mismatch "$mode" "$name"
202
- grep -v 'Running in' "$tmp_err" >&2 || true
203
- exit 3
204
- fi
205
-
206
- if [[ $rc -ne 0 ]]; then
207
- grep -v 'Running in' "$tmp_err" >&2 || true
208
- printf '%s\n' "$raw" | sed '/^[{[]/,$!d' >&2
209
- exit "$rc"
210
- fi
211
-
212
- # Drop everything before the first line that starts a JSON document.
213
- json="$(printf '%s\n' "$raw" | sed '/^[{[]/,$!d')"
214
-
215
- # The CLI exits 0 on API errors and prints {"error": {...}}; turn that into a
216
- # real failure so callers using `set -e` or `&&` stop instead of parsing junk.
217
- if printf '%s' "$json" | jq -e 'type == "object" and has("error")' >/dev/null 2>&1; then
218
- printf '%s\n' "$json" | jq -r '"stripe api error: \(.error.type // "?"): \(.error.message // "?")"' >&2
219
- printf '%s\n' "$json" >&2
220
- exit 1
221
- fi
222
-
223
- printf '%s\n' "$json"