thincoder 0.6.0 → 0.7.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 +19 -1
- package/bin/thincoder.mjs +25 -1
- package/package.json +1 -1
- package/src/SYSTEM_PROMPT.md +6 -3
- package/src/agent.mjs +147 -64
- package/src/checkpoint.mjs +6 -3
- package/src/coder-overlay.md +1 -1
- package/src/config.mjs +37 -27
- package/src/context.mjs +37 -8
- package/src/distill.mjs +6 -2
- package/src/embedding.mjs +11 -2
- package/src/gitmem.mjs +6 -2
- package/src/markdown.mjs +11 -4
- package/src/mcp.mjs +197 -24
- package/src/memory.mjs +242 -81
- package/src/provider.mjs +35 -14
- package/src/repomap.mjs +17 -6
- package/src/session.mjs +8 -5
- package/src/skills.mjs +6 -2
- package/src/tools/apply_patch.md +11 -0
- package/src/tools/bash.md +13 -1
- package/src/tools/checkpoint.md +11 -0
- package/src/tools/grep.md +3 -0
- package/src/tools/insert_after.md +13 -0
- package/src/tools/question.md +1 -0
- package/src/tools/syntax_check.md +10 -0
- package/src/tools/websearch.md +1 -0
- package/src/tools.mjs +483 -84
- package/src/tui.mjs +156 -55
package/src/skills.mjs
CHANGED
|
@@ -28,13 +28,17 @@ export async function loadSkills(cwd) {
|
|
|
28
28
|
try {
|
|
29
29
|
const s = await stat(p)
|
|
30
30
|
if (!s.isFile()) continue
|
|
31
|
-
// 提取描述(前 400
|
|
31
|
+
// 提取描述(前 400 字符里第一段非空、非标题行);文件带 frontmatter 时整块跳过,
|
|
32
|
+
// 否则会把 frontmatter 字段行(如 "name: x")误当描述
|
|
32
33
|
const head = await readFile(p, "utf8")
|
|
33
34
|
const body = head.slice(0, 400).split("\n")
|
|
34
35
|
let desc = ""
|
|
36
|
+
let inFrontmatter = false
|
|
35
37
|
for (const line of body) {
|
|
36
38
|
const t = line.trim()
|
|
37
|
-
if (t
|
|
39
|
+
if (t === "---") { inFrontmatter = !inFrontmatter; continue }
|
|
40
|
+
if (inFrontmatter) continue
|
|
41
|
+
if (t && !t.startsWith("#")) {
|
|
38
42
|
desc = t.slice(0, 120)
|
|
39
43
|
break
|
|
40
44
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Apply a unified diff to one or more files, atomically: if any hunk fails to apply, nothing is written.
|
|
2
|
+
|
|
3
|
+
Parameters:
|
|
4
|
+
- patch (required): Unified diff text. One `--- a/path` / `+++ b/path` header pair per file, then `@@ -old,count +new,count @@` hunks. Use `--- /dev/null` to create a new file.
|
|
5
|
+
|
|
6
|
+
Notes:
|
|
7
|
+
- Use this for multi-file changes (e.g. rename an interface + update all callers) — one call, all-or-nothing
|
|
8
|
+
- Hunks are located by their context/removed lines, not line numbers — but the context must match the file EXACTLY. Read the files first and generate the patch from actual content
|
|
9
|
+
- If a hunk's context matches multiple locations it is rejected — add more surrounding context lines
|
|
10
|
+
- Deleting files is not supported — use the delete tool
|
|
11
|
+
- For single-file small edits, edit is simpler; for full rewrites, write is simpler
|
package/src/tools/bash.md
CHANGED
|
@@ -4,10 +4,22 @@ Parameters:
|
|
|
4
4
|
- command (required): Shell command to execute
|
|
5
5
|
- timeout: Timeout in milliseconds (default 120000, max ~300000)
|
|
6
6
|
|
|
7
|
+
Output format:
|
|
8
|
+
```
|
|
9
|
+
[stdout]:
|
|
10
|
+
<standard output, or "(empty)">
|
|
11
|
+
|
|
12
|
+
[stderr]:
|
|
13
|
+
<standard error, only present if non-empty>
|
|
14
|
+
|
|
15
|
+
(exit code N)
|
|
16
|
+
```
|
|
17
|
+
|
|
7
18
|
Notes:
|
|
8
19
|
- There is NO TTY — editors, pagers (vim, less), and interactive prompts WILL hang. Always pass non-interactive flags: `git commit -m`, `git --no-pager`, `-y`/`--yes` where applicable
|
|
9
20
|
- The environment sets GIT_PAGER=cat, PAGER=cat, EDITOR=true, TERM=dumb — but still always use non-interactive flags
|
|
10
|
-
- Output is capped at ~
|
|
21
|
+
- Output is capped at ~200K chars; if you need more, redirect to a file and read it. Truncated output ends with a `[... truncated: N chars omitted]` marker — the missing tail may contain errors.
|
|
22
|
+
- Check `[stderr]` for error messages, warnings, and diagnostic output — it is separated from `[stdout]` so you can quickly identify problems.
|
|
11
23
|
- On Windows, use Unix shell syntax inside bash commands (Git Bash): forward slashes, `/dev/null` not `NUL`
|
|
12
24
|
- Never use bash to read, copy, or transmit secret files (.env, keys, tokens)
|
|
13
25
|
- Do NOT run destructive commands (rm -rf, force-push, drop table) without explicit user confirmation
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
List, create, and restore workspace snapshots (checkpoints). Git repositories only.
|
|
2
|
+
|
|
3
|
+
Parameters:
|
|
4
|
+
- action (required): "list" | "create" | "rewind"
|
|
5
|
+
- id: snapshot id (required for rewind)
|
|
6
|
+
|
|
7
|
+
Notes:
|
|
8
|
+
- A checkpoint is AUTO-CREATED before every user task. If uncommitted work was destroyed (by you, a git command, or a failed refactor), use action=list then action=rewind with the latest id to recover it
|
|
9
|
+
- A checkpoint captures all uncommitted state: tracked-file changes (as a diff) plus copies of untracked files
|
|
10
|
+
- Rewind first snapshots the current state, so rewinding is itself reversible
|
|
11
|
+
- Create one manually before risky bulk operations
|
package/src/tools/grep.md
CHANGED
|
@@ -4,9 +4,12 @@ Parameters:
|
|
|
4
4
|
- pattern (required): JavaScript regular expression
|
|
5
5
|
- path: Directory or file to search (default cwd)
|
|
6
6
|
- glob: Only search files matching this glob (e.g. '*.mjs')
|
|
7
|
+
- before: Lines of context to show before each match (grep -B). Default 0
|
|
8
|
+
- after: Lines of context to show after each match (grep -A). Default 0
|
|
7
9
|
|
|
8
10
|
Notes:
|
|
9
11
|
- Skips node_modules, .git, dist, build, .turbo, coverage
|
|
10
12
|
- Results capped at 200 matches
|
|
11
13
|
- Binary/unreadable files are silently skipped
|
|
12
14
|
- Use this to find usages, definitions, patterns; use glob to find files by name
|
|
15
|
+
- With before/after: matching lines use `:` separator, context lines use `-` (like ripgrep); overlapping context ranges in the same file are merged and de-duplicated
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Insert a line of text after a specific line in a file. Safer than `edit` for adding new content — no need to copy surrounding context for exact string matching.
|
|
2
|
+
|
|
3
|
+
Parameters:
|
|
4
|
+
- path (required): File path
|
|
5
|
+
- content (required): Text to insert (will be placed as a new line after the target line)
|
|
6
|
+
- after_line: Line number to insert after (1-based). Preferred when you know the exact line number from `read`.
|
|
7
|
+
- after_regex: JavaScript regex to find the line to insert after. Must match exactly one line; if it matches multiple, the tool errors and shows the matching line numbers.
|
|
8
|
+
|
|
9
|
+
Notes:
|
|
10
|
+
- Either after_line or after_regex is required; if both are given, after_line wins.
|
|
11
|
+
- Use this instead of `edit` when you're adding a new function, import, or block — no need to fabricate surrounding context for exact matching.
|
|
12
|
+
- The inserted content becomes its own line; it's equivalent to `lines.splice(targetLine, 0, content)`.
|
|
13
|
+
- Returns a diff of the change.
|
package/src/tools/question.md
CHANGED
|
@@ -8,3 +8,4 @@ Notes:
|
|
|
8
8
|
- The agent loop pauses until the user answers
|
|
9
9
|
- The answer is injected as the next user message
|
|
10
10
|
- Use sparingly — prefer making reasonable decisions when possible
|
|
11
|
+
- After receiving an answer about a design convention, tool preference, or recurring pattern: save it with memory_put. This prevents asking the same question in future sessions — the user shouldn't have to repeat their preferences.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Check a JavaScript file for syntax errors using `node --check`. Fast, offline, no dependencies — use after writing or editing .js/.mjs/.cjs files to catch parse errors before running tests.
|
|
2
|
+
|
|
3
|
+
Parameters:
|
|
4
|
+
- path (required): File path (.js, .mjs, or .cjs)
|
|
5
|
+
|
|
6
|
+
Notes:
|
|
7
|
+
- Only supports JavaScript-family files; for other languages, run the appropriate checker via `bash`.
|
|
8
|
+
- Returns "Syntax OK" or the exact error message with line/column from Node.js.
|
|
9
|
+
- This is NOT a test run — it only catches parse errors (missing brackets, invalid syntax), not logic bugs.
|
|
10
|
+
- Use this right after `write` or `edit` to fail fast on trivial mistakes before investing time in a full test run.
|
package/src/tools/websearch.md
CHANGED
|
@@ -5,6 +5,7 @@ Parameters:
|
|
|
5
5
|
- limit: Max results (default 8)
|
|
6
6
|
|
|
7
7
|
Notes:
|
|
8
|
+
- Before searching the web, call `memory_search` first — you may already know the answer from a previous session. Only reach for websearch if memory comes up empty.
|
|
8
9
|
- Use this for information that is NOT in the local codebase — current docs, error messages, API references
|
|
9
10
|
- Follow up with `fetch` to read full pages from the results
|
|
10
11
|
- Results are scraped from Bing HTML — some formatting may be imperfect
|