Skip to content

Commit 5b1432d

Browse files
committed
feat: Added CLI version to plugin search. This gates breaking changes and prevents them from breaking older versions
1 parent b4e176c commit 5b1432d

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
"deploy": "npm run pkg && npm run notarize && npm run upload",
145145
"prepublishOnly": "npm run build"
146146
},
147-
"version": "1.1.0-beta4",
147+
"version": "1.1.0-beta5",
148148
"bugs": "https://github.com/codifycli/codify/issues",
149149
"keywords": [
150150
"oclif",

src/api/backend/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import { PluginSearchQuery, PluginSearchResult } from './types.js';
99
const API_BASE_URL = 'https://api.codifycli.com'
1010

1111
export const ApiClient = {
12-
async searchPlugins(query: PluginSearchQuery[]): Promise<PluginSearchResult> {
13-
const body = JSON.stringify({ query });
12+
async searchPlugins(query: PluginSearchQuery[], cliVersion: string): Promise<PluginSearchResult> {
13+
const body = JSON.stringify({ query, cliVersion });
1414
const res = await fetch(
15-
`${API_BASE_URL}/v1/plugins/versions/search`,
15+
`${API_BASE_URL}/v2/plugins/versions/search`,
1616
{ method: 'POST', body, headers: { 'Content-Type': 'application/json' } }
1717
);
1818

src/plugins/resolver.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import path from 'node:path';
77
import { PluginInfo } from '../api//backend/types.js';
88
import { ApiClient } from '../api/backend/index.js';
99
import { ctx } from '../events/context.js';
10+
import { VERSION } from '../config.js';
1011
import { Plugin } from './plugin.js';
1112

1213
const PLUGIN_CACHE_DIR = path.resolve(os.homedir(), '.codify/plugins')
@@ -31,7 +32,7 @@ export class PluginResolver {
3132

3233
// Fetch the latest plugin info from the server
3334
const latestPluginInfo = await ApiClient
34-
.searchPlugins(networkPluginDefs.map(([name, version]) => ({ name, version })))
35+
.searchPlugins(networkPluginDefs.map(([name, version]) => ({ name, version })), VERSION)
3536
.catch((error: Error) => {
3637
console.warn('Unable to fetch latest plugin info');
3738
ctx.debug(`Unable to fetch latest plugin info:\n${error.message}`);

0 commit comments

Comments
 (0)