-
Notifications
You must be signed in to change notification settings - Fork 118
Feature Flags
Jace Roell edited this page Apr 30, 2026
·
4 revisions
The Feature Flags system provides a way to manage feature toggles and configuration options in Zowe Explorer extensions.
Import the Feature Flags from the Zowe Explorer API:
import { FeatureFlags, FeatureFlagsAccess, FlagAccessLevel } from "@zowe/zowe-explorer-api";// Set a flag (memory only)
await FeatureFlags.set("enableNewUI", true);
// Set a flag and save to disk
await FeatureFlags.set("maxRetries", 5, true);
// Get a flag value
const isEnabled = FeatureFlags.get("enableNewUI");
const maxRetries = FeatureFlags.get("maxRetries") || 3; // with default// Boolean
await FeatureFlags.set("enableFeature", true);
// String
await FeatureFlags.set("apiEndpoint", "https://api.example.com");
// Number
await FeatureFlags.set("timeout", 30000);
// Object
await FeatureFlags.set("config", {
retries: 3,
timeout: 5000,
});FeatureFlags.remove("obsoleteFeature");The FeatureFlagsAccess class provides permission-based access to flags.
enum FlagAccessLevel {
None = 0,
Read = 1 << 0,
Write = 1 << 1,
}// Get with permission check
try {
const value = FeatureFlagsAccess.get("fetchByDefault");
} catch (error) {
console.error("Access denied:", error.message);
}
// Set with permission check
try {
await FeatureFlagsAccess.set("fetchByDefault", false, true);
} catch (error) {
console.error("Write access denied:", error.message);
}
// List available keys
const readableKeys = FeatureFlagsAccess.getReadableKeys();
const writableKeys = FeatureFlagsAccess.getWritableKeys();Flags are stored in feature-flags.json:
{
"enableNewUI": true,
"maxRetries": 5,
"apiEndpoint": "https://api.example.com"
}Persistence options:
-
save: false(default) - Memory only -
save: true- Immediate disk write, persistent across restarts
export async function activate(context: vscode.ExtensionContext) {
await FeatureFlags.init();
const enableAdvanced = FeatureFlags.get("advancedMode") || false;
if (enableAdvanced) {
// Initialize advanced features
}
}class MyExtension {
renderUI() {
const useNewUI = FeatureFlags.get("enableNewUI") === true;
return useNewUI ? this.renderNewUI() : this.renderLegacyUI();
}
}class Config {
static get() {
return {
maxRetries: FeatureFlags.get("maxRetries") ?? 3,
timeout: FeatureFlags.get("timeout") ?? 30000,
enableLogging: FeatureFlags.get("enableLogging") ?? false,
};
}
}zowe/vscode-extension-for-zowe
Welcome
Using Zowe Explorer
Roadmaps
- 2025 Zowe Explorer Roadmap
- 2024 Zowe Explorer Roadmap
- 2023 Zowe Explorer Roadmap
- 2022 Zowe Explorer Roadmap
Development Process
- Contributor Guidance
- Developer Setup
- Developer Reference
- Developing for Theia
- File Save Flow
- Menu Commands
Testing Process
Release Process
Backlog Grooming Process
How to Extend Zowe Explorer
- Extending Zowe Explorer
- Using Zowe Explorer Local Storage
- Error Handling for Extenders
- Secure Credentials for Extenders
- Sample Extender Repositories
Conformance Criteria
v3 Features and Information