@@ -2,6 +2,7 @@ import * as T from 'typings'
22import * as TT from 'typings/tutorial'
33import * as E from 'typings/error'
44import * as vscode from 'vscode'
5+ import { satisfies } from 'semver'
56import saveCommit from '../actions/saveCommit'
67import setupActions from '../actions/setupActions'
78import solutionActions from '../actions/solutionActions'
@@ -110,6 +111,25 @@ class Channel implements Channel {
110111case 'EDITOR_TUTORIAL_CONFIG' :
111112try {
112113const data :TT . Tutorial = action . payload . tutorial
114+
115+ // validate extension version
116+ const expectedAppVersion = data . config ?. appVersions ?. coderoadVSCode
117+ if ( expectedAppVersion ) {
118+ const extension = vscode . extensions . getExtension ( 'coderoad.coderoad' )
119+ if ( extension ) {
120+ const currentAppVersion = extension . packageJSON . version
121+ const satisfied = satisfies ( currentAppVersion , expectedAppVersion )
122+ if ( ! satisfied ) {
123+ const error :E . ErrorMessage = {
124+ type :'UnmetExtensionVersion' ,
125+ message :`Expected CodeRoad v${ expectedAppVersion } , but found${ currentAppVersion } ` ,
126+ }
127+ this . send ( { type :'TUTORIAL_CONFIGURE_FAIL' , payload :{ error} } )
128+ return
129+ }
130+ }
131+ }
132+
113133// setup tutorial config (save watcher, test runner, etc)
114134await this . context . setTutorial ( this . workspaceState , data )
115135
@@ -121,7 +141,7 @@ class Channel implements Channel {
121141const currentVersion :string | null = await version ( dep . name )
122142if ( ! currentVersion ) {
123143// use a custom error message
124- const error = {
144+ const error : E . ErrorMessage = {
125145type :'MissingTutorialDependency' ,
126146message :
127147dep . message || `Process "${ dep . name } " is required but not found. It may need to be installed` ,
@@ -140,7 +160,7 @@ class Channel implements Channel {
140160const satisfiedDependency = await compareVersions ( currentVersion , dep . version )
141161
142162if ( ! satisfiedDependency ) {
143- const error = {
163+ const error : E . ErrorMessage = {
144164type :'UnmetTutorialDependency' ,
145165message :`Expected${ dep . name } to have version${ dep . version } , but found version${ currentVersion } ` ,
146166actions :[
@@ -155,7 +175,7 @@ class Channel implements Channel {
155175}
156176
157177if ( satisfiedDependency !== true ) {
158- const error = satisfiedDependency || {
178+ const error : E . ErrorMessage = satisfiedDependency || {
159179type :'UnknownError' ,
160180message :`Something went wrong comparing dependency for${ name } ` ,
161181actions :[