@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.
Files changed (106) hide show
  1. package/README.md +214 -30
  2. package/dist/codegen/json-schema-to-zod.js +7 -5
  3. package/dist/codegen/language-mappers/zod-base-mapper.d.ts +2 -2
  4. package/dist/codegen/language-mappers/zod-to-string-mapper.d.ts +2 -2
  5. package/dist/codegen/language-mappers/zod-to-string-mapper.js +6 -6
  6. package/dist/codegen/language-mappers/zod-to-typescript-mapper.d.ts +2 -2
  7. package/dist/codegen/language-mappers/zod-to-typescript-mapper.js +6 -6
  8. package/dist/codegen/language-mappers/zod-to-typescript-return-value-mapper.d.ts +2 -2
  9. package/dist/codegen/language-mappers/zod-to-typescript-return-value-mapper.js +5 -5
  10. package/dist/codegen/local-config-reader.js +0 -1
  11. package/dist/codegen/schema-extractor.js +5 -2
  12. package/dist/commands/info.js +4 -1
  13. package/dist/commands/init.js +12 -2
  14. package/dist/commands/interactive.d.ts +1 -0
  15. package/dist/commands/interactive.js +8 -0
  16. package/dist/commands/login.js +9 -3
  17. package/dist/commands/migrate/doctor.d.ts +12 -0
  18. package/dist/commands/migrate/doctor.js +63 -0
  19. package/dist/commands/migrate/my-code.d.ts +11 -0
  20. package/dist/commands/migrate/my-code.js +80 -0
  21. package/dist/commands/migrate/status.d.ts +10 -0
  22. package/dist/commands/migrate/status.js +99 -0
  23. package/dist/commands/migrate.d.ts +20 -0
  24. package/dist/commands/migrate.js +277 -0
  25. package/dist/commands/override.js +6 -3
  26. package/dist/commands/profile.d.ts +1 -1
  27. package/dist/commands/profile.js +1 -1
  28. package/dist/commands/pull.d.ts +2 -2
  29. package/dist/commands/pull.js +38 -41
  30. package/dist/commands/schema.d.ts +3 -3
  31. package/dist/commands/schema.js +37 -37
  32. package/dist/commands/sdk-key/create.js +12 -14
  33. package/dist/commands/sdk-key/revoke.d.ts +1 -1
  34. package/dist/commands/sdk-key/revoke.js +2 -4
  35. package/dist/commands/set-default.js +7 -5
  36. package/dist/commands/set-rollout.d.ts +1 -1
  37. package/dist/commands/set-rollout.js +16 -13
  38. package/dist/commands/sync.d.ts +3 -3
  39. package/dist/commands/sync.js +30 -26
  40. package/dist/commands/whoami.js +1 -5
  41. package/dist/commands/workspace/bootstrap.js +7 -7
  42. package/dist/commands/workspace/switch.js +2 -2
  43. package/dist/init/init-workspace.d.ts +2 -2
  44. package/dist/init/init-workspace.js +32 -18
  45. package/dist/init/samples.d.ts +1 -1
  46. package/dist/init/samples.js +2 -2
  47. package/dist/init/schema.js +24 -15
  48. package/dist/interactive-prompt.js +1 -10
  49. package/dist/migrate/doctor.d.ts +27 -0
  50. package/dist/migrate/doctor.js +222 -0
  51. package/dist/migrate/identifier-map.d.ts +14 -0
  52. package/dist/migrate/identifier-map.js +55 -0
  53. package/dist/migrate/import-state.d.ts +14 -0
  54. package/dist/migrate/import-state.js +60 -0
  55. package/dist/migrate/local-write.d.ts +26 -0
  56. package/dist/migrate/local-write.js +85 -0
  57. package/dist/migrate/migration-report.d.ts +42 -0
  58. package/dist/migrate/migration-report.js +85 -0
  59. package/dist/migrate/push-strategy.d.ts +34 -0
  60. package/dist/migrate/push-strategy.js +127 -0
  61. package/dist/migrate/push-to-cloud.d.ts +15 -0
  62. package/dist/migrate/push-to-cloud.js +31 -0
  63. package/dist/migrate/registry.d.ts +6 -0
  64. package/dist/migrate/registry.js +25 -0
  65. package/dist/migrate/source.d.ts +22 -0
  66. package/dist/migrate/source.js +12 -0
  67. package/dist/migrate/sources/flagsmith.d.ts +2 -0
  68. package/dist/migrate/sources/flagsmith.js +28 -0
  69. package/dist/migrate/sources/launch/api.d.ts +7 -0
  70. package/dist/migrate/sources/launch/api.js +75 -0
  71. package/dist/migrate/sources/launch/translate.d.ts +6 -0
  72. package/dist/migrate/sources/launch/translate.js +190 -0
  73. package/dist/migrate/sources/launch/types.d.ts +68 -0
  74. package/dist/migrate/sources/launch/types.js +1 -0
  75. package/dist/migrate/sources/launch.d.ts +3 -0
  76. package/dist/migrate/sources/launch.js +70 -0
  77. package/dist/migrate/sources/launchdarkly.d.ts +2 -0
  78. package/dist/migrate/sources/launchdarkly.js +18 -0
  79. package/dist/quonfig.d.ts +1 -1
  80. package/dist/quonfig.js +5 -9
  81. package/dist/ui/get-confirmation.d.ts +2 -1
  82. package/dist/ui/get-confirmation.js +9 -1
  83. package/dist/ui/get-value.d.ts +1 -1
  84. package/dist/ui/get-value.js +4 -3
  85. package/dist/util/config-value-dto.js +17 -1
  86. package/dist/util/encryption.js +4 -1
  87. package/dist/util/friction-log.d.ts +1 -1
  88. package/dist/util/friction-log.js +5 -1
  89. package/dist/util/get-client.js +51 -3
  90. package/dist/util/get-valid-token.d.ts +4 -0
  91. package/dist/util/get-valid-token.js +17 -2
  92. package/dist/util/git-ops.js +7 -7
  93. package/dist/util/gitea-api.d.ts +2 -2
  94. package/dist/util/gitea-api.js +5 -3
  95. package/dist/util/gitea-token-storage.d.ts +2 -2
  96. package/dist/util/gitea-token-storage.js +1 -1
  97. package/dist/util/is-interactive.d.ts +21 -1
  98. package/dist/util/is-interactive.js +21 -1
  99. package/dist/util/oauth-client.js +1 -1
  100. package/dist/util/token-storage.js +2 -2
  101. package/dist/verify/standalone.d.ts +0 -1
  102. package/dist/verify/standalone.js +22 -23
  103. package/dist/verify/validate.d.ts +8 -8
  104. package/dist/verify/validate.js +256 -245
  105. package/oclif.manifest.json +365 -3
  106. 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 "node:child_process";
