mini-trellis 0.1.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.
Files changed (186) hide show
  1. package/COPYRIGHT +20 -0
  2. package/LICENSE +235 -0
  3. package/README.md +66 -0
  4. package/bin/mini-trellis.js +3 -0
  5. package/dist/cli/index.d.ts +3 -0
  6. package/dist/cli/index.d.ts.map +1 -0
  7. package/dist/cli/index.js +153 -0
  8. package/dist/cli/index.js.map +1 -0
  9. package/dist/commands/init.d.ts +19 -0
  10. package/dist/commands/init.d.ts.map +1 -0
  11. package/dist/commands/init.js +401 -0
  12. package/dist/commands/init.js.map +1 -0
  13. package/dist/commands/mem.d.ts +30 -0
  14. package/dist/commands/mem.d.ts.map +1 -0
  15. package/dist/commands/mem.js +412 -0
  16. package/dist/commands/mem.js.map +1 -0
  17. package/dist/commands/migrate.d.ts +40 -0
  18. package/dist/commands/migrate.d.ts.map +1 -0
  19. package/dist/commands/migrate.js +272 -0
  20. package/dist/commands/migrate.js.map +1 -0
  21. package/dist/commands/uninstall.d.ts +11 -0
  22. package/dist/commands/uninstall.d.ts.map +1 -0
  23. package/dist/commands/uninstall.js +135 -0
  24. package/dist/commands/uninstall.js.map +1 -0
  25. package/dist/commands/upgrade.d.ts +28 -0
  26. package/dist/commands/upgrade.d.ts.map +1 -0
  27. package/dist/commands/upgrade.js +84 -0
  28. package/dist/commands/upgrade.js.map +1 -0
  29. package/dist/configurators/claude.d.ts +3 -0
  30. package/dist/configurators/claude.d.ts.map +1 -0
  31. package/dist/configurators/claude.js +62 -0
  32. package/dist/configurators/claude.js.map +1 -0
  33. package/dist/configurators/codex.d.ts +3 -0
  34. package/dist/configurators/codex.d.ts.map +1 -0
  35. package/dist/configurators/codex.js +21 -0
  36. package/dist/configurators/codex.js.map +1 -0
  37. package/dist/configurators/index.d.ts +24 -0
  38. package/dist/configurators/index.d.ts.map +1 -0
  39. package/dist/configurators/index.js +80 -0
  40. package/dist/configurators/index.js.map +1 -0
  41. package/dist/configurators/opencode.d.ts +2 -0
  42. package/dist/configurators/opencode.d.ts.map +1 -0
  43. package/dist/configurators/opencode.js +62 -0
  44. package/dist/configurators/opencode.js.map +1 -0
  45. package/dist/configurators/pi.d.ts +2 -0
  46. package/dist/configurators/pi.d.ts.map +1 -0
  47. package/dist/configurators/pi.js +18 -0
  48. package/dist/configurators/pi.js.map +1 -0
  49. package/dist/configurators/shared.d.ts +147 -0
  50. package/dist/configurators/shared.d.ts.map +1 -0
  51. package/dist/configurators/shared.js +377 -0
  52. package/dist/configurators/shared.js.map +1 -0
  53. package/dist/configurators/workflow.d.ts +15 -0
  54. package/dist/configurators/workflow.d.ts.map +1 -0
  55. package/dist/configurators/workflow.js +46 -0
  56. package/dist/configurators/workflow.js.map +1 -0
  57. package/dist/constants/paths.d.ts +74 -0
  58. package/dist/constants/paths.d.ts.map +1 -0
  59. package/dist/constants/paths.js +83 -0
  60. package/dist/constants/paths.js.map +1 -0
  61. package/dist/constants/version.d.ts +9 -0
  62. package/dist/constants/version.d.ts.map +1 -0
  63. package/dist/constants/version.js +15 -0
  64. package/dist/constants/version.js.map +1 -0
  65. package/dist/index.d.ts +9 -0
  66. package/dist/index.d.ts.map +1 -0
  67. package/dist/index.js +9 -0
  68. package/dist/index.js.map +1 -0
  69. package/dist/templates/claude/index.d.ts +11 -0
  70. package/dist/templates/claude/index.d.ts.map +1 -0
  71. package/dist/templates/claude/index.js +17 -0
  72. package/dist/templates/claude/index.js.map +1 -0
  73. package/dist/templates/claude/settings.json +40 -0
  74. package/dist/templates/codex/config.toml +39 -0
  75. package/dist/templates/codex/hooks.json +15 -0
  76. package/dist/templates/codex/index.d.ts +11 -0
  77. package/dist/templates/codex/index.d.ts.map +1 -0
  78. package/dist/templates/codex/index.js +22 -0
  79. package/dist/templates/codex/index.js.map +1 -0
  80. package/dist/templates/common/bundled-skills/mini-trellis-session-insight/SKILL.md +37 -0
  81. package/dist/templates/common/bundled-skills/mini-trellis-session-insight/references/cli-quick-reference.md +36 -0
  82. package/dist/templates/common/bundled-skills/mini-trellis-session-insight/references/triggering-patterns.md +93 -0
  83. package/dist/templates/common/commands/remember.md +22 -0
  84. package/dist/templates/common/index.d.ts +48 -0
  85. package/dist/templates/common/index.d.ts.map +1 -0
  86. package/dist/templates/common/index.js +104 -0
  87. package/dist/templates/common/index.js.map +1 -0
  88. package/dist/templates/common/skills/update-spec.md +16 -0
  89. package/dist/templates/extract.d.ts +40 -0
  90. package/dist/templates/extract.d.ts.map +1 -0
  91. package/dist/templates/extract.js +106 -0
  92. package/dist/templates/extract.js.map +1 -0
  93. package/dist/templates/markdown/agents.md +15 -0
  94. package/dist/templates/markdown/index.d.ts +10 -0
  95. package/dist/templates/markdown/index.d.ts.map +1 -0
  96. package/dist/templates/markdown/index.js +18 -0
  97. package/dist/templates/markdown/index.js.map +1 -0
  98. package/dist/templates/markdown/research-readme.md +9 -0
  99. package/dist/templates/markdown/spec/guides/index.md.txt +5 -0
  100. package/dist/templates/markdown/spec/guides/mini-memory.md.txt +30 -0
  101. package/dist/templates/markdown/workspace-index.md +23 -0
  102. package/dist/templates/opencode/lib/context-visibility.js +148 -0
  103. package/dist/templates/opencode/lib/session-utils.js +394 -0
  104. package/dist/templates/opencode/lib/trellis-context.js +627 -0
  105. package/dist/templates/opencode/package.json +5 -0
  106. package/dist/templates/opencode/plugins/session-start.js +65 -0
  107. package/dist/templates/pi/extensions/mini-trellis/index.ts.txt +170 -0
  108. package/dist/templates/pi/index.d.ts +4 -0
  109. package/dist/templates/pi/index.d.ts.map +1 -0
  110. package/dist/templates/pi/index.js +9 -0
  111. package/dist/templates/pi/index.js.map +1 -0
  112. package/dist/templates/pi/settings.json +9 -0
  113. package/dist/templates/shared-hooks/index.d.ts +13 -0
  114. package/dist/templates/shared-hooks/index.d.ts.map +1 -0
  115. package/dist/templates/shared-hooks/index.js +26 -0
  116. package/dist/templates/shared-hooks/index.js.map +1 -0
  117. package/dist/templates/shared-hooks/session-start.py +676 -0
  118. package/dist/templates/template-utils.d.ts +26 -0
  119. package/dist/templates/template-utils.d.ts.map +1 -0
  120. package/dist/templates/template-utils.js +64 -0
  121. package/dist/templates/template-utils.js.map +1 -0
  122. package/dist/templates/trellis/config.yaml +34 -0
  123. package/dist/templates/trellis/gitattributes.txt +9 -0
  124. package/dist/templates/trellis/gitignore.txt +32 -0
  125. package/dist/templates/trellis/index.d.ts +8 -0
  126. package/dist/templates/trellis/index.d.ts.map +1 -0
  127. package/dist/templates/trellis/index.js +16 -0
  128. package/dist/templates/trellis/index.js.map +1 -0
  129. package/dist/templates/trellis/scripts/__init__.py +5 -0
  130. package/dist/templates/trellis/scripts/add_session.py +1545 -0
  131. package/dist/templates/trellis/scripts/common/__init__.py +94 -0
  132. package/dist/templates/trellis/scripts/common/active_task.py +855 -0
  133. package/dist/templates/trellis/scripts/common/cli_adapter.py +950 -0
  134. package/dist/templates/trellis/scripts/common/config.py +482 -0
  135. package/dist/templates/trellis/scripts/common/developer.py +192 -0
  136. package/dist/templates/trellis/scripts/common/git.py +203 -0
  137. package/dist/templates/trellis/scripts/common/git_context.py +106 -0
  138. package/dist/templates/trellis/scripts/common/io.py +160 -0
  139. package/dist/templates/trellis/scripts/common/log.py +45 -0
  140. package/dist/templates/trellis/scripts/common/packages_context.py +238 -0
  141. package/dist/templates/trellis/scripts/common/paths.py +543 -0
  142. package/dist/templates/trellis/scripts/common/safe_commit.py +322 -0
  143. package/dist/templates/trellis/scripts/common/session_context.py +708 -0
  144. package/dist/templates/trellis/scripts/common/task_context.py +470 -0
  145. package/dist/templates/trellis/scripts/common/task_queue.py +188 -0
  146. package/dist/templates/trellis/scripts/common/task_store.py +1930 -0
  147. package/dist/templates/trellis/scripts/common/task_utils.py +498 -0
  148. package/dist/templates/trellis/scripts/common/tasks.py +122 -0
  149. package/dist/templates/trellis/scripts/common/trellis_config.py +239 -0
  150. package/dist/templates/trellis/scripts/common/types.py +110 -0
  151. package/dist/templates/trellis/scripts/common/workflow_phase.py +242 -0
  152. package/dist/templates/trellis/scripts/get_context.py +16 -0
  153. package/dist/templates/trellis/scripts/init_developer.py +51 -0
  154. package/dist/types/ai-tools.d.ts +30 -0
  155. package/dist/types/ai-tools.d.ts.map +1 -0
  156. package/dist/types/ai-tools.js +89 -0
  157. package/dist/types/ai-tools.js.map +1 -0
  158. package/dist/utils/atomic-write.d.ts +12 -0
  159. package/dist/utils/atomic-write.d.ts.map +1 -0
  160. package/dist/utils/atomic-write.js +30 -0
  161. package/dist/utils/atomic-write.js.map +1 -0
  162. package/dist/utils/cwd-guard.d.ts +38 -0
  163. package/dist/utils/cwd-guard.d.ts.map +1 -0
  164. package/dist/utils/cwd-guard.js +62 -0
  165. package/dist/utils/cwd-guard.js.map +1 -0
  166. package/dist/utils/file-writer.d.ts +36 -0
  167. package/dist/utils/file-writer.d.ts.map +1 -0
  168. package/dist/utils/file-writer.js +204 -0
  169. package/dist/utils/file-writer.js.map +1 -0
  170. package/dist/utils/managed-paths.d.ts +5 -0
  171. package/dist/utils/managed-paths.d.ts.map +1 -0
  172. package/dist/utils/managed-paths.js +51 -0
  173. package/dist/utils/managed-paths.js.map +1 -0
  174. package/dist/utils/managed-removal.d.ts +42 -0
  175. package/dist/utils/managed-removal.d.ts.map +1 -0
  176. package/dist/utils/managed-removal.js +223 -0
  177. package/dist/utils/managed-removal.js.map +1 -0
  178. package/dist/utils/posix.d.ts +13 -0
  179. package/dist/utils/posix.d.ts.map +1 -0
  180. package/dist/utils/posix.js +15 -0
  181. package/dist/utils/posix.js.map +1 -0
  182. package/dist/utils/uninstall-scrubbers.d.ts +66 -0
  183. package/dist/utils/uninstall-scrubbers.d.ts.map +1 -0
  184. package/dist/utils/uninstall-scrubbers.js +417 -0
  185. package/dist/utils/uninstall-scrubbers.js.map +1 -0
  186. package/package.json +80 -0
