@posthog/wizard 0.2.2

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 (72) hide show
  1. package/LICENSE +47 -0
  2. package/README.md +34 -0
  3. package/dist/bin.d.ts +2 -0
  4. package/dist/bin.js +28 -0
  5. package/dist/bin.js.map +1 -0
  6. package/dist/src/lib/constants.d.ts +20 -0
  7. package/dist/src/lib/constants.js +34 -0
  8. package/dist/src/lib/constants.js.map +1 -0
  9. package/dist/src/nextjs/docs.d.ts +8 -0
  10. package/dist/src/nextjs/docs.js +235 -0
  11. package/dist/src/nextjs/docs.js.map +1 -0
  12. package/dist/src/nextjs/nextjs-wizard.d.ts +9 -0
  13. package/dist/src/nextjs/nextjs-wizard.js +331 -0
  14. package/dist/src/nextjs/nextjs-wizard.js.map +1 -0
  15. package/dist/src/nextjs/prompts.d.ts +12 -0
  16. package/dist/src/nextjs/prompts.js +64 -0
  17. package/dist/src/nextjs/prompts.js.map +1 -0
  18. package/dist/src/nextjs/utils.d.ts +9 -0
  19. package/dist/src/nextjs/utils.js +80 -0
  20. package/dist/src/nextjs/utils.js.map +1 -0
  21. package/dist/src/run.d.ts +8 -0
  22. package/dist/src/run.js +69 -0
  23. package/dist/src/run.js.map +1 -0
  24. package/dist/src/telemetry.d.ts +2 -0
  25. package/dist/src/telemetry.js +13 -0
  26. package/dist/src/telemetry.js.map +1 -0
  27. package/dist/src/utils/analytics.d.ts +4 -0
  28. package/dist/src/utils/analytics.js +10 -0
  29. package/dist/src/utils/analytics.js.map +1 -0
  30. package/dist/src/utils/bash.d.ts +2 -0
  31. package/dist/src/utils/bash.js +54 -0
  32. package/dist/src/utils/bash.js.map +1 -0
  33. package/dist/src/utils/clack-utils.d.ts +177 -0
  34. package/dist/src/utils/clack-utils.js +628 -0
  35. package/dist/src/utils/clack-utils.js.map +1 -0
  36. package/dist/src/utils/clack.d.ts +2 -0
  37. package/dist/src/utils/clack.js +9 -0
  38. package/dist/src/utils/clack.js.map +1 -0
  39. package/dist/src/utils/debug.d.ts +2 -0
  40. package/dist/src/utils/debug.js +22 -0
  41. package/dist/src/utils/debug.js.map +1 -0
  42. package/dist/src/utils/environment.d.ts +1 -0
  43. package/dist/src/utils/environment.js +12 -0
  44. package/dist/src/utils/environment.js.map +1 -0
  45. package/dist/src/utils/file-utils.d.ts +2 -0
  46. package/dist/src/utils/file-utils.js +38 -0
  47. package/dist/src/utils/file-utils.js.map +1 -0
  48. package/dist/src/utils/logging.d.ts +9 -0
  49. package/dist/src/utils/logging.js +50 -0
  50. package/dist/src/utils/logging.js.map +1 -0
  51. package/dist/src/utils/package-json.d.ts +25 -0
  52. package/dist/src/utils/package-json.js +27 -0
  53. package/dist/src/utils/package-json.js.map +1 -0
  54. package/dist/src/utils/package-manager.d.ts +19 -0
  55. package/dist/src/utils/package-manager.js +188 -0
  56. package/dist/src/utils/package-manager.js.map +1 -0
  57. package/dist/src/utils/query.d.ts +6 -0
  58. package/dist/src/utils/query.js +27 -0
  59. package/dist/src/utils/query.js.map +1 -0
  60. package/dist/src/utils/semver.d.ts +5 -0
  61. package/dist/src/utils/semver.js +25 -0
  62. package/dist/src/utils/semver.js.map +1 -0
  63. package/dist/src/utils/string.d.ts +1 -0
  64. package/dist/src/utils/string.js +9 -0
  65. package/dist/src/utils/string.js.map +1 -0
  66. package/dist/src/utils/types.d.ts +30 -0
  67. package/dist/src/utils/types.js +3 -0
  68. package/dist/src/utils/types.js.map +1 -0
  69. package/dist/src/utils/vendor/is-unicorn-supported.d.ts +1 -0
  70. package/dist/src/utils/vendor/is-unicorn-supported.js +24 -0
  71. package/dist/src/utils/vendor/is-unicorn-supported.js.map +1 -0
  72. package/package.json +135 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/run.ts"],"names":[],"mappings":";;;;;AAiBA,kBA0BC;AA3CD,qDAAuD;AAGvD,0DAAuE;AAEvE,+CAAyE;AAEzE,qCAAuC;AACvC,qDAAsD;AACtD,0DAAkC;AAQ3B,KAAK,UAAU,GAAG,CAAC,IAAU;IAClC,MAAM,SAAS,GAAG;QAChB,GAAG,IAAI;QACP,GAAG,IAAA,6BAAe,GAAE;KACrB,CAAC;IAGF,eAAK,CAAC,KAAK,CAAC,kBAAkB,mBAAmB,EAAE,EAAE,CAAC,CAAC;IAEvD,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,IAAI,MAAM,sBAAsB,EAAE,CAAC;IAG5E,MAAM,aAAa,GAAkB;QACnC,KAAK,EAAE,SAAS,CAAC,KAAK,IAAI,KAAK;QAC/B,YAAY,EAAE,SAAS,CAAC,YAAY,IAAI,KAAK;QAC7C,gBAAgB,EAAE,KAAK;KACxB,CAAC;IAEF,QAAQ,WAAW,EAAE,CAAC;QACpB,KAAK,uBAAW,CAAC,MAAM;YACrB,MAAM,IAAA,+BAAe,EAAC,aAAa,CAAC,CAAC;YACrC,MAAM;QAER;YACE,eAAK,CAAC,GAAG,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;IACjD,CAAC;AACH,CAAC;AAED,SAAS,mBAAmB;IAC1B,IAAI,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;IAC9C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAC9B,IAAA,sBAAY,EAAC,iBAAiB,EAAE,OAAO,CAAC,CACvB,CAAC;YACpB,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;QAClC,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;IACH,CAAC;IACD,OAAO,OAAO,IAAI,EAAE,CAAC;AACvB,CAAC;AAGD,KAAK,UAAU,iBAAiB;IAE9B,MAAM,SAAS,GAAG;QAChB,4BAAY;KACb,CAAA;IAED,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,MAAM,QAAQ,EAAE,CAAC;QACrC,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,WAAW,CAAC;QACrB,CAAC;IACH,CAAC;AACH,CAAC;AAED,KAAK,UAAU,sBAAsB;IAEnC,MAAM,mBAAmB,GAAG,MAAM,iBAAiB,EAAE,CAAC;IAEtD,IAAI,mBAAmB,EAAE,CAAC;QACxB,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC,yBAAyB,IAAA,qCAAyB,EAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;QAC7F,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED,MAAM,WAAW,GAAgB,MAAM,IAAA,8BAAgB,EACrD,eAAK,CAAC,MAAM,CAAC;QACX,OAAO,EAAE,6BAA6B;QACtC,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,uBAAW,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;KAC3D,CAAC,CACH,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import { abortIfCancelled } from './utils/clack-utils';\n\nimport type { WizardOptions } from './utils/types';\nimport { detectNextJs, runNextjsWizard } from './nextjs/nextjs-wizard';\n\nimport { getIntegrationDescription, Integration } from './lib/constants';\nimport type { PackageDotJson } from './utils/package-json';\nimport { readFileSync } from 'node:fs';\nimport { readEnvironment } from './utils/environment';\nimport clack from './utils/clack';\n\n\ntype Args = {\n integration?: Integration;\n debug?: boolean;\n forceInstall?: boolean;\n};\nexport async function run(argv: Args) {\n const finalArgs = {\n ...argv,\n ...readEnvironment(),\n };\n\n\n clack.intro(`PostHog Wizard ${tryGetWizardVersion()}`);\n\n const integration = finalArgs.integration ?? await getIntegrationForSetup();\n\n\n const wizardOptions: WizardOptions = {\n debug: finalArgs.debug ?? false,\n forceInstall: finalArgs.forceInstall ?? false,\n telemetryEnabled: false,\n };\n\n switch (integration) {\n case Integration.nextjs:\n await runNextjsWizard(wizardOptions);\n break;\n\n default:\n clack.log.error('No setup wizard selected!');\n }\n}\n\nfunction tryGetWizardVersion(): string {\n let version = process.env.npm_package_version;\n if (!version) {\n try {\n const wizardPkgJson = JSON.parse(\n readFileSync('../package.json', 'utf-8'),\n ) as PackageDotJson;\n version = wizardPkgJson.version;\n } catch {\n // ignore\n }\n }\n return version ?? '';\n}\n\n\nasync function detectIntegration(): Promise<Integration | undefined> {\n\n const detectors = [\n detectNextJs\n ]\n\n for (const detector of detectors) {\n const integration = await detector();\n if (integration) {\n return integration;\n }\n }\n}\n\nasync function getIntegrationForSetup() {\n\n const detectedIntegration = await detectIntegration();\n\n if (detectedIntegration) {\n clack.log.success(`Detected integration: ${getIntegrationDescription(detectedIntegration)}`);\n return detectedIntegration;\n }\n\n const integration: Integration = await abortIfCancelled(\n clack.select({\n message: 'What do you want to set up?',\n options: [{ value: Integration.nextjs, label: 'Next.js' }],\n }),\n );\n\n return integration;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function traceStep<T>(step: string, callback: () => T): T;
2
+ export declare function updateProgress(step: string): void;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.traceStep = traceStep;
4
+ exports.updateProgress = updateProgress;
5
+ const analytics_1 = require("./utils/analytics");
6
+ function traceStep(step, callback) {
7
+ updateProgress(step);
8
+ return callback();
9
+ }
10
+ function updateProgress(step) {
11
+ analytics_1.Analytics.setTag('progress', step);
12
+ }
13
+ //# sourceMappingURL=telemetry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../src/telemetry.ts"],"names":[],"mappings":";;AAMA,8BAMC;AAED,wCAEC;AAhBD,iDAA8C;AAM9C,SAAgB,SAAS,CACvB,IAAY,EACZ,QAAiB;IAEjB,cAAc,CAAC,IAAI,CAAC,CAAC;IACrB,OAAO,QAAQ,EAAE,CAAC;AACpB,CAAC;AAED,SAAgB,cAAc,CAAC,IAAY;IACzC,qBAAS,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import { Analytics } from './utils/analytics';\n\n\n\n\n\nexport function traceStep<T>(\n step: string,\n callback: () => T,\n): T {\n updateProgress(step);\n return callback();\n}\n\nexport function updateProgress(step: string) {\n Analytics.setTag('progress', step);\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export declare class Analytics {
2
+ constructor();
3
+ static setTag(key: string, value: string | boolean | number | null | undefined): void;
4
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Analytics = void 0;
4
+ class Analytics {
5
+ constructor() { }
6
+ static setTag(key, value) {
7
+ }
8
+ }
9
+ exports.Analytics = Analytics;
10
+ //# sourceMappingURL=analytics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../src/utils/analytics.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAS;IACpB,gBAAgB,CAAC;IAEjB,MAAM,CAAC,MAAM,CAAC,GAAW,EAAE,KAAmD;IAC9E,CAAC;CAGF;AAPD,8BAOC","sourcesContent":["export class Analytics {\n constructor() { }\n\n static setTag(key: string, value: string | boolean | number | null | undefined) {\n }\n\n\n}"]}
@@ -0,0 +1,2 @@
1
+ export declare function executeSync(command: string): string;
2
+ export declare function execute(command: string): Promise<string>;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.executeSync = executeSync;
37
+ exports.execute = execute;
38
+ const child_process = __importStar(require("child_process"));
39
+ function executeSync(command) {
40
+ const output = child_process.execSync(command);
41
+ return output.toString();
42
+ }
43
+ function execute(command) {
44
+ return new Promise((resolve, reject) => {
45
+ child_process.exec(command, (error, stdout, _) => {
46
+ if (error) {
47
+ reject(error);
48
+ return;
49
+ }
50
+ resolve(stdout);
51
+ });
52
+ });
53
+ }
54
+ //# sourceMappingURL=bash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bash.js","sourceRoot":"","sources":["../../../src/utils/bash.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kCAGC;AAED,0BAWC;AAlBD,6DAA+C;AAE/C,SAAgB,WAAW,CAAC,OAAe;IACzC,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC3B,CAAC;AAED,SAAgB,OAAO,CAAC,OAAe;IACrC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE;YAC/C,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,CAAC,KAAK,CAAC,CAAC;gBACd,OAAO;YACT,CAAC;YAED,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import * as child_process from 'child_process';\n\nexport function executeSync(command: string): string {\n const output = child_process.execSync(command);\n return output.toString();\n}\n\nexport function execute(command: string): Promise<string> {\n return new Promise((resolve, reject) => {\n child_process.exec(command, (error, stdout, _) => {\n if (error) {\n reject(error);\n return;\n }\n\n resolve(stdout);\n });\n });\n}\n"]}
@@ -0,0 +1,177 @@
1
+ import { type PackageDotJson } from './package-json';
2
+ import { type PackageManager } from './package-manager';
3
+ import type { Feature, WizardOptions } from './types';
4
+ export interface CliSetupConfig {
5
+ filename: string;
6
+ name: string;
7
+ gitignore: boolean;
8
+ likelyAlreadyHasAuthToken(contents: string): boolean;
9
+ tokenContent(authToken: string): string;
10
+ likelyAlreadyHasOrgAndProject(contents: string): boolean;
11
+ orgAndProjContent(org: string, project: string): string;
12
+ likelyAlreadyHasUrl?(contents: string): boolean;
13
+ urlContent?(url: string): string;
14
+ }
15
+ export interface CliSetupConfigContent {
16
+ authToken: string;
17
+ org?: string;
18
+ project?: string;
19
+ url?: string;
20
+ }
21
+ export declare function abort(message?: string, status?: number): Promise<never>;
22
+ export declare function abortIfCancelled<T>(input: T | Promise<T>): Promise<Exclude<T, symbol>>;
23
+ export declare function printWelcome(options: {
24
+ wizardName: string;
25
+ message?: string;
26
+ telemetryEnabled?: boolean;
27
+ }): void;
28
+ export declare function confirmContinueIfNoOrDirtyGitRepo(): Promise<void>;
29
+ export declare function isInGitRepo(): boolean;
30
+ export declare function getUncommittedOrUntrackedFiles(): string[];
31
+ export declare function askForItemSelection(items: string[], message: string): Promise<{
32
+ value: string;
33
+ index: number;
34
+ }>;
35
+ export declare function confirmContinueIfPackageVersionNotSupported({ packageId, packageName, packageVersion, acceptableVersions, note, }: {
36
+ packageId: string;
37
+ packageName: string;
38
+ packageVersion: string;
39
+ acceptableVersions: string;
40
+ note?: string;
41
+ }): Promise<void>;
42
+ /**
43
+ * Installs or updates a package with the user's package manager.
44
+ *
45
+ * IMPORTANT: This function modifies the `package.json`! Be sure to re-read
46
+ * it if you make additional modifications to it after calling this function!
47
+ */
48
+ export declare function installPackage({ packageName, alreadyInstalled, askBeforeUpdating, packageNameDisplayLabel, packageManager, forceInstall, }: {
49
+ /** The string that is passed to the package manager CLI as identifier to install (e.g. `posthog-js`, or `posthog-js@^1.100.0`) */
50
+ packageName: string;
51
+ alreadyInstalled: boolean;
52
+ askBeforeUpdating?: boolean;
53
+ /** Overrides what is shown in the installation logs in place of the `packageName` option. Useful if the `packageName` is ugly */
54
+ packageNameDisplayLabel?: string;
55
+ packageManager?: PackageManager;
56
+ /** Add force install flag to command to skip install precondition fails */
57
+ forceInstall?: boolean;
58
+ }): Promise<{
59
+ packageManager?: PackageManager;
60
+ }>;
61
+ export declare function runPrettierIfInstalled(): Promise<void>;
62
+ /**
63
+ * Checks if @param packageId is listed as a dependency in @param packageJson.
64
+ * If not, it will ask users if they want to continue without the package.
65
+ *
66
+ * Use this function to check if e.g. a the framework of the SDK is installed
67
+ *
68
+ * @param packageJson the package.json object
69
+ * @param packageId the npm name of the package
70
+ * @param packageName a human readable name of the package
71
+ */
72
+ export declare function ensurePackageIsInstalled(packageJson: PackageDotJson, packageId: string, packageName: string): Promise<void>;
73
+ export declare function getPackageDotJson(): Promise<PackageDotJson>;
74
+ export declare function updatePackageDotJson(packageDotJson: PackageDotJson): Promise<void>;
75
+ export declare function getPackageManager(): Promise<PackageManager>;
76
+ export declare function isUsingTypeScript(): boolean;
77
+ /**
78
+ * Checks if we already got project data from a previous wizard invocation.
79
+ * If yes, this data is returned.
80
+ * Otherwise, we start the login flow and ask the user to select a project.
81
+ *
82
+ * Use this function to get project data for the wizard.
83
+ *
84
+ * @param options wizard options
85
+ * @returns project data (token, url)
86
+ */
87
+ export declare function getOrAskForProjectData(_options: WizardOptions): Promise<{
88
+ wizardHash: string;
89
+ host: string;
90
+ projectApiKey: string;
91
+ }>;
92
+ /**
93
+ * Asks users if they have a config file for @param tool (e.g. Vite).
94
+ * If yes, asks users to specify the path to their config file.
95
+ *
96
+ * Use this helper function as a fallback mechanism if the lookup for
97
+ * a config file with its most usual location/name fails.
98
+ *
99
+ * @param toolName Name of the tool for which we're looking for the config file
100
+ * @param configFileName Name of the most common config file name (e.g. vite.config.js)
101
+ *
102
+ * @returns a user path to the config file or undefined if the user doesn't have a config file
103
+ */
104
+ export declare function askForToolConfigPath(toolName: string, configFileName: string): Promise<string | undefined>;
105
+ /**
106
+ * Prints copy/paste-able instructions to the console.
107
+ * Afterwards asks the user if they added the code snippet to their file.
108
+ *
109
+ * While there's no point in providing a "no" answer here, it gives users time to fulfill the
110
+ * task before the wizard continues with additional steps.
111
+ *
112
+ * Use this function if you want to show users instructions on how to add/modify
113
+ * code in their file. This is helpful if automatic insertion failed or is not possible/feasible.
114
+ *
115
+ * @param filename the name of the file to which the code snippet should be applied.
116
+ * If a path is provided, only the filename will be used.
117
+ *
118
+ * @param codeSnippet the snippet to be printed. Use {@link makeCodeSnippet} to create the
119
+ * diff-like format for visually highlighting unchanged or modified lines of code.
120
+ *
121
+ * @param hint (optional) a hint to be printed after the main instruction to add
122
+ * the code from @param codeSnippet to their @param filename.
123
+ *
124
+ * TODO: refactor copy paste instructions across different wizards to use this function.
125
+ * this might require adding a custom message parameter to the function
126
+ */
127
+ export declare function showCopyPasteInstructions(filename: string, codeSnippet: string, hint?: string): Promise<void>;
128
+ /**
129
+ * Callback that exposes formatting helpers for a code snippet.
130
+ * @param unchanged - Formats text as old code.
131
+ * @param plus - Formats text as new code.
132
+ * @param minus - Formats text as removed code.
133
+ */
134
+ type CodeSnippetFormatter = (unchanged: (txt: string) => string, plus: (txt: string) => string, minus: (txt: string) => string) => string;
135
+ /**
136
+ * Crafts a code snippet that can be used to e.g.
137
+ * - print copy/paste instructions to the console
138
+ * - create a new config file.
139
+ *
140
+ * @param colors set this to true if you want the final snippet to be colored.
141
+ * This is useful for printing the snippet to the console as part of copy/paste instructions.
142
+ *
143
+ * @param callback the callback that returns the formatted code snippet.
144
+ * It exposes takes the helper functions for marking code as unchanged, new or removed.
145
+ * These functions no-op if no special formatting should be applied
146
+ * and otherwise apply the appropriate formatting/coloring.
147
+ * (@see {@link CodeSnippetFormatter})
148
+ *
149
+ * @see {@link showCopyPasteInstructions} for the helper with which to display the snippet in the console.
150
+ *
151
+ * @returns a string containing the final, formatted code snippet.
152
+ */
153
+ export declare function makeCodeSnippet(colors: boolean, callback: CodeSnippetFormatter): string;
154
+ /**
155
+ * Creates a new config file with the given @param filepath and @param codeSnippet.
156
+ *
157
+ * Use this function to create a new config file for users. This is useful
158
+ * when users answered that they don't yet have a config file for a tool.
159
+ *
160
+ * (This doesn't mean that they don't yet have some other way of configuring
161
+ * their tool but we can leave it up to them to figure out how to merge configs
162
+ * here.)
163
+ *
164
+ * @param filepath absolute path to the new config file
165
+ * @param codeSnippet the snippet to be inserted into the file
166
+ * @param moreInformation (optional) the message to be printed after the file was created
167
+ * For example, this can be a link to more information about configuring the tool.
168
+ *
169
+ * @returns true on success, false otherwise
170
+ */
171
+ export declare function createNewConfigFile(filepath: string, codeSnippet: string, moreInformation?: string): Promise<boolean>;
172
+ export declare function featureSelectionPrompt<F extends ReadonlyArray<Feature>>(features: F): Promise<{
173
+ [key in F[number]['id']]: boolean;
174
+ }>;
175
+ export declare function askShouldInstallPackage(pkgName: string): Promise<boolean>;
176
+ export declare function askShouldAddPackageOverride(pkgName: string, pkgVersion: string): Promise<boolean>;
177
+ export {};