Skip to content
Generated from the .d.ts files published in guardlink@2.0.0. Report problems against guardlink, not this page.

init

Everything exported by guardlink/init, from the .d.ts files published in guardlink@2.0.0. See the entry points for the other subpaths, and use guardlink as a library for worked examples.

Property Type Description
agentIds? string[] Explicit agent IDs to create files for (when no existing agent files found)
dryRun? boolean Dry run — show what would be created without writing
force? boolean Re-scaffold an already-initialized project: rewrite config, README, prompt, reference doc, .mcp.json and the agent instruction blocks. It does NOT overwrite authored content. A definitions file holding declarations the template does not, and a config.json carrying settings the template does not, are preserved and reported (D24). Use reset for those.
mode? AnnotationMode Where annotations LIVE. Nothing else. external (default) — .gal sidecars under .guardlink/annotations/ inline — comments in the source files themselves This used to also decide whether init wrote anything outside .guardlink/, which conflated two unrelated questions and made “keep annotations out of my source” cost you MCP auto-discovery and every agent instruction file — the two things that make an agent aware GuardLink exists at all. That footprint question is now rootFiles (GL-506).
project? string Override project name
reset? boolean Overwrite authored content too — the definitions file and a customised config.json. This DESTROYS the threat model’s declarations. Typing the flag is the confirmation; there is no prompt, because the flag exists so the destructive intent has to be stated separately from “re-scaffold”. Implies force.
root string Project root directory
rootFiles? boolean Whether init may write outside .guardlink/. Default true: root .mcp.json, agent instruction files, docs/, .gitignore and .gitattributes. Set false for a zero-footprint install where .guardlink/ is the entire diff — what --mode external used to imply, now asked for on its own.
skipAgentFiles? boolean Skip agent file updates (only create .guardlink/)

Property Type Description
created string[] -
preserved string[] Files --force declined to overwrite because they hold authored content (D24). Distinct from skipped, which is the ordinary “exists, not forcing” case: an entry here means the user asked for an overwrite and did not get one, so callers are expected to say so loudly.
project ProjectInfo -
skipped string[] -
updated string[] -

Property Type
dryRun? boolean
model ThreatModel | null
root string

Property Type
skipped string[]
updated string[]

const AGENT_CHOICES: AgentChoice[]

initProject(options): InitResult

Parameter Type
options InitOptions

InitResult


promptAgentSelection(agentFiles): Promise<string[]>

Show detection-aware prompt. Displays:

  1. Always-created files
  2. Auto-detected agents (from directory presence)
  3. Optional agents user can add

Returns combined list of agent IDs (detected + user-selected).

Parameter Type
agentFiles AgentFile[]

Promise<string[]>


resolveAgentFiles(agentIds): AgentChoice[]

Resolve agent IDs (from picker or flags) to file paths.

Parameter Type
agentIds string[]

AgentChoice[]


syncAgentFiles(options): SyncResult

Regenerate ALL agent instruction files with live threat model context. Called after parse/validate/annotate to keep instructions up to date. Uses marker-based replacement so user content outside markers is preserved.

Parameter Type
options SyncOptions

SyncResult

Re-exports AgentFile


Re-exports detectProject


Re-exports ProjectInfo