Operations
Brand Use Module
Brand operations for downloading and applying Quarto brands.
Handles downloading brand extensions or plain brand repositories and copying brand files (YAML + referenced assets) to _brand/.
Interfaces
Functions
Extension Installation Module
Extension installation operations.
Handles installing extensions from GitHub, URLs, and local sources.
Interfaces
Type Aliases
Functions
Extension Removal Module
Extension removal operations.
Handles removing installed extensions from a project.
Interfaces
Functions
Extension Update Module
Extension update operations.
Handles checking for and applying updates to installed extensions.
Interfaces
Functions
Template Use Module
Use extension operation for installing and copying template files.
Combines installation with template file copying for starter templates.
Interfaces
Type Aliases
Functions
applySourceOwner
TypeScript
function applySourceOwner(extensions, source): void;Defined in: packages/core/src/operations/install.ts:631
Apply GitHub owner to all discovered extensions. When installing from GitHub, extensions are namespaced under the repository owner.
Parameters
| Parameter | Type | Description |
|---|---|---|
extensions |
DiscoveredExtension[] |
Discovered extensions to update |
source |
InstallSource |
Installation source |
Returns
void
applyUpdates
TypeScript
function applyUpdates(updates, options): Promise<UpdateResult>;Defined in: packages/core/src/operations/update.ts:179
Apply updates to extensions.
Parameters
| Parameter | Type | Description |
|---|---|---|
updates |
UpdateInfo[] |
Updates to apply |
options |
UpdateOptions |
Update options |
Returns
Promise<UpdateResult>
Update result
checkForBrandExtension
TypeScript
function checkForBrandExtension(dir): BrandExtensionInfo;Defined in: packages/core/src/operations/brand.ts:91
Check if a directory contains a brand extension.
Reads _extension.yml and looks for contributes.metadata.project.brand.
Parameters
| Parameter | Type | Description |
|---|---|---|
dir |
string |
Directory to check |
Returns
Brand extension info
checkForUpdates
TypeScript
function checkForUpdates(options): Promise<UpdateInfo[]>;Defined in: packages/core/src/operations/update.ts:88
Check for available updates.
Parameters
| Parameter | Type | Description |
|---|---|---|
options |
UpdateCheckOptions |
Check options |
Returns
Promise<UpdateInfo[]>
Array of available updates
extractBrandFilePaths
TypeScript
function extractBrandFilePaths(brandYamlPath, onWarning?): string[];Defined in: packages/core/src/operations/brand.ts:299
Extract all local file paths referenced in a brand YAML file.
Extracts paths from:
- logo.images.* (string or { path, alt } objects).
- logo.small, logo.medium, logo.large (string or { light, dark } objects).
- typography.fonts[].files where source is “file”.
Parameters
| Parameter | Type | Description |
|---|---|---|
brandYamlPath |
string |
Absolute path to the brand YAML file |
onWarning? |
(message) => void |
Optional callback for non-fatal warnings (e.g., parse errors) |
Returns
string[]
Array of unique relative file paths
findBrandFile
TypeScript
function findBrandFile(stagedDir): BrandFileInfo | null;Defined in: packages/core/src/operations/brand.ts:136
Find the brand file in a staged directory.
Search order:
- Root: _brand.yml / _brand.yaml (plain brand repo).
- _extensions/* (direct children).
- _extensions/*/* (nested owner/name).
Parameters
| Parameter | Type | Description |
|---|---|---|
stagedDir |
string |
Extracted/staged directory to search |
Returns
BrandFileInfo | null
Brand file info or null if not found
formatInstallSource
TypeScript
function formatInstallSource(source): string;Defined in: packages/core/src/operations/install.ts:254
Format an install source as a string.
Parameters
| Parameter | Type |
|---|---|
source |
InstallSource |
Returns
string
getTemplateFiles
TypeScript
function getTemplateFiles(sourceRoot, exclude?): Promise<string[]>;Defined in: packages/core/src/operations/use.ts:804
Get list of template files that would be copied from repo root.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
sourceRoot |
string |
undefined |
Repository root directory |
exclude |
string[] |
DEFAULT_EXCLUDE_PATTERNS |
Patterns to exclude |
Returns
Promise<string[]>
List of template file paths
install
TypeScript
function install(source, options): Promise<InstallResult>;Defined in: packages/core/src/operations/install.ts:303
Install an extension from a source.
Parameters
| Parameter | Type | Description |
|---|---|---|
source |
InstallSource |
Installation source |
options |
InstallOptions |
Installation options |
Returns
Promise<InstallResult>
Installation result
Example
TypeScript
// Install from GitHub
const source = parseInstallSource("quarto-ext/fontawesome");
const result = await install(source, { projectDir: "." });
console.log(`Installed ${result.extension.id.name}`);
// Install with progress tracking
await install(source, {
projectDir: ".",
onProgress: ({ phase, message }) => console.log(`[${phase}] ${message}`),
});installSingleExtension
TypeScript
function installSingleExtension(
extension,
projectDir,
sourceString,
force,
onProgress?,
confirmOverwrite?,
sourceType?): Promise<InstallResult>;Defined in: packages/core/src/operations/install.ts:733
Install a single extension from an already-extracted directory. Used for installing additional extensions when multiple are selected, or when installing extensions directly with pre-computed IDs (e.g., from twoPhaseUse).
Parameters
| Parameter | Type | Description |
|---|---|---|
extension |
DiscoveredExtension |
Discovered extension with path and pre-computed ID |
projectDir |
string |
Project directory to install to |
sourceString |
string |
Source string to record in manifest |
force |
boolean |
Whether to force reinstall |
onProgress? |
InstallProgressCallback |
Progress callback |
confirmOverwrite? |
ConfirmOverwriteCallback |
Callback to confirm overwrite when extension exists |
sourceType? |
SourceType |
- |
Returns
Promise<InstallResult>
Installation result
normaliseVersion
TypeScript
function normaliseVersion(version): string | null;Defined in: packages/core/src/operations/update.ts:269
Normalise a version string for comparison. Strips leading “v” prefix and coerces to valid semver.
Parameters
| Parameter | Type | Description |
|---|---|---|
version |
string |
Version string to normalise |
Returns
string | null
Normalised semver string, or null if invalid
parseInstallSource
TypeScript
function parseInstallSource(input, checkExists?): InstallSource;Defined in: packages/core/src/operations/install.ts:174
Parse an install source string.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
input |
string |
undefined |
Source string (GitHub ref, URL, or local path) |
checkExists |
(path) => boolean |
fs.existsSync |
- |
Returns
Parsed InstallSource
Example
TypeScript
// GitHub reference
parseInstallSource("quarto-ext/fontawesome");
// { type: "github", owner: "quarto-ext", repo: "fontawesome", version: { type: "latest" } }
// GitHub with version
parseInstallSource("quarto-ext/lightbox@v1.0.0");
// { type: "github", ..., version: { type: "tag", tag: "v1.0.0" } }
// URL
parseInstallSource("https://example.com/ext.zip");
// { type: "url", url: "https://example.com/ext.zip" }
// Local path
parseInstallSource("./my-extension");
// { type: "local", path: "./my-extension" }remove
TypeScript
function remove(extensionId, options): Promise<RemoveResult>;Defined in: packages/core/src/operations/remove.ts:58
Remove an installed extension.
Parameters
| Parameter | Type | Description |
|---|---|---|
extensionId |
ExtensionId |
Extension to remove |
options |
RemoveOptions |
Removal options |
Returns
Promise<RemoveResult>
Removal result
Example
TypeScript
const result = await remove(
{ owner: "quarto-ext", name: "fontawesome" },
{ projectDir: ".", cleanupEmpty: true }
);
console.log(`Removed ${result.filesRemoved.length} files`);removeMultiple
TypeScript
function removeMultiple(extensionIds, options): Promise<(
| RemoveResult
| {
error: string;
extensionId: ExtensionId;
})[]>;Defined in: packages/core/src/operations/remove.ts:97
Remove multiple extensions.
Parameters
| Parameter | Type | Description |
|---|---|---|
extensionIds |
ExtensionId[] |
Extensions to remove |
options |
RemoveOptions |
Removal options |
Returns
Promise<( | RemoveResult | { error: string; extensionId: ExtensionId; })[]>
Array of removal results
resolveStagedDir
TypeScript
function resolveStagedDir(extractDir): string;Defined in: packages/core/src/operations/brand.ts:467
Resolve the staged directory from a downloaded/extracted archive.
GitHub archives typically have a single top-level directory (e.g., “owner-repo-sha/”). This function finds that directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
extractDir |
string |
Extraction directory |
Returns
string
The effective staged directory
selectExtensionsFromSource
TypeScript
function selectExtensionsFromSource(allExtensions, selectExtension?): Promise<
| DiscoveredExtension[]
| null>;Defined in: packages/core/src/operations/install.ts:647
Select extensions from a list using an optional callback. Returns null if the user cancelled.
Parameters
| Parameter | Type | Description |
|---|---|---|
allExtensions |
DiscoveredExtension[] |
All discovered extensions |
selectExtension? |
ExtensionSelectionCallback |
Optional callback for user selection |
Returns
Promise< | DiscoveredExtension[] | null>
Selected extensions, or null if cancelled
update
TypeScript
function update(options): Promise<UpdateResult>;Defined in: packages/core/src/operations/update.ts:236
Check and apply updates in one operation.
Parameters
| Parameter | Type | Description |
|---|---|---|
options |
UpdateOptions |
Update options |
Returns
Promise<UpdateResult>
Update result
use
TypeScript
function use(source, options): Promise<UseResult>;Defined in: packages/core/src/operations/use.ts:528
Install an extension and optionally copy template files.
Parameters
| Parameter | Type | Description |
|---|---|---|
source |
string | InstallSource |
Extension source (string or InstallSource) |
options |
UseOptions |
Use options |
Returns
Promise<UseResult>
Use result
useBrand
TypeScript
function useBrand(source, options): Promise<UseBrandResult>;Defined in: packages/core/src/operations/brand.ts:615
Download and apply a Quarto brand to a project.
Downloads/extracts the source, finds the brand YAML file, extracts referenced asset paths, and copies the brand file (renamed to _brand.yml) plus assets into the project’s _brand/ directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
source |
string | InstallSource |
Brand source (string or InstallSource) |
options |
UseBrandOptions |
Use brand options |
Returns
Promise<UseBrandResult>
Use brand result
Example
TypeScript
const result = await useBrand("mcanouil/quarto-mcanouil", {
projectDir: "/path/to/project",
onProgress: ({ phase, message }) => console.log(`[${phase}] ${message}`),
});BrandExtensionInfo
Defined in: packages/core/src/operations/brand.ts:28
Result of brand extension detection.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
brandFileName? |
string |
The brand file name declared in the extension manifest. | packages/core/src/operations/brand.ts:34 |
extensionDir? |
string |
Directory containing the brand extension. | packages/core/src/operations/brand.ts:32 |
isBrandExtension |
boolean |
Whether a brand extension was found. | packages/core/src/operations/brand.ts:30 |
BrandFileInfo
Defined in: packages/core/src/operations/brand.ts:40
Located brand file information.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
brandFileDir |
string |
Directory containing the brand file (for resolving relative paths). | packages/core/src/operations/brand.ts:44 |
brandFilePath |
string |
Absolute path to the brand YAML file. | packages/core/src/operations/brand.ts:42 |
isBrandExtension |
boolean |
Whether the brand was found via a brand extension. | packages/core/src/operations/brand.ts:46 |
FileSelectionResult
Defined in: packages/core/src/operations/use.ts:154
Result of file selection callback.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
overwriteExisting |
boolean |
Whether to overwrite existing files without prompting. | packages/core/src/operations/use.ts:158 |
selectedFiles |
string[] |
Files selected for copying. | packages/core/src/operations/use.ts:156 |
InstallOptions
Defined in: packages/core/src/operations/install.ts:77
Options for extension installation.
Extends
Properties
| Property | Type | Description | Overrides | Inherited from | Defined in |
|---|---|---|---|---|---|
auth? |
AuthConfig |
Authentication configuration. | RegistryOptions.auth |
- | packages/core/src/operations/install.ts:81 |
cacheDir? |
string |
Cache directory (uses platform default if not provided). | - | RegistryOptions.cacheDir |
packages/core/src/registry/fetcher.ts:27 |
cacheTtl? |
number |
Cache TTL in milliseconds (default: 24 hours). | - | RegistryOptions.cacheTtl |
packages/core/src/registry/fetcher.ts:31 |
confirmOverwrite? |
ConfirmOverwriteCallback |
Callback for confirming overwrite when extension already exists. Only called when force is true. If not provided, overwrites silently. Return true to overwrite, false to cancel. | - | - | packages/core/src/operations/install.ts:104 |
dryRun? |
boolean |
Dry run mode - resolve without installing. | - | - | packages/core/src/operations/install.ts:91 |
force? |
boolean |
Force reinstall if already installed. | - | - | packages/core/src/operations/install.ts:85 |
forceRefresh? |
boolean |
Force refresh, ignoring cache. | - | RegistryOptions.forceRefresh |
packages/core/src/registry/fetcher.ts:29 |
keepSourceDir? |
boolean |
Keep source directory after installation (for template copying). | - | - | packages/core/src/operations/install.ts:89 |
onProgress? |
InstallProgressCallback |
Progress callback. | - | - | packages/core/src/operations/install.ts:83 |
projectDir |
string |
Project directory. | - | - | packages/core/src/operations/install.ts:79 |
registryUrl? |
string |
Custom registry URL. | - | RegistryOptions.registryUrl |
packages/core/src/registry/fetcher.ts:25 |
selectExtension? |
ExtensionSelectionCallback |
Callback for selecting extensions when source contains multiple. If not provided and source contains multiple extensions, the first one is installed (legacy behaviour). | - | - | packages/core/src/operations/install.ts:98 |
signal? |
AbortSignal |
AbortSignal for cancellation. | - | - | packages/core/src/operations/install.ts:87 |
sourceDisplay? |
string |
Display source to record in manifest (for relative paths that were resolved). | - | - | packages/core/src/operations/install.ts:93 |
sourceType? |
SourceType |
Override the source type written to the manifest. By default, the source type is inferred from the install source (e.g., “github”, “url”, “local”). Use “registry” when installing via the extension registry. | - | - | packages/core/src/operations/install.ts:116 |
timeout? |
number |
Request timeout in milliseconds. | - | RegistryOptions.timeout |
packages/core/src/registry/fetcher.ts:35 |
validateQuartoVersion? |
ValidateQuartoVersionCallback |
Callback for validating Quarto version requirement. Called when the manifest specifies a quartoRequired field. Return true to proceed, false to cancel. | - | - | packages/core/src/operations/install.ts:110 |
InstallResult
Defined in: packages/core/src/operations/install.ts:122
Result of installation.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
additionalInstallFailures? |
object[] |
Additional extensions that failed to install when multiple were selected. | packages/core/src/operations/install.ts:144 |
additionalInstalls? |
InstallResult[] |
Additional extensions installed when multiple were selected (only set when using selectExtension callback). | packages/core/src/operations/install.ts:142 |
alreadyExists? |
boolean |
Whether the extension already exists (only relevant in dry run mode). | packages/core/src/operations/install.ts:140 |
cancelled? |
boolean |
Whether the installation was cancelled by user (via callbacks). | packages/core/src/operations/install.ts:146 |
dryRun? |
boolean |
Whether this was a dry run (no files were actually created). | packages/core/src/operations/install.ts:136 |
extension |
InstalledExtension |
Installed extension details. | packages/core/src/operations/install.ts:126 |
filesCreated |
string[] |
Files created during installation. | packages/core/src/operations/install.ts:128 |
source |
string |
Source string for the manifest. | packages/core/src/operations/install.ts:130 |
sourceRoot? |
string |
Path to extracted source root (only set if keepSourceDir was true). | packages/core/src/operations/install.ts:134 |
sourceType? |
SourceType |
Source type for the manifest. | packages/core/src/operations/install.ts:132 |
success |
boolean |
Whether installation succeeded. | packages/core/src/operations/install.ts:124 |
wouldCreate? |
string[] |
Files that would be created (only set in dry run mode). | packages/core/src/operations/install.ts:138 |
RemoveOptions
Defined in: packages/core/src/operations/remove.ts:21
Options for removal.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
cleanupEmpty? |
boolean |
Clean up empty parent directories. | packages/core/src/operations/remove.ts:25 |
projectDir |
string |
Project directory. | packages/core/src/operations/remove.ts:23 |
RemoveResult
Defined in: packages/core/src/operations/remove.ts:31
Result of removal.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
directoriesRemoved |
string[] |
Directories cleaned up. | packages/core/src/operations/remove.ts:39 |
extension |
InstalledExtension |
Removed extension details. | packages/core/src/operations/remove.ts:35 |
filesRemoved |
string[] |
Files removed. | packages/core/src/operations/remove.ts:37 |
success |
boolean |
Whether removal succeeded. | packages/core/src/operations/remove.ts:33 |
UpdateCheckOptions
Defined in: packages/core/src/operations/update.ts:43
Options for checking updates.
Extends
Extended by
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
auth? |
AuthConfig |
Authentication configuration. | RegistryOptions.auth |
packages/core/src/registry/fetcher.ts:33 |
cacheDir? |
string |
Cache directory (uses platform default if not provided). | RegistryOptions.cacheDir |
packages/core/src/registry/fetcher.ts:27 |
cacheTtl? |
number |
Cache TTL in milliseconds (default: 24 hours). | RegistryOptions.cacheTtl |
packages/core/src/registry/fetcher.ts:31 |
extension? |
ExtensionId |
Specific extension to check (all if omitted). | - | packages/core/src/operations/update.ts:47 |
forceRefresh? |
boolean |
Force refresh, ignoring cache. | RegistryOptions.forceRefresh |
packages/core/src/registry/fetcher.ts:29 |
projectDir |
string |
Project directory. | - | packages/core/src/operations/update.ts:45 |
registryUrl? |
string |
Custom registry URL. | RegistryOptions.registryUrl |
packages/core/src/registry/fetcher.ts:25 |
timeout? |
number |
Request timeout in milliseconds. | RegistryOptions.timeout |
packages/core/src/registry/fetcher.ts:35 |
UpdateInfo
Defined in: packages/core/src/operations/update.ts:27
Information about an available update.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
currentVersion |
string |
Current installed version. | packages/core/src/operations/update.ts:31 |
extension |
InstalledExtension |
Extension with update available. | packages/core/src/operations/update.ts:29 |
latestVersion |
string |
Latest available version. | packages/core/src/operations/update.ts:33 |
releaseUrl |
string | null |
URL to the release. | packages/core/src/operations/update.ts:35 |
source |
string |
Source reference for updating. | packages/core/src/operations/update.ts:37 |
UpdateOptions
Defined in: packages/core/src/operations/update.ts:53
Options for applying updates.
Extends
Properties
UpdateResult
Defined in: packages/core/src/operations/update.ts:63
Result of update operation.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
failed |
object[] |
Failed updates with errors. | packages/core/src/operations/update.ts:76 |
skipped |
object[] |
Skipped extensions with reasons. | packages/core/src/operations/update.ts:71 |
updated |
object[] |
Successfully updated extensions. | packages/core/src/operations/update.ts:65 |
UseBrandOptions
Defined in: packages/core/src/operations/brand.ts:52
Options for “use brand” operation.
Extends
Properties
| Property | Type | Description | Overrides | Inherited from | Defined in |
|---|---|---|---|---|---|
auth? |
AuthConfig |
Authentication configuration. | RegistryOptions.auth |
- | packages/core/src/operations/brand.ts:56 |
cacheDir? |
string |
Cache directory (uses platform default if not provided). | - | RegistryOptions.cacheDir |
packages/core/src/registry/fetcher.ts:27 |
cacheTtl? |
number |
Cache TTL in milliseconds (default: 24 hours). | - | RegistryOptions.cacheTtl |
packages/core/src/registry/fetcher.ts:31 |
cleanupExtra? |
(files) => Promise<boolean> |
Callback to confirm removing extra files in _brand/ not present in the source. | - | - | packages/core/src/operations/brand.ts:60 |
confirmOverwrite? |
(files) => Promise<boolean> |
Callback to confirm overwriting existing files. Receives list of files that would be overwritten. | - | - | packages/core/src/operations/brand.ts:58 |
forceRefresh? |
boolean |
Force refresh, ignoring cache. | - | RegistryOptions.forceRefresh |
packages/core/src/registry/fetcher.ts:29 |
onProgress? |
(info) => void |
Progress callback. | - | - | packages/core/src/operations/brand.ts:62 |
projectDir |
string |
Project directory. | - | - | packages/core/src/operations/brand.ts:54 |
registryUrl? |
string |
Custom registry URL. | - | RegistryOptions.registryUrl |
packages/core/src/registry/fetcher.ts:25 |
timeout? |
number |
Request timeout in milliseconds. | - | RegistryOptions.timeout |
packages/core/src/registry/fetcher.ts:35 |
UseBrandResult
Defined in: packages/core/src/operations/brand.ts:68
Result of “use brand” operation.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
cleaned |
string[] |
Files cleaned up (removed from _brand/). | packages/core/src/operations/brand.ts:78 |
created |
string[] |
Files created (new files). | packages/core/src/operations/brand.ts:72 |
overwritten |
string[] |
Files overwritten. | packages/core/src/operations/brand.ts:74 |
skipped |
string[] |
Files skipped (existing, not overwritten). | packages/core/src/operations/brand.ts:76 |
source |
string |
Source string for display. | packages/core/src/operations/brand.ts:80 |
success |
boolean |
Whether the operation succeeded. | packages/core/src/operations/brand.ts:70 |
UseOptions
Defined in: packages/core/src/operations/use.ts:184
Options for “use extension” operation.
Properties
| Property | Type | Description | Defined in | ||
|---|---|---|---|---|---|
auth? |
AuthConfig |
Authentication configuration. | packages/core/src/operations/use.ts:188 | ||
confirmExtensionOverwrite? |
(extensions) => Promise< | DiscoveredExtension[] | null> |
Callback to confirm overwriting existing extensions. Called with extensions that already exist in the project. Returns the extensions to overwrite, or null to cancel. | packages/core/src/operations/use.ts:223 | ||
confirmOverwrite? |
OverwriteCallback |
Callback to confirm overwrites (per-file). Takes precedence if confirmOverwriteBatch is not provided. | packages/core/src/operations/use.ts:196 | ||
confirmOverwriteBatch? |
OverwriteBatchCallback |
Callback to confirm overwrites in batch. Receives all conflicting files upfront. Takes precedence over confirmOverwrite. | packages/core/src/operations/use.ts:198 | ||
dryRun? |
boolean |
Dry run mode - resolve and validate without copying files. | packages/core/src/operations/use.ts:210 | ||
exclude? |
string[] |
Additional patterns to exclude. | packages/core/src/operations/use.ts:194 | ||
include? |
string[] |
File patterns to include (overrides defaults). | packages/core/src/operations/use.ts:192 | ||
noTemplate? |
boolean |
Skip template copying. | packages/core/src/operations/use.ts:190 | ||
onProgress? |
(info) => void |
Progress callback. | packages/core/src/operations/use.ts:208 | ||
projectDir |
string |
Project directory. | packages/core/src/operations/use.ts:186 | ||
selectExtension? |
ExtensionSelectionCallback |
Callback for selecting extensions when source contains multiple. If not provided and source contains multiple extensions, the first one is installed. | packages/core/src/operations/use.ts:217 | ||
selectFiles? |
FileSelectionCallback |
Callback for interactive file selection. Takes precedence over include/exclude/confirmOverwrite. | packages/core/src/operations/use.ts:200 | ||
selectFilesFirst? |
boolean |
Show file selection before installing extension (default: false). When true, the extension is only installed if the user confirms file selection. When false, the extension is installed immediately and then files are selected. | packages/core/src/operations/use.ts:206 | ||
selectTargetSubdir? |
SelectTargetSubdirCallback |
Callback for interactive target subdirectory selection. Called before file selection in two-phase flow. Returns subdirectory path, or null/empty string for project root. | packages/core/src/operations/use.ts:235 | ||
sourceDisplay? |
string |
Display source to record in manifest (for relative paths that were resolved). | packages/core/src/operations/use.ts:212 | ||
sourceType? |
SourceType |
Override the source type written to the manifest. Use “registry” when installing via the extension registry. | packages/core/src/operations/use.ts:240 | ||
targetSubdir? |
string |
Subdirectory within projectDir where template files should be copied. If selectTargetSubdir callback is provided and selectFilesFirst is true, the callback takes precedence. | packages/core/src/operations/use.ts:229 |
UseResult
Defined in: packages/core/src/operations/use.ts:246
Result of “use extension” operation.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
cancelled? |
boolean |
Whether the user cancelled the file selection (only set when selectFilesFirst is true). | packages/core/src/operations/use.ts:260 |
dryRun? |
boolean |
Whether this was a dry run (no files were actually copied). | packages/core/src/operations/use.ts:254 |
install |
InstallResult |
Installation result. | packages/core/src/operations/use.ts:248 |
skippedFiles |
string[] |
Files skipped due to existing. | packages/core/src/operations/use.ts:252 |
templateFiles |
string[] |
Template files copied. | packages/core/src/operations/use.ts:250 |
wouldConflict? |
string[] |
Files that would conflict with existing files (only set in dry run mode). | packages/core/src/operations/use.ts:258 |
wouldCopy? |
string[] |
Template files that would be copied (only set in dry run mode). | packages/core/src/operations/use.ts:256 |
ConfirmOverwriteCallback
TypeScript
type ConfirmOverwriteCallback = (extension) => Promise<boolean>;Defined in: packages/core/src/operations/install.ts:63
Callback for confirming overwrite when extension already exists.
Parameters
| Parameter | Type | Description |
|---|---|---|
extension |
DiscoveredExtension |
The extension that already exists |
Returns
Promise<boolean>
True to overwrite, false to skip/cancel
ExtensionSelectionCallback
TypeScript
type ExtensionSelectionCallback = (extensions) => Promise<
| DiscoveredExtension[]
| null>;Defined in: packages/core/src/operations/install.ts:55
Callback for selecting which extension(s) to install from a multi-extension source. Called when a repository contains multiple extensions.
Parameters
| Parameter | Type | Description |
|---|---|---|
extensions |
DiscoveredExtension[] |
Array of discovered extensions in the source |
Returns
Promise< | DiscoveredExtension[] | null>
Selected extensions to install, or null to cancel
FileSelectionCallback
TypeScript
type FileSelectionCallback = (availableFiles, existingFiles, defaultExcludePatterns) => Promise<
| FileSelectionResult
| null>;Defined in: packages/core/src/operations/use.ts:166
Callback for interactive file selection. Receives all available template files and which ones already exist. Returns which files to copy and whether to overwrite existing.
Parameters
| Parameter | Type |
|---|---|
availableFiles |
string[] |
existingFiles |
string[] |
defaultExcludePatterns |
string[] |
Returns
Promise< | FileSelectionResult | null>
InstallPhase
TypeScript
type InstallPhase = "resolving" | "downloading" | "extracting" | "installing" | "finalizing";Defined in: packages/core/src/operations/install.ts:41
Progress phases for installation.
InstallProgressCallback
TypeScript
type InstallProgressCallback = (progress) => void;Defined in: packages/core/src/operations/install.ts:46
Progress callback for installation.
Parameters
| Parameter | Type |
|---|---|
progress |
{ message: string; percentage?: number; phase: InstallPhase; } |
progress.message |
string |
progress.percentage? |
number |
progress.phase |
InstallPhase |
Returns
void
InstallSource
TypeScript
type InstallSource =
| {
owner: string;
repo: string;
type: "github";
version: VersionSpec;
}
| {
type: "url";
url: string;
}
| {
path: string;
type: "local";
};Defined in: packages/core/src/operations/install.ts:33
Source for extension installation.
OverwriteBatchCallback
TypeScript
type OverwriteBatchCallback = (files) => Promise<OverwriteBatchResult>;Defined in: packages/core/src/operations/use.ts:149
Callback for confirming file overwrites in batch. Receives all conflicting files upfront and returns which ones to overwrite.
Parameters
| Parameter | Type |
|---|---|
files |
string[] |
Returns
Promise<OverwriteBatchResult>
OverwriteBatchResult
TypeScript
type OverwriteBatchResult = "all" | "none" | string[];Defined in: packages/core/src/operations/use.ts:143
Result of batch overwrite confirmation.
- ‘all’: Overwrite all files.
- ‘none’: Skip all files.
- string[]: List of specific files to overwrite.
OverwriteCallback
TypeScript
type OverwriteCallback = (file) => Promise<boolean>;Defined in: packages/core/src/operations/use.ts:135
Callback for confirming file overwrites (per-file).
Parameters
| Parameter | Type |
|---|---|
file |
string |
Returns
Promise<boolean>
SelectTargetSubdirCallback
TypeScript
type SelectTargetSubdirCallback = () => Promise<string | null | undefined>;Defined in: packages/core/src/operations/use.ts:179
Callback for selecting target subdirectory. Returns:
- undefined: user cancelled (stop operation)
- null: user selected project root
- string: user entered a subdirectory path
Returns
Promise<string | null | undefined>
ValidateQuartoVersionCallback
TypeScript
type ValidateQuartoVersionCallback = (required, manifest) => Promise<boolean>;Defined in: packages/core/src/operations/install.ts:72
Callback for validating Quarto version requirement.
Parameters
| Parameter | Type | Description |
|---|---|---|
required |
string |
The required Quarto version string from the manifest |
manifest |
ExtensionManifest |
The extension manifest |
Returns
Promise<boolean>
True to proceed with installation, false to cancel