@baravak/risloo-profile-cli 4.78.0 → 4.83.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.
@@ -24,6 +24,42 @@ Ask for the relevant inputs:
24
24
 
25
25
  Then **ask for the designer's Figma comments** — thresholds, coefficients, conditional behavior, spacing rules, and other implementation notes. The Figma MCP / SVG / HTML do **not** contain comments, and these specs usually live only there. Don't start coding until you have them.
26
26
 
27
+ ### Figma MCP budget discipline — fetch the whole artifact, not pieces
28
+
29
+ Figma MCP read calls are **rate limited per plan and seat**, and the cheap tiers are brutal (a View/Collab seat, or any seat on a Starter plan, gets **6 calls per month**; a Dev/Full seat on Professional gets 200/day, 10/min). Running out mid-task strands the work. So treat every read call as expensive and design for **maximum data per request**.
30
+
31
+ Rules:
32
+
33
+ 1. **Download the complete artifact set up front — source, SVG, and PNG — then work locally.** Do not drip-feed one layer per call. Prefer `download_assets` on the **Chart** node: one call returns the whole-node export plus the vector SVGs of its subtree. Add `get_metadata` on the same node for the layer tree with exact `x/y/width/height`. Those two calls plus one `get_screenshot` give you geometry, vectors, and the visual reference for a whole page.
34
+ 2. **Asset URLs cost nothing.** `get_design_context` on a vector-heavy layer returns an `<img src="…svg">` asset URL instead of code, and `get_screenshot` returns a PNG URL. Downloading those with `curl` does **not** consume quota. Always pull the file and read it locally rather than making another MCP call.
35
+ 3. **Never call `get_design_context` on a repeated component instance more than once.** A dotted-column or dash-ruler instance can expand to hundreds of nodes, burning a call and flooding context. Sample **one** atom for its style, then derive the repetition from `get_metadata` sizes and the pitch arithmetic.
36
+ 4. **Answer remaining questions from the downloaded PNG/SVG, not from Figma.** Exact colors, tick pitch, mirroring, and alignment are all measurable locally (e.g. sample pixels with Python/PIL, grep the SVG for `stroke=`/`fill=`). Go back to MCP only for text content and semantics that the outlined SVG genuinely cannot carry.
37
+ 5. **Batch the calls you do need in one message** so they run in parallel and stay inside the per-minute cap; keep a batch at or below the seat's per-minute limit.
38
+ 6. **Check the budget before a big pull.** `whoami` is exempt from rate limits and reports every plan and seat — use it when a call fails or before planning a large fetch. On a limit error, stop and tell the user which seat/plan is capping, rather than retrying.
39
+ 7. **If the quota is exhausted, ask the user to export the files** (Chart SVG + PNG) instead of waiting — that path costs zero calls and the SVG is authoritative for color and geometry anyway.
40
+
41
+ #### Access tiers and which tools are metered
42
+
43
+ | Seat | Starter | Professional | Organization | Enterprise |
44
+ |---|---|---|---|---|
45
+ | View, Collab | 6 / month | 6 / month | 6 / month | 6 / month |
46
+ | Dev, Full | 6 / month | 200 / day, 10 / min | 200 / day, 15 / min | 600 / day, 20 / min |
47
+
48
+ - **Metered:** every tool that *reads* from Figma — `get_design_context`, `get_metadata`, `get_screenshot`, `get_variable_defs`, `download_assets`, and the rest.
49
+ - **Exempt:** `whoami`, `generate_figma_design`, `add_code_connect_map`, and other write-to-Figma tools. Reading MCP **resources** (`skill://…`, `file://figma/docs/…`) is also not metered.
50
+ - Quota follows the **plan that owns the file**, not the user's best seat. A user with a Full seat on their own Starter team and a View seat on the team that owns the design still gets 6/month for that design. `whoami` returns every plan with its `tier` and `seat`, plus the plan key — the plan key also appears in the rate-limit error URL, which identifies exactly which plan is capping.
51
+ - The fix is usually a **seat** upgrade (View → Dev/Full) on the owning team, not a plan upgrade. Report that distinction to the user instead of suggesting they buy a bigger plan.
52
+
53
+ ### Recommended one-shot fetch sequence for a new page
54
+
55
+ For each Chart node, in a single batched message:
56
+
57
+ 1. `get_metadata` — the layer tree with exact `x/y/width/height` for every node. This is the geometry ledger's backbone.
58
+ 2. `download_assets` with `defaultFormat: "svg"` — returns a URL for the whole-node vector export plus the subtree's SVG assets.
59
+ 3. `get_screenshot` at a `maxDimension` at least equal to the Chart's natural width — the visual acceptance reference.
60
+
61
+ Then `curl` all returned URLs (free) and do the rest locally: read the export SVG for exact colors, strokes, radii, gradients and paint order; read the metadata for layout boxes and text-node dimensions; compare renders against the PNG. Only text **content** needs a further call, and `get_metadata` already carries it in the layer `name` for text nodes.
62
+
27
63
  Do not select one design artifact and ignore the others. Establish an authority table for the current task:
