{"version":3,"file":"project-trust.d.ts","sourceRoot":"","sources":["../../src/cli/project-trust.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGnE,wBAAgB,yBAAyB,CAAC,OAAO,EAAE;IAClD,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,CAAC;IACd,eAAe,EAAE,eAAe,CAAC;IACjC,KAAK,EAAE,OAAO,CAAC;CACf,GAAG,mBAAmB,CAkDtB","sourcesContent":["import chalk from \"chalk\";\nimport type { ProjectTrustContext } from \"../core/extensions/types.ts\";\nimport type { AppMode } from \"../core/project-trust.ts\";\nimport type { SettingsManager } from \"../core/settings-manager.ts\";\nimport { showStartupInput, showStartupSelector } from \"./startup-ui.ts\";\n\nexport function createProjectTrustContext(options: {\n\tcwd: string;\n\tmode: AppMode;\n\tsettingsManager: SettingsManager;\n\thasUI: boolean;\n}): ProjectTrustContext {\n\treturn {\n\t\tcwd: options.cwd,\n\t\tmode: options.mode === \"interactive\" ? \"tui\" : options.mode,\n\t\thasUI: options.hasUI,\n\t\tui: {\n\t\t\tselect: async (title, selectOptions) => {\n\t\t\t\tif (!options.hasUI) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tif (options.mode !== \"interactive\") {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn showStartupSelector(\n\t\t\t\t\toptions.settingsManager,\n\t\t\t\t\ttitle,\n\t\t\t\t\tselectOptions.map((option) => ({ label: option, value: option })),\n\t\t\t\t);\n\t\t\t},\n\t\t\tconfirm: async (title, message) => {\n\t\t\t\tif (!options.hasUI) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (options.mode !== \"interactive\") {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t(await showStartupSelector(options.settingsManager, `${title}\\n${message}`, [\n\t\t\t\t\t\t{ label: \"Yes\", value: true },\n\t\t\t\t\t\t{ label: \"No\", value: false },\n\t\t\t\t\t])) ?? false\n\t\t\t\t);\n\t\t\t},\n\t\t\tinput: async (title, placeholder) => {\n\t\t\t\tif (!options.hasUI) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tif (options.mode !== \"interactive\") {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn showStartupInput(options.settingsManager, title, placeholder);\n\t\t\t},\n\t\t\tnotify: (message, type = \"info\") => {\n\t\t\t\tif (options.mode !== \"interactive\") {\n\t\t\t\t\tconst color = type === \"error\" ? chalk.red : type === \"warning\" ? chalk.yellow : chalk.cyan;\n\t\t\t\t\tconsole.error(color(message));\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t};\n}\n"]}