totopo 0.2.0 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "totopo",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Secure AI Box — isolated dev environments for AI coding assistants",
5
5
  "type": "module",
6
6
  "bin": {
@@ -79,6 +79,22 @@ if (mode === "host-mirror") {
79
79
 
80
80
  writeSettings(totopoDir, { runtimeMode: mode, selectedTools });
81
81
 
82
+ // ─── Commit scope ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
83
+ const scopeChoice = await select({
84
+ message: "Commit .totopo/ config to git?",
85
+ options: [
86
+ { value: "shared", label: "Shared — commit config files, only .env stays private" },
87
+ { value: "local", label: "Local only — add entire .totopo/ to .gitignore" },
88
+ ],
89
+ });
90
+
91
+ if (isCancel(scopeChoice)) {
92
+ cancel("Setup cancelled.");
93
+ process.exit(0);
94
+ }
95
+
96
+ const commitScope = scopeChoice as "shared" | "local";
97
+
82
98
  // ─── Create .env ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
83
99
  const envPath = join(totopoDir, ".env");
84
100
  if (existsSync(envPath)) {
@@ -88,17 +104,30 @@ if (existsSync(envPath)) {
88
104
  log.success("Created .totopo/.env");
89
105
  }
90
106
 
91
- // ─── Ensure .totopo/.env is gitignored ───────────────────────────────────────────────────────────────────────────────────────────────────
107
+ // ─── Gitignore ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
92
108
  const gitignorePath = join(repoRoot, ".gitignore");
93
- const gitignoreEntry = ".totopo/.env";
94
-
95
- if (existsSync(gitignorePath) && readFileSync(gitignorePath, "utf8").includes(gitignoreEntry)) {
96
- log.info(".totopo/.env already in .gitignore");
109
+ const gitignoreContent = existsSync(gitignorePath) ? readFileSync(gitignorePath, "utf8") : null;
110
+
111
+ if (commitScope === "local") {
112
+ const entry = ".totopo/";
113
+ const addition = "\n# totopo — config is local-only for this project\n.totopo/\n";
114
+ if (gitignoreContent !== null && gitignoreContent.includes(entry)) {
115
+ log.info(".totopo/ already in .gitignore");
116
+ } else {
117
+ const newContent = gitignoreContent !== null ? gitignoreContent + addition : addition;
118
+ writeFileSync(gitignorePath, newContent);
119
+ log.success("Added .totopo/ to .gitignore");
120
+ }
97
121
  } else {
122
+ const entry = ".totopo/.env";
98
123
  const addition = "\n# totopo — API keys must never be committed\n.totopo/.env\n";
99
- const existing = existsSync(gitignorePath) ? readFileSync(gitignorePath, "utf8") : "";
100
- writeFileSync(gitignorePath, existing + addition);
101
- log.success("Added .totopo/.env to .gitignore");
124
+ if (gitignoreContent !== null && gitignoreContent.includes(entry)) {
125
+ log.info(".totopo/.env already in .gitignore");
126
+ } else {
127
+ const newContent = gitignoreContent !== null ? gitignoreContent + addition : addition;
128
+ writeFileSync(gitignorePath, newContent);
129
+ log.success("Added .totopo/.env to .gitignore");
130
+ }
102
131
  }
103
132
 
104
133
  log.warn("Add your API keys to .totopo/.env before starting the container.");