28
64
 
29
65
  - **PNG** — final visual acceptance target, including visible orientation, wrapping, cropping, alignment, and composition.
@@ -0,0 +1,70 @@
1
+ name: Publish to npm
2
+
3
+ # Releases are driven by a tag:
4
+ #
5
+ # npm version <patch|minor|major>
6
+ # git push --follow-tags
7
+ #
8
+ # No npm token is involved. The job authenticates to the registry with a
9
+ # short-lived OIDC credential issued to this workflow (trusted publishing),
10
+ # which is what `id-token: write` below grants. The registry must be told to
11
+ # trust this repository + workflow filename in the package's settings.
12
+ on:
13
+ push:
14
+ tags:
15
+ - "v*"
16
+ workflow_dispatch:
17
+
18
+ permissions:
19
+ contents: read
20
+ id-token: write
21
+
22
+ jobs:
23
+ publish:
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - uses: actions/checkout@v7
27
+
28
+ - uses: actions/setup-node@v7
29
+ with:
30
+ node-version: 24
31
+ registry-url: https://registry.npmjs.org
32
+ cache: npm
33
+
34
+ # Trusted publishing needs npm 11.5.1+. The npm bundled with Node usually
35
+ # already satisfies that, so only reach for the network when it does not
36
+ # — an unconditional global install is a needless failure point.
37
+ - name: Ensure npm supports trusted publishing
38
+ run: |
39
+ need=11.5.1
40
+ have="$(npm --version)"
41
+ if [ "$(printf '%s\n%s\n' "$need" "$have" | sort -V | head -n1)" = "$need" ]; then
42
+ echo "npm $have satisfies >= $need"
43
+ else
44
+ echo "npm $have is older than $need, upgrading"
45
+ for attempt in 1 2 3; do
46
+ npm install -g npm@latest && break
47
+ echo "attempt $attempt failed, retrying"; sleep 10
48
+ done
49
+ fi
50
+ npm --version
51
+
52
+ - run: npm ci --fetch-retries=5
53
+
54
+ # sharp carries a native binary. Fail here with a clear message rather
55
+ # than part-way through the release.
56
+ - name: Smoke-check the native image pipeline
57
+ run: node -e "require('sharp'); console.log('sharp loaded')"
58
+
59
+ # A tag that disagrees with package.json would publish the wrong version.
60
+ - name: Check the tag matches package.json
61
+ if: github.event_name == 'push'
62
+ run: |
63
+ tag="${GITHUB_REF_NAME#v}"
64
+ pkg="$(node -p "require('./package.json').version")"
65
+ echo "tag=$tag package.json=$pkg"
66
+ test "$tag" = "$pkg"
67
+
68
+ # Runs prepublishOnly (npm test) first. Provenance is attached
69
+ # automatically because this is a public repository.
70
+ - run: npm publish
@@ -1,14 +1,23 @@
1
- name: push-package
1
+ name: CI
2
+
2
3
  on:
3
- push
4
+ push:
5
+ pull_request:
6
+
4
7
  jobs:
5
- build:
8
+ test:
6
9
  runs-on: ubuntu-latest
7
10
  steps:
8
- - uses: actions/checkout@v2
9
- - uses: actions/setup-node@v2
11
+ - uses: actions/checkout@v7
12
+
13
+ - uses: actions/setup-node@v7
10
14
  with:
