Compare commits

...
15 Commits
Author SHA1 Message Date
poli0981andClaude Opus 5.5 acad57acf4 docs: v1.3.0 is on Firefox Add-ons too — all three stores live
Firefox Add-ons approved the first version. The owner reported it on
2026-11-21. AMO's public API shows the add-on public, version 1.3.0,
Firefox 140 or later, slug "bookmarkmagic". Both the slug URL and the
gecko-id URL the About link uses answer 200.

- README: the Firefox install row links the listing, with an AMO version
  badge beside the Chrome Web Store and Edge ones.
- docs/00: the Type line, the 1.3.0 status (live on all three stores), §9
  (gecko id, slug, listing), §10 item 21 done and item 24 done. Item 23's
  automation state was re-checked and is unchanged: firefox-add-ons still
  does not exist.
- docs/13 §8 and store/listing.*.md: the licence to pick is "GNU General
  Public License v3.0 or later". AMO offers "v3.0 only" beside it, and that
  is what the listing ended up with (GPL-3.0-only, per the API) — the docs
  only said "v3.0". Item 21 keeps it open, along with the empty support site.
- docs/15 and CLAUDE.md: Firefox Add-ons live; 1.3.0 is on all three.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:54:53 +07:00
poli0981andClaude Opus 5.5 33c4d517b4 docs: v1.3.0 is live on the Chrome Web Store; tags now publish
The Chrome Web Store approved 1.3.0 on 2026-11-19. Its listing shows version
1.3.0 ("Updated: November 19, 2026", 4 users) — the first update since 1.2.0,
carrying 1.2.1 as well. Firefox Add-ons is the one store still reviewing.

- docs/00: the 1.2.0, 1.2.1 and 1.3.0 status paragraphs. §10 item 20 is done,
  but the 11 §5 upgrade pass and 13 §1b step 10 still have no recorded
  result. Item 23 records the store automation as configured today: all
  three *_AUTOPUBLISH variables are true, so a pushed v* tag is a store
  submission. chrome-web-store and edge-add-ons have their secrets and the
  v* tag rule but no required reviewer. firefox-add-ons does not exist yet.
- docs/15: CWS live, Firefox Add-ons in review.
- CLAUDE.md: the banner, and a carry-forward note in Phase 10: a tag is an
  upload to users' browsers, so it needs the owner's go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 16:44:13 +07:00
poli0981andClaude Opus 5.5 28c27154ac docs: Edge Add-ons is live; record the v1.3.0 submissions
The owner submitted v1.3.0 to all three stores on 2026-11-18, and Edge
Add-ons approved it on 2026-11-19: the first Edge version, public, five
languages. The Chrome Web Store update and the first Firefox Add-ons
version are still in review.

- README: the Edge row of the install table links the listing, and an
  Edge Add-ons version badge (a shields dynamic badge over the store's
  public getproductdetailsbycrxid JSON) sits beside the Chrome Web Store
  one.
- docs/00: the Type line and v1.3.0 status; §9 gains the Edge item id
  (CRX ID), Product ID, Store ID and listing; §10 items 20-22 and 24
  record what was submitted, what is live and what is still open (the
  11 §5 passes have no recorded result; sync-on Edge is still unverified).
  The 1.2.1 paragraph says it never went up on its own.
- docs/13 §9: the About link matches the CRX ID, not the Product ID; done
  for 1.3.0.
- docs/15: v1.2.1 submission skipped; v1.3.0 submitted; v1.3.0 live on
  Edge; Chrome Web Store and Firefox Add-ons in review.
- CLAUDE.md: the banner and the Phase 10 exit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 07:32:59 +07:00
poli0981andClaude Opus 5.5 ce97979706 fix(about): send Edge Add-ons installs to their listing
BookmarkMagic went live on Edge Add-ons on 2026-11-19. Its "Store listing"
link chooses the listing by runtime.id, and only the Chrome Web Store's id
was known, so an install from Edge Add-ons was sent to the README's install
section.

storeUrlFor now looks the id up in a map of each Chromium store's item id
to its listing. Edge's item id is Partner Center's "CRX ID", which is what
an install reports; the Product ID is a different number, the one the
EDGE_PRODUCT_ID secret takes. Any other id (an unpacked build) still goes
to the install section.

Ships with the next release (CHANGELOG [Unreleased]); docs/06 §3.5 says
so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 07:32:59 +07:00
poli0981andClaude Opus 5.5 1657646b01 docs(store): Edge listing names no other browser
Partner Center warned on the zh-CN description: "Avoid referencing other
browsers in your extension description such as Firefox". Edge's developer
policy (1.1.2) says a listing must not reference other browsers, and the
first Edge copy was the Chrome Web Store description with two bullets
swapped: the export bullet still listed seven browsers, and the swapped
import bullet itself named Chrome, Brave and Firefox.

- store/listing.*.md: Firefox Add-ons and Edge Add-ons get a heading
  each. The Edge section is a complete description, pasted whole, that
  names no browser but Edge: the profile "Bookmarks" file is the one "Edge
  and similar browsers keep", HTML export is "the standard bookmark file
  every major browser can import". Every other line matches the Chrome
  Web Store copy; the Firefox copy is unchanged.
- tests/unit/store-listing.test.ts: one Edge description per locale, 250
  to 5,000 characters, no other browser's name; and the same pattern must
  find the browsers the Chrome Web Store copy lists, so it cannot pass by
  matching nothing.
- docs/08 §10, docs/13 §9, docs/11 §4, store/README.md: the rule, where it
  is tested, and policy 1.5.2's "should" about the privacy policy, left
  as it is unless review raises it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 23:45:49 +07:00
poli0981andClaude Opus 5.5 bcc4c81a8c docs(01): knip 6.45.1, after Dependabot #45
The hand sync every Dependabot bump needs: docs/01 §2 names the version
the lockfile holds, and Dependabot only moves the lockfile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:21:38 +07:00
poli0981andClaude Opus 5.5 46093b7bd1 docs: record v1.3.0 as released
v1.3.0 is tagged (signed, on 80c7190) and released: three packages and
SHA256SUMS.txt, each checksum verified after download, and both manifests
passing check-manifest as downloaded. Nothing is submitted to a store yet.

- CLAUDE.md: the banner names 1.3.0 and what it is; the doc index points
  at docs/08's Firefox and Edge sections; Phase 10 gets its exit and two
  things to carry forward (no Firefox in CI; every change ships in two
  packages).
- docs/00: the Type line says Firefox; a v1.3.0 status paragraph; doc
  suite 1.13.
- docs/15: "v1.3.0 released" with the checksums and sizes, and
  "v1.3.0 submitted" pending for the owner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:21:38 +07:00
