linear

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Linear API Emulator

Linear API 模拟器

Stateful Linear GraphQL API emulation with organizations, users, teams, workflow states, issues, comments, labels, projects, cycles, OAuth apps, tokens, webhooks, and basic agent sessions.
具备状态的Linear GraphQL API模拟,支持组织、用户、团队、工作流状态、问题、评论、标签、项目、周期、OAuth应用、令牌、Webhook以及基础Agent会话。

Start

启动

bash
undefined
bash
undefined

Linear only

仅启动Linear

npx emulate --service linear

Default URL: `http://localhost:4012` when all services are started, or `http://localhost:4000` when Linear is the only service.
npx emulate --service linear

默认URL:当启动所有服务时为 `http://localhost:4012`,当仅启动Linear服务时为 `http://localhost:4000`。

URL Mapping

URL映射

Real Linear URLEmulator URL
https://api.linear.app/graphql
$LINEAR_EMULATOR_URL/graphql
https://linear.app/oauth/authorize
$LINEAR_EMULATOR_URL/oauth/authorize
https://api.linear.app/oauth/token
$LINEAR_EMULATOR_URL/oauth/token
https://api.linear.app/oauth/revoke
$LINEAR_EMULATOR_URL/oauth/revoke
真实Linear URL模拟器URL
https://api.linear.app/graphql
$LINEAR_EMULATOR_URL/graphql
https://linear.app/oauth/authorize
$LINEAR_EMULATOR_URL/oauth/authorize
https://api.linear.app/oauth/token
$LINEAR_EMULATOR_URL/oauth/token
https://api.linear.app/oauth/revoke
$LINEAR_EMULATOR_URL/oauth/revoke

Auth

认证

GraphQL accepts a bearer token or bare personal API key:
bash
curl "$LINEAR_EMULATOR_URL/graphql" \
  -H "Authorization: Bearer lin_test_admin" \
  -H "Content-Type: application/json" \
  -d '{"query":"{ viewer { id email } }"}'
Scope checks are relaxed by default. Set
linear.strict_scopes: true
in seed config to require supported operation scopes such as
read
,
write
,
issues:create
,
comments:create
, and
admin
.
GraphQL接受Bearer令牌或纯个人API密钥:
bash
curl "$LINEAR_EMULATOR_URL/graphql" \
  -H "Authorization: Bearer lin_test_admin" \
  -H "Content-Type: application/json" \
  -d '{"query":"{ viewer { id email } }"}'
默认情况下权限范围检查较为宽松。在种子配置中设置
linear.strict_scopes: true
,即可要求支持的操作权限范围,如
read
write
issues:create
comments:create
admin

Seed Config

种子配置

yaml
linear:
  organization:
    name: Acme
    url_key: acme
  users:
    - email: admin@example.com
      name: Admin User
      admin: true
    - email: dev@example.com
      name: Developer
  teams:
    - key: ENG
      name: Engineering
  issues:
    - team: ENG
      title: Fix local checkout test
      state: Todo
      assignee: dev@example.com
  oauth_apps:
    - client_id: lin_example_client_id
      client_secret: example_client_secret
      name: My Linear App
      redirect_uris:
        - http://localhost:3000/api/auth/callback/linear
      scopes: [read, write, issues:create, comments:create]
  tokens:
    - token: lin_test_admin
      user: admin@example.com
      scopes: [read, write, issues:create, comments:create, admin]
  strict_scopes: false
yaml
linear:
  organization:
    name: Acme
    url_key: acme
  users:
    - email: admin@example.com
      name: Admin User
      admin: true
    - email: dev@example.com
      name: Developer
  teams:
    - key: ENG
      name: Engineering
  issues:
    - team: ENG
      title: Fix local checkout test
      state: Todo
      assignee: dev@example.com
  oauth_apps:
    - client_id: lin_example_client_id
      client_secret: example_client_secret
      name: My Linear App
      redirect_uris:
        - http://localhost:3000/api/auth/callback/linear
      scopes: [read, write, issues:create, comments:create]
  tokens:
    - token: lin_test_admin
      user: admin@example.com
      scopes: [read, write, issues:create, comments:create, admin]
  strict_scopes: false

GraphQL Surface

GraphQL 接口

