@conto_finance/create-conto-agent 0.4.3 → 0.4.5

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.
@@ -112,6 +112,32 @@ function ensureEnvLocalGitignored(dir) {
112
112
  fs.writeFileSync(gitignorePath, `${current}${separator}${comment}.env.local
113
113
  `);
114
114
  }
115
+ var SANDBOX_SETUP_ENV_FILE = path.join(".conto", "sandbox-setup.env");
116
+ function writeSandboxSetupEnv(dir, entries) {
117
+ const setupDir = path.join(dir, ".conto");
118
+ if (!fs.existsSync(setupDir)) {
119
+ fs.mkdirSync(setupDir, { recursive: true, mode: PRIVATE_DIR_MODE });
120
+ }
121
+ fs.chmodSync(setupDir, PRIVATE_DIR_MODE);
122
+ const lines = entries.map(
123
+ (entry) => typeof entry === "string" ? entry : `${entry[0]}=${entry[1]}`
124
+ );
125
+ writePrivateFile(path.join(dir, SANDBOX_SETUP_ENV_FILE), lines.join("\n") + "\n");
126
+ return SANDBOX_SETUP_ENV_FILE;
127
+ }
128
+ function ensureContoDirGitignored(dir) {
129
+ const gitignorePath = path.join(dir, ".gitignore");
130
+ const current = fs.existsSync(gitignorePath) ? fs.readFileSync(gitignorePath, "utf8") : "";
131
+ const alreadyIgnored = current.split(/\r?\n/).map((line) => line.trim()).some((line) => [".conto", ".conto/", "/.conto", "/.conto/"].includes(line));
132
+ if (alreadyIgnored) return;
133
+ const separator = current.length === 0 || current.endsWith("\n") ? "" : "\n";
134
+ fs.writeFileSync(
135
+ gitignorePath,
136
+ `${current}${separator}# Conto local credentials and setup state
137
+ .conto/
138
+ `
139
+ );
140
+ }
115
141
  function writeContoConfig(dir, config) {
116
142
  fs.writeFileSync(path.join(dir, "conto.config.json"), JSON.stringify(config, null, 2) + "\n");
117
143
  }
@@ -147,6 +173,9 @@ export {
147
173
  loadConfig,
148
174
  writeEnvLocal,
149
175
  ensureEnvLocalGitignored,
176
+ SANDBOX_SETUP_ENV_FILE,
177
+ writeSandboxSetupEnv,
178
+ ensureContoDirGitignored,
150
179
  writeContoConfig,
151
180
  clearGlobalConfig,
152
181
  isSensitiveConfigKey,