@@ -0,0 +1,417 @@
1
+ /**
2
+ * Scrubbers for structured config files during `trellis uninstall`.
3
+ *
4
+ * Each scrubber takes the file content (and any context it needs) and returns
5
+ * `{ content, fullyEmpty }`:
6
+ * - `content` is the post-scrub text to write back if the file should remain.
7
+ * - `fullyEmpty` is true when, after stripping every trellis-managed value,
8
+ * nothing meaningful is left. The caller deletes the file in that case.
9
+ *
10
+ * Manifest path matching (for hooks.json scrubbers) uses substring containment
11
+ * on the resolved `command` string. The leading `python3 ` / `python ` prefix
12
+ * does not matter — we just look for the manifest-relative file path.
13
+ */
14
+ import { getConfigTemplate as getCodexConfigTemplate } from "../templates/codex/index.js";
15
+ /**
16
+ * Test whether a hook command string references any of the given manifest paths.
17
+ *
18
+ * Trellis-emitted hook commands always have the shape
19
+ * `<python-cmd> <manifest-path>`
20
+ * so the trailing whitespace-delimited token is the script path. We compare
21
+ * that last token (with surrounding quotes stripped) against the manifest
22
+ * delete-set. This is intentionally stricter than substring matching: a
23
+ * user-added hook whose body merely mentions a deleted path inside an `echo`
24
+ * or comment argument (`echo "see .claude/hooks/session-start.py"`) does NOT
25
+ * match, because the trailing token is `inspiration"` (or similar) — not the
26
+ * path. We also accept absolute-path variants like
27
+ * `/Users/me/proj/.claude/hooks/session-start.py` via `endsWith("/" + p)`.
28
+ */
29
+ function commandMatchesDeletedPath(command, deletedPaths) {
30
+ const trimmed = command.trim();
31
+ if (trimmed.length === 0)
32
+ return false;
33
+ const tokens = trimmed.split(/\s+/);
34
+ const lastToken = tokens[tokens.length - 1].replace(/^["']|["']$/g, "");
35
+ if (lastToken.length === 0)
36
+ return false;
37
+ for (const p of deletedPaths) {
38
+ if (lastToken === p || lastToken.endsWith("/" + p)) {
39
+ return true;
40
+ }
41
+ }
42
+ return false;
43
+ }
44
+ /**
45
+ * Read the `command` (or fallback `bash` / `powershell`) string out of an
46
+ * arbitrary hook entry. Copilot's flat schema uses `bash` + `powershell`
47
+ * instead of `command` for some events.
48
+ */
49
+ function getEntryCommand(entry) {
50
+ if (entry === null || typeof entry !== "object") {
51
+ return null;
52
+ }
53
+ const obj = entry;
54
+ if (typeof obj.command === "string")
55
+ return obj.command;
56
+ if (typeof obj.bash === "string")
57
+ return obj.bash;
58
+ if (typeof obj.powershell === "string")
59
+ return obj.powershell;
60
+ return null;
61
+ }
62
+ const CLAUDE_TRELLIS_STATUSLINE = ".claude/hooks/statusline.py";
63
+ function isTrellisClaudeStatusLine(value, deletedPaths) {
64
+ if (!deletedPaths.includes(CLAUDE_TRELLIS_STATUSLINE))
65
+ return false;
66
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
67
+ return false;
68
+ }
69
+ const command = getEntryCommand(value);
70
+ return (command !== null &&
71
+ commandMatchesDeletedPath(command, [CLAUDE_TRELLIS_STATUSLINE]));
72
+ }
73
+ /**
74
+ * Scrub a hooks-shaped settings JSON file.
75
+ *
76
+ * `mode = "nested"` → `hooks.{Event}.[ {matcher?, hooks: [ {command,...} ]} ]`
77
+ * `mode = "flat"` → `hooks.{Event}.[ {command,...} ]`
78
+ *
79
+ * Strips every entry whose command references a path in `deletedPaths`,
80
+ * then bottom-up cleans empty containers (matcher block, event array, hooks
81
+ * object). The exact opt-in Trellis Claude statusLine command is also removed;
82
+ * other keys outside `hooks` (e.g. `env`, `model`, `permissions`, `version`)
83
+ * are preserved.
84
+ */
85
+ export function scrubHooksJson(content, deletedPaths, mode) {
86
+ let parsed;
87
+ try {
88
+ parsed = JSON.parse(content);
89
+ }
90
+ catch {
91
+ // Malformed JSON — leave it untouched, caller will skip.
92
+ return { content, fullyEmpty: false };
93
+ }
94
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
95
+ return { content, fullyEmpty: false };
96
+ }
97
+ const root = parsed;
98
+ if (isTrellisClaudeStatusLine(root.statusLine, deletedPaths)) {
99
+ delete root.statusLine;
100
+ }
101
+ const hooks = root.hooks;
102
+ if (hooks === undefined) {
103
+ // No hooks block — nothing to scrub. Treat as fully empty only if the
104
+ // entire file has no other keys.
105
+ const fullyEmpty = Object.keys(root).length === 0;
106
+ return { content: JSON.stringify(root, null, 2) + "\n", fullyEmpty };
107
+ }
108
+ if (hooks === null || typeof hooks !== "object" || Array.isArray(hooks)) {
109
+ // hooks is some unexpected shape — leave it alone.
110
+ return { content, fullyEmpty: false };
111
+ }
112
+ const hooksObj = hooks;
113
+ for (const eventName of Object.keys(hooksObj)) {
114
+ const eventArr = hooksObj[eventName];
115
+ if (!Array.isArray(eventArr))
116
+ continue;
117
+ const filteredEvent = [];
118
+ for (const entry of eventArr) {
119
+ if (mode === "flat") {
120
+ const cmd = getEntryCommand(entry);
121
+ if (cmd !== null && commandMatchesDeletedPath(cmd, deletedPaths)) {
122
+ continue; // drop trellis entry
123
+ }
124
+ filteredEvent.push(entry);
125
+ }
126
+ else {
127
+ // nested: entry is { matcher?, hooks: [...] }
128
+ if (entry === null || typeof entry !== "object") {
129
+ filteredEvent.push(entry);
130
+ continue;
131
+ }
132
+ const matcherBlock = entry;
133
+ const inner = matcherBlock.hooks;
134
+ if (!Array.isArray(inner)) {
135
+ filteredEvent.push(entry);
136
+ continue;
137
+ }
138
+ const filteredInner = inner.filter((sub) => {
139
+ const cmd = getEntryCommand(sub);
140
+ return !(cmd !== null && commandMatchesDeletedPath(cmd, deletedPaths));
141
+ });
142
+ if (filteredInner.length === 0) {
143
+ // Whole matcher block is now empty → drop the block.
144
+ continue;
145
+ }
146
+ // Reconstruct the block with the filtered inner list.
147
+ const rebuilt = { ...matcherBlock };
148
+ rebuilt.hooks = filteredInner;
149
+ filteredEvent.push(rebuilt);
150
+ }
151
+ }
152
+ if (filteredEvent.length === 0) {
153
+ // Drop the whole event array.
154
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
155
+ delete hooksObj[eventName];
156
+ }
157
+ else {
158
+ hooksObj[eventName] = filteredEvent;
159
+ }
160
+ }
161
+ // If hooks is empty → drop the key.
162
+ if (Object.keys(hooksObj).length === 0) {
163
+ delete root.hooks;
164
+ }
165
+ else {
166
+ root.hooks = hooksObj;
167
+ }
168
+ const fullyEmpty = Object.keys(root).length === 0;
169
+ return {
170
+ content: JSON.stringify(root, null, 2) + "\n",
171
+ fullyEmpty,
172
+ };
173
+ }
174
+ /**
175
+ * Scrub `.opencode/package.json`:
176
+ * - remove `dependencies["@opencode-ai/plugin"]`
177
+ * - if `dependencies` ends up empty → drop the field
178
+ * - fully empty when nothing is left in the object
179
+ */
180
+ export function scrubOpencodePackageJson(content) {
181
+ let parsed;
182
+ try {
183
+ parsed = JSON.parse(content);
184
+ }
185
+ catch {
186
+ return { content, fullyEmpty: false };
187
+ }
188
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
189
+ return { content, fullyEmpty: false };
190
+ }
191
+ const root = parsed;
192
+ const deps = root.dependencies;
193
+ if (deps !== null && typeof deps === "object" && !Array.isArray(deps)) {
194
+ const depsObj = deps;
195
+ if ("@opencode-ai/plugin" in depsObj) {
196
+ delete depsObj["@opencode-ai/plugin"];
197
+ }
198
+ if (Object.keys(depsObj).length === 0) {
199
+ delete root.dependencies;
200
+ }
201
+ else {
202
+ root.dependencies = depsObj;
203
+ }
204
+ }
205
+ const fullyEmpty = Object.keys(root).length === 0;
206
+ return {
207
+ content: JSON.stringify(root, null, 2) + "\n",
208
+ fullyEmpty,
209
+ };
210
+ }
211
+ /**
212
+ * Trellis-specific values written by the Pi configurator.
213
+ *
214
+ * The `extensions`/`skills`/`prompts` arrays are paths relative to `.pi/`. We
215
+ * remove the exact entries that the Pi configurator emits.
216
+ */
217
+ const PI_TRELLIS_EXTENSION = "./extensions/mini-trellis/index.ts";
218
+ const PI_TRELLIS_SKILLS = "./skills";
219
+ const PI_TRELLIS_PROMPTS = "./prompts";
220
+ const PI_SUBAGENTS_PACKAGE = "npm:pi-subagents";
221
+ function isTrellisPiEntry(value, target) {
222
+ return typeof value === "string" && value === target;
223
+ }
224
+ /**
225
+ * Scrub `.pi/settings.json`:
226
+ * - drop `enableSkillCommands` (trellis-flagged)
227
+ * - remove trellis entries from `extensions`/`skills`/`prompts` arrays
228
+ * - remove trellis-managed `packages["npm:pi-subagents"]` isolation override
229
+ * - drop arrays that become empty
230
+ */
231
+ export function scrubPiSettings(content) {
232
+ let parsed;
233
+ try {
234
+ parsed = JSON.parse(content);
235
+ }
236
+ catch {
237
+ return { content, fullyEmpty: false };
238
+ }
239
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
240
+ return { content, fullyEmpty: false };
241
+ }
242
+ const root = parsed;
243
+ if ("enableSkillCommands" in root) {
244
+ delete root.enableSkillCommands;
245
+ }
246
+ const arrayCleanups = [
247
+ ["extensions", PI_TRELLIS_EXTENSION],
248
+ ["skills", PI_TRELLIS_SKILLS],
249
+ ["prompts", PI_TRELLIS_PROMPTS],
250
+ ];
251
+ for (const [key, target] of arrayCleanups) {
252
+ const arr = root[key];
253
+ if (!Array.isArray(arr))
254
+ continue;
255
+ const filtered = arr.filter((v) => !isTrellisPiEntry(v, target));
256
+ if (filtered.length === 0) {
257
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
258
+ delete root[key];
259
+ }
260
+ else {
261
+ root[key] = filtered;
262
+ }
263
+ }
264
+ const packagesValue = root.packages;
265
+ if (Array.isArray(packagesValue)) {
266
+ const filtered = packagesValue.filter((entry) => {
267
+ if (entry !== null &&
268
+ typeof entry === "object" &&
269
+ !Array.isArray(entry)) {
270
+ const obj = entry;
271
+ return obj.source !== PI_SUBAGENTS_PACKAGE;
272
+ }
273
+ // String entries — keep unless they exactly match the package name
274
+ return entry !== PI_SUBAGENTS_PACKAGE;
275
+ });
276
+ if (filtered.length === 0) {
277
+ delete root.packages;
278
+ }
279
+ else {
280
+ root.packages = filtered;
281
+ }
282
+ }
283
+ const fullyEmpty = Object.keys(root).length === 0;
284
+ return {
285
+ content: JSON.stringify(root, null, 2) + "\n",
286
+ fullyEmpty,
287
+ };
288
+ }
289
+ /**
290
+ * Scrub `.codex/config.toml`.
291
+ *
292
+ * The current Trellis-emitted file has three owned chunks:
293
+ * 1. The line `project_doc_fallback_filenames = ["AGENTS.md"]`.
294
+ * 2. Comment lines derived from the current shipped Codex config template,
295
+ * plus an allowlist of legacy template comments.
296
+ * 3. The exact `[agents].max_depth = 1` setting.
297
+ *
298
+ * Strategy: line-based removal. We strip:
299
+ * - the `project_doc_fallback_filenames = ...` line
300
+ * - any line that is *only* a known Trellis template comment
301
+ * - Trellis's exact `max_depth = 1`, retaining `[agents]` when user keys remain
302
+ * - blank lines that surrounded those removals
303
+ *
304
+ * If the user added their own non-trellis lines, they are preserved as-is.
305
+ * "Fully empty" = post-scrub content has no non-whitespace characters.
306
+ */
307
+ export function scrubCodexConfigToml(content) {
308
+ const legacyCommentMarkers = [
309
+ "Project-scoped Codex defaults for Trellis workflows.",
310
+ "Codex loads this after ~/.codex/config.toml when you work in this project.",
311
+ "Keep AGENTS.md as the primary project instruction file.",
312
+ "NOTE: Trellis's SessionStart + UserPromptSubmit hooks require opt-in.",
313
+ "Add the following to your USER-level config at ~/.codex/config.toml",
314
+ "(not this project file — features.* must be enabled globally):",
315
+ "[features]",
316
+ "hooks = true",
317
+ "codex_hooks = true",
318
+ "Without this flag, hooks.json is ignored and Trellis context won't",
319
+ "be injected into Codex sessions.",
320
+ ];
321
+ const currentTemplateCommentMarkers = getCodexConfigTemplate()
322
+ .content.split(/\r?\n/)
323
+ .map((line) => line.trim())
324
+ .filter((line) => line.startsWith("#"))
325
+ .map((line) => line.replace(/^#+\s?/, "").trim())
326
+ .filter((line) => line.length > 0);
327
+ const trellisCommentMarkers = new Set([
328
+ ...legacyCommentMarkers,
329
+ ...currentTemplateCommentMarkers,
330
+ ]);
331
+ // A comment line is "trellis-known" if its content (after `#` and spaces)
332
+ // matches one of the known marker strings exactly OR is an empty `#` line.
333
+ function isTrellisCommentLine(line) {
334
+ const trimmed = line.trim();
335
+ if (!trimmed.startsWith("#"))
336
+ return false;
337
+ const inner = trimmed.replace(/^#+\s?/, "").trim();
338
+ if (inner.length === 0)
339
+ return true; // bare `#` line inside trellis block
340
+ return trellisCommentMarkers.has(inner);
341
+ }
342
+ function isTrellisAssignment(line) {
343
+ return /^\s*project_doc_fallback_filenames\s*=/.test(line);
344
+ }
345
+ const filteredLines = content
346
+ .split(/\r?\n/)
347
+ .filter((line) => !isTrellisAssignment(line) && !isTrellisCommentLine(line));
348
+ // Trellis currently owns `[agents].max_depth = 1`. Remove the assignment,
349
+ // but retain the table header if user-owned keys remain in that table.
350
+ const withoutAgentDepth = [];
351
+ for (let index = 0; index < filteredLines.length; index += 1) {
352
+ const line = filteredLines[index] ?? "";
353
+ if (!/^\s*\[agents\]\s*$/.test(line)) {
354
+ withoutAgentDepth.push(line);
355
+ continue;
356
+ }
357
+ const tableLines = [];
358
+ let cursor = index + 1;
359
+ const tableHeader = /^\s*\[\[?[^\]]+\]\]?\s*$/;
360
+ while (cursor < filteredLines.length &&
361
+ !tableHeader.test(filteredLines[cursor] ?? "")) {
362
+ const candidate = filteredLines[cursor] ?? "";
363
+ if (!/^\s*max_depth\s*=\s*1\s*(?:#.*)?$/.test(candidate)) {
364
+ tableLines.push(candidate);
365
+ }
366
+ cursor += 1;
367
+ }
368
+ const hasUserTableContent = tableLines.some((candidate) => {
369
+ const trimmed = candidate.trim();
370
+ return trimmed.length > 0 && !trimmed.startsWith("#");
371
+ });
372
+ if (hasUserTableContent) {
373
+ withoutAgentDepth.push(line, ...tableLines);
374
+ }
375
+ else {
376
+ withoutAgentDepth.push(...tableLines.filter((candidate) => candidate.trim().length > 0));
377
+ }
378
+ index = cursor - 1;
379
+ }
380
+ const out = [];
381
+ let prevWasBlank = true; // start-of-file counts as blank for collapsing
382
+ for (const rawLine of withoutAgentDepth) {
383
+ const isBlank = rawLine.trim().length === 0;
384
+ if (isBlank && prevWasBlank) {
385
+ continue; // collapse runs of blanks created by removals
386
+ }
387
+ out.push(rawLine);
388
+ prevWasBlank = isBlank;
389
+ }
390
+ // Trim trailing blank lines.
391
+ while (out.length > 0 && out[out.length - 1].trim().length === 0) {
392
+ out.pop();
393
+ }
394
+ const result = out.length > 0 ? out.join("\n") + "\n" : "";
395
+ const fullyEmpty = result.trim().length === 0;
396
+ return { content: result, fullyEmpty };
397
+ }
398
+ export function scrubManagedMarkdownBlock(content, startMarker, endMarker) {
399
+ const start = content.indexOf(startMarker);
400
+ if (start === -1) {
401
+ return { content, fullyEmpty: false };
402
+ }
403
+ const end = content.indexOf(endMarker, start);
404
+ if (end === -1) {
405
+ return { content, fullyEmpty: false };
406
+ }
407
+ const blockEnd = end + endMarker.length;
408
+ const result = (content.slice(0, start) + content.slice(blockEnd))
409
+ .replace(/\n{3,}/g, "\n\n")
410
+ .trimEnd();
411
+ const normalized = result.length > 0 ? `${result}\n` : "";
412
+ return {
413
+ content: normalized,
414
+ fullyEmpty: normalized.trim().length === 0,
415
+ };
416
+ }
417
+ //# sourceMappingURL=uninstall-scrubbers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uninstall-scrubbers.js","sourceRoot":"","sources":["../../src/utils/uninstall-scrubbers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,iBAAiB,IAAI,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAO1F;;;;;;;;;;;;;GAaG;AACH,SAAS,yBAAyB,CAChC,OAAe,EACf,YAA+B;IAE/B,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC/B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAEvC,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IACxE,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAEzC,KAAK,MAAM,CAAC,IAAI,YAAY,EAAE,CAAC;QAC7B,IAAI,SAAS,KAAK,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC;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,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IACxC,CAAC;IAED,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC9C,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;QACf,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IACxC,CAAC;IAED,MAAM,QAAQ,GAAG,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC;IACxC,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;SAC/D,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;SAC1B,OAAO,EAAE,CAAC;IACb,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IAE1D,OAAO;QACL,OAAO,EAAE,UAAU;QACnB,UAAU,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;KAC3C,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "mini-trellis",
3
+ "version": "0.1.0",
4
+ "description": "Minimal memory layer for AI coding agents: spec, research, journal, and cross-session recall. Fork of Trellis 0.6.17.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/Tiger-zzZ/mini-trellis.git"
8
+ },
9
+ "homepage": "https://github.com/Tiger-zzZ/mini-trellis#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/Tiger-zzZ/mini-trellis/issues"
12
+ },
13
+ "type": "module",
14
+ "main": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "bin": {
17
+ "mini-trellis": "./bin/mini-trellis.js"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "keywords": [
23
+ "ai",
24
+ "memory",
25
+ "claude",
26
+ "codex",
27
+ "opencode",
28
+ "cli",
29
+ "mini-trellis"
30
+ ],
31
+ "author": "Mindfold LLC",
32
+ "license": "AGPL-3.0-only",
33
+ "dependencies": {
34
+ "chalk": "^5.3.0",
35
+ "commander": "^12.1.0",
36
+ "figlet": "^1.9.4",
37
+ "inquirer": "^9.3.7",
38
+ "mini-trellis-core": "0.1.0"
39
+ },
40
+ "devDependencies": {
41
+ "@eslint/js": "^9.18.0",
42
+ "@types/figlet": "^1.7.0",
43
+ "@types/inquirer": "^9.0.7",
44
+ "@types/node": "^20.17.10",
45
+ "@vitest/coverage-v8": "^4.0.18",
46
+ "basedpyright": "^1.37.2",
47
+ "eslint": "^9.18.0",
48
+ "prettier": "^3.4.2",
49
+ "typescript": "^5.7.2",
50
+ "typescript-eslint": "^8.21.0",
51
+ "vitest": "^4.0.18"
52
+ },
53
+ "engines": {
54
+ "node": ">=18.17.0"
55
+ },
56
+ "files": [
57
+ "dist",
58
+ "bin",
59
+ "README.md",
60
+ "LICENSE",
61
+ "COPYRIGHT"
62
+ ],
63
+ "scripts": {
64
+ "build": "pnpm run clean && tsc && pnpm run copy-templates",
65
+ "clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
66
+ "copy-templates": "node scripts/copy-templates.js",
67
+ "dev": "tsc --watch",
68
+ "start": "node ./dist/cli/index.js",
69
+ "test": "vitest run",
70
+ "test:watch": "vitest",
71
+ "test:coverage": "vitest run --coverage",
72
+ "lint": "eslint src/ test/",
73
+ "lint:fix": "eslint src/ test/ --fix",
74
+ "format": "prettier --write src/",
75
+ "format:check": "prettier --check src/",
76
+ "typecheck": "tsc --noEmit",
77
+ "lint:py": "basedpyright",
78
+ "lint:all": "pnpm lint && pnpm lint:py"
79
+ }
80
+ }