Skip to main content

Class: GitHubIntegrationPlugin

Defined in: src/plugins/builtin/github-integration.ts:119

GitHub integration plugin.

Remarks

Automatically links preprints to GitHub repositories when they reference GitHub URLs in their supplementary materials.

Example

const plugin = new GitHubIntegrationPlugin();
await manager.loadBuiltinPlugin(plugin, {
githubToken: process.env.GITHUB_TOKEN, // Optional for higher rate limits
});

Extends

Constructors

new GitHubIntegrationPlugin()

new GitHubIntegrationPlugin(): GitHubIntegrationPlugin

Returns

GitHubIntegrationPlugin

Inherited from

BasePlugin.constructor

Properties

cache

protected cache: ICacheProvider

Defined in: src/plugins/builtin/base-plugin.ts:88

Cache provider (available after initialization).

Inherited from

BasePlugin.cache


context

protected context: IPluginContext

Defined in: src/plugins/builtin/base-plugin.ts:78

Plugin context (available after initialization).

Inherited from

BasePlugin.context


id

readonly id: "pub.chive.plugin.github" = 'pub.chive.plugin.github'

Defined in: src/plugins/builtin/github-integration.ts:123

Plugin ID.

Overrides

BasePlugin.id


logger

protected logger: ILogger

Defined in: src/plugins/builtin/base-plugin.ts:83

Logger instance (available after initialization).

Inherited from

BasePlugin.logger


manifest

readonly manifest: IPluginManifest

Defined in: src/plugins/builtin/github-integration.ts:128

Plugin manifest.

Overrides

BasePlugin.manifest


metrics

protected metrics: IMetrics

Defined in: src/plugins/builtin/base-plugin.ts:93

Metrics provider (available after initialization).

Inherited from

BasePlugin.metrics

Methods

getConfig()

protected getConfig<T>(key): undefined | T

Defined in: src/plugins/builtin/base-plugin.ts:226

Gets a configuration value with type safety.

Type Parameters

T

Parameters

key

string

Configuration key

Returns

undefined | T

Configuration value or undefined

Example

const apiKey = this.getConfig<string>('apiKey');

Inherited from

BasePlugin.getConfig


getRequiredConfig()

protected getRequiredConfig<T>(key): T

Defined in: src/plugins/builtin/base-plugin.ts:242

Gets a required configuration value.

Type Parameters

T

Parameters

key

string

Configuration key

Returns

T

Configuration value

Throws

Error if key not found

Example

const apiKey = this.getRequiredConfig<string>('apiKey');

Inherited from

BasePlugin.getRequiredConfig


getState()

getState(): PluginState

Defined in: src/plugins/builtin/base-plugin.ts:162

Gets current plugin state.

Returns

PluginState

Current lifecycle state

Inherited from

BasePlugin.getState


initialize()

initialize(context): Promise<void>

Defined in: src/plugins/builtin/base-plugin.ts:111

Initializes the plugin.

Parameters

context

IPluginContext

Plugin context with injected dependencies

Returns

Promise<void>

Remarks

Sets up context and calls onInitialize(). Subclasses should override onInitialize() instead of this method.

Inherited from

BasePlugin.initialize


onInitialize()

protected onInitialize(): Promise<void>

Defined in: src/plugins/builtin/github-integration.ts:170

Initializes the plugin.

Returns

Promise<void>

Overrides

BasePlugin.onInitialize


onShutdown()

protected onShutdown(): Promise<void>

Defined in: src/plugins/builtin/base-plugin.ts:211

Override in subclass for shutdown logic.

Returns

Promise<void>

Remarks

Called during shutdown(). Use this to:

  • Save state
  • Close connections
  • Clean up resources

Default implementation does nothing.

Example

protected async onShutdown(): Promise<void> {
await this.saveState();
this.connection?.close();
}

Inherited from

BasePlugin.onShutdown


recordCounter()

protected recordCounter(name, labels?, value?): void

Defined in: src/plugins/builtin/base-plugin.ts:257

Records a counter metric.

Parameters

name

string

Metric name

labels?

Record<string, string>

Optional labels

value?

number

Optional increment value (default 1)

Returns

void

Inherited from

BasePlugin.recordCounter


recordGauge()

protected recordGauge(name, value, labels?): void

Defined in: src/plugins/builtin/base-plugin.ts:268

Records a gauge metric.

Parameters

name

string

Metric name

value

number

Gauge value

labels?

Record<string, string>

Optional labels

Returns

void

Inherited from

BasePlugin.recordGauge


shutdown()

shutdown(): Promise<void>

Defined in: src/plugins/builtin/base-plugin.ts:142

Shuts down the plugin.

Returns

Promise<void>

Remarks

Calls onShutdown() and updates state. Subclasses should override onShutdown() instead of this method.

Inherited from

BasePlugin.shutdown


startTimer()

protected startTimer(name, labels?): () => void

Defined in: src/plugins/builtin/base-plugin.ts:286

Starts a timer for histogram metrics.

Parameters

name

string

Metric name

labels?

Record<string, string>

Optional labels

Returns

Function

Function to call when operation completes

Returns

void

Example

const endTimer = this.startTimer('api_request');
await this.fetchData();
endTimer(); // Records duration

Inherited from

BasePlugin.startTimer