Skip to content

Commit 2e37073

Browse files
mrubensvalekseev
authored andcommitted
Turn on marketplace (RooCodeInc#4788)
1 parent e78ff68 commit 2e37073

File tree

10 files changed

+44
-203
lines changed

10 files changed

+44
-203
lines changed

packages/types/src/experiment.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { Keys, Equals, AssertEqual } from "./type-fu.js"
66
* ExperimentId
77
*/
88

9-
export const experimentIds = ["powerSteering", "disableCompletionCommand", "marketplace", "multiFileApplyDiff"] as const
9+
export const experimentIds = ["powerSteering", "disableCompletionCommand", "multiFileApplyDiff"] as const
1010

1111
export const experimentIdsSchema = z.enum(experimentIds)
1212

@@ -19,7 +19,6 @@ export type ExperimentId = z.infer<typeof experimentIdsSchema>
1919
export const experimentsSchema = z.object({
2020
powerSteering: z.boolean().optional(),
2121
disableCompletionCommand: z.boolean().optional(),
22-
marketplace: z.boolean().optional(),
2322
multiFileApplyDiff: z.boolean().optional(),
2423
})
2524

src/core/webview/ClineProvider.ts

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,6 @@ export class ClineProvider
528528
// If the extension is starting a new session, clear previous task state.
529529
await this.removeClineFromStack()
530530

531-
// Set initial VSCode context for experiments
532-
await this.updateVSCodeContext()
533-
534531
this.log("Webview view resolved")
535532
}
536533

@@ -1273,29 +1270,12 @@ export class ClineProvider
12731270
const state = await this.getStateToPostToWebview()
12741271
this.postMessageToWebview({ type: "state", state })
12751272

1276-
// Update VSCode context for experiments
1277-
await this.updateVSCodeContext()
1278-
12791273
// Check MDM compliance and send user to account tab if not compliant
12801274
if (!this.checkMdmCompliance()) {
12811275
await this.postMessageToWebview({ type: "action", action: "accountButtonClicked" })
12821276
}
12831277
}
12841278

1285-
/**
1286-
* Updates VSCode context variables for experiments so they can be used in when clauses
1287-
*/
1288-
private async updateVSCodeContext() {
1289-
const { experiments } = await this.getState()
1290-
1291-
// Set context for marketplace experiment
1292-
await vscode.commands.executeCommand(
1293-
"setContext",
1294-
`${Package.name}.marketplaceEnabled`,
1295-
experiments.marketplace ?? false,
1296-
)
1297-
}
1298-
12991279
/**
13001280
* Checks if there is a file-based system prompt override for the given mode
13011281
*/
@@ -1384,14 +1364,12 @@ export class ClineProvider
13841364
const allowedCommands = vscode.workspace.getConfiguration(Package.name).get<string[]>("allowedCommands") || []
13851365
const cwd = this.cwd
13861366

1387-
// Only fetch marketplace data if the feature is enabled
1367+
// Fetch marketplace data
13881368
let marketplaceItems: any[] = []
13891369
let marketplaceInstalledMetadata: any = { project: {}, global: {} }
13901370

1391-
if (experiments.marketplace) {
1392-
marketplaceItems = (await this.marketplaceManager.getCurrentItems()) || []
1393-
marketplaceInstalledMetadata = await this.marketplaceManager.getInstallationMetadata()
1394-
}
1371+
marketplaceItems = (await this.marketplaceManager.getCurrentItems()) || []
1372+
marketplaceInstalledMetadata = await this.marketplaceManager.getInstallationMetadata()
13951373

13961374
// Check if there's a system prompt override for the current mode
13971375
const currentMode = mode ?? defaultModeSlug

