@nmakarov/cli-toolkit 0.32.0 → 0.36.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.
package/dist/init.cjs CHANGED
@@ -1866,6 +1866,43 @@ var Params = class _Params {
1866
1866
  module: moduleName ?? this._currentModule
1867
1867
  });
1868
1868
  }
1869
+ /**
1870
+ * Report a param value that a component RESOLVED ON ITS OWN — outside
1871
+ * Params.get() — e.g. discovered by combining its config files (the way
1872
+ * blueprints merge defaults/aggregator/feed data). Without this, every
1873
+ * key such a component probed for an override shows up in the
1874
+ * --showUsedParams dump as "undefined (default)"; reporting upgrades the
1875
+ * entry to the value the component actually works with.
1876
+ *
1877
+ * Attribution rules:
1878
+ * - entries figured from an explicit input (cli/env/options/…) are left
1879
+ * untouched — the component merely confirmed them, the origin stands;
1880
+ * - entries whose source is "default" (Params had nothing) are upgraded
1881
+ * in place to the reported value and source;
1882
+ * - keys never seen by Params are appended as new entries.
1883
+ * First report wins: once upgraded, later reports for the same key/module
1884
+ * are ignored (the source is no longer "default").
1885
+ *
1886
+ * @param {string} key
1887
+ * @param {*} value - the value the component actually uses
1888
+ * @param {string} [source="discovered"] - short origin label, e.g. "blueprint"
1889
+ * @param {string} [moduleName] - dump section; defaults to the current module
1890
+ */
1891
+ reportResolved(key, value, source = "discovered", moduleName) {
1892
+ const mod = moduleName ?? this._currentModule;
1893
+ const mine = this.trackedParams.filter((e) => e.key === key && e.module === mod);
1894
+ if (mine.some((e) => e.source !== "default")) {
1895
+ return;
1896
+ }
1897
+ if (mine.length === 0) {
1898
+ this.trackParam(key, "reported", value, source, mod);
1899
+ return;
1900
+ }
1901
+ for (const entry of mine) {
1902
+ entry.value = value;
1903
+ entry.source = source;
1904
+ }
1905
+ }
1869
1906
  /**
1870
1907
  * Get all tracked parameters (for --stopAfter=init)
1871
1908
  */