计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
linear-upgrade-migration【效率与协作】Upgrade Linear SDK versions and migrate breaking changes. Use when updating to a new SDK version, handling deprecations, or migrating between major Linear API versions. Trigger with phrases like "upgrade linear SDK", "linear SDK migration", "update linear", "linear breaking changes", "linear deprecation".
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Safely upgrade Linear SDK versions and handle breaking changes.
# Check installed version
npm list @linear/sdk
# Check latest available version
npm view @linear/sdk version
# Check changelog
npm view @linear/sdk changelog
# View version history
npm view @linear/sdk versions --json | jq -r '.[-10:][]'
# Check GitHub releases for migration guides
open https://github.com/linear/linear/releases
git checkout -b upgrade/linear-sdk-vX.Y.Z
# Upgrade to latest
npm install @linear/sdk@latest
# Or upgrade to specific version
npm install @linear/sdk@X.Y.Z
# Check for type errors
npx tsc --noEmit
// Before (deprecated)
const issue = await client.issue("ABC-123");
console.log(issue.state); // Old field name
// After (new version)
const issue = await client.issue("ABC-123");
const state = await issue.state; // Now returns Promise
console.log(state?.name);
// Before: Direct object return
const teams = await client.teams();
teams.forEach(team => console.log(team.name));
// After: Paginated connection
const teams = await client.teams();
teams.nodes.forEach(team => console.log(team.name));
// Before
await client.createIssue({ title: "Issue" });
// After: teamId is required
await client.createIssue({
title: "Issue",
teamId: team.id, // Now required
});
// Check if method exists before using
if (typeof client.deprecatedMethod === "function") {
await client.deprecatedMethod();
} else {
await client.newMethod();
}
// lib/linear-compat.ts
import { LinearClient, Issue } from "@linear/sdk";
// Wrapper for breaking changes
export class LinearCompatClient {
private client: LinearClient;
constructor(apiKey: string) {
this.client = new LinearClient({ apiKey });
}
// Normalize different SDK versions
async getIssue(identifier: string): Promise<{
id: string;
title: string;
stateName: string;
}> {
const issue = await this.client.issue(identifier);
const state = await issue.state;
return {
id: issue.id,
title: issue.title,
stateName: state?.name ?? "Unknown",
};
}
// Add backward-compatible methods as needed
}
# Run test suite
npm test
# Run type checking
npx tsc --noEmit
# Run linting
npm run lint
# Deploy to staging
npm run deploy:staging
# Run integration tests against staging
npm run test:integration
// Feature flag for new SDK behavior
const USE_NEW_SDK = process.env.LINEAR_SDK_V2 === "true";
async function getIssues() {
if (USE_NEW_SDK) {
// New SDK logic
return newGetIssues();
} else {
// Legacy SDK logic
return legacyGetIssues();
}
}
| SDK Version | Node.js | TypeScript | Key Changes |
|---|---|---|---|
| 1.x | 14+ | 4.5+ | Initial release |
| 2.x | 16+ | 4.7+ | ESM support |
| 3.x | 18+ | 5.0+ | Strict types |
// 1.x: CommonJS
const { LinearClient } = require("@linear/sdk");
// 2.x: ESM
import { LinearClient } from "@linear/sdk";
// Update package.json
{
"type": "module"
}
// 2.x: Loose types
const issue: any = await client.issue("ABC-123");
// 3.x: Strict types
const issue: Issue = await client.issue("ABC-123");
// Must handle nullable fields
const state = await issue.state;
if (state) {
console.log(state.name);
}
# If upgrade fails, rollback
git checkout main
npm install @linear/sdk@PREVIOUS_VERSION
npm run test
git commit -am "Rollback Linear SDK to PREVIOUS_VERSION"
| Error | Cause | Solution |
|---|---|---|
Property does not exist | Renamed field | Check migration guide |
Type not assignable | Changed type | Update type annotations |
Module not found | ESM/CJS mismatch | Update import syntax |
Runtime method missing | Version mismatch | Check SDK version |
Set up CI/CD integration with linear-ci-integration.