Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable plugin manager with hardcoded list of approved plugins #2773

Merged
merged 5 commits into from
Feb 22, 2025

Conversation

imolorhe
Copy link
Collaborator

@imolorhe imolorhe commented Feb 22, 2025

Improved type schema generation to be more flexible

Checks

  • Ran yarn test-build
  • Updated relevant documentations
  • Tested all settings/partial settings validation logic (in electron, app settings, etc)

Changes proposed in this pull request:

Summary by Sourcery

This pull request introduces a plugin manager to the application, allowing users to browse, install, and remove plugins. It also improves the type schema generation process to be more flexible and automated. The plugin list is now fetched from a static JSON file within the documentation site, improving reliability and control over plugin availability.

New Features:

  • Introduces a plugin manager UI to the application, allowing users to browse, install, and remove plugins.
  • Adds support for experimental features, gated behind a setting.

Enhancements:

  • Improves the type schema generation process to be more flexible and automated, using typescript-json-schema and ajv to generate JSON schemas and validation functions from TypeScript interfaces.
  • Updates the plugin list to be fetched from a static JSON file within the documentation site, improving reliability and control over plugin availability.
  • Updates dependencies to their latest versions.

Build:

  • Updates the build process to generate JSON schemas and validation functions for settings and partial settings, improving type safety and validation.
  • Adds a script to copy the generated type definitions to the build directory.

CI:

  • Adds a new job to the CI workflow to check the formatting of the code.

Deployment:

  • Serve the plugins.json file from the documentation site.

Documentation:

  • Adds a plugins.yaml file to the documentation site to define the list of approved plugins.
  • Updates the documentation site to serve the plugins.json file.

Tests:

  • Adds a validation step to the build process to ensure that the plugins.yaml file is valid.

Copy link

sourcery-ai bot commented Feb 22, 2025

Reviewer's Guide by Sourcery

This pull request improves the type schema generation to be more flexible, enables the plugin manager with a hardcoded list of approved plugins, updates dependencies, removes unused files, and updates import paths.

Updated class diagram for APSPluginDefinition

classDiagram
  class APSPluginDefinition {
    +id: string
    +name: string
    +description: string
    +author: string
    +repository: string
    +homepage?: string
  }
  note for APSPluginDefinition "Represents the definition of a plugin from the Altair Plugin Server."
Loading

Class diagram for APSPluginListResponse

classDiagram
  class APSPluginListResponse {
    +plugins: APSPluginDefinition[]
  }
  class APSPluginDefinition {
    +id: string
    +name: string
    +description: string
    +author: string
    +repository: string
    +homepage?: string
  }

  APSPluginListResponse -- APSPluginDefinition : contains
Loading

File-Level Changes

Change Details Files
Improved type schema generation to be more flexible by using typescript-json-schema and ajv to generate JSON schemas and validation functions for settings and partial settings.
  • Replaced the previous method of copying settings definition files with a new system that generates JSON schemas and validation functions.
  • Utilized typescript-json-schema to generate JSON schemas from TypeScript interfaces.
  • Employed ajv to compile validation functions from the generated JSON schemas.
  • Added support for generating schemas and validators for files in the src/typegen directory.
  • Implemented dynamic generation of validation .d.ts files.
  • Added change-case as a dependency to handle string case conversions for file names.
  • Added yaml as a dependency to handle yaml parsing for plugins.
  • Added new files to the src/typegen directory to define the types for settings, partial settings, and plugins yaml manifest.
  • Added a new file to the altair-core package to define the types for the plugin server.
  • Added a new file to the altair-docs package to define the dynamic files plugin.
  • Added a new file to the altair-docs package to define the vite dynamic files plugin.
  • Added a new file to the altair-docs package to define the plugins yaml manifest.
  • Added a new file to the altair-docs package to store the plugins yaml manifest.
packages/altair-core/scripts/copy_settings_d_ts.js
packages/altair-core/package.json
packages/altair-core/src/typegen/README.md
packages/altair-core/src/typegen/partial-settings.ts
packages/altair-core/src/typegen/plugins-yaml-manifest.ts
packages/altair-core/src/typegen/settings.ts
packages/altair-docs/.vitepress/plugins/dynamic-files.ts
packages/altair-docs/.vitepress/plugins/vite-dynamic-files.ts
packages/altair-docs/.data/plugins.yaml
packages/altair-core/src/plugin/server/types.ts
Enabled the plugin manager in the Altair app with a hardcoded list of approved plugins.
  • Modified the plugin manager component to fetch and display a list of remote plugins.
  • Updated the plugin manager UI to include plugin descriptions and actions to add or remove plugins.
  • Added a link to npm to find more plugins.
  • Modified the plugin manager component to use the plugin id instead of the plugin name.
  • Modified the plugin manager component to display the plugin description instead of the plugin summary.
  • Modified the plugin manager component to use the APSPluginDefinition type instead of the RemotePluginListItem type.
  • Modified the plugin registry service to fetch the plugin list from a static JSON file instead of the altair plugin server.
  • Added a new icon for the plugins menu item.
  • Added a new translation key for the plugins menu item.
  • Added a new translation key for the restart text.
  • Added a new translation key for the plugin add button.
  • Added a new translation key for the plugin remove button.
  • Added a new translation key for the plugin unique name text.
  • Exposed the plugin manager in the side menu when the enableExperimental setting is enabled.
packages/altair-app/src/app/modules/altair/components/plugin-manager/plugin-manager.component.html
packages/altair-app/src/scss/components/_plugin-manager.scss
packages/altair-app/src/app/modules/altair/components/plugin-manager/plugin-manager.component.ts
packages/altair-app/src/app/modules/altair/containers/altair/altair.component.html
packages/altair-app/src/app/modules/altair/services/plugin/plugin-registry.service.ts
packages/altair-app/src/app/modules/altair/modules/icons/icons.ts
packages/altair-app/src/assets/i18n/default.json
packages/altair-docs/.vitepress/config.mts
bin/dev.sh
Updated dependencies in pnpm-lock.yaml.
  • Updated versions of various packages, including @langchain/core, @langchain/openai, @langchain/textsplitters, @vueuse/integrations, and others.
  • Added new dependencies such as change-case and yaml.
  • Removed the debug dependency from axios in langchain.
  • Updated devDependencies such as @octokit/rest and vitepress.
pnpm-lock.yaml
Removed unused or outdated files and updated import paths.
  • Removed packages/altair-core/src/validate-settings.d.ts and packages/altair-core/src/validate-partial-settings.d.ts.
  • Updated import paths for settings validator in packages/altair-app/src/app/modules/altair/utils/settings_addons.ts and packages/altair-electron/src/settings/main/store.ts to point to the generated validators in the typegen directory.
  • Removed packages/altair-app/src/app/modules/altair/components/settings-dialog/extensions.ts and packages/altair-app/src/app/modules/altair/components/settings-dialog/settings-dialog.component.ts.
  • Removed packages/altair-electron/src/app/window.ts.
packages/altair-app/src/app/modules/altair/utils/settings_addons.ts
packages/altair-electron/src/settings/main/store.ts
Updated the development script to include the documentation server.
  • Added pnpm start:docs to the list of concurrently run scripts in bin/dev.sh.
bin/dev.sh
Updated the URL configuration to include the documentation server.
  • Added a docs property to the UrlConfig interface in packages/altair-core/src/config/urls.ts.
  • Added a docs property to the urlMap object for each environment (development, production, testing).
  • Set the docs property to http://localhost:6025 for the development and testing environments.
  • Set the docs property to https://altairgraphql.dev for the production environment.
packages/altair-core/src/config/urls.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @imolorhe - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a script to automatically generate the plugins.yaml file from the plugin manifests to avoid manual updates and potential inconsistencies.
  • The plugin list API endpoint is now configurable via the environment, which is great for different environments.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

github-actions bot commented Feb 22, 2025

Visit the preview URL for this PR (updated for commit e9b1d8e):

https://altair-gql--pr2773-imolorhe-re-enable-p-zj9di79s.web.app

(expires Sat, 01 Mar 2025 21:03:21 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 02d6323d75a99e532a38922862e269d63351a6cf

@imolorhe imolorhe added this pull request to the merge queue Feb 22, 2025
Merged via the queue into master with commit 0f69010 Feb 22, 2025
15 checks passed
@imolorhe imolorhe deleted the imolorhe/re-enable-plugin-manager branch February 22, 2025 23:06
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.

1 participant