genesis-ai-cli 7.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.
Files changed (227) hide show
  1. package/.env.example +78 -0
  2. package/README.md +282 -0
  3. package/dist/src/active-inference/actions.d.ts +75 -0
  4. package/dist/src/active-inference/actions.js +250 -0
  5. package/dist/src/active-inference/autonomous-loop.d.ts +103 -0
  6. package/dist/src/active-inference/autonomous-loop.js +289 -0
  7. package/dist/src/active-inference/core.d.ts +85 -0
  8. package/dist/src/active-inference/core.js +555 -0
  9. package/dist/src/active-inference/demo-autonomous-loop.d.ts +8 -0
  10. package/dist/src/active-inference/demo-autonomous-loop.js +338 -0
  11. package/dist/src/active-inference/demo-value-integration.d.ts +8 -0
  12. package/dist/src/active-inference/demo-value-integration.js +174 -0
  13. package/dist/src/active-inference/index.d.ts +32 -0
  14. package/dist/src/active-inference/index.js +88 -0
  15. package/dist/src/active-inference/integration.d.ts +114 -0
  16. package/dist/src/active-inference/integration.js +698 -0
  17. package/dist/src/active-inference/memory-integration.d.ts +51 -0
  18. package/dist/src/active-inference/memory-integration.js +232 -0
  19. package/dist/src/active-inference/observations.d.ts +67 -0
  20. package/dist/src/active-inference/observations.js +147 -0
  21. package/dist/src/active-inference/test-active-inference.d.ts +8 -0
  22. package/dist/src/active-inference/test-active-inference.js +320 -0
  23. package/dist/src/active-inference/test-value-integration.d.ts +6 -0
  24. package/dist/src/active-inference/test-value-integration.js +168 -0
  25. package/dist/src/active-inference/types.d.ts +150 -0
  26. package/dist/src/active-inference/types.js +59 -0
  27. package/dist/src/active-inference/value-integration.d.ts +164 -0
  28. package/dist/src/active-inference/value-integration.js +459 -0
  29. package/dist/src/agents/base-agent.d.ts +53 -0
  30. package/dist/src/agents/base-agent.js +178 -0
  31. package/dist/src/agents/builder.d.ts +67 -0
  32. package/dist/src/agents/builder.js +537 -0
  33. package/dist/src/agents/critic.d.ts +35 -0
  34. package/dist/src/agents/critic.js +322 -0
  35. package/dist/src/agents/ethicist.d.ts +54 -0
  36. package/dist/src/agents/ethicist.js +393 -0
  37. package/dist/src/agents/explorer.d.ts +26 -0
  38. package/dist/src/agents/explorer.js +216 -0
  39. package/dist/src/agents/feeling.d.ts +41 -0
  40. package/dist/src/agents/feeling.js +320 -0
  41. package/dist/src/agents/index.d.ts +111 -0
  42. package/dist/src/agents/index.js +222 -0
  43. package/dist/src/agents/memory.d.ts +69 -0
  44. package/dist/src/agents/memory.js +404 -0
  45. package/dist/src/agents/message-bus.d.ts +88 -0
  46. package/dist/src/agents/message-bus.js +267 -0
  47. package/dist/src/agents/narrator.d.ts +90 -0
  48. package/dist/src/agents/narrator.js +473 -0
  49. package/dist/src/agents/planner.d.ts +38 -0
  50. package/dist/src/agents/planner.js +341 -0
  51. package/dist/src/agents/predictor.d.ts +73 -0
  52. package/dist/src/agents/predictor.js +506 -0
  53. package/dist/src/agents/sensor.d.ts +88 -0
  54. package/dist/src/agents/sensor.js +377 -0
  55. package/dist/src/agents/test-agents.d.ts +6 -0
  56. package/dist/src/agents/test-agents.js +73 -0
  57. package/dist/src/agents/types.d.ts +194 -0
  58. package/dist/src/agents/types.js +7 -0
  59. package/dist/src/brain/index.d.ts +185 -0
  60. package/dist/src/brain/index.js +843 -0
  61. package/dist/src/brain/trace.d.ts +91 -0
  62. package/dist/src/brain/trace.js +327 -0
  63. package/dist/src/brain/types.d.ts +165 -0
  64. package/dist/src/brain/types.js +51 -0
  65. package/dist/src/cli/chat.d.ts +237 -0
  66. package/dist/src/cli/chat.js +1959 -0
  67. package/dist/src/cli/dispatcher.d.ts +182 -0
  68. package/dist/src/cli/dispatcher.js +718 -0
  69. package/dist/src/cli/human-loop.d.ts +170 -0
  70. package/dist/src/cli/human-loop.js +543 -0
  71. package/dist/src/cli/index.d.ts +12 -0
  72. package/dist/src/cli/index.js +28 -0
  73. package/dist/src/cli/interactive.d.ts +141 -0
  74. package/dist/src/cli/interactive.js +757 -0
  75. package/dist/src/cli/ui.d.ts +205 -0
  76. package/dist/src/cli/ui.js +632 -0
  77. package/dist/src/consciousness/attention-schema.d.ts +154 -0
  78. package/dist/src/consciousness/attention-schema.js +432 -0
  79. package/dist/src/consciousness/global-workspace.d.ts +149 -0
  80. package/dist/src/consciousness/global-workspace.js +422 -0
  81. package/dist/src/consciousness/index.d.ts +186 -0
  82. package/dist/src/consciousness/index.js +476 -0
  83. package/dist/src/consciousness/phi-calculator.d.ts +119 -0
  84. package/dist/src/consciousness/phi-calculator.js +445 -0
  85. package/dist/src/consciousness/phi-decisions.d.ts +169 -0
  86. package/dist/src/consciousness/phi-decisions.js +383 -0
  87. package/dist/src/consciousness/phi-monitor.d.ts +153 -0
  88. package/dist/src/consciousness/phi-monitor.js +465 -0
  89. package/dist/src/consciousness/types.d.ts +260 -0
  90. package/dist/src/consciousness/types.js +44 -0
  91. package/dist/src/daemon/dream-mode.d.ts +115 -0
  92. package/dist/src/daemon/dream-mode.js +470 -0
  93. package/dist/src/daemon/index.d.ts +162 -0
  94. package/dist/src/daemon/index.js +542 -0
  95. package/dist/src/daemon/maintenance.d.ts +139 -0
  96. package/dist/src/daemon/maintenance.js +549 -0
  97. package/dist/src/daemon/process.d.ts +82 -0
  98. package/dist/src/daemon/process.js +442 -0
  99. package/dist/src/daemon/scheduler.d.ts +90 -0
  100. package/dist/src/daemon/scheduler.js +494 -0
  101. package/dist/src/daemon/types.d.ts +213 -0
  102. package/dist/src/daemon/types.js +50 -0
  103. package/dist/src/epistemic/index.d.ts +74 -0
  104. package/dist/src/epistemic/index.js +225 -0
  105. package/dist/src/grounding/epistemic-stack.d.ts +100 -0
  106. package/dist/src/grounding/epistemic-stack.js +408 -0
  107. package/dist/src/grounding/feedback.d.ts +98 -0
  108. package/dist/src/grounding/feedback.js +276 -0
  109. package/dist/src/grounding/index.d.ts +123 -0
  110. package/dist/src/grounding/index.js +224 -0
  111. package/dist/src/grounding/verifier.d.ts +149 -0
  112. package/dist/src/grounding/verifier.js +484 -0
  113. package/dist/src/healing/detector.d.ts +110 -0
  114. package/dist/src/healing/detector.js +436 -0
  115. package/dist/src/healing/fixer.d.ts +138 -0
  116. package/dist/src/healing/fixer.js +572 -0
  117. package/dist/src/healing/index.d.ts +23 -0
  118. package/dist/src/healing/index.js +43 -0
  119. package/dist/src/hooks/index.d.ts +135 -0
  120. package/dist/src/hooks/index.js +317 -0
  121. package/dist/src/index.d.ts +23 -0
  122. package/dist/src/index.js +1266 -0
  123. package/dist/src/kernel/index.d.ts +155 -0
  124. package/dist/src/kernel/index.js +795 -0
  125. package/dist/src/kernel/invariants.d.ts +153 -0
  126. package/dist/src/kernel/invariants.js +355 -0
  127. package/dist/src/kernel/test-kernel.d.ts +6 -0
  128. package/dist/src/kernel/test-kernel.js +108 -0
  129. package/dist/src/kernel/test-real-mcp.d.ts +10 -0
  130. package/dist/src/kernel/test-real-mcp.js +295 -0
  131. package/dist/src/llm/index.d.ts +146 -0
  132. package/dist/src/llm/index.js +428 -0
  133. package/dist/src/llm/router.d.ts +136 -0
  134. package/dist/src/llm/router.js +510 -0
  135. package/dist/src/mcp/index.d.ts +85 -0
  136. package/dist/src/mcp/index.js +657 -0
  137. package/dist/src/mcp/resilient.d.ts +139 -0
  138. package/dist/src/mcp/resilient.js +417 -0
  139. package/dist/src/memory/cache.d.ts +118 -0
  140. package/dist/src/memory/cache.js +356 -0
  141. package/dist/src/memory/cognitive-workspace.d.ts +231 -0
  142. package/dist/src/memory/cognitive-workspace.js +521 -0
  143. package/dist/src/memory/consolidation.d.ts +99 -0
  144. package/dist/src/memory/consolidation.js +443 -0
  145. package/dist/src/memory/episodic.d.ts +114 -0
  146. package/dist/src/memory/episodic.js +394 -0
  147. package/dist/src/memory/forgetting.d.ts +134 -0
  148. package/dist/src/memory/forgetting.js +324 -0
  149. package/dist/src/memory/index.d.ts +211 -0
  150. package/dist/src/memory/index.js +367 -0
  151. package/dist/src/memory/indexer.d.ts +123 -0
  152. package/dist/src/memory/indexer.js +479 -0
  153. package/dist/src/memory/procedural.d.ts +136 -0
  154. package/dist/src/memory/procedural.js +479 -0
  155. package/dist/src/memory/semantic.d.ts +132 -0
  156. package/dist/src/memory/semantic.js +497 -0
  157. package/dist/src/memory/types.d.ts +193 -0
  158. package/dist/src/memory/types.js +15 -0
  159. package/dist/src/orchestrator.d.ts +65 -0
  160. package/dist/src/orchestrator.js +317 -0
  161. package/dist/src/persistence/index.d.ts +257 -0
  162. package/dist/src/persistence/index.js +763 -0
  163. package/dist/src/pipeline/executor.d.ts +51 -0
  164. package/dist/src/pipeline/executor.js +695 -0
  165. package/dist/src/pipeline/index.d.ts +7 -0
  166. package/dist/src/pipeline/index.js +11 -0
  167. package/dist/src/self-production.d.ts +67 -0
  168. package/dist/src/self-production.js +205 -0
  169. package/dist/src/subagents/executor.d.ts +58 -0
  170. package/dist/src/subagents/executor.js +283 -0
  171. package/dist/src/subagents/index.d.ts +37 -0
  172. package/dist/src/subagents/index.js +53 -0
  173. package/dist/src/subagents/registry.d.ts +23 -0
  174. package/dist/src/subagents/registry.js +167 -0
  175. package/dist/src/subagents/types.d.ts +79 -0
  176. package/dist/src/subagents/types.js +14 -0
  177. package/dist/src/tools/bash.d.ts +139 -0
  178. package/dist/src/tools/bash.js +583 -0
  179. package/dist/src/tools/edit.d.ts +125 -0
  180. package/dist/src/tools/edit.js +424 -0
  181. package/dist/src/tools/git.d.ts +179 -0
  182. package/dist/src/tools/git.js +504 -0
  183. package/dist/src/tools/index.d.ts +21 -0
  184. package/dist/src/tools/index.js +163 -0
  185. package/dist/src/types.d.ts +145 -0
  186. package/dist/src/types.js +7 -0
  187. package/dist/src/world-model/decoder.d.ts +163 -0
  188. package/dist/src/world-model/decoder.js +517 -0
  189. package/dist/src/world-model/digital-twin.d.ts +219 -0
  190. package/dist/src/world-model/digital-twin.js +695 -0
  191. package/dist/src/world-model/encoder.d.ts +141 -0
  192. package/dist/src/world-model/encoder.js +564 -0
  193. package/dist/src/world-model/index.d.ts +221 -0
  194. package/dist/src/world-model/index.js +772 -0
  195. package/dist/src/world-model/predictor.d.ts +161 -0
  196. package/dist/src/world-model/predictor.js +681 -0
  197. package/dist/src/world-model/test-value-jepa.d.ts +8 -0
  198. package/dist/src/world-model/test-value-jepa.js +430 -0
  199. package/dist/src/world-model/types.d.ts +341 -0
  200. package/dist/src/world-model/types.js +69 -0
  201. package/dist/src/world-model/value-jepa.d.ts +247 -0
  202. package/dist/src/world-model/value-jepa.js +622 -0
  203. package/dist/test/brain.test.d.ts +11 -0
  204. package/dist/test/brain.test.js +358 -0
  205. package/dist/test/cli/dispatcher.test.d.ts +4 -0
  206. package/dist/test/cli/dispatcher.test.js +332 -0
  207. package/dist/test/cli/human-loop.test.d.ts +4 -0
  208. package/dist/test/cli/human-loop.test.js +270 -0
  209. package/dist/test/grounding/feedback.test.d.ts +4 -0
  210. package/dist/test/grounding/feedback.test.js +462 -0
  211. package/dist/test/grounding/verifier.test.d.ts +4 -0
  212. package/dist/test/grounding/verifier.test.js +442 -0
  213. package/dist/test/grounding.test.d.ts +6 -0
  214. package/dist/test/grounding.test.js +246 -0
  215. package/dist/test/healing/detector.test.d.ts +4 -0
  216. package/dist/test/healing/detector.test.js +266 -0
  217. package/dist/test/healing/fixer.test.d.ts +4 -0
  218. package/dist/test/healing/fixer.test.js +369 -0
  219. package/dist/test/integration.test.d.ts +5 -0
  220. package/dist/test/integration.test.js +290 -0
  221. package/dist/test/tools/bash.test.d.ts +4 -0
  222. package/dist/test/tools/bash.test.js +348 -0
  223. package/dist/test/tools/edit.test.d.ts +4 -0
  224. package/dist/test/tools/edit.test.js +350 -0
  225. package/dist/test/tools/git.test.d.ts +4 -0
  226. package/dist/test/tools/git.test.js +350 -0
  227. package/package.json +60 -0
