Skip to content

AGENTS.md

129 lines · 3.9 KB · Markdown
Raw

@kody/linear — agent notes

Human setup and intent live in README.md. This file is for agents: imports, smoke/dryRun execute snippets, and edge cases. Secrets and OAuth by name only — never paste tokens. Do not disable live webhooks or jobs.

Auth

CallResolves to
omitlinear / linearApiKey
account: 'work'linear-work / linearApiKey-work
integrationName: 'linear-work'that exact OAuth name
secretName: 'linearApiKey-work'that exact API-key secret
auth: 'oauth' | 'api-key'force lane when both exist

OAuth Bearer vs personal API key (no Bearer) is handled by the package. Host: api.linear.app. GraphQL: https://api.linear.app/graphql.

Do not hard-code a personal workspace slug or alias.

Import paths

ExportImport
overview / connect URLs / export mapkody:@kody/linear
accountskody:@kody/linear/accounts
smoke-testkody:@kody/linear/smoke-test
viewerkody:@kody/linear/viewer
list-teamskody:@kody/linear/list-teams
get-teamkody:@kody/linear/get-team
list-projectskody:@kody/linear/list-projects
get-projectkody:@kody/linear/get-project
create-projectkody:@kody/linear/create-project
list-issueskody:@kody/linear/list-issues
get-issuekody:@kody/linear/get-issue
create-issuekody:@kody/linear/create-issue
update-issuekody:@kody/linear/update-issue
list-commentskody:@kody/linear/list-comments
create-commentkody:@kody/linear/create-comment
list-workflow-stateskody:@kody/linear/list-workflow-states
requestkody:@kody/linear/request
typeskody:@kody/linear/types

Prefer static kody:@kody/linear/... imports from execute. Do not lead with packages.invoke.

Priority values: 0 none, 1 urgent, 2 high, 3 medium, 4 low. Workflow state types: triage, backlog, unstarted, started, completed, canceled.

Smoke test (read-only)

import smokeTest from 'kody:@kody/linear/smoke-test'

export default async function main() {
	return await smokeTest()
	// Without credentials: { ok: true, live: false } + connect / API-key URLs
	// With credentials: { live: true, hasViewerId, hasOrganizationId } (no email)
}

dryRun / confirm

Mutating helpers require confirm: true. Pass dryRun: true to inspect the GraphQL payload without calling Linear. ./request treats query documents as read-only; mutation documents need confirmation.

import createIssue from 'kody:@kody/linear/create-issue'

export default async function main() {
	const preview = await createIssue({
		title: 'Investigate checkout timeout',
		teamId: 'team-uuid',
		priority: 2,
		dryRun: true,
	})
	// After the user confirms the exact team and title:
	return await createIssue({
		title: 'Investigate checkout timeout',
		teamId: 'team-uuid',
		priority: 2,
		confirm: true,
	})
}

Read helpers:

import listIssues from 'kody:@kody/linear/list-issues'
import listWorkflowStates from 'kody:@kody/linear/list-workflow-states'

export default async function main() {
	const states = await listWorkflowStates({ teamKey: 'ENG' })
	return await listIssues({
		teamKey: 'ENG',
		stateType: 'started',
		first: 20,
	})
}

Unwrapped GraphQL:

import request from 'kody:@kody/linear/request'

export default async function main() {
	return await request({
		query: `query ($key: String!) {
			team(id: $key) { id name key }
		}`,
		variables: { key: 'ENG' },
	})
}

Edge cases

  • If Linear returns 401/403 or GraphQL FORBIDDEN / insufficient-scope, helpers throw a message that names the missing scope and the next setup URL.
  • assigneeId: 'me' on ./list-issues filters to the authorizing user.
  • Helpers project slim objects. Use ./request when you need extra fields.
  • Prefer @kody/linear-mcp only for a faster first win; this package is the preferred invoke path once BYO OAuth or an API key is set up.