@nuucognition/cli-core 0.0.1-beta.1 → 0.0.1-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -3
- package/dist/index.js +5 -17
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -104,8 +104,6 @@ declare function hasFeature(registry: FeatureRegistry, id: string): boolean;
|
|
|
104
104
|
declare function isTierEnabled(featureTier: "prod" | "exp" | "dev", mode: RuntimeMode): boolean;
|
|
105
105
|
declare function resolveRuntime(config: ModeConfig): Promise<ResolvedRuntime>;
|
|
106
106
|
declare function resolveRuntimeSync(config: ModeConfig): ResolvedRuntime;
|
|
107
|
-
declare function setMode(config: ModeConfig, mode: RuntimeMode): Promise<void>;
|
|
108
|
-
declare function resetMode(config: ModeConfig): Promise<void>;
|
|
109
107
|
declare function setExperimental(config: ModeConfig, enabled: boolean): Promise<void>;
|
|
110
108
|
declare function resetExperimental(config: ModeConfig): Promise<void>;
|
|
111
109
|
declare function setFeatureEnabled(config: ModeConfig, featureId: string, enabled: boolean): Promise<void>;
|
|
@@ -155,4 +153,4 @@ declare class AuthRequiredError extends CliError {
|
|
|
155
153
|
constructor(featureId: string, cliname: string);
|
|
156
154
|
}
|
|
157
155
|
|
|
158
|
-
export { type AuthCommandFactoryConfig, type AuthEnvironment, AuthRequiredError, CliError, type ConfigOptions, type FeatureCheck, type FeatureContext, type FeatureDefinition, FeatureNotAvailableError, type FeatureRegistry, type FeatureTier, type FeatureType, type LoginConfig, type ModeConfig, NUU_ACCOUNT_URL_DEV, NUU_ACCOUNT_URL_PROD, type NuuCredentials, type ResolvedRuntime, type RuntimeMode, TIER_ALIASES, bold, checkFeature, clearAuth, createFeatureRegistry, createLoginCommand, createLogoutCommand, createWhoamiCommand, dim, ensureConfigDir, ensureConfigDirSync, ensureNuuDir, error, getCommandFeatures, getConfigDir, getConfigPath, getFeature, getFeaturesByTier, getFeaturesByType, getNuuDir, getValidAuth, hasAuth, hasFeature, info, isAuthExpired, isFeatureEnabled, isTierEnabled, isValidTier, loadAuth, loadAuthSync, normalizeRuntimeMode, normalizeTier, readConfigFile, readConfigFileSync, refreshAuth, removeConfigField, removeFeatureOverride, requireFeature, requireValidAuth, resetExperimental, resetFeatureEnabled,
|
|
156
|
+
export { type AuthCommandFactoryConfig, type AuthEnvironment, AuthRequiredError, CliError, type ConfigOptions, type FeatureCheck, type FeatureContext, type FeatureDefinition, FeatureNotAvailableError, type FeatureRegistry, type FeatureTier, type FeatureType, type LoginConfig, type ModeConfig, NUU_ACCOUNT_URL_DEV, NUU_ACCOUNT_URL_PROD, type NuuCredentials, type ResolvedRuntime, type RuntimeMode, TIER_ALIASES, bold, checkFeature, clearAuth, createFeatureRegistry, createLoginCommand, createLogoutCommand, createWhoamiCommand, dim, ensureConfigDir, ensureConfigDirSync, ensureNuuDir, error, getCommandFeatures, getConfigDir, getConfigPath, getFeature, getFeaturesByTier, getFeaturesByType, getNuuDir, getValidAuth, hasAuth, hasFeature, info, isAuthExpired, isFeatureEnabled, isTierEnabled, isValidTier, loadAuth, loadAuthSync, normalizeRuntimeMode, normalizeTier, readConfigFile, readConfigFileSync, refreshAuth, removeConfigField, removeFeatureOverride, requireFeature, requireValidAuth, resetExperimental, resetFeatureEnabled, resolveConfig, resolveConfigSync, resolveRuntime, resolveRuntimeSync, saveAuth, scopedEnvVar, scopedEnvVarTrue, setAuthVerbose, setConfigField, setExperimental, setFeatureEnabled, setFeatureOverride, shouldRefreshAuth, startLoginFlow, success, warn, writeConfigFile };
|
package/dist/index.js
CHANGED
|
@@ -130,7 +130,7 @@ async function removeFeatureOverride(path, featureId) {
|
|
|
130
130
|
// src/config/index.ts
|
|
131
131
|
var CONFIG_FILENAME = "config.toml";
|
|
132
132
|
function getConfigDir(cliname) {
|
|
133
|
-
return join(homedir(), ".nuucognition",
|
|
133
|
+
return join(homedir(), ".nuucognition", cliname);
|
|
134
134
|
}
|
|
135
135
|
function getConfigPath(cliname) {
|
|
136
136
|
return join(getConfigDir(cliname), CONFIG_FILENAME);
|
|
@@ -638,10 +638,6 @@ function isTierEnabled(featureTier, mode) {
|
|
|
638
638
|
if (featureTier === "exp") return false;
|
|
639
639
|
return false;
|
|
640
640
|
}
|
|
641
|
-
function resolveModeFromRecord(record) {
|
|
642
|
-
const raw = record.mode;
|
|
643
|
-
return typeof raw === "string" ? normalizeRuntimeMode(raw) : void 0;
|
|
644
|
-
}
|
|
645
641
|
function resolveExperimentalFromRecord(record) {
|
|
646
642
|
const raw = record.experimental;
|
|
647
643
|
return typeof raw === "boolean" ? raw : void 0;
|
|
@@ -652,11 +648,11 @@ function resolveEnabledFeaturesFromRecord(record) {
|
|
|
652
648
|
}
|
|
653
649
|
return Object.entries(record.features).filter(([, enabled]) => enabled === true).map(([featureId]) => featureId);
|
|
654
650
|
}
|
|
655
|
-
function
|
|
651
|
+
function getBuildMode() {
|
|
656
652
|
return normalizeRuntimeMode(process.env.BUILD_MODE ?? "") ?? "dev";
|
|
657
653
|
}
|
|
658
|
-
function readRuntimeSync(
|
|
659
|
-
const mode =
|
|
654
|
+
function readRuntimeSync(_config, resolvedConfig) {
|
|
655
|
+
const mode = getBuildMode();
|
|
660
656
|
const configExperimental = resolveExperimentalFromRecord(resolvedConfig);
|
|
661
657
|
const experimental = mode === "dev" ? true : configExperimental ?? false;
|
|
662
658
|
const enabledFeatures = resolveEnabledFeaturesFromRecord(resolvedConfig);
|
|
@@ -676,12 +672,6 @@ function resolveRuntimeSync(config) {
|
|
|
676
672
|
const resolvedConfig = resolveConfigSync({ cliname: config.cliname });
|
|
677
673
|
return readRuntimeSync(config, resolvedConfig);
|
|
678
674
|
}
|
|
679
|
-
async function setMode(config, mode) {
|
|
680
|
-
await setConfigField(getConfigPath(config.cliname), "mode", mode);
|
|
681
|
-
}
|
|
682
|
-
async function resetMode(config) {
|
|
683
|
-
await removeConfigField(getConfigPath(config.cliname), "mode");
|
|
684
|
-
}
|
|
685
675
|
async function setExperimental(config, enabled) {
|
|
686
676
|
await setConfigField(getConfigPath(config.cliname), "experimental", enabled);
|
|
687
677
|
}
|
|
@@ -719,7 +709,7 @@ function tierInstruction(requiredTier, cliname, featureId) {
|
|
|
719
709
|
}
|
|
720
710
|
return [
|
|
721
711
|
`Run \`${cliname} --enable ${featureId}\` for one invocation`,
|
|
722
|
-
`or set \`[features].${featureId} = true\` in \`~/.nuucognition
|
|
712
|
+
`or set \`[features].${featureId} = true\` in \`~/.nuucognition/${cliname}/config.toml\`.`
|
|
723
713
|
];
|
|
724
714
|
}
|
|
725
715
|
var FeatureNotAvailableError = class extends CliError {
|
|
@@ -993,7 +983,6 @@ export {
|
|
|
993
983
|
requireValidAuth,
|
|
994
984
|
resetExperimental,
|
|
995
985
|
resetFeatureEnabled,
|
|
996
|
-
resetMode,
|
|
997
986
|
resolveConfig,
|
|
998
987
|
resolveConfigSync,
|
|
999
988
|
resolveRuntime,
|
|
@@ -1006,7 +995,6 @@ export {
|
|
|
1006
995
|
setExperimental,
|
|
1007
996
|
setFeatureEnabled,
|
|
1008
997
|
setFeatureOverride,
|
|
1009
|
-
setMode,
|
|
1010
998
|
shouldRefreshAuth,
|
|
1011
999
|
startLoginFlow,
|
|
1012
1000
|
success,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuucognition/cli-core",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.3",
|
|
4
4
|
"description": "Shared CLI infrastructure for the NUU ecosystem",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"eslint": "^9.32.0",
|
|
34
34
|
"tsup": "^8.3.5",
|
|
35
35
|
"typescript": "^5.9.2",
|
|
36
|
-
"@nuucognition/
|
|
37
|
-
"@nuucognition/
|
|
36
|
+
"@nuucognition/eslint-config": "0.0.0",
|
|
37
|
+
"@nuucognition/typescript-config": "0.0.0"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "tsup",
|