4d-add-dependency
4D Add Dependency
Add dependencies to a 4D project by updating the appropriate configuration files.
Usage
Run the script to add a dependency:
python3 scripts/add_dependency.py <repo> [options]
Arguments
repo: GitHub repo (owner/repo), GitHub URL, or local path
Options
--name NAME: Override dependency name (default: derived from repo)--tag TAG: Exact version tag (e.g.,1.0.0)--version VERSION: Semantic version (e.g.,latest,1.1.0)--project PATH: Path to 4D project root
Examples
# GitHub dependency with tag
python3 scripts/add_dependency.py mesopelagique/JSONRPC --tag 1.0.0
# GitHub URL (no version)
python3 scripts/add_dependency.py https://github.com/mesopelagique/SemVer
# GitHub release URL (tag extracted automatically)
python3 scripts/add_dependency.py https://github.com/mesopelagique/SemVer/releases/tag/0.2.0
# Local sibling folder
python3 scripts/add_dependency.py ../MyComponent
# Local folder with custom name
python3 scripts/add_dependency.py /path/to/component --name MyComponent
File Formats
dependencies.json
Located at Project/Sources/dependencies.json:
{
"version": 2130,
"dependencies": {
"LocalComponent": {},
"GitHubComponent": {
"github": "owner/repo",
"tag": "1.0.0"
}
}
}
environment4d.json
Required for non-sibling local dependencies. Found by walking up from project root, or created in parent directory:
{
"dependencies": {
"ComponentName": "file:///path/to/component.4dbase"
}
}
Behavior
- GitHub repos/URLs: Add entry with
githubfield and optionaltag/version- Release URLs (
/releases/tag/x.x.x) automatically extract the tag
- Release URLs (
- Local sibling folders: Add empty entry
{}to dependencies.json only - Local non-sibling folders: Also add
file://path to environment4d.json
More from e-marchand/skills
4d-check-syntax
Check syntax and compile a 4D project to find errors and type issues. Use this skill when the user wants to compile, check syntax, or validate a 4D project. Creates a _compile method if not present, then runs it using tool4d. Returns compilation errors in JSON format for easy parsing.
114d-run
Run a 4D project method. Use tool4d by default for fast dataless execution, and fall back to a user-provided 4D executable path when the method needs a real database or runtime features unavailable in tool4d. Includes Python helpers for macOS and Windows.
94d-find-command
Find 4D commands by keyword. Use this skill when the user wants to search for, find, or discover 4D commands matching a term. Searches the gram.4dsyntax file from tool4d.app to list matching command names and uses bundled syntax metadata for readable signatures and summaries. Filters out deprecated commands.
94d-clean-project
Clean a 4D project by removing generated files, caches, and system artifacts.
64d-create-project
Create a new 4D project from scratch. Use this skill when the user wants to initialize, create, or start a new 4D project. Creates the required folder structure and .4DProject configuration file.
64d-doc-lookup
Look up 4D documentation for commands, classes, or language concepts. Use when the user asks about a 4D command's syntax, parameters, or usage, needs class API reference, or wants to understand a 4D language concept. Resolves names to developer.4d.com URLs and optionally fetches page content.
5