@quonfig/cli 0.0.11 → 0.0.13
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/README.md +214 -30
- package/dist/codegen/json-schema-to-zod.js +7 -5
- package/dist/codegen/language-mappers/zod-base-mapper.d.ts +2 -2
- package/dist/codegen/language-mappers/zod-to-string-mapper.d.ts +2 -2
- package/dist/codegen/language-mappers/zod-to-string-mapper.js +6 -6
- package/dist/codegen/language-mappers/zod-to-typescript-mapper.d.ts +2 -2
- package/dist/codegen/language-mappers/zod-to-typescript-mapper.js +6 -6
- package/dist/codegen/language-mappers/zod-to-typescript-return-value-mapper.d.ts +2 -2
- package/dist/codegen/language-mappers/zod-to-typescript-return-value-mapper.js +5 -5
- package/dist/codegen/local-config-reader.js +0 -1
- package/dist/codegen/schema-extractor.js +5 -2
- package/dist/commands/info.js +4 -1
- package/dist/commands/init.js +12 -2
- package/dist/commands/interactive.d.ts +1 -0
- package/dist/commands/interactive.js +8 -0
- package/dist/commands/login.js +9 -3
- package/dist/commands/migrate/doctor.d.ts +12 -0
- package/dist/commands/migrate/doctor.js +63 -0
- package/dist/commands/migrate/my-code.d.ts +11 -0
- package/dist/commands/migrate/my-code.js +80 -0
- package/dist/commands/migrate/status.d.ts +10 -0
- package/dist/commands/migrate/status.js +99 -0
- package/dist/commands/migrate.d.ts +20 -0
- package/dist/commands/migrate.js +277 -0
- package/dist/commands/override.js +6 -3
- package/dist/commands/profile.d.ts +1 -1
- package/dist/commands/profile.js +1 -1
- package/dist/commands/pull.d.ts +2 -2
- package/dist/commands/pull.js +38 -41
- package/dist/commands/schema.d.ts +3 -3
- package/dist/commands/schema.js +37 -37
- package/dist/commands/sdk-key/create.js +12 -14
- package/dist/commands/sdk-key/revoke.d.ts +1 -1
- package/dist/commands/sdk-key/revoke.js +2 -4
- package/dist/commands/set-default.js +7 -5
- package/dist/commands/set-rollout.d.ts +1 -1
- package/dist/commands/set-rollout.js +16 -13
- package/dist/commands/sync.d.ts +3 -3
- package/dist/commands/sync.js +30 -26
- package/dist/commands/whoami.js +1 -5
- package/dist/commands/workspace/bootstrap.js +7 -7
- package/dist/commands/workspace/switch.js +2 -2
- package/dist/init/init-workspace.d.ts +2 -2
- package/dist/init/init-workspace.js +32 -18
- package/dist/init/samples.d.ts +1 -1
- package/dist/init/samples.js +2 -2
- package/dist/init/schema.js +24 -15
- package/dist/interactive-prompt.js +1 -10
- package/dist/migrate/doctor.d.ts +27 -0
- package/dist/migrate/doctor.js +222 -0
- package/dist/migrate/identifier-map.d.ts +14 -0
- package/dist/migrate/identifier-map.js +55 -0
- package/dist/migrate/import-state.d.ts +14 -0
- package/dist/migrate/import-state.js +60 -0
- package/dist/migrate/local-write.d.ts +26 -0
- package/dist/migrate/local-write.js +85 -0
- package/dist/migrate/migration-report.d.ts +42 -0
- package/dist/migrate/migration-report.js +85 -0
- package/dist/migrate/push-strategy.d.ts +34 -0
- package/dist/migrate/push-strategy.js +127 -0
- package/dist/migrate/push-to-cloud.d.ts +15 -0
- package/dist/migrate/push-to-cloud.js +31 -0
- package/dist/migrate/registry.d.ts +6 -0
- package/dist/migrate/registry.js +25 -0
- package/dist/migrate/source.d.ts +22 -0
- package/dist/migrate/source.js +12 -0
- package/dist/migrate/sources/flagsmith.d.ts +2 -0
- package/dist/migrate/sources/flagsmith.js +28 -0
- package/dist/migrate/sources/launch/api.d.ts +7 -0
- package/dist/migrate/sources/launch/api.js +75 -0
- package/dist/migrate/sources/launch/translate.d.ts +6 -0
- package/dist/migrate/sources/launch/translate.js +190 -0
- package/dist/migrate/sources/launch/types.d.ts +68 -0
- package/dist/migrate/sources/launch/types.js +1 -0
- package/dist/migrate/sources/launch.d.ts +3 -0
- package/dist/migrate/sources/launch.js +70 -0
- package/dist/migrate/sources/launchdarkly.d.ts +2 -0
- package/dist/migrate/sources/launchdarkly.js +18 -0
- package/dist/quonfig.d.ts +1 -1
- package/dist/quonfig.js +5 -9
- package/dist/ui/get-confirmation.d.ts +2 -1
- package/dist/ui/get-confirmation.js +9 -1
- package/dist/ui/get-value.d.ts +1 -1
- package/dist/ui/get-value.js +4 -3
- package/dist/util/config-value-dto.js +17 -1
- package/dist/util/encryption.js +4 -1
- package/dist/util/friction-log.d.ts +1 -1
- package/dist/util/friction-log.js +5 -1
- package/dist/util/get-client.js +51 -3
- package/dist/util/get-valid-token.d.ts +4 -0
- package/dist/util/get-valid-token.js +17 -2
- package/dist/util/git-ops.js +7 -7
- package/dist/util/gitea-api.d.ts +2 -2
- package/dist/util/gitea-api.js +5 -3
- package/dist/util/gitea-token-storage.d.ts +2 -2
- package/dist/util/gitea-token-storage.js +1 -1
- package/dist/util/is-interactive.d.ts +21 -1
- package/dist/util/is-interactive.js +21 -1
- package/dist/util/oauth-client.js +1 -1
- package/dist/util/token-storage.js +2 -2
- package/dist/verify/standalone.d.ts +0 -1
- package/dist/verify/standalone.js +22 -23
- package/dist/verify/validate.d.ts +8 -8
- package/dist/verify/validate.js +256 -245
- package/oclif.manifest.json +365 -3
- package/package.json +6 -6
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
/**
|
|
3
2
|
* Standalone workspace validator.
|
|
4
3
|
*
|
|
@@ -11,19 +10,19 @@
|
|
|
11
10
|
* 0 All checks pass
|
|
12
11
|
* 1 Validation errors found
|
|
13
12
|
*/
|
|
14
|
-
import { execSync } from
|
|
15
|
-
import * as readline from
|
|
16
|
-
import { formatResult, validateFileMap, validateWorkspace } from
|
|
13
|
+
import { execSync } from 'node:child_process';
|
|
14
|
+
import * as readline from 'node:readline';
|
|
15
|
+
import { formatResult, validateFileMap, validateWorkspace } from './validate.js';
|
|
17
16
|
async function main() {
|
|
18
17
|
const args = process.argv.slice(2);
|
|
19
|
-
if (args.includes(
|
|
18
|
+
if (args.includes('--git-hook')) {
|
|
20
19
|
await runGitHook();
|
|
21
20
|
}
|
|
22
|
-
else if (args.includes(
|
|
21
|
+
else if (args.includes('--help') || args.includes('-h')) {
|
|
23
22
|
printUsage();
|
|
24
23
|
}
|
|
25
24
|
else {
|
|
26
|
-
const dir = args[0] ||
|
|
25
|
+
const dir = args[0] || '.';
|
|
27
26
|
runDiskValidation(dir);
|
|
28
27
|
}
|
|
29
28
|
}
|
|
@@ -55,23 +54,23 @@ async function runGitHook() {
|
|
|
55
54
|
// Read all of stdin (ref lines). Use callback API for bun compatibility.
|
|
56
55
|
await new Promise((resolve) => {
|
|
57
56
|
const rl = readline.createInterface({ input: process.stdin });
|
|
58
|
-
rl.on(
|
|
59
|
-
const parts = line.trim().split(
|
|
57
|
+
rl.on('line', (line) => {
|
|
58
|
+
const parts = line.trim().split(' ');
|
|
60
59
|
if (parts.length >= 3) {
|
|
61
60
|
refs.push({ oldOid: parts[0], newOid: parts[1], refName: parts[2] });
|
|
62
61
|
}
|
|
63
62
|
});
|
|
64
|
-
rl.on(
|
|
63
|
+
rl.on('close', resolve);
|
|
65
64
|
});
|
|
66
65
|
if (refs.length === 0) {
|
|
67
|
-
console.log(
|
|
66
|
+
console.log('qfg-verify: no refs received');
|
|
68
67
|
process.exit(0);
|
|
69
68
|
}
|
|
70
69
|
// Validate the latest pushed commit for each ref
|
|
71
70
|
let hasErrors = false;
|
|
72
71
|
for (const ref of refs) {
|
|
73
72
|
// Skip deletions
|
|
74
|
-
if (ref.newOid ===
|
|
73
|
+
if (ref.newOid === '0000000000000000000000000000000000000000')
|
|
75
74
|
continue;
|
|
76
75
|
console.log(`qfg-verify: validating ${ref.refName} (${ref.newOid.slice(0, 8)})`);
|
|
77
76
|
try {
|
|
@@ -82,8 +81,8 @@ async function runGitHook() {
|
|
|
82
81
|
hasErrors = true;
|
|
83
82
|
}
|
|
84
83
|
}
|
|
85
|
-
catch (
|
|
86
|
-
console.error(`qfg-verify: error reading commit ${ref.newOid}: ${
|
|
84
|
+
catch (error) {
|
|
85
|
+
console.error(`qfg-verify: error reading commit ${ref.newOid}: ${error.message}`);
|
|
87
86
|
hasErrors = true;
|
|
88
87
|
}
|
|
89
88
|
}
|
|
@@ -95,28 +94,28 @@ async function runGitHook() {
|
|
|
95
94
|
*/
|
|
96
95
|
function readFilesFromCommit(commitOid) {
|
|
97
96
|
const files = new Map();
|
|
98
|
-
const dirs = [
|
|
97
|
+
const dirs = ['configs', 'feature-flags', 'segments', 'log-levels', 'schemas', 'schemas-protected'];
|
|
99
98
|
for (const dir of dirs) {
|
|
100
99
|
// List files in this directory at the given commit
|
|
101
100
|
let listing;
|
|
102
101
|
try {
|
|
103
102
|
listing = execSync(`git ls-tree --name-only ${commitOid} ${dir}/`, {
|
|
104
|
-
encoding:
|
|
105
|
-
stdio: [
|
|
103
|
+
encoding: 'utf8',
|
|
104
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
106
105
|
});
|
|
107
106
|
}
|
|
108
107
|
catch {
|
|
109
108
|
// Directory doesn't exist in this commit
|
|
110
109
|
continue;
|
|
111
110
|
}
|
|
112
|
-
const filenames = listing.trim().split(
|
|
111
|
+
const filenames = listing.trim().split('\n').filter(Boolean);
|
|
113
112
|
for (const filePath of filenames) {
|
|
114
|
-
if (!filePath.endsWith(
|
|
113
|
+
if (!filePath.endsWith('.json') || filePath.includes('/.'))
|
|
115
114
|
continue;
|
|
116
115
|
try {
|
|
117
116
|
const content = execSync(`git show ${commitOid}:${filePath}`, {
|
|
118
|
-
encoding:
|
|
119
|
-
stdio: [
|
|
117
|
+
encoding: 'utf8',
|
|
118
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
120
119
|
});
|
|
121
120
|
files.set(filePath, content);
|
|
122
121
|
}
|
|
@@ -127,7 +126,7 @@ function readFilesFromCommit(commitOid) {
|
|
|
127
126
|
}
|
|
128
127
|
return files;
|
|
129
128
|
}
|
|
130
|
-
main().catch((
|
|
131
|
-
console.error(`qfg-verify: fatal: ${
|
|
129
|
+
main().catch((error) => {
|
|
130
|
+
console.error(`qfg-verify: fatal: ${error.message}`);
|
|
132
131
|
process.exit(1);
|
|
133
132
|
});
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* - Value type consistency
|
|
20
20
|
* - Weighted values non-empty and consistent
|
|
21
21
|
*/
|
|
22
|
-
export type Severity =
|
|
22
|
+
export type Severity = 'error' | 'warning';
|
|
23
23
|
export interface ValidationIssue {
|
|
24
24
|
file: string;
|
|
25
25
|
message: string;
|
|
@@ -28,22 +28,22 @@ export interface ValidationIssue {
|
|
|
28
28
|
}
|
|
29
29
|
export interface ValidationStats {
|
|
30
30
|
configs: number;
|
|
31
|
+
envRefsChecked: number;
|
|
32
|
+
environmentOverrides: number;
|
|
31
33
|
featureFlags: number;
|
|
32
|
-
segments: number;
|
|
33
34
|
logLevels: number;
|
|
34
|
-
schemas: number;
|
|
35
|
-
environmentOverrides: number;
|
|
36
35
|
rules: number;
|
|
37
|
-
segmentRefsChecked: number;
|
|
38
36
|
schemaRefsChecked: number;
|
|
39
|
-
|
|
37
|
+
schemas: number;
|
|
38
|
+
segmentRefsChecked: number;
|
|
39
|
+
segments: number;
|
|
40
40
|
uniqueKeysVerified: number;
|
|
41
41
|
}
|
|
42
42
|
export interface ValidationResult {
|
|
43
|
-
issues: ValidationIssue[];
|
|
44
43
|
filesChecked: number;
|
|
45
|
-
|
|
44
|
+
issues: ValidationIssue[];
|
|
46
45
|
stats: ValidationStats;
|
|
46
|
+
valid: boolean;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Validate an entire workspace directory on disk.
|