11
- node-version: "16.x"
12
- - run: |
13
- yarn
14
- yarn test
15
+ node-version: 24
16
+ cache: npm
17
+
18
+ # `npm ci` installs exactly what package-lock.json pins; the previous
19
+ # `yarn` step ignored that lockfile.
20
+ - run: npm ci
21
+
22
+ # Renders every sample in both variants.
23
+ - run: npm test
package/.mcp.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "figma": {
4
+ "type": "http",
5
+ "url": "https://mcp.figma.com/mcp"
6
+ }
7
+ }
8
+ }
package/AGENTS.md CHANGED
@@ -44,8 +44,7 @@ risloo-extractor-app/
44
44
  │ └── publish/
45
45
  │ ├── json/profiles/ # Template JSON per sample
46
46
  │ ├── json/gift/ # Gift template data
47
- ├── test.js # Auto-test all samples
48
- │ └── bot.js # Post-publish automation
47
+ └── test.js # Auto-test all samples
49
48
  ├── views/
50
49
  │ ├── profiles/samples/ # Handlebars SVG templates (.hbs)
51
50
  │ └── gift.hbs
@@ -387,7 +386,7 @@ If several local coordinate patches accumulate, stop. Re-establish the coordinat
387
386
  | Dates | Moment.js + moment-jalaali (Persian calendar) |
388
387
  | QR codes | qrcode |
389
388
  | File watching | Chokidar |
390
- | Package manager | Yarn |
389
+ | Package manager | npm (`package-lock.json` is the lockfile) |
391
390
  | Design source | Figma (via MCP) |
392
391
 
393
392
  ---
@@ -405,9 +404,17 @@ If several local coordinate patches accumulate, stop. Re-establish the coordinat
405
404
 
406
405
  ## Publishing
407
406
 
407
+ Releases go through GitHub Actions via npm **trusted publishing** (OIDC) — there
408
+ is no npm token anywhere, local or in secrets. Tag the release and push it; the
409
+ `.github/workflows/publish.yml` job publishes it.
410
+
408
411
  ```bash
409
- npm version <patch|minor|major>
410
- npm publish
411
- # prepublishOnly: npm test
412
- # postpublish: npm run bot
412
+ npm version <patch|minor|major> # bumps package.json and creates the vX.Y.Z tag
413
+ git push --follow-tags # pushing the tag triggers the release
414
+ # prepublishOnly: npm test — runs inside the job before the registry is touched
413
415
  ```
416
+
417
+ The job refuses to publish if the tag and `package.json` version disagree.
418
+ Publishing from a laptop with `npm publish` is not expected to work: npm
419
+ removed non-expiring tokens, and the package is configured to trust this
420
+ workflow instead.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baravak/risloo-profile-cli",
3
- "version": "4.78.0",
3
+ "version": "4.83.0",
4
4
  "description": "**Risloo Profile CLI** is a library for creating profiles, reports and sheets for *psychological* samples.",
5
5
  "main": "bin/risloo.js",
6
6
  "publishConfig": {
@@ -10,10 +10,8 @@
10
10
  "risloo": "bin/risloo.js"
11
11
  },
12
12
  "scripts": {
13
- "bot": "node ./src/publish/bot.js",
14
13
  "test": "node ./src/publish/test.js",
15
14
  "prepublishOnly": "npm test",
16
- "postpublish": "npm run bot",
17
15
  "start": "node app"
18
16
  },
19
17
  "repository": {
@@ -26,8 +24,6 @@
26
24
  "chalk": "^4.1.2",
27
25
  "chokidar": "^3.5.3",
28
26
  "commander": "^8.3.0",
29
- "dotenv": "^16.0.0",
30
- "form-data": "^4.0.0",
31
27
  "handlebars": "^4.7.7",
32
28
  "moment": "^2.29.1",
33
29
  "moment-jalaali": "^0.9.2",
@@ -40,4 +36,4 @@
40
36
  "url": "https://github.com/baravak/risloo-extractor-app/issues"
41
37
  },
42
38
  "homepage": "https://github.com/baravak/risloo-extractor-app#readme"
43
- }
39
+ }