@flagshark/core 1.3.0 → 1.4.0

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 (157) hide show
  1. package/README.md +124 -18
  2. package/dist/config/excluder.d.ts.map +1 -1
  3. package/dist/config/excluder.js +1 -0
  4. package/dist/config/excluder.js.map +1 -1
  5. package/dist/config/loader.js +1 -0
  6. package/dist/config/loader.js.map +1 -1
  7. package/dist/config/schema.d.ts +25 -12
  8. package/dist/config/schema.d.ts.map +1 -1
  9. package/dist/config/schema.js +1 -0
  10. package/dist/config/schema.js.map +1 -1
  11. package/dist/detection/detectors/cpp.d.ts.map +1 -1
  12. package/dist/detection/detectors/cpp.js +6 -2
  13. package/dist/detection/detectors/cpp.js.map +1 -1
  14. package/dist/detection/detectors/go.d.ts +2 -2
  15. package/dist/detection/detectors/go.d.ts.map +1 -1
  16. package/dist/detection/detectors/javascript.d.ts +2 -2
  17. package/dist/detection/detectors/javascript.d.ts.map +1 -1
  18. package/dist/detection/detectors/javascript.js +6 -2
  19. package/dist/detection/detectors/javascript.js.map +1 -1
  20. package/dist/detection/detectors/php.d.ts.map +1 -1
  21. package/dist/detection/detectors/php.js +6 -2
  22. package/dist/detection/detectors/php.js.map +1 -1
  23. package/dist/detection/detectors/python.d.ts +2 -2
  24. package/dist/detection/detectors/python.d.ts.map +1 -1
  25. package/dist/detection/detectors/python.js +6 -2
  26. package/dist/detection/detectors/python.js.map +1 -1
  27. package/dist/detection/detectors/ruby.d.ts.map +1 -1
  28. package/dist/detection/detectors/ruby.js +7 -4
  29. package/dist/detection/detectors/ruby.js.map +1 -1
  30. package/dist/detection/detectors/typescript.d.ts +2 -2
  31. package/dist/detection/detectors/typescript.d.ts.map +1 -1
  32. package/dist/detection/detectors/typescript.js +6 -2
  33. package/dist/detection/detectors/typescript.js.map +1 -1
  34. package/dist/detection/feature-flag.d.ts.map +1 -1
  35. package/dist/detection/helpers.d.ts.map +1 -1
  36. package/dist/detection/helpers.js +11 -1
  37. package/dist/detection/helpers.js.map +1 -1
  38. package/dist/detection/index.d.ts +1 -1
  39. package/dist/detection/index.d.ts.map +1 -1
  40. package/dist/detection/interface.d.ts +2 -0
  41. package/dist/detection/interface.d.ts.map +1 -1
  42. package/dist/detection/polyglot-analyzer.d.ts.map +1 -1
  43. package/dist/detection/polyglot-analyzer.js +50 -0
  44. package/dist/detection/polyglot-analyzer.js.map +1 -1
  45. package/dist/detection/tree-sitter/const-resolver.d.ts.map +1 -1
  46. package/dist/detection/tree-sitter/const-resolver.js +2 -2
  47. package/dist/detection/tree-sitter/const-resolver.js.map +1 -1
  48. package/dist/detection/tree-sitter/engine.d.ts.map +1 -1
  49. package/dist/detection/tree-sitter/engine.js +2 -14
  50. package/dist/detection/tree-sitter/engine.js.map +1 -1
  51. package/dist/detection/tree-sitter/module-url.d.ts +25 -0
  52. package/dist/detection/tree-sitter/module-url.d.ts.map +1 -0
  53. package/dist/detection/tree-sitter/module-url.js +38 -0
  54. package/dist/detection/tree-sitter/module-url.js.map +1 -0
  55. package/dist/detection/tree-sitter/parser-cache.d.ts +4 -0
  56. package/dist/detection/tree-sitter/parser-cache.d.ts.map +1 -1
  57. package/dist/detection/tree-sitter/parser-cache.js +30 -6
  58. package/dist/detection/tree-sitter/parser-cache.js.map +1 -1
  59. package/dist/detection/tree-sitter/queries-inline.d.ts +13 -0
  60. package/dist/detection/tree-sitter/queries-inline.d.ts.map +1 -0
  61. package/dist/detection/tree-sitter/queries-inline.js +17 -0
  62. package/dist/detection/tree-sitter/queries-inline.js.map +1 -0
  63. package/dist/detection/tree-sitter/query-runner.d.ts +14 -1
  64. package/dist/detection/tree-sitter/query-runner.d.ts.map +1 -1
  65. package/dist/detection/tree-sitter/query-runner.js +28 -11
  66. package/dist/detection/tree-sitter/query-runner.js.map +1 -1
  67. package/dist/detection/yaml-config.js +2 -2
  68. package/dist/detection/yaml-config.js.map +1 -1
  69. package/dist/index.d.ts +2 -0
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +4 -0
  72. package/dist/index.js.map +1 -1
  73. package/dist/output/csv.d.ts +9 -0
  74. package/dist/output/csv.d.ts.map +1 -0
  75. package/dist/output/csv.js +31 -0
  76. package/dist/output/csv.js.map +1 -0
  77. package/dist/output/index.d.ts +8 -0
  78. package/dist/output/index.d.ts.map +1 -0
  79. package/dist/output/index.js +8 -0
  80. package/dist/output/index.js.map +1 -0
  81. package/dist/output/json.d.ts +13 -0
  82. package/dist/output/json.d.ts.map +1 -0
  83. package/dist/output/json.js +43 -0
  84. package/dist/output/json.js.map +1 -0
  85. package/dist/output/markdown.d.ts +23 -0
  86. package/dist/output/markdown.d.ts.map +1 -0
  87. package/dist/output/markdown.js +94 -0
  88. package/dist/output/markdown.js.map +1 -0
  89. package/dist/output/sarif.d.ts +16 -0
  90. package/dist/output/sarif.d.ts.map +1 -0
  91. package/dist/output/sarif.js +104 -0
  92. package/dist/output/sarif.js.map +1 -0
  93. package/dist/output/select.d.ts +23 -0
  94. package/dist/output/select.d.ts.map +1 -0
  95. package/dist/output/select.js +36 -0
  96. package/dist/output/select.js.map +1 -0
  97. package/dist/output/shared.d.ts +13 -0
  98. package/dist/output/shared.d.ts.map +1 -0
  99. package/dist/output/shared.js +28 -0
  100. package/dist/output/shared.js.map +1 -0
  101. package/dist/output/text.d.ts +11 -0
  102. package/dist/output/text.d.ts.map +1 -0
  103. package/dist/output/text.js +104 -0
  104. package/dist/output/text.js.map +1 -0
  105. package/dist/providers/cache.d.ts +28 -0
  106. package/dist/providers/cache.d.ts.map +1 -0
  107. package/dist/providers/cache.js +84 -0
  108. package/dist/providers/cache.js.map +1 -0
  109. package/dist/providers/cross-reference.d.ts +19 -0
  110. package/dist/providers/cross-reference.d.ts.map +1 -0
  111. package/dist/providers/cross-reference.js +48 -0
  112. package/dist/providers/cross-reference.js.map +1 -0
  113. package/dist/providers/index.d.ts +5 -0
  114. package/dist/providers/index.d.ts.map +1 -0
  115. package/dist/providers/index.js +4 -0
  116. package/dist/providers/index.js.map +1 -0
  117. package/dist/providers/interface.d.ts +37 -0
  118. package/dist/providers/interface.d.ts.map +1 -0
  119. package/dist/providers/interface.js +2 -0
  120. package/dist/providers/interface.js.map +1 -0
  121. package/dist/providers/launchdarkly/client.d.ts +13 -0
  122. package/dist/providers/launchdarkly/client.d.ts.map +1 -0
  123. package/dist/providers/launchdarkly/client.js +44 -0
  124. package/dist/providers/launchdarkly/client.js.map +1 -0
  125. package/dist/providers/launchdarkly/definition.d.ts +22 -0
  126. package/dist/providers/launchdarkly/definition.d.ts.map +1 -0
  127. package/dist/providers/launchdarkly/definition.js +24 -0
  128. package/dist/providers/launchdarkly/definition.js.map +1 -0
  129. package/dist/providers/launchdarkly/errors.d.ts +5 -0
  130. package/dist/providers/launchdarkly/errors.d.ts.map +1 -0
  131. package/dist/providers/launchdarkly/errors.js +9 -0
  132. package/dist/providers/launchdarkly/errors.js.map +1 -0
  133. package/dist/providers/launchdarkly/types.d.ts +154 -0
  134. package/dist/providers/launchdarkly/types.d.ts.map +1 -0
  135. package/dist/providers/launchdarkly/types.js +17 -0
  136. package/dist/providers/launchdarkly/types.js.map +1 -0
  137. package/dist/providers/orchestrate.d.ts +24 -0
  138. package/dist/providers/orchestrate.d.ts.map +1 -0
  139. package/dist/providers/orchestrate.js +44 -0
  140. package/dist/providers/orchestrate.js.map +1 -0
  141. package/dist/providers/registry.d.ts +8 -0
  142. package/dist/providers/registry.d.ts.map +1 -0
  143. package/dist/providers/registry.js +15 -0
  144. package/dist/providers/registry.js.map +1 -0
  145. package/dist/scan-repo.d.ts +2 -0
  146. package/dist/scan-repo.d.ts.map +1 -1
  147. package/dist/scan-repo.js +15 -6
  148. package/dist/scan-repo.js.map +1 -1
  149. package/dist/staleness.d.ts +4 -1
  150. package/dist/staleness.d.ts.map +1 -1
  151. package/dist/staleness.js +15 -11
  152. package/dist/staleness.js.map +1 -1
  153. package/package.json +6 -2
  154. package/dist/detection/tree-sitter/query-builder.d.ts +0 -3
  155. package/dist/detection/tree-sitter/query-builder.d.ts.map +0 -1
  156. package/dist/detection/tree-sitter/query-builder.js +0 -7
  157. package/dist/detection/tree-sitter/query-builder.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/providers/interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import type { PlatformFlag } from '../interface.js';
