@kelviq/cli 0.1.1

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 (99) hide show
  1. package/README.md +313 -0
  2. package/dist/cli-ui/auth-hint.d.ts +6 -0
  3. package/dist/cli-ui/auth-hint.js +34 -0
  4. package/dist/cli-ui/auth-hint.js.map +1 -0
  5. package/dist/cli-ui/hints.d.ts +5 -0
  6. package/dist/cli-ui/hints.js +19 -0
  7. package/dist/cli-ui/hints.js.map +1 -0
  8. package/dist/cli-ui/spinner.d.ts +7 -0
  9. package/dist/cli-ui/spinner.js +61 -0
  10. package/dist/cli-ui/spinner.js.map +1 -0
  11. package/dist/cli-ui/style.d.ts +47 -0
  12. package/dist/cli-ui/style.js +71 -0
  13. package/dist/cli-ui/style.js.map +1 -0
  14. package/dist/cli-ui/tty.d.ts +1 -0
  15. package/dist/cli-ui/tty.js +13 -0
  16. package/dist/cli-ui/tty.js.map +1 -0
  17. package/dist/cli.d.ts +2 -0
  18. package/dist/cli.js +51 -0
  19. package/dist/cli.js.map +1 -0
  20. package/dist/commands/env.d.ts +34 -0
  21. package/dist/commands/env.js +52 -0
  22. package/dist/commands/env.js.map +1 -0
  23. package/dist/commands/init.d.ts +15 -0
  24. package/dist/commands/init.js +70 -0
  25. package/dist/commands/init.js.map +1 -0
  26. package/dist/commands/login.d.ts +22 -0
  27. package/dist/commands/login.js +205 -0
  28. package/dist/commands/login.js.map +1 -0
  29. package/dist/commands/logout.d.ts +13 -0
  30. package/dist/commands/logout.js +39 -0
  31. package/dist/commands/logout.js.map +1 -0
  32. package/dist/commands/promote.d.ts +42 -0
  33. package/dist/commands/promote.js +243 -0
  34. package/dist/commands/promote.js.map +1 -0
  35. package/dist/commands/pull.d.ts +31 -0
  36. package/dist/commands/pull.js +108 -0
  37. package/dist/commands/pull.js.map +1 -0
  38. package/dist/commands/push-shared.d.ts +97 -0
  39. package/dist/commands/push-shared.js +283 -0
  40. package/dist/commands/push-shared.js.map +1 -0
  41. package/dist/commands/push.d.ts +42 -0
  42. package/dist/commands/push.js +268 -0
  43. package/dist/commands/push.js.map +1 -0
  44. package/dist/config-format/builders.d.ts +10 -0
  45. package/dist/config-format/builders.js +46 -0
  46. package/dist/config-format/builders.js.map +1 -0
  47. package/dist/config-format/index.d.ts +4 -0
  48. package/dist/config-format/index.js +9 -0
  49. package/dist/config-format/index.js.map +1 -0
  50. package/dist/config-format/load.d.ts +23 -0
  51. package/dist/config-format/load.js +82 -0
  52. package/dist/config-format/load.js.map +1 -0
  53. package/dist/config-format/schema.d.ts +423 -0
  54. package/dist/config-format/schema.js +105 -0
  55. package/dist/config-format/schema.js.map +1 -0
  56. package/dist/core/config.d.ts +48 -0
  57. package/dist/core/config.js +128 -0
  58. package/dist/core/config.js.map +1 -0
  59. package/dist/core/errors.d.ts +20 -0
  60. package/dist/core/errors.js +58 -0
  61. package/dist/core/errors.js.map +1 -0
  62. package/dist/core/http.d.ts +39 -0
  63. package/dist/core/http.js +104 -0
  64. package/dist/core/http.js.map +1 -0
  65. package/dist/core/version.d.ts +1 -0
  66. package/dist/core/version.js +14 -0
  67. package/dist/core/version.js.map +1 -0
  68. package/dist/generated/openapi.json +6635 -0
  69. package/dist/sync/apply.d.ts +38 -0
  70. package/dist/sync/apply.js +234 -0
  71. package/dist/sync/apply.js.map +1 -0
  72. package/dist/sync/diff.d.ts +186 -0
  73. package/dist/sync/diff.js +402 -0
  74. package/dist/sync/diff.js.map +1 -0
  75. package/dist/sync/fetch-catalog.d.ts +105 -0
  76. package/dist/sync/fetch-catalog.js +100 -0
  77. package/dist/sync/fetch-catalog.js.map +1 -0
  78. package/dist/sync/price-filter.d.ts +37 -0
  79. package/dist/sync/price-filter.js +195 -0
  80. package/dist/sync/price-filter.js.map +1 -0
  81. package/dist/sync/prune.d.ts +77 -0
  82. package/dist/sync/prune.js +112 -0
  83. package/dist/sync/prune.js.map +1 -0
  84. package/dist/sync/publish.d.ts +75 -0
  85. package/dist/sync/publish.js +126 -0
  86. package/dist/sync/publish.js.map +1 -0
  87. package/dist/sync/push-plan-json.d.ts +79 -0
  88. package/dist/sync/push-plan-json.js +70 -0
  89. package/dist/sync/push-plan-json.js.map +1 -0
  90. package/dist/sync/render-plan.d.ts +83 -0
  91. package/dist/sync/render-plan.js +358 -0
  92. package/dist/sync/render-plan.js.map +1 -0
  93. package/dist/sync/serialize.d.ts +18 -0
  94. package/dist/sync/serialize.js +108 -0
  95. package/dist/sync/serialize.js.map +1 -0
  96. package/dist/sync/to-config.d.ts +9 -0
  97. package/dist/sync/to-config.js +191 -0
  98. package/dist/sync/to-config.js.map +1 -0
  99. package/package.json +68 -0
