Files
openidea/wit/run-targets.wit
T
l0ng-ai 74e66a5dae feat(plugins): environment and debugger for plugin run configurations (API 1.9) (#3476)
Plugin run configurations could not set environment variables, and Debug
only worked when a source file in the arguments let the IDE infer a
debugger, so a plugin could run `func start` for an Azure Functions app but
not debug the worker it starts.

API 1.9 adds the optional `launch-configurations` export, preferred over
`run-configurations` when a component has both. Each configuration can add
environment variables (only names the IDE's environment doesn't already
have, like `process` commands) and name a debugger: launch the program
under a language's debugger, or run it and attach to the first process of
an Attach to Process kind that the run starts. Only the run's own
descendants are candidates; the IDE waits up to a minute while the run
lasts and otherwise leaves it running without the debugger. Remote projects
resolve the process on the server.

The SDK gets `LaunchConfigurations` / `launch_configurations`, the README
and docs describe the export, and the bundled components and fixtures are
rebuilt for 1.9.
2026-11-15 11:01:12 +08:00

60 lines
2.8 KiB
Plaintext

package openidea:plugin@1.9.0;
/// Project-scoped targets owned by the registering plugin (API 1.4).
interface run-targets {
use types.{error};
use workspace.{project};
/// An argv wrapper using a granted, pinned process program. No shell is used.
/// Normally: program + args + workdir-args + command + command arguments.
/// An override matches wrap::program_name(command) and replaces args AND command:
/// program + override + workdir-args + command arguments.
/// DDEV: program="ddev", args=["exec"], commands=[("composer", ["composer"])]:
/// `ddev exec php x.php` and `ddev composer install`.
/// Each workdir-args element may contain {cwd}, mapped under container-root.
/// All workdir-args are omitted without container-root or for cwd outside the project.
/// Without workdir-args the wrapper manages its container directory itself.
/// The wrapper always starts in the configuration's LOCAL working directory.
/// Environment reaches the wrapper; forwarding into a container depends on its conventions.
/// Registration never selects the target. Debugging plugin targets is invalid.
record run-target {
id: string,
name: string,
program: string,
args: list<string>,
workdir-args: list<string>,
container-root: option<string>,
commands: list<tuple<string, list<string>>>,
}
/// Registers/replaces this plugin's target in an open, trusted project.
/// Targets survive idle reclamation, and disappear on unregister or plugin stop.
/// Remote project registration and execution take place on the server.
register: func(project: borrow<project>, target: run-target) -> result<_, error>;
/// Per-command prefix and optional replacement working-directory arguments (API 1.5).
/// None inherits the target's workdir-args; some([]) omits them.
/// Replacement arguments use the same {cwd} substitution and path restrictions.
record command-override {
name: string,
args: list<string>,
workdir-args: option<list<string>>,
}
/// Like run-target, with per-command working-directory argument control (API 1.5).
/// Matching commands use program + override args + selected workdir-args + command arguments.
record run-target-with-overrides {
id: string,
name: string,
program: string,
args: list<string>,
workdir-args: list<string>,
container-root: option<string>,
commands: list<command-override>,
}
/// Same ownership, trust, process grant and pin checks as register (API 1.5).
register-with-overrides: func(project: borrow<project>, target: run-target-with-overrides) -> result<_, error>;
/// Removes only this plugin's target from the project; missing ids are harmless.
unregister: func(project: borrow<project>, id: string);
}