2
+ export interface FetchAllFlagsConfig {
3
+ project: string;
4
+ environment: string;
5
+ token: string;
6
+ }
7
+ export interface FetchAllFlagsOptions {
8
+ apiBase?: string;
9
+ fetch?: typeof globalThis.fetch;
10
+ signal?: AbortSignal;
11
+ }
12
+ export declare function fetchAllFlags(config: FetchAllFlagsConfig, opts?: FetchAllFlagsOptions): Promise<PlatformFlag[]>;
13
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/providers/launchdarkly/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAKnD,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;IAC/B,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,EAC3B,IAAI,GAAE,oBAAyB,GAC9B,OAAO,CAAC,YAAY,EAAE,CAAC,CA+BzB"}
@@ -0,0 +1,44 @@
1
+ import { FlagsResponseSchema } from './types.js';
2
+ import { LdApiError } from './errors.js';
3
+ const DEFAULT_API_BASE = 'https://app.launchdarkly.com';
4
+ const LD_API_VERSION = '20240415';
5
+ export async function fetchAllFlags(config, opts = {}) {
6
+ const fetchFn = opts.fetch ?? globalThis.fetch;
7
+ const apiBase = opts.apiBase ?? DEFAULT_API_BASE;
8
+ const out = [];
9
+ let path = buildFirstPath(config.project, config.environment);
10
+ while (path) {
11
+ const res = await fetchFn(new URL(path, apiBase), {
12
+ headers: {
13
+ Authorization: config.token,
14
+ 'LD-API-Version': LD_API_VERSION,
15
+ },
16
+ signal: opts.signal,
17
+ });
18
+ if (!res.ok) {
19
+ throw new LdApiError(`LaunchDarkly API ${res.status} ${res.statusText}`, res.status);
20
+ }
21
+ const json = await res.json();
22
+ const parsed = FlagsResponseSchema.parse(json);
23
+ for (const item of parsed.items) {
24
+ const envData = item.environments?.[config.environment];
25
+ out.push({
26
+ key: item.key,
27
+ archived: item.archived,
28
+ lastModified: envData?.lastModified != null ? new Date(envData.lastModified) : null,
29
+ });
30
+ }
31
+ path = parsed._links?.next?.href;
32
+ }
33
+ return out;
34
+ }
35
+ function buildFirstPath(project, environment) {
36
+ const params = new URLSearchParams({
37
+ env: environment,
38
+ limit: '100',
39
+ offset: '0',
40
+ summary: '1',
41
+ });
42
+ return `/api/v2/flags/${encodeURIComponent(project)}?${params.toString()}`;
43
+ }
44
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/providers/launchdarkly/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGxC,MAAM,gBAAgB,GAAG,8BAA8B,CAAA;AACvD,MAAM,cAAc,GAAG,UAAU,CAAA;AAcjC,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA2B,EAC3B,OAA6B,EAAE;IAE/B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAA;IAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,gBAAgB,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AC;AAED,SAAS,cAAc,CAAC,OAAe,EAAE,WAAmB;IAC1D,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;QACjC,GAAG,EAAE,WAAW;QAChB,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,GAAG;QACX,OAAO,EAAE,GAAG;KACb,CAAC,CAAA;IACF,OAAO,iBAAiB,kBAAkB,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAA;AAC5E,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ import type { PlatformDefinition } from '../interface.js';
3
+ declare const launchdarklyConfigSchema: z.ZodObject<{
4
+ project: z.ZodString;
5
+ environment: z.ZodString;
6
+ api_base: z.ZodOptional<z.ZodString>;
7
+ token_env: z.ZodOptional<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ project: string;
10
+ environment: string;
11
+ token_env?: string | undefined;
12
+ api_base?: string | undefined;
13
+ }, {
14
+ project: string;
15
+ environment: string;
16
+ token_env?: string | undefined;
17
+ api_base?: string | undefined;
18
+ }>;
19
+ type LdConfig = z.infer<typeof launchdarklyConfigSchema>;
20
+ export declare const launchdarklyDefinition: PlatformDefinition<LdConfig>;
21
+ export {};
22
+ //# sourceMappingURL=definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/providers/launchdarkly/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEzD,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;;EAK5B,CAAA;AAEF,KAAK,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAExD,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,QAAQ,CAc/D,CAAA"}
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ import { fetchAllFlags } from './client.js';
3
+ const launchdarklyConfigSchema = z.object({
4
+ project: z.string(),
5
+ environment: z.string(),
6
+ api_base: z.string().url().optional(),
7
+ token_env: z.string().optional(),
8
+ });
9
+ export const launchdarklyDefinition = {
10
+ name: 'launchdarkly',
11
+ displayName: 'LaunchDarkly',
12
+ defaultTokenEnv: 'LAUNCHDARKLY_API_TOKEN',
13
+ configSchema: launchdarklyConfigSchema,
14
+ createClient: (cfg, token) => ({
15
+ name: 'launchdarkly',
16
+ displayName: 'LaunchDarkly',
17
+ listFlags: ({ signal } = {}) => fetchAllFlags({
18
+ project: cfg.project,
19
+ environment: cfg.environment,
20
+ token,
21
+ }, { apiBase: cfg.api_base, signal }),
22
+ }),
23
+ };
24
+ //# sourceMappingURL=definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/providers/launchdarkly/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAG3C,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACrC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAA;AAIF,MAAM,CAAC,MAAM,sBAAsB,GAAiC;IAClE,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,eAAe,EAAE,wBAAwB;IACzC,YAAY,EAAE,wBAAwB;IACtC,YAAY,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAC7B,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,cAAc;QAC3B,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,aAAa,CAAC;YAC5C,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,KAAK;SACN,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;KACtC,CAAC;CACH,CAAA"}
@@ -0,0 +1,5 @@
1
+ export declare class LdApiError extends Error {
2
+ readonly status: number;
3
+ constructor(message: string, status: number);
4
+ }
5
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/providers/launchdarkly/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAW,SAAQ,KAAK;aACU,MAAM,EAAE,MAAM;gBAA/C,OAAO,EAAE,MAAM,EAAkB,MAAM,EAAE,MAAM;CAI5D"}
@@ -0,0 +1,9 @@
1
+ export class LdApiError extends Error {
2
+ status;
3
+ constructor(message, status) {
4
+ super(message);
5
+ this.status = status;
6
+ this.name = 'LdApiError';
7
+ }
8
+ }
9
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/providers/launchdarkly/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,UAAW,SAAQ,KAAK;IACU;IAA7C,YAAY,OAAe,EAAkB,MAAc;QACzD,KAAK,CAAC,OAAO,CAAC,CAAA;QAD6B,WAAM,GAAN,MAAM,CAAQ;QAEzD,IAAI,CAAC,IAAI,GAAG,YAAY,CAAA;IAC1B,CAAC;CACF"}
@@ -0,0 +1,154 @@
1
+ import { z } from 'zod';
2
+ export declare const FlagsResponseSchema: z.ZodObject<{
3
+ items: z.ZodArray<z.ZodObject<{
4
+ key: z.ZodString;
5
+ archived: z.ZodBoolean;
6
+ environments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
7
+ lastModified: z.ZodOptional<z.ZodNumber>;
8
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
9
+ lastModified: z.ZodOptional<z.ZodNumber>;
10
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
11
+ lastModified: z.ZodOptional<z.ZodNumber>;
12
+ }, z.ZodTypeAny, "passthrough">>>>;
13
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
14
+ key: z.ZodString;
15
+ archived: z.ZodBoolean;
16
+ environments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
17
+ lastModified: z.ZodOptional<z.ZodNumber>;
18
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
19
+ lastModified: z.ZodOptional<z.ZodNumber>;
20
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
21
+ lastModified: z.ZodOptional<z.ZodNumber>;
22
+ }, z.ZodTypeAny, "passthrough">>>>;
23
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
24
+ key: z.ZodString;
25
+ archived: z.ZodBoolean;
26
+ environments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
27
+ lastModified: z.ZodOptional<z.ZodNumber>;
28
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
29
+ lastModified: z.ZodOptional<z.ZodNumber>;
30
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
31
+ lastModified: z.ZodOptional<z.ZodNumber>;
32
+ }, z.ZodTypeAny, "passthrough">>>>;
33
+ }, z.ZodTypeAny, "passthrough">>, "many">;
34
+ totalCount: z.ZodNumber;
35
+ _links: z.ZodOptional<z.ZodObject<{
36
+ next: z.ZodOptional<z.ZodObject<{
37
+ href: z.ZodString;
38
+ }, "strip", z.ZodTypeAny, {
39
+ href: string;
40
+ }, {
41
+ href: string;
42
+ }>>;
43
+ }, "strip", z.ZodTypeAny, {
44
+ next?: {
45
+ href: string;
46
+ } | undefined;
47
+ }, {
48
+ next?: {
49
+ href: string;
50
+ } | undefined;
51
+ }>>;
52
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
53
+ items: z.ZodArray<z.ZodObject<{
54
+ key: z.ZodString;
55
+ archived: z.ZodBoolean;
56
+ environments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
57
+ lastModified: z.ZodOptional<z.ZodNumber>;
58
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
59
+ lastModified: z.ZodOptional<z.ZodNumber>;
60
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
61
+ lastModified: z.ZodOptional<z.ZodNumber>;
62
+ }, z.ZodTypeAny, "passthrough">>>>;
63
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
64
+ key: z.ZodString;
65
+ archived: z.ZodBoolean;
66
+ environments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
67
+ lastModified: z.ZodOptional<z.ZodNumber>;
68
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
69
+ lastModified: z.ZodOptional<z.ZodNumber>;
70
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
71
+ lastModified: z.ZodOptional<z.ZodNumber>;
72
+ }, z.ZodTypeAny, "passthrough">>>>;
73
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
74
+ key: z.ZodString;
75
+ archived: z.ZodBoolean;
76
+ environments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
77
+ lastModified: z.ZodOptional<z.ZodNumber>;
78
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
79
+ lastModified: z.ZodOptional<z.ZodNumber>;
80
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
81
+ lastModified: z.ZodOptional<z.ZodNumber>;
82
+ }, z.ZodTypeAny, "passthrough">>>>;
83
+ }, z.ZodTypeAny, "passthrough">>, "many">;
84
+ totalCount: z.ZodNumber;
85
+ _links: z.ZodOptional<z.ZodObject<{
86
+ next: z.ZodOptional<z.ZodObject<{
87
+ href: z.ZodString;
88
+ }, "strip", z.ZodTypeAny, {
89
+ href: string;
90
+ }, {
91
+ href: string;
92
+ }>>;
93
+ }, "strip", z.ZodTypeAny, {
94
+ next?: {
95
+ href: string;
96
+ } | undefined;
97
+ }, {
98
+ next?: {
99
+ href: string;
100
+ } | undefined;
101
+ }>>;
102
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
103
+ items: z.ZodArray<z.ZodObject<{
104
+ key: z.ZodString;
105
+ archived: z.ZodBoolean;
106
+ environments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
107
+ lastModified: z.ZodOptional<z.ZodNumber>;
108
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
109
+ lastModified: z.ZodOptional<z.ZodNumber>;
110
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
111
+ lastModified: z.ZodOptional<z.ZodNumber>;
112
+ }, z.ZodTypeAny, "passthrough">>>>;
113
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
114
+ key: z.ZodString;
115
+ archived: z.ZodBoolean;
116
+ environments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
117
+ lastModified: z.ZodOptional<z.ZodNumber>;
118
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
119
+ lastModified: z.ZodOptional<z.ZodNumber>;
120
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
121
+ lastModified: z.ZodOptional<z.ZodNumber>;
122
+ }, z.ZodTypeAny, "passthrough">>>>;
123
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
124
+ key: z.ZodString;
125
+ archived: z.ZodBoolean;
126
+ environments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
127
+ lastModified: z.ZodOptional<z.ZodNumber>;
128
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
129
+ lastModified: z.ZodOptional<z.ZodNumber>;
130
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
131
+ lastModified: z.ZodOptional<z.ZodNumber>;
132
+ }, z.ZodTypeAny, "passthrough">>>>;
133
+ }, z.ZodTypeAny, "passthrough">>, "many">;
134
+ totalCount: z.ZodNumber;
135
+ _links: z.ZodOptional<z.ZodObject<{
136
+ next: z.ZodOptional<z.ZodObject<{
137
+ href: z.ZodString;
138
+ }, "strip", z.ZodTypeAny, {
139
+ href: string;
140
+ }, {
141
+ href: string;
142
+ }>>;
143
+ }, "strip", z.ZodTypeAny, {
144
+ next?: {
145
+ href: string;
146
+ } | undefined;
147
+ }, {
148
+ next?: {
149
+ href: string;
150
+ } | undefined;
151
+ }>>;
152
+ }, z.ZodTypeAny, "passthrough">>;
153
+ export type FlagsResponse = z.infer<typeof FlagsResponseSchema>;
154
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/providers/launchdarkly/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAYvB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAMhB,CAAA;AAEhB,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ const EnvironmentSchema = z.object({
3
+ lastModified: z.number().optional(),
4
+ }).passthrough();
5
+ const FlagItemSchema = z.object({
6
+ key: z.string(),
7
+ archived: z.boolean(),
8
+ environments: z.record(z.string(), EnvironmentSchema).optional(),
9
+ }).passthrough();
10
+ export const FlagsResponseSchema = z.object({
11
+ items: z.array(FlagItemSchema),
12
+ totalCount: z.number(),
13
+ _links: z.object({
14
+ next: z.object({ href: z.string() }).optional(),
15
+ }).optional(),
16
+ }).passthrough();
17
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/providers/launchdarkly/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC,WAAW,EAAE,CAAA;AAEhB,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,iBAAiB,CAAC,CAAC,QAAQ,EAAE;CACjE,CAAC,CAAC,WAAW,EAAE,CAAA;AAEhB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;IAC9B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE;KAChD,CAAC,CAAC,QAAQ,EAAE;CACd,CAAC,CAAC,WAAW,EAAE,CAAA"}
@@ -0,0 +1,24 @@
1
+ import type { PlatformSignal, PlatformFlag } from './interface.js';
2
+ import type { FeatureFlag } from '../detection/feature-flag.js';
3
+ import type { ScanLogger } from '../scan-repo.js';
4
+ export interface OrchestratePlatformsOptions {
5
+ /** Raw .flagshark.yml `platforms:` block, before per-platform Zod validation. */
6
+ platformsConfig: Record<string, unknown> | undefined;
7
+ /** Detected flag keys from the analyzer. */
8
+ detectedFlags: Map<string, FeatureFlag[]>;
9
+ logger: ScanLogger;
10
+ /** When true, skip cache for this run. */
11
+ noCache?: boolean;
12
+ signal?: AbortSignal;
13
+ /**
14
+ * @internal — test seam. When set, used instead of platform.listFlags().
15
+ * Allows tests to bypass network without monkey-patching globalThis.fetch.
16
+ */
17
+ listFlagsOverride?: (signal?: AbortSignal) => Promise<PlatformFlag[]>;
18
+ }
19
+ /**
20
+ * Runs each configured platform integration. Logs warnings on individual
21
+ * platform failures and continues. Returns merged signals keyed by flag name.
22
+ */
23
+ export declare function orchestratePlatforms(opts: OrchestratePlatformsOptions): Promise<Map<string, PlatformSignal[]>>;
24
+ //# sourceMappingURL=orchestrate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrate.d.ts","sourceRoot":"","sources":["../../src/providers/orchestrate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,MAAM,WAAW,2BAA2B;IAC1C,iFAAiF;IACjF,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IACpD,4CAA4C;IAC5C,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,CAAA;IACzC,MAAM,EAAE,UAAU,CAAA;IAClB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,YAAY,EAAE,CAAC,CAAA;CACtE;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC,CAsCxC"}
@@ -0,0 +1,44 @@
1
+ import { findPlatform } from './registry.js';
2
+ import { crossReference, mergePlatformSignals } from './cross-reference.js';
3
+ import { computeCacheKey, loadPlatformFlagsCached } from './cache.js';
4
+ /**
5
+ * Runs each configured platform integration. Logs warnings on individual
6
+ * platform failures and continues. Returns merged signals keyed by flag name.
7
+ */
8
+ export async function orchestratePlatforms(opts) {
9
+ const out = new Map();
10
+ if (!opts.platformsConfig)
11
+ return out;
12
+ for (const [name, rawConfig] of Object.entries(opts.platformsConfig)) {
13
+ const def = findPlatform(name);
14
+ if (!def) {
15
+ opts.logger.warn(`Unknown platform '${name}' — skipping`);
16
+ continue;
17
+ }
18
+ const parsed = def.configSchema.safeParse(rawConfig);
19
+ if (!parsed.success) {
20
+ opts.logger.warn(`Invalid config for platform '${name}': ${parsed.error.message}`);
21
+ continue;
22
+ }
23
+ const tokenEnv = rawConfig.token_env ?? def.defaultTokenEnv;
24
+ const token = process.env[tokenEnv];
25
+ if (!token) {
26
+ opts.logger.warn(`${def.displayName}: missing ${tokenEnv}; skipping platform integration`);
27
+ continue;
28
+ }
29
+ try {
30
+ const client = def.createClient(parsed.data, token);
31
+ const cacheKey = computeCacheKey(name, parsed.data, token);
32
+ const flags = opts.listFlagsOverride
33
+ ? await opts.listFlagsOverride(opts.signal)
34
+ : await loadPlatformFlagsCached(client, cacheKey, { noCache: opts.noCache, signal: opts.signal });
35
+ const signals = crossReference(opts.detectedFlags, flags, def.displayName);
36
+ mergePlatformSignals(out, signals);
37
+ }
38
+ catch (err) {
39
+ opts.logger.warn(`${def.displayName}: ${err.message}. Continuing with code-only signals.`);
40
+ }
41
+ }
42
+ return out;
43
+ }
44
+ //# sourceMappingURL=orchestrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrate.js","sourceRoot":"","sources":["../../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F,SAAQ;QACV,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;YACnD,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;YAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,iBAAiB;gBAClC,CAAC,CAAC,MAAM,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC;gBAC3C,CAAC,CAAC,MAAM,uBAAuB,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;YACnG,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE,GAAG,CAAC,WAAW,CAAC,CAAA;YAC1E,oBAAoB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QACpC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,WAAW,KAAM,GAAa,CAAC,OAAO,sCAAsC,CAAC,CAAA;QACvG,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { PlatformDefinition } from './interface.js';
2
+ /**
3
+ * Static registry of platform integrations. Adding a new platform appends an
4
+ * import + an entry here. No other central code changes.
5
+ */
6
+ export declare const platformRegistry: ReadonlyArray<PlatformDefinition<any>>;
7
+ export declare function findPlatform(name: string): PlatformDefinition<unknown> | undefined;
8
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/providers/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAGxD;;;GAGG;AAIH,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAEnE,CAAA;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAAC,OAAO,CAAC,GAAG,SAAS,CAElF"}
@@ -0,0 +1,15 @@
1
+ import { launchdarklyDefinition } from './launchdarkly/definition.js';
2
+ /**
3
+ * Static registry of platform integrations. Adding a new platform appends an
4
+ * import + an entry here. No other central code changes.
5
+ */
6
+ // Use any in the array type to accommodate concrete-config definitions. Each
7
+ // definition's specific TConfig is preserved through findPlatform() because
8
+ // callers re-parse the raw config through definition.configSchema anyway.
9
+ export const platformRegistry = [
10
+ launchdarklyDefinition,
11
+ ];
12
+ export function findPlatform(name) {
13
+ return platformRegistry.find((p) => p.name === name);
14
+ }
15
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/providers/registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAErE;;;GAGG;AACH,6EAA6E;AAC7E,4EAA4E;AAC5E,0EAA0E;AAC1E,MAAM,CAAC,MAAM,gBAAgB,GAA2C;IACtE,sBAAsB;CACvB,CAAA;AAED,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAA;AACtD,CAAC"}
@@ -57,6 +57,8 @@ export interface ScanRepoOptions {
57
57
  * When true, the result will include the list of excluded file paths.
58
58
  */
59
59
  collectExcludedPaths?: boolean;
60
+ /** When true, bypass platform cache for this run. */
61
+ noCache?: boolean;
60
62
  }
