discourse-shared-edits/support/lint
Sam 50d9317272
FEATURE: yjs-based collaborative editing with state recovery and cursor sync
Major overhaul of the shared edits plugin to improve reliability, robustness,
and developer experience:

**Backend**
- Extract Revise service for cleaner controller orchestration
- Add StateValidator for base64/Yjs safety, corruption detection, and recovery
- Centralize protocol constants (Ruby + JS) to avoid hardcoded strings
- Add state hash sync verification and vector validation endpoints
- Harden security (guardian checks), error handling, and resource cleanup
- Resize shared edit columns migration; add state_hash column

**Frontend**
- Decompose shared-edit-manager into focused modules: yjs-document,
  markdown-sync, rich-mode-sync, network-manager, encoding-utils
- Add cursor overlay and caret coordinate tracking for selection sharing
- Add ProseMirror extension for rich-mode collaborative editing
- Cache-busted Yjs bundle loading via hashed filenames
- Fix scroll drift during sync

**Testing & Tooling**
- Extensive new specs: state_validator, revision_controller, model, revise service
- New Ember acceptance tests: cursor, lifecycle, sync flows
- Add support scripts: fake_writer (Playwright), state_corruptor, debug_recovery
- Add support/lint wrapper for full CI lint suite
- Update dependencies and rebuild Yjs/y-prosemirror bundles
2026-02-13 11:34:52 +11:00

63 lines
1.4 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
repo_root=$(git rev-parse --show-toplevel)
cd "$repo_root"
usage() {
cat <<'HELP'
Usage: support/lint [--fix]
Runs the same lint steps as the GitHub CI workflow from the repo root.
Passing --fix (or -f) swaps in the autofix-friendly variants where available.
HELP
}
fix=false
while (( $# )); do
case "$1" in
-f|--fix)
fix=true
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown option: $1" >&2
usage
exit 1
;;
esac
shift
done
run_cmd() {
printf '\n>>> %s\n' "$*"
"$@"
}
readarray -t ruby_files < <(git ls-files '*.rb' '*.rake' '*.thor')
do_stree() {
local subcommand=$1
if (( ${#ruby_files[@]} > 0 )); then
run_cmd bundle exec stree "$subcommand" Gemfile "${ruby_files[@]}"
else
run_cmd bundle exec stree "$subcommand" Gemfile
fi
}
if $fix; then
run_cmd bundle exec rubocop --force-exclusion -A
do_stree write
run_cmd pnpm prettier -w "assets/**/*.{scss,js,gjs,hbs}"
run_cmd pnpm eslint --fix --no-error-on-unmatched-pattern {test,assets,admin/assets}/javascripts
run_cmd pnpm stylelint --fix --allow-empty-input "assets/**/*.scss"
else
run_cmd bundle exec rubocop --force-exclusion
do_stree check
run_cmd pnpm prettier --check "assets/**/*.{scss,js,gjs,hbs}"
run_cmd pnpm eslint --no-error-on-unmatched-pattern {test,assets,admin/assets}/javascripts
run_cmd pnpm stylelint --allow-empty-input "assets/**/*.scss"
fi