@@ -0,0 +1,79 @@
1
+ import type { FeatureDriftEntry, PushPlan } from './diff.js';
2
+ import type { PrunePlan } from './prune.js';
3
+ export interface JsonFlagOptions {
4
+ json?: boolean;
5
+ dryRun?: boolean;
6
+ }
7
+ /**
8
+ * `--json` is valid ONLY together with `--dry-run` (never mixes with
9
+ * prompts/writes) — checked before any I/O, same convention as
10
+ * src/sync/publish.ts's `validatePublishFlags`. Returns a one-line,
11
+ * human-readable explanation for every invalid combination, `undefined`
12
+ * otherwise.
13
+ */
14
+ export declare function validateJsonFlags(options: JsonFlagOptions): string | undefined;
15
+ export interface PushJsonSummary {
16
+ creates: number;
17
+ updates: number;
18
+ priceReplaces: number;
19
+ entitlementChanges: number;
20
+ archives: number;
21
+ skipped: number;
22
+ remoteOnly: number;
23
+ warnings: number;
24
+ }
25
+ export interface PushJsonPublish {
26
+ plans: string[];
27
+ updateFeatures: boolean;
28
+ updatePricing: boolean;
29
+ }
30
+ export interface PushJsonDocument {
31
+ environment: 'sandbox' | 'production';
32
+ direction: 'push' | 'promote';
33
+ changes: boolean;
34
+ summary: PushJsonSummary;
35
+ operations: {
36
+ products: PushPlan['products'];
37
+ features: PushPlan['features'];
38
+ plans: PushPlan['plans'];
39
+ entitlements: PushPlan['entitlements'];
40
+ prices: PushPlan['prices'];
41
+ };
42
+ prune: PrunePlan | null;
43
+ publish: PushJsonPublish | null;
44
+ featureDrift: FeatureDriftEntry[];
45
+ errors: string[];
46
+ warnings: string[];
47
+ }
48
+ /** The `{"error": ..., "featureDrift": [...]}` document for load/fetch/drift errors in JSON mode (plan 015 Step 1) — a deliberately smaller, separate shape from `PushJsonDocument` above, never a partially-filled success document. */
49
+ export interface PushJsonErrorDocument {
50
+ error: string;
51
+ featureDrift: FeatureDriftEntry[];
52
+ }
53
+ export interface BuildPushJsonDocumentOptions {
54
+ envName: 'sandbox' | 'production';
55
+ direction: 'push' | 'promote';
56
+ plan: PushPlan;
57
+ /** Computed unconditionally by push.ts/promote.ts regardless of `--prune` (cheap, no HTTP) — same value already used for the text renderer's own prune preview. */
58
+ prunePlan: PrunePlan;
59
+ /** Whether `--prune` was actually passed this run — gates the `prune` field and `summary.archives` exactly like render-plan.ts's own `prune` option gates its archive/skipped sections; `summary.skipped` stays visible regardless (informational, computed either way). */
60
+ prunePassed: boolean;
61
+ /** Only set for an ACTUAL dry run with `--publish` — mirrors push.ts/promote.ts's own `publishPreview` construction (`{ planIdentifiers, updateFeatures, updatePricing }`, from src/sync/publish.ts's `publishSetFromPushPlan`/`publishRequestBody`). */
62
+ publishPreview?: {
63
+ planIdentifiers: string[];
64
+ updateFeatures: boolean;
65
+ updatePricing: boolean;
66
+ };
67
+ }
68
+ /**
69
+ * Builds the exact `--dry-run --json` document. Exit 0 always follows a
70
+ * successful call to this function — `changes` is data, never an exit code
71
+ * (mirrors `changes`'s own definition: true iff a real run of this plan
72
+ * would write or archive anything, the same "is there anything to do" test
73
+ * render-plan.ts's `isPushPlanEmpty` / push.ts's `archiveCount` gate use).
74
+ */
75
+ export declare function buildPushJsonDocument(opts: BuildPushJsonDocumentOptions): PushJsonDocument;
76
+ /** The error-document counterpart to `buildPushJsonDocument` — load/fetch failures pass `featureDrift: []` (the default); the feature-drift abort branch passes the real `plan.featureDrift`. */
77
+ export declare function buildPushJsonErrorDocument(message: string, featureDrift?: FeatureDriftEntry[]): PushJsonErrorDocument;
78
+ /** Writes exactly one JSON document (plus a trailing newline) to `stdout` — the entirety of stdout's output in JSON mode. */
79
+ export declare function writeJsonDocument(stdout: NodeJS.WritableStream, doc: PushJsonDocument | PushJsonErrorDocument): void;
@@ -0,0 +1,70 @@
1
+ import { isPushPlanEmpty } from './render-plan.js';
2
+ import { pruneArchiveCount } from './prune.js';
3
+ /**
4
+ * `--json` is valid ONLY together with `--dry-run` (never mixes with
5
+ * prompts/writes) — checked before any I/O, same convention as
6
+ * src/sync/publish.ts's `validatePublishFlags`. Returns a one-line,
7
+ * human-readable explanation for every invalid combination, `undefined`
8
+ * otherwise.
9
+ */
10
+ export function validateJsonFlags(options) {
11
+ if (options.json && !options.dryRun) {
12
+ return '--json requires --dry-run (JSON output never mixes with prompts or writes).';
13
+ }
14
+ return undefined;
15
+ }
16
+ function summaryFor(plan, prunePlan, prunePassed) {
17
+ const archives = prunePassed ? pruneArchiveCount(prunePlan) : 0;
18
+ const skipped = prunePlan.skipped.plans.length + prunePlan.skipped.features.length;
19
+ const remoteOnly = plan.unmanagedRemote.products.length + plan.unmanagedRemote.features.length + plan.unmanagedRemote.plans.length;
20
+ return {
21
+ creates: plan.products.create.length + plan.features.create.length + plan.plans.create.length,
22
+ updates: plan.products.patch.length + plan.plans.patch.length,
23
+ priceReplaces: plan.prices.bulkReplace.length,
24
+ entitlementChanges: plan.entitlements.add.length + plan.entitlements.update.length + plan.entitlements.delete.length,
25
+ archives,
26
+ skipped,
27
+ remoteOnly,
28
+ warnings: plan.warnings.length,
29
+ };
30
+ }
31
+ /**
32
+ * Builds the exact `--dry-run --json` document. Exit 0 always follows a
33
+ * successful call to this function — `changes` is data, never an exit code
34
+ * (mirrors `changes`'s own definition: true iff a real run of this plan
35
+ * would write or archive anything, the same "is there anything to do" test
36
+ * render-plan.ts's `isPushPlanEmpty` / push.ts's `archiveCount` gate use).
37
+ */
38
+ export function buildPushJsonDocument(opts) {
39
+ const { envName, direction, plan, prunePlan, prunePassed, publishPreview } = opts;
40
+ const archiveCount = prunePassed ? pruneArchiveCount(prunePlan) : 0;
41
+ return {
42
+ environment: envName,
43
+ direction,
44
+ changes: !isPushPlanEmpty(plan) || archiveCount > 0,
45
+ summary: summaryFor(plan, prunePlan, prunePassed),
46
+ operations: {
47
+ products: plan.products,
48
+ features: plan.features,
49
+ plans: plan.plans,
50
+ entitlements: plan.entitlements,
51
+ prices: plan.prices,
52
+ },
53
+ prune: prunePassed ? prunePlan : null,
54
+ publish: publishPreview
55
+ ? { plans: publishPreview.planIdentifiers, updateFeatures: publishPreview.updateFeatures, updatePricing: publishPreview.updatePricing }
56
+ : null,
57
+ featureDrift: plan.featureDrift,
58
+ errors: plan.errors,
59
+ warnings: plan.warnings,
60
+ };
61
+ }
62
+ /** The error-document counterpart to `buildPushJsonDocument` — load/fetch failures pass `featureDrift: []` (the default); the feature-drift abort branch passes the real `plan.featureDrift`. */
63
+ export function buildPushJsonErrorDocument(message, featureDrift = []) {
64
+ return { error: message, featureDrift };
65
+ }
66
+ /** Writes exactly one JSON document (plus a trailing newline) to `stdout` — the entirety of stdout's output in JSON mode. */
67
+ export function writeJsonDocument(stdout, doc) {
68
+ stdout.write(`${JSON.stringify(doc)}\n`);
69
+ }
70
+ //# sourceMappingURL=push-plan-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-plan-json.js","sourceRoot":"","sources":["../../src/sync/push-plan-json.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAO/C;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAwB;IACxD,IAAI,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACpC,OAAO,6EAA6E,CAAC;IACvF,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAwDD,SAAS,UAAU,CAAC,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enderPushPlanOptions {
3
+ envName: string;
4
+ /**
5
+ * CLI plan 014: true for promote's directional "sandbox → production"
6
+ * label — the target-environment line gets an extra yellow alongside its
7
+ * usual bold when set. `push`'s plain "sandbox"/"production" label leaves
8
+ * this unset.
9
+ */
10
+ directional?: boolean;
11
+ /**
12
+ * CLI plan 014: render every warning line exactly as it appears in
13
+ * `PushPlan.warnings` (this module's pre-plan-014 behavior), bypassing
14
+ * price-drop aggregation entirely. Defaults to aggregated.
15
+ */
16
+ verbose?: boolean;
17
+ /**
18
+ * CLI plan 009: when `--dry-run --publish` is used, the plans that WOULD
19
+ * be published this run (`publishSetFromPushPlan`, src/sync/publish.ts)
20
+ * and the exact migration booleans that would be sent
21
+ * (`publishRequestBody`) — rendered as its own section so a dry run
22
+ * previews DESIGN-push.md §4's publish step too, with zero writes.
23
+ * Omitted entirely (no section rendered, including when the computed set
24
+ * is empty) when `--publish` wasn't passed.
25
+ */
26
+ publishPreview?: {
27
+ planIdentifiers: string[];
28
+ updateFeatures: boolean;
29
+ updatePricing: boolean;
30
+ };
31
+ /**
32
+ * CLI plan 010: when `--prune` is passed, the computed `PrunePlan`
33
+ * (src/sync/prune.ts) rendered as its own archive + skipped sections.
34
+ * Omitted entirely (no section rendered, and the pre-existing
35
+ * "Remote-only" section falls back to its unchanged default shape —
36
+ * products AND features AND plans together) when `--prune` wasn't passed —
37
+ * this is what keeps the no-`--prune` render path byte-for-byte identical
38
+ * to before this plan. When passed, remote-only features/plans move OUT of
39
+ * "Remote-only" and into "Archive"/"Skipped" below (never duplicated
40
+ * across sections); "Remote-only" keeps only products, which are never
41
+ * prune candidates (DESIGN-push.md §5).
42
+ */
43
+ prune?: {
44
+ archivePlans: string[];
45
+ archiveFeatures: string[];
46
+ skippedPlans: Array<{
47
+ identifier: string;
48
+ reason: string;
49
+ }>;
50
+ skippedFeatures: Array<{
51
+ identifier: string;
52
+ reason: string;
53
+ }>;
54
+ };
55
+ }
56
+ /** Exported (CLI plan 015) so the spinner's fetch-completion line (src/commands/pull.ts/push.ts/promote.ts) can reuse the exact same "N noun(s)" convention as this renderer's own summary line, instead of a second hand-rolled copy. */
57
+ export declare function plural(n: number, noun: string): string;
58
+ /**
59
+ * True iff the plan contains zero write operations. Deliberately ignores
60
+ * `warnings`/`unmanagedRemote` (informational, never a write) and
61
+ * `errors`/`featureDrift` (the command aborts before rendering when either
62
+ * is non-empty — see src/commands/push.ts). Exported so the command can
63
+ * reuse the exact same "is there anything to confirm" definition the
64
+ * renderer used to decide whether it printed "No changes." (CLI plan 008
65
+ * Step 3 point 5: the empty-plan short-circuit must agree with what was
66
+ * just printed).
67
+ */
68
+ export declare function isPushPlanEmpty(plan: PushPlan): boolean;
69
+ /**
70
+ * Renders the full plan-of-record diff a `push` run confirms against
71
+ * (DESIGN-push.md §7 point 2). Sections appear in dependency order (§8,
72
+ * extended by CLI plan 010): products, features, plans, entitlements
73
+ * (converge), prices (replace), then (CLI plan 009) the `--dry-run
74
+ * --publish` preview, then (CLI plan 010) the `--prune` archive + skipped
75
+ * sections — matching prune's own "runs last" execution order — then
76
+ * remote-only (left alone; products only once `--prune` is active) and
77
+ * warnings. "No changes." replaces the operations block only when the plan
78
+ * has zero write operations AND (when `--prune` is active) zero archive
79
+ * operations — see `isPushPlanEmpty`/`prune.ts`'s `isPrunePlanEmpty` — but
80
+ * warnings/remote-only/archive/skipped info still renders beneath it when
81
+ * present. Always ends with the target environment name.
82
+ */
83
+ export declare function renderPushPlan(plan: PushPlan, { envName, directional, verbose, publishPreview, prune }: RenderPushPlanOptions): string;
@@ -0,0 +1,358 @@
1
+ import { style } from '../cli-ui/style.js';
2
+ /** Exported (CLI plan 015) so the spinner's fetch-completion line (src/commands/pull.ts/push.ts/promote.ts) can reuse the exact same "N noun(s)" convention as this renderer's own summary line, instead of a second hand-rolled copy. */
3
+ export function plural(n, noun) {
4
+ return `${n} ${noun}${n === 1 ? '' : 's'}`;
5
+ }
6
+ const TRUNCATE_LENGTH = 40;
7
+ /** Truncates an already-stringified value to ~40 chars with a single `…` (CLI plan 014 Step 4). */
8
+ function truncate(s) {
9
+ return s.length > TRUNCATE_LENGTH ? `${s.slice(0, TRUNCATE_LENGTH)}…` : s;
10
+ }
11
+ /**
12
+ * Compact, canonical (sorted-key) JSON for display — deterministic
13
+ * regardless of the source object's key insertion order, so the same
14
+ * logical value always renders identically. `undefined` (a field absent on
15
+ * one side of an old→new pair) renders as the literal text `undefined`
16
+ * rather than throwing (`JSON.stringify(undefined)` returns the `undefined`
17
+ * *value*, not a string).
18
+ */
19
+ function canonicalJson(value) {
20
+ if (value === undefined)
21
+ return 'undefined';
22
+ if (Array.isArray(value))
23
+ return `[${value.map((v) => canonicalJson(v)).join(',')}]`;
24
+ if (value !== null && typeof value === 'object') {
25
+ const record = value;
26
+ const keys = Object.keys(record).sort();
27
+ return `{${keys.map((k) => `${JSON.stringify(k)}:${canonicalJson(record[k])}`).join(',')}}`;
28
+ }
29
+ return JSON.stringify(value);
30
+ }
31
+ /** `"Pro" → "Pro Plan"` — each side independently truncated (CLI plan 014 Step 4). */
32
+ function formatValueChange(oldValue, newValue) {
33
+ return `${truncate(canonicalJson(oldValue))} → ${truncate(canonicalJson(newValue))}`;
34
+ }
35
+ /**
36
+ * True iff the plan contains zero write operations. Deliberately ignores
37
+ * `warnings`/`unmanagedRemote` (informational, never a write) and
38
+ * `errors`/`featureDrift` (the command aborts before rendering when either
39
+ * is non-empty — see src/commands/push.ts). Exported so the command can
40
+ * reuse the exact same "is there anything to confirm" definition the
41
+ * renderer used to decide whether it printed "No changes." (CLI plan 008
42
+ * Step 3 point 5: the empty-plan short-circuit must agree with what was
43
+ * just printed).
44
+ */
45
+ export function isPushPlanEmpty(plan) {
46
+ return (plan.products.create.length === 0 &&
47
+ plan.products.patch.length === 0 &&
48
+ plan.features.create.length === 0 &&
49
+ plan.plans.create.length === 0 &&
50
+ plan.plans.patch.length === 0 &&
51
+ plan.entitlements.add.length === 0 &&
52
+ plan.entitlements.update.length === 0 &&
53
+ plan.entitlements.delete.length === 0 &&
54
+ plan.prices.bulkReplace.length === 0);
55
+ }
56
+ /**
57
+ * CLI plan 014 Step 4: one line per changed field — `~ update <noun> "<id>":
58
+ * <field> <old> → <new>` for the first field, ` <field> <old> → <new>`
59
+ * (indented, no repeated header) for every field after it. `previous`
60
+ * defaults to `{}` (an op predating this plan, or a hand-built test fixture
61
+ * that never set it) so a missing old value renders as `undefined` rather
62
+ * than throwing.
63
+ */
64
+ function formatPatchLines(noun, identifier, body, previous) {
65
+ const fields = Object.keys(body);
66
+ const prev = previous ?? {};
67
+ return fields.map((field, i) => {
68
+ const rendered = `${field} ${formatValueChange(prev[field], body[field])}`;
69
+ const line = i === 0 ? ` ~ update ${noun} "${identifier}": ${rendered}` : ` ${rendered}`;
70
+ return style.update(line);
71
+ });
72
+ }
73
+ function formatProductsSection(plan) {
74
+ if (plan.products.create.length === 0 && plan.products.patch.length === 0)
75
+ return [];
76
+ const lines = ['Products:'];
77
+ for (const op of plan.products.create)
78
+ lines.push(style.create(` + create ${op.identifier}`));
79
+ for (const op of plan.products.patch) {
80
+ lines.push(...formatPatchLines('product', op.identifier, op.body, op.previous));
81
+ }
82
+ return lines;
83
+ }
84
+ function formatFeaturesSection(plan) {
85
+ if (plan.features.create.length === 0)
86
+ return [];
87
+ const lines = ['Features:'];
88
+ for (const op of plan.features.create)
89
+ lines.push(style.create(` + create ${op.identifier}`));
90
+ return lines;
91
+ }
92
+ function formatPlansSection(plan) {
93
+ if (plan.plans.create.length === 0 && plan.plans.patch.length === 0)
94
+ return [];
95
+ const lines = ['Plans:'];
96
+ for (const op of plan.plans.create)
97
+ lines.push(style.create(` + create ${op.identifier}`));
98
+ for (const op of plan.plans.patch) {
99
+ lines.push(...formatPatchLines('plan', op.identifier, op.body, op.previous));
100
+ }
101
+ return lines;
102
+ }
103
+ /** Converge section (DESIGN-push.md §3): grouped per plan, in the order plans
104
+ * were first touched by an add/update/delete, each with a one-line count
105
+ * header and one line per operation naming the feature identifier. */
106
+ function formatEntitlementsSection(plan) {
107
+ const { add, update, delete: del } = plan.entitlements;
108
+ if (add.length === 0 && update.length === 0 && del.length === 0)
109
+ return [];
110
+ const planIdentifiers = [];
111
+ const seen = new Set();
112
+ for (const op of [...add, ...update, ...del]) {
113
+ if (!seen.has(op.planIdentifier)) {
114
+ seen.add(op.planIdentifier);
115
+ planIdentifiers.push(op.planIdentifier);
116
+ }
117
+ }
118
+ const lines = ['Entitlements:'];
119
+ for (const planIdentifier of planIdentifiers) {
120
+ const planAdd = add.filter((op) => op.planIdentifier === planIdentifier);
121
+ const planUpdate = update.filter((op) => op.planIdentifier === planIdentifier);
122
+ const planDelete = del.filter((op) => op.planIdentifier === planIdentifier);
123
+ const counts = [
124
+ planAdd.length > 0 ? plural(planAdd.length, 'add') : null,
125
+ planUpdate.length > 0 ? plural(planUpdate.length, 'update') : null,
126
+ planDelete.length > 0 ? plural(planDelete.length, 'delete') : null,
127
+ ]
128
+ .filter((part) => part !== null)
129
+ .join(', ');
130
+ lines.push(` ${planIdentifier}: ${counts}`);
131
+ for (const op of planAdd)
132
+ lines.push(` + add ${op.featureIdentifier}`);
133
+ for (const op of planUpdate) {
134
+ lines.push(style.update(` ~ update ${op.featureIdentifier}: ${formatValueChange(op.previousDetails, op.details)}`));
135
+ }
136
+ for (const op of planDelete)
137
+ lines.push(` - delete ${op.featureIdentifier}`);
138
+ }
139
+ return lines;
140
+ }
141
+ function formatPricesSection(plan) {
142
+ if (plan.prices.bulkReplace.length === 0)
143
+ return [];
144
+ const lines = ['Prices:'];
145
+ for (const op of plan.prices.bulkReplace) {
146
+ const remoteCount = op.remotePriceCount ?? 0;
147
+ const desiredCount = op.prices.length;
148
+ lines.push(style.update(` ~ replace prices for plan "${op.planIdentifier}" (${remoteCount} → ${plural(desiredCount, 'price')})`));
149
+ }
150
+ return lines;
151
+ }
152
+ /** DESIGN-push.md §5/§6: remote-only resources are left alone by default —
153
+ * listed here so an author notices before opting into removal (plan 010).
154
+ * When `pruneActive` (i.e. `--prune` was passed), features/plans are omitted
155
+ * here — they render in `formatArchiveSection`/`formatSkippedSection`
156
+ * instead — but products always stay, since products never leave this
157
+ * section (§5: never a prune candidate, marker or not). */
158
+ function formatRemoteOnlySection(plan, pruneActive) {
159
+ const { products, features, plans } = plan.unmanagedRemote;
160
+ const includeFeaturesPlans = !pruneActive;
161
+ const hasFeaturesPlans = includeFeaturesPlans && (features.length > 0 || plans.length > 0);
162
+ if (products.length === 0 && !hasFeaturesPlans)
163
+ return [];
164
+ const lines = ['Remote-only (left alone — not managed by this config):'];
165
+ for (const p of products)
166
+ lines.push(` - product ${p.identifier}`);
167
+ if (includeFeaturesPlans) {
168
+ for (const f of features)
169
+ lines.push(` - feature ${f.identifier}${f.managedByMarker ? ' (managed-by: kelviq-cli)' : ''}`);
170
+ for (const p of plans)
171
+ lines.push(` - plan ${p.identifier}${p.managedByMarker ? ' (managed-by: kelviq-cli)' : ''}`);
172
+ }
173
+ return lines.map((line) => style.dim(line));
174
+ }
175
+ /** CLI plan 010 `--prune`: the archive section, plans then features — matching DESIGN-push.md §8's execution order for the prune step. Omitted entirely when there is nothing to archive. */
176
+ function formatArchiveSection(prune) {
177
+ const { archivePlans, archiveFeatures } = prune;
178
+ if (archivePlans.length === 0 && archiveFeatures.length === 0)
179
+ return [];
180
+ const lines = ['Archive (--prune):'];
181
+ for (const identifier of archivePlans)
182
+ lines.push(` - archive plan ${identifier}`);
183
+ for (const identifier of archiveFeatures)
184
+ lines.push(` - archive feature ${identifier}`);
185
+ return lines.map((line) => style.archive(line));
186
+ }
187
+ /** CLI plan 010 `--prune`: remote-only plans/features that matched config history but carry no `managed-by: kelviq-cli` marker — never archived, listed with a reason so the asymmetry (marked -> archived, unmarked -> skipped) is visible in the same diff. Omitted entirely when nothing was skipped. */
188
+ function formatSkippedUnmanagedSection(prune) {
189
+ const { skippedPlans, skippedFeatures } = prune;
190
+ if (skippedPlans.length === 0 && skippedFeatures.length === 0)
191
+ return [];
192
+ const lines = ['Skipped (unmanaged — no kelviq-cli marker):'];
193
+ for (const s of skippedPlans)
194
+ lines.push(` - plan ${s.identifier}: ${s.reason}`);
195
+ for (const s of skippedFeatures)
196
+ lines.push(` - feature ${s.identifier}: ${s.reason}`);
197
+ return lines.map((line) => style.dim(line));
198
+ }
199
+ /** CLI plan 009 `--dry-run --publish` preview — see `RenderPushPlanOptions.publishPreview`. */
200
+ function formatPublishPreviewSection(preview) {
201
+ if (preview.planIdentifiers.length === 0)
202
+ return [];
203
+ const lines = ['Would publish (--publish, dry run — no writes happen):'];
204
+ for (const identifier of preview.planIdentifiers)
205
+ lines.push(` - ${identifier}`);
206
+ lines.push(` updateFeatures: ${preview.updateFeatures}, updatePricing: ${preview.updatePricing}`);
207
+ return lines;
208
+ }
209
+ // ---------------------------------------------------------------------------
210
+ // CLI plan 014 Step 3: price-drop warning aggregation (render-time only —
211
+ // `PushPlan.warnings` itself stays the raw, ungrouped list plan 015's
212
+ // `--json` needs).
213
+ // ---------------------------------------------------------------------------
214
+ const PRICE_DROP_WARNING_RE = /^Plan "([^"]+)" price: dropped "([^"]+)" \(server-owned field, not sent\)\.$/;
215
+ /** The last dot-separated segment of a dropped-path warning, e.g. `stripePriceId` out of `chargeCatalogPrice[0].charges[1].stripePriceId`. */
216
+ function leafName(path) {
217
+ const segments = path.split('.');
218
+ return segments[segments.length - 1] ?? path;
219
+ }
220
+ /**
221
+ * Groups price-filter dropped-path warnings per plan into one line each
222
+ * (`Plan "<id>" price: N server-owned fields stripped (<leaf names>) — use
223
+ * --verbose to list them.`), preserving each plan's first-occurrence
224
+ * position and passing every other (non-price-drop) warning through
225
+ * unchanged. Never mutates `warnings` itself. Non-price warnings (license
226
+ * drops, unresolved refs) never match `PRICE_DROP_WARNING_RE` and are always
227
+ * passed through as-is.
228
+ */
229
+ function aggregatePriceWarnings(warnings) {
230
+ const counts = new Map();
231
+ const leaves = new Map();
232
+ for (const w of warnings) {
233
+ const m = PRICE_DROP_WARNING_RE.exec(w);
234
+ if (!m)
235
+ continue;
236
+ const [, planIdentifier, path] = m;
237
+ counts.set(planIdentifier, (counts.get(planIdentifier) ?? 0) + 1);
238
+ if (!leaves.has(planIdentifier))
239
+ leaves.set(planIdentifier, new Set());
240
+ leaves.get(planIdentifier)?.add(leafName(path));
241
+ }
242
+ const emitted = new Set();
243
+ const out = [];
244
+ for (const w of warnings) {
245
+ const m = PRICE_DROP_WARNING_RE.exec(w);
246
+ if (!m) {
247
+ out.push(w);
248
+ continue;
249
+ }
250
+ const [, planIdentifier] = m;
251
+ if (emitted.has(planIdentifier))
252
+ continue;
253
+ emitted.add(planIdentifier);
254
+ const count = counts.get(planIdentifier) ?? 0;
255
+ const leafList = Array.from(leaves.get(planIdentifier) ?? []).sort();
256
+ out.push(`Plan "${planIdentifier}" price: ${plural(count, 'server-owned field')} stripped (${leafList.join(', ')}) — use --verbose to list them.`);
257
+ }
258
+ return out;
259
+ }
260
+ function formatWarningsSection(warnings, verbose) {
261
+ if (warnings.length === 0)
262
+ return [];
263
+ const rendered = verbose ? warnings : aggregatePriceWarnings(warnings);
264
+ const lines = [`Warnings (${rendered.length}):`];
265
+ for (const w of rendered)
266
+ lines.push(` - ${w}`);
267
+ return lines.map((line) => style.warn(line));
268
+ }
269
+ /** The one-line close: `3 creates, 1 update, 1 price replace, 2 warnings`
270
+ * (CLI plan 008 Step 1's own example). `creates` folds in entitlement adds,
271
+ * `updates` folds in entitlement updates (plus product/plan patches);
272
+ * entitlement deletes get their own `deletes` bucket since nothing else in
273
+ * this plan without `--prune` ever deletes a product/feature/plan.
274
+ * `archiveCount` (CLI plan 010) folds in plan/feature archives — 0 when
275
+ * `--prune` wasn't passed, keeping this line unchanged from before plan 010.
276
+ * `warningsCount` (CLI plan 014) is the RENDERED warning-line count (matching
277
+ * the "Warnings (N):" heading directly above it) — the aggregated count when
278
+ * price-drop warnings collapsed, the raw count under `--verbose`. */
279
+ function summaryText(plan, archiveCount, warningsCount) {
280
+ const creates = plan.products.create.length + plan.features.create.length + plan.plans.create.length + plan.entitlements.add.length;
281
+ const updates = plan.products.patch.length + plan.plans.patch.length + plan.entitlements.update.length;
282
+ const deletes = plan.entitlements.delete.length;
283
+ const priceReplaces = plan.prices.bulkReplace.length;
284
+ const parts = [];
285
+ if (creates > 0)
286
+ parts.push(plural(creates, 'create'));
287
+ if (updates > 0)
288
+ parts.push(plural(updates, 'update'));
289
+ if (deletes > 0)
290
+ parts.push(plural(deletes, 'delete'));
291
+ if (priceReplaces > 0)
292
+ parts.push(`${priceReplaces} price ${priceReplaces === 1 ? 'replace' : 'replaces'}`);
293
+ if (archiveCount > 0)
294
+ parts.push(plural(archiveCount, 'archive'));
295
+ if (warningsCount > 0)
296
+ parts.push(plural(warningsCount, 'warning'));
297
+ return parts.length > 0 ? parts.join(', ') : 'no changes';
298
+ }
299
+ /**
300
+ * Renders the full plan-of-record diff a `push` run confirms against
301
+ * (DESIGN-push.md §7 point 2). Sections appear in dependency order (§8,
302
+ * extended by CLI plan 010): products, features, plans, entitlements
303
+ * (converge), prices (replace), then (CLI plan 009) the `--dry-run
304
+ * --publish` preview, then (CLI plan 010) the `--prune` archive + skipped
305
+ * sections — matching prune's own "runs last" execution order — then
306
+ * remote-only (left alone; products only once `--prune` is active) and
307
+ * warnings. "No changes." replaces the operations block only when the plan
308
+ * has zero write operations AND (when `--prune` is active) zero archive
309
+ * operations — see `isPushPlanEmpty`/`prune.ts`'s `isPrunePlanEmpty` — but
310
+ * warnings/remote-only/archive/skipped info still renders beneath it when
311
+ * present. Always ends with the target environment name.
312
+ */
313
+ export function renderPushPlan(plan, { envName, directional, verbose, publishPreview, prune }) {
314
+ const archiveCount = prune ? prune.archivePlans.length + prune.archiveFeatures.length : 0;
315
+ const hasWrites = !isPushPlanEmpty(plan) || archiveCount > 0;
316
+ const blocks = [];
317
+ if (hasWrites) {
318
+ for (const section of [
319
+ formatProductsSection(plan),
320
+ formatFeaturesSection(plan),
321
+ formatPlansSection(plan),
322
+ formatEntitlementsSection(plan),
323
+ formatPricesSection(plan),
324
+ ]) {
325
+ if (section.length > 0)
326
+ blocks.push(section);
327
+ }
328
+ }
329
+ else {
330
+ blocks.push(['No changes.']);
331
+ }
332
+ if (publishPreview) {
333
+ const publishLines = formatPublishPreviewSection(publishPreview);
334
+ if (publishLines.length > 0)
335
+ blocks.push(publishLines);
336
+ }
337
+ if (prune) {
338
+ const archiveLines = formatArchiveSection(prune);
339
+ if (archiveLines.length > 0)
340
+ blocks.push(archiveLines);
341
+ const skippedLines = formatSkippedUnmanagedSection(prune);
342
+ if (skippedLines.length > 0)
343
+ blocks.push(skippedLines);
344
+ }
345
+ const remoteOnlyLines = formatRemoteOnlySection(plan, Boolean(prune));
346
+ if (remoteOnlyLines.length > 0)
347
+ blocks.push(remoteOnlyLines);
348
+ const warningLines = formatWarningsSection(plan.warnings, Boolean(verbose));
349
+ if (warningLines.length > 0)
350
+ blocks.push(warningLines);
351
+ const renderedWarningsCount = verbose ? plan.warnings.length : aggregatePriceWarnings(plan.warnings).length;
352
+ const targetLine = style.bold(`Target environment: ${envName}`);
353
+ blocks.push(hasWrites
354
+ ? [style.bold(`Summary: ${summaryText(plan, archiveCount, renderedWarningsCount)}`), directional ? style.warn(targetLine) : targetLine]
355
+ : [directional ? style.warn(targetLine) : targetLine]);
356
+ return blocks.map((block) => block.join('\n')).join('\n\n');
357
+ }
358
+ //# sourceMappingURL=render-plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-plan.js","sourceRoot":"","sources":["../../src/sync/render-plan.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AA+C3C,0OAA0O;AAC1O,MAAM,UAAU,MAAM,CAAC,CAAS,EAAE,IAAY;IAC5C,OAAO,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAC7C,CAAC;AAED,MAAM,eAAe,GAAG,EAAE,CA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CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CACxD,CAAC;IAEF,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { FeatureDef, PlanDef, ProductDef } from '../config-format/schema.js';
2
+ export interface SerializeInput {
3
+ products: ProductDef[];
4
+ features: FeatureDef[];
5
+ plans: PlanDef[];
6
+ }
7
+ export interface SerializeResult {
8
+ code: string;
9
+ warnings: string[];
10
+ }
11
+ /**
12
+ * Serializes translated defs into the text of a `kelviq.config.ts` module.
13
+ * Each def is pretty-printed as a JS object literal (unquoted keys where
14
+ * they're valid identifiers, single-quoted strings) into its builder call,
15
+ * so the output both typechecks against the plan-004 builder signatures and
16
+ * reads like a hand-written config file.
17
+ */
18
+ export declare function serializeConfig(input: SerializeInput): SerializeResult;