61
63
  export interface ScanRepoResult {
62
64
  /** Total count of unique flag names detected across the repository. */
@@ -1 +1 @@
1
- {"version":3,"file":"scan-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CAAC,EAAE,MAAM,CAAA;IAEb;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAA;IAEnB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,OAAO,GAAG,aAAa,CAAA;IAEhC;;;OAGG;IACH,MAAM,CAAC,EAAE,eAAe,CAAA;IAExB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAE9B,qDAAqD;IACrD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,UAAU,EAAE,MAAM,CAAA;IAElB,yDAAyD;IACzD,YAAY,EAAE,MAAM,CAAA;IAEpB;;;;OAIG;IACH,UAAU,EAAE,SAAS,EAAE,CAAA;IAEvB;;;OAGG;IACH,iBAAiB,EAAE,MAAM,EAAE,CAAA;IAE3B,0EAA0E;IAC1E,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAEzC;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IAEnB,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAA;IAEpB,uFAAuF;IACvF,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB,0FAA0F;IAC1F,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IAExB,kGAAkG;IAClG,iBAAiB,CAAC,EAAE,cAAc,CAAA;CACnC;AAUD,wBAAsB,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAmF7E"}
package/dist/scan-repo.js CHANGED
@@ -10,11 +10,13 @@ import { buildDefaultConfig } from './config/defaults.js';
10
10
  import { buildExcluder } from './config/excluder.js';
11
11
  import { loadConfigFile } from './config/loader.js';
12
12
  import { loadIgnoreFile } from './config/ignore-file.js';
13
+ import { orchestratePlatforms } from './providers/orchestrate.js';
14
+ const NOOP = () => { };
13
15
  const NOOP_LOGGER = {
14
- debug: () => { },
15
- info: () => { },
16
- warn: () => { },
17
- error: () => { },
16
+ debug: NOOP,
17
+ info: NOOP,
18
+ warn: NOOP,
19
+ error: NOOP,
18
20
  };
19
21
  export async function scanRepo(opts) {
20
22
  const start = performance.now();
@@ -23,7 +25,7 @@ export async function scanRepo(opts) {
23
25
  (opts.noConfig
24
26
  ? buildDefaultConfig()
25
27
  : (await loadConfigFile(opts.cwd))?.config ?? buildDefaultConfig());
26
- const threshold = opts.threshold ?? config.threshold ?? 6;
28
+ const threshold = opts.threshold ?? config.threshold;
27
29
  const ignoreFile = opts.noIgnoreFile ? null : await loadIgnoreFile(opts.cwd);
28
30
  const excluder = buildExcluder({
29
31
  config,
@@ -46,7 +48,14 @@ export async function scanRepo(opts) {
46
48
  logger.debug(`Detected ${files.size} candidate files (excluded ${excludedCount})`);
47
49
  const filesScanned = files.size;
48
50
  const analysisResult = await analyzer.analyzeFiles(files, opts.signal);
49
- const staleFlags = await analyzeStaleness(analysisResult.totalFlags, { thresholdMonths: threshold, repoRoot: opts.cwd });
51
+ const platformSignals = await orchestratePlatforms({
52
+ platformsConfig: config.platforms,
53
+ detectedFlags: analysisResult.totalFlags,
54
+ logger,
55
+ noCache: opts.noCache,
56
+ signal: opts.signal,
57
+ });
58
+ const staleFlags = await analyzeStaleness(analysisResult.totalFlags, { thresholdMonths: threshold, repoRoot: opts.cwd, platformSignals });
50
59
  const totalFlags = analysisResult.totalFlags.size;
51
60
  const uniqueStaleNames = new Set(staleFlags.map((f) => f.name)).size;
52
61
  const healthScore = totalFlags === 0 ? 100 : Math.round(((totalFlags - uniqueStaleNames) / totalFlags) * 100);
@@ -1 +1 @@
1
- {"version":3,"file":"scan-repo.js","sourceRoot":"","sources":["../src/scan-repo.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,Y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C,cAAc;KAC3C,CAAA;AACH,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { type FeatureFlag } from './detection/feature-flag.js';
2
2
  export interface StalenessSignal {
3
- type: 'age' | 'hardcoded' | 'low-usage';
3
+ type: 'age' | 'hardcoded' | 'low-usage' | 'missing-in-platform' | 'archived-in-platform';
4
+ severity: 'error' | 'warning';
4
5
  description: string;
5
6
  }
6
7
  export interface StaleFlag {
@@ -18,6 +19,8 @@ export interface StalenessOptions {
18
19
  thresholdMonths: number;
19
20
  /** Absolute path to the git repository root. */
20
21
  repoRoot: string;
22
+ /** Optional: pre-computed platform signals keyed by flag name. */
23
+ platformSignals?: Map<string, import('./providers/interface.js').PlatformSignal[]>;
21
24
  }
22
25
  /**
23
26
  * Analyze a set of detected feature flags for staleness signals.
@@ -1 +1 @@
1
- {"version":3,"file":"staleness.d.ts","sourceRoot":"","sources":["../src/staleness.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAI9D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,KAAK,GAAG,WAAW,GAAG,WAAW,CAAA;IACvC,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,eAAe,EAAE,CAAA;IAC1B,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B,mEAAmE;IACnE,eAAe,EAAE,MAAM,CAAA;IACvB,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAA;CACjB;AAyKD;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,EACjC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,SAAS,EAAE,CAAC,CAyEtB"}
1
+ {"version":3,"file":"staleness.d.ts","sourceRoot":"","sources":["../src/staleness.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAI9D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,KAAK,GAAG,WAAW,GAAG,WAAW,GAAG,qBAAqB,GAAG,sBAAsB,CAAA;IACxF,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,eAAe,EAAE,CAAA;IAC1B,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B,mEAAmE;IACnE,eAAe,EAAE,MAAM,CAAA;IACvB,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAA;IAChB,kEAAkE;IAClE,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,0BAA0B,EAAE,cAAc,EAAE,CAAC,CAAA;CACnF;AAmKD;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,EACjC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,SAAS,EAAE,CAAC,CAmFtB"}
package/dist/staleness.js CHANGED
@@ -118,6 +118,7 @@ function checkAgeSignal(authorTime, thresholdMonths) {
118
118
  return {
119
119
  signal: {
120
120
  type: 'age',
121
+ severity: 'warning',
121
122
  description: `Flag reference last modified ${age} (threshold: ${thresholdMonths} months)`,
122
123
  },
123
124
  age,
@@ -133,16 +134,10 @@ function checkLowUsageSignal(flagName, occurrences) {
133
134
  }
134
135
  return {
135
136
  type: 'low-usage',
137
+ severity: 'warning',
136
138
  description: `Flag "${flagName}" only appears in 1 file — may have been fully rolled out`,
137
139
  };
138
140
  }
139
- /**
140
- * Hardcoded signal — placeholder for tree-sitter v2.
141
- * Always returns null (no signal) for the regex v1 implementation.
142
- */
143
- function checkHardcodedSignal(_flag) {
144
- return null;
145
- }
146
141
  // ── Main entry point ───────────────────────────────────────────────
147
142
  /**
148
143
  * Analyze a set of detected feature flags for staleness signals.
@@ -193,10 +188,19 @@ export async function analyzeStaleness(flags, options) {
193
188
  if (lowUsageSignal) {
194
189
  signals.push(lowUsageSignal);
195
190
  }
196
- // Hardcoded signal (v2 placeholder)
197
- const hardcoded = checkHardcodedSignal(flag);
198
- if (hardcoded) {
199
- signals.push(hardcoded);
191
+ // Hardcoded signal (v2 placeholder — always null for regex v1)
192
+ // checkHardcodedSignal returns null unconditionally; kept for structural symmetry
193
+ // with the other signal detectors. No branch emitted here.
194
+ // Platform signals (from provider API cross-reference)
195
+ const platformSigs = options.platformSignals?.get(flagName);
196
+ if (platformSigs) {
197
+ for (const ps of platformSigs) {
198
+ signals.push({
199
+ type: ps.type,
200
+ severity: ps.severity,
201
+ description: ps.description,
202
+ });
203
+ }
200
204
  }
201
205
  // Only include flags that have at least one signal.
202
206
  if (signals.length > 0) {