src/core/webview/webviewMessageHandler.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,13 +1465,6 @@ export const webviewMessageHandler = async (
14651465
break
14661466
}
14671467
case "filterMarketplaceItems": {
1468-
// Check if marketplace is enabled before making API calls
1469-
const { experiments } = await provider.getState()
1470-
if (!experiments.marketplace) {
1471-
console.log("Marketplace: Feature disabled, skipping API call")
1472-
break
1473-
}
1474-
14751468
if (marketplaceManager && message.filters) {
14761469
try {
14771470
await marketplaceManager.updateWithFilteredItems({
@@ -1489,13 +1482,6 @@ export const webviewMessageHandler = async (
14891482
}
14901483

14911484
case "installMarketplaceItem": {
1492-
// Check if marketplace is enabled before installing
1493-
const { experiments } = await provider.getState()
1494-
if (!experiments.marketplace) {
1495-
console.log("Marketplace: Feature disabled, skipping installation")
1496-
break
1497-
}
1498-
14991485
if (marketplaceManager && message.mpItem && message.mpInstallOptions) {
15001486
try {
15011487
const configFilePath = await marketplaceManager.installMarketplaceItem(
@@ -1525,13 +1511,6 @@ export const webviewMessageHandler = async (
15251511
}
15261512

15271513
case "removeInstalledMarketplaceItem": {
1528-
// Check if marketplace is enabled before removing
1529-
const { experiments } = await provider.getState()
1530-
if (!experiments.marketplace) {
1531-
console.log("Marketplace: Feature disabled, skipping removal")
1532-
break
1533-
}
1534-
15351514
if (marketplaceManager && message.mpItem && message.mpInstallOptions) {
15361515
try {
15371516
await marketplaceManager.removeInstalledMarketplaceItem(message.mpItem, message.mpInstallOptions)
@@ -1544,13 +1523,6 @@ export const webviewMessageHandler = async (
15441523
}
15451524

15461525
case "installMarketplaceItemWithParameters": {
1547-
// Check if marketplace is enabled before installing with parameters
1548-
const { experiments } = await provider.getState()
1549-
if (!experiments.marketplace) {
1550-
console.log("Marketplace: Feature disabled, skipping installation with parameters")
1551-
break
1552-
}
1553-
15541526
if (marketplaceManager && message.payload && "item" in message.payload && "parameters" in message.payload) {
15551527
try {
15561528
const configFilePath = await marketplaceManager.installMarketplaceItem(message.payload.item, {

src/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232
{
233233
"command": "roo-cline.marketplaceButtonClicked",
234234
"group": "navigation@4",
235-
"when": "view == roo-cline.SidebarProvider && roo-cline.marketplaceEnabled"
235+
"when": "view == roo-cline.SidebarProvider"
236236
},
237237
{
238238
"command": "roo-cline.historyButtonClicked",
@@ -274,7 +274,7 @@
274274
{
275275
"command": "roo-cline.marketplaceButtonClicked",
276276
"group": "navigation@4",
277-
"when": "activeWebviewPanelId == roo-cline.TabPanelProvider && roo-cline.marketplaceEnabled"
277+
"when": "activeWebviewPanelId == roo-cline.TabPanelProvider"
278278
},
279279
{
280280
"command": "roo-cline.historyButtonClicked",

src/services/marketplace/__tests__/marketplace-setting-check.spec.ts

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@ import { webviewMessageHandler } from "../../../core/webview/webviewMessageHandl
66
const mockProvider = {
77
getState: vi.fn(),
88
postStateToWebview: vi.fn(),
9+
postMessageToWebview: vi.fn(),
910
} as any
1011

1112
const mockMarketplaceManager = {
1213
updateWithFilteredItems: vi.fn(),
1314
} as any
1415

15-
describe("Marketplace Setting Check", () => {
16+
describe("Marketplace General Availability", () => {
1617
beforeEach(() => {
1718
vi.clearAllMocks()
1819
})
1920

20-
it("should skip API calls when marketplace is disabled", async () => {
21-
// Mock experiments with marketplace disabled
21+
it("should allow marketplace API calls (marketplace is generally available)", async () => {
22+
// Mock state without marketplace experiment (since it's now generally available)
2223
mockProvider.getState.mockResolvedValue({
23-
experiments: { marketplace: false },
24+
experiments: {},
2425
})
2526

2627
const message = {
@@ -30,25 +31,7 @@ describe("Marketplace Setting Check", () => {
3031

3132
await webviewMessageHandler(mockProvider, message, mockMarketplaceManager)
3233

33-
// Should not call marketplace manager methods
34-
expect(mockMarketplaceManager.updateWithFilteredItems).not.toHaveBeenCalled()
35-
expect(mockProvider.postStateToWebview).not.toHaveBeenCalled()
36-
})
37-
38-
it("should allow API calls when marketplace is enabled", async () => {
39-
// Mock experiments with marketplace enabled
40-
mockProvider.getState.mockResolvedValue({
41-
experiments: { marketplace: true },
42-
})
43-
44-
const message = {
45-
type: "filterMarketplaceItems" as const,
46-
filters: { type: "mcp", search: "", tags: [] },
47-
}
48-
49-
await webviewMessageHandler(mockProvider, message, mockMarketplaceManager)
50-
51-
// Should call marketplace manager methods
34+
// Should call marketplace manager methods since marketplace is generally available
5235
expect(mockMarketplaceManager.updateWithFilteredItems).toHaveBeenCalledWith({
5336
type: "mcp",
5437
search: "",
@@ -57,13 +40,13 @@ describe("Marketplace Setting Check", () => {
5740
expect(mockProvider.postStateToWebview).toHaveBeenCalled()
5841
})
5942

60-
it("should skip installation when marketplace is disabled", async () => {
61-
// Mock experiments with marketplace disabled
43+
it("should allow marketplace installation (marketplace is generally available)", async () => {
44+
// Mock state without marketplace experiment (since it's now generally available)
6245
mockProvider.getState.mockResolvedValue({
63-
experiments: { marketplace: false },
46+
experiments: {},
6447
})
6548

66-
const mockInstallMarketplaceItem = vi.fn()
49+
const mockInstallMarketplaceItem = vi.fn().mockResolvedValue(undefined)
6750
const mockMarketplaceManagerWithInstall = {
6851
installMarketplaceItem: mockInstallMarketplaceItem,
6952
}
@@ -83,7 +66,7 @@ describe("Marketplace Setting Check", () => {
8366

8467
await webviewMessageHandler(mockProvider, message, mockMarketplaceManagerWithInstall as any)
8568

86-
// Should not call install method
87-
expect(mockInstallMarketplaceItem).not.toHaveBeenCalled()
69+
// Should call install method since marketplace is generally available
70+
expect(mockInstallMarketplaceItem).toHaveBeenCalledWith(message.mpItem, message.mpInstallOptions)
8871
})
8972
})

src/shared/__tests__/experiments.spec.ts

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ describe("experiments", () => {
2727
it("returns false when POWER_STEERING experiment is not enabled", () => {
2828
const experiments: Record<ExperimentId, boolean> = {
2929
powerSteering: false,
30-
marketplace: false,
3130
disableCompletionCommand: false,
3231
multiFileApplyDiff: false,
3332
}
@@ -37,7 +36,6 @@ describe("experiments", () => {
3736
it("returns true when experiment POWER_STEERING is enabled", () => {
3837
const experiments: Record<ExperimentId, boolean> = {
3938
powerSteering: true,
40-
marketplace: false,
4139
disableCompletionCommand: false,
4240
multiFileApplyDiff: false,
4341
}
@@ -47,49 +45,10 @@ describe("experiments", () => {
4745
it("returns false when experiment is not present", () => {
4846
const experiments: Record<ExperimentId, boolean> = {
4947
powerSteering: false,
50-
marketplace: false,
5148
disableCompletionCommand: false,
5249
multiFileApplyDiff: false,
5350
}
5451
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.POWER_STEERING)).toBe(false)
5552
})
5653
})
57-
describe("MARKETPLACE", () => {
58-
it("is configured correctly", () => {
59-
expect(EXPERIMENT_IDS.MARKETPLACE).toBe("marketplace")
60-
expect(experimentConfigsMap.MARKETPLACE).toMatchObject({
61-
enabled: false,
62-
})
63-
})
64-
})
65-
66-
describe("isEnabled for MARKETPLACE", () => {
67-
it("returns false when MARKETPLACE experiment is not enabled", () => {
68-
const experiments: Record<ExperimentId, boolean> = {
69-
powerSteering: false,
70-
marketplace: false,
71-
disableCompletionCommand: false,
72-
multiFileApplyDiff: false,
73-
}
74-
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.MARKETPLACE)).toBe(false)
75-
})
76-
77-
it("returns true when MARKETPLACE experiment is enabled", () => {
78-
const experiments: Record<ExperimentId, boolean> = {
79-
powerSteering: false,
80-
marketplace: true,
81-
disableCompletionCommand: false,
82-
multiFileApplyDiff: false,
83-
}
84-
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.MARKETPLACE)).toBe(true)
85-
})
86-
87-
it("returns false when MARKETPLACE experiment is not present", () => {
88-
const experiments: Record<ExperimentId, boolean> = {
89-
powerSteering: false,
90-
// marketplace missing
91-
} as any
92-
expect(Experiments.isEnabled(experiments, EXPERIMENT_IDS.MARKETPLACE)).toBe(false)
93-
})
94-
})
9554
})

src/shared/experiments.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { AssertEqual, Equals, Keys, Values, ExperimentId, Experiments } from "@roo-code/types"
22

33
export const EXPERIMENT_IDS = {
4-
MARKETPLACE: "marketplace",
54
MULTI_FILE_APPLY_DIFF: "multiFileApplyDiff",
65
DISABLE_COMPLETION_COMMAND: "disableCompletionCommand",
76
POWER_STEERING: "powerSteering",
@@ -16,7 +15,6 @@ interface ExperimentConfig {
1615
}
1716

1817
export const experimentConfigsMap: Record<ExperimentKey, ExperimentConfig> = {
19-
MARKETPLACE: { enabled: false },
2018
MULTI_FILE_APPLY_DIFF: { enabled: false },
2119
DISABLE_COMPLETION_COMMAND: { enabled: false },
2220
POWER_STEERING: { enabled: false },

webview-ui/src/App.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const App = () => {
4040
telemetrySetting,
4141
telemetryKey,
4242
machineId,
43-
experiments,
4443
cloudUserInfo,
4544
cloudIsAuthenticated,
4645
mdmCompliant,
@@ -93,10 +92,6 @@ const App = () => {
9392
// Handle switchTab action with tab parameter
9493
if (message.action === "switchTab" && message.tab) {
9594
const targetTab = message.tab as Tab
96-
// Don't switch to marketplace tab if the experiment is disabled
97-
if (targetTab === "marketplace" && !experiments.marketplace) {
98-
return
99-
}
10095
switchTab(targetTab)
10196
setCurrentSection(undefined)
10297
} else {
@@ -105,10 +100,6 @@ const App = () => {
105100
const section = message.values?.section as string | undefined
106101

107102
if (newTab) {
108-
// Don't switch to marketplace tab if the experiment is disabled
109-
if (newTab === "marketplace" && !experiments.marketplace) {
110-
return
111-
}
112103
switchTab(newTab)
113104
setCurrentSection(section)
114105
}
@@ -124,7 +115,7 @@ const App = () => {
124115
chatViewRef.current?.acceptInput()
125116
}
126117
},
127-
[switchTab, experiments],
118+
[switchTab],
128119
)
129120

130121
useEvent("message", onMessage)
@@ -147,10 +138,10 @@ const App = () => {
147138

148139
// Track marketplace tab views
149140
useEffect(() => {
150-
if (tab === "marketplace" && experiments.marketplace) {
141+
if (tab === "marketplace") {
151142
telemetryClient.capture(TelemetryEventName.MARKETPLACE_TAB_VIEWED)
152143
}
153-
}, [tab, experiments.marketplace])
144+
}, [tab])
154145

155146
if (!didHydrateState) {
156147
return null

0 commit comments

Comments
 (0)