Build the Apple Container extension

Turns the empty scaffold into a working Nova extension for Apple Container
and container-compose, in the shape of the Docker Suite extension.

Sidebar (Scripts/Sidebar):
- System, Containers, Images, Volumes and Networks sections
- Containers grouped into compose projects via the com.docker.compose.project
  label container-compose stamps; project rows drive compose up/down/build
  against the matching workspace file
- Lifecycle, shell, logs, inspect, browse and copy commands per resource
- Apple Container publishes no event stream, so the sidebar polls while
  visible and only reloads a section when a fingerprint of its data changes,
  which keeps selection and expansion intact

Hostnames (Scripts/Hostnames.js):
- A container's hostname is <name>.<domain> and the domain lives in Apple
  Container's config.toml, which has no CLI setter, so the Hostname Domain
  preference reads and writes that file directly
- Changing it offers to register the domain with macOS and restart the
  services; the write preserves the file's other tables and its mode

Language support:
- Dockerfile and Compose syntaxes backed by tree-sitter grammars built by
  Tools/build-syntaxes.sh, pinned to revisions that generate ABI 14
- The Compose syntax is named dockercompose because that is the languageId
  docker-language-server recognises compose files by
- docker-language-server is downloaded on first use rather than bundled, at
  roughly 40 MB

Icons are generated by Tools/make-icons.py so they can be regenerated rather
than hand-maintained.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UnSBcR5Lywz5Fbj5FmVbfc
This commit is contained in:
2026-08-18 22:45:14 -03:00
co-authored by Claude Opus 5
parent 0879e5a163
commit 0506f44db3
80 changed files with 5201 additions and 3 deletions
+3
View File
@@ -0,0 +1,3 @@
(block_mapping_pair
":" @start
) @end.after
+70
View File
@@ -0,0 +1,70 @@
; Compose files are YAML, with the sections and service names picked out.
(comment) @comment
; Top-level sections: services, volumes, networks, name, include, …
(document
(block_node
(block_mapping
(block_mapping_pair
key: (flow_node) @keyword))))
; Service, volume, network and secret names
((block_mapping_pair
key: (flow_node) @_section
value: (block_node
(block_mapping
(block_mapping_pair
key: (flow_node) @identifier.type))))
(#match? @_section "^(services|volumes|networks|configs|secrets)$"))
; Everything else that is a key
(block_mapping_pair
key: (_) @identifier.key)
(flow_pair
key: (_) @identifier.key)
; Scalars
((string_scalar) @string
(#not-match? @string "(?i)^(yes|no|true|false|on|off)$"))
((string_scalar) @value.boolean
(#match? @value.boolean "(?i)^(yes|no|true|false|on|off)$"))
(double_quote_scalar) @string
(single_quote_scalar) @string
(boolean_scalar) @value.boolean
(integer_scalar) @value.number
(float_scalar) @value.number
(null_scalar) @value.null
(block_scalar) @string
(anchor_name) @identifier.constant
(alias_name) @identifier.constant
(tag) @identifier.type
(escape_sequence) @string.escape
[
"---"
"..."
"-"
"?"
":"
"|"
">"
"*"
"&"
","
] @operator
[
"["
"]"
"{"
"}"
] @bracket
+28
View File
@@ -0,0 +1,28 @@
; Instructions fold across their line continuations.
((run_instruction) @subtree
(#set! scope.byLine))
((cmd_instruction) @subtree
(#set! scope.byLine))
((entrypoint_instruction) @subtree
(#set! scope.byLine))
((copy_instruction) @subtree
(#set! scope.byLine))
((add_instruction) @subtree
(#set! scope.byLine))
((env_instruction) @subtree
(#set! scope.byLine))
((label_instruction) @subtree
(#set! scope.byLine))
((healthcheck_instruction) @subtree
(#set! scope.byLine))
((heredoc_block) @subtree
(#set! scope.byLine))
+87
View File
@@ -0,0 +1,87 @@
; Instructions
[
"ADD"
"ARG"
"AS"
"CMD"
"COPY"
"CROSS_BUILD"
"ENTRYPOINT"
"ENV"
"EXPOSE"
"FROM"
"HEALTHCHECK"
"LABEL"
"MAINTAINER"
"ONBUILD"
"RUN"
"SHELL"
"STOPSIGNAL"
"USER"
"VOLUME"
"WORKDIR"
] @keyword
"NONE" @value.null
; Images
(image_name) @identifier.type
(image_tag) @identifier.constant
(image_digest) @identifier.constant
(image_alias) @identifier.type.declare
; Flags such as --from=builder and --mount=type=cache,target=/root/.cache
(param) @keyword.modifier
(mount_param) @keyword.modifier
(mount_param_param) @keyword.modifier
; Keys and values
(env_pair
name: (_) @identifier.key)
(label_pair
key: (_) @identifier.key)
(expose_port) @value.number
; Variables: $HOME and ${HOME:-/root}
(expansion) @identifier.variable
(variable) @identifier.variable
; Strings
(double_quoted_string) @string
(single_quoted_string) @string
(json_string) @string
(escape_sequence) @string.escape
(heredoc_line) @string
[
(heredoc_marker)
(heredoc_end)
] @operator
(line_continuation) @operator
[
":"
"@"
"="
] @operator
[
"["
"]"
"{"
"}"
] @bracket
"," @punctuation.delimiter
(comment) @comment
+11
View File
@@ -0,0 +1,11 @@
; Shell fragments in RUN, CMD and ENTRYPOINT are shell script. Nova's built-in
; shell syntax picks them up when it is available; when it is not, the fragment
; is simply left unhighlighted.
((shell_fragment) @injection.content
(#set! injection.language "shell")
(#set! injection.combined))
((heredoc_block) @injection.content
(#set! injection.language "shell")
(#set! injection.combined))