15
- import * as readline from "node:readline";
16
- import { formatResult, validateFileMap, validateWorkspace } from "./validate.js";
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("--git-hook")) {
18
+ if (args.includes('--git-hook')) {
20
19
  await runGitHook();
21
20
  }
22
- else if (args.includes("--help") || args.includes("-h")) {
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("line", (line) => {
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("close", resolve);
63
+ rl.on('close', resolve);
65
64
  });
66
65
  if (refs.length === 0) {
67
- console.log("qfg-verify: no refs received");
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 === "0000000000000000000000000000000000000000")
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 (err) {
86
- console.error(`qfg-verify: error reading commit ${ref.newOid}: ${err.message}`);
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 = ["configs", "feature-flags", "segments", "log-levels", "schemas", "schemas-protected"];
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: "utf-8",
105
- stdio: ["pipe", "pipe", "pipe"],
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("\n").filter(Boolean);
111
+ const filenames = listing.trim().split('\n').filter(Boolean);
113
112
  for (const filePath of filenames) {
114
- if (!filePath.endsWith(".json") || filePath.includes("/."))
113
+ if (!filePath.endsWith('.json') || filePath.includes('/.'))
115
114
  continue;
116
115
  try {
117
116
  const content = execSync(`git show ${commitOid}:${filePath}`, {
118
- encoding: "utf-8",
119
- stdio: ["pipe", "pipe", "pipe"],
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((err) => {
131
- console.error(`qfg-verify: fatal: ${err.message}`);
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 = "error" | "warning";
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
- envRefsChecked: number;
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
- valid: boolean;
44
+ issues: ValidationIssue[];
46
45
  stats: ValidationStats;
46
+ valid: boolean;
47
47
  }
48
48
  /**
49
49
  * Validate an entire workspace directory on disk.