| name | speak-upgrade-migration |
| description | Analyze, plan, and execute Speak SDK upgrades with breaking change detection.
Use when upgrading Speak SDK versions, detecting deprecations,
or migrating to new API versions for language learning features.
Trigger with phrases like "upgrade speak", "speak migration",
"speak breaking changes", "update speak SDK", "analyze speak version".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Bash(git:*) |
| version | 1.0.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
Speak Upgrade & Migration
Overview
Guide for upgrading Speak SDK versions and handling breaking changes in language learning integrations.
Prerequisites
- Current Speak SDK installed
- Git for version control
- Test suite available
- Staging environment
Instructions
Step 1: Check Current Version
npm list @speak/language-sdk
npm view @speak/language-sdk version
npm outdated @speak/language-sdk
Step 2: Review Changelog
open https://github.com/speak/language-sdk/releases
cat node_modules/@speak/language-sdk/CHANGELOG.md
Step 3: Create Upgrade Branch
git checkout -b upgrade/speak-sdk-vX.Y.Z
npm install @speak/language-sdk@latest
npm test
Step 4: Handle Common Breaking Changes
SDK Version History
| SDK Version | API Version | Node.js | Key Changes |
|---|
| 3.x | 2025-01 | 20+ | Real-time API, new speech engine |
| 2.x | 2024-01 | 18+ | Async/await patterns, TypeScript |
| 1.x | 2023-01 | 16+ | Initial release |
Import Changes (v1 to v2)
import { Client, Lesson } from 'speak-sdk';
const client = new Client({ key: 'xxx' });
import { SpeakClient, LessonSession } from '@speak/language-sdk';
const client = new SpeakClient({
apiKey: 'xxx',
appId: 'app_xxx',
});
Session API Changes (v2 to v3)
const session = await tutor.startLesson({ topic: 'greetings' });
const feedback = await session.submitResponse({ text: 'Hola' });
const session = tutor.createLessonStream({ topic: 'greetings' });
session.on('prompt', (prompt) => console.log(prompt));
session.on('feedback', (feedback) => console.log(feedback));
await session.send({ text: 'Hola', audio: audioBuffer });
Speech Recognition Changes
const result = await client.speech.recognize(audioBuffer);
const recognizer = client.speech.createRecognizer({
language: 'es',
continuous: true,
});
recognizer.on('result', (result) => {
console.log('Partial:', result.partial);
console.log('Final:', result.final);
});
recognizer.start(audioStream);
Step 5: Migration Script
import { readdir, readFile, writeFile } from 'fs/promises';
import { join } from 'path';
const MIGRATIONS = [
{
pattern: /from 'speak-sdk'/g,
replacement: "from '@speak/language-sdk'",
description: 'Update import path',
},
{
pattern: /new Client\(/g,
replacement: 'new SpeakClient(',
description: 'Rename Client to SpeakClient',
},
{
pattern: /{ key:/g,
replacement: '{ apiKey:',
description: 'Rename key to apiKey',
},
{
pattern: /\.startLesson\(/g,
replacement: '.createLessonStream(',
description: 'Update to streaming API',
},
];
async function migrateFile(filePath: string): Promise<void> {
let content = await readFile(filePath, 'utf-8');
let modified = false;
for (const migration of ) {
(migration..(content)) {
.();
content = content.(migration., migration.);
modified = ;
}
}
(modified) {
(filePath, content);
.();
}
}
(): <> {
files = (dir, { : , : });
( file files) {
(file.() && .(file.)) {
filePath = (file., file.);
(filePath);
}
}
}
();
Step 6: Update Type Definitions
interface LegacySession {
submitResponse(response: { text: string }): Promise<Feedback>;
}
interface LessonStream {
on(event: 'prompt', callback: (prompt: TutorPrompt) => void): void;
on(event: 'feedback', callback: (feedback: Feedback) => void): void;
on(event: 'error', callback: (error: SpeakError) => void): void;
send(input: LessonInput): Promise<void>;
close(): Promise<SessionSummary>;
}
class SessionAdapter {
: ;
: <> | = ;
() {
. = stream;
}
(: { : }): <> {
( {
..(, resolve);
..(, reject);
..(response);
});
}
}
Deprecation Handling
if (process.env.NODE_ENV === 'development') {
process.on('warning', (warning) => {
if (warning.name === 'DeprecationWarning' && warning.message.includes('speak')) {
console.warn('[Speak SDK]', warning.message);
trackDeprecation({
message: warning.message,
stack: warning.stack,
version: process.env.SPEAK_SDK_VERSION,
});
}
});
}
async function getLesson(config: LessonConfig) {
const client = getSpeakClient();
if ('startLesson' in client.tutor) {
console.warn('Using deprecated startLesson API. Update to createLessonStream.');
return await client..(config);
}
client..(config);
}
Rollback Procedure
npm install @speak/language-sdk@2.x.x --save-exact
npm list @speak/language-sdk
npm test
Testing Upgrade in Staging
export SPEAK_SDK_VERSION=3.x
npm run deploy:staging
npm run test:integration
npm run test:e2e
Output
- Updated SDK version
- Fixed breaking changes
- Passing test suite
- Documented rollback procedure
Error Handling
| Issue | Cause | Solution |
|---|
| Import errors | Path changed | Update import paths |
| Type errors | Interface changed | Update type definitions |
| Runtime errors | API behavior changed | Review changelog |
| Test failures | Mock outdated | Update test mocks |
Resources
Next Steps
For CI integration during upgrades, see speak-ci-integration.