@sunilp-org/jam-cli 0.1.0 → 0.1.1
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 +304 -52
- package/dist/commands/ask.d.ts +4 -0
- package/dist/commands/ask.d.ts.map +1 -1
- package/dist/commands/ask.js +202 -10
- package/dist/commands/ask.js.map +1 -1
- package/dist/commands/commit.d.ts +12 -0
- package/dist/commands/commit.d.ts.map +1 -0
- package/dist/commands/commit.js +135 -0
- package/dist/commands/commit.js.map +1 -0
- package/dist/commands/context.d.ts +12 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +52 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/review.d.ts +25 -0
- package/dist/commands/review.d.ts.map +1 -0
- package/dist/commands/review.js +117 -0
- package/dist/commands/review.js.map +1 -0
- package/dist/commands/run.d.ts +1 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +199 -197
- package/dist/commands/run.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +3 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/index.js +63 -1
- package/dist/index.js.map +1 -1
- package/dist/providers/base.d.ts +26 -0
- package/dist/providers/base.d.ts.map +1 -1
- package/dist/providers/factory.d.ts.map +1 -1
- package/dist/providers/factory.js +17 -1
- package/dist/providers/factory.js.map +1 -1
- package/dist/providers/groq.d.ts +16 -0
- package/dist/providers/groq.d.ts.map +1 -0
- package/dist/providers/groq.js +23 -0
- package/dist/providers/groq.js.map +1 -0
- package/dist/providers/ollama.d.ts +6 -1
- package/dist/providers/ollama.d.ts.map +1 -1
- package/dist/providers/ollama.js +77 -4
- package/dist/providers/ollama.js.map +1 -1
- package/dist/providers/openai.d.ts +18 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +229 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/tools/all-tools.d.ts +18 -0
- package/dist/tools/all-tools.d.ts.map +1 -0
- package/dist/tools/all-tools.js +95 -0
- package/dist/tools/all-tools.js.map +1 -0
- package/dist/tools/apply_patch.js +1 -1
- package/dist/tools/apply_patch.js.map +1 -1
- package/dist/tools/context-tools.d.ts +14 -0
- package/dist/tools/context-tools.d.ts.map +1 -0
- package/dist/tools/context-tools.js +63 -0
- package/dist/tools/context-tools.js.map +1 -0
- package/dist/tools/git_diff.js +1 -1
- package/dist/tools/git_diff.js.map +1 -1
- package/dist/tools/git_status.js +1 -1
- package/dist/tools/git_status.js.map +1 -1
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +2 -0
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/run_command.d.ts +8 -3
- package/dist/tools/run_command.d.ts.map +1 -1
- package/dist/tools/run_command.js +90 -3
- package/dist/tools/run_command.js.map +1 -1
- package/dist/ui/chat.d.ts.map +1 -1
- package/dist/ui/chat.js +173 -1
- package/dist/ui/chat.js.map +1 -1
- package/dist/ui/logo.d.ts.map +1 -1
- package/dist/ui/logo.js +5 -1
- package/dist/ui/logo.js.map +1 -1
- package/dist/utils/agent.d.ts +130 -0
- package/dist/utils/agent.d.ts.map +1 -0
- package/dist/utils/agent.js +449 -0
- package/dist/utils/agent.js.map +1 -0
- package/dist/utils/cache.d.ts +30 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +62 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/context.d.ts +38 -0
- package/dist/utils/context.d.ts.map +1 -0
- package/dist/utils/context.js +383 -0
- package/dist/utils/context.js.map +1 -0
- package/dist/utils/critic.d.ts +31 -0
- package/dist/utils/critic.d.ts.map +1 -0
- package/dist/utils/critic.js +126 -0
- package/dist/utils/critic.js.map +1 -0
- package/dist/utils/index-builder.d.ts +53 -0
- package/dist/utils/index-builder.d.ts.map +1 -0
- package/dist/utils/index-builder.js +241 -0
- package/dist/utils/index-builder.js.map +1 -0
- package/dist/utils/memory.d.ts +104 -0
- package/dist/utils/memory.d.ts.map +1 -0
- package/dist/utils/memory.js +215 -0
- package/dist/utils/memory.js.map +1 -0
- package/dist/utils/past-sessions.d.ts +31 -0
- package/dist/utils/past-sessions.d.ts.map +1 -0
- package/dist/utils/past-sessions.js +126 -0
- package/dist/utils/past-sessions.js.map +1 -0
- package/dist/utils/tokens.d.ts +53 -0
- package/dist/utils/tokens.d.ts.map +1 -0
- package/dist/utils/tokens.js +138 -0
- package/dist/utils/tokens.js.map +1 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
Ask questions • Explain code • Review diffs • Generate patches • Run agentic tasks
|
|
29
29
|
|
|
30
|
-
*All from your command line, powered by any
|
|
30
|
+
*All from your command line, powered by Ollama, OpenAI, Groq, or any compatible provider.*
|
|
31
31
|
|
|
32
32
|
[Getting Started](#quick-start) · [Commands](#commands) · [Configuration](#configuration) · [Contributing](#contributing) · [Security](#security-policy)
|
|
33
33
|
|
|
@@ -58,7 +58,7 @@ Most AI coding tools are built around a single vendor's model, require a browser
|
|
|
58
58
|
| 📂 | **Repo-aware** | Explain files, search code, review diffs with full workspace context |
|
|
59
59
|
| 🩹 | **Patch workflow** | Generate unified diffs, validate, preview, and apply with confirmation |
|
|
60
60
|
| 🤖 | **Tool-calling agent** | `jam run` gives the model access to local tools (read, search, diff, apply) |
|
|
61
|
-
| 🔌 | **Pluggable providers** | Ollama
|
|
61
|
+
| 🔌 | **Pluggable providers** | Ollama, OpenAI, Groq built-in; adapter pattern for adding any LLM |
|
|
62
62
|
| ⚙️ | **Layered config** | Global → repo → CLI flags; multiple named profiles |
|
|
63
63
|
| 🔐 | **Secure secrets** | OS keychain via keytar, env var fallback |
|
|
64
64
|
| 🐚 | **Shell completions** | Bash and Zsh |
|
|
@@ -162,7 +162,9 @@ jam ask "Hello" --profile work
|
|
|
162
162
|
| `--provider <name>` | Override provider |
|
|
163
163
|
| `--base-url <url>` | Override provider base URL |
|
|
164
164
|
| `--profile <name>` | Use a named config profile |
|
|
165
|
-
| `--no-
|
|
165
|
+
| `--no-tools` | Disable read-only tool use (file discovery) |
|
|
166
|
+
| `--no-color` | Strip ANSI colors from output (global flag) |
|
|
167
|
+
| `-q, --quiet` | Suppress all non-essential output (spinners, status lines, decorations) |
|
|
166
168
|
|
|
167
169
|
---
|
|
168
170
|
|
|
@@ -236,6 +238,50 @@ jam diff --staged --json # JSON output
|
|
|
236
238
|
|
|
237
239
|
---
|
|
238
240
|
|
|
241
|
+
### `jam review`
|
|
242
|
+
|
|
243
|
+
Review a branch or pull request with AI.
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
jam review # review current branch against main
|
|
247
|
+
jam review --base develop # diff against a different base branch
|
|
248
|
+
jam review --pr 42 # review a specific PR (requires GitHub CLI)
|
|
249
|
+
jam review --json # JSON output
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Options:**
|
|
253
|
+
|
|
254
|
+
| Flag | Description |
|
|
255
|
+
|------|-------------|
|
|
256
|
+
| `--base <ref>` | Base branch or ref to diff against (default: `main`) |
|
|
257
|
+
| `--pr <number>` | Review a specific PR number (requires `gh` CLI) |
|
|
258
|
+
| `--json` | Machine-readable JSON output |
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
### `jam commit`
|
|
263
|
+
|
|
264
|
+
Generate an AI-written commit message from staged changes and commit.
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
jam commit # generate message, confirm, then commit
|
|
268
|
+
jam commit --dry # generate message only, do not commit
|
|
269
|
+
jam commit --yes # skip confirmation prompt
|
|
270
|
+
jam commit --amend # amend the last commit with a new AI message
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
**Options:**
|
|
274
|
+
|
|
275
|
+
| Flag | Description |
|
|
276
|
+
|------|-------------|
|
|
277
|
+
| `--dry` | Generate the message but do not commit |
|
|
278
|
+
| `--yes` | Auto-confirm without prompting |
|
|
279
|
+
| `--amend` | Amend the last commit with a new AI-generated message |
|
|
280
|
+
|
|
281
|
+
Messages follow the [Conventional Commits](https://conventionalcommits.org) specification.
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
239
285
|
### `jam patch`
|
|
240
286
|
|
|
241
287
|
Ask the AI to generate a unified diff patch, validate it, and optionally apply it.
|
|
@@ -278,6 +324,7 @@ jam run "Read src/config.ts and identify any security issues"
|
|
|
278
324
|
| `git_diff` | Read | Get git diff |
|
|
279
325
|
| `write_file` | **Write** | Write to a file (prompts for confirmation) |
|
|
280
326
|
| `apply_patch` | **Write** | Apply a unified diff (prompts for confirmation) |
|
|
327
|
+
| `run_command` | **Write** | Execute a shell command (dangerous patterns blocked; prompts for confirmation) |
|
|
281
328
|
|
|
282
329
|
Write tools require confirmation unless `toolPolicy` is set to `allowlist` in config.
|
|
283
330
|
|
|
@@ -302,6 +349,18 @@ jam config init --global # create ~/.config/jam/config.json
|
|
|
302
349
|
|
|
303
350
|
---
|
|
304
351
|
|
|
352
|
+
### `jam context`
|
|
353
|
+
|
|
354
|
+
Manage the `JAM.md` project context file. This file is auto-read by `jam ask` and `jam chat` to give the model awareness of your project's architecture, conventions, and goals.
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
jam context init # generate JAM.md at the workspace root
|
|
358
|
+
jam context init --force # overwrite an existing JAM.md
|
|
359
|
+
jam context show # display the current JAM.md contents
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
305
364
|
### `jam models list`
|
|
306
365
|
|
|
307
366
|
```bash
|
|
@@ -406,7 +465,7 @@ Jam merges config in priority order (highest wins):
|
|
|
406
465
|
|
|
407
466
|
| Field | Type | Description |
|
|
408
467
|
|-------|------|-------------|
|
|
409
|
-
| `provider` | string | Provider name (`ollama`) |
|
|
468
|
+
| `provider` | string | Provider name (`ollama`, `openai`, `groq`) |
|
|
410
469
|
| `model` | string | Model ID (e.g. `llama3.2`, `codellama`) |
|
|
411
470
|
| `baseUrl` | string | Provider API base URL |
|
|
412
471
|
| `apiKey` | string | API key (prefer keychain or env vars) |
|
|
@@ -442,6 +501,8 @@ echo '{"defaultProfile": "fast"}' > .jamrc
|
|
|
442
501
|
|----------|-------------|
|
|
443
502
|
| `JAM_API_KEY` | API key fallback (if keytar unavailable) |
|
|
444
503
|
| `JAM_BASE_URL` | Override provider base URL |
|
|
504
|
+
| `OPENAI_API_KEY` | OpenAI API key (used when `provider: openai`) |
|
|
505
|
+
| `GROQ_API_KEY` | Groq API key (used when `provider: groq`) |
|
|
445
506
|
|
|
446
507
|
---
|
|
447
508
|
|
|
@@ -461,50 +522,14 @@ npm run test:coverage # coverage report
|
|
|
461
522
|
|
|
462
523
|
```
|
|
463
524
|
src/
|
|
464
|
-
├── index.ts
|
|
465
|
-
├── commands/
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
│ ├── patch.ts # jam patch
|
|
473
|
-
│ ├── auth.ts # jam auth
|
|
474
|
-
│ ├── config.ts # jam config
|
|
475
|
-
│ ├── models.ts # jam models
|
|
476
|
-
│ ├── history.ts # jam history
|
|
477
|
-
│ ├── completion.ts # jam completion
|
|
478
|
-
│ └── doctor.ts # jam doctor
|
|
479
|
-
├── providers/ # LLM adapter layer
|
|
480
|
-
│ ├── base.ts # ProviderAdapter interface
|
|
481
|
-
│ ├── ollama.ts # Ollama adapter (NDJSON streaming)
|
|
482
|
-
│ └── factory.ts # createProvider()
|
|
483
|
-
├── tools/ # Model-callable local tools
|
|
484
|
-
│ ├── types.ts # ToolDefinition, ToolResult interfaces
|
|
485
|
-
│ ├── registry.ts # ToolRegistry + permission enforcement
|
|
486
|
-
│ ├── read_file.ts
|
|
487
|
-
│ ├── list_dir.ts
|
|
488
|
-
│ ├── search_text.ts
|
|
489
|
-
│ ├── git_diff.ts
|
|
490
|
-
│ ├── git_status.ts
|
|
491
|
-
│ ├── apply_patch.ts
|
|
492
|
-
│ └── write_file.ts
|
|
493
|
-
├── config/ # Config loading and schema
|
|
494
|
-
│ ├── schema.ts # Zod schema
|
|
495
|
-
│ ├── defaults.ts # Built-in defaults
|
|
496
|
-
│ └── loader.ts # cosmiconfig + deep merge
|
|
497
|
-
├── storage/
|
|
498
|
-
│ └── history.ts # Chat session persistence (JSON files)
|
|
499
|
-
├── ui/
|
|
500
|
-
│ ├── chat.tsx # Ink chat REPL (React TUI)
|
|
501
|
-
│ └── renderer.ts # Markdown + streaming renderer
|
|
502
|
-
└── utils/
|
|
503
|
-
├── errors.ts # JamError class
|
|
504
|
-
├── stream.ts # withRetry, collectStream
|
|
505
|
-
├── logger.ts # Logger (stderr, redaction)
|
|
506
|
-
├── secrets.ts # keytar + env fallback
|
|
507
|
-
└── workspace.ts # Git root detection
|
|
525
|
+
├── index.ts # CLI entry point — command registration (Commander)
|
|
526
|
+
├── commands/ # One file per command (ask, chat, run, review, commit, …)
|
|
527
|
+
├── providers/ # LLM adapter layer — ProviderAdapter interface + Ollama impl
|
|
528
|
+
├── tools/ # Model-callable tools + registry + permission enforcement
|
|
529
|
+
├── config/ # Zod schema, cosmiconfig loader, built-in defaults
|
|
530
|
+
├── storage/ # Chat session persistence (JSON files)
|
|
531
|
+
├── ui/ # Ink/React TUI (chat REPL) + Markdown/streaming renderer
|
|
532
|
+
└── utils/ # Shared helpers: streaming, logger, secrets, agent loop, tokens
|
|
508
533
|
```
|
|
509
534
|
|
|
510
535
|
---
|
|
@@ -584,17 +609,244 @@ We take security seriously. If you discover a vulnerability, please **do not** o
|
|
|
584
609
|
|
|
585
610
|
## Roadmap
|
|
586
611
|
|
|
587
|
-
- [
|
|
612
|
+
- [x] OpenAI provider
|
|
613
|
+
- [ ] Azure OpenAI provider
|
|
588
614
|
- [ ] Anthropic Claude provider
|
|
589
|
-
- [
|
|
590
|
-
- [ ] `jam commit` — AI-generated commit messages
|
|
591
|
-
- [ ] `jam review` — PR review workflow
|
|
615
|
+
- [x] Groq provider
|
|
592
616
|
- [ ] Plugin system for custom tools
|
|
593
617
|
- [ ] Token usage tracking and budgets
|
|
594
618
|
- [ ] Web UI companion
|
|
595
619
|
|
|
596
620
|
---
|
|
597
621
|
|
|
622
|
+
## Probable Enhancements
|
|
623
|
+
|
|
624
|
+
> Ideas and directions under consideration. These range from quick wins to deep architectural changes. Contributions, RFCs, and discussion on any of these are welcome.
|
|
625
|
+
|
|
626
|
+
### 🧩 Plugin System
|
|
627
|
+
|
|
628
|
+
The tool registry (`ToolRegistry.register()`) already accepts any `ToolDefinition`, but tool discovery is hardcoded. A proper plugin system would allow external tools without modifying source.
|
|
629
|
+
|
|
630
|
+
- **Local plugins** — load `ToolDefinition` modules from `.jam/plugins/` or `~/.config/jam/plugins/`
|
|
631
|
+
- **npm plugin packages** — `jam plugin install @scope/jam-plugin-docker` discovers and registers tools at startup
|
|
632
|
+
- **Plugin manifest** — declarative `jam-plugin.json` with name, version, tool definitions, required permissions
|
|
633
|
+
- **Lifecycle hooks** — `onActivate`, `onDeactivate`, `beforeToolCall`, `afterToolCall` for plugin-level middleware
|
|
634
|
+
- **Sandboxed execution** — plugins run with restricted filesystem/network access based on declared capabilities
|
|
635
|
+
|
|
636
|
+
```
|
|
637
|
+
jam plugin install jam-plugin-docker
|
|
638
|
+
jam plugin list
|
|
639
|
+
jam plugin remove jam-plugin-docker
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
### 🎯 Skills
|
|
643
|
+
|
|
644
|
+
Skills are named, composable mini-agents — each with a focused system prompt, a curated tool subset, and a defined output contract. Think of them as recipes the model can invoke.
|
|
645
|
+
|
|
646
|
+
- **Built-in skills** — `refactor`, `test-writer`, `documenter`, `security-audit`, `dependency-update`, `migration`
|
|
647
|
+
- **Skill registry** — each skill declares its name, description, required tools, system prompt template, and output schema
|
|
648
|
+
- **Composable** — skills can call other skills (e.g., `refactor` invokes `test-writer` to verify changes)
|
|
649
|
+
- **User-defined skills** — `.jam/skills/` directory with YAML/JSON skill definitions
|
|
650
|
+
- **Skill marketplace** — share and import community skills via npm or a registry
|
|
651
|
+
|
|
652
|
+
```yaml
|
|
653
|
+
# .jam/skills/api-endpoint.yaml
|
|
654
|
+
name: api-endpoint
|
|
655
|
+
description: Generate a new REST API endpoint with tests
|
|
656
|
+
tools: [read_file, write_file, search_text, run_command]
|
|
657
|
+
system: |
|
|
658
|
+
You are an API endpoint generator. Given a resource name and
|
|
659
|
+
fields, generate the route handler, validation, tests, and
|
|
660
|
+
OpenAPI schema following the project's existing patterns.
|
|
661
|
+
output:
|
|
662
|
+
type: files
|
|
663
|
+
confirm: true
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
```bash
|
|
667
|
+
jam skill run refactor --file src/api/auth.ts
|
|
668
|
+
jam skill run test-writer --file src/utils/cache.ts
|
|
669
|
+
jam skill list
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
### 🤖 Sub-Agents & Task Decomposition
|
|
673
|
+
|
|
674
|
+
The current agent loop (`jam run`) is a single monolithic ReAct loop. Sub-agents would enable the planner to decompose complex instructions into specialized child tasks.
|
|
675
|
+
|
|
676
|
+
- **Planner agent** — breaks a complex instruction into an ordered DAG of sub-tasks
|
|
677
|
+
- **Specialist delegation** — each sub-task dispatched to a purpose-built sub-agent (e.g., "read and understand", "refactor", "write tests", "verify")
|
|
678
|
+
- **Result aggregation** — parent agent collects sub-agent outputs and synthesizes a final result
|
|
679
|
+
- **Parallel sub-agents** — independent sub-tasks execute concurrently (e.g., "write tests" and "update docs" in parallel)
|
|
680
|
+
- **Scoped context** — each sub-agent receives only the context it needs, reducing token waste
|
|
681
|
+
- **Fail-and-retry isolation** — a failed sub-agent can be retried without restarting the entire task
|
|
682
|
+
|
|
683
|
+
```bash
|
|
684
|
+
jam run "Refactor the auth module to use JWT, update all tests, and document the changes"
|
|
685
|
+
# Planner decomposes into:
|
|
686
|
+
# 1. [understand] Read current auth module and tests
|
|
687
|
+
# 2. [refactor] Rewrite auth module with JWT
|
|
688
|
+
# 3. [test] Update tests for new implementation (parallel with 4)
|
|
689
|
+
# 4. [document] Update docs and JSDoc comments (parallel with 3)
|
|
690
|
+
# 5. [verify] Run tests and validate the patch
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
### 🔌 Connectors
|
|
694
|
+
|
|
695
|
+
Connectors are adapters for external services — bringing data in and pushing results out. Currently Jam only understands the local filesystem and git.
|
|
696
|
+
|
|
697
|
+
- **GitHub** — read/create issues, PRs, review comments; `jam review --pr 42` already shells out to `gh`, a connector would be native
|
|
698
|
+
- **GitLab / Bitbucket** — equivalent PR/MR workflows for non-GitHub teams
|
|
699
|
+
- **JIRA / Linear / Shortcut** — fetch issue context, update status, attach AI-generated summaries
|
|
700
|
+
- **Slack / Discord** — post review summaries, commit digests, or search results to channels
|
|
701
|
+
- **Database** — read schema, run read-only queries, explain query plans
|
|
702
|
+
- **REST / GraphQL** — generic HTTP connector for internal APIs (`jam ask "Why is /api/users slow?" --connector api-prod`)
|
|
703
|
+
- **Docker / K8s** — read container logs, describe pods, inspect images
|
|
704
|
+
- **CI/CD** — read build logs, trigger pipelines, analyze failures
|
|
705
|
+
|
|
706
|
+
```json
|
|
707
|
+
// .jam/config.json
|
|
708
|
+
{
|
|
709
|
+
"connectors": {
|
|
710
|
+
"github": { "token": "env:GITHUB_TOKEN" },
|
|
711
|
+
"jira": { "baseUrl": "https://myorg.atlassian.net", "token": "env:JIRA_TOKEN" },
|
|
712
|
+
"postgres": { "connectionString": "env:DATABASE_URL", "readOnly": true }
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
### 🧠 MCP (Model Context Protocol) Support
|
|
718
|
+
|
|
719
|
+
[MCP](https://modelcontextprotocol.io) is an open standard for connecting AI models to external tools and data sources. Adding MCP client support would let Jam consume any MCP-compatible server.
|
|
720
|
+
|
|
721
|
+
- **MCP client** — Jam discovers and connects to MCP servers declared in config
|
|
722
|
+
- **Tool bridge** — MCP tools appear as native Jam tools in the registry, usable by `jam run`
|
|
723
|
+
- **Resource bridge** — MCP resources (files, database rows, API responses) injected as context
|
|
724
|
+
- **Prompt bridge** — MCP prompt templates available as Jam skills
|
|
725
|
+
- **Server mode** — expose Jam's own tools (read_file, search_text, git_diff, etc.) as an MCP server for other agents
|
|
726
|
+
|
|
727
|
+
```json
|
|
728
|
+
{
|
|
729
|
+
"mcp": {
|
|
730
|
+
"servers": {
|
|
731
|
+
"filesystem": { "command": "npx @modelcontextprotocol/server-filesystem /path/to/dir" },
|
|
732
|
+
"postgres": { "command": "npx @modelcontextprotocol/server-postgres", "env": { "DATABASE_URL": "..." } }
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
### ⚡ Parallel Tool Execution
|
|
739
|
+
|
|
740
|
+
Currently tools execute sequentially within each agent round. When the model requests multiple independent tool calls (e.g., read three files), they could run concurrently.
|
|
741
|
+
|
|
742
|
+
- **Dependency analysis** — detect independent tool calls within a single round
|
|
743
|
+
- **Concurrent dispatch** — `Promise.all()` for independent read operations
|
|
744
|
+
- **Write serialization** — write tools always execute sequentially and with confirmation
|
|
745
|
+
- **Progress display** — show parallel tool execution status in real time
|
|
746
|
+
|
|
747
|
+
### 🔗 Middleware & Hooks
|
|
748
|
+
|
|
749
|
+
A middleware chain around LLM calls and tool executions, enabling cross-cutting concerns without modifying core logic.
|
|
750
|
+
|
|
751
|
+
- **Pre/post LLM hooks** — prompt injection defense, cost tracking, audit logging
|
|
752
|
+
- **Pre/post tool hooks** — rate limiting, output sanitization, metrics
|
|
753
|
+
- **Error interceptors** — custom retry logic, fallback providers, graceful degradation
|
|
754
|
+
- **Event emitter** — structured events (`tool:start`, `tool:end`, `llm:stream`, `agent:iteration`) for UI decoupling, telemetry, and external integrations
|
|
755
|
+
|
|
756
|
+
```typescript
|
|
757
|
+
// .jam/middleware/cost-tracker.ts
|
|
758
|
+
export default {
|
|
759
|
+
name: 'cost-tracker',
|
|
760
|
+
afterCompletion({ usage, provider, model }) {
|
|
761
|
+
const cost = estimateCost(provider, model, usage);
|
|
762
|
+
appendToLog(`~/.jam/cost.csv`, { timestamp: Date.now(), model, cost });
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
### 🧭 Embeddings & Vector Search
|
|
768
|
+
|
|
769
|
+
The current past-session search uses keyword overlap (Jaccard scoring), and the symbol index is regex-based. Optional local embeddings would enable true semantic search.
|
|
770
|
+
|
|
771
|
+
- **Local embedding model** — use Ollama's embedding endpoint (`nomic-embed-text`, `mxbai-embed-large`) so nothing leaves your machine
|
|
772
|
+
- **Codebase index** — vector index of functions, classes, and doc comments stored at `.jam/vectors/`
|
|
773
|
+
- **Semantic code search** — `jam search "authentication flow"` returns semantically relevant code, not just keyword matches
|
|
774
|
+
- **Session memory** — embed past Q&A pairs for cross-session context recall with relevance decay
|
|
775
|
+
- **RAG pipeline** — retrieve relevant code chunks before prompting, reducing token usage and improving accuracy
|
|
776
|
+
|
|
777
|
+
### 💰 Cost & Token Tracking
|
|
778
|
+
|
|
779
|
+
`TokenUsage` is already captured per request but not aggregated or displayed.
|
|
780
|
+
|
|
781
|
+
- **Session cost estimation** — estimate cost based on provider pricing (configurable per-profile)
|
|
782
|
+
- **Budget limits** — `maxCostPerSession`, `maxCostPerDay` in config; warn or hard-stop when exceeded
|
|
783
|
+
- **Usage dashboard** — `jam usage` command showing tokens consumed, cost by model, by command, over time
|
|
784
|
+
- **Token budget per tool call** — prevent runaway context from a single large file read
|
|
785
|
+
|
|
786
|
+
```bash
|
|
787
|
+
jam usage # summary: today, this week, this month
|
|
788
|
+
jam usage --detail # per-session breakdown
|
|
789
|
+
jam usage --export csv # export for expense tracking
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
### 📦 Multi-File Transactions
|
|
793
|
+
|
|
794
|
+
`apply_patch` and `write_file` currently operate on single files with no rollback mechanism.
|
|
795
|
+
|
|
796
|
+
- **Transaction block** — group multiple file writes into an atomic operation
|
|
797
|
+
- **Git stash checkpoint** — auto-stash before a multi-file edit, restore on failure
|
|
798
|
+
- **Dry-run preview** — show all proposed changes across files before any writes
|
|
799
|
+
- **Selective accept** — accept/reject individual file changes within a transaction
|
|
800
|
+
|
|
801
|
+
### 🔍 Provider Capabilities & Feature Negotiation
|
|
802
|
+
|
|
803
|
+
The `ProviderAdapter` interface treats all providers equally, but providers differ in capabilities.
|
|
804
|
+
|
|
805
|
+
- **Capability flags** — `supportsToolCalling`, `supportsVision`, `supportsStructuredOutput`, `supportsEmbeddings` on `ProviderInfo`
|
|
806
|
+
- **Graceful degradation** — if a provider doesn't support tool calling, fall back to prompt-based tool simulation
|
|
807
|
+
- **Model capability discovery** — query the provider for model-specific features at runtime
|
|
808
|
+
- **Auto-routing** — route tasks to the best-fit model/provider (e.g., use a fast model for planning, a capable model for generation)
|
|
809
|
+
|
|
810
|
+
### 🧠 Persistent Agent Memory
|
|
811
|
+
|
|
812
|
+
Working memory is currently session-scoped. Cross-session memory would make Jam smarter over time.
|
|
813
|
+
|
|
814
|
+
- **Workspace knowledge base** — facts, patterns, and conventions learned from past sessions, stored per-repo
|
|
815
|
+
- **Memory decay** — older memories lose relevance weight over time unless reinforced
|
|
816
|
+
- **Explicit memory** — `jam remember "the auth module uses bcrypt, not argon2"` for user-declared facts
|
|
817
|
+
- **Memory retrieval** — automatically surface relevant memories during planning and synthesis
|
|
818
|
+
- **Forgetting** — `jam forget` to clear or selectively prune memories
|
|
819
|
+
|
|
820
|
+
### 🌐 Web UI Companion
|
|
821
|
+
|
|
822
|
+
A local web interface for sessions that benefit from richer display.
|
|
823
|
+
|
|
824
|
+
- **Diff viewer** — syntax-highlighted side-by-side diffs for `jam patch` and `jam review`
|
|
825
|
+
- **Session browser** — visual history of past chat sessions with search
|
|
826
|
+
- **Tool call inspector** — expandable timeline of every tool call, its input, output, and duration
|
|
827
|
+
- **Markdown preview** — rendered Markdown responses with code block copy buttons
|
|
828
|
+
- **Served locally** — `jam ui` starts a local server; no external hosting
|
|
829
|
+
|
|
830
|
+
### 🧪 Testing & Verification Skills
|
|
831
|
+
|
|
832
|
+
First-class support for test generation and verification.
|
|
833
|
+
|
|
834
|
+
- **Test generation** — `jam test generate src/utils/cache.ts` generates tests matching project conventions
|
|
835
|
+
- **Test-driven patch** — `jam patch` can optionally run tests before and after applying changes
|
|
836
|
+
- **Coverage-aware context** — prioritize uncovered code paths in review and audit workflows
|
|
837
|
+
- **Regression detection** — track which tests fail after a patch and auto-revert if needed
|
|
838
|
+
|
|
839
|
+
### 🐚 Shell Integration & Workflow Automation
|
|
840
|
+
|
|
841
|
+
Deeper shell integration for power users and CI/CD pipelines.
|
|
842
|
+
|
|
843
|
+
- **Git hooks** — `jam hooks install` sets up pre-commit (auto-lint), prepare-commit-msg (AI message), pre-push (review)
|
|
844
|
+
- **Watch mode** — `jam watch` monitors file changes and provides continuous AI feedback
|
|
845
|
+
- **Pipeline mode** — structured JSON I/O for chaining Jam commands in shell scripts and CI
|
|
846
|
+
- **Makefile/Taskfile recipes** — pre-built task definitions for common workflows
|
|
847
|
+
|
|
848
|
+
---
|
|
849
|
+
|
|
598
850
|
## Acknowledgments
|
|
599
851
|
|
|
600
852
|
Built with these excellent open source projects:
|
package/dist/commands/ask.d.ts
CHANGED
|
@@ -3,7 +3,11 @@ export interface AskOptions extends CliOverrides {
|
|
|
3
3
|
file?: string;
|
|
4
4
|
json?: boolean;
|
|
5
5
|
noColor?: boolean;
|
|
6
|
+
quiet?: boolean;
|
|
6
7
|
system?: string;
|
|
8
|
+
/** Enable read-only tool use so the model can discover and read files.
|
|
9
|
+
* Defaults to true when stdout is a TTY and the provider supports chatWithTools. */
|
|
10
|
+
tools?: boolean;
|
|
7
11
|
}
|
|
8
12
|
export declare function runAsk(inlinePrompt: string | undefined, options: AskOptions): Promise<void>;
|
|
9
13
|
//# sourceMappingURL=ask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../../src/commands/ask.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../../src/commands/ask.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;yFACqF;IACrF,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AA0CD,wBAAsB,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAyQjG"}
|