Skip to content

feat: add sidebar panel, i18n, token validation, and UX improvements#20

Open
Ebola-Chan-bot wants to merge 2 commits intoAcode-Foundation:mainfrom
Ebola-Chan-bot:feat/sidebar-i18n-token-validation
Open

feat: add sidebar panel, i18n, token validation, and UX improvements#20
Ebola-Chan-bot wants to merge 2 commits intoAcode-Foundation:mainfrom
Ebola-Chan-bot:feat/sidebar-i18n-token-validation

Conversation

@Ebola-Chan-bot
Copy link

  • Add sidebar.js: full actionable sidebar panel with 6 GitHub operations (Open Repo, Open Gist, Delete Gist, Delete Gist File, Update Token, Clear Cache)
  • Add Chinese/English i18n based on device locale detection (navigator.languages)
  • Token handling: normalize input (strip Bearer/token prefix, trim whitespace), validate format, and immediately verify against GitHub /user API on save
  • Enhanced API error messages: include GitHub's response message and documentation URL
  • Fix stale gh:// filesystem handlers from old plugin instances via global registry pattern (window.acodeGithubFsTests) for proper cleanup across plugin reloads
  • Prefetch repos/branches before opening palette to avoid misleading empty results
  • Show toast after opening repo folder guiding user to check file browser sidebar
  • Pass listFiles:false to openFolder to skip 'list all files may crash' prompt
  • Localize all user-facing strings: tutorial, commands, dialogs, toasts, settings
  • Update .gitignore to exclude pem files, debug server, and package-lock.json

- Add sidebar.js: full actionable sidebar panel with 6 GitHub operations
  (Open Repo, Open Gist, Delete Gist, Delete Gist File, Update Token, Clear Cache)
- Add Chinese/English i18n based on device locale detection (navigator.languages)
- Token handling: normalize input (strip Bearer/token prefix, trim whitespace),
  validate format, and immediately verify against GitHub /user API on save
- Enhanced API error messages: include GitHub's response message and documentation URL
- Fix stale gh:// filesystem handlers from old plugin instances via global registry
  pattern (window.__acodeGithubFsTests__) for proper cleanup across plugin reloads
- Prefetch repos/branches before opening palette to avoid misleading empty results
- Show toast after opening repo folder guiding user to check file browser sidebar
- Pass listFiles:false to openFolder to skip 'list all files may crash' prompt
- Localize all user-facing strings: tutorial, commands, dialogs, toasts, settings
- Update .gitignore to exclude pem files, debug server, and package-lock.json
Copilot AI review requested due to automatic review settings March 1, 2026 05:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a GitHub sidebar panel and expands localization/UX around repository and gist workflows, while also improving token handling and GitHub API error reporting.

Changes:

  • Introduces a new sidebar panel (src/sidebar.js) with buttons for common GitHub operations (repos, gists, token, cache).
  • Adds Chinese/English localization for many user-facing strings and improves UX (prefetch repos/branches, additional toasts, openFolder({ listFiles:false })).
  • Improves token normalization/validation and enhances GitHub API error messages with GitHub-provided details and docs URL.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/sidebar.js Adds a sidebar UI with actionable GitHub operations and basic busy/error handling.
src/main.js Integrates sidebar, adds i18n helper, token normalization/validation, caching/UX improvements.
src/githubFs.js Adds a global registry cleanup to remove stale gh:// handlers across reloads and localizes commit prompt strings.
src/GitHubAPI/Requestable.js Normalizes token input and improves Axios error message detail formatting.
.gitignore Ignores additional local/dev artifacts (pem, debug server, package-lock).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@greptile-apps
Copy link

greptile-apps bot commented Mar 1, 2026

Greptile Summary

This PR adds significant UX improvements including a sidebar panel, bilingual i18n (Chinese/English), and robust token handling. The implementation introduces 6 actionable GitHub operations via sidebar, fixes plugin hot-reload issues with a global registry pattern, and validates tokens against the GitHub API.

Key Changes:

  • Sidebar panel provides direct access to repo/gist operations without command palette
  • Comprehensive i18n based on navigator.languages detection
  • Token normalization strips Bearer/token prefixes and validates format
  • Prefetches repos/branches to avoid empty palette results
  • Enhanced API error messages include GitHub response details and documentation URLs
  • Global registry pattern (window.__acodeGithubFsTests__) prevents stale filesystem handlers across plugin reloads

Issue Found:

  • Token is saved to localStorage before GitHub API validation completes, which could persist invalid tokens and cause repeated failures on app restart

Confidence Score: 3/5

  • This PR is mostly safe but contains one logic issue with token persistence timing that should be fixed before merge
  • Score reflects substantial feature additions with generally solid implementation, but the token save-before-validate bug in updateToken() could cause user-facing issues. The rest of the code demonstrates good practices: XSS prevention via escaping, proper error handling, and thoughtful UX improvements. Once the localStorage timing issue is resolved, this would be a 4/5.
  • Pay close attention to src/main.js lines 407-419 where token is saved before validation

Important Files Changed

Filename Overview
.gitignore Added entries for pem files, debug-server.js, and package-lock.json - standard gitignore additions with no issues
src/GitHubAPI/Requestable.js Added token normalization (strips Bearer/token prefixes) and enhanced error messages with GitHub API response details - improves UX and token handling robustness
src/githubFs.js Implemented global registry pattern to fix stale filesystem handlers across plugin reloads, added Chinese/English i18n for commit messages - solid implementation of hot-reload fix
src/main.js Major feature additions: sidebar integration, comprehensive i18n, prefetching, token validation - contains one critical issue with token save timing before validation
src/sidebar.js New sidebar UI with 6 GitHub operations, full i18n support, proper busy state handling - well-structured implementation with XSS prevention via esc() function

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User Clicks Update Token] --> B[Show Token Input Prompt]
    B --> C{User Enters Token}
    C -->|Cancel| D[Exit]
    C -->|Submit| E[Normalize Token]
    E --> F[Strip Bearer/token prefix]
    F --> G[Trim whitespace]
    G --> H{Validate Format}
    H -->|Invalid Regex| I[Show Error Toast]
    I --> D
    H -->|Valid| J[Save to this.token]
    J --> K[Reset FS Initialized]
    K --> L[Save to localStorage]
    L --> M[Init FS]
    M --> N[Create GitHub API Client]
    N --> O[Call /user API]
    O -->|Success| P[Token Valid - Complete]
    O -->|Fail| Q[Show Validation Error]
    Q --> R[Throw Error]
    
    style L fill:#ffcccc
    style O fill:#ccffcc
    style Q fill:#ffcccc
Loading

Last reviewed commit: 7b8ec0f

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

- Requestable: default auth={} to prevent TypeError on unauthenticated use
- main: persist token to localStorage only after validation succeeds, rollback on failure
- main: fix 'Github' casing to 'GitHub' in user-facing strings
- sidebar: remove unused refreshAfter parameter from runAction/createActionButton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants