Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 12, 2025

Description

Fixes installation of adapters from GitHub URLs by validating adapter compatibility before installation begins. Previously, the CLI would install adapters from GitHub without checking if they support GitHub installation (common.nogit flag) or are compatible with the current system, resulting in startup errors due to missing files or incompatible configurations.

Changes

This PR implements comprehensive pre-installation validation by fetching and checking the io-package.json file directly from GitHub:

  1. Added _fetchAndValidateIoPackage method that:

    • Fetches io-package.json from GitHub's raw content API using the commit hash
    • Returns the full adapter object for validation
    • Handles fetch failures gracefully
  2. Added _performAdapterChecks method that performs compatibility checks:

    • nogit flag: Blocks installation if common.nogit is true
    • OS compatibility: Validates the adapter supports the current operating system (common.os)
  3. Modified installAdapterFromUrl to validate before installation:

    • Tracks GitHub user, repo, and commit information during URL parsing
    • Calls validation checks after the commit hash is determined
    • Handles both full GitHub URLs (https://github.com/user/repo) and short format (user/repo#commit)

Behavior

When installing an adapter from GitHub:

  • If common.nogit is true: Installation is blocked with error:

    Cannot install adapter from GitHub: The adapter "repo" has set the "nogit" flag 
    which prevents manual installation from GitHub.
    
  • If OS is incompatible: Installation is blocked with error:

    Cannot install adapter from GitHub: Adapter does not support current OS. 
    Required linux. Actual platform: win32
    
  • If io-package.json cannot be fetched: Installation continues with a warning that the adapter may not support GitHub installation

  • If the commit hash cannot be determined: Installation continues with a warning

  • If all checks pass: Installation proceeds normally

Example

For adapters like ioBroker.modbus that have common.nogit: true, the command:

iob url https://github.com/ioBroker/ioBroker.modbus

Will now fail with a descriptive error instead of installing and causing runtime errors.

Closes #2623

Fixes #3119

Original prompt

This section details on the original issue you should resolve

<issue_title>[bug]: Requirement check for 'nogit' missing</issue_title>
<issue_description>### No existing issues.

  • There is no existing issue for my problem.

Description

iob url https://... installs an adapter even if the flag common.nogit is set to true.

This results in various errors, most likely startup errors due to missing files.

Installation should be blocked.

If this is not possible (do to limited access to sources - iob url seems to simply call npm) a BIG info should be logged AFTER installation and any attempt to start the adapter should be blocked (as after installation io-package.json is definitly available this should be possible in any case). The combination "installed from github and nogit should be available to check,

Reproduction instruction

Try to install any adapter with common.nogit set to true (i.e. ioBroker.modbus) using commandline iob url https://...

JS-controller version

7.0.6

Node version

22</issue_description>

Comments on the Issue (you are @copilot in this section)

@Apollon77 The problem here is that a "URL" install does not know the adapter name and so can not check the repository. Additionally usually this is used to install development adapters.

We can do the following:
When we already determine the commit hash of the installation (and make sure we do this before npm install call) we could use this commit has to read the "io-package.json" directly from GitHub. If we can read it we can check basically all infos. if we can not access that we should log a warning that we could not determine the adapter details but still install.</comment_new>

Fixes #3119


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Fix missing requirement check for 'nogit' during installation Add nogit flag check for GitHub adapter installations Oct 12, 2025
@Copilot Copilot AI requested a review from Apollon77 October 12, 2025 11:42
Copilot finished work on behalf of Apollon77 October 12, 2025 11:42
Copy link
Collaborator

@Apollon77 Apollon77 left a comment

Choose a reason for hiding this comment

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

@copilot remove changed the package-lock.json file from this PR. This was not part of the order.

Additional please adjust to not only check the Nogit flag when loading of the io-package was possible but do all checks normally done when adding an adapter with known details from repository object or such. But ensure that nogit is checked in all cases.

Copy link
Contributor Author

Copilot AI commented Oct 13, 2025

@copilot remove changed the package-lock.json file from this PR. This was not part of the order.

Additional please adjust to not only check the Nogit flag when loading of the io-package was possible...

Done in commit 52a8302. Reverted package-lock.json changes and enhanced the implementation to perform all adapter compatibility checks (OS compatibility, nogit flag, etc.) when io-package.json is successfully fetched from GitHub, not just the nogit check.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • spdx.org
    • Triggering command: node /home/REDACTED/work/ioBroker.js-controller/ioBroker.js-controller/node_modules/.bin/ts-node schemas/updateSchemas.ts (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Copilot Copilot AI changed the title Add nogit flag check for GitHub adapter installations Add adapter compatibility checks for GitHub installations Oct 13, 2025
@Copilot Copilot AI requested a review from Apollon77 October 13, 2025 06:07
Copilot finished work on behalf of Apollon77 October 13, 2025 06:07
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.

[bug]: Requirement check for 'nogit' missing

2 participants