@codemieai/code 0.0.2 → 0.0.4
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/README.md +357 -719
- package/bin/codemie-claude.js +145 -0
- package/bin/codemie-code.js +128 -15
- package/bin/codemie-codex.js +137 -0
- package/bin/codemie.js +1 -1
- package/dist/agents/adapters/claude-code.d.ts +7 -2
- package/dist/agents/adapters/claude-code.d.ts.map +1 -1
- package/dist/agents/adapters/claude-code.js +94 -58
- package/dist/agents/adapters/claude-code.js.map +1 -1
- package/dist/agents/adapters/codemie-code.d.ts +11 -2
- package/dist/agents/adapters/codemie-code.d.ts.map +1 -1
- package/dist/agents/adapters/codemie-code.js +93 -25
- package/dist/agents/adapters/codemie-code.js.map +1 -1
- package/dist/agents/adapters/codex.d.ts +7 -2
- package/dist/agents/adapters/codex.d.ts.map +1 -1
- package/dist/agents/adapters/codex.js +104 -39
- package/dist/agents/adapters/codex.js.map +1 -1
- package/dist/agents/codemie-code/agent.d.ts +89 -0
- package/dist/agents/codemie-code/agent.d.ts.map +1 -0
- package/dist/agents/codemie-code/agent.js +689 -0
- package/dist/agents/codemie-code/agent.js.map +1 -0
- package/dist/agents/codemie-code/config.d.ts +40 -0
- package/dist/agents/codemie-code/config.d.ts.map +1 -0
- package/dist/agents/codemie-code/config.js +278 -0
- package/dist/agents/codemie-code/config.js.map +1 -0
- package/dist/agents/codemie-code/filters.d.ts +91 -0
- package/dist/agents/codemie-code/filters.d.ts.map +1 -0
- package/dist/agents/codemie-code/filters.js +328 -0
- package/dist/agents/codemie-code/filters.js.map +1 -0
- package/dist/agents/codemie-code/index.d.ts +92 -0
- package/dist/agents/codemie-code/index.d.ts.map +1 -0
- package/dist/agents/codemie-code/index.js +327 -0
- package/dist/agents/codemie-code/index.js.map +1 -0
- package/dist/agents/codemie-code/modes/contextAwarePlanning.d.ts +87 -0
- package/dist/agents/codemie-code/modes/contextAwarePlanning.d.ts.map +1 -0
- package/dist/agents/codemie-code/modes/contextAwarePlanning.js +957 -0
- package/dist/agents/codemie-code/modes/contextAwarePlanning.js.map +1 -0
- package/dist/agents/codemie-code/modes/planMode.d.ts +116 -0
- package/dist/agents/codemie-code/modes/planMode.d.ts.map +1 -0
- package/dist/agents/codemie-code/modes/planMode.js +537 -0
- package/dist/agents/codemie-code/modes/planMode.js.map +1 -0
- package/dist/agents/codemie-code/prompts.d.ts +40 -0
- package/dist/agents/codemie-code/prompts.d.ts.map +1 -0
- package/dist/agents/codemie-code/prompts.js +160 -0
- package/dist/agents/codemie-code/prompts.js.map +1 -0
- package/dist/agents/codemie-code/storage/todoStorage.d.ts +78 -0
- package/dist/agents/codemie-code/storage/todoStorage.d.ts.map +1 -0
- package/dist/agents/codemie-code/storage/todoStorage.js +225 -0
- package/dist/agents/codemie-code/storage/todoStorage.js.map +1 -0
- package/dist/agents/codemie-code/tokenUtils.d.ts +108 -0
- package/dist/agents/codemie-code/tokenUtils.d.ts.map +1 -0
- package/dist/agents/codemie-code/tokenUtils.js +220 -0
- package/dist/agents/codemie-code/tokenUtils.js.map +1 -0
- package/dist/agents/codemie-code/toolMetadata.d.ts +15 -0
- package/dist/agents/codemie-code/toolMetadata.d.ts.map +1 -0
- package/dist/agents/codemie-code/toolMetadata.js +315 -0
- package/dist/agents/codemie-code/toolMetadata.js.map +1 -0
- package/dist/agents/codemie-code/tools/index.d.ts +45 -0
- package/dist/agents/codemie-code/tools/index.d.ts.map +1 -0
- package/dist/agents/codemie-code/tools/index.js +407 -0
- package/dist/agents/codemie-code/tools/index.js.map +1 -0
- package/dist/agents/codemie-code/tools/planning.d.ts +53 -0
- package/dist/agents/codemie-code/tools/planning.d.ts.map +1 -0
- package/dist/agents/codemie-code/tools/planning.js +224 -0
- package/dist/agents/codemie-code/tools/planning.js.map +1 -0
- package/dist/agents/codemie-code/types.d.ts +418 -0
- package/dist/agents/codemie-code/types.d.ts.map +1 -0
- package/dist/agents/codemie-code/types.js +35 -0
- package/dist/agents/codemie-code/types.js.map +1 -0
- package/dist/agents/codemie-code/ui/progressTracker.d.ts +125 -0
- package/dist/agents/codemie-code/ui/progressTracker.d.ts.map +1 -0
- package/dist/agents/codemie-code/ui/progressTracker.js +343 -0
- package/dist/agents/codemie-code/ui/progressTracker.js.map +1 -0
- package/dist/agents/codemie-code/ui/todoPanel.d.ts +112 -0
- package/dist/agents/codemie-code/ui/todoPanel.d.ts.map +1 -0
- package/dist/agents/codemie-code/ui/todoPanel.js +318 -0
- package/dist/agents/codemie-code/ui/todoPanel.js.map +1 -0
- package/dist/agents/codemie-code/ui.d.ts +179 -0
- package/dist/agents/codemie-code/ui.d.ts.map +1 -0
- package/dist/agents/codemie-code/ui.js +1408 -0
- package/dist/agents/codemie-code/ui.js.map +1 -0
- package/dist/agents/codemie-code/utils/progressionEnforcer.d.ts +87 -0
- package/dist/agents/codemie-code/utils/progressionEnforcer.d.ts.map +1 -0
- package/dist/agents/codemie-code/utils/progressionEnforcer.js +293 -0
- package/dist/agents/codemie-code/utils/progressionEnforcer.js.map +1 -0
- package/dist/agents/codemie-code/utils/todoParser.d.ts +41 -0
- package/dist/agents/codemie-code/utils/todoParser.d.ts.map +1 -0
- package/dist/agents/codemie-code/utils/todoParser.js +305 -0
- package/dist/agents/codemie-code/utils/todoParser.js.map +1 -0
- package/dist/agents/codemie-code/utils/todoValidator.d.ts +65 -0
- package/dist/agents/codemie-code/utils/todoValidator.d.ts.map +1 -0
- package/dist/agents/codemie-code/utils/todoValidator.js +249 -0
- package/dist/agents/codemie-code/utils/todoValidator.js.map +1 -0
- package/dist/agents/codemie-code/validators/planValidator.d.ts +94 -0
- package/dist/agents/codemie-code/validators/planValidator.d.ts.map +1 -0
- package/dist/agents/codemie-code/validators/planValidator.js +281 -0
- package/dist/agents/codemie-code/validators/planValidator.js.map +1 -0
- package/dist/agents/registry.d.ts +1 -1
- package/dist/agents/registry.d.ts.map +1 -1
- package/dist/agents/registry.js +11 -15
- package/dist/agents/registry.js.map +1 -1
- package/dist/cli/commands/auth.d.ts +3 -0
- package/dist/cli/commands/auth.d.ts.map +1 -0
- package/dist/cli/commands/auth.js +170 -0
- package/dist/cli/commands/auth.js.map +1 -0
- package/dist/cli/commands/config.d.ts +3 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +350 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +308 -71
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/env.d.ts +3 -0
- package/dist/cli/commands/env.d.ts.map +1 -0
- package/dist/cli/commands/env.js +19 -0
- package/dist/cli/commands/env.js.map +1 -0
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +28 -33
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/list.js +18 -24
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +297 -31
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/setup.d.ts +3 -0
- package/dist/cli/commands/setup.d.ts.map +1 -0
- package/dist/cli/commands/setup.js +523 -0
- package/dist/cli/commands/setup.js.map +1 -0
- package/dist/cli/commands/tools.d.ts +6 -0
- package/dist/cli/commands/tools.d.ts.map +1 -0
- package/dist/cli/commands/tools.js +244 -0
- package/dist/cli/commands/tools.js.map +1 -0
- package/dist/cli/commands/uninstall.js +24 -30
- package/dist/cli/commands/uninstall.js.map +1 -1
- package/dist/cli/commands/version.d.ts.map +1 -1
- package/dist/cli/commands/version.js +11 -16
- package/dist/cli/commands/version.js.map +1 -1
- package/dist/cli/commands/workflow.d.ts +6 -0
- package/dist/cli/commands/workflow.d.ts.map +1 -0
- package/dist/cli/commands/workflow.js +424 -0
- package/dist/cli/commands/workflow.js.map +1 -0
- package/dist/cli/index.js +85 -35
- package/dist/cli/index.js.map +1 -1
- package/dist/clients/adapters/github.d.ts +17 -0
- package/dist/clients/adapters/github.d.ts.map +1 -0
- package/dist/clients/adapters/github.js +150 -0
- package/dist/clients/adapters/github.js.map +1 -0
- package/dist/clients/adapters/gitlab.d.ts +17 -0
- package/dist/clients/adapters/gitlab.d.ts.map +1 -0
- package/dist/clients/adapters/gitlab.js +147 -0
- package/dist/clients/adapters/gitlab.js.map +1 -0
- package/dist/clients/registry.d.ts +20 -0
- package/dist/clients/registry.d.ts.map +1 -0
- package/dist/clients/registry.js +27 -0
- package/dist/clients/registry.js.map +1 -0
- package/dist/env/manager.js +9 -46
- package/dist/env/manager.js.map +1 -1
- package/dist/index.d.ts +6 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -43
- package/dist/index.js.map +1 -1
- package/dist/tools/detector.d.ts +33 -0
- package/dist/tools/detector.d.ts.map +1 -0
- package/dist/tools/detector.js +145 -0
- package/dist/tools/detector.js.map +1 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/manager.d.ts +21 -0
- package/dist/tools/manager.d.ts.map +1 -0
- package/dist/tools/manager.js +104 -0
- package/dist/tools/manager.js.map +1 -0
- package/dist/tools/registry.d.ts +8 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +36 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/types.d.ts +41 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +5 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/types/sso.d.ts +42 -0
- package/dist/types/sso.d.ts.map +1 -0
- package/dist/types/sso.js +2 -0
- package/dist/types/sso.js.map +1 -0
- package/dist/utils/agent-compatibility.d.ts +32 -0
- package/dist/utils/agent-compatibility.d.ts.map +1 -0
- package/dist/utils/agent-compatibility.js +140 -0
- package/dist/utils/agent-compatibility.js.map +1 -0
- package/dist/utils/async-tips.d.ts.map +1 -1
- package/dist/utils/async-tips.js +16 -55
- package/dist/utils/async-tips.js.map +1 -1
- package/dist/utils/clipboard.d.ts +16 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +179 -0
- package/dist/utils/clipboard.js.map +1 -0
- package/dist/utils/codemie-integration-validator.d.ts +17 -0
- package/dist/utils/codemie-integration-validator.d.ts.map +1 -0
- package/dist/utils/codemie-integration-validator.js +105 -0
- package/dist/utils/codemie-integration-validator.js.map +1 -0
- package/dist/utils/codemie-model-fetcher.d.ts +11 -0
- package/dist/utils/codemie-model-fetcher.d.ts.map +1 -0
- package/dist/utils/codemie-model-fetcher.js +242 -0
- package/dist/utils/codemie-model-fetcher.js.map +1 -0
- package/dist/utils/config-loader.d.ts +118 -0
- package/dist/utils/config-loader.d.ts.map +1 -0
- package/dist/utils/config-loader.js +397 -0
- package/dist/utils/config-loader.js.map +1 -0
- package/dist/utils/credential-store.d.ts +16 -0
- package/dist/utils/credential-store.d.ts.map +1 -0
- package/dist/utils/credential-store.js +109 -0
- package/dist/utils/credential-store.js.map +1 -0
- package/dist/utils/dirname.d.ts +7 -0
- package/dist/utils/dirname.d.ts.map +1 -0
- package/dist/utils/dirname.js +11 -0
- package/dist/utils/dirname.js.map +1 -0
- package/dist/utils/errors.js +7 -17
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/exec.js +3 -6
- package/dist/utils/exec.js.map +1 -1
- package/dist/utils/first-time.d.ts +34 -0
- package/dist/utils/first-time.d.ts.map +1 -0
- package/dist/utils/first-time.js +226 -0
- package/dist/utils/first-time.js.map +1 -0
- package/dist/utils/health-checker.d.ts +20 -0
- package/dist/utils/health-checker.d.ts.map +1 -0
- package/dist/utils/health-checker.js +172 -0
- package/dist/utils/health-checker.js.map +1 -0
- package/dist/utils/logger.js +12 -18
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/model-fetcher.d.ts +21 -0
- package/dist/utils/model-fetcher.d.ts.map +1 -0
- package/dist/utils/model-fetcher.js +150 -0
- package/dist/utils/model-fetcher.js.map +1 -0
- package/dist/utils/sso-auth.d.ts +15 -0
- package/dist/utils/sso-auth.d.ts.map +1 -0
- package/dist/utils/sso-auth.js +207 -0
- package/dist/utils/sso-auth.js.map +1 -0
- package/dist/utils/sso-gateway.d.ts +47 -0
- package/dist/utils/sso-gateway.d.ts.map +1 -0
- package/dist/utils/sso-gateway.js +298 -0
- package/dist/utils/sso-gateway.js.map +1 -0
- package/dist/utils/tips.d.ts.map +1 -1
- package/dist/utils/tips.js +13 -52
- package/dist/utils/tips.js.map +1 -1
- package/dist/workflows/detector.d.ts +37 -0
- package/dist/workflows/detector.d.ts.map +1 -0
- package/dist/workflows/detector.js +160 -0
- package/dist/workflows/detector.js.map +1 -0
- package/dist/workflows/index.d.ts +8 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/index.js +8 -0
- package/dist/workflows/index.js.map +1 -0
- package/dist/workflows/installer.d.ts +24 -0
- package/dist/workflows/installer.d.ts.map +1 -0
- package/dist/workflows/installer.js +105 -0
- package/dist/workflows/installer.js.map +1 -0
- package/dist/workflows/registry.d.ts +29 -0
- package/dist/workflows/registry.d.ts.map +1 -0
- package/dist/workflows/registry.js +54 -0
- package/dist/workflows/registry.js.map +1 -0
- package/dist/workflows/templates/github/metadata.d.ts +6 -0
- package/dist/workflows/templates/github/metadata.d.ts.map +1 -0
- package/dist/workflows/templates/github/metadata.js +111 -0
- package/dist/workflows/templates/github/metadata.js.map +1 -0
- package/dist/workflows/templates/gitlab/metadata.d.ts +6 -0
- package/dist/workflows/templates/gitlab/metadata.d.ts.map +1 -0
- package/dist/workflows/templates/gitlab/metadata.js +14 -0
- package/dist/workflows/templates/gitlab/metadata.js.map +1 -0
- package/dist/workflows/types.d.ts +71 -0
- package/dist/workflows/types.d.ts.map +1 -0
- package/dist/workflows/types.js +5 -0
- package/dist/workflows/types.js.map +1 -0
- package/package.json +32 -25
- package/src/workflows/templates/github/code-ci.yml +529 -0
- package/src/workflows/templates/github/inline-fix.yml +665 -0
- package/src/workflows/templates/github/pr-review.yml +677 -0
- package/.claude/agents/README.md +0 -298
- package/.claude/agents/release-manager.md +0 -857
- package/.codemie/guides/git-workflow.md +0 -493
- package/CLAUDE.md +0 -855
- package/dist/agents/adapters/aider.d.ts +0 -12
- package/dist/agents/adapters/aider.d.ts.map +0 -1
- package/dist/agents/adapters/aider.js +0 -80
- package/dist/agents/adapters/aider.js.map +0 -1
- package/dist/cli/cli.d.ts +0 -4
- package/dist/cli/cli.d.ts.map +0 -1
- package/dist/cli/cli.js +0 -107
- package/dist/cli/cli.js.map +0 -1
- package/dist/cli/commands/mcp.d.ts +0 -3
- package/dist/cli/commands/mcp.d.ts.map +0 -1
- package/dist/cli/commands/mcp.js +0 -459
- package/dist/cli/commands/mcp.js.map +0 -1
- package/dist/code/agent-events.d.ts +0 -39
- package/dist/code/agent-events.d.ts.map +0 -1
- package/dist/code/agent-events.js +0 -4
- package/dist/code/agent-events.js.map +0 -1
- package/dist/code/agent.d.ts +0 -19
- package/dist/code/agent.d.ts.map +0 -1
- package/dist/code/agent.js +0 -144
- package/dist/code/agent.js.map +0 -1
- package/dist/code/config.d.ts +0 -13
- package/dist/code/config.d.ts.map +0 -1
- package/dist/code/config.js +0 -41
- package/dist/code/config.js.map +0 -1
- package/dist/code/index.d.ts +0 -19
- package/dist/code/index.d.ts.map +0 -1
- package/dist/code/index.js +0 -400
- package/dist/code/index.js.map +0 -1
- package/dist/code/prompts.d.ts +0 -2
- package/dist/code/prompts.d.ts.map +0 -1
- package/dist/code/prompts.js +0 -45
- package/dist/code/prompts.js.map +0 -1
- package/dist/code/tools/command.d.ts +0 -8
- package/dist/code/tools/command.d.ts.map +0 -1
- package/dist/code/tools/command.js +0 -83
- package/dist/code/tools/command.js.map +0 -1
- package/dist/code/tools/diff-utils.d.ts +0 -2
- package/dist/code/tools/diff-utils.d.ts.map +0 -1
- package/dist/code/tools/diff-utils.js +0 -45
- package/dist/code/tools/diff-utils.js.map +0 -1
- package/dist/code/tools/filesystem.d.ts +0 -11
- package/dist/code/tools/filesystem.d.ts.map +0 -1
- package/dist/code/tools/filesystem.js +0 -442
- package/dist/code/tools/filesystem.js.map +0 -1
- package/dist/code/tools/git.d.ts +0 -7
- package/dist/code/tools/git.d.ts.map +0 -1
- package/dist/code/tools/git.js +0 -111
- package/dist/code/tools/git.js.map +0 -1
- package/dist/code/tools/mcp.d.ts +0 -13
- package/dist/code/tools/mcp.d.ts.map +0 -1
- package/dist/code/tools/mcp.js +0 -230
- package/dist/code/tools/mcp.js.map +0 -1
- package/dist/data/tips.json +0 -118
- package/dist/ui/terminal-ui.d.ts +0 -73
- package/dist/ui/terminal-ui.d.ts.map +0 -1
- package/dist/ui/terminal-ui.js +0 -900
- package/dist/ui/terminal-ui.js.map +0 -1
- package/dist/utils/env-mapper.d.ts +0 -40
- package/dist/utils/env-mapper.d.ts.map +0 -1
- package/dist/utils/env-mapper.js +0 -122
- package/dist/utils/env-mapper.js.map +0 -1
- package/docs/USER_GUIDE.md +0 -573
- package/eslint.config.mjs +0 -43
- package/tests/agent-direct.test.mjs +0 -45
- package/tests/agent-output.test.mjs +0 -64
- package/tests/codemie-code.test.mjs +0 -42
- package/tests/context7-only.test.mjs +0 -42
- package/tests/conversation-flow.test.mjs +0 -63
- package/tests/interactive-simulation.test.mjs +0 -60
- package/tests/live-output.test.mjs +0 -53
- package/tests/mcp-context7.test.mjs +0 -105
- package/tests/mcp-e2e.test.mjs +0 -109
- package/tests/mcp-time-server.test.mjs +0 -58
- package/tests/streaming.test.mjs +0 -57
- package/tests/test-helpers.mjs +0 -94
- package/tests/text-wrapping.test.mjs +0 -33
- package/tests/tool-count.test.mjs +0 -81
- package/tests/ui-format.test.mjs +0 -39
- package/tests/ui-state.test.mjs +0 -72
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration Test: CodeMieCode class tool calling
|
|
3
|
-
* Uses Node.js native test runner
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { describe, it, before, after } from 'node:test';
|
|
7
|
-
import assert from 'node:assert';
|
|
8
|
-
import { CodeMieCode } from '../dist/code/index.js';
|
|
9
|
-
import { skipIfNoBaseUrl } from './test-helpers.mjs';
|
|
10
|
-
|
|
11
|
-
describe('CodeMieCode Tool Calling', () => {
|
|
12
|
-
let assistant;
|
|
13
|
-
|
|
14
|
-
before(async () => {
|
|
15
|
-
if (skipIfNoBaseUrl()) return;
|
|
16
|
-
|
|
17
|
-
assistant = new CodeMieCode(process.cwd());
|
|
18
|
-
await assistant.initialize({ showTips: false });
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
after(async () => {
|
|
22
|
-
if (assistant) {
|
|
23
|
-
await assistant.dispose();
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should initialize successfully', () => {
|
|
28
|
-
if (skipIfNoBaseUrl()) return;
|
|
29
|
-
|
|
30
|
-
assert.ok(assistant, 'Assistant should be initialized');
|
|
31
|
-
assert.ok(assistant.agent, 'Assistant should have an agent');
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should list files in current directory', async () => {
|
|
35
|
-
if (skipIfNoBaseUrl()) return;
|
|
36
|
-
const response = await assistant.chat('list files in the current directory');
|
|
37
|
-
|
|
38
|
-
assert.ok(response, 'Response should be defined');
|
|
39
|
-
assert.ok(typeof response === 'string', 'Response should be a string');
|
|
40
|
-
assert.ok(response.length > 0, 'Response should not be empty');
|
|
41
|
-
});
|
|
42
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration Test: Context7 MCP Server Only
|
|
3
|
-
* Uses Node.js native test runner
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { describe, it, before, after } from 'node:test';
|
|
7
|
-
import assert from 'node:assert';
|
|
8
|
-
import { MCPTools } from '../dist/code/tools/mcp.js';
|
|
9
|
-
import { skipIfNoBaseUrl } from './test-helpers.mjs';
|
|
10
|
-
|
|
11
|
-
describe('Context7 MCP Server Only', () => {
|
|
12
|
-
let mcpTools;
|
|
13
|
-
|
|
14
|
-
before(async () => {
|
|
15
|
-
if (skipIfNoBaseUrl()) return;
|
|
16
|
-
|
|
17
|
-
mcpTools = new MCPTools(process.cwd());
|
|
18
|
-
await mcpTools.initialize(['context7']);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
after(async () => {
|
|
22
|
-
if (mcpTools) {
|
|
23
|
-
await mcpTools.dispose();
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should load tools from context7 server', async () => {
|
|
28
|
-
if (skipIfNoBaseUrl()) return;
|
|
29
|
-
const tools = await mcpTools.getTools();
|
|
30
|
-
assert.ok(tools.length > 0, 'Should have loaded tools from context7');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should have library-related tools', async () => {
|
|
34
|
-
if (skipIfNoBaseUrl()) return;
|
|
35
|
-
const tools = await mcpTools.getTools();
|
|
36
|
-
const hasLibraryTools = tools.some(tool =>
|
|
37
|
-
tool.name.includes('library') || tool.name.includes('resolve')
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
assert.ok(hasLibraryTools, 'Should have library-related tools');
|
|
41
|
-
});
|
|
42
|
-
});
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration Test: Conversation flow with multiple questions
|
|
3
|
-
* Uses Node.js native test runner
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { describe, it, before, after } from 'node:test';
|
|
7
|
-
import assert from 'node:assert';
|
|
8
|
-
import { CodeMieCode } from '../dist/code/index.js';
|
|
9
|
-
import { skipIfNoBaseUrl } from './test-helpers.mjs';
|
|
10
|
-
|
|
11
|
-
describe('Conversation Flow', () => {
|
|
12
|
-
let assistant;
|
|
13
|
-
|
|
14
|
-
before(async () => {
|
|
15
|
-
if (skipIfNoBaseUrl()) return;
|
|
16
|
-
|
|
17
|
-
assistant = new CodeMieCode(process.cwd());
|
|
18
|
-
await assistant.initialize({ showTips: false });
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
after(async () => {
|
|
22
|
-
if (assistant) {
|
|
23
|
-
await assistant.dispose();
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should handle 3 consecutive questions', async () => {
|
|
28
|
-
if (skipIfNoBaseUrl()) return;
|
|
29
|
-
// Question 1
|
|
30
|
-
const response1 = await assistant.chat('What is 2+2?');
|
|
31
|
-
assert.ok(response1, 'Response 1 should be defined');
|
|
32
|
-
assert.ok(response1.includes('4'), 'Response 1 should contain "4"');
|
|
33
|
-
|
|
34
|
-
// Question 2
|
|
35
|
-
const response2 = await assistant.chat('What is the capital of France?');
|
|
36
|
-
assert.ok(response2, 'Response 2 should be defined');
|
|
37
|
-
assert.ok(response2.toLowerCase().includes('paris'), 'Response 2 should contain "paris"');
|
|
38
|
-
|
|
39
|
-
// Question 3
|
|
40
|
-
const response3 = await assistant.chat('List the files in the current directory');
|
|
41
|
-
assert.ok(response3, 'Response 3 should be defined');
|
|
42
|
-
|
|
43
|
-
// Verify conversation history
|
|
44
|
-
const history = assistant.agent.getHistory();
|
|
45
|
-
assert.ok(history.length > 0, 'History should not be empty');
|
|
46
|
-
|
|
47
|
-
// Count user messages - should be exactly 3
|
|
48
|
-
const userMessages = history.filter(m => m.role === 'user');
|
|
49
|
-
assert.strictEqual(userMessages.length, 3, 'Should have exactly 3 user messages');
|
|
50
|
-
|
|
51
|
-
// Verify all 3 questions are in history
|
|
52
|
-
const questions = [
|
|
53
|
-
'What is 2+2?',
|
|
54
|
-
'What is the capital of France?',
|
|
55
|
-
'List the files in the current directory'
|
|
56
|
-
];
|
|
57
|
-
|
|
58
|
-
for (let i = 0; i < questions.length; i++) {
|
|
59
|
-
assert.ok(userMessages[i], `User message ${i} should exist`);
|
|
60
|
-
assert.strictEqual(userMessages[i].content, questions[i], `User message ${i} should match question`);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration Test: Interactive conversation simulation
|
|
3
|
-
* Uses Node.js native test runner
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { describe, it, before, after } from 'node:test';
|
|
7
|
-
import assert from 'node:assert';
|
|
8
|
-
import { CodeMieCode } from '../dist/code/index.js';
|
|
9
|
-
import { skipIfNoBaseUrl } from './test-helpers.mjs';
|
|
10
|
-
|
|
11
|
-
describe('Interactive Conversation Simulation', () => {
|
|
12
|
-
let assistant;
|
|
13
|
-
|
|
14
|
-
before(async () => {
|
|
15
|
-
if (skipIfNoBaseUrl()) return;
|
|
16
|
-
|
|
17
|
-
assistant = new CodeMieCode(process.cwd());
|
|
18
|
-
await assistant.initialize({ showTips: false });
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
after(async () => {
|
|
22
|
-
if (assistant) {
|
|
23
|
-
await assistant.dispose();
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should handle 3 consecutive interactive questions', async () => {
|
|
28
|
-
if (skipIfNoBaseUrl()) return;
|
|
29
|
-
const questions = [
|
|
30
|
-
'What is 2+2?',
|
|
31
|
-
'What is the capital of France?',
|
|
32
|
-
'List files in the current directory'
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
let completedQuestions = 0;
|
|
36
|
-
|
|
37
|
-
for (let i = 0; i < questions.length; i++) {
|
|
38
|
-
const question = questions[i];
|
|
39
|
-
let hasCompleted = false;
|
|
40
|
-
let hasError = false;
|
|
41
|
-
|
|
42
|
-
await assistant.agent.chatStream(question, (event) => {
|
|
43
|
-
if (event.type === 'complete') {
|
|
44
|
-
hasCompleted = true;
|
|
45
|
-
}
|
|
46
|
-
if (event.type === 'error') {
|
|
47
|
-
hasError = true;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
assert.ok(hasCompleted || !hasError, `Question ${i + 1} should complete successfully`);
|
|
52
|
-
|
|
53
|
-
if (hasCompleted) {
|
|
54
|
-
completedQuestions++;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
assert.strictEqual(completedQuestions, 3, 'All 3 questions should complete');
|
|
59
|
-
});
|
|
60
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration Test: Live output format
|
|
3
|
-
* Uses Node.js native test runner
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { describe, it, before } from 'node:test';
|
|
7
|
-
import assert from 'node:assert';
|
|
8
|
-
import { CodeMieAgent } from '../dist/code/agent.js';
|
|
9
|
-
import { loadConfig } from '../dist/code/config.js';
|
|
10
|
-
import { FilesystemTools } from '../dist/code/tools/filesystem.js';
|
|
11
|
-
import { skipIfNoBaseUrl } from './test-helpers.mjs';
|
|
12
|
-
|
|
13
|
-
describe('Live Output Format', () => {
|
|
14
|
-
let agent;
|
|
15
|
-
|
|
16
|
-
before(() => {
|
|
17
|
-
if (skipIfNoBaseUrl()) return;
|
|
18
|
-
|
|
19
|
-
const config = loadConfig(process.cwd());
|
|
20
|
-
const filesystemTools = new FilesystemTools({
|
|
21
|
-
allowedDirectories: [process.cwd()]
|
|
22
|
-
});
|
|
23
|
-
const tools = filesystemTools.getTools();
|
|
24
|
-
agent = new CodeMieAgent(config, tools);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should produce correctly formatted live output', async () => {
|
|
28
|
-
if (skipIfNoBaseUrl()) return;
|
|
29
|
-
let hasToolCall = false;
|
|
30
|
-
let hasToolResult = false;
|
|
31
|
-
let hasContent = false;
|
|
32
|
-
|
|
33
|
-
await agent.chatStream('list files in current directory', (event) => {
|
|
34
|
-
switch (event.type) {
|
|
35
|
-
case 'content_chunk':
|
|
36
|
-
hasContent = true;
|
|
37
|
-
break;
|
|
38
|
-
|
|
39
|
-
case 'tool_call_start':
|
|
40
|
-
hasToolCall = true;
|
|
41
|
-
break;
|
|
42
|
-
|
|
43
|
-
case 'tool_call_result':
|
|
44
|
-
hasToolResult = true;
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
assert.ok(hasContent, 'Should have content chunks');
|
|
50
|
-
assert.ok(hasToolCall, 'Should have tool calls');
|
|
51
|
-
assert.ok(hasToolResult, 'Should have tool results');
|
|
52
|
-
});
|
|
53
|
-
});
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration Test: Context7 MCP Server Integration
|
|
3
|
-
* Uses Node.js native test runner
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { describe, it, before, after } from 'node:test';
|
|
7
|
-
import assert from 'node:assert';
|
|
8
|
-
import { MCPTools } from '../dist/code/tools/mcp.js';
|
|
9
|
-
import path from 'path';
|
|
10
|
-
import { fileURLToPath } from 'url';
|
|
11
|
-
import * as fs from 'fs/promises';
|
|
12
|
-
import * as os from 'os';
|
|
13
|
-
import { skipIfNoBaseUrl } from './test-helpers.mjs';
|
|
14
|
-
|
|
15
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
-
const __dirname = path.dirname(__filename);
|
|
17
|
-
|
|
18
|
-
describe('MCP Context7 Server', () => {
|
|
19
|
-
let mcpTools;
|
|
20
|
-
let configPath;
|
|
21
|
-
let originalConfig;
|
|
22
|
-
|
|
23
|
-
before(async () => {
|
|
24
|
-
if (skipIfNoBaseUrl()) return;
|
|
25
|
-
configPath = path.join(os.homedir(), '.codemie', 'config.json');
|
|
26
|
-
|
|
27
|
-
// Backup original config
|
|
28
|
-
try {
|
|
29
|
-
const content = await fs.readFile(configPath, 'utf-8');
|
|
30
|
-
originalConfig = JSON.parse(content);
|
|
31
|
-
} catch (error) {
|
|
32
|
-
await fs.mkdir(path.dirname(configPath), { recursive: true });
|
|
33
|
-
originalConfig = {};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Ensure context7 and time servers are configured
|
|
37
|
-
const config = { ...originalConfig };
|
|
38
|
-
if (!config.mcpServers) {
|
|
39
|
-
config.mcpServers = {};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
config.mcpServers.context7 = {
|
|
43
|
-
command: 'npx',
|
|
44
|
-
args: ['-y', '@upstash/context7-mcp']
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
config.mcpServers.time = {
|
|
48
|
-
transport: 'stdio',
|
|
49
|
-
command: 'uvx',
|
|
50
|
-
args: ['mcp-server-time']
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
await fs.writeFile(configPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
54
|
-
|
|
55
|
-
mcpTools = new MCPTools(process.cwd());
|
|
56
|
-
await mcpTools.initialize(['time', 'context7']);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
after(async () => {
|
|
60
|
-
if (mcpTools) {
|
|
61
|
-
await mcpTools.dispose();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Restore original config
|
|
65
|
-
if (originalConfig) {
|
|
66
|
-
await fs.writeFile(configPath, JSON.stringify(originalConfig, null, 2), 'utf-8');
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('should load tools from both time and context7 servers', async () => {
|
|
71
|
-
if (skipIfNoBaseUrl()) return;
|
|
72
|
-
const tools = await mcpTools.getTools();
|
|
73
|
-
assert.ok(tools.length > 0, 'Should have loaded tools');
|
|
74
|
-
|
|
75
|
-
const timeTools = tools.filter(t => t.name.includes('time'));
|
|
76
|
-
const context7Tools = tools.filter(t => t.name.includes('library') || t.name.includes('resolve'));
|
|
77
|
-
|
|
78
|
-
assert.ok(timeTools.length > 0, 'Should have time tools');
|
|
79
|
-
assert.ok(context7Tools.length > 0, 'Should have context7 tools');
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('should query time in Hong Kong', async () => {
|
|
83
|
-
if (skipIfNoBaseUrl()) return;
|
|
84
|
-
const tools = await mcpTools.getTools();
|
|
85
|
-
const getTimeTool = tools.find(t => t.name === 'mcp_get_current_time');
|
|
86
|
-
|
|
87
|
-
const timeResult = await getTimeTool.invoke({ timezone: 'Asia/Hong_Kong' });
|
|
88
|
-
const timeData = typeof timeResult === 'string' ? JSON.parse(timeResult) : timeResult;
|
|
89
|
-
|
|
90
|
-
assert.ok(timeData.timezone && timeData.timezone.includes('Hong_Kong'), 'Should return Hong Kong timezone');
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('should resolve library ID for langchain', async () => {
|
|
94
|
-
if (skipIfNoBaseUrl()) return;
|
|
95
|
-
const tools = await mcpTools.getTools();
|
|
96
|
-
const resolveTool = tools.find(t => t.name.includes('resolve') && t.name.includes('library'));
|
|
97
|
-
|
|
98
|
-
assert.ok(resolveTool, 'Should have resolve-library-id tool');
|
|
99
|
-
|
|
100
|
-
const resolveResult = await resolveTool.invoke({ libraryName: 'langchain' });
|
|
101
|
-
|
|
102
|
-
assert.ok(resolveResult, 'Should return a result');
|
|
103
|
-
assert.ok(typeof resolveResult === 'string' && resolveResult.length > 0, 'Result should be non-empty string');
|
|
104
|
-
});
|
|
105
|
-
});
|
package/tests/mcp-e2e.test.mjs
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration Test: End-to-End Time MCP Server Integration
|
|
3
|
-
* Uses Node.js native test runner
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { describe, it, before, after } from 'node:test';
|
|
7
|
-
import assert from 'node:assert';
|
|
8
|
-
import { MCPTools } from '../dist/code/tools/mcp.js';
|
|
9
|
-
import path from 'path';
|
|
10
|
-
import { fileURLToPath } from 'url';
|
|
11
|
-
import * as fs from 'fs/promises';
|
|
12
|
-
import * as os from 'os';
|
|
13
|
-
import { skipIfNoBaseUrl } from './test-helpers.mjs';
|
|
14
|
-
|
|
15
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
-
const __dirname = path.dirname(__filename);
|
|
17
|
-
|
|
18
|
-
describe('MCP E2E Time Server Integration', () => {
|
|
19
|
-
let mcpTools;
|
|
20
|
-
let configPath;
|
|
21
|
-
let originalConfig;
|
|
22
|
-
|
|
23
|
-
before(async () => {
|
|
24
|
-
if (skipIfNoBaseUrl()) return;
|
|
25
|
-
configPath = path.join(os.homedir(), '.codemie', 'config.json');
|
|
26
|
-
|
|
27
|
-
// Backup original config
|
|
28
|
-
try {
|
|
29
|
-
const content = await fs.readFile(configPath, 'utf-8');
|
|
30
|
-
originalConfig = JSON.parse(content);
|
|
31
|
-
} catch (error) {
|
|
32
|
-
await fs.mkdir(path.dirname(configPath), { recursive: true });
|
|
33
|
-
originalConfig = {};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Ensure time server is configured
|
|
37
|
-
const config = { ...originalConfig };
|
|
38
|
-
if (!config.mcpServers) {
|
|
39
|
-
config.mcpServers = {};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
config.mcpServers.time = {
|
|
43
|
-
transport: 'stdio',
|
|
44
|
-
command: 'uvx',
|
|
45
|
-
args: ['mcp-server-time']
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
await fs.writeFile(configPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
49
|
-
|
|
50
|
-
mcpTools = new MCPTools(process.cwd());
|
|
51
|
-
await mcpTools.initialize(['time']);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
after(async () => {
|
|
55
|
-
if (mcpTools) {
|
|
56
|
-
await mcpTools.dispose();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Restore original config
|
|
60
|
-
if (originalConfig) {
|
|
61
|
-
await fs.writeFile(configPath, JSON.stringify(originalConfig, null, 2), 'utf-8');
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('should load tools from configured time server', async () => {
|
|
66
|
-
if (skipIfNoBaseUrl()) return;
|
|
67
|
-
const tools = await mcpTools.getTools();
|
|
68
|
-
assert.ok(tools.length > 0, 'Should have loaded tools');
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('should query time in Hong Kong', async () => {
|
|
72
|
-
if (skipIfNoBaseUrl()) return;
|
|
73
|
-
const tools = await mcpTools.getTools();
|
|
74
|
-
const getTimeTool = tools.find(t => t.name === 'mcp_get_current_time');
|
|
75
|
-
|
|
76
|
-
assert.ok(getTimeTool, 'get_current_time tool should exist');
|
|
77
|
-
|
|
78
|
-
const result = await getTimeTool.invoke({ timezone: 'Asia/Hong_Kong' });
|
|
79
|
-
const data = typeof result === 'string' ? JSON.parse(result) : result;
|
|
80
|
-
|
|
81
|
-
assert.ok(data.timezone && data.timezone.includes('Hong_Kong'), 'Should return Hong Kong timezone');
|
|
82
|
-
assert.ok(data.datetime, 'Should return datetime');
|
|
83
|
-
assert.ok(data.day_of_week, 'Should return day of week');
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('should convert time between timezones', async () => {
|
|
87
|
-
if (skipIfNoBaseUrl()) return;
|
|
88
|
-
const tools = await mcpTools.getTools();
|
|
89
|
-
const convertTimeTool = tools.find(t => t.name === 'mcp_convert_time');
|
|
90
|
-
|
|
91
|
-
assert.ok(convertTimeTool, 'convert_time tool should be available');
|
|
92
|
-
|
|
93
|
-
const convertResult = await convertTimeTool.invoke({
|
|
94
|
-
source_timezone: 'Asia/Hong_Kong',
|
|
95
|
-
time: '14:00',
|
|
96
|
-
target_timezone: 'America/New_York'
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
assert.ok(convertResult, 'Should return a result');
|
|
100
|
-
|
|
101
|
-
const convertData = typeof convertResult === 'string' ? JSON.parse(convertResult) : convertResult;
|
|
102
|
-
|
|
103
|
-
assert.ok(convertData.source, 'Should have source timezone data');
|
|
104
|
-
assert.ok(convertData.target, 'Should have target timezone data');
|
|
105
|
-
assert.ok(convertData.target.datetime, 'Should have target datetime');
|
|
106
|
-
assert.ok(convertData.target.timezone.includes('New_York'), 'Should convert to New York timezone');
|
|
107
|
-
assert.ok(convertData.time_difference, 'Should have time difference');
|
|
108
|
-
});
|
|
109
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration Test: Time MCP Server
|
|
3
|
-
* Uses Node.js native test runner
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { describe, it, before, after } from 'node:test';
|
|
7
|
-
import assert from 'node:assert';
|
|
8
|
-
import { MCPTools } from '../dist/code/tools/mcp.js';
|
|
9
|
-
import path from 'path';
|
|
10
|
-
import { fileURLToPath } from 'url';
|
|
11
|
-
import { skipIfNoBaseUrl } from './test-helpers.mjs';
|
|
12
|
-
|
|
13
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
-
const __dirname = path.dirname(__filename);
|
|
15
|
-
|
|
16
|
-
describe('MCP Time Server', () => {
|
|
17
|
-
let mcpTools;
|
|
18
|
-
|
|
19
|
-
before(async () => {
|
|
20
|
-
if (skipIfNoBaseUrl()) return;
|
|
21
|
-
|
|
22
|
-
mcpTools = new MCPTools(process.cwd());
|
|
23
|
-
await mcpTools.initialize(['time']);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
after(async () => {
|
|
27
|
-
if (mcpTools) {
|
|
28
|
-
await mcpTools.dispose();
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('should load tools from time server', async () => {
|
|
33
|
-
if (skipIfNoBaseUrl()) return;
|
|
34
|
-
const tools = await mcpTools.getTools();
|
|
35
|
-
assert.ok(tools.length > 0, 'Should have loaded tools from time server');
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('should have get_current_time tool', async () => {
|
|
39
|
-
if (skipIfNoBaseUrl()) return;
|
|
40
|
-
const tools = await mcpTools.getTools();
|
|
41
|
-
const getTimeTool = tools.find(t => t.name === 'mcp_get_current_time');
|
|
42
|
-
assert.ok(getTimeTool, 'get_current_time tool should be available');
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('should execute get_current_time tool', async () => {
|
|
46
|
-
if (skipIfNoBaseUrl()) return;
|
|
47
|
-
const tools = await mcpTools.getTools();
|
|
48
|
-
const getTimeTool = tools.find(t => t.name === 'mcp_get_current_time');
|
|
49
|
-
|
|
50
|
-
const result = await getTimeTool.invoke({ timezone: 'Europe/Vilnius' });
|
|
51
|
-
|
|
52
|
-
assert.ok(result, 'Tool should return a result');
|
|
53
|
-
|
|
54
|
-
// Try to parse the result
|
|
55
|
-
const data = typeof result === 'string' ? JSON.parse(result) : result;
|
|
56
|
-
assert.ok(data.datetime || data.timezone, 'Result should contain datetime or timezone');
|
|
57
|
-
});
|
|
58
|
-
});
|
package/tests/streaming.test.mjs
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration Test: Streaming functionality
|
|
3
|
-
* Uses Node.js native test runner
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { describe, it, before } from 'node:test';
|
|
7
|
-
import assert from 'node:assert';
|
|
8
|
-
import { CodeMieAgent } from '../dist/code/agent.js';
|
|
9
|
-
import { loadConfig } from '../dist/code/config.js';
|
|
10
|
-
import { FilesystemTools } from '../dist/code/tools/filesystem.js';
|
|
11
|
-
import { skipIfNoBaseUrl } from './test-helpers.mjs';
|
|
12
|
-
|
|
13
|
-
describe('Streaming', () => {
|
|
14
|
-
let agent;
|
|
15
|
-
|
|
16
|
-
before(() => {
|
|
17
|
-
if (skipIfNoBaseUrl()) return;
|
|
18
|
-
|
|
19
|
-
const config = loadConfig(process.cwd());
|
|
20
|
-
const filesystemTools = new FilesystemTools({
|
|
21
|
-
allowedDirectories: [process.cwd()]
|
|
22
|
-
});
|
|
23
|
-
const tools = filesystemTools.getTools();
|
|
24
|
-
agent = new CodeMieAgent(config, tools);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should stream tool calling events', async () => {
|
|
28
|
-
if (skipIfNoBaseUrl()) return;
|
|
29
|
-
|
|
30
|
-
const events = [];
|
|
31
|
-
|
|
32
|
-
await new Promise((resolve, reject) => {
|
|
33
|
-
agent.chatStream('list files in this directory', (event) => {
|
|
34
|
-
events.push(event.type);
|
|
35
|
-
|
|
36
|
-
switch(event.type) {
|
|
37
|
-
case 'complete':
|
|
38
|
-
try {
|
|
39
|
-
assert.ok(events.includes('thinking_start'), 'Should emit thinking_start');
|
|
40
|
-
assert.ok(events.includes('thinking_end'), 'Should emit thinking_end');
|
|
41
|
-
assert.ok(events.includes('tool_call_start'), 'Should emit tool_call_start');
|
|
42
|
-
assert.ok(events.includes('tool_call_result'), 'Should emit tool_call_result');
|
|
43
|
-
assert.ok(events.includes('content_chunk'), 'Should emit content_chunk');
|
|
44
|
-
assert.ok(events.includes('complete'), 'Should emit complete');
|
|
45
|
-
resolve();
|
|
46
|
-
} catch (error) {
|
|
47
|
-
reject(error);
|
|
48
|
-
}
|
|
49
|
-
break;
|
|
50
|
-
case 'error':
|
|
51
|
-
reject(new Error(event.error));
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
});
|
package/tests/test-helpers.mjs
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test helpers and utilities
|
|
3
|
-
* Provides common functionality for test files
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Check if base URL is configured for tests to run
|
|
8
|
-
* Tests that require LLM interaction need a valid base URL
|
|
9
|
-
*
|
|
10
|
-
* @returns {boolean} true if base URL is configured, false otherwise
|
|
11
|
-
*/
|
|
12
|
-
export function isBaseUrlConfigured() {
|
|
13
|
-
return !!(
|
|
14
|
-
process.env.CODEMIE_BASE_URL ||
|
|
15
|
-
process.env.ANTHROPIC_BASE_URL ||
|
|
16
|
-
process.env.OPENAI_BASE_URL
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Check if we should skip tests that require base URL
|
|
22
|
-
* Prints a warning message if base URL is not configured
|
|
23
|
-
*
|
|
24
|
-
* This function returns true if tests should be skipped. Tests should check
|
|
25
|
-
* the return value and return early if true.
|
|
26
|
-
*
|
|
27
|
-
* @param {string} [customMessage] - Optional custom message to display
|
|
28
|
-
* @returns {boolean} true if test should be skipped, false otherwise
|
|
29
|
-
*/
|
|
30
|
-
export function skipIfNoBaseUrl(customMessage) {
|
|
31
|
-
if (!isBaseUrlConfigured()) {
|
|
32
|
-
const message = customMessage ||
|
|
33
|
-
'Base URL not configured. Set CODEMIE_BASE_URL, ANTHROPIC_BASE_URL, or OPENAI_BASE_URL environment variable.';
|
|
34
|
-
|
|
35
|
-
console.warn(`⚠️ Skipping test: ${message}`);
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Get list of required environment variables that are missing
|
|
43
|
-
*
|
|
44
|
-
* @returns {string[]} Array of missing environment variable names
|
|
45
|
-
*/
|
|
46
|
-
export function getMissingEnvVars() {
|
|
47
|
-
const missing = [];
|
|
48
|
-
|
|
49
|
-
// Check base URL
|
|
50
|
-
if (!isBaseUrlConfigured()) {
|
|
51
|
-
missing.push('BASE_URL (CODEMIE_BASE_URL, ANTHROPIC_BASE_URL, or OPENAI_BASE_URL)');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Check auth token
|
|
55
|
-
const hasAuthToken = !!(
|
|
56
|
-
process.env.CODEMIE_AUTH_TOKEN ||
|
|
57
|
-
process.env.CODEMIE_API_KEY ||
|
|
58
|
-
process.env.ANTHROPIC_AUTH_TOKEN ||
|
|
59
|
-
process.env.ANTHROPIC_API_KEY ||
|
|
60
|
-
process.env.OPENAI_AUTH_TOKEN ||
|
|
61
|
-
process.env.OPENAI_API_KEY
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
if (!hasAuthToken) {
|
|
65
|
-
missing.push('AUTH_TOKEN (CODEMIE_AUTH_TOKEN, ANTHROPIC_AUTH_TOKEN, or OPENAI_AUTH_TOKEN)');
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return missing;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Check if all required environment variables are configured
|
|
73
|
-
*
|
|
74
|
-
* @returns {boolean} true if all required env vars are set
|
|
75
|
-
*/
|
|
76
|
-
export function isFullyConfigured() {
|
|
77
|
-
return getMissingEnvVars().length === 0;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Print configuration status for debugging
|
|
82
|
-
*/
|
|
83
|
-
export function printConfigStatus() {
|
|
84
|
-
console.log('\n=== Test Configuration Status ===');
|
|
85
|
-
console.log('Base URL configured:', isBaseUrlConfigured());
|
|
86
|
-
console.log('Fully configured:', isFullyConfigured());
|
|
87
|
-
|
|
88
|
-
const missing = getMissingEnvVars();
|
|
89
|
-
if (missing.length > 0) {
|
|
90
|
-
console.log('\nMissing configuration:');
|
|
91
|
-
missing.forEach(env => console.log(` - ${env}`));
|
|
92
|
-
}
|
|
93
|
-
console.log('=================================\n');
|
|
94
|
-
}
|