Supported queries:
  • viewer
  • organization
  • users
    ,
    user
  • teams
    ,
    team
  • workflowStates
    ,
    workflowState
  • issues
    ,
    issue
  • comments
    ,
    comment
  • issueLabels
    ,
    issueLabel
  • projects
    ,
    project
  • cycles
    ,
    cycle
  • webhooks
    ,
    webhook
  • agentSessions
    ,
    agentSession
Supported mutations:
  • issueCreate
    ,
    issueUpdate
    ,
    issueDelete
    ,
    issueArchive
    ,
    issueUnarchive
  • commentCreate
    ,
    commentUpdate
    ,
    commentDelete
  • issueLabelCreate
    ,
    issueLabelUpdate
    ,
    issueLabelDelete
  • issueAddLabel
    ,
    issueRemoveLabel
  • webhookCreate
    ,
    webhookDelete
  • agentSessionCreateOnIssue
    ,
    agentSessionCreateOnComment
    ,
    agentSessionUpdate
  • agentActivityCreate
Connections use Relay-style cursors with
nodes
,
edges
, and
pageInfo
.
支持的查询:
  • viewer
  • organization
  • users
    ,
    user
  • teams
    ,
    team
  • workflowStates
    ,
    workflowState
  • issues
    ,
    issue
  • comments
    ,
    comment
  • issueLabels
    ,
    issueLabel
  • projects
    ,
    project
  • cycles
    ,
    cycle
  • webhooks
    ,
    webhook
  • agentSessions
    ,
    agentSession
支持的突变:
  • issueCreate
    ,
    issueUpdate
    ,
    issueDelete
    ,
    issueArchive
    ,
    issueUnarchive
  • commentCreate
    ,
    commentUpdate
    ,
    commentDelete
  • issueLabelCreate
    ,
    issueLabelUpdate
    ,
    issueLabelDelete
  • issueAddLabel
    ,
    issueRemoveLabel
  • webhookCreate
    ,
    webhookDelete
  • agentSessionCreateOnIssue
    ,
    agentSessionCreateOnComment
    ,
    agentSessionUpdate
  • agentActivityCreate
连接使用Relay风格的游标,包含
nodes
edges
pageInfo

OAuth

OAuth

  • GET /oauth/authorize
    - authorization endpoint with local user picker
  • POST /oauth/authorize/callback
    - local user picker callback
  • POST /oauth/token
    - authorization code, refresh token, and client credentials grants
  • POST /oauth/revoke
    - revoke access or refresh tokens
OAuth apps can use
actor: user
or
actor: app
. The configured actor is authoritative. User actor apps use authorization code flows. App actor apps use the app install flow and can request client credentials tokens. App actor support is sufficient for local agent and service-account tests, but it is not full production Linear agent behavior.
  • GET /oauth/authorize
    - 带本地用户选择器的授权端点
  • POST /oauth/authorize/callback
    - 本地用户选择器回调
  • POST /oauth/token
    - 授权码、刷新令牌和客户端凭证授权
  • POST /oauth/revoke
    - 撤销访问令牌或刷新令牌
OAuth应用可使用
actor: user
actor: app
。配置的actor为权威设置。用户actor应用使用授权码流程。应用actor应用使用应用安装流程,并可请求客户端凭证令牌。应用actor支持足以满足本地Agent和服务账户测试,但并非完整的生产环境Linear Agent行为。

Webhooks

Webhook

Create local webhook subscriptions through
webhookCreate
or seed config. Supported writes dispatch Linear-shaped payloads with
Linear-Delivery
,
Linear-Event
, and
Linear-Signature
headers when a secret is configured.
通过
webhookCreate
或种子配置创建本地Webhook订阅。当配置密钥后,支持的写入操作会发送Linear格式的负载,并附带
Linear-Delivery
Linear-Event
Linear-Signature
头。

Inspector

检查器

Open
GET /
in the Linear emulator to inspect issues, teams, users, projects, agent sessions, OAuth apps, tokens, webhook subscriptions, and webhook deliveries.
在Linear模拟器中打开
GET /
,可查看问题、团队、用户、项目、Agent会话、OAuth应用、令牌、Webhook订阅以及Webhook投递记录。

Current Limits

当前限制

Full Linear schema coverage, exact production rate limiting, notification inbox behavior, rich document APIs, customer APIs, initiative APIs, exact search relevance, and full production agent behavior are not implemented.
尚未实现完整的Linear Schema覆盖、精确的生产环境速率限制、通知收件箱行为、富文档API、客户API、倡议API、精确的搜索相关性以及完整的生产环境Agent行为。