dependabot[bot] 938ad5d8ab chore(deps-dev): Bump knip
Bumps the dev-minor-and-patch group with 1 update: [knip](https://github.com/webpro-nl/knip/tree/HEAD/packages/knip).


Updates `knip` from 6.44.2 to 6.45.1
- [Release notes](https://github.com/webpro-nl/knip/releases)
- [Commits](https://github.com/webpro-nl/knip/commits/knip@6.45.1/packages/knip)

---
updated-dependencies:
- dependency-name: knip
  dependency-version: 6.45.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: dev-minor-and-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-18 22:16:05 +07:00
poli0981andClaude Opus 5.5 80c7190864 chore(release): 1.3.0
Firefox and Microsoft Edge Add-ons, and maintenance mode. Permissions are
unchanged; nothing re-asks for consent (LEGAL_VERSION stays 1).

- package.json and the lockfile's root at 1.3.0; CHANGELOG [1.3.0] with
  Added / Changed / Fixed / Packages.
- docs/00 §10 items 19-26: what only the owner can do for this release
  (the store uploads, the first AMO and Edge submissions by hand, the store
  environments, real-browser QA, native review).
- docs/15: Phase 10 in the progress table; 1.2.1 may be skipped on the
  store, since 1.3.0 contains it.
- docs/13 §8: the sources archive rebuilt every file of the Firefox
  package byte for byte. docs/08 §9: Options can open a second Manager tab
  on Firefox.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:10:35 +07:00
poli0981andClaude Opus 5.5 ffceb4bd54 fix: review findings — separators are not items, Replace counts what it deletes
An adversarial review of the Firefox port found:

- #edit treated a Firefox separator as an item in three places: a folder's
  count badge, whether a folder can be expanded, and whether it can be
  sorted. A folder of separators and one bookmark offered Sort A-Z.
- Replace's confirmation counted every writable root, so a signed-in
  Chrome's account roots, which Replace never empties, were counted among
  what it would delete. In every release since 1.1.0; it now counts the
  replaceable roots only.
- The store jobs checked their files against the SHA256SUMS.txt that came
  in the same artifact, with --ignore-missing. Each file is now checked by
  name against the published Release's checksums.
- Qodana's publish job ran only after a successful scan, so a scan failing
  on findings never published them.
- getRoots' position fallback had no test. It now has two, with unknown
  ids and a Bookmarks Menu listed first.

Docs follow: the two browser modules and the warning codes (02), where the
landed index is compared (05), the separator markup and folder count (06),
what the Firefox suites are (11), the release staging and environments
limited to v* tags (12, 00), and which loose entries reach the Bookmarks
Menu on Firefox (03, 04, README).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:10:35 +07:00
poli0981andClaude Opus 5.5 23f6386d3d docs: Firefox and Edge for users — install, build, limits, listings
- BUILD.md: rebuilding the release packages, written for Firefox Add-ons'
  source review (Node.js 26 stated outright: the sources archive drops
  .nvmrc), and useful to anyone checking a store build against the source.
- README: a browser/store/requirement table (Edge and Firefox listings not
  live yet, and said so), the Firefox package on each Release is for
  checking, not installing; the privacy section names the same CSP in every
  browser; limits gain Firefox's separators, address and title lengths.
- SECURITY.md: the latest version on each of the three stores is supported.
- ACCESSIBILITY.md: Firefox and Edge are best effort and untested with
  assistive technology; separators are drawn but not announced, and Alt+↑/↓
  past one leaves the spoken position unchanged — a known limitation.
- store/listing.*.md: the AMO and Edge blocks — the two bullets that named
  Chrome rewritten for browsers in general, one more limitation for Firefox,
  and each store's fields. Translations best-effort.
- CHANGELOG: the 1.3.0 entry under [Unreleased] until the bump.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:10:35 +07:00
poli0981andClaude Opus 5.5 dc4cd06cbb ci: build both packages, and publish to three stores from isolated jobs
- ci.yml: the Firefox package is built and checked beside the Chrome one.
- release.yml: three release files — the Chromium package (Chrome Web Store
  and Edge Add-ons), the Firefox package and AMO's sources archive — each
  staged by exact name so a missing one fails the run, both manifests checked
  against the tag, SHA256SUMS over all three.
- One store job per store (docs/12 §3), each off until its repo variable is
  true, each in its own GitHub Environment holding only its own secrets, each
  checking the downloaded file against SHA256SUMS before uploading. They
  install tools/publish — publish-browser-extension 6.2.0 and its three
  dependencies, from their own lockfile, scripts off — instead of the ~320
  packages of the dev toolchain, which the single old job installed next to
  four Chrome secrets.
- The old job could not have worked: it sent CWS API v1.1 credentials, and
  v1.1 was shut down on 2026-10-15. store-chrome uses v2 (publisher id and a
  service account) and sets CHROME_API_VERSION explicitly. store-firefox is
  listed and desktop-only; store-edge sends the Chromium package.
- Dependabot watches tools/publish; the licence gate reads its lockfile too.
- qodana.yaml: clean since the first run's findings were handled, so any new
  one now fails that (non-required) workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:10:35 +07:00
poli0981andClaude Opus 5.5 2eaa1acce4 feat(firefox): the right roots, the Bookmarks Menu, separators and move index
What made Firefox more than a build target (docs/02 §4, 03, 04, 05 §10):

- Roots. getRoots (now browser/roots.ts) tries Firefox's GUIDs after
  folderType and the Chromium ids, and never takes the Bookmarks Menu by
  position — Firefox lists it first, and the old fallback took it for the
  bar, so a Replace emptied the Menu and the toolbar and restored into the
  wrong roots. The Menu is a fourth destination Replace also empties.
- The Menu in the file model: root "menu" (BM JSON, additive); HTML writes
  its entries loose at the top level, as Firefox's own export does; on
  Firefox loose top-level entries are routed into the Menu, elsewhere a menu
  folder stays a folder under Other. New-folder mode is unchanged.
- Separators come back as { type: "separator", url: "data:" }. Recognised by
  type (browser/live-tree.ts): left out of exports and backups, of every
  count, of the dedupe index and the duplicate finder, never a search match;
  in #edit they are aria-hidden lines that take no focus or command, with
  posinset counting items only, Alt+↑/↓ stepping past one as one place, and
  Sort A→Z sorting each run between them. The Replace confirmation says how
  many will go and that nothing brings them back; files' separators are
  counted (SEPARATORS_SKIPPED).
- Move index: Chromium counts a rightward same-folder move before removal,
  Firefox after. The adapter sends each its own number and the reply's index
  is checked — a mismatch re-reads the tree. Before this, every rightward drag
  on Firefox landed one place too far and Alt+↓ moved two.
- Firefox refuses addresses over 65 536 characters, mid-write: dropped before
  planning on Firefox (URL_TOO_LONG); nothing changes on Chromium.
- Strings true in every browser: the date note says "the browser", the About
  link is "Store listing" and goes to the listing the copy came from (AMO by
  gecko id, the Chrome Web Store by item id, else the README's install
  section); the smart-bookmark note drops "dead link". Diagnostics names the
  browser. All five locales (ja/zh-CN/ro best-effort).

bookmarks.ts was over the 300-line target, so its pure half moved to
live-tree.ts and root resolution to roots.ts before anything was added.
Tests run the root, Replace, export and #edit paths over a Firefox flavour of
the fake (docs/11 §4). Also fixes the last Qodana finding, a redundant escape
in the i18n interpolation regex.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:10:35 +07:00
poli0981andClaude Opus 5.5 779335802a build(firefox): a second package, MV3, held to its own manifest gate
wxt.config.ts now builds for the target browser (docs/08 §1, §9):

- `manifestVersion: 3` for every target — WXT built Firefox as MV2;
- Firefox gets browser_specific_settings.gecko — the permanent id
  bookmarkmagic@poli0981.dev, strict_min_version 140.0 (the first that
  accepts data_collection_permissions, which AMO requires of new add-ons),
  and data_collection_permissions { required: ["none"] } — and no
  minimum_chrome_version; Chrome keeps its floor of 136;
- Vite targets firefox140 for that package;
- the sources archive AMO reviews leaves out coverage, captures, store copy,
  docs, tests and tools.

Permissions, CSP, pages and icons are identical in both packages.
check-manifest.mjs takes --browser chrome|firefox, mapped through a fixed
table to .output/<target>-mv3 (still no path from the command line), and
pins each package's exact key set and floor; the gecko block is compared key
order aside. New npm scripts: build:firefox, zip:firefox; verify:full builds
and checks both packages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:10:35 +07:00
poli0981andClaude Opus 5.5 355443ef6b docs: specify Firefox (AMO) and Edge Add-ons support for v1.3.0
Docs first, as CLAUDE.md requires; the code follows in this branch.

- 08: the manifest per target (two packages from one source, MV3 for
  both); Firefox's gecko id, data-collection declaration, floor 140 and
  source-code submission; Edge takes the Chrome package unchanged.
- 02 §4, 03 §1/§3, 04, 05 §10: Firefox's GUID roots and fourth root, the
  Bookmarks Menu (`root: "menu"`, unmarked entries routed into it on
  Firefox); separators recognised by type, kept out of the file model and
  shown as untouchable lines in #edit; the move index sent by each browser's
  own rule and checked against the reply; addresses Firefox refuses dropped
  before planning; separators a file holds counted.
- 06/07: the About link follows the install; three strings that blamed
  Chrome for what every browser does are reworded; new keys listed.
- 11: a Firefox flavour of the fake, and a manual pass on real Firefox and
  Edge (including Edge signed in with sync) before the first submissions.
- 12/13: three store jobs, each in its own environment with only its own
  secrets and a four-package install; CWS API v2 (v1.1 died 2026-10-15);
  AMO and Edge runbooks for the first, manual uploads.
- 09/14 and legal/: three stores named; a clarification, not a
  LEGAL_VERSION bump.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:10:35 +07:00
109 changed files with 3699 additions and 613 deletions

No files matched your search

+16
View File
@@ -56,6 +56,22 @@ updates:
- dependency-name: '@types/node'
update-types: [version-update:semver-major]
# The store-upload tool release.yml installs on its own (docs/12 §3): four
# packages, kept apart from the toolchain because they run beside store
# credentials. Its own directory, so its bumps arrive as their own PRs.
- package-ecosystem: npm
directory: /tools/publish
schedule:
interval: weekly
day: monday
open-pull-requests-limit: 2
cooldown:
default-days: 7
commit-message:
prefix: chore
prefix-development: chore
include: scope
- package-ecosystem: github-actions
directory: /
schedule:
+3
View File
@@ -59,6 +59,9 @@ jobs:
# tabs/scripting/host_permissions that never appear in the config file.
- run: npm run build
- run: npm run check:manifest
# The second package (docs/08 §9), held to its own key set and floor.
- run: npm run build:firefox
- run: npm run check:manifest -- --browser firefox
windows:
# Not a required check. The owner develops on Windows, and the paths that
+4 -1
View File
@@ -99,7 +99,10 @@ jobs:
publish:
name: Findings to code scanning
needs: scan
if: needs.scan.outputs.ran == 'true'
# !cancelled(), not the implicit success(): with failureConditions in
# qodana.yaml, a scan that FINDS something fails — and those are exactly
# the findings that must reach code scanning and the pull request.
if: ${{ !cancelled() && needs.scan.outputs.ran == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
+183 -39
View File
@@ -5,11 +5,16 @@
# (required by docs/09 §5), performs no store submission, and exposes no
# `outputs:`, so a caller cannot reference the zip it built.
#
# Three jobs, least privilege first. `build` installs, runs every gate and
# packages with a READ-ONLY token; only `publish`, which installs nothing and
# runs no repository code, ever holds `contents: write`. Before this split one
# job ran `npm ci` — every dependency's install script plus our own tests —
# while holding a write token that checkout had also left in .git/config.
# Least privilege first. `build` installs, runs every gate and packages with a
# READ-ONLY token; only `publish`, which installs nothing and runs no
# repository code, ever holds `contents: write`. Before the split one job ran
# `npm ci` — every dependency's install script plus our own tests — while
# holding a write token that checkout had also left in .git/config.
#
# Since v1.3.0 there are three release files: the Chromium package (the Chrome
# Web Store AND Edge Add-ons take it), the Firefox package, and the sources
# archive AMO reviews (docs/08 §9, docs/13 §1c). And three store jobs, one per
# store, each off until its repo variable says otherwise (docs/12 §3).
name: Release
on:
@@ -47,33 +52,40 @@ jobs:
- run: npm run check:licenses
- run: npm audit --omit=dev --audit-level=low
- run: npm run zip # wxt zip → .output/<name>-<version>-chrome.zip
- run: npm run zip # → .output/<name>-<version>-chrome.zip (Chrome Web Store, Edge Add-ons)
- run: npm run zip:firefox # → …-firefox.zip and …-sources.zip (Firefox Add-ons)
# Gate the artifact, not just the config it was built from. A tag is the
# last point at which an unintended permission can still be stopped.
# Gate the artifacts, not just the config they were built from. A tag is
# the last point at which an unintended permission can still be stopped.
- run: npm run check:manifest
- run: npm run check:manifest -- --browser firefox
- name: Verify tag matches manifest version
- name: Verify tag matches both manifests
run: |
set -euo pipefail
MANIFEST_VERSION=$(jq -r '.version' .output/chrome-mv3/manifest.json)
TAG_VERSION="${GITHUB_REF_NAME#v}"
test "$MANIFEST_VERSION" = "$TAG_VERSION" \
|| { echo "::error::tag $TAG_VERSION != manifest $MANIFEST_VERSION"; exit 1; }
- name: SHA256SUMS
working-directory: .output
run: sha256sum *-chrome.zip > SHA256SUMS.txt
for target in chrome firefox; do
MANIFEST_VERSION=$(jq -r '.version' ".output/${target}-mv3/manifest.json")
test "$MANIFEST_VERSION" = "$TAG_VERSION" \
|| { echo "::error::tag $TAG_VERSION != $target manifest $MANIFEST_VERSION"; exit 1; }
done
# Staged in a plain directory: upload-artifact skips hidden paths by
# default, and `.output` is one. Left there, the upload found nothing and
# the first v1.1.0 tag run failed before any Release existed — the split
# into build and publish jobs had never run on a tag until then.
# default, and `.output` is one. Each file by its exact name: a glob would
# pass with one of the three missing.
- name: Stage the release files
run: |
set -euo pipefail
VERSION="${GITHUB_REF_NAME#v}"
mkdir dist
cp .output/*-chrome.zip .output/SHA256SUMS.txt dist/
for file in "bookmarkmagic-${VERSION}-chrome.zip" \
"bookmarkmagic-${VERSION}-firefox.zip" \
"bookmarkmagic-${VERSION}-sources.zip"; do
test -f ".output/$file" || { echo "::error::missing release file $file"; exit 1; }
cp ".output/$file" dist/
done
(cd dist && sha256sum bookmarkmagic-*.zip > SHA256SUMS.txt)
cat dist/SHA256SUMS.txt
- uses: actions/upload-artifact@v7
with:
@@ -101,9 +113,9 @@ jobs:
run: sha256sum -c SHA256SUMS.txt
# Idempotent on purpose. `gh release create` fails outright if a Release
# for the tag already exists, so any failure AFTER this step — realistically
# the store job below, once CWS_AUTOPUBLISH is on — used to strand the tag:
# re-running could not get past this line (docs/13 §7).
# for the tag already exists, so any failure AFTER this step — a store
# job, realistically — used to strand the tag: re-running could not get
# past this line (docs/13 §7).
- name: Create or update the Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -112,45 +124,177 @@ jobs:
set -euo pipefail
if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
echo "Release $GITHUB_REF_NAME exists — re-uploading assets."
gh release upload "$GITHUB_REF_NAME" dist/*-chrome.zip dist/SHA256SUMS.txt --clobber
gh release upload "$GITHUB_REF_NAME" dist/*.zip dist/SHA256SUMS.txt --clobber
else
gh release create "$GITHUB_REF_NAME" dist/*-chrome.zip dist/SHA256SUMS.txt \
gh release create "$GITHUB_REF_NAME" dist/*.zip dist/SHA256SUMS.txt \
--verify-tag --generate-notes
fi
store:
# v1.0.x/v1.1.x are published by hand (docs/12 §3). Flipping the repo
# variable CWS_AUTOPUBLISH to 'true' turns this on once the four CHROME_*
# secrets exist. A variable, not a secret: only variables are allowed here.
# --- Stores (docs/12 §3) -------------------------------------------------
#
# One job per store, so a store's credentials never share a runner with
# another's and one store refusing an upload does not stop the others. Each
# runs in a GitHub Environment that holds only its own secrets (give it the
# owner as required reviewer), is off until its repo VARIABLE is 'true' (a
# secret is not allowed in a job-level `if:`), and installs only
# tools/publish — publish-browser-extension and its three dependencies, from
# their own lockfile, scripts off — not the dev toolchain: a job's secrets
# are readable by everything on its runner. Never re-run a store job that
# succeeded: every store refuses a version number it has already seen.
# A sparse checkout of tools/publish still brings the repository's root files
# (cone mode), .nvmrc among them.
store-chrome:
name: Publish to Chrome Web Store
needs: publish
if: vars.CWS_AUTOPUBLISH == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
environment: chrome-web-store
permissions:
contents: read
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
sparse-checkout: tools/publish
- uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci --ignore-scripts
- run: npm ci --ignore-scripts --prefix tools/publish
- uses: actions/download-artifact@v8
with:
name: release-${{ github.ref_name }}
path: dist
- name: Submit the Release asset
# Against the SHA256SUMS.txt of the published Release — not the copy that
# travelled in the same artifact — and by exact name, so a missing file
# fails here rather than passing a check that skipped it.
- name: Check against the published checksums
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
set -euo pipefail
VERSION="${GITHUB_REF_NAME#v}"
gh release download "$GITHUB_REF_NAME" --pattern SHA256SUMS.txt --dir published
cd dist
for file in "bookmarkmagic-${VERSION}-chrome.zip"; do
grep -F " $file" ../published/SHA256SUMS.txt | sha256sum -c -
done
- name: Submit
env:
# API v2: v1.1 was shut down on 2026-10-15. Set explicitly — the tool
# still defaults to v1.1.
CHROME_API_VERSION: v2
CHROME_PUBLISHER_ID: ${{ secrets.CHROME_PUBLISHER_ID }}
CHROME_EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }}
CHROME_CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
CHROME_CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
CHROME_REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
# The locally installed wxt, never `npx wxt`: npx may fetch and run an
# unpinned package with these four secrets in its environment.
run: ./node_modules/.bin/wxt submit --chrome-zip dist/*-chrome.zip
CHROME_SERVICE_ACCOUNT_CLIENT_EMAIL: ${{ secrets.CHROME_SERVICE_ACCOUNT_CLIENT_EMAIL }}
CHROME_SERVICE_ACCOUNT_PRIVATE_KEY: ${{ secrets.CHROME_SERVICE_ACCOUNT_PRIVATE_KEY }}
run: |
set -euo pipefail
./tools/publish/node_modules/.bin/publish-extension \
--chrome-zip "dist/bookmarkmagic-${GITHUB_REF_NAME#v}-chrome.zip"
store-firefox:
name: Publish to Firefox Add-ons
needs: publish
if: vars.AMO_AUTOPUBLISH == 'true'
runs-on: ubuntu-latest
timeout-minutes: 30
environment: firefox-add-ons
permissions:
contents: read
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
sparse-checkout: tools/publish
- uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
- run: npm ci --ignore-scripts --prefix tools/publish
- uses: actions/download-artifact@v8
with:
name: release-${{ github.ref_name }}
path: dist
# Against the SHA256SUMS.txt of the published Release — not the copy that
# travelled in the same artifact — and by exact name, so a missing file
# fails here rather than passing a check that skipped it.
- name: Check against the published checksums
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
set -euo pipefail
VERSION="${GITHUB_REF_NAME#v}"
gh release download "$GITHUB_REF_NAME" --pattern SHA256SUMS.txt --dir published
cd dist
for file in "bookmarkmagic-${VERSION}-firefox.zip" "bookmarkmagic-${VERSION}-sources.zip"; do
grep -F " $file" ../published/SHA256SUMS.txt | sha256sum -c -
done
- name: Submit
env:
FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXTENSION_ID }}
FIREFOX_JWT_ISSUER: ${{ secrets.FIREFOX_JWT_ISSUER }}
FIREFOX_JWT_SECRET: ${{ secrets.FIREFOX_JWT_SECRET }}
FIREFOX_CHANNEL: listed
# Desktop only: Firefox for Android has no bookmarks API (docs/08 §9).
FIREFOX_COMPATIBILITY: firefox
run: |
set -euo pipefail
VERSION="${GITHUB_REF_NAME#v}"
./tools/publish/node_modules/.bin/publish-extension \
--firefox-zip "dist/bookmarkmagic-${VERSION}-firefox.zip" \
--firefox-sources-zip "dist/bookmarkmagic-${VERSION}-sources.zip"
store-edge:
name: Publish to Microsoft Edge Add-ons
needs: publish
if: vars.EDGE_AUTOPUBLISH == 'true'
runs-on: ubuntu-latest
timeout-minutes: 30
environment: edge-add-ons
permissions:
contents: read
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
sparse-checkout: tools/publish
- uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
- run: npm ci --ignore-scripts --prefix tools/publish
- uses: actions/download-artifact@v8
with:
name: release-${{ github.ref_name }}
path: dist
# Against the SHA256SUMS.txt of the published Release — not the copy that
# travelled in the same artifact — and by exact name, so a missing file
# fails here rather than passing a check that skipped it.
- name: Check against the published checksums
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
set -euo pipefail
VERSION="${GITHUB_REF_NAME#v}"
gh release download "$GITHUB_REF_NAME" --pattern SHA256SUMS.txt --dir published
cd dist
for file in "bookmarkmagic-${VERSION}-chrome.zip"; do
grep -F " $file" ../published/SHA256SUMS.txt | sha256sum -c -
done
- name: Submit
env:
# API v1.1 keys expire every 72 days (docs/12 §3).
EDGE_PRODUCT_ID: ${{ secrets.EDGE_PRODUCT_ID }}
EDGE_CLIENT_ID: ${{ secrets.EDGE_CLIENT_ID }}
EDGE_API_KEY: ${{ secrets.EDGE_API_KEY }}
run: |
set -euo pipefail
# Edge Add-ons takes the Chromium package unchanged (docs/08 §10).
./tools/publish/node_modules/.bin/publish-extension \
--edge-zip "dist/bookmarkmagic-${GITHUB_REF_NAME#v}-chrome.zip"
# A job INSIDE this workflow, not an `on: release: [published]` caller.
# A Release created by `gh release create` under the default GITHUB_TOKEN
@@ -172,7 +316,7 @@ jobs:
# `on: push: tags` — so without this the job exits 1 and never announces.
tag_override: ${{ github.ref_name }}
# Named, not `inherit`: the reusable is pinned to a moving branch, so it gets
# only the two webhooks it reads — never the CHROME_* or SONAR secrets. The
# only the two webhooks it reads — never the store or SONAR secrets. The
# names also differ: this repo stores RELEASES_WEBHOOK / REPO_WEBHOOK, while
# the reusable reads DISCORD_* — with `inherit` it received neither and would
# have failed on "No webhooks configured" the day DISCORD_ANNOUNCE was set.
+14 -7
View File
@@ -6,7 +6,7 @@ page zoomed, or with animation switched off. This file says what that means
today: what the goal is, what has actually been tested, what is known not to
work well yet, and how to tell us about a barrier.
**Last reviewed:** 2026-11-10, for version 1.2.1.
**Last reviewed:** 2026-11-18, for version 1.3.0.
## The goal
@@ -34,8 +34,10 @@ The priorities, in order:
|---|---|
| Chrome 136 or later on Windows | Supported, and where the testing below was done |
| Chrome 136 or later on macOS, Linux and ChromeOS | Supported; expected to work the same, not tested for accessibility |
| Edge, Brave, Vivaldi and Opera (the same build) | Best effort — the extension runs there, and accessibility is untested |
| Edge, Brave, Vivaldi and Opera (the same package as Chrome) | Best effort — the extension runs there, and accessibility is untested |
| Firefox 140 or later on the desktop (since 1.3.0, its own package) | Best effort — the extension runs there, and accessibility is untested |
| Chrome on Android or iOS | Not applicable: Chrome there does not run extensions |
| Firefox for Android | Not applicable: it has no bookmarks API for extensions |
## What is in place
@@ -132,8 +134,8 @@ limitations below).
| What 1.2.1 changed: focus, Alt+↑/↓, button sizes | A scripted keyboard run in Chrome — no screen reader | November 2026, version 1.2.1 |
| Colour contrast of the theme colours, reduced motion, the tree's key handling | Automated tests, on every change | Continuous |
**Not tested**, so we cannot tell you how well they work: anything on macOS,
Linux or ChromeOS; NVDA, JAWS, VoiceOver, ChromeVox and Orca; voice control
**Not tested**, so we cannot tell you how well they work: anything in Firefox
or Edge; anything on macOS, Linux or ChromeOS; NVDA, JAWS, VoiceOver, ChromeVox and Orca; voice control
(Dragon, Voice Access, Voice Control); switch access; screen magnifiers; and
zoom at 200 %. Narrator has not yet been run over what 1.2.1 added.
If you use one of these, a report of what you found — good or bad — is
@@ -158,6 +160,10 @@ These are known, and none of them is by design.
- **Reordering with a pointer needs a drag.** There is a keyboard way
(Alt+↑/↓) and Sort A→Z, but no click-only way to place one item before
another.
- **Separators in Firefox are only drawn.** A line in a Firefox folder is
shown in the tree, but a screen reader is not told it is there, and the
"position n of m" counts bookmarks and folders only — so Alt+↑ or Alt+↓ past
a separator moves the row without changing the position you hear.
- **Alt+↑/↓ may not reach the page on a Chromebook**, where the system can turn
those keys into Page Up and Page Down. On a Mac there is no Menu key (use
Shift+F10), and the laptop's delete key is Backspace, which the tree does
@@ -203,7 +209,8 @@ accessibility report is treated as a defect, not a feature request.
It helps to include:
- what you were trying to do, and what happened instead;
- the BookmarkMagic version (About tab, or `chrome://extensions`);
- the BookmarkMagic version (About tab, `chrome://extensions`, or
`about:addons` in Firefox);
- your browser and operating system;
- the assistive technology you use and its version, if any — a screen reader,
a contrast theme, zoom level, voice control;
@@ -224,8 +231,8 @@ guarantees:
- A report is acknowledged within about a week.
- A **blocking** barrier is fixed ahead of other work and shipped in its own
patch release; Chrome then updates installed copies by itself, usually
within days of the store's review.
patch release; your browser then updates installed copies by itself,
usually within days of the store's review.
- Anything else is scheduled, and added to the list above until it is fixed,
so the next person can see it is known.
- If a fix is not possible or not planned, you will be told why.
+63
View File
@@ -0,0 +1,63 @@
# Building BookmarkMagic from source
How to rebuild the packages attached to each
[GitHub Release](https://github.com/poli0981/bookmarkmagic/releases) — for
Firefox Add-ons reviewers, who must be able to reproduce the submitted package
from its sources, and for anyone who wants to check that a store build matches
this repository.
## Requirements
| Tool | Version | Where |
|---|---|---|
| Node.js | **26** (the version in `.nvmrc`; tested with 26.13) | <https://nodejs.org/en/download> |
| npm | the one bundled with Node.js 26 (11.x) | ships with Node.js |
| OS | any — Windows 11, macOS and Ubuntu all build the same files | |
No other tool, account, network service or environment variable is needed
beyond what `npm ci` installs from `package-lock.json`.
> **The Firefox sources archive omits dotfiles**, so `.nvmrc` and `.npmrc` are
> not in it. Use Node.js 26: an older Node may install but is not what the
> package was built with, and `package.json` says `"engines": { "node": ">=26" }`.
## Steps
```bash
npm ci # exactly the versions in package-lock.json
npm run zip:firefox # the Firefox package (and a sources archive)
npm run zip # the Chromium package (Chrome Web Store, Edge Add-ons)
```
`npm ci` runs one install script of this project's own, `wxt prepare`, which
generates the TypeScript configuration the build reads. (CI installs with
`--ignore-scripts` and runs `npx --no-install wxt prepare` itself; the result
is the same.)
## Output
| Command | Unpacked build | Package |
|---|---|---|
| `npm run zip:firefox` | `.output/firefox-mv3/` | `.output/bookmarkmagic-<version>-firefox.zip` |
| `npm run zip` | `.output/chrome-mv3/` | `.output/bookmarkmagic-<version>-chrome.zip` |
Compare the **files inside** the package with the submitted one, not the
archives themselves: a zip records file times, so two builds of the same
commit hash differently while every entry is identical (`docs/09 §5`).
## What the build does
- [WXT](https://wxt.dev) bundles `src/` with Vite into plain JavaScript, CSS
and HTML. The code is **minified, not obfuscated**.
- The only third-party code compiled in is the Svelte runtime, its `clsx`
helper and WXT's one-line browser shim, all MIT
([`legal/THIRD_PARTY_NOTICES.md`](legal/THIRD_PARTY_NOTICES.md)); the build
fails if anything else would ship.
- Nothing is downloaded at build time beyond `npm ci`, and the built extension
makes no network requests at all — its content security policy forbids them
([`docs/08_MV3_COMPLIANCE.md`](docs/08_MV3_COMPLIANCE.md) §3).
To check a build the way CI does: `npm run check:manifest` (Chromium) and
`npm run check:manifest -- --browser firefox` (Firefox) verify the manifest,
the permissions, the CSP, the file inventory and that no network API is in the
bundle.
+67 -2
View File
@@ -12,7 +12,71 @@ version bump).
## [Unreleased]
Nothing yet.
### Changed
- **About → Store listing** on a copy installed from Microsoft Edge Add-ons now
opens BookmarkMagic's Edge Add-ons page, live since 2026-11-19. Until now it
opened the install section of the project's README.
## [1.3.0] — 2026-11-18
Firefox and Microsoft Edge, and maintenance mode. Permissions are unchanged
(`bookmarks` and `storage`), nothing is asked of you again, and on Chrome
there is nothing to do — your browser updates itself. This version also
carries everything listed under 1.2.1, which never reached the Chrome Web
Store on its own.
### Added
- **Firefox** (desktop, 140 or later), with a package of its own for Firefox
Add-ons — listing to come. The same features, the same two permissions and
the same no-network policy, which Firefox enforces just as Chrome does.
Firefox's **Bookmarks Menu** is a root like the others: Merge and Replace put
entries back where they came from. Whatever a file leaves loose at its top
level goes into the menu, as Firefox's own import does — the menu itself in
a Firefox export, but also Other's and Mobile's contents in Chrome's own
HTML export, which Chrome writes loose. BookmarkMagic's exports and backups
name every root and are not affected.
- **Microsoft Edge Add-ons** — the Chrome package, unchanged; listing to come.
Until then Edge installs from the Chrome Web Store.
- **Firefox separators** show in the Edit tab as lines. Nothing acts on them:
they are not focused, searched, counted, sorted across, or offered as
duplicates of each other. Sort A→Z sorts each run between two separators on
its own.
- Replace on Firefox says how many separators it will delete — no file
BookmarkMagic writes can keep one, so they do not come back with the backup.
- An import says how many separators the file held, and on Firefox skips — and
counts — any address longer than the 65,536 characters Firefox accepts,
before anything is written.
### Changed
- The About tab's store link is now **"Store listing"** and opens the store
your copy came from: the Chrome Web Store for the Chrome Web Store's copy,
Firefox Add-ons in Firefox, and otherwise the README's list of stores.
- Sentences that blamed Chrome for what every browser does now say "the
browser" — "The browser does not let an extension set a bookmark's original
date" — in all five languages; the note about skipped Firefox smart
bookmarks no longer calls them dead links.
- Copy diagnostics names the browser and its version (`"browser": "Firefox
160"`) instead of only Chrome's.
- The project is in **maintenance mode** ([`MAINTENANCE.md`](MAINTENANCE.md)):
fixes, accessibility, translations, security and dependency updates, and
features that are already on the roadmap.
### Fixed
- Since 1.1.0, in a Chrome signed in with account bookmarks (Chrome 134 or
later), Replace's confirmation counted the account's own bar, Other and
Mobile among what it would delete. Replace has never touched them; the count
now covers exactly what it deletes.
### Packages
Each GitHub Release now carries three files: `…-chrome.zip` (the Chrome Web
Store and Edge Add-ons), `…-firefox.zip` and `…-sources.zip` (what Firefox
Add-ons reviews), with `SHA256SUMS.txt` over all three. [`BUILD.md`](BUILD.md)
explains how to rebuild them.
## [1.2.1] — 2026-11-10
@@ -293,7 +357,8 @@ from 2026-08-03.
- Parsing is bounded: 25 MB per file, 100 000 nodes, 200 levels of nesting.
- No network access of any kind at runtime, enforced by a grep gate in CI.
[Unreleased]: https://github.com/poli0981/bookmarkmagic/compare/v1.2.1...HEAD
[Unreleased]: https://github.com/poli0981/bookmarkmagic/compare/v1.3.0...HEAD
[1.3.0]: https://github.com/poli0981/bookmarkmagic/compare/v1.2.1...v1.3.0
[1.2.1]: https://github.com/poli0981/bookmarkmagic/compare/v1.2.0...v1.2.1
[1.2.0]: https://github.com/poli0981/bookmarkmagic/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/poli0981/bookmarkmagic/compare/v1.0.1...v1.1.0
+28 -3
View File
@@ -1,6 +1,7 @@
# CLAUDE.md — Build Instructions (BookmarkMagic)
A Chrome MV3 extension: offline bookmark import/export/edit.
A Chrome MV3 extension — and since v1.3.0 a Firefox one, and on Edge Add-ons —
for offline bookmark import/export/edit.
This file is the entry point; the `docs/` suite is the specification.
**When code and docs disagree, docs win — or stop and ask.**
@@ -10,7 +11,10 @@ This file is the entry point; the `docs/` suite is the specification.
> (v1.0.0 live by 2026-08-03; v1.0.1 live, confirmed on the listing
> 2026-10-28; v1.1.0 live, confirmed on the listing 2026-11-06; v1.2.0 live,
> confirmed on the listing 2026-11-10; v1.2.1 released on GitHub 2026-11-10,
> ⚠️ not yet submitted).
> never submitted on its own; v1.3.0 — Firefox and Edge, 1.2.1 included —
> released on GitHub and submitted to all three stores 2026-11-18, **live on
> Edge Add-ons and the Chrome Web Store 2026-11-19 and on Firefox Add-ons by
> 2026-11-21**).
> Phases 0–9 are complete; since 2026-11-18 the project is in **maintenance
> mode** — `/MAINTENANCE.md` is the policy (Phase 10 below).
> That changes the rules of the game:
@@ -41,7 +45,7 @@ This file is the entry point; the `docs/` suite is the specification.
| docs/05_ALGORITHMS.md | Parser walk, normalize, dedupe, diff, write queue |
| docs/06_UI.md | Tokens, layouts per tab, component inventory, a11y (§5 is the spec behind `/ACCESSIBILITY.md`) |
| docs/07_I18N.md | chrome.i18n vs runtime store split, EN/VI/JA rules |
| docs/08_MV3_COMPLIANCE.md | Manifest, permissions (bookmarks+storage ONLY), CWS rules |
| docs/08_MV3_COMPLIANCE.md | Manifest, permissions (bookmarks+storage ONLY), CWS rules; Firefox §9, Edge §10 |
| docs/09_SECURITY_PRIVACY.md | Threat model T1–T8, secure-coding bans |
| docs/10_CODING_STANDARDS.md | Size limits, tsconfig, biome.json, knip.json, conventions |
| docs/11_TESTING.md | Coverage gates, fixtures, suites, manual QA |
@@ -222,6 +226,27 @@ with a write token, for pull requests from forks.** It checks out the base
branch and only compares event text with constants. Never add a checkout of
the pull request's head, a step that runs its code, or a `${{ }}` of a title
or body inside a `run:` line to that file.
Two more, from the port. **There is no Firefox in CI**: the fake's Firefox
flavour (`11 §4`) is a reading of Firefox's source, not evidence, so a change
to roots, separators or move indices needs a real Firefox before an AMO
upload. And **every change now ships in two packages**: `verify:full` builds
and checks both (`build:firefox`, `check:manifest -- --browser firefox`), and a
string that names Chrome is false in one of them.
**Exit:** ✔ v1.3.0 tagged and released 2026-11-18 (signed tag on `80c7190`,
three checksum-verified packages; PR #44 merged at the reviewed head).
Human-only ⚠️ (`00 §10` items 19–26): the `11 §5` passes — Chrome with the
**1.2.0 → 1.3.0 upgrade over an existing profile**, a real Firefox 140+, Edge
signed in with sync on — then the Chrome Web Store upload of 1.3.0 in place
of 1.2.1, the first Firefox Add-ons version and the first Edge submission by
hand, the store environments if automation is wanted, and native review.
The three uploads went up 2026-11-18; Edge and the Chrome Web Store approved
2026-11-19, Firefox Add-ons by 2026-11-21 — 1.3.0 is on all three stores. **An Edge copy's About link is chosen
by its CRX ID** (`links.ts`), so the listing ids in `00 §9` are code, not
trivia. And **since 2026-11-19 a pushed `v*` tag is a store submission**:
every `*_AUTOPUBLISH` variable is `true`, and no store environment has a
required reviewer yet (`00 §10` item 23 has the state). Treat a tag as an
upload to users' browsers, and have the owner's go for that release before
pushing one.
## Working style
+38 -18
View File
@@ -8,13 +8,16 @@
[![Quality gate](https://sonarcloud.io/api/project_badges/measure?project=poli0981_bookmarkmagic&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=poli0981_bookmarkmagic)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=poli0981_bookmarkmagic&metric=coverage)](https://sonarcloud.io/summary/new_code?id=poli0981_bookmarkmagic)
[![Chrome Web Store](https://img.shields.io/chrome-web-store/v/eghnciphhegekmnofffpgbdfefckdhmg?label=Chrome%20Web%20Store)](https://chromewebstore.google.com/detail/bookmarkmagic/eghnciphhegekmnofffpgbdfefckdhmg)
[![Edge Add-ons](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fmicrosoftedge.microsoft.com%2Faddons%2Fgetproductdetailsbycrxid%2Fnchfchjnlihbifggooggpmmacighmdjg&query=%24.version&prefix=v&label=Edge%20Add-ons)](https://microsoftedge.microsoft.com/addons/detail/nchfchjnlihbifggooggpmmacighmdjg)
[![Firefox Add-ons](https://img.shields.io/amo/v/bookmarkmagic?label=Firefox%20Add-ons)](https://addons.mozilla.org/firefox/addon/bookmarkmagic/)
[![Runtime dependencies: 0](https://img.shields.io/badge/runtime%20dependencies-0-brightgreen.svg)](#privacy)
Move your bookmarks between browsers the simple way: with a file. No account,
no cloud sync, 100% offline.
A Chrome (MV3) extension for importing, exporting and editing bookmarks and
folder trees. English · Tiếng Việt · 日本語 · 简体中文 · Română.
A browser extension (Manifest V3) for importing, exporting and editing
bookmarks and folder trees — for Chrome and the other Chromium browsers, and,
since 1.3.0, for Firefox. English · Tiếng Việt · 日本語 · 简体中文 · Română.
## Project status
@@ -72,11 +75,11 @@ This is the whole point of the project, so it is worth being precise.
- **No network access at all.** Not analytics, not telemetry, not update pings.
There is no server, and the code makes no network calls. The browser backs
that up: the extension's content security policy makes Chrome refuse fetch,
XHR, WebSocket, EventSource and beacon requests, and remote images, fonts,
media and frames. On top of that, `npm run check:manifest` scans the shipped
bundle for network APIs (WebRTC included, which no CSP directive covers) and
`npm run guard` scans the source.
that up: the extension's content security policy — the same in Chrome, Edge
and Firefox — makes the browser refuse fetch, XHR, WebSocket, EventSource and
beacon requests, and remote images, fonts, media and frames. On top of that,
`npm run check:manifest` scans both shipped packages for network APIs (WebRTC
included, which no CSP directive covers) and `npm run guard` scans the source.
- **Exactly two permissions**: `bookmarks` and `storage`. No host permissions,
no content scripts, no background worker. Two gates enforce it: a unit test
over `wxt.config.ts`, and `npm run check:manifest`, which CI runs against the
@@ -98,28 +101,45 @@ Full policy: [`legal/PRIVACY.md`](legal/PRIVACY.md).
## Honest limitations
- Favicons cannot be imported — the bookmarks API has no favicon field.
- Imported bookmarks get today's date. Chrome does not let an extension set a
- Imported bookmarks get today's date. Browsers do not let an extension set a
bookmark's original creation date. Your **exported** files keep the real ones.
- **Firefox separators are not kept.** They show in the Edit tab as lines, but
no file BookmarkMagic writes can hold one: exports and backups leave them out,
imports skip the ones a file holds and say how many, and Replace — which
deletes them with everything else — tells you so before it starts.
- Firefox refuses bookmark addresses longer than 65,536 characters (they are
skipped, and counted) and shortens titles longer than 4,096.
- On Firefox, entries a file leaves loose at its top level go into the
**Bookmarks Menu**, where Firefox's own import puts them. For an HTML file
exported by Chrome itself, that means Chrome's Other and Mobile bookmarks;
BookmarkMagic's own exports name every root and land where they came from.
- CSV is a flattened view: empty folders and "which folder is the toolbar" are
not preserved. Use HTML or JSON for a faithful backup.
- Markdown is share-only — BookmarkMagic cannot read it back.
## Install
From the Chrome Web Store: [here](https://chromewebstore.google.com/detail/bookmarkmagic/eghnciphhegekmnofffpgbdfefckdhmg)
| Browser | Where | Requires |
|---|---|---|
| Chrome, Brave, Vivaldi, Opera | [Chrome Web Store](https://chromewebstore.google.com/detail/bookmarkmagic/eghnciphhegekmnofffpgbdfefckdhmg) | Chrome 136 or later (April 2025), or a Chromium browser of the same vintage |
| Microsoft Edge | [Edge Add-ons](https://microsoftedge.microsoft.com/addons/detail/nchfchjnlihbifggooggpmmacighmdjg) | Edge 136 or later |
| Firefox (desktop) | [Firefox Add-ons](https://addons.mozilla.org/firefox/addon/bookmarkmagic/) | Firefox 140 or later. Firefox for Android has no bookmarks API for extensions |
Requires Chrome 136 or later (April 2025), or any Chromium browser of the same
vintage — Edge, Brave, Vivaldi, Opera. On an older browser the store keeps the
version you already have and simply stops updating it.
On an older browser the store keeps the version you already have and simply
stops updating it.
From source (Node.js 26):
Each [GitHub Release](https://github.com/poli0981/bookmarkmagic/releases) carries
the exact packages sent to the stores, with `SHA256SUMS.txt`. Firefox only
installs add-ons Mozilla has signed, so its `-firefox.zip` there is for
checking the store build, not for installing.
From source (Node.js 26) — [`BUILD.md`](BUILD.md) has the details:
```bash
npm ci && npm run build
npm ci && npm run build # Chromium: load .output/chrome-mv3/ at chrome://extensions (Developer mode)
npm run build:firefox # Firefox: about:debugging → Load Temporary Add-on → .output/firefox-mv3/manifest.json
```
Then load `.output/chrome-mv3/` at `chrome://extensions` with Developer mode on.
## Development
```bash
@@ -205,5 +225,5 @@ questions: copyright@poli0981.dev.
The BookmarkMagic name and icon identify this project. The GPL lets anyone fork
the code; it does not let a fork present itself as this project.
Not affiliated with or endorsed by Google, Chrome, Mozilla, Firefox or any
browser vendor. Browser names are trademarks of their respective owners.
Not affiliated with or endorsed by Google, Chrome, Mozilla, Firefox,
Microsoft, Edge or any browser vendor. Browser names are trademarks of their respective owners.
+4 -4
View File
@@ -4,13 +4,13 @@
| Version | Supported |
|---|---|
| The latest version published on the Chrome Web Store | ✅ |
| The latest version published on the Chrome Web Store, Firefox Add-ons or Microsoft Edge Add-ons | ✅ |
| Anything older | ❌ |
There is no back-porting, and there is nothing for you to do to stay current:
Chrome auto-updates extensions once a new version passes store review. You can
see which version you are running in the extension's **About** tab, or on
`chrome://extensions`.
your browser updates extensions once a new version passes store review. You
can see which version you are running in the extension's **About** tab, on
`chrome://extensions`, or on `about:addons` in Firefox.
## Reporting a vulnerability
+100 -10
View File
@@ -1,7 +1,9 @@
# 00 — Project Overview
> **Project:** BookmarkMagic
> **Type:** Chrome/Chromium MV3 browser extension (open source, Chrome Web Store)
> **Type:** MV3 browser extension for Chromium browsers and, since v1.3.0,
> Firefox (open source; on the Chrome Web Store, and since v1.3.0 on Microsoft
> Edge Add-ons and Firefox Add-ons too)
> **Owner:** poli0981 (GitHub) / SkullMute
> **Repo:** `poli0981/bookmarkmagic` ✔
> **License:** GPL-3.0-or-later
@@ -24,14 +26,28 @@
>
> **v1.2.0 is PUBLISHED.** Tagged and released 2026-11-06 (signed tag on
> `e2f36bc`); the listing was observed showing **version 1.2.0** (`Updated:
> November 7, 2026`, 5 languages) on 2026-11-10. Installed users are on 1.2.0.
> November 7, 2026`, 5 languages) on 2026-11-10. It was the store's version
> until 1.3.0 replaced it on 2026-11-19.
>
> **v1.2.1 — accessibility — is RELEASED on GitHub, not yet on the store.**
> Tagged and released 2026-11-10 (signed tag on `d61318a`, checksum-verified
> zip): an accessibility statement (`/ACCESSIBILITY.md`) and the fixes an
> audit found (`06 §5`). ⚠️ It still needs the owner's manual pass, including
> the 1.2.0 → 1.2.1 upgrade over an existing profile, and a hand upload to
> the store (`13 §1b`); until it clears review, installed users stay on 1.2.0.
> **v1.2.1 — accessibility — is RELEASED on GitHub, never on a store on its
> own.** Tagged and released 2026-11-10 (signed tag on `d61318a`,
> checksum-verified zip): an accessibility statement (`/ACCESSIBILITY.md`) and
> the fixes an audit found (`06 §5`). 1.3.0 carries all of it and went to the
> Chrome Web Store in its place (submitted 2026-11-18, live 2026-11-19).
>
> **v1.3.0 — Firefox and Edge — is RELEASED, and LIVE on all three stores.**
> Tagged and released 2026-11-18 (signed tag on
> `80c7190`, three checksum-verified packages): a Firefox package (desktop,
> 140 or later), and the Chrome package for Edge Add-ons as well, with 1.2.1
> inside. The owner submitted it to all three stores on 2026-11-18. **Edge
> Add-ons approved it on 2026-11-19** — the first Edge version, live in five
> languages (§9 has the listing). **The Chrome Web Store approved it the same
> day**: the listing shows version 1.3.0 (`Updated: November 19, 2026`, 4
> users), so installed Chrome users move from 1.2.0 to 1.3.0 by themselves.
> **Firefox Add-ons approved it too.** The owner reported it on 2026-11-21,
> and the public listing then showed version 1.3.0 for Firefox 140 or later,
> desktop only. It is the first Firefox version (§9 has the listing; §10
> item 21 has what its listing still gets wrong).
>
> The project is now in **maintenance**, not construction: every change from
> here reaches installed users through a store review, so it needs a version
@@ -43,7 +59,7 @@
> upgrades, bug/UI/UX/accessibility/translation fixes, and features only when
> they are on `15`'s roadmap or genuinely needed; requests for anything else
> are closed by `triage.yml` (`12 §2.6`).
> **Doc suite version:** 1.12 (2026-11-18 — maintenance mode)
> **Doc suite version:** 1.13 (2026-11-18 — Firefox and Edge, v1.3.0)
---
@@ -126,6 +142,12 @@ v1.0's scope):
- A redesigned UI with a self-drawn icon set, all motion behind
`prefers-reduced-motion` (`06`).
**v1.3.0 adds** two stores: **Firefox Add-ons** (its own package from the same
source — the Bookmarks Menu as a fourth root, separators shown and protected,
Firefox's own move-index rule, `02 §4`, `03`) and **Microsoft Edge Add-ons**
(the Chromium package, unchanged). Release automation for all three stores,
each off until its owner switches it on (`12 §3`).
**v1.2.0 adds** two UI languages, chosen from the CWS dashboard's install and
usage figures: **Simplified Chinese (`zh-CN`) and Romanian (`ro`)** — in the
app, in the manifest and in the store listing (`07`). Traditional Chinese is
@@ -177,6 +199,11 @@ Derived identifiers (canonical across docs and code):
| Safety-backup filename | `bookmarkmagic-backup-YYYYMMDD-HHmm.json` |
| Chrome Web Store item id | `eghnciphhegekmnofffpgbdfefckdhmg` (also the value `CHROME_EXTENSION_ID` needs — `12 §3`) |
| Store listing URL | `https://chromewebstore.google.com/detail/bookmarkmagic/eghnciphhegekmnofffpgbdfefckdhmg` |
| Edge Add-ons item id ("CRX ID") | `nchfchjnlihbifggooggpmmacighmdjg` — the `runtime.id` of an install from Edge Add-ons, mapped in `links.ts` (`06 §3.5`) |
| Edge Add-ons Product ID | `3bf2e086-99ee-4f8b-a8db-e13827f04ca1` (the value `EDGE_PRODUCT_ID` needs — `12 §3`) · Store ID `0RDCKC9LZ41P` |
| Edge Add-ons listing URL | `https://microsoftedge.microsoft.com/addons/detail/nchfchjnlihbifggooggpmmacighmdjg` (live 2026-11-19) |
| Firefox Add-ons id | gecko id `bookmarkmagic@poli0981.dev` (permanent; also the value `FIREFOX_EXTENSION_ID` needs — `12 §3`) · slug `bookmarkmagic` |
| Firefox Add-ons listing URL | `https://addons.mozilla.org/firefox/addon/bookmarkmagic/` (public by 2026-11-21). The About link uses the gecko-id form, which AMO resolves too (`links.ts`) |
## 10. Manual action items (human-only) ⚠️
@@ -222,7 +249,10 @@ Derived identifiers (canonical across docs and code):
the four is already known — `CHROME_EXTENSION_ID` is the item id in §9. The
other three come from `npx wxt submit init` (`12 §3`). Note there is no
dry-run: the first time that step executes it makes a real submission.
7. **Untested:** `npm run dev:firefox`. No gate exercises it (Firefox is a
7. ~~**Untested:** `npm run dev:firefox`.~~ Since v1.3.0 the Firefox package is
built and checked by CI and the release (`12 §2.1`, `12 §2.3`) and its logic
is tested against a Firefox-shaped fake (`11 §4`). Still ⚠️: nothing has run
it in a real Firefox until the owner's `11 §5` pass. Historical text: No gate exercises it (Firefox is a
non-goal, §7). The `overrides` block that used to threaten it is gone
(`09 §3.1`), but do not assume it works.
8. **Unmeasured:** the 2 s parse budget on a real browser (`11 §6`). The
@@ -279,6 +309,66 @@ Derived identifiers (canonical across docs and code):
18. ⚠️ **Native review of the new strings** — the About link label and the
spoken position — in JA, ZH-CN and RO, with the passes in items 9 and 13.
### v1.3.0 — maintenance mode, Firefox and Edge (added 2026-11-18)
19. ⚠️ **Pin the maintenance announcement** (Discussions #43) — the API cannot.
20. ✔ **v1.3.0 to the Chrome Web Store** instead of 1.2.1, which never went
up — submitted 2026-11-18, **live 2026-11-19** (the listing shows version
1.3.0). The CWS listing text may keep its Chrome wording; it is the
Chrome store. ⚠️ Still open: the `11 §5` pass with the **1.2.0 → 1.3.0
upgrade over an existing profile** has no recorded result — installed
users are taking that upgrade now — and neither has `13 §1b` step 10, the
published build on a clean profile.
21. ✔ **The first Firefox Add-ons version, by hand** (`13 §8`) — submitted
2026-11-18, **approved and public by 2026-11-21** (§9). That was the
Firefox package **and** the sources archive, desktop only, with
`BUILD.md` in the notes to reviewers. AMO's validator, the first outside
check of the package, reported 0 errors and 2 warnings (read them in the
Developer Hub).
⚠️ Still open:
- The listing says **"GNU General Public License v3.0 only"**
(`GPL-3.0-only`, per AMO's API) where the code is
`GPL-3.0-or-later`. AMO offers both; pick "or later", at the latest
with the next version.
- The support site is empty; it should be the repository's issues
(`13 §8`).
- The `11 §5` Firefox section on a real Firefox 140+ has no recorded
result.
22. ✔ **The first Edge Add-ons submission, by hand** (`13 §9`) — submitted
2026-11-18, **approved and live 2026-11-19** (§9). Partner Center flagged
the first description for naming another browser; the Edge copy now names
none (PR #47, `08 §10`). ⚠️ Still open: the `11 §5` Edge items have no
recorded result — above all a profile **signed in with sync on**
(`08 §10`, unverified). An Edge user who meets `NO_WRITABLE_ROOTS` would be
the first sign.
23. ⚠️ **Store automation, when wanted** (`12 §3`): the three environments,
each with a required reviewer, deployments limited to `v*` tags, and its
secrets (Chrome: API v2 service
account; AMO: JWT pair; Edge: API key + Client ID, renewed every 72 days),
then the `*_AUTOPUBLISH` variables.
**State on 2026-11-19, unchanged when re-checked 2026-11-21:** all three
`*_AUTOPUBLISH` variables are `true`,
so **a pushed `v*` tag is now a store submission**.
- `chrome-web-store` and `edge-add-ons` exist, with their secrets and the
`v*` tag rule, but ⚠️ with **no required reviewer**. A tag therefore
uploads to both stores with no approval step.
- ⚠️ `firefox-add-ons` does not exist and has no secrets. The next tag's
`store-firefox` job would fail, and GitHub would create the environment
with no rules. Until the JWT pair is in place, either create the
environment with its secrets or set `AMO_AUTOPUBLISH` to `false`.
24. ✔ **After the listings go live**: their URLs for the README and the
About link (`06 §3.5` — Edge's needs its listing id), and the AMO/Edge
badges. **Edge ✔ 2026-11-19**: README install table and badge, and the
About link's mapping (ships with the next release — CHANGELOG
`[Unreleased]`). **AMO ✔ 2026-11-21**: README install row and badge. Its
About link has been the gecko-id URL since 1.3.0, and that URL resolves
(checked: 200).
25. ⚠️ **Evidence for the Firefox fake** (`11 §4`): a sanitized `getTree()`
dump from a real Firefox 140+ profile, committed as a fixture the fake is
checked against; and a Firefox column in `11 §6`'s parse timing.
26. ⚠️ **Native review** of the strings 1.3.0 added or changed (`07`) in JA,
ZH-CN and RO, and of the store-listing blocks for AMO and Edge.
## 11. Reading order
For humans: this file → `15_ROADMAP.md` → the rest as needed.
+7 -4
View File
@@ -10,7 +10,8 @@
| Item | Choice | Rationale |
|---|---|---|
| Browser | Chrome / Chromium, **Manifest V3** | MV2 is fully retired. Edge/Brave/Vivaldi/Opera work from the same build. |
| Browser | Chrome / Chromium, **Manifest V3** — and since v1.3.0 **Firefox**, MV3 too | MV2 is fully retired. Edge/Brave/Vivaldi/Opera run the Chromium package; Edge Add-ons publishes that same package (`08 §10`). Firefox gets its own package from the same source (`wxt build -b firefox`, MV3 forced by `manifestVersion: 3`, `08 §9`). |
| Min Firefox | `strict_min_version: "140.0"` (since v1.3.0) | The first Firefox that accepts `data_collection_permissions`, which AMO requires of new extensions; every ES2025 built-in is older (134). Vite targets `firefox140` for that package. Desktop only — Firefox for Android has no `bookmarks` API. |
| Min Chrome | `minimum_chrome_version: "136"` (was `"120"` through v1.0.1) | The ES2025 floor: 136 is the first Chrome with every ES2025 built-in (`RegExp.escape` 136, `Float16Array` 135, `Promise.try` 128, iterator helpers and Set methods 122). The manifest floor, Vite's `build.target` (`chrome136`) and tsconfig's `lib: ["ES2025", …]` are one number stated three times — `wxt.config.ts` derives two of them from `CHROME_FLOOR`, and `tests/unit/manifest.test.ts` pins all three. Users on Chrome 120–135 keep the version they have and stop receiving updates; nothing is uninstalled. `scheduler.yield()` (129+) is now always present, though the write queue keeps its fallback because the test environment has no `scheduler`. |
| Runtime deps | **0 (zero)** | `DOMParser`, `Blob`, `URL`, `showSaveFilePicker` and `navigator.clipboard` cover all needs. "Zero" means no npm `dependencies`: the compiled Svelte runtime still ships inside the bundle — see `legal/THIRD_PARTY_NOTICES.md`. |
@@ -29,7 +30,7 @@
| svelte-check | ^4.7.8 | Type/template authority for `.svelte` files. Runs on the TS 6 API (see TypeScript above). |
| **@types/node** | **^26** (matches the Node major) | Types for `node:fs`, `node:path`, `node:child_process` and `process`, which the test suite and `scripts/*.mjs` genuinely use. **Declared explicitly since 2026-08-03** — it used to arrive transitively, and WXT 0.21 stopped providing it. Types only: erased at build, so hard rule 2 (zero *runtime* dependencies) is untouched. |
| jsdom | **^31.0** (was ^30 through v1.2.1, ^29 through v1.0.0) | Test DOM. Not interchangeable — `02 §3` picks jsdom over happy-dom because the Netscape walk depends on parse5's implied-end-tag behaviour. A major bump runs `tests/unit/dom-environment.test.ts` first; if that canary fails, pin rather than loosen the test. |
| **Knip** | **^6** (6.44.2 as of 2026-11-18) | Dead code: unused files, exports, dependencies. Requires Node ≥ 20.19. v6 swapped the TypeScript backend for oxc-parser — confirm `compilers.svelte` is still the supported `.svelte` hook before scaffold (`10 §4`). |
| **Knip** | **^6** (6.45.1 as of 2026-11-18) | Dead code: unused files, exports, dependencies. Requires Node ≥ 20.19. v6 swapped the TypeScript backend for oxc-parser — confirm `compilers.svelte` is still the supported `.svelte` hook before scaffold (`10 §4`). |
| **Vitest** | **^5.1.0** (was ^4 through v1.0.1) | Unit tests. 5.0 changed `clearMocks` to default `true`, requires `vi.mock` at top level and fails unawaited async assertions; the suite needed no changes. Requires Node ≥ 22.12. |
| @vitest/coverage-v8 | match Vitest | Coverage reporting (`text` + `lcov` for SonarCloud, `12 §2.5`). |
@@ -60,7 +61,9 @@
"scripts": {
"postinstall": "wxt prepare", // generates .wxt/tsconfig.json — 10 §2 extends it
"dev": "wxt",
"dev:firefox": "wxt -b firefox", // build sanity only, no store release
"dev:firefox": "wxt -b firefox", // MV3 since v1.3.0 (manifestVersion: 3)
"build:firefox": "wxt build -b firefox", // .output/firefox-mv3
"zip:firefox": "wxt zip -b firefox", // the AMO package + its sources archive
"build": "wxt build",
"zip": "wxt zip",
"check": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings && tsc --noEmit && tsc -p tsconfig.scripts.json",
@@ -76,7 +79,7 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"verify": "npm run lint && npm run check && npm run knip && npm run guard && npm run check:licenses && npm run test",
"verify:full": "npm run verify && npm run coverage && npm run build && npm run check:manifest"
"verify:full": "npm run verify && npm run coverage && npm run build && npm run check:manifest && npm run build:firefox && npm run check:manifest -- --browser firefox"
}
}
```
+31 -4
View File
@@ -103,6 +103,8 @@ bookmarkmagic/
│ │ │ └── limits.ts # MAX_FILE_BYTES, MAX_NODES, MAX_DEPTH, LEGAL_VERSION
│ │ ├── browser/
│ │ │ ├── bookmarks.ts # getTree/create/move/update/remove wrappers
│ │ │ ├── roots.ts # getRoots: which live folders are the roots (§4)
│ │ │ ├── live-tree.ts # live → file model; separators, counts, move index (§4)
│ │ │ ├── write-queue.ts # sequential tree writer + progress + abort
│ │ │ ├── storage.ts # typed settings/legal accessors
│ │ │ ├── download.ts # Blob → <a download>
@@ -174,7 +176,7 @@ export interface BookmarkNode {
addDate?: number; // epoch SECONDS (normalized, see timestamps.ts)
lastModified?: number; // epoch SECONDS
toolbar?: boolean; // Netscape PERSONAL_TOOLBAR_FOLDER
root?: 'other' | 'mobile'; // folder IS that browser root (since v1.1.0; toolbar wins)
root?: 'other' | 'mobile' | 'menu'; // folder IS that browser root (since v1.1.0; 'menu' since v1.3.0; toolbar wins)
children?: BookmarkNode[];
}
@@ -220,7 +222,7 @@ Segment construction per mode — spelled out so it is not left to interpretatio
| Mode | Segments |
|---|---|
| `new-folder` | Exactly one. `parentId` = Other Bookmarks; `nodes` = the single `Imported <date>` wrapper folder containing the whole parsed tree, root folders included. Markers are informational only (`03 §1`). |
| `merge` | Top-level nodes are routed first (`core/route.ts`, `03 §1` step 7): a `toolbar` folder's children → the bar; a `root: "other"` folder's children → Other, in its place in the order; a `root: "mobile"` folder's children → Mobile (an ordinary folder under Other when the profile has no Mobile root); everything else → Other. Each root's list is then matched against that root's live children (`core/merge.ts`, `05 §5`): a folder with the exact title of a writable live child folder is **reused** — not created — and its children are matched one level down; everything else becomes a node in the segment of the live folder it lands in. One segment per live folder that receives anything, in first-use order. |
| `merge` | Top-level nodes are routed first (`core/route.ts`, `03 §1` step 7): a `toolbar` folder's children → the bar; a `root: "other"` folder's children → Other, in its place in the order; a `root: "mobile"` folder's children → Mobile (an ordinary folder under Other when the profile has no Mobile root); a `root: "menu"` folder's children → the Bookmarks Menu (an ordinary folder under Other where there is none — every Chromium browser); everything else → the Bookmarks Menu where the browser has one (Firefox — what Firefox's own HTML import does with loose entries), else Other. Each root's list is then matched against that root's live children (`core/merge.ts`, `05 §5`): a folder with the exact title of a writable live child folder is **reused** — not created — and its children are matched one level down; everything else becomes a node in the segment of the live folder it lands in. One segment per live folder that receives anything, in first-use order. |
| `replace` | As `merge`, but planned against **emptied** roots, so nothing matches and every node is created. |
A root nothing is bound for gets no segment. `stats.toCreate` is the total
@@ -229,7 +231,23 @@ one `done` counter for the whole import (`05 §6`). Every node is accounted for:
`toCreate + reusedFolders + unwrapped root folders` equals the deduped tree
(asserted over 200 random trees in `merge.test.ts`).
Chrome root mapping: `browser/bookmarks.ts` `getRoots()` resolves the three
**Firefox (since v1.3.0).** Firefox has no `folderType`, its roots are GUIDs —
`menu________`, `toolbar_____`, `unfiled_____`, `mobile______`, in that order —
and it has a fourth root Chromium lacks, the **Bookmarks Menu**. `getRoots()`
tries those GUIDs after the Chromium ids and before position, so the position
fallback (which on Firefox would take the Menu for the bar) is never reached,
and returns the Menu as a fourth destination that Replace also empties. The
position fallback itself never takes the Menu either: it is left out of the
candidates, so roots with unknown ids still map the bar, Other and Mobile
(tested with hand-built roots in `bookmarks.test.ts` — neither fake reaches
that path).
**Separators** exist only in Firefox's live tree: `type: "separator"` and, for
historical reasons, `url: "data:"`. They are recognised by `type`, never by
the url; `toBookmarkNodes` drops them, so the file model never holds one, and
`#edit` shows them as lines no command can touch (`03 §3`). Counting helpers
in `browser/live-tree.ts` keep them out of every bookmark count.
Chrome root mapping: `browser/roots.ts` `getRoots()` resolves the three
destinations by `folderType` (`bookmarks-bar`, `other`, `mobile`, Chrome
134+), among this device's roots only — a signed-in account's own roots
(`syncing: true`, Chrome 134+) are listed but never written to or emptied.
@@ -240,6 +258,11 @@ that fails do Mobile-marked folders land under Other. Segment `parentId`s
always come from that resolution or from live folders found in the same read,
never a literal — but tests may rely on the ids.
**Address length inside the browser.** Firefox refuses an address longer than
65 536 characters (and shortens titles past 4 096). The import drops such
addresses before planning, as `URL_TOO_LONG`, using a limit the browser layer
passes in — Chromium has none, so nothing changes there (`03 §1`).
**Depth inside the browser** is capped separately from the parse cap:
`MAX_WRITE_DEPTH` (90 levels below a root). Chrome stores its bookmarks as JSON
it reads back with a 200-level nesting limit, two levels per folder, so a tree
@@ -318,7 +341,11 @@ the hash for a new tab, or via the broadcast for an open one.
`NEWER_VERSION`, `EMPTY_TITLE`, and since v1.1.0 `INVALID_URL` (an address
`chrome.bookmarks.create` would reject), `PLACE_QUERIES_SKIPPED` (Firefox smart
bookmarks), `EXTRA_ROOTS_SKIPPED` (vendor roots in a browser JSON file) and
`UNREADABLE_ENTRIES` (a `<DT>` with no readable `<A>` or `<H3>`).
`UNREADABLE_ENTRIES` (a `<DT>` with no readable `<A>` or `<H3>`), and since
v1.3.0 `SEPARATORS_SKIPPED` (separators an HTML file or a Firefox backup
holds — no format keeps one) and `URL_TOO_LONG` (an address longer than the
browser accepts, 65 536 characters in Firefox — added by the import from
the browser layer's limit, not by a parser).
- `browser/` adds `BmBackupError { code }` for the forced safety backup
(`03 §1` step 6b) — `BACKUP_SERIALIZE_FAILED`, `BACKUP_EXCEEDS_LIMITS` (since
v1.1.0: the backup would be refused by the import's own caps, so it is no
+47 -4
View File
@@ -45,7 +45,15 @@
- Steps 1–7 touch nothing in the browser. The first write happens at step 8.
- Replace = delete children of Bookmarks Bar + Other Bookmarks (+ Mobile if
present), then write. Roots themselves are never deleted (API forbids it).
present, + the Bookmarks Menu on Firefox), then write. Roots themselves are
never deleted (API forbids it). On Firefox the deletion includes the
**separators** in those roots, and nothing restores them — no format
BookmarkMagic writes keeps one — so the confirmation says how many will go
(`import.replaceSeparators`, shown only when there are any). The counts in
that confirmation never include separators among the bookmarks, and they
cover exactly what Replace deletes: the roots it empties, never a signed-in
Chrome account's own roots (`syncing: true`, `02 §4`), which it leaves
alone (fixed in v1.3.0 — they used to be counted).
- **Root routing** (`core/route.ts`), top-level nodes only — deeper, markers
are data. A folder that *is* a browser root is **unwrapped**: its children go
into that root and the folder itself is never written.
@@ -55,7 +63,18 @@
the order;
- `root: "mobile"` folder → its children into Mobile Bookmarks; a profile
with no Mobile root keeps it as an ordinary folder under Other;
- everything else → Other Bookmarks.
- `root: "menu"` folder (since v1.3.0) → its children into Firefox's
Bookmarks Menu; every Chromium browser, which has no menu root, keeps it
as an ordinary folder under Other;
- everything else → the **Bookmarks Menu on Firefox**, Other Bookmarks
everywhere else. Firefox's own HTML export leaves the menu's contents loose
at the top level, and Firefox's own import puts loose entries back into
the menu; doing the same is what makes a Firefox file round-trip in
Firefox. It also means a **Chrome** HTML export's Other and Mobile
contents, which Chrome writes loose (`04 §1.2`), land in the Menu in
Firefox — as they do with Firefox's own import. BookmarkMagic's exports
mark every root, so they are not affected. New-folder mode is not routing and stays the same on every
browser: `Other Bookmarks/Imported <date>/…`.
The markers come from our own exports and backups (`04 §1.1`, §2), from
Firefox's HTML export (`UNFILED_BOOKMARKS_FOLDER`), and from the two browser
@@ -65,6 +84,13 @@
the whole tree, root folders included, goes under
`Other Bookmarks/Imported <date>/…` (markers recorded in the preview as
informational).
- **What Firefox refuses is dropped before planning** (since v1.3.0): an
address longer than 65 536 characters (`URL_TOO_LONG`, counted; the limit
comes from the browser layer, and Chromium has none). Firefox also shortens
titles past 4 096 characters on its own; that is a documented limit, not a
warning. Separators a file holds — `<HR>` in HTML, separator entries in a
Firefox JSON backup — are counted as `SEPARATORS_SKIPPED`: the file model has
no separator, on any browser.
- **Merge reuses folders** (`core/merge.ts`, `05 §5`). Below each destination
root, a file folder with the exact, case-sensitive title of a writable child
folder of the live folder its parent matched is reused — never created,
@@ -193,14 +219,31 @@ tree key was ignored.
| Move | drag & drop onto a row — before, after or into (`planDrop`, `05 §10`) → `bookmarks.move(id, { parentId, index })`, or `{ parentId }` alone into a folder; "Move to…" (row button, menu key / Shift+F10) → modal folder list with a filter → `bookmarks.move(id, { parentId })`, appended; **Alt+↑ / Alt+↓** on the tree (since v1.2.1) → `nudgeTarget` picks the sibling shown above or below, then the same `planDrop` (before / after) and the same `moveTo` as a drag — no second write path. One move at a time. The command reports the row's new place among the siblings on screen — the same "n of m" as its `aria-posinset` — which the tab speaks (`06 §5`) |
| Delete | Del or the row button → confirm dialog (folder shows descendant count) → `removeTree` / `remove`; when the deleted row had focus, focus moves to the next row, else the previous. A copy deleted from the duplicate panel leaves the tree's focus where it was |
| New folder | toolbar button → `bookmarks.create({ parentId, title })` in the focused folder, beside a focused bookmark, else in the first writable root → inserted at once unless its live event got there first (Chrome fires `onCreated` before `create` resolves, so either may win), a search that would hide it cleared, and every folder above it opened as the user's own — so clearing the search cannot close them again → inline rename |
| Sort A→Z | toolbar (the focused folder, or the focused bookmark's folder) or a folder row's button → `planSort` (`05 §10`) → confirm stating how many items move → one awaited `bookmarks.move(id, { parentId, index })` per planned move, yielding every 25, under the write lock (§5). Refused part-way → "moved d of t" and a re-read: there is no undo |
| Sort A→Z | toolbar (the focused folder, or the focused bookmark's folder) or a folder row's button → `planSort` (`05 §10`; on Firefox each run between two separators is sorted on its own, and separators stay where they are) → confirm stating how many items move → one awaited `bookmarks.move(id, { parentId, index })` per planned move, yielding every 25, under the write lock (§5). Refused part-way → "moved d of t" and a re-read: there is no undo |
| Open bookmark | Enter, double-click, or the row's Open button → `tabs.create({ url })` for `http:`/`https:` only (`09` T3); anything else is refused with a toast |
| Copy link | the row button, or Ctrl/⌘+C on the focused row → `navigator.clipboard.writeText` (`09` T8) |
| Duplicate finder | toolbar toggles the panel → groups by normalized URL, computed **only while the panel or its confirmation is showing**, policy-managed copies left out (the browser refuses to delete them) → per-copy delete, or "keep first in each group" (confirm with the exact count) under the write lock; stopped part-way → "deleted d of t" and a re-read |
**Separators (Firefox, since v1.3.0)** are rows of their own in the tree: a
line at the depth of its siblings, outside the accessibility tree
(`aria-hidden`), never focused, matched, counted, opened, renamed, deleted,
dragged or dropped into — and never offered as a duplicate of each other,
which their shared `data:` address would otherwise make them. They are still
siblings, so positions stay the browser's: a drag lands where it was dropped,
and Alt+↑ above a separator moves the row past it, one place.
**The move index is the browser's own rule.** `planDrop` computes a target
twice (`05 §10`): Chromium's `bookmarks.move` counts a move to the right as if
the node were still in place (`position.api`), Firefox's counts after removing
it (`position.local`). The adapter sends the one its browser expects, and the
move's own reply (the node's new `index`) is checked against `position.local`:
a mismatch re-reads the tree rather than leave it disagreeing with the browser.
**Live sync** (`edit/live-sync.ts`, `05 §11`). `#edit` subscribes on enter and
unsubscribes on leave: `bookmarks.onCreated/onRemoved/onChanged/onMoved`, plus
`onChildrenReordered` and Chrome's own importer's `onImportBegan/onImportEnded`.
`onChildrenReordered` and Chrome's own importer's `onImportBegan/onImportEnded`
where the browser has them (Firefox has neither; its own sort and import send
one `onMoved`/`onCreated` per node, which the burst rule below absorbs).
Events are queued and applied together **once per animation frame**, in arrival
order. An import running in another tab sends one `onCreated` per node — 1.0.x
patched the tree, and rescanned it for duplicates, on every one — so past 500
+29 -7
View File
@@ -84,6 +84,19 @@ winning:
| Bookmarks Bar | `PERSONAL_TOOLBAR_FOLDER="true"` | every browser |
| Other Bookmarks | `UNFILED_BOOKMARKS_FOLDER="true"` | Firefox (its own exporter writes it), and us |
| Mobile Bookmarks | `MOBILE_BOOKMARKS_FOLDER="true"` | us — importers ignore attributes they do not know |
| Bookmarks Menu (Firefox) | *none* — its contents are written **loose at the top level** | every browser, the way Firefox's own exporter writes it (since v1.3.0) |
The Bookmarks Menu has no attribute of its own in Firefox's format: Firefox
exports the menu's entries as the file's top level and imports loose
top-level entries back into the menu. A BM JSON `root: "menu"` folder (§2)
is therefore written to HTML by unwrapping it — its children appear at the
top level, before the marked roots — and reading that file in Firefox puts
them back where they were (`03 §1`). Chromium has no menu root, so in Chrome
or Edge those entries land in Other Bookmarks, as they do from Firefox's own
export. The other way round, Chrome's own export writes Other's and Mobile's
contents loose (§1.2), so in Firefox they land in the Bookmarks Menu, exactly
as Firefox's own import places them; our exports mark both roots and land
where they came from.
### 1.2 Parse tolerance (import)
@@ -116,7 +129,11 @@ Must accept, with a warning where noted:
space in the host) → skipped, `INVALID_URL`, because `chrome.bookmarks.create`
rejects it mid-write, after a Replace has already cleared the tree; Firefox
`place:` smart bookmarks → skipped, `PLACE_QUERIES_SKIPPED` (Chrome's own
importer drops them too; in Chrome they are dead links). `javascript:`,
importer drops them too; in Chrome they are dead links, and on Firefox
BookmarkMagic still does not write them — the notice says "skipped", not
"dead", since v1.3.0). On Firefox, an address longer than 65 536 characters
→ skipped before planning, `URL_TOO_LONG` (applied after parsing, with the
limit the browser layer passes in, so every format is covered by one rule). `javascript:`,
`data:` and `file:` addresses are kept verbatim (`09` T3). Fixture:
`weird/invalid-urls.html`.
- **Empty titles are kept empty** (since v1.1.0), counted as `EMPTY_TITLE`.
@@ -146,8 +163,11 @@ Must accept, with a warning where noted:
The older `chrome-131-export.html` wraps them in an `Other bookmarks` folder
that Chrome itself never writes; it is kept as a third-party shape, not as a
record of Chrome.
- `<HR>` separator elements (Firefox) → skipped, no warning. These are
*elements*, so "unknown attributes ignored" does not cover them.
- `<HR>` separator elements (Firefox) → skipped and **counted**,
`SEPARATORS_SKIPPED` (no warning until v1.3.0; once Firefox users could
import, a silent loss stopped being acceptable). These are *elements*, so
"unknown attributes ignored" does not cover them. The file model has no
separator: none of the four formats BookmarkMagic writes carries one.
- Empty folders → preserved.
- **Root list selection.** Do **not** pick a single root `<DL>` —
`document.querySelector('dl')` and "the outermost `<DL>`" are both lossy.
@@ -214,9 +234,9 @@ not an anomaly, and must not raise a warning (`05 §4`).
omit `children` (⇒ empty). Unknown extra keys are ignored on import
(forward compatibility); `version > 1` → warning "newer file, best-effort";
an absent `version` is read as 1.
- `"root": "other" | "mobile"` (since v1.1.0, folders only, never beside
`"toolbar"`) marks a folder that IS that browser root — the JSON form of
§1.1's markers. Additive: v1 readers ignore unknown keys, so the version stays
- `"root": "other" | "mobile" | "menu"` (since v1.1.0; `"menu"`, Firefox's
Bookmarks Menu, since v1.3.0; folders only, never beside `"toolbar"`) marks a
folder that IS that browser root — the JSON form of §1.1's markers. Additive: v1 readers ignore unknown keys, so the version stays
1, and a 1.0.x reader simply nests as before.
- **Legacy backups.** A 1.0.x safety backup has exactly the shape of a Chromium
profile — `generator` `BookmarkMagic 1.0.x`, no `root` keys, three top-level
@@ -309,7 +329,9 @@ item — `15`). One line of `JSON.stringify` output:
```
- Nodes: `type` `text/x-moz-place` (bookmark: `title`, `uri`), `…-container`
(folder: `title`, `children`), `…-separator` (skipped silently, as `<HR>` is).
(folder: `title`, `children`), `…-separator` (skipped and counted,
`SEPARATORS_SKIPPED`, as `<HR>` is — so a backup and its HTML twin still
give the same result, which the parity rule requires).
A node with no `type` falls back to `typeCode` 1/2/3. Dates are **PRTime** —
integer microseconds since the Unix epoch — converted explicitly and
truncated, as Firefox's own HTML export does (`microsToSeconds`).
+20 -6
View File
@@ -335,11 +335,23 @@ froze the tab.
## 10. Reordering — `edit/sort.ts`, `edit/move-target.ts`
Both write through `chrome.bookmarks.move`, whose index has one trap: **within
one parent, a move to the right counts the target index as if the node were
still in place**, while `onMoved` — and `patch-tree`'s `moveNode` — count after
its removal. Moving `a` after `c` in `[a, b, c]` is `move(a, { index: 3 })`, and
`onMoved` then reports index 2. A move to the left needs no adjustment.
Both write through `bookmarks.move`, whose index has one trap, and it is not
the same trap in every browser. **Chromium**: within one parent, a move to the
right counts the target index as if the node were still in place, while
`onMoved` — and `patch-tree`'s `moveNode` — count after its removal. Moving `a`
after `c` in `[a, b, c]` is `move(a, { index: 3 })`, and `onMoved` then reports
index 2. **Firefox** (since v1.3.0) counts after removal in the call too —
`move(a, { index: 2 })` — as Places stores the final position. A move to the
left is the same number in both. `planDrop` returns both numbers; the adapter
(`browser/bookmarks.ts` `move`, through `moveIndexFor` in `live-tree.ts`)
sends `api` to Chromium and `local` to Firefox and returns the index the
browser reports; `moveTo` in `stores/edit-commands.svelte.ts` compares it with
`local` and re-reads the tree on a mismatch (`03 §3`).
**Separators** (Firefox) are children like any other here: they occupy
indices, `planDrop` may place a node before or after one, and Alt+↑/↓ steps
past one as a single place. They are never a drop target *into*, and Sort A→Z
leaves them where they are and sorts each run between them on its own.
**Sort A→Z** (`planSort`), planned before anything moves so the confirmation
can state the number:
@@ -347,7 +359,9 @@ can state the number:
```
sortedOrder(children, locale):
collator = Intl.Collator(locale, { numeric: true, sensitivity: 'base' })
stable sort: folders before bookmarks, then collator.compare(key), then current position
split children into runs at each separator (Firefox; Chromium has none — one run)
each run: stable sort, folders before bookmarks, then collator.compare(key), then current position
result = run₀ sorted, separator₀, run₁ sorted, separator₁, … — every separator keeps its index
key(node) = node.title — or the URL, for a bookmark whose title is blank (as Chrome shows it)
planSort(children, locale):
+23 -5
View File
@@ -276,7 +276,8 @@ disabled while a bulk command runs.
fixed-height scroller, mounted 500 rows at a time with a "Show more" row
(`05 §9`); the roots start open. A row: disclosure chevron · glyph (folder,
open folder, link — a lock for a policy-managed node) · title (an untitled
bookmark shows its address, muted, in mono) · host · a child count on folders ·
bookmark shows its address, muted, in mono) · host · a child count on folders
(bookmarks and folders — a Firefox separator is not counted) ·
⚠ on an address Open refuses (`09` T3) · action buttons, shown on hover and on
the focused row: **Open** and **Copy link** (bookmarks), **Sort A→Z**
(sortable folders), **Rename**, **Move to…**, **Delete** (editable nodes only —
@@ -363,7 +364,7 @@ behind a `<ConfirmDialog>` (six preferences is enough to be worth a confirm).
`<AboutCard>`: logo, name, version (from manifest at runtime), tagline;
links: **GitHub repo ↗** · Report an issue ↗ · Changelog ↗ · Accessibility ↗ ·
Chrome Web Store ↗;
Store listing ↗;
**Third-party code:** no runtime dependencies are installed, and the two
MIT-licensed pieces the build compiles in are named — the Svelte runtime and
WXT's one-line browser shim — with their notices shipped in the package as
@@ -392,9 +393,17 @@ use a screen has no other route from inside the product to either, and the
tree's keys are shown nowhere in the UI. The same test pins its URL and the
file's existence.
"Chrome Web Store" points at the published listing (item id in `00 §9`), added
once the item went public. It is the only route a user has from inside the
product to rate or review it, which `13 §6` depends on.
"Store listing" points at the listing the running copy came from — it is the
only route a user has from inside the product to rate or review it, which
`13 §6` depends on. Since v1.3.0 one package serves the Chrome Web Store and
Edge Add-ons, so the link is chosen at run time (`links.ts` `storeUrlFor`):
the Firefox build → the AMO listing, addressed by the gecko id; a Chromium
copy whose `runtime.id` is a store's item id (`00 §9`) → that store's
listing — the Chrome Web Store's, or Edge Add-ons' (mapped after the listing
went live on 2026-11-19, so from the release after 1.3.0); anything else — an
unpacked build → the README's install section, which lists every store. 1.3.0
itself sends an Edge Add-ons install to that section, which links the Edge
listing too. The label was "Chrome Web Store" until v1.3.0.
**No email address appears anywhere in the product.** Since v1.1.0 the
project's addresses are per purpose (`security@` in `SECURITY.md`, `privacy@` in
@@ -485,6 +494,15 @@ held failures at the head of the one queue instead, and every later toast —
the panel's close button, the delete buttons having gone with the copies.
After a confirmed **Sort A→Z** from the toolbar — whose button is disabled
while the sort runs, which is what dropped it — focus goes to the tree.
- **Separators (Firefox, since v1.3.0)** render as a line inside an
`aria-hidden` list item between the `treeitem`s — outside the accessibility
tree, so the tree still owns only tree items, and with no `role`, which a
hidden element does not need. They take no focus, so ↑/↓, Home/End and
type-ahead pass over them, and `aria-posinset`/`aria-setsize` count the
items around them, not the separators. Alt+↑/↓ does step past one, one place
at a time, as a drag would — and since the separator is not counted, the
spoken "position n of m" does not change on that step. A known limitation
(`ACCESSIBILITY.md`): a screen reader is not told where the separators are.
- **The tree says what Alt+↑/↓ did.** One always-present polite live region in
the tab speaks "<title>: position n of m" after each move — n and m being
the row's own `aria-posinset` and `aria-setsize`, so under a search they
+19
View File
@@ -229,6 +229,25 @@ stay raw.
(`00 §10`), and translation reports arrive through
`.github/ISSUE_TEMPLATE/translation.yml`.
### Browser-neutral wording (since v1.3.0)
Since the same strings run in Chrome, Edge and Firefox, a sentence may name a
browser only when it is about that browser's own thing — "Chrome's Bookmarks
file", "Firefox JSON backups", "Firefox smart bookmarks". A sentence about what
"the browser" does or allows says "the browser". v1.3.0 reworded the three
that were not true everywhere, in all five languages:
| Key | Was | Is |
|---|---|---|
| `import.dateNotice` | "Chrome does not let an extension set…" | "The browser does not let an extension set…" |
| `about.store` | "Chrome Web Store listing" | "Store listing" (the URL follows the install, `06 §3.5`) |
| `warnings.PLACE_QUERIES_SKIPPED` | "…skipped — here they would be dead links." | "…skipped." (on Firefox they are not dead links; BookmarkMagic still does not write them) |
and added, with Romanian's `few` form where a count is involved (§5):
`warnings.URL_TOO_LONG`, `warnings.SEPARATORS_SKIPPED`,
`import.replaceSeparators` and `import.target.menu`. The JA, ZH-CN and RO versions are best-effort and
carry the usual `TODO(review-…)` marker.
## 5. Locale-sensitive edge cases
- **Pluralization.** A plural key is an object of CLDR plural forms. Every
+97 -3
View File
@@ -1,6 +1,9 @@
# 08 — Manifest V3 & Chrome Web Store Compliance
# 08 — Manifest V3 & Store Compliance
Goal: pass review fast and stay listed. Every item here is a hard requirement.
Goal: pass review fast and stay listed — on the Chrome Web Store, Firefox
Add-ons (AMO) and Microsoft Edge Add-ons. Every item here is a hard
requirement. §1–§8 were written for Chrome and still hold for every store;
§9 (Firefox) and §10 (Edge) add what differs.
## 1. Manifest (generated by WXT from `wxt.config.ts`)
@@ -20,6 +23,18 @@ export default defineConfig({
});
```
Since v1.3.0 the manifest is a function of the target browser (`wxt.config.ts`,
`manifestVersion: 3` for every target — WXT would otherwise build Firefox as
MV2). Two packages are built from one source:
| Package | For | Differs from the above |
|---|---|---|
| `bookmarkmagic-X.Y.Z-chrome.zip` (`.output/chrome-mv3`) | Chrome Web Store **and Microsoft Edge Add-ons** | nothing — this is the manifest above (§10) |
| `bookmarkmagic-X.Y.Z-firefox.zip` (`.output/firefox-mv3`) + `…-sources.zip` | Firefox Add-ons | no `minimum_chrome_version`; adds `browser_specific_settings.gecko` (§9) |
Permissions, CSP, pages and icons are **identical** in both; `check:manifest`
holds each package to its own exact key set (§3, layer 2).
## 2. Permissions — justification table (paste into CWS review notes)
| Permission | Justification (single purpose) |
@@ -97,7 +112,8 @@ governed by a page CSP and is not a request the extension makes (`09 §1`).
#### Layer 2 — the built-artifact gate
`npm run check:manifest` (`scripts/check-manifest.mjs`) scans every `.js` file
in `.output/chrome-mv3` for the network identifiers the source gate bans, as
in `.output/chrome-mv3` — and, with `--browser firefox`, in `.output/firefox-mv3`
(since v1.3.0, each against its own key set, §1) — for the network identifiers the source gate bans, as
bare words — including code that arrived through a dependency, which no source
gate can see — and pins the manifest: MV3, the permission list, the exact key
set, the Chrome floor, the exact CSP, that every file the manifest and the
@@ -205,3 +221,81 @@ any of them changes (`09 §4`).
- [ ] Privacy tab answers unchanged, or updated + re-certified.
- [ ] Store listing screenshots regenerated if the UI changed
(`scripts/screenshots.mjs --shoot` — `13 §2`).
- [ ] Firefox: `check:manifest --browser firefox` passes; the gecko id is
still `bookmarkmagic@poli0981.dev`; the sources zip and `BUILD.md`
rebuild the package (§9).
- [ ] Edge: the package uploaded is the Chrome Release asset (§10).
## 9. Firefox Add-ons (AMO) — since v1.3.0
```ts
browser_specific_settings: {
gecko: {
id: 'bookmarkmagic@poli0981.dev', // permanent after the first AMO upload
strict_min_version: '140.0',
data_collection_permissions: { required: ['none'] },
},
},
```
- **The id is permanent.** AMO requires one for MV3 and never lets it change;
every installed copy and every update is tied to it. It is an id, not a
mailbox, and no page of the extension shows it (`15`, 2026-11-18).
- **`data_collection_permissions: { required: ['none'] }`** is Firefox's own
consent system, mandatory for new extensions since 2025-11-03. "None" is the
accurate answer for the same reason §5's privacy answers are "No": nothing is
collected or transmitted. Changing it is the Firefox equivalent of changing
the CWS privacy tab — a minor-version event (`09 §4`).
- **Floor: Firefox 140** — the first release that understands
`data_collection_permissions` (older ones reject the key), and above every
ES2025 built-in the code relies on (`RegExp.escape` and `Promise.try` are
134). Vite's `build.target` for this package is `firefox140`, the
counterpart of `chrome136`. Like the Chrome floor, never raise it in a patch.
- **Desktop only.** Firefox for Android has no `bookmarks` API, so the
manifest declares no `gecko_android` and the listing and every API upload
declare Firefox desktop compatibility only.
- **The extension-page CSP is the same string**, in MV3's object form, and
Firefox enforces it the same way; `check:manifest` pins it in both packages.
- **No background script** on Firefox either, so Firefox's MV3 event-page
model never comes into it.
- **Options can open a second Manager tab.** Chrome reuses an open Manager
for `options_ui` whatever its route, ignoring the `#settings` fragment
(`02 §5`); Firefox matches the whole address, fragment included (its
about:addons and `open_in_tab` code never pass `ignoreFragment`), so with a
Manager open on `#edit` it opens another one on `#settings`. Cosmetic: both
tabs work, and the write lock keeps them from writing at once (`03 §5`).
- **Source code is part of every submission.** The bundle is minified, so AMO
requires the sources and instructions that rebuild the same files. `wxt zip
-b firefox` writes `…-sources.zip` beside the package (dotfiles excluded —
`.nvmrc` among them, so the instructions state Node 26 explicitly), and
`/BUILD.md` is those instructions. AMO's reviewers build on their own
machine and diff the result against the uploaded package.
- **Obfuscation is prohibited** on AMO too; minification is allowed.
- What the code does differently on Firefox — the roots, the separators, the
move index — is `02 §4`, `03 §1` and `05 §10`; none of it is a manifest
matter.
## 10. Microsoft Edge Add-ons — since v1.3.0
- **The Chrome package, unchanged.** Edge accepts Chrome's MV3 manifest keys,
`minimum_chrome_version` included (Edge versions follow Chromium's, so
136 means Edge 136). The zip uploaded to Edge is the same Release asset as
the Chrome one, with the same checksum.
- **The listing names no other browser.** Edge's developer policy (1.1.2)
says an extension "must not reference other browsers", and Partner Center
warns on any browser name in a description — on 2026-11-18 it flagged
"Firefox" in the first Edge copy, which was the Chrome Web Store
description with two bullets swapped and still listed seven browsers. The
Edge copy in `store/listing.*.md` is now a complete description of its own:
the profile `Bookmarks` file is the one "Edge and similar browsers keep",
HTML export is the file "every major browser can import", and
`tests/unit/store-listing.test.ts` fails on a name pasted back in. The same
policy (1.5.2) asks that the privacy policy refer "primarily" to Edge;
`legal/PRIVACY.md` names all three stores. That is a *should*, so it is left
as it is unless review raises it.
- Edge's bookmarks API is Chromium's: the same roots ("Favorites bar", "Other
favorites"), `folderType` included. Whether Edge marks the roots of a
signed-in, syncing profile with `syncing: true` — which would leave no
writable root (`NO_WRITABLE_ROOTS`) — is **unverified**; `11 §5` checks it
on a real Edge with sync on before the first submission.
- Privacy answers in Partner Center are §5's.
+11 -3
View File
@@ -156,7 +156,10 @@ enters the tree through a reviewed change to the lists — or one `EXCEPTIONS`
entry with its reason and a `15` decision-log row — never unnoticed inside a
Dependabot bump. The gate trusts each package's own declaration, as any
lockfile-based check must, and needs neither `node_modules` nor the network.
It runs in `verify`, in CI's `quality` job and in the release build.
It runs in `verify`, in CI's `quality` job and in the release build, over the
root lockfile and, since v1.3.0, `tools/publish/package-lock.json` — the
store-upload tool, which ships nothing, so it is held to the toolchain list
(`12 §3`).
Considered and not used: `actions/dependency-review-action`. It sees only
what a pull request changes, reads licences from ClearlyDefined rather than
@@ -177,8 +180,13 @@ a **minor-version** event at minimum.
CRC32. The archives' SHA-256 hashes still differ, because `wxt zip` records
file mtimes and nothing normalizes them (there is no `SOURCE_DATE_EPOCH`
support). Do not claim byte-identical rebuilds.
- GitHub Releases attach the exact zip uploaded to CWS + `SHA256SUMS.txt`
so users can verify store build ↔ source correspondence. That works on the
- GitHub Releases attach the exact zips uploaded to the stores + `SHA256SUMS.txt`
(since v1.3.0: the Chrome package, which is also what Edge Add-ons receives,
the Firefox package and its sources archive) so users can verify store build
↔ source correspondence. The stores re-sign or repackage what they receive
(Chrome and Edge into a signed CRX, AMO signs the XPI), so a file installed
from a store does not hash like the Release asset; the checksum vouches for
what was uploaded. That works on the
released artifact itself, which is the same file in both places — it is not a
claim that a third party can rebuild the same hash.
- Tags are signed (GPG) — consistent with the tracker-repo signing practice.
+63
View File
@@ -189,6 +189,28 @@ Also in `tests/unit/browser/` (v1.1.0):
code with its URL-bearing detail absent; crash hooks record names only, and
stop after teardown.
**Firefox flavour (since v1.3.0).** There is no Firefox in CI, so
`tests/helpers/fake-bookmarks.ts` takes `{ flavour: 'firefox' }` and then
behaves the way Firefox's source says its API does
(`browser/components/extensions/parent/ext-bookmarks.js`, Places'
`Bookmarks.sys.mjs`): GUID roots in the order Menu, Toolbar, Other, Mobile,
all four always present; no `folderType`; separators as
`{ type: 'separator', url: 'data:' }`; a same-folder `move` that takes the
final position; no `onChildrenReordered` or `onImport*`; `get('3')`
rejected; addresses over 65 536 characters refused. Firefox has suites of its own rather than
a second pass of the Chromium ones: `firefox-import.test.ts` (roots by GUID;
Merge, New-folder and Replace — all four roots emptied, the backup restored
twice; export), `edit-firefox.test.ts` (the edit model, keyboard positions,
Sort A→Z around separators, drops and Alt+↑/↓ at Firefox's index, the re-read
when the browser reports another landing place), `live-tree.test.ts`
(separators, counts, the Menu marker, each browser's move index) and the pure
`firefox-menu.test.ts`. The position fallback in `getRoots`, which neither
fake reaches — both have known ids — is tested in `bookmarks.test.ts` with
hand-built roots of unknown ids, including a Menu listed first. ⚠️ The fake is built from reading Firefox's source;
a sanitized `getTree()` dump from a real Firefox 140+ profile, committed as a
fixture the fake is checked against, would turn that reading into evidence
(`00 §10`).
### #edit logic, stores, styles and scripts
The components have no test framework (§1), so everything that can move out of
@@ -256,6 +278,11 @@ them is tested where it lives:
and the issue chooser; every key `tree-keyboard.ts` switches on has a row;
it states a goal and an untested list, and it is dated. It cannot tell
whether a sentence is *true* — that is `§5`'s last item.
- **`store-listing.test.ts`** (2026-11-18, after v1.3.0) — the Edge Add-ons
copy in every `store/listing.*.md`: one complete description under the Edge
heading, 250 to 5,000 characters (Partner Center's range), naming no browser
but Edge (`08 §10`, `13 §9`). The same pattern has to find the browsers the
Chrome Web Store copy lists, so it cannot pass by matching nothing.
- **`tests/unit/scripts/`** — the repo's own gates, tested like code. New in
v1.1.0: `guard.test.ts` (`08 §3`), `check-manifest.test.ts` (a correct build
passes, one without the CSP fails) and `sanitize-formats.test.ts` (the
@@ -445,6 +472,42 @@ failure mode that would hit every installed user at once.
smoke it. This is the only check that the artifact users receive is the
artifact that was tested (`13 §1b` step 10).
### Firefox and Edge (since v1.3.0) — before the first submission to each
Firefox (140 or later; about:debugging → Load Temporary Add-on →
`.output/firefox-mv3/manifest.json`, on a profile you can afford to lose):
- [ ] The four roots are where they belong: an import in Merge mode of a
BookmarkMagic HTML export puts the bar's entries in the **Bookmarks
Toolbar**, Other's in **Other Bookmarks**, loose entries in the
**Bookmarks Menu**; New-folder mode puts `Imported <date>` under Other
Bookmarks.
- [ ] **Replace, then restore the safety backup with Replace twice**: menu,
toolbar, Other and Mobile come back in their own roots, never nested; the
confirmation counted the separators it was about to delete and said they
would not come back.
- [ ] Export all four formats: no `data:` entry where a separator was; HTML
re-imports into Firefox with the menu restored; an import of Firefox's
own HTML export reports the separators it skipped.
- [ ] #edit: separators are lines that ↑/↓ and type-ahead skip; Alt+↑/↓ steps
past one; a drag before/after a row lands exactly there (the move-index
rule, `05 §10`); Sort A→Z leaves separators where they are; the
duplicate panel never lists separators.
- [ ] Replace's backup on Firefox goes through the **anchor download and the
"I have the backup" confirmation** (no `showSaveFilePicker`).
- [ ] About → "Store listing" opens the AMO listing; right-click → Options
lands on #settings (a second Manager tab here is expected, `08 §9`).
- [ ] The Manager in every language; Firefox's own locale fallback.
Edge (the Chrome package, Load unpacked from `.output/chrome-mv3`):
- [ ] **Signed in with sync on**: #edit loads and Merge writes — no
`NO_WRITABLE_ROOTS` (`08 §10`, unverified until this item is done).
- [ ] The Chrome items above that touch roots: Favorites bar / Other
favorites receive what Bookmarks bar / Other bookmarks would.
- [ ] About → "Store listing" opens the README's install section (the Edge
listing's address is not known until it exists).
## 6. Performance budgets (checked manually in v1)
- Parse 25 MB / 100k HTML file: < 2 s.
+64 -21
View File
@@ -68,8 +68,10 @@ Three jobs. The two whose names branch protection requires (§5) are
`a11y_*` checks a gate, `10 §3` — then the TS 7 `tsc`), `knip`, `coverage` (`11 §1` thresholds),
`guard` (`08 §3`), `check:licenses` (every licence in the lockfile, `09 §3.2`),
`npm audit --omit=dev --audit-level=low` (the
zero-runtime-dependencies claim, `09 T5`), `build`, `check:manifest`. The last
two exist because the unit test over `wxt.config.ts` proves what we *asked*
zero-runtime-dependencies claim, `09 T5`), `build`, `check:manifest`, and since
v1.3.0 `build:firefox` + `check:manifest -- --browser firefox` — the second
package, held to its own key set (`08 §1`, `08 §9`). The build/check pairs
exist because the unit test over `wxt.config.ts` proves what we *asked*
for and only the built manifest proves what WXT *emitted* — a dev build of
the same config carries `tabs`/`scripting`/`host_permissions`.
- **`windows` — "Windows smoke (guard + unit tests)".** Not required. The owner
@@ -116,13 +118,14 @@ Standalone, **not** the ops reusable: the reusable's `release` job only does
by `09 §5`), performs no store submission, and exposes no `outputs:`, so a
caller cannot reference the zip it built.
Four jobs, least privilege first (split 2026-10-28):
Jobs, least privilege first (split 2026-10-28; the store job became three in
v1.3.0):
| Job | Token | Does |
|---|---|---|
| `build` "Gate + package" | `contents: read` | install, **every CI gate again** (a tag skips the branch triggers, and must never ship what a PR would have blocked), `zip`, `check:manifest`, the tag ↔ manifest version check, `SHA256SUMS.txt`; copies both files into a plain `dist/` and uploads that as the artifact `release-<tag>` — `upload-artifact` skips hidden paths such as `.output/` by default, which failed the first v1.1.0 tag run before any Release existed |
| `build` "Gate + package" | `contents: read` | install, **every CI gate again** (a tag skips the branch triggers, and must never ship what a PR would have blocked), `zip` and (since v1.3.0) `zip:firefox` — the Chrome/Edge package, the Firefox package and its sources archive — `check:manifest` on both packages, the tag ↔ manifest version check on both, `SHA256SUMS.txt` over all three files, each staged by its exact name so a missing one fails the run (a glob would pass with one of three); copies the three files and `SHA256SUMS.txt` into a plain `dist/` and uploads that as the artifact `release-<tag>` — `upload-artifact` skips hidden paths such as `.output/` by default, which failed the first v1.1.0 tag run before any Release existed |
| `publish` "GitHub Release" | `contents: write` | downloads the artifact, `sha256sum -c` it, creates the Release with `--verify-tag` (or re-uploads to an existing one). Installs nothing and runs no repository code — the only job that ever holds a write token |
| `store` "Publish to Chrome Web Store" | `contents: read` | only when the repo variable `CWS_AUTOPUBLISH` is `'true'`: `./node_modules/.bin/wxt submit` with the Release asset — the local binary, never `npx wxt`, which may fetch an unpinned package into an environment holding the four `CHROME_*` secrets (SonarCloud S6505/S8543) |
| `store-chrome`, `store-firefox`, `store-edge` | `contents: read` | since v1.3.0, one job per store, each only when its own repo variable is `'true'` (`CWS_AUTOPUBLISH`, `AMO_AUTOPUBLISH`, `EDGE_AUTOPUBLISH`) and each in its own GitHub **Environment** holding only that store's secrets (§3). They install `tools/publish/` — `publish-browser-extension` and its three dependencies, from their own lockfile, scripts off — instead of the whole dev toolchain, check the downloaded files by exact name against the `SHA256SUMS.txt` of the **published Release** (not the artifact's own copy), and run its `publish-extension` binary. Before v1.3.0 a single `store` job ran `wxt submit` after a full `npm ci`: four Chrome secrets shared a runner with ~320 packages |
| `announce` | `contents: read` | Discord, only when `DISCORD_ANNOUNCE` is `'true'` |
Before the split, one job ran `npm ci` — every dependency's install script plus
@@ -297,23 +300,56 @@ pull requests, a weekly schedule and `workflow_dispatch`. Configuration is
defect and switched off, with its reason, when it is a convention; it is
never left standing to be ignored.
## 3. Chrome Web Store publishing automation
## 3. Store publishing automation (Chrome Web Store, Firefox Add-ons, Edge Add-ons)
WXT ships publishing built-in: **`wxt submit`** (wrapping
`publish-browser-extension`). One-time local setup: `npx wxt submit init`
→ walks through creating the Google Cloud OAuth client + refresh token →
produces the four values above → store as **repo Actions secrets**.
Since v1.3.0 the release workflow can submit to all three stores, each step
**off until its owner switches it on** with a repo variable. Uploaded builds
still go through each store's review; automation removes the clicking, not the
review.
**Gating policy:**
| Job | Gate (repo variable) | Environment | Secrets in that environment | Uploads |
|---|---|---|---|---|
| `store-chrome` | `CWS_AUTOPUBLISH=true` | `chrome-web-store` | `CHROME_PUBLISHER_ID`, `CHROME_EXTENSION_ID` (= the item id, `00 §9`), `CHROME_SERVICE_ACCOUNT_CLIENT_EMAIL`, `CHROME_SERVICE_ACCOUNT_PRIVATE_KEY` | the Chrome package |
| `store-firefox` | `AMO_AUTOPUBLISH=true` | `firefox-add-ons` | `FIREFOX_EXTENSION_ID` (= the gecko id), `FIREFOX_JWT_ISSUER`, `FIREFOX_JWT_SECRET` | the Firefox package and its sources, `listed`, Firefox desktop only |
| `store-edge` | `EDGE_AUTOPUBLISH=true` | `edge-add-ons` | `EDGE_PRODUCT_ID`, `EDGE_CLIENT_ID`, `EDGE_API_KEY` | the Chrome package |
- **The tool is `publish-browser-extension`** (6.2.0 — what `wxt submit`
wraps), installed from `tools/publish/`'s own lockfile: four packages, not
the dev toolchain. A job's secrets are readable by everything on its runner
for the whole job (§2.5), and these can push an update to every user.
- **One job per store**, so a store's credentials never share a runner with
another's, and one store refusing an upload does not stop the others.
- **Environments** carry the secrets, not the repository, so nothing else in
any workflow can read them. Give each one a required reviewer (the owner) to
approve every upload, **and** restrict its deployment branches and tags to
the tag pattern `v*`: an environment GitHub creates on first use has no
rule at all, so any branch with a workflow that names it — a pushed branch,
not only a release — could reach its secrets. The reviewer is the second
lock, not the only one.
- **Chrome Web Store API v2.** v1.1 — what the old `store` job's
client-id/secret/refresh-token secrets used — was shut down on 2026-10-15;
that job would have failed the day `CWS_AUTOPUBLISH` was set. v2 takes a
publisher id and a Google Cloud **service account** (`CHROME_API_VERSION=v2`
is set by the job, never left to the tool's default).
- **AMO: the first version must be created by hand.** The API (and the tool)
can add a version to an add-on that exists, not create one; `13 §8`. AMO
JWT credentials come from addons.mozilla.org/developers/addon/api/key/.
- **Edge: the first submission is made in Partner Center**, by hand (`13 §9`).
API keys (v1.1, with a Client ID) **expire every 72 days** — a scheduled
chore, not an incident; until rotated, `store-edge` fails and the others do
not.
- **No re-run of a store job that succeeded**: every store refuses a version
number it has seen. Re-run only the failed job (`13 §7`).
| Version | Method |
|---|---|
| v1.0.x | **Manual**, per the `13 §1b` runbook: download the zip from the GitHub Release (not the CI artifact — the Release asset is the one `SHA256SUMS.txt` covers) → Dashboard → Package → upload new package → submit. The original rationale was "first reviews often ask questions"; in the event the first review asked nothing. It stays manual because none of the four `CHROME_*` secrets exists yet and `CWS_AUTOPUBLISH` is unset. |
| v1.1+ | **Automated**: the `Publish to Chrome Web Store` step in §2.3 runs after the Release succeeds, gated on the repo variable `CWS_AUTOPUBLISH=true` so it can be flipped off instantly if a review dispute is ongoing. |
| v1.0.x–v1.2.x | Chrome Web Store by hand (`13 §1b`) — the `CHROME_*` secrets never existed. |
| v1.3.0 | The first AMO and Edge versions **must** be uploaded by hand (`13 §8`, `13 §9`); the Chrome one by hand until the owner sets up §3's environment. |
| later | Each store automated once its environment has its secrets and its variable is `true`; switch a variable off to stop submitting there instantly (a review dispute, a rollout to watch). |
Notes: uploaded builds still go through CWS review before rollout (automation
removes the clicking, not the review). Consider Dashboard "staged rollout"
manually for risky releases.
Consider a staged (percentage) rollout on the Chrome Web Store for anything
touching the write paths — `CHROME_DEPLOY_PERCENTAGE` for the automated job,
the dashboard otherwise.
## 4. Branch/version flow
@@ -359,9 +395,14 @@ means "unknown", not "not done".
- [x] CodeQL **Default setup DISABLED** (Settings → Advanced Security) —
confirmed 2026-07-26; `codeql.yml` uploads SARIF cleanly, which is only
possible with it off (§2.2).
- [ ] ⚠️ Actions secrets: the four `CHROME_*` values (after `wxt submit init`).
`CHROME_EXTENSION_ID` is already known — it is the published item id in
`00 §9`. Required before `CWS_AUTOPUBLISH` can be flipped for v1.1.
- [ ] ⚠️ Store environments (§3), each with the owner as required reviewer,
deployments limited to tags matching `v*`, and only its own secrets: `chrome-web-store` (the four API v2 values;
`CHROME_EXTENSION_ID` is the item id in `00 §9`), `firefox-add-ons`
(`FIREFOX_EXTENSION_ID` = `bookmarkmagic@poli0981.dev` and the AMO JWT
pair), `edge-add-ons` (product id, Client ID, API key — rotate every 72
days). GitHub creates an environment the first time a job names it, with
no protection; add the reviewer, the `v*` tag rule and the secrets in
Settings → Environments.
- [x] Actions secrets for Discord notifications — **present as of 2026-10-28:**
`DISCORD_CI_WEBHOOK`, `RELEASES_WEBHOOK`, `REPO_WEBHOOK` (the last two under
names the reusable does not read; `release.yml` maps them, §2.3).
@@ -374,7 +415,8 @@ means "unknown", not "not done".
scan errors out. The owner agreed to switch it off on 2026-10-28.
- [x] Private vulnerability reporting **enabled** (verified 2026-10-28 via the
API) — `SECURITY.md` and the issue chooser send reporters there first.
- [ ] ⚠️ Repo variable `CWS_AUTOPUBLISH=false` initially. Note that when the
- [ ] ⚠️ Repo variables `CWS_AUTOPUBLISH`, `AMO_AUTOPUBLISH`,
`EDGE_AUTOPUBLISH` — unset, so no store job runs. Note that when a
variable does not exist the expression is simply false, so "not configured"
and "configured off" are indistinguishable from a run's output.
- [ ] ⚠️ Repo variables `DISCORD_ANNOUNCE` and `DISCORD_CI_NOTIFY` — both still
@@ -383,7 +425,8 @@ means "unknown", not "not done".
posts. Unset means skipped; a reusable-workflow caller cannot use
`continue-on-error` to absorb a failure (§2.3).
- [x] Dependabot: npm weekly, grouped dev minor+patch, `github-actions` too —
`.github/dependabot.yml`. Both ecosystems have a 7-day `cooldown`
`.github/dependabot.yml` — and since v1.3.0 `tools/publish/` (the
store-upload tool's own lockfile, §3) as a third ecosystem entry. Both ecosystems have a 7-day `cooldown`
(matching `.npmrc` `min-release-age=7`, `09 §3.1`); WXT is excluded from
the group so every WXT bump arrives alone and gets its built-manifest
diff; majors of the TypeScript pair and `@types/node` are ignored.
+102 -2
View File
@@ -1,6 +1,9 @@
# 13 — Release & Store Publishing
Developer account: registered & fee paid ✔.
Chrome Web Store developer account: registered & fee paid ✔. Since v1.3.0
there are two more stores — Firefox Add-ons (§8) and Microsoft Edge Add-ons
(§9) — and §1b is still the procedure for every release; §8 and §9 add what
is different there.
## 1. First-submission runbook (v1.0.0) — ✔ completed 2026-07-26
@@ -62,7 +65,9 @@ privacy and distribution tabs are already filled; you are replacing the package.
`release.yml` re-runs every gate, builds, zips, verifies tag↔manifest, writes
`SHA256SUMS.txt`, and creates the GitHub Release.
5. Download the **Release asset**, not the CI artifact — `SHA256SUMS.txt` covers
the Release asset only (`12 §3`). Verify with `sha256sum -c`.
the Release assets only (`12 §3`). Verify with `sha256sum -c --ignore-missing
SHA256SUMS.txt` (since v1.3.0 it lists three files; `--ignore-missing` lets
you check only the one you downloaded).
6. Dashboard → the existing item → **Package → Upload new package** → the zip.
Do *not* create a new item.
7. Fill the "why this update" / what-changed note. Listing text and the privacy
@@ -81,6 +86,19 @@ Chrome auto-updates installed extensions once the new version passes review;
users do nothing and, notably, get no prompt. That is why the upgrade test
matters more than any other single check here.
## 1c. Which file goes where (since v1.3.0)
| Store | Upload | Notes |
|---|---|---|
| Chrome Web Store | `bookmarkmagic-X.Y.Z-chrome.zip` | §1b |
| Microsoft Edge Add-ons | the **same** `…-chrome.zip` | §9 |
| Firefox Add-ons | `bookmarkmagic-X.Y.Z-firefox.zip` **and** `…-sources.zip` | §8 |
A store that re-signs or repackages what it receives (all three do, in some
form) serves users a file whose hash is not the Release asset's. What
`SHA256SUMS.txt` vouches for is that the uploaded file is the Release asset
(`09 §5`).
## 2. Asset checklist ⚠️
### Store assets (submitted — source of truth is the CWS dashboard)
@@ -242,6 +260,15 @@ superseding version has to pass review too.
answers must agree with the code exactly. `npm run guard` and
`npm run check:manifest` are the evidence that they do.
### A store job failed after the Release was published (since v1.3.0)
Re-run **only the failed job** from the run page. Every store refuses a
version number it has already accepted, so re-running the whole workflow would
turn the stores that succeeded red; and nothing before the store jobs needs
redoing — the Release and its checksums are already published. The usual
causes: an expired Edge API key (72 days, `12 §3`), a review hold, a token
revoked in a store dashboard.
### A tag was pushed and the release run failed
`release.yml` runs `gh release create` with no existence check, so a failure
@@ -255,3 +282,76 @@ on) leaves a published Release that a re-run cannot recreate.
`git push --delete origin vX.Y.Z`, then re-tag. Only safe while nothing has
consumed the assets.
- Never move a tag that has already been announced or submitted.
## 8. Firefox Add-ons (AMO) — runbook (since v1.3.0)
**First version — by hand, once** (the API and `publish-browser-extension`
can only add versions to an add-on that exists):
1. The `11 §5` pass on a **real Firefox** (140 or later): about:debugging →
This Firefox → Load Temporary Add-on → `.output/firefox-mv3/manifest.json`
(or the Release's `…-firefox.zip`). Its Firefox section covers the
Bookmarks Menu, separators and Alt+↑/↓.
2. addons.mozilla.org/developers → **Submit a New Add-on** → *On this site*
(listed) → upload `bookmarkmagic-X.Y.Z-firefox.zip` from the Release.
3. **Compatibility: Firefox only** — untick Firefox for Android (no
`bookmarks` API there, `08 §9`).
4. **Source code: yes** → upload `bookmarkmagic-X.Y.Z-sources.zip` from the same
Release. In *Notes to reviewer* paste the short version of `/BUILD.md`:
Node.js 26 and npm 11 (the sources archive drops `.nvmrc`), `npm ci`,
`npm run zip:firefox`, the package lands in `.output/`. Reviewers diff their
build against the upload, file by file.
Checked 2026-11-18: the sources archive, unpacked into an empty folder,
`npm ci --ignore-scripts`, `wxt prepare`, `npm run build:firefox`, rebuilt
every one of the package's 19 files byte for byte.
5. Listing: from `store/listing.<lang>.md`'s **AMO** block — name, summary
(≤ 250 characters), description, category *Bookmarks*, licence *GNU General
Public License v3.0 **or later*** — AMO offers "v3.0 only" beside it, and
the code is `GPL-3.0-or-later`. Then the privacy policy
`https://github.com/poli0981/bookmarkmagic/blob/main/legal/PRIVACY.md`, the
homepage (the repository), and the support site (the repository's issues).
No support email (`09 §6`).
6. Submit, and record the review's outcome in `15`. The add-on's page is
`https://addons.mozilla.org/firefox/addon/bookmarkmagic@poli0981.dev/`
(AMO resolves the gecko id; the slug it picks works too).
Done for 1.3.0: submitted 2026-11-18, approved — public by 2026-11-21, slug
`bookmarkmagic`. Both URLs answer 200. As uploaded, the version says
**"GPL-3.0-only"** and has **no support site** (⚠️ `00 §10` item 21).
Its validation report showed 0 errors and 2 warnings.
**Later versions:** by hand, the same way (*Upload New Version*), or
automatically from `release.yml`'s `store-firefox` job once
`firefox-add-ons` has its secrets and `AMO_AUTOPUBLISH` is `true`
(`12 §3`) — the job uploads the package and the sources together.
**Rollback:** AMO can disable a version in the Developer Hub, which sends
users back to the previous approved one — a recall Chrome does not offer.
Still ship the fix forward.
## 9. Microsoft Edge Add-ons — runbook (since v1.3.0)
**First submission — by hand, once:**
1. A Partner Center developer account (no fee) — ⚠️ owner.
2. The `11 §5` pass on a real **Edge**, including a profile **signed in with
sync on** — the case `08 §10` could not verify (`NO_WRITABLE_ROOTS` if
Edge marks syncing roots).
3. Partner Center → Edge → **Create new extension** → upload the Release's
`bookmarkmagic-X.Y.Z-chrome.zip` — the Chrome package, unchanged.
4. Listing from `store/listing.<lang>.md`'s **Microsoft Edge Add-ons**
section: a complete description of its own, pasted whole, that names no
browser but Edge (Edge's policy 1.1.2 — Partner Center warns on any other
browser's name, `08 §10`); category *Productivity*; privacy answers as
`08 §5`; privacy policy URL as above; screenshots from `store/screenshots/`.
5. Submit; record the outcome in `15`. Note the **Product ID** on the
extension's overview page — `EDGE_PRODUCT_ID` — and the listing URL, which
the About link and the README can then use (`06 §3.5`). The About link
matches the **CRX ID** (the `runtime.id` an install reports), not the
Product ID.
Done for 1.3.0: submitted 2026-11-18, live 2026-11-19 — ids and listing
in `00 §9`.
**Later versions:** by hand (*Update* → upload the new package), or from
`release.yml`'s `store-edge` job once `edge-add-ons` has its secrets and
`EDGE_AUTOPUBLISH` is `true`. The API key expires every **72 days**; put the
renewal in a calendar.
+11 -1
View File
@@ -89,12 +89,22 @@ its `clsx` helper and WXT's browser shim, which the build always compiled in. **
every change clarifies or corrects a description of what was already true, or
removes an obligation; none adds one or a data flow.
**Precedent (2026-11-18, v1.3.0):** Firefox Add-ons and Microsoft Edge Add-ons
become distribution channels. EULA clause 5 says updates come "through the
store you installed the Extension from"; PRIVACY names all three stores and
Firefox's data-consent declaration ("none"), and calls the settings store by
both browsers' names; DISCLAIMER's note on dates no longer blames Chrome alone,
and the non-affiliation line adds Microsoft and Edge. THIRD_PARTY_NOTICES (same
day, Phase 10) corrected its description of the build tooling's licences.
**Not a bump:** a new channel to receive the same software is not a new data
flow from the Extension, and nothing asks more of the user.
**What each `LEGAL_VERSION` means** — the text a user who accepted that number
agreed to:
| `LEGAL_VERSION` | Accepted text | Notes |
|---|---|---|
| 1 | The four `legal/` files as published 2026-07-26, with the clarifications of 2026-08-03 and 2026-10-29 | The clarifications are listed above; git history has each wording |
| 1 | The four `legal/` files as published 2026-07-26, with the clarifications of 2026-08-03, 2026-10-29 and 2026-11-18 | The clarifications are listed above; git history has each wording |
### 3.2 `LICENSE`
+7 -1
View File
@@ -40,7 +40,13 @@ Build-phase breakdown lives in `CLAUDE.md` (single source for sequencing).
| **v1.2.0 published** | ✔ observed 2026-11-10 | the listing shows version 1.2.0 (`Updated: November 7, 2026`), 3 users, "5 languages" — English, Tiếng Việt, română, 中文(中国), 日本語. ⚠️ As for 1.0.1 and 1.1.0, `13 §1b` step 10 (clean-profile install of the published build + upgrade re-check) has no recorded result |
| 9 — v1.2.1 accessibility | ✔ 2026-11-10 | `ACCESSIBILITY.md` and its intake (issue form, PR checklist, `accessibility@`); the defects an audit of `src/` found that a keyboard-and-Narrator pass had not — an invisible focus ring on the theme control, no forced-colours support, drag-only reordering (Alt+↑/↓), focus dropped on `<body>` in three places, targets under 24 px; dependency sync after Dependabot #31/#32/#35/#36 (`06 §5`) |
| **v1.2.1 released** | ✔ 2026-11-10 | PR #37, merged at the head that was reviewed. Signed tag on `d61318a`, GitHub Release with a `sha256sum -c`-verified zip (`4975b5df…ca13254`, 106 290 bytes). Its manifest differs from 1.2.0's only in `version`, and the file inventory is the same. SonarCloud's new-code gate failed the first push at 73.6 % — the live-sync wiring moved out of `EditTab` had no test — and passed once it had one. `announce` and store publish skipped (variables unset) |
| **v1.2.1 submitted** | ⚠️ pending | owner: the `11 §5` pass incl. the **1.2.0 → 1.2.1 upgrade over an existing profile**, a Windows contrast theme and a screen-reader pass over Alt+↑/↓, then the zip upload (`13 §1b`) |
| **v1.2.1 submitted** | skipped — 1.3.0 went up in its place on 2026-11-18 | owner: the `11 §5` pass incl. the **1.2.0 → 1.2.1 upgrade over an existing profile**, a Windows contrast theme and a screen-reader pass over Alt+↑/↓, then the zip upload (`13 §1b`). 1.3.0 contains all of 1.2.1, so uploading 1.3.0 instead is the shorter path (`00 §10` item 20) |
| 10 — maintenance mode, Firefox + Edge | ✔ 2026-11-18 | PR #42: Dependabot #39–#41 and their hand sync, the unfixable `picomatch` advisory recorded, a lockfile licence gate, `MAINTENANCE.md` with a feature form that classifies and `triage.yml` that closes out-of-policy requests, Qodana (`qodana-js`) beside SonarCloud — 27 first-run findings, none a defect. PR #44: Firefox and Edge Add-ons — Firefox's roots by GUID and the Bookmarks Menu as a fourth root, separators recognised by type, each browser's move index, Firefox's address limit, a second (Firefox) package with its own manifest gate, three store jobs in their own environments (CWS API v2), `BUILD.md` (the sources archive rebuilt the package byte for byte) |
| **v1.3.0 released** | ✔ 2026-11-18 | PR #44, merged at the head that was reviewed (`42c78ec`; `main`'s tree identical). Signed tag on `80c7190`, GitHub Release with three packages and `SHA256SUMS.txt`, each `sha256sum -c`-verified after download — chrome `89c01451…fb921561` (107 946 bytes), firefox `45db6de9…8c09ef71` (108 100 bytes), sources `76799878…5fd6a4a4` (413 081 bytes). The Chrome manifest differs from 1.2.1's in `version` alone; the Firefox one adds `browser_specific_settings.gecko` and has no `minimum_chrome_version`. The store jobs and `announce` skipped (variables unset) |
| **v1.3.0 submitted** | ✔ 2026-11-18 | by the owner, to all three stores: the Chrome Web Store (in place of 1.2.1), the first Firefox Add-ons version and the first Edge Add-ons submission. Partner Center flagged the first Edge description for naming another browser — the Edge copy now names none (PR #47). ⚠️ The `11 §5` passes (`00 §10` items 20–22) have no recorded result |
| **v1.3.0 on Edge Add-ons** | ✔ live 2026-11-19 | approved on the first submission: listing `microsoftedge.microsoft.com/addons/detail/nchfchjnlihbifggooggpmmacighmdjg`, category Productivity, public, five languages. Policy 1.5.2 (a privacy policy that refers "primarily" to Edge, `08 §10`) did not block it. README install row and badge, and the About link's mapping for the next release, followed the same day (`00 §10` item 24) |
| **v1.3.0 on the Chrome Web Store** | ✔ live 2026-11-19 | approved; the listing shows version 1.3.0 (`Updated: November 19, 2026`), 4 users — the first update since 1.2.0, and it carries 1.2.1 too. ⚠️ As for every version since 1.0.1, the `11 §5` upgrade pass and `13 §1b` step 10 have no recorded result |
| **v1.3.0 on Firefox Add-ons** | ✔ live by 2026-11-21 | the first version, approved (owner's report 2026-11-21): `addons.mozilla.org/firefox/addon/bookmarkmagic/`, public, Firefox 140 or later, desktop only; the validator reported 0 errors and 2 warnings. The gecko-id URL the About link uses resolves. ⚠️ The listing says `GPL-3.0-only` where the code is `GPL-3.0-or-later`, and has no support site (`00 §10` item 21). With this, **1.3.0 is on all three stores** |
**Verified on real browsers 2026-07-25:** Chrome and Brave, unpacked build.
Until that point every phase had been tested only against a hand-rolled
+5 -5
View File
@@ -1,6 +1,6 @@
# Disclaimer — BookmarkMagic
Terms version 1 · Effective 2026-07-26 · Last updated 2026-10-29
Terms version 1 · Effective 2026-07-26 · Last updated 2026-11-18
- Provided "AS IS", without warranty of any kind (see LICENSE §15–16).
- Bookmark operations modify your browser's bookmark data. The "Replace
@@ -10,14 +10,14 @@ Terms version 1 · Effective 2026-07-26 · Last updated 2026-10-29
Extension could read back. If the browser stops part-way, what was already
deleted can be restored by importing that backup. You remain responsible for
keeping backups of data you care about.
- Imported bookmarks are created with the current date and time. Chrome's
extension API does not allow an extension to set a bookmark's original
creation date, so original dates are preserved in your exported *files* but
- Imported bookmarks are created with the current date and time. The
browsers' extension APIs do not allow an extension to set a bookmark's
original creation date, so original dates are preserved in your exported *files* but
not when writing back into the browser.
- Import files come from outside this Extension; verify you trust their source.
Bookmarked URLs are stored as-is and are not vetted by the Extension.
- This project is not affiliated with or endorsed by Google, Chrome, Mozilla,
Firefox or any browser vendor. Browser names are trademarks of their
Firefox, Microsoft, Edge or any browser vendor. Browser names are trademarks of their
respective owners.
- The BookmarkMagic name and icon identify this project, published by skullmute
(poli0981). The GPL lets anyone fork the code; it does not let a fork present
+4 -3
View File
@@ -1,6 +1,6 @@
# End User License Agreement — BookmarkMagic
Terms version 1 · Effective 2026-07-26 · Last updated 2026-10-29
Terms version 1 · Effective 2026-07-26 · Last updated 2026-11-18
Copyright © 2026 skullmute ([poli0981](https://github.com/poli0981)).
@@ -17,8 +17,9 @@ Copyright © 2026 skullmute ([poli0981](https://github.com/poli0981)).
allow one, and your rights under the GPL do not depend on it.
4. **Your data.** The software processes bookmark data locally on your device
only, and sends nothing anywhere (see PRIVACY.md).
5. **Updates.** Updates are delivered via the Chrome Web Store and may change
functionality. Material legal changes trigger re-acceptance in-app.
5. **Updates.** Updates are delivered through the store you installed the
Extension from — the Chrome Web Store, Firefox Add-ons or Microsoft Edge
Add-ons — and may change functionality. Material legal changes trigger re-acceptance in-app.
6. **Contact.** Questions about these terms: **legal@poli0981.dev**. Formal
copyright infringement (DMCA) notices: **dmca@poli0981.dev**.
+15 -8
View File
@@ -1,6 +1,6 @@
# Privacy Policy — BookmarkMagic
Terms version 1 · Effective 2026-07-26 · Last updated 2026-10-29
Terms version 1 · Effective 2026-07-26 · Last updated 2026-11-18
BookmarkMagic ("the Extension") is designed to work entirely on your device.
@@ -16,9 +16,10 @@ contains no analytics, telemetry, or crash reporting.
device.
- **Local settings** (permission: `storage`): your language, theme,
preferences, and the date you accepted these terms are stored locally via
`chrome.storage.local`. They are not transmitted anywhere and are removed by
Chrome when you uninstall the Extension. The Extension does not use
`chrome.storage.sync`, so even your settings stay off any vendor cloud.
`chrome.storage.local` (Firefox calls the same store `browser.storage.local`).
They are not transmitted anywhere and are removed by the browser when you
uninstall the Extension. The Extension does not use `storage.sync`, so even
your settings stay off any vendor cloud.
The Extension requests no other permissions. It has no host permissions, no
content scripts, and no background service worker. It contains no code that
@@ -48,10 +49,12 @@ see THIRD_PARTY_NOTICES.md) contain no network code.
Two things happen outside the Extension and are worth knowing:
- **The Chrome Web Store** (Google) distributes the Extension and its updates.
Installing and updating it are governed by Google's own privacy policy, not
this one, and Google gives the developer only aggregate counts such as the
number of users.
- **The store you install it from** — the Chrome Web Store (Google), Firefox
Add-ons (Mozilla) or Microsoft Edge Add-ons (Microsoft) — distributes the
Extension and its updates. Installing and updating it are governed by that
store's own privacy policy, not this one, and each gives the developer only
aggregate counts such as the number of users. On Firefox the Extension
declares that it collects no data, in Firefox's own data-consent system.
- **Opening a bookmark.** When you open a bookmark from the Edit tab, your
browser loads that page exactly as when you click any link: the request is
the browser's, made on your instruction, to the site you chose. The
@@ -85,6 +88,10 @@ of practice: it describes handling of material you choose to send us, which was
never part of what the Extension itself collects — which remains nothing. No
re-acceptance was requested.*
*Clarified on 2026-11-18: the Extension is also distributed through Firefox
Add-ons and Microsoft Edge Add-ons. That adds no data flow — the Extension
still collects nothing — so no re-acceptance is requested (`docs/14 §3.1`).*
*Clarified on 2026-10-29: the diagnostics log, the Chrome Web Store, opening a
bookmark, and what the build compiles in are now described, and the contact
address changed. None of it changes what the Extension collects — still
+12 -23
View File
@@ -1,12 +1,12 @@
{
"name": "bookmarkmagic",
"version": "1.2.1",
"version": "1.3.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "bookmarkmagic",
"version": "1.2.1",
"version": "1.3.0",
"hasInstallScript": true,
"license": "GPL-3.0-or-later",
"devDependencies": {
@@ -17,7 +17,7 @@
"@vitest/coverage-v8": "^5.1.0",
"@wxt-dev/module-svelte": "^2.0.5",
"jsdom": "^31.0.0",
"knip": "^6.44.2",
"knip": "^6.45.1",
"svelte": "^5.57.3",
"svelte-check": "^4.7.8",
"typescript": "npm:@typescript/typescript6@~6.0.2",
@@ -3109,9 +3109,9 @@
}
},
"node_modules/knip": {
"version": "6.44.2",
"resolved": "https://registry.npmjs.org/knip/-/knip-6.44.2.tgz",
"integrity": "sha512-6URO7pnqtOnyvSsXfW6+8C9j1lfcicxUCysXO0RgMtHTZ96HqCXh29op8iabeQW5JeIc8dJWwzSdJVWDokeScQ==",
"version": "6.45.1",
"resolved": "https://registry.npmjs.org/knip/-/knip-6.45.1.tgz",
"integrity": "sha512-zp3zXKy2cZWiIttdlWU5fisKxVQaLSU6471ej0KGz1GdHdaHxpzTAO/LIyFNc3gU3v1W7LJaqvYumoO3l/u+6A==",
"dev": true,
"funding": [
{
@@ -3131,12 +3131,11 @@
"oxc-parser": "^0.156.0",
"oxc-resolver": "11.24.2",
"picomatch": "^4.0.7",
"smol-toml": "^1.9.0",
"smol-toml": "^1.9.1",
"strip-json-comments": "5.0.3",
"tinyglobby": "^0.2.17",
"unbash": "^6.0.1",
"yaml": "^2.9.1",
"zod": "^4.6.5"
"unbash": "^6.0.4",
"yaml": "^2.9.1"
},
"bin": {
"knip": "bin/knip.js",
@@ -4347,9 +4346,9 @@
"license": "ISC"
},
"node_modules/unbash": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/unbash/-/unbash-6.0.1.tgz",
"integrity": "sha512-0db9eS5iqybux41zLkX69nk90KTci7F7eZ+gXzEG/Q7E0tAqEBhRh5fkZvk1N7jT7QkGWqq34i8SFGPFEe1V8A==",
"version": "6.0.4",
"resolved": "https://registry.npmjs.org/unbash/-/unbash-6.0.4.tgz",
"integrity": "sha512-t3OptUArewg9OpYGDskTSlxhyLDahfmZ4d36hE44Efb1y3HRLLpzsVqwH+AwBVymP4t7pP71xN+nnduudn2awA==",
"dev": true,
"license": "ISC",
"engines": {
@@ -4952,16 +4951,6 @@
"integrity": "sha512-msJxIvYDYcoNL+PJsu+7qmpDWsYmAxTY+2TNYXXF0hzBzBk0BMecOqDOG/EckUoKCuKwObfbugIl8QpqHDXeFA==",
"dev": true,
"license": "MIT"
},
"node_modules/zod": {
"version": "4.6.7",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
}
}
}
+5 -3
View File
@@ -1,7 +1,7 @@
{
"name": "bookmarkmagic",
"private": true,
"version": "1.2.1",
"version": "1.3.0",
"type": "module",
"description": "Import, export & edit bookmarks between browsers — offline, no account, no cloud.",
"license": "GPL-3.0-or-later",
@@ -22,7 +22,9 @@
"dev": "wxt",
"dev:firefox": "wxt -b firefox",
"build": "wxt build",
"build:firefox": "wxt build -b firefox",
"zip": "wxt zip",
"zip:firefox": "wxt zip -b firefox",
"check": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings && tsc --noEmit && tsc -p tsconfig.scripts.json",
"lint": "biome check .",
"lint:fix": "biome check --write .",
@@ -35,7 +37,7 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"verify": "npm run lint && npm run check && npm run knip && npm run guard && npm run check:licenses && npm run test",
"verify:full": "npm run verify && npm run coverage && npm run build && npm run check:manifest"
"verify:full": "npm run verify && npm run coverage && npm run build && npm run check:manifest && npm run build:firefox && npm run check:manifest -- --browser firefox"
},
"devDependencies": {
"@biomejs/biome": "2.6.6",
@@ -45,7 +47,7 @@
"@vitest/coverage-v8": "^5.1.0",
"@wxt-dev/module-svelte": "^2.0.5",
"jsdom": "^31.0.0",
"knip": "^6.44.2",
"knip": "^6.45.1",
"svelte": "^5.57.3",
"svelte-check": "^4.7.8",
"typescript": "npm:@typescript/typescript6@~6.0.2",
+7
View File
@@ -40,3 +40,10 @@ exclude:
- name: DuplicatedCode
paths:
- src/styles/tokens.css
# Clean since 2026-11-18 (docs/12 §2.7): any new finding turns this workflow
# red, so it is fixed or switched off here with its reason — never left
# standing to be ignored. Not a required check.
failureConditions:
severityThresholds:
any: 0
+4 -1
View File
@@ -7,7 +7,10 @@ export const TOOLCHAIN_LICENSES: readonly string[];
export const EXCEPTIONS: Readonly<Record<string, string>>;
export function satisfies(expression: string, allowed: readonly string[]): boolean;
export function packageNameOf(key: string): string;
export function checkLockfile(lock: unknown): {
export function checkLockfile(
lock: unknown,
options?: { shipsCode?: boolean },
): {
problems: string[];
checked: number;
counts: Map<string, number>;
+34 -13
View File
@@ -24,7 +24,8 @@
* npm; this gate trusts it, as every lockfile-based checker must. It needs no
* `node_modules` and no network, so it runs before anything is installed.
*
* Usage: node scripts/check-licenses.mjs — reads <repo>/package-lock.json,
* Usage: node scripts/check-licenses.mjs — reads <repo>/package-lock.json and
* <repo>/tools/publish/package-lock.json (the store-upload tool, docs/12 §3),
* resolved from this file. Its tests call `checkLockfile(lock)` directly.
*/
import { readFileSync } from 'node:fs';
@@ -142,10 +143,14 @@ function printable(value) {
/**
* Check every installed package of a v2/v3 lockfile.
*
* @param {unknown} lock — the parsed `package-lock.json`
* @param {unknown} lock - the parsed `package-lock.json`
* @param {{ shipsCode?: boolean }} [options] - `shipsCode: false` for a lockfile
* that builds nothing into the extension (tools/publish), where the credited
* packages are not expected
* @returns {{ problems: string[], checked: number, counts: Map<string, number> }}
*/
export function checkLockfile(lock) {
export function checkLockfile(lock, options = {}) {
const shipsCode = options.shipsCode ?? true;
/** @type {string[]} */
const problems = [];
/** @type {Map<string, number>} */
@@ -181,7 +186,7 @@ export function checkLockfile(lock) {
}
}
for (const name of CREDITED_PACKAGES) {
for (const name of shipsCode ? CREDITED_PACKAGES : []) {
if (!shippedSeen.has(name)) {
problems.push(`${printable(name)}: credited as shipping, but not in the lockfile`);
}
@@ -189,18 +194,34 @@ export function checkLockfile(lock) {
return { problems, checked, counts };
}
/** The lockfiles this repository installs from, and whether each builds the extension. */
const LOCKFILES = [
{ path: 'package-lock.json', shipsCode: true },
{ path: 'tools/publish/package-lock.json', shipsCode: false },
];
/** @returns {number} exit code */
function main() {
const lockPath = resolve(fileURLToPath(import.meta.url), '..', '..', 'package-lock.json');
/** @type {unknown} */
let lock;
try {
lock = JSON.parse(readFileSync(lockPath, 'utf8'));
} catch (cause) {
console.error(`::error::check-licenses: cannot read package-lock.json (${String(cause)})`);
return 1;
const repo = resolve(fileURLToPath(import.meta.url), '..', '..');
/** @type {string[]} */
const problems = [];
let checked = 0;
/** @type {Map<string, number>} */
const counts = new Map();
for (const { path, shipsCode } of LOCKFILES) {
/** @type {unknown} */
let lock;
try {
lock = JSON.parse(readFileSync(resolve(repo, path), 'utf8'));
} catch (cause) {
console.error(`::error::check-licenses: cannot read ${path} (${String(cause)})`);
return 1;
}
const result = checkLockfile(lock, { shipsCode });
for (const problem of result.problems) problems.push(`${path}: ${problem}`);
checked += result.checked;
for (const [license, n] of result.counts) counts.set(license, (counts.get(license) ?? 0) + n);
}
const { problems, checked, counts } = checkLockfile(lock);
if (problems.length > 0) {
for (const problem of problems) console.error(`::error::check-licenses: ${problem}`);
console.error(
+5 -1
View File
@@ -2,4 +2,8 @@
* Types for scripts/check-manifest.mjs, so its tests can call it directly.
* The script itself is plain JavaScript checked with `// @ts-check`.
*/
export function checkExtension(outDir: string): { problems: string[]; readError?: string };
export const TARGETS: Record<string, { dir: string; keys: string[]; label: string }>;
export function checkExtension(
outDir: string,
target?: string,
): { problems: string[]; readError?: string };
+89 -19
View File
@@ -18,10 +18,12 @@
* 3. the bundle: none of the network identifiers `npm run guard` bans in the
* source, anywhere in the shipped JavaScript.
*
* Usage: node scripts/check-manifest.mjs — checks <repo>/.output/chrome-mv3,
* resolved from this file, not the cwd. It takes no arguments on purpose: a
* path from the command line flowed straight into file reads (SonarCloud
* S8707). Its tests call `checkExtension(dir)` directly instead.
* Usage: node scripts/check-manifest.mjs [--browser chrome|firefox] — checks
* <repo>/.output/chrome-mv3 (the default) or <repo>/.output/firefox-mv3 (since
* v1.3.0, docs/08 §9), resolved from this file, not the cwd. It takes no path:
* one from the command line flowed straight into file reads (SonarCloud
* S8707), so `--browser` only picks an entry of a fixed table. Its tests call
* `checkExtension(dir, target)` directly instead.
*/
import { existsSync, readdirSync, readFileSync } from 'node:fs';
import { join, relative, resolve } from 'node:path';
@@ -54,7 +56,10 @@ const EXPECTED_CSP =
*
* Adding a key here is a deliberate act. Check docs/08 §1 first.
*/
const EXPECTED_KEYS = [
/** @param {string} a @param {string} b */
const byName = (a, b) => a.localeCompare(b, 'en');
const COMMON_KEYS = [
'action',
'content_security_policy',
'default_locale',
@@ -62,13 +67,57 @@ const EXPECTED_KEYS = [
'homepage_url',
'icons',
'manifest_version',
'minimum_chrome_version',
'name',
'options_ui',
'permissions',
'version',
];
/**
* Firefox's block, exactly (docs/08 §9). The id is permanent once on AMO; the
* floor is the first Firefox that accepts `data_collection_permissions`.
*/
const FIREFOX_SETTINGS = {
gecko: {
id: 'bookmarkmagic@poli0981.dev',
strict_min_version: '140.0',
data_collection_permissions: { required: ['none'] },
},
};
/**
* The two packages (docs/08 §1): where each is built, its exact key set, and
* how its floor reads in the log. Edge Add-ons takes the Chrome package.
*
* @type {Record<string, { dir: string, keys: string[], label: string }>}
*/
export const TARGETS = {
chrome: {
dir: 'chrome-mv3',
keys: [...COMMON_KEYS, 'minimum_chrome_version'].sort(byName),
label: `Chrome ≥${CHROME_FLOOR}`,
},
firefox: {
dir: 'firefox-mv3',
keys: [...COMMON_KEYS, 'browser_specific_settings'].sort(byName),
label: 'Firefox ≥140, gecko id pinned',
},
};
/**
* A value's JSON with object keys sorted, so key order never decides equality.
* @param {unknown} value
* @returns {string}
*/
function canonical(value) {
if (Array.isArray(value)) return `[${value.map(canonical).join(',')}]`;
if (value !== null && typeof value === 'object') {
const entries = Object.entries(value).sort(([a], [b]) => byName(a, b));
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonical(v)}`).join(',')}}`;
}
return JSON.stringify(value) ?? 'undefined';
}
/** Keys that would widen the extension's reach. None may be present. */
const FORBIDDEN_KEYS = [
'host_permissions',
@@ -110,9 +159,6 @@ const NETWORK_IN_BUNDLE =
/** `src`/`href` values in a built page. Vite writes them double-quoted. */
const PAGE_REFS = /\b(?:src|href)="([^"]*)"/g;
/** @param {string} a @param {string} b */
const byName = (a, b) => a.localeCompare(b, 'en');
/** @param {string} dir @returns {string[]} */
function listFiles(dir) {
return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
@@ -133,8 +179,13 @@ function readManifest(outDir) {
}
}
/** @param {Record<string, unknown>} manifest @param {string[]} problems */
function checkManifest(manifest, problems) {
/**
* @param {Record<string, unknown>} manifest
* @param {string[]} problems
* @param {string} target - a key of TARGETS
*/
function checkManifest(manifest, problems, target) {
const expectedKeys = TARGETS[target]?.keys ?? [];
if (manifest.manifest_version !== 3) {
problems.push(`manifest_version is ${manifest.manifest_version}, expected 3`);
}
@@ -152,14 +203,20 @@ function checkManifest(manifest, problems) {
}
const actualKeys = Object.keys(manifest);
const unexpected = actualKeys.filter((key) => !EXPECTED_KEYS.includes(key)).sort(byName);
const missing = EXPECTED_KEYS.filter((key) => !actualKeys.includes(key));
const unexpected = actualKeys.filter((key) => !expectedKeys.includes(key)).sort(byName);
const missing = expectedKeys.filter((key) => !actualKeys.includes(key));
if (unexpected.length > 0) {
problems.push(`unexpected top-level key(s): ${unexpected.join(', ')} — see docs/08 §1`);
}
if (missing.length > 0) problems.push(`missing expected top-level key(s): ${missing.join(', ')}`);
if (manifest.minimum_chrome_version !== CHROME_FLOOR) {
if (target === 'firefox') {
if (canonical(manifest.browser_specific_settings) !== canonical(FIREFOX_SETTINGS)) {
problems.push(
`browser_specific_settings is ${JSON.stringify(manifest.browser_specific_settings)}, expected exactly ${JSON.stringify(FIREFOX_SETTINGS)} (docs/08 §9)`,
);
}
} else if (manifest.minimum_chrome_version !== CHROME_FLOOR) {
problems.push(
`minimum_chrome_version is ${JSON.stringify(manifest.minimum_chrome_version)}, expected "${CHROME_FLOOR}" (docs/01 §1)`,
);
@@ -235,15 +292,19 @@ function checkBundle(outDir, problems) {
* Check one built extension directory.
*
* @param {string} outDir
* @param {string} [target] - a key of TARGETS; `chrome` when omitted
* @returns {{ problems: string[], readError?: string }} no problems and no read
* error means the build is clean
*/
export function checkExtension(outDir) {
export function checkExtension(outDir, target = 'chrome') {
if (!Object.hasOwn(TARGETS, target)) {
return { problems: [], readError: `unknown target "${target}"` };
}
const manifest = readManifest(outDir);
if (typeof manifest === 'string') return { problems: [], readError: manifest };
/** @type {string[]} */
const problems = [];
checkManifest(manifest, problems);
checkManifest(manifest, problems, target);
checkInventory(outDir, manifest, problems);
checkBundle(outDir, problems);
return { problems };
@@ -251,10 +312,19 @@ export function checkExtension(outDir) {
/** @returns {number} the exit code */
function main() {
const flag = process.argv.indexOf('--browser');
const target = flag === -1 ? 'chrome' : (process.argv[flag + 1] ?? '');
const profile = Object.hasOwn(TARGETS, target) ? TARGETS[target] : undefined;
if (profile === undefined) {
console.error(`check-manifest: --browser must be one of ${Object.keys(TARGETS).join(', ')}`);
return 1;
}
const repo = resolve(fileURLToPath(new URL('..', import.meta.url)));
const { problems, readError } = checkExtension(join(repo, '.output', 'chrome-mv3'));
// The directory comes from the table, never from the command line.
const { problems, readError } = checkExtension(join(repo, '.output', profile.dir), target);
if (readError !== undefined) {
console.error(`check-manifest: ${readError} — run \`npm run build\` first.`);
const build = target === 'chrome' ? 'npm run build' : `npm run build:${target}`;
console.error(`check-manifest: ${readError} — run \`${build}\` first.`);
return 1;
}
if (problems.length > 0) {
@@ -268,7 +338,7 @@ function main() {
// Constants only: the manifest has just passed every check, so its values ARE
// these — and nothing read from a file is echoed into the log.
console.warn(
`check-manifest: clean — MV3, permissions exactly ${ALLOWED_PERMISSIONS.join(' + ')}, Chrome ≥${CHROME_FLOOR}, CSP pinned, inventory complete, no network API in the bundle.`,
`check-manifest: clean (${target}) — MV3, permissions exactly ${ALLOWED_PERMISSIONS.join(' + ')}, ${profile.label}, CSP pinned, inventory complete, no network API in the bundle.`,
);
return 0;
}
+5 -15
View File
@@ -2,6 +2,7 @@
import { onMount } from 'svelte';
import { getAppVersion } from '@/lib/browser/app-info';
import { getRootChildren } from '@/lib/browser/bookmarks';
import { countLive } from '@/lib/browser/live-tree';
import { type ManagerRoute, openManager } from '@/lib/browser/open-manager';
import Icon, { type IconName } from '@/lib/components/icons/Icon.svelte';
import { num, t, tPlural } from '@/lib/i18n/index.svelte';
@@ -27,21 +28,10 @@
*/
async function countTree(): Promise<void> {
try {
let bookmarks = 0;
let folders = 0;
const stack: { url?: string; children?: unknown[] }[] = [];
for (const root of await getRootChildren()) {
// A loop, not push(...spread): Other Bookmarks can hold 100k children.
for (const child of root.children ?? []) stack.push(child);
}
while (stack.length > 0) {
const node = stack.pop();
if (node === undefined) break;
if (node.url === undefined) folders++;
else bookmarks++;
// SAFETY: children of a LiveNode are LiveNodes, which have this shape.
for (const child of (node.children ?? []) as typeof stack) stack.push(child);
}
// Inside the roots, separators (Firefox) apart: a separator's url is
// "data:", and counting by url called every one a bookmark.
const inside = (await getRootChildren()).flatMap((root) => root.children ?? []);
const { bookmarks, folders } = countLive(inside);
counts = { bookmarks, folders };
} catch {
counts = undefined;
+9
View File
@@ -25,6 +25,15 @@ export function getAppVersion(): string {
}
}
/** This install's extension id, or `''` when it cannot be read. Never throws. */
export function getExtensionId(): string {
try {
return browser.runtime.id;
} catch {
return '';
}
}
/**
* The `generator` string written into exported and backup BM JSON.
*
+36 -187
View File
@@ -3,60 +3,20 @@
*
* Purpose: the single audited surface where the extension talks to the
* bookmarks API. Components never call `chrome.*` directly.
* Inputs / guarantees: raw rejections are mapped to `BmBrowserError`; the live
* tree is converted into the pure `BookmarkNode` file model here, including
* the millisecond→second conversion (`chrome.bookmarks` reports `dateAdded`
* in ms; `BookmarkNode.addDate` is seconds — docs/05 §4).
* Inputs / guarantees: raw rejections are mapped to `BmBrowserError`. The
* pure half — the node shape, separators, counts and the conversion into the
* `BookmarkNode` file model — is `live-tree.ts`; which folders are the roots
* is `roots.ts`. Firefox's API differs from Chromium's in ways this file
* absorbs (docs/02 §4): its move index (below) and its missing events.
*/
import { browser } from 'wxt/browser';
import type { BookmarkNode } from '../core/model';
import { millisToSeconds } from '../core/timestamps';
import { BmAborted, BmBrowserError, BmEnvError, BmPartialWrite } from './errors';
import { BmAborted, BmBrowserError, BmPartialWrite } from './errors';
import { type LiveNode, type MoveDestination, type MoveIndexRule, moveIndexFor } from './live-tree';
/** The live-tree node. Unlike `BookmarkNode` it carries browser identity. */
export interface LiveNode {
id: string;
parentId?: string;
index?: number;
title: string;
url?: string;
dateAdded?: number;
dateGroupModified?: number;
/** Set by Chrome on policy-managed nodes; such nodes reject writes. */
unmodifiable?: string;
/**
* Chrome 134+: which permanent folder a root is ('bookmarks-bar', 'other',
* 'mobile', 'managed'), and whether it is in the signed-in account's storage
* rather than this device's. Both exist from the 136 floor up.
*/
folderType?: string;
syncing?: boolean;
children?: LiveNode[];
}
export interface BookmarkRoots {
/** Bookmarks Bar. */
toolbarId: string;
/** Other Bookmarks. */
otherId: string;
/** Mobile Bookmarks, when the profile has one. */
mobileId: string | undefined;
/** The same three roots as nodes, children included — Merge matches inside them. */
toolbar: LiveNode;
other: LiveNode;
mobile: LiveNode | undefined;
/** Writable top-level folders, in tree order, excluding managed ones. */
writable: LiveNode[];
/**
* The roots Replace backs up and empties: exactly the destinations above.
* Never an account-storage root this import does not write back into —
* deleting one would sync the deletion to every device, and the restore
* would land its bookmarks in local storage.
*/
replaceable: LiveNode[];
/** Every top-level folder, managed ones included — what "already in this browser" means. */
all: LiveNode[];
}
// The node shape and the move-index rule live with the pure helpers
// (live-tree.ts); re-exported so the adapter stays the one import for code
// that talks to the browser.
export type { LiveNode, MoveDestination } from './live-tree';
async function guard<T>(operation: string, run: () => Promise<T>): Promise<T> {
try {
@@ -72,139 +32,6 @@ export async function getRootChildren(): Promise<LiveNode[]> {
return (tree[0]?.children ?? []) as LiveNode[];
}
const FOLDER_IDS = { 'bookmarks-bar': '1', other: '2', mobile: '3' } as const;
/**
* Desktop Chrome leaves an EMPTY Mobile root out of `getTree()`, so a restore
* into a fresh profile found no Mobile root and nested those bookmarks under
* Other. The node still exists, and accepts writes; ask for it by id.
*/
async function hiddenMobileRoot(): Promise<LiveNode | undefined> {
try {
const [node] = (await browser.bookmarks.get(FOLDER_IDS.mobile)) as LiveNode[];
const usable =
node !== undefined &&
node.url === undefined &&
node.unmodifiable === undefined &&
node.syncing !== true &&
(node.folderType === undefined || node.folderType === 'mobile');
return usable ? { ...node, children: node.children ?? [] } : undefined;
} catch {
return undefined;
}
}
/**
* Resolve the destination roots.
*
* By `folderType` first — Chrome 134+ can list a signed-in account's own bar,
* Other and Mobile beside this device's, and the old by-id-then-by-position
* rule mixed the two sets up. This device's roots are the destinations;
* account roots are never written to or emptied. The ids "1"/"2"/"3" and then
* position remain as fallbacks for a browser without `folderType`. Nodes
* carrying `unmodifiable` (the enterprise "Managed bookmarks" folder) are
* excluded everywhere — writing to or removing them rejects.
*/
export async function getRoots(): Promise<BookmarkRoots> {
const children = await getRootChildren();
const writable = children.filter((node) => node.unmodifiable === undefined);
const local = writable.filter((node) => node.syncing !== true);
const typed = local.some((node) => node.folderType !== undefined);
const pick = (type: keyof typeof FOLDER_IDS): LiveNode | undefined =>
local.find((node) => node.folderType === type) ??
local.find((node) => node.id === FOLDER_IDS[type]);
const toolbar = pick('bookmarks-bar') ?? (typed ? undefined : local[0]);
const other = pick('other') ?? (typed ? undefined : local.find((n) => n !== toolbar));
const mobile =
pick('mobile') ??
(typed ? undefined : local.find((n) => n !== toolbar && n !== other)) ??
(await hiddenMobileRoot());
if (toolbar === undefined || other === undefined) {
// Not a BmBrowserError: nothing refused anything. Every root this profile
// has is policy-managed, so there is nowhere an extension may write, and
// "the browser refused a bookmark operation" would be actively misleading.
throw new BmEnvError('NO_WRITABLE_ROOTS', `${children.length} root(s), none writable`);
}
return {
toolbarId: toolbar.id,
otherId: other.id,
mobileId: mobile?.id,
toolbar,
other,
mobile,
writable,
replaceable: mobile === undefined ? [toolbar, other] : [toolbar, other, mobile],
all: children,
};
}
export interface ToNodesOptions {
/**
* Id of the Bookmarks Bar. The matching node is marked `toolbar: true`.
*
* Without this the marker is lost, and re-importing the file (including the
* Replace safety backup) lands the entire toolbar under Other Bookmarks —
* `03 §1` routes purely on that flag.
*/
toolbarId?: string;
/**
* Ids of Other and Mobile Bookmarks, marked `root: 'other'`/`'mobile'` for
* the same reason: without them a restore nested both one level too deep.
*/
otherId?: string;
mobileId?: string;
}
/** The marker ids for a whole-tree conversion — what an export or backup passes. */
export function rootMarkersOf(roots: BookmarkRoots): ToNodesOptions {
return {
toolbarId: roots.toolbarId,
otherId: roots.otherId,
...(roots.mobileId !== undefined && { mobileId: roots.mobileId }),
};
}
function markerOf(id: string, options: ToNodesOptions): Pick<BookmarkNode, 'toolbar' | 'root'> {
if (id === options.toolbarId) return { toolbar: true };
if (id === options.otherId) return { root: 'other' };
if (id === options.mobileId) return { root: 'mobile' };
return {};
}
/** Convert the live tree into the pure file model (ms → s, ids dropped). */
export function toBookmarkNodes(
nodes: readonly LiveNode[],
options: ToNodesOptions = {},
): BookmarkNode[] {
return nodes.map((node) => {
const addDate = millisToSeconds(node.dateAdded);
const isFolderNode = node.url === undefined;
// dateGroupModified is a FOLDER field — Chrome does not set it on
// bookmarks, and our HTML serializer only emits LAST_MODIFIED on <H3>.
const lastModified = isFolderNode ? millisToSeconds(node.dateGroupModified) : undefined;
return {
title: node.title,
...(node.url !== undefined && { url: node.url }),
...(addDate !== undefined && { addDate }),
...(lastModified !== undefined && { lastModified }),
...(isFolderNode && markerOf(node.id, options)),
...(isFolderNode && { children: toBookmarkNodes(node.children ?? [], options) }),
};
});
}
/** Flatten a live tree, parents before children. Used by dedupe and #edit. */
export function flattenLive(nodes: readonly LiveNode[], into: LiveNode[] = []): LiveNode[] {
for (const node of nodes) {
into.push(node);
if (node.children !== undefined) flattenLive(node.children, into);
}
return into;
}
/** The current children of one folder — what a bulk command re-plans from. */
export async function getChildren(id: string): Promise<LiveNode[]> {
return (await guard('bookmarks.getChildren', () =>
@@ -226,11 +53,33 @@ export async function update(id: string, changes: { title?: string; url?: string
await guard('bookmarks.update', () => browser.bookmarks.update(id, changes));
}
const MOVE_INDEX_RULE: MoveIndexRule = import.meta.env.FIREFOX ? 'firefox' : 'chromium';
/**
* The longest address this browser accepts in a bookmark, or `undefined` for
* none. Firefox refuses anything over 65 536 characters (Places'
* `MAX_URL_LENGTH`) — mid-write, so the import drops such addresses up front
* (docs/04 §1.2); Chromium has no limit an import can reach.
*/
export const MAX_URL_LENGTH: number | undefined = import.meta.env.FIREFOX ? 65_536 : undefined;
/**
* Move a node. Resolves to the index the browser says the node now has, which
* the caller compares with `position.local` — a disagreement means the tree on
* screen no longer matches the browser's, and it is re-read (docs/03 §3).
*/
export async function move(
id: string,
destination: { parentId?: string; index?: number },
): Promise<void> {
await guard('bookmarks.move', () => browser.bookmarks.move(id, destination));
destination: MoveDestination,
rule: MoveIndexRule = MOVE_INDEX_RULE,
): Promise<number | undefined> {
const { parentId, position } = destination;
const details = {
...(parentId !== undefined && { parentId }),
...(position !== undefined && { index: moveIndexFor(position, rule) }),
};
const moved = await guard('bookmarks.move', () => browser.bookmarks.move(id, details));
return (moved as { index?: number } | undefined)?.index;
}
/** Remove a single bookmark. Folders need `removeTree`. */
+20 -6
View File
@@ -102,14 +102,28 @@ export interface DiagnosticsContext {
theme: string;
}
/**
* The browser and its major version from the user agent: "Firefox 160",
* "Edge 142", "Chrome 142", or "unknown". Edge's agent also says Chrome, so it
* is read first. Since v1.3.0 — until then the report carried `chromeMajor`,
* which said "unknown" on Firefox.
*/
export function browserOf(userAgent: string): string {
for (const [name, pattern] of [
['Firefox', /Firefox\/(\d+)/],
['Edge', /Edg\/(\d+)/],
['Chrome', /Chrome\/(\d+)/],
] as const) {
const major = pattern.exec(userAgent)?.[1];
if (major !== undefined) return `${name} ${major}`;
}
return 'unknown';
}
/** The report the About tab copies: context first, then the events, oldest first. */
export function snapshot(context: DiagnosticsContext): string {
const chrome = /Chrome\/(\d+)/.exec(globalThis.navigator?.userAgent ?? '')?.[1] ?? 'unknown';
return JSON.stringify(
{ app: 'BookmarkMagic', ...context, chromeMajor: chrome, events: entries },
null,
2,
);
const browser = browserOf(globalThis.navigator?.userAgent ?? '');
return JSON.stringify({ app: 'BookmarkMagic', ...context, browser, events: entries }, null, 2);
}
/** Test teardown — module state outlives a single `it()`. */
+173
View File
@@ -0,0 +1,173 @@
/**
* The live bookmark tree as the browser reports it — docs/02 §4.
*
* Purpose: the pure half of the bookmarks adapter — the node shape, Firefox's
* separators, the counts, and the conversion into the file model. No
* browser call lives here, so every line is tested directly.
* Guarantees: separators are recognised by `type` alone. Firefox gives them
* `url: "data:"`, so every "has a url, so it is a bookmark" test in the code
* would otherwise count, export, dedupe and open them as bookmarks.
*/
import type { BookmarkNode } from '../core/model';
import { millisToSeconds } from '../core/timestamps';
/** The live-tree node. Unlike `BookmarkNode` it carries browser identity. */
export interface LiveNode {
id: string;
parentId?: string;
index?: number;
title: string;
url?: string;
dateAdded?: number;
dateGroupModified?: number;
/** Set by Chrome on policy-managed nodes; such nodes reject writes. */
unmodifiable?: string;
/**
* Chrome 134+: which permanent folder a root is ('bookmarks-bar', 'other',
* 'mobile', 'managed'), and whether it is in the signed-in account's storage
* rather than this device's. Both exist from the 136 floor up; Firefox has
* neither.
*/
folderType?: string;
syncing?: boolean;
/** Firefox: 'bookmark', 'folder' or 'separator'. Chromium does not send it. */
type?: string;
children?: LiveNode[];
}
/** A Firefox separator. By `type`, never by url: a separator's url is "data:". */
export function isSeparator(node: { type?: string }): boolean {
return node.type === 'separator';
}
/**
* The forest without its separators — for everything that reads bookmarks as
* bookmarks (the dedupe index, Merge's folder matching). Untouched branches
* are returned as they are.
*/
export function withoutSeparators(nodes: readonly LiveNode[]): LiveNode[] {
const out: LiveNode[] = [];
for (const node of nodes) {
if (isSeparator(node)) continue;
out.push(
node.children === undefined ? node : { ...node, children: withoutSeparators(node.children) },
);
}
return out;
}
export interface LiveCounts {
bookmarks: number;
folders: number;
/** Firefox only; always 0 in a Chromium browser. */
separators: number;
}
/**
* Count what a forest holds, separators apart. Iterative: Other Bookmarks can
* hold 100k children, and the live tree has no depth cap.
*/
export function countLive(nodes: readonly LiveNode[]): LiveCounts {
const counts: LiveCounts = { bookmarks: 0, folders: 0, separators: 0 };
const stack: LiveNode[] = [];
for (const node of nodes) stack.push(node);
while (stack.length > 0) {
const node = stack.pop();
if (node === undefined) break;
if (isSeparator(node)) counts.separators++;
else if (node.url === undefined) counts.folders++;
else counts.bookmarks++;
for (const child of node.children ?? []) stack.push(child);
}
return counts;
}
export interface ToNodesOptions {
/**
* Id of the Bookmarks Bar. The matching node is marked `toolbar: true`.
*
* Without this the marker is lost, and re-importing the file (including the
* Replace safety backup) lands the entire toolbar under Other Bookmarks —
* `03 §1` routes purely on that flag.
*/
toolbarId?: string;
/**
* Ids of Other and Mobile Bookmarks, and of Firefox's Bookmarks Menu,
* marked `root: 'other'`/`'mobile'`/`'menu'` for the same reason: without
* them a restore nested each one level too deep.
*/
otherId?: string;
mobileId?: string;
menuId?: string;
}
function markerOf(id: string, options: ToNodesOptions): Pick<BookmarkNode, 'toolbar' | 'root'> {
if (id === options.toolbarId) return { toolbar: true };
if (id === options.otherId) return { root: 'other' };
if (id === options.mobileId) return { root: 'mobile' };
if (id === options.menuId) return { root: 'menu' };
return {};
}
/**
* Convert the live tree into the pure file model (ms → s, ids dropped).
* Separators are left out: no format BookmarkMagic writes can hold one
* (docs/04).
*/
export function toBookmarkNodes(
nodes: readonly LiveNode[],
options: ToNodesOptions = {},
): BookmarkNode[] {
const out: BookmarkNode[] = [];
for (const node of nodes) {
if (isSeparator(node)) continue;
const addDate = millisToSeconds(node.dateAdded);
const isFolderNode = node.url === undefined;
// dateGroupModified is a FOLDER field — Chrome does not set it on
// bookmarks, and our HTML serializer only emits LAST_MODIFIED on <H3>.
const lastModified = isFolderNode ? millisToSeconds(node.dateGroupModified) : undefined;
out.push({
title: node.title,
...(node.url !== undefined && { url: node.url }),
...(addDate !== undefined && { addDate }),
...(lastModified !== undefined && { lastModified }),
...(isFolderNode && markerOf(node.id, options)),
...(isFolderNode && { children: toBookmarkNodes(node.children ?? [], options) }),
});
}
return out;
}
/**
* How a browser counts `bookmarks.move`'s index for a move inside one folder
* (docs/05 §10). Chromium counts as if the node were still in place; Firefox
* counts after removing it, because Places stores the final position. Moving
* `a` after `c` in `[a, b, c]` is index 3 in Chrome and 2 in Firefox — and
* sending Chrome's number to Firefox made every rightward drag land one place
* too far and Alt+↓ move two places.
*/
export type MoveIndexRule = 'chromium' | 'firefox';
/** Where a node goes: a folder, and optionally a place in it counted both ways (`planDrop`). */
export interface MoveDestination {
parentId?: string;
/** `api` counted before the node's removal (Chromium's rule), `local` after it. */
position?: { api: number; local: number };
}
/** The index to send under a browser's rule. */
export function moveIndexFor(
position: { api: number; local: number },
rule: MoveIndexRule,
): number {
return rule === 'firefox' ? position.local : position.api;
}
/** Flatten a live tree, parents before children. Used by dedupe and #edit. */
export function flattenLive(nodes: readonly LiveNode[], into: LiveNode[] = []): LiveNode[] {
for (const node of nodes) {
into.push(node);
if (node.children !== undefined) flattenLive(node.children, into);
}
return into;
}
+139
View File
@@ -0,0 +1,139 @@
/**
* Which live folders are the browser's permanent roots — docs/02 §4.
*
* Purpose: find the import's destinations — the bar, Other, Mobile, and on
* Firefox the Bookmarks Menu — in whatever browser this runs in.
* Guarantees: this device's roots only (a signed-in Chrome account's own roots
* are listed but never written to or emptied); policy-managed roots never;
* and on Firefox the Menu is never mistaken for the bar.
*/
import { browser } from 'wxt/browser';
import { getRootChildren } from './bookmarks';
import { BmEnvError } from './errors';
import type { LiveNode, ToNodesOptions } from './live-tree';
export interface BookmarkRoots {
/** Bookmarks Bar. */
toolbarId: string;
/** Other Bookmarks. */
otherId: string;
/** Mobile Bookmarks, when the profile has one. */
mobileId: string | undefined;
/** Firefox's Bookmarks Menu. No Chromium browser has one. */
menuId: string | undefined;
/** The same roots as nodes, children included — Merge matches inside them. */
toolbar: LiveNode;
other: LiveNode;
mobile: LiveNode | undefined;
menu: LiveNode | undefined;
/** Writable top-level folders, in tree order, excluding managed ones. */
writable: LiveNode[];
/**
* The roots Replace backs up and empties: exactly the destinations above.
* Never an account-storage root this import does not write back into —
* deleting one would sync the deletion to every device, and the restore
* would land its bookmarks in local storage.
*/
replaceable: LiveNode[];
/** Every top-level folder, managed ones included — what "already in this browser" means. */
all: LiveNode[];
}
/** Chromium's stable ids for the three permanent folders. */
const CHROMIUM_IDS = { 'bookmarks-bar': '1', other: '2', mobile: '3' } as const;
/** Firefox's permanent folders — Places GUIDs, the same in every profile. */
const FIREFOX_IDS = {
'bookmarks-bar': 'toolbar_____',
other: 'unfiled_____',
mobile: 'mobile______',
} as const;
const FIREFOX_MENU_ID = 'menu________';
/**
* Desktop Chrome leaves an EMPTY Mobile root out of `getTree()`, so a restore
* into a fresh profile found no Mobile root and nested those bookmarks under
* Other. The node still exists, and accepts writes; ask for it by id. (Firefox
* always lists its Mobile root, and rejects the id "3" — caught here.)
*/
async function hiddenMobileRoot(): Promise<LiveNode | undefined> {
try {
const [node] = (await browser.bookmarks.get(CHROMIUM_IDS.mobile)) as LiveNode[];
const usable =
node !== undefined &&
node.url === undefined &&
node.unmodifiable === undefined &&
node.syncing !== true &&
(node.folderType === undefined || node.folderType === 'mobile');
return usable ? { ...node, children: node.children ?? [] } : undefined;
} catch {
return undefined;
}
}
/**
* Resolve the destination roots.
*
* By `folderType` first — Chrome 134+ can list a signed-in account's own bar,
* Other and Mobile beside this device's, and the old by-id-then-by-position
* rule mixed the two sets up. Then the stable Chromium ids, then Firefox's
* GUIDs, and position last. The Bookmarks Menu is never a candidate for a
* position: Firefox lists it first, and until v1.3.0 the position fallback
* took it for the bar — Replace would have emptied the Menu and the toolbar
* and restored the bar's bookmarks into the Menu. Nodes carrying
* `unmodifiable` (the enterprise "Managed bookmarks" folder) are excluded
* everywhere — writing to or removing them rejects.
*/
export async function getRoots(): Promise<BookmarkRoots> {
const children = await getRootChildren();
const writable = children.filter((node) => node.unmodifiable === undefined);
const local = writable.filter((node) => node.syncing !== true);
const typed = local.some((node) => node.folderType !== undefined);
const menu = local.find((node) => node.id === FIREFOX_MENU_ID);
const positional = local.filter((node) => node !== menu);
const pick = (type: keyof typeof CHROMIUM_IDS): LiveNode | undefined =>
local.find((node) => node.folderType === type) ??
local.find((node) => node.id === CHROMIUM_IDS[type]) ??
local.find((node) => node.id === FIREFOX_IDS[type]);
const toolbar = pick('bookmarks-bar') ?? (typed ? undefined : positional[0]);
const other = pick('other') ?? (typed ? undefined : positional.find((n) => n !== toolbar));
const mobile =
pick('mobile') ??
(typed ? undefined : positional.find((n) => n !== toolbar && n !== other)) ??
(await hiddenMobileRoot());
if (toolbar === undefined || other === undefined) {
// Not a BmBrowserError: nothing refused anything. Every root this profile
// has is policy-managed, so there is nowhere an extension may write, and
// "the browser refused a bookmark operation" would be actively misleading.
throw new BmEnvError('NO_WRITABLE_ROOTS', `${children.length} root(s), none writable`);
}
const replaceable = [toolbar, other];
if (mobile !== undefined) replaceable.push(mobile);
if (menu !== undefined) replaceable.push(menu);
return {
toolbarId: toolbar.id,
otherId: other.id,
mobileId: mobile?.id,
menuId: menu?.id,
toolbar,
other,
mobile,
menu,
writable,
replaceable,
all: children,
};
}
/** The marker ids for a whole-tree conversion — what an export or backup passes. */
export function rootMarkersOf(roots: BookmarkRoots): ToNodesOptions {
return {
toolbarId: roots.toolbarId,
otherId: roots.otherId,
...(roots.mobileId !== undefined && { mobileId: roots.mobileId }),
...(roots.menuId !== undefined && { menuId: roots.menuId }),
};
}
+6 -3
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import { getAppVersion } from '../browser/app-info';
import { getAppVersion, getExtensionId } from '../browser/app-info';
import { dateTime, t } from '../i18n/index.svelte';
import {
ACCESSIBILITY_URL,
@@ -8,7 +8,7 @@
ISSUES_URL,
LEGAL_URLS,
REPO_URL,
STORE_URL,
storeUrlFor,
} from '../links';
import { copyToClipboard } from '../browser/clipboard';
import { snapshot } from '../browser/diagnostics';
@@ -19,6 +19,9 @@
import Icon from './icons/Icon.svelte';
const version = getAppVersion();
// The listing this copy came from (docs/06 §3.5): AMO for the Firefox build,
// the Chrome Web Store for its own id, the install page for anything else.
const storeUrl = storeUrlFor({ firefox: import.meta.env.FIREFOX, extensionId: getExtensionId() });
const acceptance = $derived(getAcceptance());
// undefined when acceptedAt is missing or unparseable — storage coerces a
// missing timestamp to '', and formatting that would throw inside the render.
@@ -60,7 +63,7 @@
{t('about.accessibility')}<Icon name="external" size={12} />
</a>
</li>
<li><a href={STORE_URL} target="_blank" rel="noopener noreferrer">{t('about.store')}<Icon name="external" size={12} /></a></li>
<li><a href={storeUrl} target="_blank" rel="noopener noreferrer">{t('about.store')}<Icon name="external" size={12} /></a></li>
</ul>
<h2 class="eyebrow">{t('about.thirdParty')}</h2>
+5 -1
View File
@@ -1,5 +1,6 @@
<script lang="ts">
import type { LiveNode } from '../browser/bookmarks';
import { isSeparator } from '../browser/live-tree';
import type { CheckState } from '../core/select';
import { num, t, tPlural } from '../i18n/index.svelte';
import Disclosure from './Disclosure.svelte';
@@ -24,7 +25,10 @@
/** Only folders are pickable — a bookmark travels with its parent. */
const folders = $derived((node.children ?? []).filter((child) => child.url === undefined));
const bookmarks = $derived((node.children ?? []).filter((child) => child.url !== undefined).length);
// A Firefox separator has a url ("data:") but is not a bookmark (docs/02 §4).
const bookmarks = $derived(
(node.children ?? []).filter((child) => child.url !== undefined && !isSeparator(child)).length,
);
const shown = $derived(folders.length > limit ? folders.slice(0, limit) : folders);
let input: HTMLInputElement | undefined = $state();
+13 -5
View File
@@ -191,11 +191,19 @@
open={confirmingReplace}
danger
title={t('import.replaceConfirmTitle')}
body={t('import.replaceConfirmBody', {
current: counts(prepared?.current.bookmarks ?? 0, prepared?.current.folders ?? 0),
incoming: counts(forecast?.stats.bookmarkCount ?? 0, forecast?.stats.folderCount ?? 0),
name: session.filename,
})}
body={[
t('import.replaceConfirmBody', {
current: counts(prepared?.current.bookmarks ?? 0, prepared?.current.folders ?? 0),
incoming: counts(forecast?.stats.bookmarkCount ?? 0, forecast?.stats.folderCount ?? 0),
name: session.filename,
}),
// Firefox only: separators go with the rest, and nothing brings them back.
(prepared?.current.separators ?? 0) > 0
? tPlural('import.replaceSeparators', prepared?.current.separators ?? 0)
: '',
]
.filter((sentence) => sentence !== '')
.join(' ')}
confirmLabel={t('import.replaceConfirm')}
cancelLabel={t('common.cancel')}
onconfirm={() => void start(session.filename)}
+36 -12
View File
@@ -110,18 +110,27 @@
onfocus={onFocus}
>
{#each shown as row (row.node.id)}
<li
id="node-{row.node.id}"
data-node-id={row.node.id}
role="treeitem"
aria-level={row.depth}
aria-setsize={row.setSize}
aria-posinset={row.posInSet}
aria-expanded={row.expandable ? row.expanded : undefined}
aria-selected={session.focusedId === row.node.id}
>
<TreeRow {row} {session} {onopen} {oncopy} {onsort} />
</li>
{#if row.node.separator === true}
<!-- A Firefox separator (docs/06 §5): a line, and aria-hidden, so it is
outside the accessibility tree and the tree still owns only
treeitems. It takes no focus and no drop. -->
<li class="separator" aria-hidden="true" style:--depth={row.depth - 1}>
<span class="rule"></span>
</li>
{:else}
<li
id="node-{row.node.id}"
data-node-id={row.node.id}
role="treeitem"
aria-level={row.depth}
aria-setsize={row.setSize}
aria-posinset={row.posInSet}
aria-expanded={row.expandable ? row.expanded : undefined}
aria-selected={session.focusedId === row.node.id}
>
<TreeRow {row} {session} {onopen} {oncopy} {onsort} />
</li>
{/if}
{/each}
</ul>
@@ -156,6 +165,21 @@
overflow: auto;
}
/* Indented like a row: 18px per level, plus the row's own inset and a
disclosure-sized gap, so the line starts where its siblings' titles do. */
.separator {
display: flex;
align-items: center;
height: 12px;
padding-left: calc(var(--depth) * 18px + var(--sp-1) + 18px);
padding-right: var(--sp-2);
}
.separator .rule {
flex: 1;
border-top: 1px solid var(--border-strong);
}
.tree:focus-visible {
outline: 2px solid var(--accent);
outline-offset: -2px;
+5 -1
View File
@@ -36,7 +36,11 @@
? 'unfiled'
: node.root === 'mobile'
? 'mobile'
: undefined,
: // Only Firefox has a Bookmarks Menu to unwrap into; elsewhere a
// menu folder stays a folder, so it gets no pill (docs/03 §1).
node.root === 'menu' && import.meta.env.FIREFOX
? 'menu'
: undefined,
);
</script>
+3 -1
View File
@@ -28,6 +28,8 @@
const focused = $derived(session.focusedId === node.id);
const renaming = $derived(session.renamingId === node.id && editable);
const domain = $derived(hostOf(node.url));
// Bookmarks and folders only: a Firefox separator is not an item (docs/03 §3).
const itemCount = $derived((node.children ?? []).filter((c) => c.separator !== true).length);
const blocked = $derived(!isFolder && isBlockedUrl(node.url));
/** Which part of this row a drag is over, when the drop there is legal. */
@@ -118,7 +120,7 @@
{:else}
<span class="title" class:untitled={node.title === ''}>{node.title === '' ? (node.url ?? '') : node.title}</span>
{#if domain !== ''}<span class="domain">{domain}</span>{/if}
{#if isFolder}<span class="count">{node.children?.length ?? 0}</span>{/if}
{#if isFolder}<span class="count">{itemCount}</span>{/if}
{#if blocked}
<!-- docs/09 T3: a javascript:/data: bookmark must not look like an
ordinary link that merely does nothing when clicked. -->
+41
View File
@@ -8,6 +8,8 @@
* censor; they are never rendered as links).
*/
import { type BookmarkNode, computeStats, isFolder, type ParseResult } from './model';
export type HrefVerdict = 'ok' | 'missing' | 'invalid' | 'place-query';
/**
@@ -31,3 +33,42 @@ export function classifyHref(raw: string | null | undefined): HrefVerdict {
if (/^place:/i.test(trimmed)) return 'place-query';
return 'ok';
}
/** Bookmarks under `nodes` whose address is longer than `max`, removed. */
function withoutLongUrls(
nodes: readonly BookmarkNode[],
max: number,
dropped: { count: number },
): BookmarkNode[] {
const out: BookmarkNode[] = [];
for (const node of nodes) {
if (!isFolder(node)) {
if ((node.url ?? '').length > max) dropped.count++;
else out.push(node);
continue;
}
out.push({ ...node, children: withoutLongUrls(node.children ?? [], max, dropped) });
}
return out;
}
/**
* Drop the bookmarks a browser would refuse for their length — docs/04 §1.2.
*
* Firefox refuses an address longer than 65 536 characters, and refuses it in
* the middle of a write, possibly after a Replace has cleared the tree. The
* browser layer passes its limit; Chromium has none and passes `undefined`,
* which returns the result untouched. Applied once after parsing, so every
* format meets one rule, and before the preview, so its counts include it.
*/
export function capUrlLength(result: ParseResult, max: number | undefined): ParseResult {
if (max === undefined) return result;
const dropped = { count: 0 };
const roots = withoutLongUrls(result.roots, max, dropped);
if (dropped.count === 0) return result;
return {
roots,
stats: computeStats(roots),
warnings: [...result.warnings, { code: 'URL_TOO_LONG', count: dropped.count }],
};
}
+7 -2
View File
@@ -11,8 +11,11 @@
* OMITTING absent keys, never by assigning `undefined`.
*/
/** A top-level folder that stands for a browser root other than the bar (docs/04 §1.1, §2). */
export type RootMarker = 'other' | 'mobile';
/**
* A top-level folder that stands for a browser root other than the bar
* (docs/04 §1.1, §2). `menu` is Firefox's Bookmarks Menu (since v1.3.0).
*/
export type RootMarker = 'other' | 'mobile' | 'menu';
export interface BookmarkNode {
title: string;
@@ -56,6 +59,8 @@ export const PARSE_WARNING_CODES = [
'PLACE_QUERIES_SKIPPED',
'EXTRA_ROOTS_SKIPPED',
'UNREADABLE_ENTRIES',
'SEPARATORS_SKIPPED',
'URL_TOO_LONG',
] as const;
export type ParseWarningCode = (typeof PARSE_WARNING_CODES)[number];
+3 -1
View File
@@ -47,7 +47,9 @@ function readDate(value: unknown, warnings: WarningBag): number | undefined {
function readRootMarker(raw: Record<string, unknown>): RootMarker | undefined {
if (raw.toolbar === true) return undefined; // the toolbar wins
return raw.root === 'other' || raw.root === 'mobile' ? raw.root : undefined;
return raw.root === 'other' || raw.root === 'mobile' || raw.root === 'menu'
? raw.root
: undefined;
}
function readNode(
+6 -10
View File
@@ -9,18 +9,12 @@
* by shape), plus display titles for the roots Firefox names only by key.
* Guarantees: emits the same tree Firefox's own HTML export describes for the
* same profile (docs/04 §2b parity rule), with the Mobile root added.
* Separators are skipped silently, as `<HR>` is; `place:` smart bookmarks
* Separators are skipped and counted, as `<HR>` is; `place:` smart bookmarks
* are skipped and counted; the tags root is dropped, because it is a view
* over bookmarks the other roots already hold.
*/
import { classifyHref } from '../href';
import {
BmParseError,
type BookmarkNode,
computeStats,
type ParseResult,
type RootMarker,
} from '../model';
import { BmParseError, type BookmarkNode, computeStats, type ParseResult } from '../model';
import { microsToSeconds } from '../timestamps';
import { bookmarkTitle, isRecord, NodeBudget, type RootTitles, WarningBag } from './shared';
@@ -141,6 +135,8 @@ function readNode(raw: unknown, depth: number, ctx: ReadContext): BookmarkNode |
case 'bookmark':
return readBookmark(raw, ctx);
case 'separator':
// No format BookmarkMagic writes holds one; counted, as <HR> is (docs/04 §2b).
ctx.warnings.add('SEPARATORS_SKIPPED');
return null;
case 'unknown':
ctx.warnings.add('UNREADABLE_ENTRIES');
@@ -162,7 +158,7 @@ function countBookmarks(root: unknown): number {
}
/** A Map, not an object literal: `root: "toString"` must not find a prototype method. */
const ROOT_KEYS = new Map<unknown, 'toolbar' | RootMarker>([
const ROOT_KEYS = new Map<unknown, 'toolbar' | 'other' | 'mobile'>([
['toolbarFolder', 'toolbar'],
['unfiledBookmarksFolder', 'other'],
['mobileFolder', 'mobile'],
@@ -180,7 +176,7 @@ function readPlacesRoot(
ctx: ReadContext,
): BookmarkNode[] {
const menu: BookmarkNode[] = [];
const special: Partial<Record<'toolbar' | RootMarker, BookmarkNode>> = {};
const special: Partial<Record<'toolbar' | 'other' | 'mobile', BookmarkNode>> = {};
for (const child of children) {
if (!isRecord(child)) {
+6 -3
View File
@@ -128,9 +128,9 @@ function walkDl(dl: Element, depth: number, ctx: WalkContext): BookmarkNode[] {
const out: BookmarkNode[] = [];
for (const child of entryElements(dl)) {
const tag = tagOf(child);
// <HR> separators (Firefox) are skipped silently — docs/04 §1.2. The HTML
// parser usually nests them inside the preceding <DT>; either way they
// are never read as an entry.
// <HR> separators (Firefox) are never read as an entry — docs/04 §1.2.
// The HTML parser usually nests them inside the preceding <DT>, so they
// are counted once for the whole document instead (SEPARATORS_SKIPPED).
if (tag === 'dd') ctx.warnings.add('DESCRIPTIONS_DROPPED');
if (tag !== 'dt') continue;
// Checked per entry, not per list: an EMPTY list one level past the cap is
@@ -287,6 +287,9 @@ export function parseNetscapeHtml(text: string): ParseResult {
}
const ctx: WalkContext = { warnings: new WarningBag(), budget: new NodeBudget() };
// The file model has no separator (docs/04 §1.2): count what is left out.
const separators = doc.getElementsByTagName('hr').length;
if (separators > 0) ctx.warnings.add('SEPARATORS_SKIPPED', separators);
let roots = body === null || !hasEntries ? [] : collectRoots(body, ctx);
if (roots.length === 0 && hasEntries) roots = outermostLists(doc, ctx);
+7 -1
View File
@@ -26,6 +26,8 @@ export interface PlanDestinations {
other: LiveFolderLike;
/** Absent when the profile has none; Mobile-marked folders then land under Other. */
mobile?: LiveFolderLike;
/** Firefox's Bookmarks Menu; absent in every Chromium browser (docs/03 §1). */
menu?: LiveFolderLike;
}
export interface BuildPlanOptions {
@@ -70,8 +72,12 @@ function planSplit(
destinations: PlanDestinations,
mode: 'merge' | 'replace',
): { segments: PlanSegment[]; reusedFolders: number } {
const routed = routeTopLevel(nodes, { hasMobileRoot: destinations.mobile !== undefined });
const routed = routeTopLevel(nodes, {
hasMobileRoot: destinations.mobile !== undefined,
hasMenuRoot: destinations.menu !== undefined,
});
const targets: [BookmarkNode[], LiveFolderLike | undefined][] = [
[routed.menu, destinations.menu],
[routed.toolbar, destinations.toolbar],
[routed.other, destinations.other],
[routed.mobile, destinations.mobile],
+18 -5
View File
@@ -2,7 +2,8 @@
* Top-level routing — docs/03 §1 step 7, docs/02 §4.
*
* Purpose: decide which browser root each top-level node of a file lands in.
* Inputs: the (deduped) top-level nodes; whether the profile has a Mobile root.
* Inputs: the (deduped) top-level nodes; whether the profile has a Mobile root,
* and whether it has a Bookmarks Menu (Firefox).
* Guarantees: pure. Markers are read on TOP-LEVEL nodes only — deeper they are
* carried as data. A marked folder IS that root, so it is unwrapped: its
* children go into the root and the folder itself is never written, which is
@@ -14,6 +15,8 @@ export interface RoutedNodes {
toolbar: BookmarkNode[];
other: BookmarkNode[];
mobile: BookmarkNode[];
/** Firefox's Bookmarks Menu; always empty without one. */
menu: BookmarkNode[];
/** Marked folders that were unwrapped rather than written. */
unwrapped: number;
}
@@ -30,13 +33,17 @@ function append(target: BookmarkNode[], list: readonly BookmarkNode[] | undefine
* - `root: 'other'` folder → its children into Other, in its place in the order;
* - `root: 'mobile'` folder → its children into Mobile; a profile with no
* Mobile root keeps it as an ordinary folder under Other instead;
* - everything else → Other.
* - `root: 'menu'` folder → its children into the Bookmarks Menu; a browser
* with none (every Chromium one) keeps it as an ordinary folder under Other;
* - everything else → the Bookmarks Menu where there is one — what Firefox's
* own import does with the loose entries its own export writes — else Other.
*/
export function routeTopLevel(
nodes: readonly BookmarkNode[],
options: { hasMobileRoot: boolean },
options: { hasMobileRoot: boolean; hasMenuRoot?: boolean },
): RoutedNodes {
const routed: RoutedNodes = { toolbar: [], other: [], mobile: [], unwrapped: 0 };
const routed: RoutedNodes = { toolbar: [], other: [], mobile: [], menu: [], unwrapped: 0 };
const loose = options.hasMenuRoot === true ? routed.menu : routed.other;
for (const node of nodes) {
if (node.toolbar === true) {
if (isFolder(node)) {
@@ -51,8 +58,14 @@ export function routeTopLevel(
} else if (isFolder(node) && node.root === 'mobile' && options.hasMobileRoot) {
append(routed.mobile, node.children);
routed.unwrapped++;
} else {
} else if (isFolder(node) && node.root === 'menu' && options.hasMenuRoot === true) {
append(routed.menu, node.children);
routed.unwrapped++;
} else if (isFolder(node) && (node.root === 'menu' || node.root === 'mobile')) {
// A root this browser does not have stays a folder, under Other.
routed.other.push(node);
} else {
loose.push(node);
}
}
return routed;
+3 -1
View File
@@ -13,6 +13,8 @@ export interface SearchableNode {
id: string;
title: string;
url?: string;
/** A Firefox separator: shown, never a match — its url is "data:" (docs/03 §3). */
separator?: true;
children?: SearchableNode[];
}
@@ -50,7 +52,7 @@ export function searchTree(roots: readonly SearchableNode[], query: string): Sea
const walk = (nodes: readonly SearchableNode[], ancestors: readonly string[]): boolean => {
let anyHere = false;
for (const node of nodes) {
const self = matches(node, needle);
const self = node.separator !== true && matches(node, needle);
const trail = [...ancestors, node.id];
const below = walk(node.children ?? [], trail);
+15 -2
View File
@@ -78,10 +78,23 @@ function writeNode(node: BookmarkNode, depth: number, out: string[]): void {
);
}
/** Serialize a tree to Netscape bookmark HTML (UTF-8, LF line endings). */
/**
* Serialize a tree to Netscape bookmark HTML (UTF-8, LF line endings).
*
* Firefox's Bookmarks Menu has no attribute in this format: Firefox writes the
* menu's entries as the file's top level and reads loose top-level entries
* back into the menu. A top-level `root: 'menu'` folder is therefore
* unwrapped here, its children written in its place (docs/04 §1.1).
*/
export function serializeNetscapeHtml(roots: readonly BookmarkNode[]): string {
const out: string[] = ['<DL><p>'];
for (const node of roots) writeNode(node, 1, out);
for (const node of roots) {
if (node.root === 'menu' && node.toolbar !== true && !isBookmark(node)) {
for (const child of node.children ?? []) writeNode(child, 1, out);
} else {
writeNode(node, 1, out);
}
}
out.push('</DL><p>');
return `${HEADER}${out.join('\n')}\n`;
}
+15 -5
View File
@@ -6,7 +6,7 @@
* Inputs: `EditNode` trees, plus `LiveNode`s straight from the bookmarks API.
* Guarantees: pure — no `chrome.*`, no Svelte, no mutation of the input.
*/
import type { LiveNode } from '../browser/bookmarks';
import { isSeparator, type LiveNode } from '../browser/live-tree';
import type { EditNode } from './patch-tree';
/**
@@ -17,13 +17,18 @@ import type { EditNode } from './patch-tree';
* folders, which is what makes `url === undefined` a reliable folder test.
*/
export function toEditNode(node: LiveNode): EditNode {
const separator = isSeparator(node);
// A separator keeps a url — Firefox sends "data:" — so that no "no url ⇒
// folder" test anywhere mistakes it for an empty folder.
const url = separator ? (node.url ?? 'data:') : node.url;
return {
id: node.id,
...(node.parentId !== undefined && { parentId: node.parentId }),
title: node.title,
...(node.url !== undefined && { url: node.url }),
...(node.url === undefined && { children: (node.children ?? []).map(toEditNode) }),
...(url !== undefined && { url }),
...(url === undefined && { children: (node.children ?? []).map(toEditNode) }),
...(node.unmodifiable !== undefined && { unmodifiable: node.unmodifiable }),
...(separator && { separator: true as const }),
};
}
@@ -45,6 +50,8 @@ export function flattenTree(nodes: readonly EditNode[], into: EditNode[] = []):
*/
export function isEditable(roots: readonly EditNode[], node: EditNode): boolean {
if (node.unmodifiable !== undefined) return false;
// Separators are shown and left alone: none of the row commands applies.
if (node.separator === true) return false;
return !roots.some((root) => root.id === node.id);
}
@@ -87,10 +94,13 @@ export function hostOf(url: string | undefined): string {
return new URL(url).host;
}
/** How many nodes sit inside `node`. Drives the delete confirmation's count. */
/**
* How many bookmarks and folders sit inside `node` — the delete confirmation's
* count. Separators (Firefox) go too, but are not "items" to anyone reading it.
*/
export function countDescendants(node: EditNode | undefined): number {
if (node === undefined) return 0;
return flattenTree(node.children ?? []).length;
return flattenTree(node.children ?? []).filter((child) => child.separator !== true).length;
}
/** Ids to delete so one copy of each duplicated link survives. */
+5
View File
@@ -19,6 +19,11 @@ export interface EditNode {
url?: string;
dateAdded?: number;
unmodifiable?: string;
/**
* A Firefox separator (docs/03 §3): a row of its own that no command touches.
* It keeps its `url` ("data:"), so every "no url ⇒ folder" test stays right.
*/
separator?: true;
children?: EditNode[];
}
+31 -5
View File
@@ -22,11 +22,9 @@ function sortKey(node: EditNode): string {
return node.title.trim() === '' && node.url !== undefined ? node.url : node.title;
}
/** The children in sorted order, without moving anything. */
export function sortedOrder(children: readonly EditNode[], locale: string): EditNode[] {
const collator = new Intl.Collator(locale, { numeric: true, sensitivity: 'base' });
return children
.map((node, position) => ({ node, position }))
/** One run of children between separators, sorted: folders first, then by name. */
function sortRun(run: readonly { node: EditNode; position: number }[], collator: Intl.Collator) {
return [...run]
.sort((a, b) => {
const aFolder = a.node.url === undefined;
const bFolder = b.node.url === undefined;
@@ -36,6 +34,34 @@ export function sortedOrder(children: readonly EditNode[], locale: string): Edit
.map(({ node }) => node);
}
/**
* The children in sorted order, without moving anything.
*
* Firefox's separators split a folder into runs the user made on purpose, so
* each run is sorted on its own and every separator keeps its place (docs/05
* §10). Chromium has no separators: one run, as before.
*/
export function sortedOrder(children: readonly EditNode[], locale: string): EditNode[] {
const collator = new Intl.Collator(locale, { numeric: true, sensitivity: 'base' });
const out: EditNode[] = [];
// A loop, not push(...spread): a folder can hold 100k children.
const flush = (items: readonly { node: EditNode; position: number }[]): void => {
for (const node of sortRun(items, collator)) out.push(node);
};
let run: { node: EditNode; position: number }[] = [];
for (const [position, node] of children.entries()) {
if (node.separator === true) {
flush(run);
out.push(node);
run = [];
} else {
run.push({ node, position });
}
}
flush(run);
return out;
}
/**
* The moves, left to right: each fills the next position with the child that
* belongs there. Every move takes a child from further right, so moving it to
+16 -6
View File
@@ -17,7 +17,9 @@ export interface VisibleRow {
/**
* Position among the visible siblings, 1-based, and how many there are. The
* rows render flat, so the browser cannot count siblings itself — without
* these, a screen reader announced "1 of 1" on every row.
* these, a screen reader announced "1 of 1" on every row. Separators
* (Firefox) are rows but not items: they are not counted, and their own
* values mean nothing (docs/06 §5).
*/
posInSet: number;
setSize: number;
@@ -44,17 +46,21 @@ export function visibleRows(
const rows: VisibleRow[] = [];
const walk = (nodes: readonly EditNode[], depth: number, parentId: string | undefined): void => {
const shown = visible === undefined ? nodes : nodes.filter((node) => visible.has(node.id));
for (const [index, node] of shown.entries()) {
const setSize = shown.filter((node) => node.separator !== true).length;
let position = 0;
for (const node of shown) {
const children = node.children ?? [];
const isOpen = expanded.has(node.id);
if (node.separator !== true) position++;
rows.push({
node,
depth,
parentId,
expandable: node.url === undefined && children.length > 0,
// A folder holding only separators has nothing to step into.
expandable: node.url === undefined && children.some((child) => child.separator !== true),
expanded: isOpen,
posInSet: index + 1,
setSize: shown.length,
posInSet: position,
setSize,
});
if (isOpen) walk(children, depth + 1, node.id);
}
@@ -73,8 +79,10 @@ export function visibleRows(
export function resolveKey(
key: string,
focusedId: string | undefined,
rows: readonly VisibleRow[],
allRows: readonly VisibleRow[],
): TreeAction {
// Separators take no focus, so every key moves over the rows that can.
const rows = allRows.filter((row) => row.node.separator !== true);
if (rows.length === 0) return NONE;
const index = rows.findIndex((row) => row.node.id === focusedId);
const current = index === -1 ? undefined : rows[index];
@@ -123,6 +131,8 @@ export function resolveKey(
* The VISIBLE siblings: under a search only the matches count, because the
* user places the row relative to one they can see, exactly as a drag does. A
* collapsed neighbour's children are not rows, so they are skipped for free.
* A separator IS a neighbour: stepping past one is one place, as a drag beside
* it would be — skipping it would move the row two places at once.
*
* @returns the neighbour's id, or `undefined` at either end of the folder.
*/
+5 -17
View File
@@ -8,15 +8,10 @@
*/
import { getGeneratorVersion } from '../browser/app-info';
import {
getRootChildren,
getRoots,
type LiveNode,
rootMarkersOf,
type ToNodesOptions,
toBookmarkNodes,
} from '../browser/bookmarks';
import { getRootChildren, type LiveNode } from '../browser/bookmarks';
import { sanitizeFilename, timestampSuffix, triggerDownload } from '../browser/download';
import { countLive, type ToNodesOptions, toBookmarkNodes } from '../browser/live-tree';
import { getRoots, rootMarkersOf } from '../browser/roots';
import type { ExportFormat } from '../browser/storage';
import type { CsvDelimiter } from '../core/csv-dialect';
import { filterBySelection } from '../core/select';
@@ -75,15 +70,8 @@ export function countSelected(
selection: ReadonlySet<string> | undefined,
): number {
const scoped = selection === undefined ? roots : filterBySelection(roots, selection);
let total = 0;
const walk = (nodes: readonly LiveNode[]): void => {
for (const node of nodes) {
if (node.url !== undefined) total++;
walk(node.children ?? []);
}
};
walk(scoped);
return total;
// Separators (Firefox) carry a url too, "data:" — never a bookmark here.
return countLive(scoped).bookmarks;
}
/** Serialize a scoped tree. Split out from the download so it is testable. */
+1 -1
View File
@@ -83,7 +83,7 @@ export function tPlural(
function interpolate(raw: string, params?: Record<string, string | number>): string {
if (params === undefined) return raw;
return raw.replace(/\{(\w+)\}/g, (match, token: string) =>
return raw.replace(/\{(\w+)}/g, (match, token: string) =>
Object.hasOwn(params, token) ? String(params[token]) : match,
);
}
+8 -2
View File
@@ -41,7 +41,13 @@ export const importTab = {
replaceConfirmBody:
'{current} in this browser will be deleted, after a safety backup is saved. Then {incoming} from {name} are written.',
replaceConfirm: 'Back up and replace',
target: { bar: 'bar', unfiled: 'Other', mobile: 'Mobile' },
// Firefox only (docs/03 §1): Replace deletes separators and no file keeps one.
replaceSeparators: {
one: '{n} separator line will be deleted too, and cannot come back — the backup, like every file BookmarkMagic writes, cannot hold one.',
other:
'{n} separator lines will be deleted too, and cannot come back — the backup, like every file BookmarkMagic writes, cannot hold one.',
},
target: { bar: 'bar', unfiled: 'Other', mobile: 'Mobile', menu: 'Menu' },
targetNote:
'In Merge and Replace, this folder’s contents go straight into that browser folder instead of a copy of it.',
reused: {
@@ -67,7 +73,7 @@ export const importTab = {
cancelledAfterClear:
'You cancelled after your existing bookmarks had already been deleted, so what is left is only the part that was rebuilt.',
dateNotice:
'Imported bookmarks are dated today. Chrome does not let an extension set a bookmark’s original date — your exported files keep the real ones.',
'Imported bookmarks are dated today. The browser does not let an extension set a bookmark’s original date — your exported files keep the real ones.',
partialCreated: {
one: '{n} item had already been created before this failed, and was left in place.',
other: '{n} items had already been created before this failed, and were left in place.',
+12 -3
View File
@@ -46,9 +46,8 @@ export const warnings = {
other: '{n} entries have addresses the browser cannot store, so they were skipped.',
},
PLACE_QUERIES_SKIPPED: {
one: '{n} Firefox smart bookmark (a saved search, not a web page) was skipped — here it would be a dead link.',
other:
'{n} Firefox smart bookmarks (saved searches, not web pages) were skipped — here they would be dead links.',
one: '{n} Firefox smart bookmark (a saved search, not a web page) was skipped.',
other: '{n} Firefox smart bookmarks (saved searches, not web pages) were skipped.',
},
EXTRA_ROOTS_SKIPPED: {
one: '{n} bookmark in a browser-specific folder (such as Opera’s Speed Dial or Trash) was not imported.',
@@ -59,6 +58,16 @@ export const warnings = {
one: '{n} entry in this file could not be read and was skipped.',
other: '{n} entries in this file could not be read and were skipped.',
},
SEPARATORS_SKIPPED: {
one: '{n} separator line was left out — BookmarkMagic keeps bookmarks and folders, not separators.',
other:
'{n} separator lines were left out — BookmarkMagic keeps bookmarks and folders, not separators.',
},
URL_TOO_LONG: {
one: '{n} bookmark was skipped: its address is longer than the 65,536 characters this browser accepts.',
other:
'{n} bookmarks were skipped: their addresses are longer than the 65,536 characters this browser accepts.',
},
};
export const errors = {
+1 -1
View File
@@ -193,7 +193,7 @@ const dict = {
issues: 'Report an issue',
changelog: 'Releases and changelog',
accessibility: 'Accessibility',
store: 'Chrome Web Store listing',
store: 'Store listing',
thirdParty: 'Third-party code',
thirdPartyNote:
'No runtime dependencies are installed. A few small MIT-licensed pieces are compiled into the extension: the Svelte runtime with its clsx helper, and WXT’s one-line browser shim — see THIRD_PARTY_NOTICES.txt in the package.',
+7 -2
View File
@@ -38,7 +38,12 @@ export const importTab = {
replaceConfirmBody:
'バックアップを保存した後、このブラウザの{current}を削除し、{name} から{incoming}を書き込みます。',
replaceConfirm: 'バックアップして置き換え',
target: { bar: 'バー', unfiled: 'その他', mobile: 'モバイル' },
replaceSeparators: {
one: '区切り線 {n} 本も削除され、元に戻せません。バックアップを含め、BookmarkMagic が書き出すファイルは区切り線を保存できないためです。',
other:
'区切り線 {n} 本も削除され、元に戻せません。バックアップを含め、BookmarkMagic が書き出すファイルは区切り線を保存できないためです。',
},
target: { bar: 'バー', unfiled: 'その他', mobile: 'モバイル', menu: 'メニュー' },
targetNote:
'統合と置き換えでは、このフォルダの中身はコピーを作らず、ブラウザの対応するフォルダに直接入ります。',
reused: {
@@ -57,7 +62,7 @@ export const importTab = {
cancelledAfterClear:
'既存のブックマークが削除された後にキャンセルされたため、残っているのは再作成された分だけです。',
dateNotice:
'インポートしたブックマークの日付は本日になります。拡張機能がブックマークの元の作成日を設定することを Chrome が許可していないためです。エクスポートしたファイルには本来の日付が残ります。',
'インポートしたブックマークの日付は本日になります。拡張機能がブックマークの元の作成日を設定することをブラウザが許可していないためです。エクスポートしたファイルには本来の日付が残ります。',
partialCreated: {
one: 'エラーの前に {n} 件が作成済みで、そのまま残されています。',
other: 'エラーの前に {n} 件が作成済みで、そのまま残されています。',
+12 -2
View File
@@ -37,9 +37,9 @@ export const warnings = {
other: 'ブラウザが保存できないアドレスの項目が {n} 件あったため、スキップしました。',
},
PLACE_QUERIES_SKIPPED: {
one: 'Firefox のスマートブックマーク(ウェブページではなく保存された検索)を {n} 件スキップしました。ここではリンク切れになるためです。',
one: 'Firefox のスマートブックマーク(ウェブページではなく保存された検索)を {n} 件スキップしました。',
other:
'Firefox のスマートブックマーク(ウェブページではなく保存された検索)を {n} 件スキップしました。ここではリンク切れになるためです。',
'Firefox のスマートブックマーク(ウェブページではなく保存された検索)を {n} 件スキップしました。',
},
EXTRA_ROOTS_SKIPPED: {
one: 'ブラウザ固有のフォルダ(Opera のスピードダイヤルやゴミ箱など)にあるブックマーク {n} 件はインポートしませんでした。',
@@ -50,6 +50,16 @@ export const warnings = {
one: '読み取れない項目が {n} 件あったため、スキップしました。',
other: '読み取れない項目が {n} 件あったため、スキップしました。',
},
SEPARATORS_SKIPPED: {
one: '区切り線 {n} 本を省きました。BookmarkMagic が保持するのはブックマークとフォルダで、区切り線は保持しません。',
other:
'区切り線 {n} 本を省きました。BookmarkMagic が保持するのはブックマークとフォルダで、区切り線は保持しません。',
},
URL_TOO_LONG: {
one: 'アドレスがこのブラウザの上限(65,536 文字)を超えるブックマーク {n} 件をスキップしました。',
other:
'アドレスがこのブラウザの上限(65,536 文字)を超えるブックマーク {n} 件をスキップしました。',
},
} satisfies Dict['warnings'];
export const errors = {
+1 -1
View File
@@ -179,7 +179,7 @@ export default {
issues: '問題を報告',
changelog: 'リリースと変更履歴',
accessibility: 'アクセシビリティ',
store: 'Chrome ウェブストアのページ',
store: 'ストアのページ',
thirdParty: 'サードパーティのコード',
thirdPartyNote:
'実行時の依存関係はインストールされません。MIT ライセンスの小さなコード(Svelte のランタイムとその clsx ヘルパー、WXT の 1 行のブラウザ互換層)が拡張機能に組み込まれています。パッケージ内の THIRD_PARTY_NOTICES.txt をご覧ください。',
+8 -2
View File
@@ -42,7 +42,13 @@ export const importTab = {
replaceConfirmBody:
'Vor fi șterse din acest browser: {current}, după salvarea unei copii de rezervă de siguranță. Apoi se scrie conținutul din {name}: {incoming}.',
replaceConfirm: 'Salvați copia și înlocuiți',
target: { bar: 'bară', unfiled: 'Alte marcaje', mobile: 'Mobile' },
replaceSeparators: {
one: 'Va fi ștearsă și {n} linie de separare, care nu mai poate fi restaurată — copia de rezervă, ca orice fișier scris de BookmarkMagic, nu poate păstra separatoare.',
few: 'Vor fi șterse și {n} linii de separare, care nu mai pot fi restaurate — copia de rezervă, ca orice fișier scris de BookmarkMagic, nu poate păstra separatoare.',
other:
'Vor fi șterse și {n} de linii de separare, care nu mai pot fi restaurate — copia de rezervă, ca orice fișier scris de BookmarkMagic, nu poate păstra separatoare.',
},
target: { bar: 'bară', unfiled: 'Alte marcaje', mobile: 'Mobile', menu: 'Meniul de marcaje' },
targetNote:
'La îmbinare și la înlocuire, conținutul acestui dosar ajunge direct în dosarul respectiv al browserului, nu într-o copie a lui.',
reused: {
@@ -65,7 +71,7 @@ export const importTab = {
cancelledAfterClear:
'Ați anulat după ce marcajele existente fuseseră deja șterse, așa că a rămas doar partea care a fost refăcută.',
dateNotice:
'Marcajele importate poartă data de azi. Chrome nu permite unei extensii să seteze data originală a unui marcaj — fișierele exportate păstrează datele reale.',
'Marcajele importate poartă data de azi. Browserul nu permite unei extensii să seteze data originală a unui marcaj — fișierele exportate păstrează datele reale.',
partialCreated: {
one: '{n} element fusese deja creat înainte de eroare și a rămas pe loc.',
few: '{n} elemente fuseseră deja create înainte de eroare și au rămas pe loc.',
+15 -4
View File
@@ -49,10 +49,9 @@ export const warnings = {
other: '{n} de intrări au adrese pe care browserul nu le poate stoca, așa că au fost omise.',
},
PLACE_QUERIES_SKIPPED: {
one: '{n} marcaj inteligent Firefox (o căutare salvată, nu o pagină web) a fost omis — aici ar fi un link nefuncțional.',
few: '{n} marcaje inteligente Firefox (căutări salvate, nu pagini web) au fost omise — aici ar fi linkuri nefuncționale.',
other:
'{n} de marcaje inteligente Firefox (căutări salvate, nu pagini web) au fost omise — aici ar fi linkuri nefuncționale.',
one: '{n} marcaj inteligent Firefox (o căutare salvată, nu o pagină web) a fost omis.',
few: '{n} marcaje inteligente Firefox (căutări salvate, nu pagini web) au fost omise.',
other: '{n} de marcaje inteligente Firefox (căutări salvate, nu pagini web) au fost omise.',
},
EXTRA_ROOTS_SKIPPED: {
one: '{n} marcaj dintr-un dosar specific unui browser (cum ar fi Speed Dial sau Coșul de gunoi din Opera) nu a fost importat.',
@@ -65,6 +64,18 @@ export const warnings = {
few: '{n} intrări din acest fișier nu au putut fi citite și au fost omise.',
other: '{n} de intrări din acest fișier nu au putut fi citite și au fost omise.',
},
SEPARATORS_SKIPPED: {
one: '{n} linie de separare a fost omisă — BookmarkMagic păstrează marcaje și dosare, nu separatoare.',
few: '{n} linii de separare au fost omise — BookmarkMagic păstrează marcaje și dosare, nu separatoare.',
other:
'{n} de linii de separare au fost omise — BookmarkMagic păstrează marcaje și dosare, nu separatoare.',
},
URL_TOO_LONG: {
one: '{n} marcaj a fost omis: adresa lui depășește cele 65.536 de caractere acceptate de acest browser.',
few: '{n} marcaje au fost omise: adresele lor depășesc cele 65.536 de caractere acceptate de acest browser.',
other:
'{n} de marcaje au fost omise: adresele lor depășesc cele 65.536 de caractere acceptate de acest browser.',
},
} satisfies Dict['warnings'];
export const errors = {
+1 -1
View File
@@ -210,7 +210,7 @@ export default {
issues: 'Raportați o problemă',
changelog: 'Versiuni și jurnalul modificărilor',
accessibility: 'Accesibilitate',
store: 'Pagina din Magazinul Chrome Web',
store: 'Pagina din magazin',
thirdParty: 'Cod terț',
thirdPartyNote:
'Nu este instalată nicio dependență de rulare. Câteva componente mici cu licență MIT sunt compilate în extensie: runtime-ul Svelte cu utilitarul său clsx și adaptorul de browser de o linie al WXT — consultați THIRD_PARTY_NOTICES.txt din pachet.',
+7 -2
View File
@@ -37,7 +37,12 @@ export const importTab = {
replaceConfirmBody:
'{current} trong trình duyệt này sẽ bị xóa, sau khi bản sao lưu an toàn được lưu. Sau đó {incoming} từ {name} sẽ được ghi vào.',
replaceConfirm: 'Sao lưu rồi thay thế',
target: { bar: 'thanh dấu trang', unfiled: 'Khác', mobile: 'Di động' },
replaceSeparators: {
one: '{n} đường phân cách cũng sẽ bị xóa và không thể khôi phục — bản sao lưu, như mọi tệp BookmarkMagic ghi ra, không lưu được đường phân cách.',
other:
'{n} đường phân cách cũng sẽ bị xóa và không thể khôi phục — bản sao lưu, như mọi tệp BookmarkMagic ghi ra, không lưu được đường phân cách.',
},
target: { bar: 'thanh dấu trang', unfiled: 'Khác', mobile: 'Di động', menu: 'Menu dấu trang' },
targetNote:
'Ở chế độ Gộp và Thay thế, nội dung thư mục này được đưa thẳng vào thư mục tương ứng của trình duyệt, không tạo bản sao của nó.',
reused: {
@@ -56,7 +61,7 @@ export const importTab = {
cancelledAfterClear:
'Bạn đã hủy sau khi bookmark cũ đã bị xóa, nên những gì còn lại chỉ là phần đã được tạo lại.',
dateNotice:
'Bookmark được nhập vào sẽ mang ngày hôm nay. Chrome không cho phép tiện ích đặt lại ngày tạo gốc của bookmark — các tệp bạn xuất ra vẫn giữ ngày thật.',
'Bookmark được nhập vào sẽ mang ngày hôm nay. Trình duyệt không cho phép tiện ích đặt lại ngày tạo gốc của bookmark — các tệp bạn xuất ra vẫn giữ ngày thật.',
partialCreated: {
one: '{n} mục đã được tạo trước khi lỗi xảy ra và vẫn được giữ lại.',
other: '{n} mục đã được tạo trước khi lỗi xảy ra và vẫn được giữ lại.',
+11 -3
View File
@@ -36,9 +36,8 @@ export const warnings = {
other: '{n} mục có địa chỉ mà trình duyệt không lưu được nên đã bị bỏ qua.',
},
PLACE_QUERIES_SKIPPED: {
one: 'Đã bỏ qua {n} bookmark thông minh của Firefox (một truy vấn đã lưu, không phải trang web) — ở đây nó sẽ là liên kết hỏng.',
other:
'Đã bỏ qua {n} bookmark thông minh của Firefox (truy vấn đã lưu, không phải trang web) — ở đây chúng sẽ là liên kết hỏng.',
one: 'Đã bỏ qua {n} bookmark thông minh của Firefox (một truy vấn đã lưu, không phải trang web).',
other: 'Đã bỏ qua {n} bookmark thông minh của Firefox (truy vấn đã lưu, không phải trang web).',
},
EXTRA_ROOTS_SKIPPED: {
one: '{n} bookmark nằm trong thư mục riêng của trình duyệt (như Speed Dial hay Thùng rác của Opera) nên không được nhập.',
@@ -49,6 +48,15 @@ export const warnings = {
one: '{n} mục trong tệp không đọc được và đã bị bỏ qua.',
other: '{n} mục trong tệp không đọc được và đã bị bỏ qua.',
},
SEPARATORS_SKIPPED: {
one: 'Đã bỏ qua {n} đường phân cách — BookmarkMagic giữ bookmark và thư mục, không giữ đường phân cách.',
other:
'Đã bỏ qua {n} đường phân cách — BookmarkMagic giữ bookmark và thư mục, không giữ đường phân cách.',
},
URL_TOO_LONG: {
one: 'Đã bỏ qua {n} bookmark: địa chỉ dài hơn 65.536 ký tự mà trình duyệt này chấp nhận.',
other: 'Đã bỏ qua {n} bookmark: địa chỉ dài hơn 65.536 ký tự mà trình duyệt này chấp nhận.',
},
} satisfies Dict['warnings'];
export const errors = {
+1 -1
View File
@@ -177,7 +177,7 @@ export default {
issues: 'Báo lỗi',
changelog: 'Bản phát hành và nhật ký thay đổi',
accessibility: 'Hỗ trợ tiếp cận',
store: 'Trang trên Chrome Web Store',
store: 'Trang trên cửa hàng',
thirdParty: 'Mã của bên thứ ba',
thirdPartyNote:
'Không cài thêm thư viện nào khi chạy. Vài phần mã nhỏ theo giấy phép MIT được biên dịch vào tiện ích: bộ chạy của Svelte cùng hàm trợ giúp clsx của nó, và lớp tương thích trình duyệt một dòng của WXT — xem THIRD_PARTY_NOTICES.txt trong gói.',
+7 -2
View File
@@ -36,7 +36,12 @@ export const importTab = {
replaceConfirmBody:
'保存安全备份后,将删除此浏览器中的 {current}。然后写入 {name} 中的 {incoming}。',
replaceConfirm: '备份并替换',
target: { bar: '书签栏', unfiled: '其他书签', mobile: '移动设备书签' },
replaceSeparators: {
one: '还会删除 {n} 条分隔线,且无法恢复——备份与 BookmarkMagic 写出的其他文件一样,无法保存分隔线。',
other:
'还会删除 {n} 条分隔线,且无法恢复——备份与 BookmarkMagic 写出的其他文件一样,无法保存分隔线。',
},
target: { bar: '书签栏', unfiled: '其他书签', mobile: '移动设备书签', menu: '书签菜单' },
targetNote:
'在合并和替换模式下,此文件夹中的内容会直接放入对应的浏览器文件夹,而不是创建它的副本。',
reused: {
@@ -55,7 +60,7 @@ export const importTab = {
},
cancelledAfterClear: '您是在现有书签已被删除之后取消的,因此剩下的只有已重建的部分。',
dateNotice:
'导入的书签日期均为今天。Chrome 不允许扩展程序设置书签的原始日期——您导出的文件会保留真实日期。',
'导入的书签日期均为今天。浏览器不允许扩展程序设置书签的原始日期——您导出的文件会保留真实日期。',
partialCreated: {
one: '操作失败前已创建 {n} 项,这些项保持原样。',
other: '操作失败前已创建 {n} 项,这些项保持原样。',
+10 -2
View File
@@ -36,8 +36,8 @@ export const warnings = {
other: '{n} 个条目的地址无法存入浏览器,因此已跳过。',
},
PLACE_QUERIES_SKIPPED: {
one: '已跳过 {n} 个 Firefox 智能书签(已保存的搜索,而非网页)——在这里它会成为失效链接。',
other: '已跳过 {n} 个 Firefox 智能书签(已保存的搜索,而非网页)——在这里它们会成为失效链接。',
one: '已跳过 {n} 个 Firefox 智能书签(已保存的搜索,而非网页)。',
other: '已跳过 {n} 个 Firefox 智能书签(已保存的搜索,而非网页)。',
},
EXTRA_ROOTS_SKIPPED: {
one: '浏览器专用文件夹(例如 Opera 的快速拨号或回收站)中的 {n} 个书签未导入。',
@@ -47,6 +47,14 @@ export const warnings = {
one: '此文件中有 {n} 个条目无法读取,已跳过。',
other: '此文件中有 {n} 个条目无法读取,已跳过。',
},
SEPARATORS_SKIPPED: {
one: '已略去 {n} 条分隔线——BookmarkMagic 保存书签和文件夹,不保存分隔线。',
other: '已略去 {n} 条分隔线——BookmarkMagic 保存书签和文件夹,不保存分隔线。',
},
URL_TOO_LONG: {
one: '已跳过 {n} 个书签:其地址超过了此浏览器接受的 65,536 个字符。',
other: '已跳过 {n} 个书签:其地址超过了此浏览器接受的 65,536 个字符。',
},
} satisfies Dict['warnings'];
export const errors = {
+1 -1
View File
@@ -175,7 +175,7 @@ export default {
issues: '报告问题',
changelog: '版本发布与更新日志',
accessibility: '无障碍',
store: 'Chrome 网上应用店页面',
store: '商店页面',
thirdParty: '第三方代码',
thirdPartyNote:
'未安装任何运行时依赖项。扩展程序中编译了几个采用 MIT 许可的小组件:Svelte 运行时及其 clsx 辅助函数,以及 WXT 的一行浏览器适配代码——详见软件包中的 THIRD_PARTY_NOTICES.txt。',
+29 -17
View File
@@ -11,14 +11,7 @@
* is written, downloaded or deleted.
*/
import { getGeneratorVersion } from '../browser/app-info';
import {
type BookmarkRoots,
clearRoots,
getRoots,
type LiveNode,
rootMarkersOf,
toBookmarkNodes,
} from '../browser/bookmarks';
import { clearRoots, type LiveNode, MAX_URL_LENGTH } from '../browser/bookmarks';
import { record } from '../browser/diagnostics';
import {
discardTarget,
@@ -30,17 +23,19 @@ import {
writeToTarget,
} from '../browser/download';
import { BmAborted, BmBackupError } from '../browser/errors';
import { countLive, toBookmarkNodes, withoutSeparators } from '../browser/live-tree';
import { type BookmarkRoots, getRoots, rootMarkersOf } from '../browser/roots';
import type { ImportMode } from '../browser/storage';
import { withWriteLock } from '../browser/write-lock';
import { type WriteProgress, writeTree } from '../browser/write-queue';
import { textCapsBreach, treeCapsBreach } from '../core/caps';
import { buildUrlIndex } from '../core/dedupe';
import { diffAgainstBrowser, type NodeStatus } from '../core/diff';
import { capUrlLength } from '../core/href';
import { MAX_FILE_BYTES, MAX_WRITE_DEPTH } from '../core/limits';
import {
BmParseError,
type BookmarkNode,
computeStats,
type FileFormat,
type ImportPlan,
type MergeMode,
@@ -63,8 +58,12 @@ export interface PreparedImport {
browserIndex: Set<string>;
/** The live roots at preview time — what the Start button's preview plan is built against. */
destinations: PlanDestinations;
/** Everything inside the writable roots: what Replace would delete (docs/09 T4). */
current: { bookmarks: number; folders: number };
/**
* Everything inside the roots Replace empties — exactly what it would
* delete (docs/09 T4); a signed-in Chrome's account roots are not among them. Separators (Firefox) are counted apart — never as bookmarks — so the
* confirmation can say they will not come back (docs/03 §1).
*/
current: { bookmarks: number; folders: number; separators: number };
}
export interface PrepareOptions {
@@ -90,7 +89,11 @@ export async function prepareImport(
// Blob.text() is UTF-8 decode, which consumes a leading BOM for us.
const text = await file.text();
const { format, result } = parseBookmarkFile(text, options);
const parsed = parseBookmarkFile(text, options);
const { format } = parsed;
// What this browser would refuse for its length goes before the preview, so
// the counts the user confirms already leave it out (docs/04 §1.2).
const result = capUrlLength(parsed.result, MAX_URL_LENGTH);
record({
kind: 'import',
phase: 'parsed',
@@ -101,9 +104,9 @@ export async function prepareImport(
// One read: getRoots walks the whole tree, so the index and the counts come
// from the same snapshot instead of a second getTree().
const roots = await getRoots();
const browserIndex = buildUrlIndex(roots.all);
const browserIndex = buildUrlIndex(withoutSeparators(roots.all));
const { existsCount, status } = diffAgainstBrowser(result.roots, browserIndex);
const inside = computeStats(roots.writable.flatMap((root) => root.children ?? []));
const inside = countLive(roots.replaceable.flatMap((root) => root.children ?? []));
return {
format,
@@ -112,7 +115,11 @@ export async function prepareImport(
status,
browserIndex,
destinations: destinationsOf(roots),
current: { bookmarks: inside.bookmarks, folders: inside.folders },
current: {
bookmarks: inside.bookmarks,
folders: inside.folders,
separators: inside.separators,
},
};
}
@@ -169,6 +176,7 @@ function destinationsOf(roots: BookmarkRoots): PlanDestinations {
toolbar: roots.toolbar,
other: roots.other,
...(roots.mobile !== undefined && { mobile: roots.mobile }),
...(roots.menu !== undefined && { menu: roots.menu }),
};
}
@@ -233,7 +241,8 @@ async function writeAll(
mode,
dedupe,
// Fresh, not the preview's: anything bookmarked since must not be added twice.
browserIndex: dedupe && mode !== 'replace' ? buildUrlIndex(roots.all) : new Set(),
browserIndex:
dedupe && mode !== 'replace' ? buildUrlIndex(withoutSeparators(roots.all)) : new Set(),
destinations: destinationsOf(roots),
newFolderTitle,
});
@@ -244,7 +253,7 @@ async function writeAll(
if (plan.stats.writeDepth > MAX_WRITE_DEPTH) {
throw new BmParseError(
'TOO_DEEP',
`the import would nest folders ${plan.stats.writeDepth} deep; Chrome stores at most ${MAX_WRITE_DEPTH}`,
`the import would nest folders ${plan.stats.writeDepth} deep; at most ${MAX_WRITE_DEPTH} are written, in every browser (Chrome's own storage limit)`,
);
}
@@ -282,6 +291,9 @@ async function backUpThenFreeze(
backup: BackupState,
first: BookmarkRoots,
): Promise<LiveNode[]> {
// Separators are not in the snapshot (no format holds one), so a change
// that only moves or adds separators is not seen here; Replace deletes them
// and says so before it starts (docs/03 §1).
const snapshotOf = (roots: BookmarkRoots) =>
toBookmarkNodes(roots.replaceable, rootMarkersOf(roots));
let roots = first;
+42 -4
View File
@@ -27,11 +27,47 @@ export const CHANGELOG_URL = `${REPO_URL}/blob/main/CHANGELOG.md`;
*/
export const ACCESSIBILITY_URL = `${REPO_URL}/blob/main/ACCESSIBILITY.md`;
/** The Chrome Web Store item id (docs/00 §9) — also the CHROME_EXTENSION_ID secret. */
const CWS_ITEM_ID = 'eghnciphhegekmnofffpgbdfefckdhmg';
/** The published Chrome Web Store listing. */
const CWS_URL = `https://chromewebstore.google.com/detail/bookmarkmagic/${CWS_ITEM_ID}`;
/**
* The published Chrome Web Store listing (item id — docs/00 §9).
* The Edge Add-ons item id — Partner Center's "CRX ID", and the `runtime.id`
* of every copy installed from Edge Add-ons (docs/00 §9). Not the Product ID,
* which is what the `EDGE_PRODUCT_ID` secret needs.
*/
const EDGE_ITEM_ID = 'nchfchjnlihbifggooggpmmacighmdjg';
/** The published Edge Add-ons listing (live since 2026-11-19). */
const EDGE_URL = `https://microsoftedge.microsoft.com/addons/detail/${EDGE_ITEM_ID}`;
/** Each Chromium store's item id → its listing. */
const CHROMIUM_LISTINGS: ReadonlyMap<string, string> = new Map([
[CWS_ITEM_ID, CWS_URL],
[EDGE_ITEM_ID, EDGE_URL],
]);
/**
* The Firefox Add-ons listing, addressed by the gecko id, which AMO resolves
* (docs/13 §8). The "@" is percent-encoded on purpose: AMO decodes it, and the
* source then holds nothing that reads as an email address (see below).
*/
const AMO_URL = 'https://addons.mozilla.org/firefox/addon/bookmarkmagic%40poli0981.dev/';
/** Every store, listed: the README's install section. */
const INSTALL_URL = `${REPO_URL}#install`;
/**
* The listing this copy was installed from — docs/06 §3.5.
*
* The only route from inside the product to rating or reviewing it, which
* docs/13 §6 lists as a post-launch channel.
* docs/13 §6 lists as a post-launch channel. One Chromium package serves the
* Chrome Web Store and Edge Add-ons, so the Chromium choice is made at run
* time, by extension id: each store's own id gets its listing (an Edge user
* who installed from the Chrome Web Store has that store's id, and gets that
* listing), any other id (an unpacked build) the install section.
*
* There is deliberately **no support email here.** Putting an address on an
* in-product surface invites users to mail their real bookmarks file, which is
@@ -40,8 +76,10 @@ export const ACCESSIBILITY_URL = `${REPO_URL}/blob/main/ACCESSIBILITY.md`;
* SECURITY.md, CONTRIBUTING.md and the privacy policy, where it arrives with
* the instruction to sanitize first (docs/15 decision log, 2026-08-03).
*/
export const STORE_URL =
'https://chromewebstore.google.com/detail/bookmarkmagic/eghnciphhegekmnofffpgbdfefckdhmg';
export function storeUrlFor(install: { firefox: boolean; extensionId: string }): string {
if (install.firefox) return AMO_URL;
return CHROMIUM_LISTINGS.get(install.extensionId) ?? INSTALL_URL;
}
export interface LabelledLink {
labelKey: string;
+15 -4
View File
@@ -15,6 +15,7 @@ import {
getChildren,
getRootChildren,
type LiveNode,
type MoveDestination,
move,
remove,
removeTree,
@@ -41,7 +42,8 @@ export interface EditApi {
getChildren: (id: string) => Promise<LiveNode[]>;
create: (details: { parentId: string; title: string }) => Promise<LiveNode>;
update: (id: string, changes: { title?: string }) => Promise<void>;
move: (id: string, destination: { parentId?: string; index?: number }) => Promise<void>;
/** Resolves to the index the browser reports the node now has (`browser/bookmarks.ts`). */
move: (id: string, destination: MoveDestination) => Promise<number | undefined>;
remove: (id: string) => Promise<void>;
removeTree: (id: string) => Promise<void>;
}
@@ -229,13 +231,22 @@ export class EditCommands extends EditView {
if (node === undefined || !this.isEditable(node)) return false;
if (!canMoveInto(this.roots, id, plan.parentId)) return false;
const { parentId, position } = plan;
return this.guard(async () => {
let landed: number | undefined;
const moved = await this.guard(async () => {
this.roots = moveNode(this.roots, id, parentId, position?.local);
await this.api.move(
landed = await this.api.move(
id,
position === undefined ? { parentId } : { parentId, index: position.api },
position === undefined ? { parentId } : { parentId, position },
);
});
// The browser says where the node really went. If that is not where the
// tree put it, the two disagree — re-read rather than show a wrong order
// (docs/03 §3). The adapter already sends each browser its own index, so
// this only fires if a browser changes its rule.
if (moved && position !== undefined && landed !== undefined && landed !== position.local) {
await this.load();
}
return moved;
};
/**
+15 -3
View File
@@ -51,9 +51,14 @@ export class EditSession extends EditCommands {
: [],
);
/** Any folder with two or more children that is not policy-managed, roots included. */
/**
* Any folder with two or more items that is not policy-managed, roots
* included. Separators (Firefox) are not items: they never move in a sort.
*/
canSort = (node: EditNode): boolean =>
node.url === undefined && node.unmodifiable === undefined && (node.children?.length ?? 0) > 1;
node.url === undefined &&
node.unmodifiable === undefined &&
(node.children ?? []).filter((child) => child.separator !== true).length > 1;
keepFirst = async (): Promise<void> => {
this.pendingKeepFirst = false;
@@ -96,7 +101,14 @@ export class EditSession extends EditCommands {
record({ kind: 'edit', action: 'sort', count: moves.length });
const outcome = await applySort(
moves,
(step) => this.api.move(step.id, { parentId: folder.id, index: step.index }),
// Every sort move goes LEFT, where both browsers' index rules agree
// (docs/05 §10): the same number serves as both.
async (step) => {
await this.api.move(step.id, {
parentId: folder.id,
position: { api: step.index, local: step.index },
});
},
(step) => {
this.roots = moveNode(this.roots, step.id, folder.id, step.index);
},
+6 -2
View File
@@ -171,8 +171,12 @@ export class EditView {
if (index === -1) return undefined;
// Skip the node's own descendants, which disappear with it.
const depth = this.rows[index]?.depth ?? 0;
const after = this.rows.slice(index + 1).find((row) => row.depth <= depth);
return after?.node.id ?? this.rows[index - 1]?.node.id;
// Separators (Firefox) take no focus, so they are never the neighbour.
const after = this.rows
.slice(index + 1)
.find((row) => row.depth <= depth && row.node.separator !== true);
const before = this.rows.slice(0, index).findLast((row) => row.node.separator !== true);
return after?.node.id ?? before?.node.id;
};
dispose = (): void => {
+6
View File
@@ -23,6 +23,12 @@ same spelling as `src/public/_locales/`. Adding a language: `docs/07 §6` and
`docs/13 §4` — the `LANGUAGES` paragraph inside *every* description lists the
languages, so all of them are re-pasted when one is added.
Since v1.3.0 each file also carries the **Firefox Add-ons** and **Microsoft
Edge Add-ons** copy, under headings of their own. The Edge description is
complete and is pasted whole: Edge's policy forbids naming other browsers, so
it is the one description that never says Chrome or Firefox (`docs/13 §9`,
checked by `tests/unit/store-listing.test.ts`).
The summary field is capped at **132 characters** by the dashboard. Each file
records its own count; re-check after any edit, because the limit is enforced at
submission time and a rejection there costs a round trip.
+78
View File
@@ -56,3 +56,81 @@ https://github.com/poli0981/bookmarkmagic
`https://github.com/poli0981/bookmarkmagic/blob/main/legal/PRIVACY.md`
**Distribution:** Public, all regions.
## Firefox Add-ons (since v1.3.0)
The description above, with the two bullets that name Chrome replaced by these — on Firefox they would not be true as written:
```
• Import bookmark files (HTML, JSON, CSV) — including the "Bookmarks" file
from the profile folder of a Chromium browser (Chrome, Edge, Brave…) and
Firefox JSON backups — with a full preview before anything is written:
counts, folders and duplicates first.
```
```
• Imported bookmarks get today's date — browsers don't let extensions set a
bookmark's original creation date. Your exported files keep the real dates.
```
On Firefox Add-ons only, add to LIMITATIONS:
```
• Firefox separators are not kept: exports and backups leave them out, and
Replace deletes them (it tells you first).
```
**Firefox Add-ons:** summary = the summary above (AMO allows 250 characters) ·
category *Bookmarks* · licence *GNU General Public License v3.0 or later* (`GPL-3.0-or-later` — not "only") · Firefox
(desktop) only — not Android · the same privacy-policy URL · support site: the
repository's issues.
## Microsoft Edge Add-ons (since v1.3.0)
A description of its own, pasted whole. Edge's developer policy (1.1.2) says a
listing "must not reference other browsers", and Partner Center flags any
browser name in the description — it did on 2026-11-18, for "Firefox". So this
copy names no browser but Edge: the import bullet describes the files by what
they are, and the export bullet says "every major browser" instead of listing
seven. `tests/unit/store-listing.test.ts` fails if a name comes back.
```
Move your bookmarks between browsers the simple way: with a file. No account.
No cloud sync. 100% offline.
WHAT IT DOES
• Import bookmark files (HTML, JSON, CSV) — including the "Bookmarks" file
that Edge and similar browsers keep in their profile folder, and JSON
bookmark backups — with a full preview before anything is written: counts,
folders and duplicates first.
• Choose how to import: into a new dated folder (safe default), merge into
the folders you already have, or replace everything (it shows exactly what
will be deleted and saves a safety backup first).
• Can skip links you already have.
• Export everything — or just the folders you pick — to HTML (the standard
bookmark file every major browser can import), JSON, CSV, or Markdown.
• Edit your bookmark tree: search, rename, drag to move or reorder, sort a
folder A→Z, create folders, delete, and find duplicate links.
PRIVACY BY DESIGN
• Works entirely on your device. No servers, no analytics, no tracking.
• Only two permissions: "bookmarks" (the whole point) and "storage" (your
settings). Nothing else.
• Free & open source (GPL-3.0) — read the code on GitHub.
LANGUAGES
English · Tiếng Việt · 日本語 · 简体中文 · Română
LIMITATIONS (HONESTY CORNER)
• Favicons can't be imported — the extensions API for bookmarks has no
favicon field.
• Imported bookmarks get today's date — browsers don't let extensions set a
bookmark's original creation date. Your exported files keep the real dates.
• CSV is a flattened view: empty folders and "which folder is the toolbar"
aren't preserved. Use HTML or JSON for a faithful backup.
Source code, issue tracker & privacy policy:
https://github.com/poli0981/bookmarkmagic
```
**Edge Add-ons:** category *Productivity* · the same privacy-policy URL.
+79
View File
@@ -60,3 +60,82 @@ https://github.com/poli0981/bookmarkmagic
法的文書は英語のみです(`docs/14`)。プライバシーポリシーの URL は EN 版と
同じものを使います。
## Firefox Add-ons(v1.3.0 以降)
上の説明文のうち、Chrome に触れている 2 項目を次のものに置き換えて使います(Firefox ではそのままでは正しくないため):
```
• ブックマークファイル(HTML、JSON、CSV)をインポートします。Chromium 系
ブラウザ(Chrome、Edge、Brave など)のプロファイルフォルダにある
「Bookmarks」ファイルや Firefox の JSON バックアップにも対応。書き込む前に
必ずプレビューを表示し、件数・フォルダ・重複を先に確認できます。
```
```
• インポートしたブックマークの日付は本日になります。拡張機能がブックマーク
の元の作成日を設定することをブラウザが許可していないためです。エクスポート
したファイルには本来の日付が残ります。
```
Firefox Add-ons のみ、「制限事項」に追加:
```
• Firefox の区切り線は保持されません。エクスポートとバックアップには含まれず、
置き換えでは削除されます(事前に表示されます)。
```
**Firefox Add-ons:** 概要 = 上の概要 · カテゴリ *Bookmarks* · ライセンス
*GNU General Public License v3.0 or later* (`GPL-3.0-or-later` — not "only") · Firefox(デスクトップ)のみ · 同じ
プライバシーポリシー URL。
## Microsoft Edge Add-ons(v1.3.0 以降)
専用の説明文を、そのまま丸ごと貼り付けます。Edge の開発者ポリシー(1.1.2)は
リスティングが他のブラウザに言及することを認めておらず、Partner Center は説明文
にブラウザ名があると警告します(2026-11-18 に「Firefox」で警告が出ました)。
そのため、この説明文は Edge 以外のブラウザ名を含みません。名前が戻ると
`tests/unit/store-listing.test.ts` が失敗します。
```
ブックマークをブラウザ間で移すいちばん簡単な方法は、ファイルを使うことです。
アカウント不要、クラウド同期なし、完全オフラインで動作します。
できること
• ブックマークファイル(HTML、JSON、CSV)をインポートします。Edge などの
ブラウザがプロファイルフォルダに保存している「Bookmarks」ファイルや、
JSON 形式のブックマークのバックアップにも対応。書き込む前に必ずプレビュー
を表示し、件数・フォルダ・重複を先に確認できます。
• インポート方法を選べます。日付付きの新しいフォルダに入れる(安全な既定
値)、既存のフォルダに統合する、またはすべて置き換える(削除される内容を
正確に示し、安全のためのバックアップを先に保存します)。
• すでにあるリンクはスキップできます。
• すべて、または選んだフォルダだけを HTML(主要なブラウザならどれでも
インポートできる標準のブックマークファイル)、JSON、CSV、Markdown に
エクスポートできます。
• ブックマークツリーを編集できます。検索、名前の変更、ドラッグでの移動と
並べ替え、フォルダの A→Z 並べ替え、フォルダの作成、削除、重複リンクの検出。
設計としてのプライバシー
• すべて端末上で動作します。サーバーも、分析も、トラッキングもありません。
• 権限は 2 つだけです。「bookmarks」(本来の目的)と「storage」(設定の
保存)。それ以外は要求しません。
• 無料・オープンソース(GPL-3.0)です。コードは GitHub で確認できます。
対応言語
English · Tiếng Việt · 日本語 · 简体中文 · Română
制限事項(正直に)
• ファビコンはインポートできません。ブラウザのブックマーク API に
ファビコンの項目がないためです。
• インポートしたブックマークの日付は本日になります。拡張機能がブックマーク
の元の作成日を設定することをブラウザが許可していないためです。エクスポート
したファイルには本来の日付が残ります。
• CSV はフラットな形式です。空のフォルダや「どれがブックマークバーか」は
保持されません。忠実なバックアップには HTML か JSON をお使いください。
ソースコード、問題の報告、プライバシーポリシー:
https://github.com/poli0981/bookmarkmagic
```
**Edge Add-ons:** カテゴリ *Productivity* · 同じプライバシーポリシー URL。
+85
View File
@@ -66,3 +66,88 @@ https://github.com/poli0981/bookmarkmagic
Documentele juridice există doar în limba engleză (`docs/14`); URL-ul politicii
de confidențialitate este același ca în versiunea în engleză.
## Firefox Add-ons (din v1.3.0)
Descrierea de mai sus, cu cele două puncte care numesc Chrome înlocuite de acestea — în Firefox n-ar fi adevărate așa cum sunt scrise:
```
• Importă fișiere de marcaje (HTML, JSON, CSV) — inclusiv fișierul „Bookmarks”
din dosarul profilului unui browser Chromium (Chrome, Edge, Brave…) și copiile
de rezervă JSON din Firefox — cu o previzualizare completă înainte de a scrie
ceva: numărul de marcaje, dosarele și duplicatele, de la început.
```
```
• Marcajele importate primesc data de azi — browserele nu permit extensiilor să
seteze data originală de creare a unui marcaj. Fișierele exportate păstrează
datele reale.
```
Doar pentru Firefox Add-ons, adăugați la LIMITĂRI:
```
• Separatoarele din Firefox nu se păstrează: exporturile și copiile de rezervă le
omit, iar înlocuirea le șterge (vă anunță înainte).
```
**Firefox Add-ons:** rezumat = rezumatul de mai sus · categoria *Bookmarks* ·
licența *GNU General Public License v3.0 or later* (`GPL-3.0-or-later` — not "only") · doar Firefox (desktop) · același
URL al politicii de confidențialitate.
## Microsoft Edge Add-ons (din v1.3.0)
O descriere proprie, lipită întreagă. Politica pentru dezvoltatori a Edge (1.1.2)
nu permite ca o listare să menționeze alte browsere, iar Partner Center
avertizează la orice nume de browser din descriere (a făcut-o pe 2026-11-18,
pentru „Firefox”). Așadar textul acesta nu numește niciun browser în afară de
Edge; `tests/unit/store-listing.test.ts` eșuează dacă un nume revine.
```
Mutați marcajele între browsere în cel mai simplu mod: cu un fișier. Fără cont.
Fără sincronizare în cloud. 100% offline.
CE FACE
• Importă fișiere de marcaje (HTML, JSON, CSV) — inclusiv fișierul „Bookmarks”
pe care Edge și browserele similare îl păstrează în dosarul profilului, precum
și copiile de rezervă JSON ale marcajelor — cu o previzualizare completă
înainte de a scrie ceva: numărul de marcaje, dosarele și duplicatele, de la
început.
• Alegeți cum se face importul: într-un dosar nou cu dată (varianta sigură,
implicită), prin îmbinare cu dosarele pe care le aveți deja sau prin
înlocuirea completă (arată exact ce se va șterge și salvează mai întâi o
copie de rezervă de siguranță).
• Poate omite linkurile pe care le aveți deja.
• Exportă tot — sau doar dosarele alese — în HTML (fișierul standard de
marcaje, pe care îl importă toate browserele principale), JSON, CSV sau
Markdown.
• Editează arborele de marcaje: căutare, redenumire, mutare și reordonare
prin tragere, sortarea unui dosar A→Z, dosare noi, ștergere și găsirea
linkurilor duplicate.
CONFIDENȚIALITATE PRIN DESIGN
• Funcționează în întregime pe dispozitivul dumneavoastră. Fără servere, fără
statistici, fără urmărire.
• Doar două permisiuni: „bookmarks” (rostul extensiei) și „storage” (setările
dumneavoastră). Nimic altceva.
• Gratuit și open source (GPL-3.0) — puteți citi codul pe GitHub.
LIMBI
English · Tiếng Việt · 日本語 · 简体中文 · Română
LIMITĂRI (CU SINCERITATE)
• Pictogramele site-urilor nu pot fi importate — API-ul pentru marcaje al
extensiilor nu are un câmp pentru ele.
• Marcajele importate primesc data de azi — browserele nu permit extensiilor să
seteze data originală de creare a unui marcaj. Fișierele exportate păstrează
datele reale.
• CSV este o vedere aplatizată: dosarele goale și „care dosar este bara de
marcaje” nu se păstrează. Pentru o copie de rezervă fidelă, folosiți HTML sau
JSON.
Cod sursă, raportarea problemelor și politica de confidențialitate:
https://github.com/poli0981/bookmarkmagic
```
**Edge Add-ons:** categoria *Productivity* · același URL al politicii de
confidențialitate.
+79
View File
@@ -55,3 +55,82 @@ https://github.com/poli0981/bookmarkmagic
Lưu ý: các tài liệu pháp lý chỉ có bản tiếng Anh (`docs/14`), nên URL chính sách
riêng tư giống hệt bản EN.
## Firefox Add-ons (từ v1.3.0)
Dùng phần mô tả ở trên, thay hai gạch đầu dòng có nhắc Chrome bằng hai dòng sau — trên Firefox, viết như cũ sẽ không đúng:
```
• Nhập tệp bookmark (HTML, JSON, CSV) — kể cả tệp "Bookmarks" trong thư mục
hồ sơ của trình duyệt Chromium (Chrome, Edge, Brave…) và bản sao lưu JSON
của Firefox — và xem trước đầy đủ trước khi ghi bất cứ thứ gì: số lượng,
thư mục và mục trùng lặp.
```
```
• Bookmark được nhập vào sẽ mang ngày hôm nay — trình duyệt không cho phép tiện
ích đặt lại ngày tạo gốc của một bookmark. Các tệp bạn xuất ra vẫn giữ ngày thật.
```
Riêng Firefox Add-ons, thêm vào phần GIỚI HẠN:
```
• Đường phân cách của Firefox không được giữ: tệp xuất và bản sao lưu bỏ qua
chúng, và chế độ Thay thế sẽ xóa chúng (có báo trước).
```
**Firefox Add-ons:** tóm tắt = phần tóm tắt ở trên · danh mục *Bookmarks* ·
giấy phép *GNU General Public License v3.0 or later* (`GPL-3.0-or-later` — not "only") · chỉ Firefox (máy tính) · cùng
URL chính sách quyền riêng tư.
## Microsoft Edge Add-ons (từ v1.3.0)
Một bản mô tả riêng, dán nguyên khối. Chính sách nhà phát triển của Edge (1.1.2)
không cho listing nhắc đến trình duyệt khác, và Partner Center cảnh báo khi mô
tả có tên trình duyệt nào — ngày 2026-11-18 nó đã báo vì chữ "Firefox". Vì vậy
bản này không nêu tên trình duyệt nào ngoài Edge: gạch về nhập tệp mô tả tệp
theo đúng bản chất của nó, gạch về xuất tệp ghi "mọi trình duyệt phổ biến" thay
cho danh sách bảy cái tên. `tests/unit/store-listing.test.ts` báo lỗi nếu một
cái tên quay lại.
```
Chuyển bookmark giữa các trình duyệt theo cách đơn giản nhất: bằng một tệp.
Không tài khoản. Không đồng bộ đám mây. Hoàn toàn offline.
TIỆN ÍCH NÀY LÀM GÌ
• Nhập tệp bookmark (HTML, JSON, CSV) — kể cả tệp "Bookmarks" mà Edge và các
trình duyệt tương tự lưu trong thư mục hồ sơ, cùng bản sao lưu bookmark dạng
JSON — và xem trước đầy đủ trước khi ghi bất cứ thứ gì: số lượng, thư mục
và mục trùng lặp.
• Chọn cách nhập: vào một thư mục mới theo ngày (mặc định an toàn), gộp vào
các thư mục bạn đã có, hoặc thay thế toàn bộ (cho biết chính xác những gì
sẽ bị xóa và lưu bản sao lưu an toàn trước).
• Có thể bỏ qua các liên kết bạn đã có.
• Xuất toàn bộ — hoặc chỉ những thư mục bạn chọn — ra HTML (tệp bookmark
chuẩn mà mọi trình duyệt phổ biến đều nhập được), JSON, CSV hoặc Markdown.
• Chỉnh sửa cây bookmark: tìm kiếm, đổi tên, kéo thả để di chuyển hoặc đổi
thứ tự, sắp xếp thư mục A→Z, tạo thư mục, xoá và tìm liên kết trùng lặp.
RIÊNG TƯ NGAY TỪ THIẾT KẾ
• Chạy hoàn toàn trên máy bạn. Không máy chủ, không phân tích, không theo dõi.
• Chỉ hai quyền: "bookmarks" (chính là mục đích của tiện ích) và "storage"
(thiết lập của bạn). Không gì khác.
• Miễn phí & mã nguồn mở (GPL-3.0) — bạn có thể đọc mã trên GitHub.
NGÔN NGỮ
English · Tiếng Việt · 日本語 · 简体中文 · Română
GIỚI HẠN (NÓI THẲNG)
• Không thể nhập favicon — API bookmark của trình duyệt không có trường
favicon.
• Bookmark được nhập vào sẽ mang ngày hôm nay — trình duyệt không cho phép tiện
ích đặt lại ngày tạo gốc của một bookmark. Các tệp bạn xuất ra vẫn giữ ngày
thật.
• CSV là dạng phẳng: thư mục rỗng và thông tin "thư mục nào là thanh bookmark"
sẽ không được giữ lại. Hãy dùng HTML hoặc JSON nếu muốn sao lưu trung thực.
Mã nguồn, nơi báo lỗi & chính sách riêng tư:
https://github.com/poli0981/bookmarkmagic
```
**Edge Add-ons:** danh mục *Productivity* · cùng URL chính sách quyền riêng tư.
+70
View File
@@ -54,3 +54,73 @@ https://github.com/poli0981/bookmarkmagic
```
法律文件仅有英文版本(`docs/14`),隐私政策 URL 与英文版相同。
## Firefox Add-ons(v1.3.0 起)
使用上面的描述,并把提到 Chrome 的两条换成下面两条——原文在 Firefox 上并不成立:
```
• 导入书签文件(HTML、JSON、CSV)——包括 Chromium 内核浏览器(Chrome、Edge、
Brave 等)个人资料文件夹中的“Bookmarks”文件和 Firefox 的 JSON 备份。写入
任何内容之前都会先完整预览:数量、文件夹和重复项一目了然。
```
```
• 导入的书签日期为今天——浏览器不允许扩展程序设置书签的原始创建日期。
您导出的文件会保留真实日期。
```
仅 Firefox Add-ons:在“限制”中添加:
```
• Firefox 的分隔线不会保留:导出和备份都不包含分隔线,替换模式会删除它们
(事先会提示)。
```
**Firefox Add-ons:** 摘要 = 上面的摘要 · 类别 *Bookmarks* · 许可证
*GNU General Public License v3.0 or later* (`GPL-3.0-or-later` — not "only") · 仅限 Firefox(桌面版)· 相同的隐私政策 URL。
## Microsoft Edge Add-ons(v1.3.0 起)
使用一份单独的完整描述,整段粘贴。Edge 的开发者政策(1.1.2)规定商品页面不得提及
其他浏览器,描述中出现浏览器名称时 Partner Center 也会发出警告(2026-11-18 曾因
“Firefox”而警告)。因此这份描述除 Edge 外不提任何浏览器;若有名称被加回,
`tests/unit/store-listing.test.ts` 会失败。
```
在浏览器之间转移书签,最简单的方式就是用一个文件。无需账户,没有云同步,
100% 离线运行。
功能
• 导入书签文件(HTML、JSON、CSV)——包括 Edge 等浏览器保存在个人资料文件夹中的
“Bookmarks”文件,以及 JSON 格式的书签备份。写入任何内容之前都会先完整预览:
数量、文件夹和重复项一目了然。
• 自选导入方式:放入一个带日期的新文件夹(安全的默认选项)、合并到您已有的
文件夹,或全部替换(会准确显示将删除的内容,并先保存一份安全备份)。
• 可以跳过您已有的链接。
• 导出全部书签,或只导出您选择的文件夹,格式可选 HTML(各主流浏览器都能导入的
标准书签文件)、JSON、CSV 或 Markdown。
• 编辑书签树:搜索、重命名、拖动以移动或重新排序、将文件夹按 A→Z 排序、
新建文件夹、删除,以及查找重复的链接。
隐私至上的设计
• 完全在您的设备上运行。没有服务器,没有分析,没有跟踪。
• 只有两项权限:“bookmarks”(核心功能)和“storage”(保存您的设置)。
仅此而已。
• 免费且开源(GPL-3.0)——可在 GitHub 上查看代码。
语言
English · Tiếng Việt · 日本語 · 简体中文 · Română
局限(坦诚说明)
• 无法导入网站图标——扩展程序的书签 API 没有网站图标字段。
• 导入的书签日期为今天——浏览器不允许扩展程序设置书签的原始创建日期。
您导出的文件会保留真实日期。
• CSV 是扁平化的视图:空文件夹以及“哪个文件夹是书签栏”都不会保留。
如需完整备份,请使用 HTML 或 JSON。
源代码、问题跟踪和隐私政策:
https://github.com/poli0981/bookmarkmagic
```
**Edge Add-ons:** 类别 *Productivity* · 相同的隐私政策 URL。
+102 -13
View File
@@ -1,23 +1,46 @@
import type { LiveNode } from '@/lib/browser/bookmarks';
import { type LiveNode, type MoveDestination, moveIndexFor } from '@/lib/browser/live-tree';
/**
* Hand-rolled `chrome.bookmarks` mock — docs/11 §4.
* Hand-rolled `bookmarks` mock — docs/11 §4.
*
* WXT's fakeBrowser stubs `bookmarks.*` with "not implemented" throws, so this
* is an in-memory tree with call recording and failure injection. It models the
* behaviours the write queue depends on: create appends when no index is given,
* and ids are handed out in creation order.
*
* Two flavours (since v1.3.0, docs/11 §4). `chromium` — the default — has the
* synthetic root "0" and the roots "1"/"2"/"3" with `folderType`, hides an
* empty Mobile root as desktop Chrome does, and counts a same-folder move's
* index before the node's removal. `firefox` behaves as Firefox's source says
* its API does (ext-bookmarks.js, Places' Bookmarks.sys.mjs): GUID roots in
* the order Menu, Toolbar, Other, Mobile, all four always listed, no
* `folderType`, a `type` on every node, separators as `{ type: 'separator',
* url: 'data:' }`, a same-folder move's index read as the final position, and
* addresses over 65 536 characters refused.
*/
export interface FakeBookmarksOptions {
/** Throw on the Nth create (1-based), to test partial-failure reporting. */
failOnCreate?: number;
/** Throw on the Nth removeTree (1-based) — the Replace path's equivalent. */
failOnRemoveTree?: number;
flavour?: 'chromium' | 'firefox';
}
/** Firefox's permanent folders, in `getTree()` order. */
export const FIREFOX_ROOTS = {
menu: 'menu________',
toolbar: 'toolbar_____',
other: 'unfiled_____',
mobile: 'mobile______',
} as const;
const FIREFOX_MAX_URL = 65_536;
export class FakeBookmarks {
readonly calls: string[] = [];
readonly flavour: 'chromium' | 'firefox';
private readonly nodes = new Map<string, LiveNode>();
private readonly rootId: string;
private nextId = 100;
private createCount = 0;
private removeCount = 0;
@@ -27,6 +50,23 @@ export class FakeBookmarks {
constructor(options: FakeBookmarksOptions = {}) {
this.options = options;
this.flavour = options.flavour ?? 'chromium';
if (this.flavour === 'firefox') {
this.rootId = 'root________';
this.nodes.set(this.rootId, { id: this.rootId, title: '', type: 'folder', children: [] });
for (const [id, title] of [
[FIREFOX_ROOTS.menu, 'Bookmarks Menu'],
[FIREFOX_ROOTS.toolbar, 'Bookmarks Toolbar'],
[FIREFOX_ROOTS.other, 'Other Bookmarks'],
[FIREFOX_ROOTS.mobile, 'Mobile Bookmarks'],
] as const) {
const node: LiveNode = { id, parentId: this.rootId, title, type: 'folder', children: [] };
this.nodes.set(id, node);
this.root.children?.push(node);
}
return;
}
this.rootId = '0';
// The synthetic root and the three Chromium roots.
this.nodes.set('0', { id: '0', title: '', children: [] });
for (const [id, title, folderType] of [
@@ -41,14 +81,14 @@ export class FakeBookmarks {
}
private get root(): LiveNode {
return this.nodes.get('0') as LiveNode;
return this.nodes.get(this.rootId) as LiveNode;
}
/** Add a policy-managed root, which every write path must skip. */
addManagedRoot(): LiveNode {
const node: LiveNode = {
id: 'managed',
parentId: '0',
parentId: this.rootId,
title: 'Managed bookmarks',
unmodifiable: 'managed',
children: [],
@@ -64,6 +104,24 @@ export class FakeBookmarks {
return created.id;
}
/** Firefox only: a separator line under a parent, returning its id. */
addSeparator(parentId: string, index?: number): string {
if (this.flavour !== 'firefox') throw new Error('Chromium has no separators');
const parent = this.nodes.get(parentId);
if (parent?.children === undefined) throw new Error(`no such parent: ${parentId}`);
const node: LiveNode = {
id: String(this.nextId++),
parentId,
title: '',
type: 'separator',
url: 'data:',
};
this.nodes.set(node.id, node);
if (index === undefined) parent.children.push(node);
else parent.children.splice(index, 0, node);
return node.id;
}
private createSync(details: {
parentId: string;
title: string;
@@ -77,6 +135,9 @@ export class FakeBookmarks {
// parser refuses is rejected — mid-write, which is why readers skip them.
const url = details.url === '' ? undefined : details.url;
if (url !== undefined && !URL.canParse(url)) throw new Error('Invalid URL.');
if (this.flavour === 'firefox' && url !== undefined && url.length > FIREFOX_MAX_URL) {
throw new Error('URL too long.');
}
const node: LiveNode = {
id: String(this.nextId++),
@@ -84,6 +145,7 @@ export class FakeBookmarks {
title: details.title,
...(url !== undefined && { url }),
...(url === undefined && { children: [] }),
...(this.flavour === 'firefox' && { type: url === undefined ? 'folder' : 'bookmark' }),
};
this.nodes.set(node.id, node);
@@ -98,8 +160,9 @@ export class FakeBookmarks {
// --- the API surface the adapter uses -------------------------------------
/**
* Like desktop Chrome, an EMPTY Mobile root is left out of the tree (it
* still exists, accepts writes, and `get('3')` returns it).
* Like desktop Chrome, an EMPTY Mobile root is left out of the Chromium tree
* (it still exists, accepts writes, and `get('3')` returns it). Firefox lists
* all four of its roots, always.
*/
getTree = async (): Promise<LiveNode[]> => {
this.calls.push('getTree');
@@ -148,7 +211,15 @@ export class FakeBookmarks {
this.nodes.delete(id);
};
move = async (id: string, destination: { parentId?: string; index?: number }): Promise<void> => {
/**
* `bookmarks.move` as the browser has it: resolves to the moved node, with
* its new `index`. Chromium reads a same-parent index as counted BEFORE the
* node was removed; Firefox reads it as the final position.
*/
move = async (
id: string,
destination: { parentId?: string; index?: number },
): Promise<LiveNode> => {
this.calls.push(`move:${id}:${destination.parentId ?? ''}:${destination.index ?? ''}`);
const node = this.nodes.get(id);
if (node === undefined) throw new Error(`no such node: ${id}`);
@@ -160,11 +231,27 @@ export class FakeBookmarks {
from.children.splice(oldIndex, 1);
const siblings = to.children ?? [];
let index = destination.index ?? siblings.length;
// Chrome reads a same-parent index as counted BEFORE the node was removed.
if (from === to && index > oldIndex) index--;
siblings.splice(Math.min(index, siblings.length), 0, node);
if (this.flavour === 'chromium' && from === to && index > oldIndex) index--;
const at = Math.min(index, siblings.length);
siblings.splice(at, 0, node);
to.children = siblings;
node.parentId = to.id;
const { children: _children, ...bare } = node;
return structuredClone({ ...bare, index: at });
};
/**
* The adapter's `move` (`browser/bookmarks.ts`) over this fake: sends the
* index this flavour's rule expects and resolves to where the node landed —
* what an `EditApi` built on the fake passes as its `move`.
*/
moveTo = async (id: string, destination: MoveDestination): Promise<number | undefined> => {
const { parentId, position } = destination;
const moved = await this.move(id, {
...(parentId !== undefined && { parentId }),
...(position !== undefined && { index: moveIndexFor(position, this.flavour) }),
});
return moved.index;
};
update = async (id: string, changes: { title?: string; url?: string }): Promise<void> => {
@@ -187,8 +274,10 @@ export class FakeBookmarks {
/** The writable roots as a title/url outline, ids dropped — for whole-tree comparisons. */
outline(): unknown[] {
const shape = (node: LiveNode): unknown =>
node.url === undefined ? { [node.title]: (node.children ?? []).map(shape) } : node.url;
const shape = (node: LiveNode): unknown => {
if (node.type === 'separator') return '---';
return node.url === undefined ? { [node.title]: (node.children ?? []).map(shape) } : node.url;
};
return (this.root.children ?? []).map(shape);
}
@@ -202,7 +291,7 @@ export class FakeBookmarks {
return (this.nodes.get(parentId)?.children ?? []).map((child) => child.title);
}
/** Total nodes created since construction (excludes the four roots). */
/** Total nodes created since construction (excludes the roots). */
get created(): number {
return this.nodes.size - (this.root.children?.length ?? 0) - 1;
}
+46 -3
View File
@@ -19,9 +19,9 @@ vi.mock('wxt/browser', () => ({
},
}));
const { clearRoots, flattenLive, getRoots, toBookmarkNodes } = await import(
'@/lib/browser/bookmarks'
);
const { clearRoots } = await import('@/lib/browser/bookmarks');
const { flattenLive, toBookmarkNodes } = await import('@/lib/browser/live-tree');
const { getRoots } = await import('@/lib/browser/roots');
beforeEach(() => {
current = new FakeBookmarks();
@@ -141,6 +141,49 @@ describe('getRoots', () => {
expect(roots.replaceable.map((r) => r.id)).toEqual(['1', '2', '3']);
expect(roots.writable.map((r) => r.id)).toEqual(['50', '51', '1', '2']);
});
it('falls back to position for roots with neither folderType nor a known id', async () => {
// The path that mapped Firefox's roots wrongly before v1.3.0: nothing
// else in the suite reaches it, since both fakes have known ids.
const folder = (id: string, title: string) => ({ id, parentId: 'r', title, children: [] });
current.getTree = async () => [
{
id: 'r',
title: '',
children: [folder('a', 'Bar'), folder('b', 'Other'), folder('c', 'Mobile')],
},
];
const roots = await getRoots();
expect([roots.toolbarId, roots.otherId, roots.mobileId, roots.menuId]).toEqual([
'a',
'b',
'c',
undefined,
]);
});
it('never takes a Bookmarks Menu by position, even when it is listed first', async () => {
const folder = (id: string, title: string) => ({ id, parentId: 'r', title, children: [] });
current.getTree = async () => [
{
id: 'r',
title: '',
children: [
folder('menu________', 'Bookmarks Menu'),
folder('x', 'Bar'),
folder('y', 'Other'),
folder('z', 'Mobile'),
],
},
];
const roots = await getRoots();
expect([roots.toolbarId, roots.otherId, roots.mobileId, roots.menuId]).toEqual([
'x',
'y',
'z',
'menu________',
]);
});
});
describe('clearRoots', () => {
+20 -8
View File
@@ -1,6 +1,7 @@
import { afterEach, describe, expect, it } from 'vitest';
import { describeError } from '@/lib/browser/describe-error';
import {
browserOf,
clearDiagnostics,
errorName,
installCrashHooks,
@@ -29,14 +30,25 @@ describe('diagnostics', () => {
it('puts the context first and nothing personal anywhere', () => {
const report = JSON.parse(snapshot(CONTEXT));
expect(report).toMatchObject({ app: 'BookmarkMagic', ...CONTEXT });
expect(Object.keys(report)).toEqual([
'app',
'version',
'locale',
'theme',
'chromeMajor',
'events',
]);
expect(Object.keys(report)).toEqual(['app', 'version', 'locale', 'theme', 'browser', 'events']);
});
it.each([
[
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:160.0) Gecko/20100101 Firefox/160.0',
'Firefox 160',
],
[
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0',
'Edge 142',
],
[
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36',
'Chrome 142',
],
['', 'unknown'],
])('names the browser from %j', (userAgent, expected) => {
expect(browserOf(userAgent)).toBe(expected);
});
it('logs every described failure by code — never by its detail text', () => {
+106
View File
@@ -0,0 +1,106 @@
import { describe, expect, it } from 'vitest';
import {
countLive,
isSeparator,
type LiveNode,
moveIndexFor,
toBookmarkNodes,
withoutSeparators,
} from '@/lib/browser/live-tree';
/**
* The pure half of the bookmarks adapter — docs/02 §4. Firefox's separators
* come with `url: "data:"`, so every "has a url, so it is a bookmark" test
* would count, export and dedupe them as bookmarks; these pin the one
* recognition rule (`type`) and everything built on it.
*/
const separator = (id: string): LiveNode => ({ id, title: '', type: 'separator', url: 'data:' });
const bookmark = (id: string, url = `https://${id}.example/`): LiveNode => ({
id,
title: id,
url,
type: 'bookmark',
});
const FIREFOX_TREE: LiveNode[] = [
{
id: 'menu________',
title: 'Bookmarks Menu',
type: 'folder',
children: [bookmark('a'), separator('s1'), bookmark('b')],
},
{
id: 'toolbar_____',
title: 'Bookmarks Toolbar',
type: 'folder',
children: [
{ id: 'f', title: 'Dev', type: 'folder', children: [separator('s2'), bookmark('c')] },
],
},
];
describe('isSeparator', () => {
it('goes by type, never by url', () => {
expect(isSeparator(separator('x'))).toBe(true);
// A real bookmark to a data: address is still a bookmark.
expect(isSeparator(bookmark('d', 'data:text/plain,hi'))).toBe(false);
expect(isSeparator({ id: 'chrome', title: 'no type at all' } as LiveNode)).toBe(false);
});
});
describe('withoutSeparators', () => {
it('removes separators at every depth and keeps everything else in order', () => {
const out = withoutSeparators(FIREFOX_TREE);
expect(out[0]?.children?.map((n) => n.id)).toEqual(['a', 'b']);
expect(out[1]?.children?.[0]?.children?.map((n) => n.id)).toEqual(['c']);
});
it('returns untouched leaves as they are', () => {
const leaf = bookmark('z');
expect(withoutSeparators([leaf])[0]).toBe(leaf);
});
});
describe('countLive', () => {
it('counts separators apart from bookmarks and folders', () => {
expect(countLive(FIREFOX_TREE)).toEqual({ bookmarks: 3, folders: 3, separators: 2 });
});
it('is all zero on an empty forest', () => {
expect(countLive([])).toEqual({ bookmarks: 0, folders: 0, separators: 0 });
});
});
describe('toBookmarkNodes', () => {
it('leaves separators out — no format BookmarkMagic writes can hold one', () => {
const nodes = toBookmarkNodes(FIREFOX_TREE);
expect(JSON.stringify(nodes)).not.toContain('data:');
expect(nodes[0]?.children?.map((n) => n.url)).toEqual([
'https://a.example/',
'https://b.example/',
]);
});
it('marks the Bookmarks Menu as root "menu" (docs/04 §2)', () => {
const [menu, toolbar] = toBookmarkNodes(FIREFOX_TREE, {
toolbarId: 'toolbar_____',
menuId: 'menu________',
});
expect(menu?.root).toBe('menu');
expect(toolbar?.toolbar).toBe(true);
});
});
describe('moveIndexFor — each browser its own rule (docs/05 §10)', () => {
// Moving `a` after `c` in [a, b, c]: before removal 3, after removal 2.
const position = { api: 3, local: 2 };
it('sends Chromium the index counted before the node is removed', () => {
expect(moveIndexFor(position, 'chromium')).toBe(3);
});
it('sends Firefox the final position', () => {
expect(moveIndexFor(position, 'firefox')).toBe(2);
});
});
+196
View File
@@ -0,0 +1,196 @@
import { describe, expect, it } from 'vitest';
import { capUrlLength } from '@/lib/core/href';
import type { BookmarkNode, ParseResult } from '@/lib/core/model';
import { computeStats } from '@/lib/core/model';
import { parseBmJson } from '@/lib/core/parse/bm-json';
import { readFirefoxJson } from '@/lib/core/parse/firefox-json';
import { parseNetscapeHtml } from '@/lib/core/parse/netscape-html';
import { buildImportPlan } from '@/lib/core/plan';
import { routeTopLevel } from '@/lib/core/route';
import { serializeBmJson } from '@/lib/core/serialize/bm-json';
import { serializeNetscapeHtml } from '@/lib/core/serialize/netscape-html';
/**
* Firefox's Bookmarks Menu, separators and address limit in the pure core —
* docs/03 §1, docs/04 (since v1.3.0).
*/
const link = (title: string): BookmarkNode => ({ title, url: `https://${title}.example/` });
/** A Firefox profile's export as BookmarkMagic models it: four marked roots. */
const FIREFOX_EXPORT: BookmarkNode[] = [
{ title: 'Bookmarks Menu', root: 'menu', children: [link('m1'), link('m2')] },
{ title: 'Bookmarks Toolbar', toolbar: true, children: [link('t1')] },
{ title: 'Other Bookmarks', root: 'other', children: [link('o1')] },
{ title: 'Mobile Bookmarks', root: 'mobile', children: [link('p1')] },
];
const titles = (nodes: readonly BookmarkNode[]): string[] => nodes.map((n) => n.title);
describe('routeTopLevel — the Bookmarks Menu', () => {
it('unwraps a menu folder into the menu, and sends loose entries there, on Firefox', () => {
const routed = routeTopLevel([...FIREFOX_EXPORT, link('loose')], {
hasMobileRoot: true,
hasMenuRoot: true,
});
expect(titles(routed.menu)).toEqual(['m1', 'm2', 'loose']);
expect(titles(routed.toolbar)).toEqual(['t1']);
expect(titles(routed.other)).toEqual(['o1']);
expect(titles(routed.mobile)).toEqual(['p1']);
expect(routed.unwrapped).toBe(4);
});
it('keeps a menu folder as a folder under Other where there is no menu (Chromium)', () => {
const routed = routeTopLevel([...FIREFOX_EXPORT, link('loose')], { hasMobileRoot: true });
expect(routed.menu).toEqual([]);
expect(titles(routed.other)).toEqual(['Bookmarks Menu', 'o1', 'loose']);
expect(routed.unwrapped).toBe(3);
});
it('still keeps a Mobile folder under Other when the profile has no Mobile root', () => {
const routed = routeTopLevel(FIREFOX_EXPORT, { hasMobileRoot: false, hasMenuRoot: true });
expect(titles(routed.other)).toEqual(['o1', 'Mobile Bookmarks']);
});
});
describe('buildImportPlan — a fourth destination', () => {
const destinations = {
menu: { id: 'menu________', title: 'Bookmarks Menu', children: [] },
toolbar: { id: 'toolbar_____', title: 'Bookmarks Toolbar', children: [] },
other: { id: 'unfiled_____', title: 'Other Bookmarks', children: [] },
mobile: { id: 'mobile______', title: 'Mobile Bookmarks', children: [] },
};
it('writes the menu into the menu, first, in Merge and Replace', () => {
for (const mode of ['merge', 'replace'] as const) {
const plan = buildImportPlan({
roots: FIREFOX_EXPORT,
mode,
dedupe: false,
browserIndex: new Set(),
destinations,
newFolderTitle: 'Imported',
});
expect(plan.segments.map((s) => s.parentId)).toEqual([
'menu________',
'toolbar_____',
'unfiled_____',
'mobile______',
]);
expect(plan.stats.bookmarkCount).toBe(5);
}
});
it('puts the New-folder wrapper under Other Bookmarks, as on Chrome', () => {
const plan = buildImportPlan({
roots: FIREFOX_EXPORT,
mode: 'new-folder',
dedupe: false,
browserIndex: new Set(),
destinations,
newFolderTitle: 'Imported',
});
expect(plan.segments.map((s) => s.parentId)).toEqual(['unfiled_____']);
});
});
describe('BM JSON — root "menu"', () => {
it('round-trips the marker (additive; the version stays 1)', () => {
const text = serializeBmJson(FIREFOX_EXPORT, {
version: '1.3.0',
exportedAt: '2026-11-18T00:00:00Z',
});
expect(JSON.parse(text).version).toBe(1);
const { roots } = parseBmJson(text);
expect(roots[0]?.root).toBe('menu');
expect(roots[0]?.children?.map((n) => n.title)).toEqual(['m1', 'm2']);
});
});
describe('Netscape HTML — the menu is written loose, as Firefox writes it', () => {
it('unwraps a top-level menu folder and keeps the marked roots', () => {
const html = serializeNetscapeHtml(FIREFOX_EXPORT);
expect(html).not.toContain('Bookmarks Menu');
const { roots } = parseNetscapeHtml(html);
// The menu's entries come back loose, first, and route into the menu on
// Firefox (above) — the file round-trips there.
expect(titles(roots).slice(0, 2)).toEqual(['m1', 'm2']);
expect(roots[2]?.toolbar).toBe(true);
expect(roots[3]?.root).toBe('other');
expect(roots[4]?.root).toBe('mobile');
});
it('leaves a deeper folder called "menu" alone: markers count at the top only', () => {
const nested: BookmarkNode[] = [
{ title: 'Folder', children: [{ title: 'Inner', root: 'menu', children: [link('x')] }] },
];
expect(parseNetscapeHtml(serializeNetscapeHtml(nested)).roots[0]?.children?.[0]?.title).toBe(
'Inner',
);
});
});
describe('separators a file holds are counted (docs/04 §1.2, §2b)', () => {
it('counts <HR> in HTML', () => {
const html =
'<!DOCTYPE NETSCAPE-Bookmark-file-1><DL><p><DT><A HREF="https://a.example/">a</A><HR><HR>' +
'<DT><A HREF="https://b.example/">b</A></DL><p>';
expect(parseNetscapeHtml(html).warnings).toEqual([{ code: 'SEPARATORS_SKIPPED', count: 2 }]);
});
it('counts separator entries in a Firefox JSON backup', () => {
const doc = {
guid: 'root________',
title: '',
type: 'text/x-moz-place-container',
root: 'placesRoot',
children: [
{
guid: 'menu________',
title: 'menu',
type: 'text/x-moz-place-container',
root: 'bookmarksMenuFolder',
children: [
{ title: 'a', type: 'text/x-moz-place', uri: 'https://a.example/' },
{ type: 'text/x-moz-place-separator' },
{ title: 'b', type: 'text/x-moz-place', uri: 'https://b.example/' },
],
},
],
};
const result = readFirefoxJson(doc);
expect(titles(result.roots)).toEqual(['a', 'b']);
expect(result.warnings).toContainEqual({ code: 'SEPARATORS_SKIPPED', count: 1 });
});
});
describe('capUrlLength — what Firefox refuses for its length (docs/04 §1.2)', () => {
const long = `https://long.example/${'x'.repeat(65_536)}`;
const parsed = (roots: BookmarkNode[]): ParseResult => ({
roots,
stats: computeStats(roots),
warnings: [],
});
it('drops addresses over the limit, at any depth, and says how many', () => {
const result = capUrlLength(
parsed([
link('ok'),
{ title: 'long', url: long },
{ title: 'F', children: [{ title: 'deep', url: long }, link('kept')] },
]),
65_536,
);
expect(result.roots.map((n) => n.title)).toEqual(['ok', 'F']);
expect(result.roots[1]?.children?.map((n) => n.title)).toEqual(['kept']);
expect(result.stats.bookmarks).toBe(2);
expect(result.warnings).toEqual([{ code: 'URL_TOO_LONG', count: 2 }]);
});
it('changes nothing without a limit (Chromium) or when nothing is too long', () => {
const input = parsed([{ title: 'long', url: long }]);
expect(capUrlLength(input, undefined)).toBe(input);
const short = parsed([link('a')]);
expect(capUrlLength(short, 65_536)).toBe(short);
});
});
+3 -2
View File
@@ -75,7 +75,7 @@ describe('parseNetscapeHtml — tolerated shapes', () => {
expect(roots[0]?.children?.[0]?.url).toBe('https://sibling.example/');
});
it('skips <HR> separators silently and keeps both neighbours (docs/04 §1.2)', () => {
it('skips <HR> separators, counts them, and keeps both neighbours (docs/04 §1.2)', () => {
const withHr = `<!DOCTYPE NETSCAPE-Bookmark-file-1>
<DL><p>
<DT><A HREF="https://a.example/">A</A>
@@ -84,7 +84,8 @@ describe('parseNetscapeHtml — tolerated shapes', () => {
</DL><p>`;
const { roots, warnings } = parseNetscapeHtml(withHr);
expect(roots.map((r) => r.url)).toEqual(['https://a.example/', 'https://b.example/']);
expect(warnings).toEqual([]);
// Counted since v1.3.0: once Firefox users import, a silent loss is not acceptable.
expect(warnings).toEqual([{ code: 'SEPARATORS_SKIPPED', count: 1 }]);
});
it('looks past a <DD> that has no nested <DL> to a later sibling list', () => {
+1 -1
View File
@@ -33,7 +33,7 @@ beforeEach(async () => {
getChildren: async (id: string) => fake.children(id),
create: fake.create,
update: fake.update,
move: fake.move,
move: fake.moveTo,
remove: fake.remove,
removeTree: fake.removeTree,
},
+171
View File
@@ -0,0 +1,171 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import type { ImportMode } from '@/lib/browser/storage';
import { FakeBookmarks, FIREFOX_ROOTS } from '../../helpers/fake-bookmarks';
/**
* The import, Replace and export on Firefox — docs/03 §1, docs/02 §4 (since
* v1.3.0), against the Firefox flavour of the fake (docs/11 §4).
*
* Until v1.3.0 `getRoots` fell back to POSITION on Firefox, which lists the
* Bookmarks Menu first: the Menu was taken for the bar, the bar for Other and
* Other for Mobile. A Replace emptied the wrong roots and restored into them.
*/
let current = new FakeBookmarks({ flavour: 'firefox' });
vi.mock('wxt/browser', () => ({
browser: {
bookmarks: {
getTree: () => current.getTree(),
get: (id: string) => current.get(id),
create: (details: Parameters<FakeBookmarks['create']>[0]) => current.create(details),
removeTree: (id: string) => current.removeTree(id),
},
},
}));
const { getRoots, rootMarkersOf } = await import('@/lib/browser/roots');
const { prepareImport, runImport } = await import('@/lib/import/run-import');
const { buildExport, countSelected } = await import('@/lib/export/run-export');
type PickerHost = { showSaveFilePicker?: unknown };
let backups: string[] = [];
beforeEach(() => {
current = new FakeBookmarks({ flavour: 'firefox' });
backups = [];
(globalThis as PickerHost).showSaveFilePicker = async () => ({
createWritable: async () => ({
write: async (data: string) => {
backups.push(data);
},
close: async () => undefined,
}),
});
});
afterEach(() => {
delete (globalThis as PickerHost).showSaveFilePicker;
vi.restoreAllMocks();
});
const { menu: MENU, toolbar: TOOLBAR, other: OTHER, mobile: MOBILE } = FIREFOX_ROOTS;
async function importText(text: string, mode: ImportMode) {
const prepared = await prepareImport(new File([text], 'bookmarks'));
const outcome = await runImport({
prepared,
mode,
dedupe: false,
newFolderTitle: 'Imported',
now: new Date(2026, 10, 18, 12, 0),
signal: new AbortController().signal,
onProgress: () => undefined,
});
return { prepared, outcome };
}
/** Something in all four roots, and separators in two of them. */
function seedProfile(): void {
current.seed(MENU, { title: 'm', url: 'https://m.example/' });
current.addSeparator(MENU);
current.seed(MENU, { title: 'm2', url: 'https://m2.example/' });
current.seed(TOOLBAR, { title: 't', url: 'https://t.example/' });
const dev = current.seed(TOOLBAR, { title: 'Dev' });
current.addSeparator(dev);
current.seed(dev, { title: 'd', url: 'https://d.example/' });
current.seed(OTHER, { title: 'o', url: 'https://o.example/' });
current.seed(MOBILE, { title: 'p', url: 'https://p.example/' });
}
/** A file with each kind of root, as a BookmarkMagic HTML export writes it. */
const HTML = `<!DOCTYPE NETSCAPE-Bookmark-file-1>
<DL><p>
<DT><A HREF="https://loose.example/">loose</A>
<DT><H3 PERSONAL_TOOLBAR_FOLDER="true">Bookmarks bar</H3>
<DL><p>
<DT><A HREF="https://bar.example/">bar</A>
</DL><p>
<DT><H3 UNFILED_BOOKMARKS_FOLDER="true">Other bookmarks</H3>
<DL><p>
<DT><A HREF="https://other.example/">other</A>
</DL><p>
</DL><p>`;
describe('getRoots on Firefox', () => {
it('finds each root by its GUID — never the Menu as the bar', async () => {
const roots = await getRoots();
expect(roots.toolbarId).toBe(TOOLBAR);
expect(roots.otherId).toBe(OTHER);
expect(roots.mobileId).toBe(MOBILE);
expect(roots.menuId).toBe(MENU);
expect(roots.replaceable.map((root) => root.id)).toEqual([TOOLBAR, OTHER, MOBILE, MENU]);
expect(rootMarkersOf(roots)).toEqual({
toolbarId: TOOLBAR,
otherId: OTHER,
mobileId: MOBILE,
menuId: MENU,
});
});
});
describe('import on Firefox', () => {
it('Merge puts each marked root in its own root and loose entries in the Menu', async () => {
await importText(HTML, 'merge');
expect(current.childTitles(MENU)).toEqual(['loose']);
expect(current.childTitles(TOOLBAR)).toEqual(['bar']);
expect(current.childTitles(OTHER)).toEqual(['other']);
});
it('New-folder mode puts the wrapper under Other Bookmarks', async () => {
await importText(HTML, 'new-folder');
expect(current.childTitles(OTHER)).toEqual(['Imported']);
expect(current.childTitles(MENU)).toEqual([]);
});
it('counts separators apart, and never as bookmarks, for the Replace confirmation', async () => {
seedProfile();
const prepared = await prepareImport(new File([HTML], 'bookmarks'));
expect(prepared.current).toEqual({ bookmarks: 6, folders: 1, separators: 2 });
});
it('Replace empties all four roots, separators included, and restores its backup twice', async () => {
seedProfile();
const withoutSeparators = JSON.stringify(current.outline()).replaceAll('"---",', '');
await importText(HTML, 'replace');
expect(JSON.stringify(current.outline())).not.toContain('---');
expect(current.childTitles(MENU)).toEqual(['loose']);
const backup = backups.at(-1) ?? '';
// The backup holds the Menu as a marked root and no separator at all.
expect(backup).toContain('"root":"menu"');
expect(backup).not.toContain('data:');
await importText(backup, 'replace');
expect(JSON.stringify(current.outline())).toBe(withoutSeparators);
await importText(backup, 'replace');
expect(JSON.stringify(current.outline())).toBe(withoutSeparators);
});
});
describe('export on Firefox', () => {
it('writes no separator, counts none as a bookmark, and leaves the Menu loose in HTML', async () => {
seedProfile();
const roots = await getRoots();
const live = (await current.getTree())[0]?.children ?? [];
expect(countSelected(live, undefined)).toBe(6);
const html = buildExport(
live,
{ format: 'netscape-html', now: new Date() },
rootMarkersOf(roots),
);
expect(html.content).not.toContain('data:');
expect(html.content).not.toContain('Bookmarks Menu');
expect(html.content.indexOf('https://m.example/')).toBeLessThan(
html.content.indexOf('PERSONAL_TOOLBAR_FOLDER'),
);
const json = buildExport(live, { format: 'bm-json', now: new Date() }, rootMarkersOf(roots));
expect(json.content).toContain('"root": "menu"');
});
});
+27
View File
@@ -277,3 +277,30 @@ describe('Firefox backups', () => {
]);
});
});
describe('the Replace confirmation counts what Replace deletes', () => {
it('leaves out a signed-in account’s roots, which Replace never empties', async () => {
current.seed('1', { title: 'mine', url: 'https://mine.example/' });
const tree = await current.getTree();
const account = {
id: '50',
title: 'Bookmarks bar',
folderType: 'bookmarks-bar',
syncing: true,
children: [
{ id: '60', parentId: '50', title: 'theirs', url: 'https://theirs.example/' },
{ id: '61', parentId: '50', title: 'theirs too', url: 'https://theirs-too.example/' },
],
};
current.getTree = async () => [
{ ...tree[0], id: '0', title: '', children: [account, ...(tree[0]?.children ?? [])] },
];
const prepared = await prepareImport(
new File(
['<!DOCTYPE NETSCAPE-Bookmark-file-1><DL><DT><A HREF="https://x.example/">x</A></DL>'],
'f',
),
);
expect(prepared.current).toEqual({ bookmarks: 1, folders: 0, separators: 0 });
});
});
+23 -3
View File
@@ -11,7 +11,7 @@ import {
ISSUES_URL,
LEGAL_URLS,
REPO_URL,
STORE_URL,
storeUrlFor,
} from '@/lib/links';
/** Vitest runs with cwd at the project root, which is where `legal/` lives. */
@@ -103,10 +103,30 @@ describe('store listing', () => {
it('is the published item, and is the only in-product route to a review', () => {
// docs/13 §6 counts store ratings as a post-launch channel; before this
// there was no way to reach the listing from inside the extension at all.
expect(STORE_URL.startsWith('https://chromewebstore.google.com/detail/')).toBe(true);
const cws = storeUrlFor({ firefox: false, extensionId: 'eghnciphhegekmnofffpgbdfefckdhmg' });
expect(cws.startsWith('https://chromewebstore.google.com/detail/')).toBe(true);
// The item id doubles as the CHROME_EXTENSION_ID secret (docs/00 §9), so a
// typo here is a typo in two places.
expect(STORE_URL).toContain('eghnciphhegekmnofffpgbdfefckdhmg');
expect(cws).toContain('eghnciphhegekmnofffpgbdfefckdhmg');
});
it('sends each install to the listing it came from (docs/06 §3.5)', () => {
// Firefox: AMO, by the gecko id — percent-encoded, so no address-shaped
// string sits in src/ (the next test).
const amo = storeUrlFor({ firefox: true, extensionId: 'anything' });
expect(amo).toBe('https://addons.mozilla.org/firefox/addon/bookmarkmagic%40poli0981.dev/');
expect(decodeURIComponent(amo)).toContain('bookmarkmagic@poli0981.dev');
// Edge Add-ons assigns its own id — Partner Center's "CRX ID", not the
// Product ID — and an install from there gets the Edge listing.
expect(storeUrlFor({ firefox: false, extensionId: 'nchfchjnlihbifggooggpmmacighmdjg' })).toBe(
'https://microsoftedge.microsoft.com/addons/detail/nchfchjnlihbifggooggpmmacighmdjg',
);
// A Chromium copy with any other id — an unpacked build gets a random
// one — goes to the list of every store.
expect(storeUrlFor({ firefox: false, extensionId: 'abcdefghijklmnopabcdefghijklmnop' })).toBe(
`${REPO_URL}#install`,
);
expect(storeUrlFor({ firefox: false, extensionId: '' })).toBe(`${REPO_URL}#install`);
});
it('puts no email address on any in-product surface', () => {
+21 -4
View File
@@ -89,7 +89,7 @@ describe('manifest', () => {
// Float16Array) that throw on the oldest Chrome still allowed to install.
expect(CONFIG).toMatch(/const CHROME_FLOOR = 136;/);
expect(CONFIG).toMatch(/minimum_chrome_version:\s*String\(CHROME_FLOOR\)/);
expect(CONFIG).toMatch(/target:\s*`chrome\$\{CHROME_FLOOR\}`/);
expect(CONFIG).toMatch(/:\s*`chrome\$\{CHROME_FLOOR\}`/);
// SAFETY: tsconfig.json is a committed file with exactly this shape; a
// missing key fails the expectations below rather than passing silently.
const tsconfig = JSON.parse(readFileSync(join(process.cwd(), 'tsconfig.json'), 'utf8')) as {
@@ -99,6 +99,21 @@ describe('manifest', () => {
expect(tsconfig.compilerOptions.lib).toEqual(['ES2025', 'DOM', 'DOM.Iterable']);
});
it('gives Firefox its own floor and gecko block, and Chrome its own floor (docs/08 §9)', () => {
// The one key that differs between the two packages — chosen by the
// target browser, never both in one manifest.
expect(CONFIG).toMatch(/const FIREFOX_FLOOR = 140;/);
expect(CONFIG).toMatch(
/browser === 'firefox'\s*\?\s*\{ browser_specific_settings: FIREFOX_SETTINGS \}\s*:\s*\{ minimum_chrome_version: String\(CHROME_FLOOR\) \}/,
);
// The id is permanent once on AMO: a change here is a new add-on.
expect(CONFIG).toContain("id: 'bookmarkmagic@poli0981.dev'");
expect(CONFIG).toMatch(/strict_min_version:\s*`\$\{FIREFOX_FLOOR\}\.0`/);
// Firefox's own "collects nothing" — the CWS privacy tab's answer.
expect(CONFIG).toContain("data_collection_permissions: { required: ['none'] }");
expect(CONFIG).toMatch(/env\.browser === 'firefox' \? `firefox\$\{FIREFOX_FLOOR\}`/);
});
it('declares the extension-page CSP once, production-only, and only ever stricter', () => {
// docs/08 §3: the CSP is what makes the zero-network promise browser-
// enforced. check-manifest.mjs pins the exact built string; this pins the
@@ -131,10 +146,12 @@ describe('manifest', () => {
expect(csp.match(/default-src[^"]*/g)).toEqual(["default-src 'none'"]);
});
it('keeps the manifest at v3 by not overriding WXT’s default', () => {
// WXT emits manifest_version 3 for the chrome-mv3 target. An explicit
// downgrade here would be the only way to lose it.
it('builds MV3 for every browser', () => {
// WXT defaults Firefox to MV2; `manifestVersion: 3` is what keeps the
// Firefox package on the manifest, CSP and review story of docs/08.
expect(CONFIG).toMatch(/manifestVersion:\s*3,/);
expect(CONFIG).not.toMatch(/manifest_version\s*:\s*2/);
expect(CONFIG).not.toMatch(/manifestVersion:\s*2/);
});
it('still points default_locale at en, and ships a _locales entry per UI locale', () => {
+13
View File
@@ -134,6 +134,19 @@ describe('checkLockfile', () => {
]);
});
it('expects no credited package in a lockfile that ships nothing (tools/publish)', () => {
const tools = { lockfileVersion: 3, packages: { 'node_modules/cac': { license: 'MIT' } } };
expect(checkLockfile(tools, { shipsCode: false }).problems).toEqual([]);
expect(checkLockfile(tools).problems).toHaveLength(4);
});
it('passes the publish tool lockfile', () => {
const lock: unknown = JSON.parse(
readFileSync(join(process.cwd(), 'tools/publish/package-lock.json'), 'utf8'),
);
expect(checkLockfile(lock, { shipsCode: false }).problems).toEqual([]);
});
it('skips the root project and workspace links', () => {
const lock = lockWith({
'packages/local': { link: true },
Loaded 100 of 109 files, more files were not shown because too many files have changed in this diff. Show more