@@ -0,0 +1,350 @@
1
+ "use strict";
2
+ /**
3
+ * Tests for Genesis Native Git Operations
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ const node_test_1 = require("node:test");
43
+ const node_assert_1 = __importDefault(require("node:assert"));
44
+ const fs = __importStar(require("fs"));
45
+ const path = __importStar(require("path"));
46
+ const child_process_1 = require("child_process");
47
+ const git_js_1 = require("../../src/tools/git.js");
48
+ // Test directory
49
+ const TEST_DIR = '/tmp/genesis-git-test-' + Date.now();
50
+ // Helper to run git commands directly
51
+ function git(cmd, cwd = TEST_DIR) {
52
+ return (0, child_process_1.execSync)(`git ${cmd}`, { cwd, encoding: 'utf-8' }).trim();
53
+ }
54
+ (0, node_test_1.describe)('GitTool', () => {
55
+ (0, node_test_1.before)(() => {
56
+ // Create test repository
57
+ fs.mkdirSync(TEST_DIR, { recursive: true });
58
+ git('init');
59
+ git('config user.email "test@test.com"');
60
+ git('config user.name "Test User"');
61
+ // Create initial commit
62
+ fs.writeFileSync(path.join(TEST_DIR, 'README.md'), '# Test Repo');
63
+ git('add README.md');
64
+ git('commit -m "Initial commit"');
65
+ (0, git_js_1.resetGitTool)();
66
+ });
67
+ (0, node_test_1.after)(() => {
68
+ fs.rmSync(TEST_DIR, { recursive: true, force: true });
69
+ (0, git_js_1.resetGitTool)();
70
+ });
71
+ // ==========================================================================
72
+ // Status Tests
73
+ // ==========================================================================
74
+ (0, node_test_1.describe)('Status', () => {
75
+ (0, node_test_1.beforeEach)(() => {
76
+ // Reset to clean state
77
+ git('checkout -- .');
78
+ git('clean -fd');
79
+ });
80
+ (0, node_test_1.it)('should get status of clean repo', async () => {
81
+ const result = await (0, git_js_1.gitStatus)(TEST_DIR);
82
+ node_assert_1.default.strictEqual(result.success, true);
83
+ node_assert_1.default.ok(result.data);
84
+ node_assert_1.default.strictEqual(result.data.isClean, true);
85
+ node_assert_1.default.strictEqual(result.data.staged.length, 0);
86
+ node_assert_1.default.strictEqual(result.data.unstaged.length, 0);
87
+ node_assert_1.default.strictEqual(result.data.untracked.length, 0);
88
+ });
89
+ (0, node_test_1.it)('should detect untracked files', async () => {
90
+ fs.writeFileSync(path.join(TEST_DIR, 'new-file.txt'), 'content');
91
+ const result = await (0, git_js_1.gitStatus)(TEST_DIR);
92
+ node_assert_1.default.strictEqual(result.success, true);
93
+ node_assert_1.default.ok(result.data?.untracked.includes('new-file.txt'));
94
+ fs.unlinkSync(path.join(TEST_DIR, 'new-file.txt'));
95
+ });
96
+ (0, node_test_1.it)('should detect staged files', async () => {
97
+ fs.writeFileSync(path.join(TEST_DIR, 'staged.txt'), 'content');
98
+ git('add staged.txt');
99
+ const result = await (0, git_js_1.gitStatus)(TEST_DIR);
100
+ node_assert_1.default.strictEqual(result.success, true);
101
+ node_assert_1.default.ok(result.data?.staged.includes('staged.txt'));
102
+ git('reset HEAD staged.txt');
103
+ fs.unlinkSync(path.join(TEST_DIR, 'staged.txt'));
104
+ });
105
+ (0, node_test_1.it)('should detect modified files', async () => {
106
+ fs.appendFileSync(path.join(TEST_DIR, 'README.md'), '\nNew line');
107
+ const result = await (0, git_js_1.gitStatus)(TEST_DIR);
108
+ node_assert_1.default.strictEqual(result.success, true);
109
+ node_assert_1.default.ok(result.data?.unstaged.includes('README.md'));
110
+ git('checkout -- README.md');
111
+ });
112
+ (0, node_test_1.it)('should get current branch', async () => {
113
+ const result = await (0, git_js_1.gitStatus)(TEST_DIR);
114
+ node_assert_1.default.strictEqual(result.success, true);
115
+ node_assert_1.default.ok(['main', 'master'].includes(result.data?.branch || ''));
116
+ });
117
+ (0, node_test_1.it)('should fail for non-git directory', async () => {
118
+ const result = await (0, git_js_1.gitStatus)('/tmp');
119
+ node_assert_1.default.strictEqual(result.success, false);
120
+ });
121
+ });
122
+ // ==========================================================================
123
+ // Diff Tests
124
+ // ==========================================================================
125
+ (0, node_test_1.describe)('Diff', () => {
126
+ (0, node_test_1.beforeEach)(() => {
127
+ git('checkout -- .');
128
+ });
129
+ (0, node_test_1.it)('should get diff of modified file', async () => {
130
+ fs.appendFileSync(path.join(TEST_DIR, 'README.md'), '\nNew content');
131
+ const result = await (0, git_js_1.gitDiff)({}, TEST_DIR);
132
+ node_assert_1.default.strictEqual(result.success, true);
133
+ node_assert_1.default.ok(result.data?.raw.includes('New content'));
134
+ git('checkout -- README.md');
135
+ });
136
+ (0, node_test_1.it)('should get staged diff', async () => {
137
+ fs.appendFileSync(path.join(TEST_DIR, 'README.md'), '\nStaged content');
138
+ git('add README.md');
139
+ const result = await (0, git_js_1.gitDiff)({ staged: true }, TEST_DIR);
140
+ node_assert_1.default.strictEqual(result.success, true);
141
+ node_assert_1.default.ok(result.data?.raw.includes('Staged content'));
142
+ git('reset HEAD README.md');
143
+ git('checkout -- README.md');
144
+ });
145
+ (0, node_test_1.it)('should get diff stats', async () => {
146
+ fs.appendFileSync(path.join(TEST_DIR, 'README.md'), '\nLine 1\nLine 2\nLine 3');
147
+ const result = await (0, git_js_1.gitDiff)({}, TEST_DIR);
148
+ node_assert_1.default.strictEqual(result.success, true);
149
+ node_assert_1.default.ok(result.data?.stats && result.data.stats.insertions > 0);
150
+ git('checkout -- README.md');
151
+ });
152
+ });
153
+ // ==========================================================================
154
+ // Log Tests
155
+ // ==========================================================================
156
+ (0, node_test_1.describe)('Log', () => {
157
+ (0, node_test_1.it)('should get commit log', async () => {
158
+ const result = await (0, git_js_1.gitLog)({ count: 5 }, TEST_DIR);
159
+ node_assert_1.default.strictEqual(result.success, true);
160
+ node_assert_1.default.ok(result.data);
161
+ node_assert_1.default.ok(result.data.length > 0);
162
+ node_assert_1.default.ok(result.data[0].message.includes('Initial commit'));
163
+ });
164
+ (0, node_test_1.it)('should get commit details', async () => {
165
+ const result = await (0, git_js_1.gitLog)({ count: 1 }, TEST_DIR);
166
+ node_assert_1.default.strictEqual(result.success, true);
167
+ node_assert_1.default.ok(result.data?.[0].hash);
168
+ node_assert_1.default.ok(result.data?.[0].shortHash);
169
+ node_assert_1.default.ok(result.data?.[0].author);
170
+ node_assert_1.default.ok(result.data?.[0].date);
171
+ });
172
+ });
173
+ // ==========================================================================
174
+ // Add/Stage Tests
175
+ // ==========================================================================
176
+ (0, node_test_1.describe)('Add/Stage', () => {
177
+ (0, node_test_1.afterEach)(() => {
178
+ git('checkout -- .');
179
+ git('clean -fd');
180
+ });
181
+ (0, node_test_1.it)('should stage a file', async () => {
182
+ fs.writeFileSync(path.join(TEST_DIR, 'to-stage.txt'), 'content');
183
+ const result = await (0, git_js_1.gitAdd)(['to-stage.txt'], TEST_DIR);
184
+ node_assert_1.default.strictEqual(result.success, true);
185
+ const status = await (0, git_js_1.gitStatus)(TEST_DIR);
186
+ node_assert_1.default.ok(status.data?.staged.includes('to-stage.txt'));
187
+ });
188
+ (0, node_test_1.it)('should stage multiple files', async () => {
189
+ fs.writeFileSync(path.join(TEST_DIR, 'file1.txt'), 'content1');
190
+ fs.writeFileSync(path.join(TEST_DIR, 'file2.txt'), 'content2');
191
+ const result = await (0, git_js_1.gitAdd)(['file1.txt', 'file2.txt'], TEST_DIR);
192
+ node_assert_1.default.strictEqual(result.success, true);
193
+ const status = await (0, git_js_1.gitStatus)(TEST_DIR);
194
+ node_assert_1.default.ok(status.data?.staged.includes('file1.txt'));
195
+ node_assert_1.default.ok(status.data?.staged.includes('file2.txt'));
196
+ });
197
+ (0, node_test_1.it)('should fail with empty files array', async () => {
198
+ const result = await (0, git_js_1.gitAdd)([], TEST_DIR);
199
+ node_assert_1.default.strictEqual(result.success, false);
200
+ });
201
+ });
202
+ // ==========================================================================
203
+ // Commit Tests
204
+ // ==========================================================================
205
+ (0, node_test_1.describe)('Commit', () => {
206
+ (0, node_test_1.afterEach)(() => {
207
+ // Reset to initial commit
208
+ try {
209
+ git('reset --hard HEAD~1');
210
+ }
211
+ catch {
212
+ // Ignore if no commits to reset
213
+ }
214
+ });
215
+ (0, node_test_1.it)('should create a commit', async () => {
216
+ fs.writeFileSync(path.join(TEST_DIR, 'commit-test.txt'), 'content');
217
+ git('add commit-test.txt');
218
+ const result = await (0, git_js_1.gitCommit)({ message: 'Test commit' }, TEST_DIR);
219
+ node_assert_1.default.strictEqual(result.success, true);
220
+ node_assert_1.default.ok(result.data?.message.includes('Test commit'));
221
+ });
222
+ (0, node_test_1.it)('should add signature to commit message', async () => {
223
+ fs.writeFileSync(path.join(TEST_DIR, 'signed.txt'), 'content');
224
+ git('add signed.txt');
225
+ const result = await (0, git_js_1.gitCommit)({ message: 'Signed commit' }, TEST_DIR);
226
+ node_assert_1.default.strictEqual(result.success, true);
227
+ const log = git('log -1 --format=%B');
228
+ node_assert_1.default.ok(log.includes('Genesis'));
229
+ });
230
+ (0, node_test_1.it)('should commit with files parameter', async () => {
231
+ fs.writeFileSync(path.join(TEST_DIR, 'auto-add.txt'), 'content');
232
+ const result = await (0, git_js_1.gitCommit)({
233
+ message: 'Auto-add commit',
234
+ files: ['auto-add.txt'],
235
+ }, TEST_DIR);
236
+ node_assert_1.default.strictEqual(result.success, true);
237
+ });
238
+ (0, node_test_1.it)('should fail with no staged changes', async () => {
239
+ const tool = (0, git_js_1.getGitTool)();
240
+ const result = await tool.commit({ message: 'Empty commit' }, TEST_DIR);
241
+ node_assert_1.default.strictEqual(result.success, false);
242
+ });
243
+ });
244
+ // ==========================================================================
245
+ // Push Tests
246
+ // ==========================================================================
247
+ (0, node_test_1.describe)('Push', () => {
248
+ (0, node_test_1.it)('should require confirmation for push', async () => {
249
+ const tool = (0, git_js_1.getGitTool)();
250
+ const result = await tool.push({}, TEST_DIR);
251
+ node_assert_1.default.strictEqual(result.success, false);
252
+ node_assert_1.default.ok(result.error?.includes('confirmation'));
253
+ });
254
+ (0, node_test_1.it)('should block force push by default', async () => {
255
+ const tool = (0, git_js_1.getGitTool)();
256
+ const result = await tool.push({ force: true, confirmed: true }, TEST_DIR);
257
+ node_assert_1.default.strictEqual(result.success, false);
258
+ node_assert_1.default.ok(result.error?.includes('blocked'));
259
+ });
260
+ });
261
+ // ==========================================================================
262
+ // Branch Tests
263
+ // ==========================================================================
264
+ (0, node_test_1.describe)('Branch', () => {
265
+ (0, node_test_1.afterEach)(() => {
266
+ try {
267
+ git('checkout master || git checkout main');
268
+ git('branch -D test-branch 2>/dev/null || true');
269
+ }
270
+ catch {
271
+ // Ignore cleanup errors
272
+ }
273
+ });
274
+ (0, node_test_1.it)('should get current branch', async () => {
275
+ const tool = (0, git_js_1.getGitTool)();
276
+ const result = await tool.branch(TEST_DIR);
277
+ node_assert_1.default.strictEqual(result.success, true);
278
+ node_assert_1.default.ok(['main', 'master'].includes(result.data || ''));
279
+ });
280
+ (0, node_test_1.it)('should list branches', async () => {
281
+ const tool = (0, git_js_1.getGitTool)();
282
+ const result = await tool.listBranches(TEST_DIR);
283
+ node_assert_1.default.strictEqual(result.success, true);
284
+ node_assert_1.default.ok(result.data?.branches && result.data.branches.length > 0);
285
+ });
286
+ (0, node_test_1.it)('should create new branch', async () => {
287
+ const tool = (0, git_js_1.getGitTool)();
288
+ const result = await tool.createBranch('test-branch', {}, TEST_DIR);
289
+ node_assert_1.default.strictEqual(result.success, true);
290
+ const branches = await tool.listBranches(TEST_DIR);
291
+ node_assert_1.default.ok(branches.data?.branches.some(b => b.includes('test-branch')));
292
+ });
293
+ (0, node_test_1.it)('should create and checkout branch', async () => {
294
+ const tool = (0, git_js_1.getGitTool)();
295
+ const result = await tool.createBranch('test-branch', { checkout: true }, TEST_DIR);
296
+ node_assert_1.default.strictEqual(result.success, true);
297
+ const branch = await tool.branch(TEST_DIR);
298
+ node_assert_1.default.strictEqual(branch.data, 'test-branch');
299
+ });
300
+ });
301
+ // ==========================================================================
302
+ // Utility Tests
303
+ // ==========================================================================
304
+ (0, node_test_1.describe)('Utilities', () => {
305
+ (0, node_test_1.it)('should check if directory is repo', async () => {
306
+ const tool = (0, git_js_1.getGitTool)();
307
+ node_assert_1.default.strictEqual(await tool.isRepo(TEST_DIR), true);
308
+ node_assert_1.default.strictEqual(await tool.isRepo('/tmp'), false);
309
+ });
310
+ (0, node_test_1.it)('should generate commit message', async () => {
311
+ fs.writeFileSync(path.join(TEST_DIR, 'gen-msg.txt'), 'content');
312
+ git('add gen-msg.txt');
313
+ const tool = (0, git_js_1.getGitTool)();
314
+ const result = await tool.generateCommitMessage(TEST_DIR);
315
+ node_assert_1.default.strictEqual(result.success, true);
316
+ node_assert_1.default.ok(result.data?.includes('file'));
317
+ git('reset HEAD gen-msg.txt');
318
+ fs.unlinkSync(path.join(TEST_DIR, 'gen-msg.txt'));
319
+ });
320
+ });
321
+ // ==========================================================================
322
+ // Configuration Tests
323
+ // ==========================================================================
324
+ (0, node_test_1.describe)('Configuration', () => {
325
+ (0, node_test_1.it)('should have sensible defaults', () => {
326
+ node_assert_1.default.strictEqual(git_js_1.DEFAULT_GIT_CONFIG.blockForcePush, true);
327
+ node_assert_1.default.strictEqual(git_js_1.DEFAULT_GIT_CONFIG.blockHardReset, true);
328
+ node_assert_1.default.strictEqual(git_js_1.DEFAULT_GIT_CONFIG.requirePushConfirmation, true);
329
+ });
330
+ (0, node_test_1.it)('should allow custom configuration', () => {
331
+ const tool = new git_js_1.GitTool({ blockForcePush: false });
332
+ const config = tool.getConfig();
333
+ node_assert_1.default.strictEqual(config.blockForcePush, false);
334
+ });
335
+ });
336
+ // ==========================================================================
337
+ // Integration Tests
338
+ // ==========================================================================
339
+ (0, node_test_1.describe)('Integration', () => {
340
+ (0, node_test_1.it)('should be in tool registry', async () => {
341
+ const { toolRegistry } = await import('../../src/tools/index.js');
342
+ node_assert_1.default.ok(toolRegistry.has('git_status'));
343
+ node_assert_1.default.ok(toolRegistry.has('git_diff'));
344
+ node_assert_1.default.ok(toolRegistry.has('git_log'));
345
+ node_assert_1.default.ok(toolRegistry.has('git_add'));
346
+ node_assert_1.default.ok(toolRegistry.has('git_commit'));
347
+ node_assert_1.default.ok(toolRegistry.has('git_push'));
348
+ });
349
+ });
350
+ });
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "genesis-ai-cli",
3
+ "version": "7.4.5",
4
+ "description": "Autonomous AI System Creator - Brain ON by default, Active Inference integrated, Curiosity-driven, Φ monitoring in every response",
5
+ "main": "dist/src/index.js",
6
+ "types": "dist/src/index.d.ts",
7
+ "bin": {
8
+ "genesis": "./dist/src/index.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "start": "node dist/src/index.js",
13
+ "dev": "tsc --watch",
14
+ "dev:chat": "npx tsx watch src/index.ts chat",
15
+ "dev:run": "npx tsx watch src/index.ts",
16
+ "test": "node --test dist/**/*.test.js",
17
+ "prepublishOnly": "npm run build",
18
+ "postinstall": "echo '\\n🧬 Genesis installed! Run: genesis help\\n'"
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "README.md",
23
+ ".env.example"
24
+ ],
25
+ "keywords": [
26
+ "mcp",
27
+ "ai",
28
+ "autonomous",
29
+ "active-inference",
30
+ "autopoiesis",
31
+ "agents",
32
+ "multi-agent",
33
+ "llm",
34
+ "openai",
35
+ "anthropic",
36
+ "system-creator"
37
+ ],
38
+ "author": "rossignoliluca",
39
+ "license": "MIT",
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/rossignoliluca/genesis.git"
43
+ },
44
+ "homepage": "https://github.com/rossignoliluca/genesis#readme",
45
+ "bugs": {
46
+ "url": "https://github.com/rossignoliluca/genesis/issues"
47
+ },
48
+ "engines": {
49
+ "node": ">=18.0.0"
50
+ },
51
+ "devDependencies": {
52
+ "@types/node": "^20.10.0",
53
+ "tsx": "^4.21.0",
54
+ "typescript": "^5.3.0"
55
+ },
56
+ "dependencies": {
57
+ "@modelcontextprotocol/sdk": "^1.25.2",
58
+ "dotenv": "^17.2.3"
59
+ }
60
+ }