@oh-my-pi/pi-coding-agent 13.2.0 → 13.2.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/CHANGELOG.md +26 -0
- package/package.json +7 -7
- package/scripts/format-prompts.ts +33 -14
- package/src/capability/index.ts +1 -2
- package/src/cli/args.ts +1 -2
- package/src/cli/config-cli.ts +1 -1
- package/src/cli/file-processor.ts +1 -2
- package/src/cli/grep-cli.ts +1 -1
- package/src/cli/jupyter-cli.ts +1 -1
- package/src/cli/plugin-cli.ts +1 -1
- package/src/cli/setup-cli.ts +1 -1
- package/src/cli/shell-cli.ts +1 -1
- package/src/cli/ssh-cli.ts +1 -1
- package/src/cli/stats-cli.ts +1 -2
- package/src/cli/update-cli.ts +1 -2
- package/src/cli/web-search-cli.ts +1 -1
- package/src/cli.ts +1 -1
- package/src/commands/launch.ts +2 -1
- package/src/commit/agentic/agent.ts +2 -1
- package/src/commit/agentic/index.ts +1 -2
- package/src/commit/agentic/prompts/system.md +3 -3
- package/src/commit/agentic/tools/propose-changelog.ts +30 -19
- package/src/commit/changelog/generate.ts +16 -6
- package/src/commit/changelog/index.ts +2 -1
- package/src/commit/pipeline.ts +1 -2
- package/src/commit/prompts/reduce-system.md +1 -1
- package/src/commit/types.ts +10 -1
- package/src/config/keybindings.ts +1 -2
- package/src/config/model-registry.ts +1 -1
- package/src/config/prompt-templates.ts +14 -2
- package/src/config/settings.ts +9 -2
- package/src/config.ts +1 -2
- package/src/debug/index.ts +1 -1
- package/src/debug/report-bundle.ts +1 -2
- package/src/debug/system-info.ts +1 -2
- package/src/discovery/agents.ts +2 -2
- package/src/discovery/builtin.ts +8 -9
- package/src/discovery/claude-plugins.ts +2 -2
- package/src/discovery/claude.ts +7 -7
- package/src/discovery/codex.ts +3 -3
- package/src/discovery/cursor.ts +5 -4
- package/src/discovery/gemini.ts +5 -5
- package/src/discovery/helpers.ts +47 -69
- package/src/discovery/mcp-json.ts +3 -3
- package/src/discovery/opencode.ts +7 -8
- package/src/discovery/ssh.ts +3 -3
- package/src/discovery/vscode.ts +3 -2
- package/src/discovery/windsurf.ts +3 -2
- package/src/exa/company.ts +1 -1
- package/src/exa/factory.ts +1 -6
- package/src/exa/linkedin.ts +1 -1
- package/src/exa/mcp-client.ts +19 -8
- package/src/exa/search.ts +2 -2
- package/src/exa/types.ts +3 -3
- package/src/exec/bash-executor.ts +2 -1
- package/src/exec/non-interactive-env.ts +43 -0
- package/src/export/custom-share.ts +1 -1
- package/src/export/html/index.ts +1 -2
- package/src/extensibility/custom-commands/loader.ts +1 -2
- package/src/extensibility/plugins/installer.ts +1 -2
- package/src/extensibility/plugins/loader.ts +1 -2
- package/src/extensibility/plugins/manager.ts +3 -2
- package/src/extensibility/skills.ts +59 -115
- package/src/index.ts +1 -3
- package/src/internal-urls/docs-index.generated.ts +1 -1
- package/src/ipy/executor.ts +1 -2
- package/src/ipy/gateway-coordinator.ts +1 -2
- package/src/ipy/modules.ts +1 -1
- package/src/ipy/runtime.ts +1 -3
- package/src/main.ts +1 -2
- package/src/mcp/config.ts +1 -1
- package/src/mcp/transports/stdio.ts +1 -2
- package/src/memories/index.ts +1 -2
- package/src/modes/components/extensions/extension-dashboard.ts +1 -1
- package/src/modes/components/extensions/inspector-panel.ts +8 -2
- package/src/modes/components/footer.ts +1 -2
- package/src/modes/components/status-line/segments.ts +1 -2
- package/src/modes/components/tool-execution.ts +3 -10
- package/src/modes/components/welcome.ts +1 -1
- package/src/modes/controllers/command-controller.ts +1 -2
- package/src/modes/controllers/mcp-command-controller.ts +1 -1
- package/src/modes/controllers/selector-controller.ts +1 -1
- package/src/modes/controllers/ssh-command-controller.ts +1 -1
- package/src/modes/interactive-mode.ts +2 -3
- package/src/modes/shared.ts +1 -2
- package/src/modes/theme/theme.ts +1 -2
- package/src/patch/index.ts +1 -25
- package/src/prompts/agents/designer.md +7 -10
- package/src/prompts/agents/explore.md +15 -23
- package/src/prompts/agents/init.md +23 -23
- package/src/prompts/agents/plan.md +14 -77
- package/src/prompts/agents/reviewer.md +6 -5
- package/src/prompts/agents/task.md +13 -11
- package/src/prompts/compaction/branch-summary.md +3 -3
- package/src/prompts/compaction/compaction-short-summary.md +7 -7
- package/src/prompts/compaction/compaction-summary-context.md +1 -1
- package/src/prompts/compaction/compaction-summary.md +5 -5
- package/src/prompts/compaction/compaction-turn-prefix.md +3 -3
- package/src/prompts/compaction/compaction-update-summary.md +11 -11
- package/src/prompts/memories/consolidation.md +5 -5
- package/src/prompts/memories/read-path.md +6 -6
- package/src/prompts/memories/stage_one_input.md +1 -1
- package/src/prompts/memories/stage_one_system.md +5 -5
- package/src/prompts/review-request.md +4 -4
- package/src/prompts/system/agent-creation-architect.md +17 -17
- package/src/prompts/system/agent-creation-user.md +2 -2
- package/src/prompts/system/custom-system-prompt.md +4 -4
- package/src/prompts/system/plan-mode-active.md +20 -20
- package/src/prompts/system/plan-mode-approved.md +7 -7
- package/src/prompts/system/plan-mode-reference.md +2 -2
- package/src/prompts/system/plan-mode-subagent.md +8 -8
- package/src/prompts/system/subagent-submit-reminder.md +5 -5
- package/src/prompts/system/subagent-system-prompt.md +29 -22
- package/src/prompts/system/subagent-user-prompt.md +7 -3
- package/src/prompts/system/summarization-system.md +1 -1
- package/src/prompts/system/system-prompt.md +201 -226
- package/src/prompts/system/title-system.md +2 -2
- package/src/prompts/system/ttsr-interrupt.md +1 -1
- package/src/prompts/system/web-search.md +16 -16
- package/src/prompts/tools/ask.md +1 -3
- package/src/prompts/tools/await.md +2 -4
- package/src/prompts/tools/bash.md +5 -7
- package/src/prompts/tools/browser.md +4 -6
- package/src/prompts/tools/calculator.md +1 -3
- package/src/prompts/tools/cancel-job.md +2 -4
- package/src/prompts/tools/exit-plan-mode.md +7 -7
- package/src/prompts/tools/fetch.md +0 -2
- package/src/prompts/tools/find.md +3 -5
- package/src/prompts/tools/gemini-image.md +6 -22
- package/src/prompts/tools/grep.md +4 -6
- package/src/prompts/tools/hashline.md +12 -15
- package/src/prompts/tools/lsp.md +1 -3
- package/src/prompts/tools/patch.md +7 -9
- package/src/prompts/tools/python.md +10 -14
- package/src/prompts/tools/read.md +0 -2
- package/src/prompts/tools/replace.md +5 -7
- package/src/prompts/tools/ssh.md +3 -5
- package/src/prompts/tools/task.md +6 -8
- package/src/prompts/tools/todo-write.md +7 -9
- package/src/prompts/tools/web-search.md +3 -5
- package/src/prompts/tools/write.md +3 -5
- package/src/sdk.ts +1 -2
- package/src/session/agent-session.ts +10 -26
- package/src/session/agent-storage.ts +1 -2
- package/src/session/history-storage.ts +1 -2
- package/src/session/session-manager.ts +10 -2
- package/src/ssh/connection-manager.ts +11 -2
- package/src/ssh/sshfs-mount.ts +7 -1
- package/src/system-prompt.ts +25 -103
- package/src/task/agents.ts +1 -1
- package/src/task/worktree.ts +1 -2
- package/src/tools/ask.ts +0 -1
- package/src/tools/bash-interactive.ts +2 -45
- package/src/tools/bash.ts +5 -5
- package/src/tools/browser.ts +1 -2
- package/src/tools/gemini-image.ts +8 -28
- package/src/tools/json-tree.ts +2 -1
- package/src/tools/python.ts +1 -1
- package/src/tools/read.ts +1 -2
- package/src/utils/tools-manager.ts +1 -2
- package/src/web/scrapers/artifacthub.ts +2 -1
- package/src/web/scrapers/aur.ts +2 -1
- package/src/web/scrapers/biorxiv.ts +2 -1
- package/src/web/scrapers/bluesky.ts +2 -1
- package/src/web/scrapers/chocolatey.ts +2 -1
- package/src/web/scrapers/cisa-kev.ts +2 -1
- package/src/web/scrapers/clojars.ts +2 -1
- package/src/web/scrapers/coingecko.ts +2 -1
- package/src/web/scrapers/crates-io.ts +2 -1
- package/src/web/scrapers/crossref.ts +2 -1
- package/src/web/scrapers/discogs.ts +3 -1
- package/src/web/scrapers/discourse.ts +2 -1
- package/src/web/scrapers/dockerhub.ts +2 -1
- package/src/web/scrapers/fdroid.ts +2 -1
- package/src/web/scrapers/firefox-addons.ts +2 -1
- package/src/web/scrapers/flathub.ts +2 -1
- package/src/web/scrapers/gitlab.ts +1 -1
- package/src/web/scrapers/go-pkg.ts +2 -1
- package/src/web/scrapers/hackage.ts +2 -1
- package/src/web/scrapers/hackernews.ts +2 -1
- package/src/web/scrapers/hex.ts +2 -1
- package/src/web/scrapers/huggingface.ts +2 -1
- package/src/web/scrapers/jetbrains-marketplace.ts +2 -1
- package/src/web/scrapers/lemmy.ts +2 -1
- package/src/web/scrapers/lobsters.ts +2 -1
- package/src/web/scrapers/mastodon.ts +2 -1
- package/src/web/scrapers/maven.ts +2 -1
- package/src/web/scrapers/mdn.ts +2 -1
- package/src/web/scrapers/metacpan.ts +2 -1
- package/src/web/scrapers/musicbrainz.ts +3 -1
- package/src/web/scrapers/npm.ts +2 -1
- package/src/web/scrapers/nuget.ts +2 -1
- package/src/web/scrapers/nvd.ts +2 -1
- package/src/web/scrapers/ollama.ts +2 -1
- package/src/web/scrapers/open-vsx.ts +2 -1
- package/src/web/scrapers/opencorporates.ts +2 -1
- package/src/web/scrapers/openlibrary.ts +2 -1
- package/src/web/scrapers/orcid.ts +3 -1
- package/src/web/scrapers/osv.ts +2 -1
- package/src/web/scrapers/packagist.ts +2 -1
- package/src/web/scrapers/pub-dev.ts +2 -1
- package/src/web/scrapers/pubmed.ts +2 -1
- package/src/web/scrapers/pypi.ts +2 -1
- package/src/web/scrapers/rawg.ts +2 -8
- package/src/web/scrapers/reddit.ts +2 -1
- package/src/web/scrapers/repology.ts +2 -1
- package/src/web/scrapers/rfc.ts +2 -1
- package/src/web/scrapers/rubygems.ts +2 -1
- package/src/web/scrapers/searchcode.ts +2 -1
- package/src/web/scrapers/sec-edgar.ts +2 -1
- package/src/web/scrapers/semantic-scholar.ts +2 -1
- package/src/web/scrapers/snapcraft.ts +2 -1
- package/src/web/scrapers/sourcegraph.ts +2 -1
- package/src/web/scrapers/spdx.ts +2 -1
- package/src/web/scrapers/stackoverflow.ts +2 -1
- package/src/web/scrapers/terraform.ts +2 -1
- package/src/web/scrapers/types.ts +0 -11
- package/src/web/scrapers/vimeo.ts +2 -1
- package/src/web/scrapers/vscode-marketplace.ts +2 -1
- package/src/web/scrapers/w3c.ts +2 -1
- package/src/web/scrapers/wikidata.ts +2 -1
- package/src/web/search/index.ts +10 -14
- package/src/web/search/provider.ts +2 -2
- package/src/web/search/providers/codex.ts +1 -2
- package/src/web/search/providers/exa.ts +1 -6
- package/src/web/search/providers/gemini.ts +1 -1
- package/src/web/search/providers/perplexity.ts +1 -2
- package/src/web/search/providers/utils.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,11 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [13.2.1] - 2026-02-24
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- Fixed changelog tools to enforce category-specific arrays and reuse the shared category list for generation
|
|
9
|
+
- Non-interactive environment variables (pager, editor, prompt suppression) were not applied to non-PTY bash execution, causing commands to potentially block on pagers or prompts
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Extracted non-interactive environment config from `bash-interactive.ts` into shared `non-interactive-env.ts` module, applied consistently to all bash execution paths
|
|
14
|
+
|
|
5
15
|
## [13.2.0] - 2026-02-23
|
|
6
16
|
### Breaking Changes
|
|
7
17
|
|
|
8
18
|
- Made `description` field required in CustomTool interface
|
|
9
19
|
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Reorganized imports from `@oh-my-pi/pi-utils/dirs` to consolidate with main `@oh-my-pi/pi-utils` exports for cleaner dependency management
|
|
23
|
+
- Renamed `loadSkillsFromDir` to `scanSkillsFromDir` with updated interface for improved clarity on skill discovery behavior
|
|
24
|
+
- Moved `tryParseJson` utility from local scrapers module to `@oh-my-pi/pi-utils` for centralized JSON parsing
|
|
25
|
+
- Simplified patch module exports by consolidating type re-exports with `export * from './types'`
|
|
26
|
+
- Removed `emitCustomToolSessionEvent` method from AgentSession for streamlined session lifecycle management
|
|
27
|
+
- Changed skill discovery from recursive to non-recursive (one level deep only) for improved performance and clarity
|
|
28
|
+
- Simplified skill loading logic by removing recursive directory traversal and consolidating ignore rule handling
|
|
29
|
+
|
|
30
|
+
### Removed
|
|
31
|
+
|
|
32
|
+
- Removed `parseJSON` helper function from discovery module (replaced by `tryParseJson` from pi-utils)
|
|
33
|
+
- Removed backwards compatibility comment from `AskToolDetails.question` field
|
|
34
|
+
- Removed unused SSH resource cleanup functions `closeAllConnections` and `unmountAll` from session imports
|
|
35
|
+
|
|
10
36
|
## [13.1.2] - 2026-02-23
|
|
11
37
|
### Breaking Changes
|
|
12
38
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-coding-agent",
|
|
4
|
-
"version": "13.2.
|
|
4
|
+
"version": "13.2.1",
|
|
5
5
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
6
6
|
"homepage": "https://github.com/can1357/oh-my-pi",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@mozilla/readability": "^0.6",
|
|
44
|
-
"@oh-my-pi/omp-stats": "13.2.
|
|
45
|
-
"@oh-my-pi/pi-agent-core": "13.2.
|
|
46
|
-
"@oh-my-pi/pi-ai": "13.2.
|
|
47
|
-
"@oh-my-pi/pi-natives": "13.2.
|
|
48
|
-
"@oh-my-pi/pi-tui": "13.2.
|
|
49
|
-
"@oh-my-pi/pi-utils": "13.2.
|
|
44
|
+
"@oh-my-pi/omp-stats": "13.2.1",
|
|
45
|
+
"@oh-my-pi/pi-agent-core": "13.2.1",
|
|
46
|
+
"@oh-my-pi/pi-ai": "13.2.1",
|
|
47
|
+
"@oh-my-pi/pi-natives": "13.2.1",
|
|
48
|
+
"@oh-my-pi/pi-tui": "13.2.1",
|
|
49
|
+
"@oh-my-pi/pi-utils": "13.2.1",
|
|
50
50
|
"@sinclair/typebox": "^0.34",
|
|
51
51
|
"@xterm/headless": "^6.0",
|
|
52
52
|
"ajv": "^8.18",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* 6. Collapse 2+ blank lines to single blank line
|
|
12
12
|
* 7. Trim trailing whitespace (preserve indentation)
|
|
13
13
|
* 8. No trailing newline at EOF
|
|
14
|
+
* 9. Bold RFC 2119 keywords (MUST, SHOULD, MAY, etc.) in prompt content
|
|
14
15
|
*/
|
|
15
16
|
import { Glob } from "bun";
|
|
16
17
|
|
|
@@ -37,6 +38,23 @@ const TABLE_ROW = /^\|.*\|$/;
|
|
|
37
38
|
// Table separator (|---|---|)
|
|
38
39
|
const TABLE_SEP = /^\|[-:\s|]+\|$/;
|
|
39
40
|
|
|
41
|
+
/** RFC 2119 keywords used in prompts. */
|
|
42
|
+
const RFC2119_KEYWORDS = /\b(?:MUST NOT|SHOULD NOT|SHALL NOT|RECOMMENDED|REQUIRED|OPTIONAL|SHOULD|SHALL|MUST|MAY)\b/g;
|
|
43
|
+
|
|
44
|
+
function boldRfc2119Keywords(line: string): string {
|
|
45
|
+
return line.replace(RFC2119_KEYWORDS, (match, offset, source) => {
|
|
46
|
+
const isAlreadyBold =
|
|
47
|
+
source[offset - 2] === "*" &&
|
|
48
|
+
source[offset - 1] === "*" &&
|
|
49
|
+
source[offset + match.length] === "*" &&
|
|
50
|
+
source[offset + match.length + 1] === "*";
|
|
51
|
+
if (isAlreadyBold) {
|
|
52
|
+
return match;
|
|
53
|
+
}
|
|
54
|
+
return `**${match}**`;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
40
58
|
/** Compact a table row by trimming cell padding */
|
|
41
59
|
function compactTableRow(line: string): string {
|
|
42
60
|
// Split by |, trim each cell, rejoin
|
|
@@ -62,12 +80,6 @@ function compactTableSep(line: string): string {
|
|
|
62
80
|
}
|
|
63
81
|
|
|
64
82
|
function formatPrompt(content: string): string {
|
|
65
|
-
// Replace common ascii ellipsis and arrow patterns with their unicode equivalents
|
|
66
|
-
content = content
|
|
67
|
-
.replace(/\.{3}/g, "…")
|
|
68
|
-
.replace(/->/g, "→")
|
|
69
|
-
.replace(/<-/g, "←")
|
|
70
|
-
.replace(/<->/g, "↔");
|
|
71
83
|
const lines = content.split("\n");
|
|
72
84
|
const result: string[] = [];
|
|
73
85
|
let inCodeBlock = false;
|
|
@@ -75,9 +87,9 @@ function formatPrompt(content: string): string {
|
|
|
75
87
|
const topLevelTags: string[] = [];
|
|
76
88
|
|
|
77
89
|
for (let i = 0; i < lines.length; i++) {
|
|
78
|
-
let line = lines[i];
|
|
90
|
+
let line = lines[i].trimEnd();
|
|
79
91
|
|
|
80
|
-
const trimmed = line.
|
|
92
|
+
const trimmed = line.trimStart();
|
|
81
93
|
|
|
82
94
|
// Track code blocks - don't modify inside them
|
|
83
95
|
if (CODE_FENCE.test(trimmed)) {
|
|
@@ -91,9 +103,18 @@ function formatPrompt(content: string): string {
|
|
|
91
103
|
continue;
|
|
92
104
|
}
|
|
93
105
|
|
|
106
|
+
// Replace common ascii ellipsis and arrow patterns with their unicode equivalents
|
|
107
|
+
line = line
|
|
108
|
+
.replace(/\.{3}/g, "…")
|
|
109
|
+
.replace(/->/g, "→")
|
|
110
|
+
.replace(/<-/g, "←")
|
|
111
|
+
.replace(/<->/g, "↔")
|
|
112
|
+
.replace(/!=/g, "≠")
|
|
113
|
+
.replace(/<=/g, "≤")
|
|
114
|
+
.replace(/>=/g, "≥");
|
|
115
|
+
|
|
94
116
|
// Track top-level XML opening tags for depth-aware indent stripping
|
|
95
|
-
const isOpeningXml =
|
|
96
|
-
OPENING_XML.test(trimmed) && !trimmed.endsWith("/>");
|
|
117
|
+
const isOpeningXml = OPENING_XML.test(trimmed) && !trimmed.endsWith("/>");
|
|
97
118
|
if (isOpeningXml && line.length === trimmed.length) {
|
|
98
119
|
// Opening tag at column 0 — track as top-level
|
|
99
120
|
const match = OPENING_XML.exec(trimmed);
|
|
@@ -104,10 +125,7 @@ function formatPrompt(content: string): string {
|
|
|
104
125
|
const closingMatch = CLOSING_XML.exec(trimmed);
|
|
105
126
|
if (closingMatch) {
|
|
106
127
|
const tagName = closingMatch[1];
|
|
107
|
-
if (
|
|
108
|
-
topLevelTags.length > 0 &&
|
|
109
|
-
topLevelTags[topLevelTags.length - 1] === tagName
|
|
110
|
-
) {
|
|
128
|
+
if (topLevelTags.length > 0 && topLevelTags[topLevelTags.length - 1] === tagName) {
|
|
111
129
|
// Closing tag matches a top-level opener — strip indent
|
|
112
130
|
line = trimmed;
|
|
113
131
|
topLevelTags.pop();
|
|
@@ -126,6 +144,7 @@ function formatPrompt(content: string): string {
|
|
|
126
144
|
// Trim trailing whitespace (preserve leading for non-closing-tags)
|
|
127
145
|
line = line.trimEnd();
|
|
128
146
|
}
|
|
147
|
+
line = boldRfc2119Keywords(line);
|
|
129
148
|
|
|
130
149
|
const isBlank = trimmed === "";
|
|
131
150
|
|
package/src/capability/index.ts
CHANGED
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import * as os from "node:os";
|
|
10
10
|
import * as path from "node:path";
|
|
11
|
-
import { logger } from "@oh-my-pi/pi-utils";
|
|
12
|
-
import { getProjectDir } from "@oh-my-pi/pi-utils/dirs";
|
|
11
|
+
import { getProjectDir, logger } from "@oh-my-pi/pi-utils";
|
|
13
12
|
|
|
14
13
|
import type { Settings } from "../config/settings";
|
|
15
14
|
import { clearCache as clearFsCache, cacheStats as fsCacheStats, invalidate as invalidateFs } from "./fs";
|
package/src/cli/args.ts
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* CLI argument parsing and help display
|
|
3
3
|
*/
|
|
4
4
|
import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
|
5
|
-
import { logger } from "@oh-my-pi/pi-utils";
|
|
6
|
-
import { APP_NAME, CONFIG_DIR_NAME } from "@oh-my-pi/pi-utils/dirs";
|
|
5
|
+
import { APP_NAME, CONFIG_DIR_NAME, logger } from "@oh-my-pi/pi-utils";
|
|
7
6
|
import chalk from "chalk";
|
|
8
7
|
import { BUILTIN_TOOLS } from "../tools";
|
|
9
8
|
|
package/src/cli/config-cli.ts
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
import * as fs from "node:fs";
|
|
5
5
|
import * as path from "node:path";
|
|
6
6
|
import type { ImageContent } from "@oh-my-pi/pi-ai";
|
|
7
|
-
import { isEnoent } from "@oh-my-pi/pi-utils";
|
|
8
|
-
import { getProjectDir } from "@oh-my-pi/pi-utils/dirs";
|
|
7
|
+
import { getProjectDir, isEnoent } from "@oh-my-pi/pi-utils";
|
|
9
8
|
import chalk from "chalk";
|
|
10
9
|
import { resolveReadPath } from "../tools/path-utils";
|
|
11
10
|
import { formatBytes } from "../tools/render-utils";
|
package/src/cli/grep-cli.ts
CHANGED
package/src/cli/jupyter-cli.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Handles `omp jupyter` subcommand for managing the shared Python gateway.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { APP_NAME } from "@oh-my-pi/pi-utils
|
|
7
|
+
import { APP_NAME } from "@oh-my-pi/pi-utils";
|
|
8
8
|
import chalk from "chalk";
|
|
9
9
|
import { getGatewayStatus, shutdownSharedGateway } from "../ipy/gateway-coordinator";
|
|
10
10
|
|
package/src/cli/plugin-cli.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Handles `omp plugin <command>` subcommands for plugin lifecycle management.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { APP_NAME } from "@oh-my-pi/pi-utils
|
|
7
|
+
import { APP_NAME } from "@oh-my-pi/pi-utils";
|
|
8
8
|
import chalk from "chalk";
|
|
9
9
|
import { PluginManager, parseSettingValue, validateSetting } from "../extensibility/plugins";
|
|
10
10
|
import { theme } from "../modes/theme/theme";
|
package/src/cli/setup-cli.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Handles `omp setup <component>` to install dependencies for optional features.
|
|
5
5
|
*/
|
|
6
6
|
import * as path from "node:path";
|
|
7
|
-
import { APP_NAME, getPythonEnvDir } from "@oh-my-pi/pi-utils
|
|
7
|
+
import { APP_NAME, getPythonEnvDir } from "@oh-my-pi/pi-utils";
|
|
8
8
|
import { $ } from "bun";
|
|
9
9
|
import chalk from "chalk";
|
|
10
10
|
import { theme } from "../modes/theme/theme";
|
package/src/cli/shell-cli.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import * as path from "node:path";
|
|
7
7
|
import { createInterface } from "node:readline/promises";
|
|
8
8
|
import { Shell } from "@oh-my-pi/pi-natives";
|
|
9
|
-
import { APP_NAME, getProjectDir } from "@oh-my-pi/pi-utils
|
|
9
|
+
import { APP_NAME, getProjectDir } from "@oh-my-pi/pi-utils";
|
|
10
10
|
import chalk from "chalk";
|
|
11
11
|
import { Settings } from "../config/settings";
|
|
12
12
|
import { getOrCreateSnapshot } from "../utils/shell-snapshot";
|
package/src/cli/ssh-cli.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Handles `omp ssh <command>` subcommands for SSH host configuration management.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { getSSHConfigPath } from "@oh-my-pi/pi-utils
|
|
7
|
+
import { getSSHConfigPath } from "@oh-my-pi/pi-utils";
|
|
8
8
|
import chalk from "chalk";
|
|
9
9
|
import { addSSHHost, readSSHConfigFile, removeSSHHost, type SSHHostConfig } from "../ssh/config-writer";
|
|
10
10
|
|
package/src/cli/stats-cli.ts
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* Handles `omp stats` subcommand for viewing AI usage statistics.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { formatDuration, formatNumber, formatPercent } from "@oh-my-pi/pi-utils";
|
|
8
|
-
import { APP_NAME } from "@oh-my-pi/pi-utils/dirs";
|
|
7
|
+
import { APP_NAME, formatDuration, formatNumber, formatPercent } from "@oh-my-pi/pi-utils";
|
|
9
8
|
import chalk from "chalk";
|
|
10
9
|
import { openPath } from "../utils/open";
|
|
11
10
|
|
package/src/cli/update-cli.ts
CHANGED
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
import { execSync, spawnSync } from "node:child_process";
|
|
8
8
|
import * as fs from "node:fs";
|
|
9
9
|
import { pipeline } from "node:stream/promises";
|
|
10
|
-
import { isEnoent } from "@oh-my-pi/pi-utils";
|
|
11
|
-
import { APP_NAME, VERSION } from "@oh-my-pi/pi-utils/dirs";
|
|
10
|
+
import { APP_NAME, isEnoent, VERSION } from "@oh-my-pi/pi-utils";
|
|
12
11
|
import chalk from "chalk";
|
|
13
12
|
import { theme } from "../modes/theme/theme";
|
|
14
13
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Handles `omp q`/`omp web-search` subcommands for testing web search providers.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { APP_NAME } from "@oh-my-pi/pi-utils
|
|
7
|
+
import { APP_NAME } from "@oh-my-pi/pi-utils";
|
|
8
8
|
import chalk from "chalk";
|
|
9
9
|
import { initTheme, theme } from "../modes/theme/theme";
|
|
10
10
|
import { runSearchQuery, type SearchParams } from "../web/search/index";
|
package/src/cli.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
+
import { APP_NAME, VERSION } from "@oh-my-pi/pi-utils";
|
|
2
3
|
/**
|
|
3
4
|
* CLI entry point — registers all commands explicitly and delegates to the
|
|
4
5
|
* lightweight CLI runner from pi-utils.
|
|
5
6
|
*/
|
|
6
7
|
import { type CommandEntry, run } from "@oh-my-pi/pi-utils/cli";
|
|
7
|
-
import { APP_NAME, VERSION } from "@oh-my-pi/pi-utils/dirs";
|
|
8
8
|
|
|
9
9
|
// Detect known Bun errata that cause TUI crashes (e.g. Bun.stringWidth mishandling OSC sequences).
|
|
10
10
|
if (Bun.stringWidth("\x1b[0m\x1b]8;;\x07") !== 0) {
|
package/src/commands/launch.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Root command for the coding agent CLI.
|
|
3
3
|
*/
|
|
4
|
+
|
|
5
|
+
import { APP_NAME } from "@oh-my-pi/pi-utils";
|
|
4
6
|
import { Args, Command, Flags } from "@oh-my-pi/pi-utils/cli";
|
|
5
|
-
import { APP_NAME } from "@oh-my-pi/pi-utils/dirs";
|
|
6
7
|
import { parseArgs } from "../cli/args";
|
|
7
8
|
import { runRootCommand } from "../main";
|
|
8
9
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { INTENT_FIELD } from "@oh-my-pi/pi-agent-core";
|
|
1
2
|
import type { Api, Model } from "@oh-my-pi/pi-ai";
|
|
2
3
|
import { Markdown } from "@oh-my-pi/pi-tui";
|
|
3
4
|
import chalk from "chalk";
|
|
@@ -245,7 +246,7 @@ function formatToolArgs(args?: Record<string, unknown>): string[] {
|
|
|
245
246
|
}
|
|
246
247
|
};
|
|
247
248
|
for (const [key, value] of Object.entries(args)) {
|
|
248
|
-
if (key ===
|
|
249
|
+
if (key === INTENT_FIELD) continue;
|
|
249
250
|
visit(value, key);
|
|
250
251
|
}
|
|
251
252
|
return lines;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as path from "node:path";
|
|
2
2
|
import { createInterface } from "node:readline/promises";
|
|
3
|
-
import { $env, isEnoent } from "@oh-my-pi/pi-utils";
|
|
4
|
-
import { getProjectDir } from "@oh-my-pi/pi-utils/dirs";
|
|
3
|
+
import { $env, getProjectDir, isEnoent } from "@oh-my-pi/pi-utils";
|
|
5
4
|
import { applyChangelogProposals } from "../../commit/changelog";
|
|
6
5
|
import { detectChangelogBoundaries } from "../../commit/changelog/detect";
|
|
7
6
|
import { parseUnreleasedSection } from "../../commit/changelog/parse";
|
|
@@ -13,11 +13,11 @@ Workflow rules:
|
|
|
13
13
|
6. Do not use read.
|
|
14
14
|
|
|
15
15
|
Commit requirements:
|
|
16
|
-
- Summary line: past-tense verb,
|
|
16
|
+
- Summary line: past-tense verb, ≤ 72 chars, no trailing period.
|
|
17
17
|
- Avoid filler words: comprehensive, various, several, improved, enhanced, better.
|
|
18
18
|
- Avoid meta phrases: "this commit", "this change", "updated code", "modified files".
|
|
19
19
|
- Scope: lowercase, max two segments; only letters, digits, hyphens, underscores.
|
|
20
|
-
- Detail lines optional (0-6). Each sentence ending in period,
|
|
20
|
+
- Detail lines optional (0-6). Each sentence ending in period, ≤ 120 chars.
|
|
21
21
|
|
|
22
22
|
Conventional commit types:
|
|
23
23
|
{{types_description}}
|
|
@@ -34,5 +34,5 @@ Tool guidance:
|
|
|
34
34
|
|
|
35
35
|
## Changelog Requirements
|
|
36
36
|
|
|
37
|
-
If changelog targets provided, you MUST call `propose_changelog` before finishing.
|
|
37
|
+
If changelog targets provided, you **MUST** call `propose_changelog` before finishing.
|
|
38
38
|
If you propose split commit plan, include changelog target files in relevant commit changes.
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
import { Type } from "@sinclair/typebox";
|
|
1
|
+
import { type TSchema, Type } from "@sinclair/typebox";
|
|
2
2
|
import type { CommitAgentState } from "../../../commit/agentic/state";
|
|
3
|
-
import type
|
|
3
|
+
import { CHANGELOG_CATEGORIES, type ChangelogCategory } from "../../../commit/types";
|
|
4
4
|
import type { CustomTool } from "../../../extensibility/custom-tools/types";
|
|
5
5
|
|
|
6
|
+
const changelogEntryProperties = CHANGELOG_CATEGORIES.reduce<Record<ChangelogCategory, TSchema>>(
|
|
7
|
+
(acc, category) => {
|
|
8
|
+
acc[category] = Type.Optional(Type.Array(Type.String()));
|
|
9
|
+
return acc;
|
|
10
|
+
},
|
|
11
|
+
{} as Record<ChangelogCategory, TSchema>,
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const changelogEntriesSchema = Type.Object(changelogEntryProperties);
|
|
15
|
+
const changelogDeletionsSchema = Type.Object(changelogEntryProperties, {
|
|
16
|
+
description: "Entries to remove from existing changelog sections (case-insensitive match)",
|
|
17
|
+
});
|
|
18
|
+
|
|
6
19
|
const changelogEntrySchema = Type.Object({
|
|
7
20
|
path: Type.String(),
|
|
8
|
-
entries:
|
|
9
|
-
deletions: Type.Optional(
|
|
10
|
-
Type.Record(Type.String(), Type.Array(Type.String()), {
|
|
11
|
-
description: "Entries to remove from existing changelog sections (case-insensitive match)",
|
|
12
|
-
}),
|
|
13
|
-
),
|
|
21
|
+
entries: changelogEntriesSchema,
|
|
22
|
+
deletions: Type.Optional(changelogDeletionsSchema),
|
|
14
23
|
});
|
|
15
24
|
|
|
16
25
|
const proposeChangelogSchema = Type.Object({
|
|
@@ -23,15 +32,7 @@ interface ChangelogResponse {
|
|
|
23
32
|
warnings: string[];
|
|
24
33
|
}
|
|
25
34
|
|
|
26
|
-
const allowedCategories = new Set<ChangelogCategory>(
|
|
27
|
-
"Breaking Changes",
|
|
28
|
-
"Added",
|
|
29
|
-
"Changed",
|
|
30
|
-
"Deprecated",
|
|
31
|
-
"Removed",
|
|
32
|
-
"Fixed",
|
|
33
|
-
"Security",
|
|
34
|
-
]);
|
|
35
|
+
const allowedCategories = new Set<ChangelogCategory>(CHANGELOG_CATEGORIES);
|
|
35
36
|
|
|
36
37
|
export function createProposeChangelogTool(
|
|
37
38
|
state: CommitAgentState,
|
|
@@ -50,11 +51,16 @@ export function createProposeChangelogTool(
|
|
|
50
51
|
|
|
51
52
|
const normalized = params.entries.map(entry => {
|
|
52
53
|
const cleaned: Record<string, string[]> = {};
|
|
53
|
-
|
|
54
|
+
const entries = entry.entries as Record<string, string[]>;
|
|
55
|
+
for (const [category, values] of Object.entries(entries)) {
|
|
54
56
|
if (!allowedCategories.has(category as ChangelogCategory)) {
|
|
55
57
|
errors.push(`Unknown changelog category for ${entry.path}: ${category}`);
|
|
56
58
|
continue;
|
|
57
59
|
}
|
|
60
|
+
if (!Array.isArray(values)) {
|
|
61
|
+
errors.push(`Invalid changelog entries for ${entry.path}: ${category}`);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
58
64
|
const items = values.map(value => value.trim().replace(/\.$/, "")).filter(value => value.length > 0);
|
|
59
65
|
if (items.length > 0) {
|
|
60
66
|
cleaned[category] = Array.from(new Set(items));
|
|
@@ -64,11 +70,16 @@ export function createProposeChangelogTool(
|
|
|
64
70
|
let cleanedDeletions: Record<string, string[]> | undefined;
|
|
65
71
|
if (entry.deletions) {
|
|
66
72
|
cleanedDeletions = {};
|
|
67
|
-
|
|
73
|
+
const deletions = entry.deletions as Record<string, string[]>;
|
|
74
|
+
for (const [category, values] of Object.entries(deletions)) {
|
|
68
75
|
if (!allowedCategories.has(category as ChangelogCategory)) {
|
|
69
76
|
errors.push(`Unknown deletion category for ${entry.path}: ${category}`);
|
|
70
77
|
continue;
|
|
71
78
|
}
|
|
79
|
+
if (!Array.isArray(values)) {
|
|
80
|
+
errors.push(`Invalid deletion entries for ${entry.path}: ${category}`);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
72
83
|
const items = values.map(value => value.trim()).filter(value => value.length > 0);
|
|
73
84
|
if (items.length > 0) {
|
|
74
85
|
cleanedDeletions[category] = Array.from(new Set(items));
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
import type { Api, AssistantMessage, Model } from "@oh-my-pi/pi-ai";
|
|
2
2
|
import { completeSimple, validateToolCall } from "@oh-my-pi/pi-ai";
|
|
3
|
-
import { Type } from "@sinclair/typebox";
|
|
3
|
+
import { type TSchema, Type } from "@sinclair/typebox";
|
|
4
4
|
import changelogSystemPrompt from "../../commit/prompts/changelog-system.md" with { type: "text" };
|
|
5
5
|
import changelogUserPrompt from "../../commit/prompts/changelog-user.md" with { type: "text" };
|
|
6
|
-
import type
|
|
6
|
+
import { CHANGELOG_CATEGORIES, type ChangelogCategory, type ChangelogGenerationResult } from "../../commit/types";
|
|
7
7
|
import { renderPromptTemplate } from "../../config/prompt-templates";
|
|
8
8
|
import { extractTextContent, extractToolCall, parseJsonPayload } from "../utils";
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const changelogEntryProperties = CHANGELOG_CATEGORIES.reduce<Record<ChangelogCategory, TSchema>>(
|
|
11
|
+
(acc, category) => {
|
|
12
|
+
acc[category] = Type.Optional(Type.Array(Type.String()));
|
|
13
|
+
return acc;
|
|
14
|
+
},
|
|
15
|
+
{} as Record<ChangelogCategory, TSchema>,
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const changelogEntriesSchema = Type.Object(changelogEntryProperties);
|
|
19
|
+
|
|
20
|
+
export const changelogTool = {
|
|
11
21
|
name: "create_changelog_entries",
|
|
12
22
|
description: "Generate changelog entries grouped by Keep a Changelog categories.",
|
|
13
23
|
parameters: Type.Object({
|
|
14
|
-
entries:
|
|
24
|
+
entries: changelogEntriesSchema,
|
|
15
25
|
}),
|
|
16
26
|
};
|
|
17
27
|
|
|
@@ -46,7 +56,7 @@ export async function generateChangelogEntries({
|
|
|
46
56
|
{
|
|
47
57
|
systemPrompt: renderPromptTemplate(changelogSystemPrompt),
|
|
48
58
|
messages: [{ role: "user", content: prompt, timestamp: Date.now() }],
|
|
49
|
-
tools: [
|
|
59
|
+
tools: [changelogTool],
|
|
50
60
|
},
|
|
51
61
|
{ apiKey, maxTokens: 1200 },
|
|
52
62
|
);
|
|
@@ -58,7 +68,7 @@ export async function generateChangelogEntries({
|
|
|
58
68
|
function parseChangelogResponse(message: AssistantMessage): ChangelogGenerationResult {
|
|
59
69
|
const toolCall = extractToolCall(message, "create_changelog_entries");
|
|
60
70
|
if (toolCall) {
|
|
61
|
-
const parsed = validateToolCall([
|
|
71
|
+
const parsed = validateToolCall([changelogTool], toolCall) as ChangelogGenerationResult;
|
|
62
72
|
return { entries: parsed.entries ?? {} };
|
|
63
73
|
}
|
|
64
74
|
|
|
@@ -2,11 +2,12 @@ import * as path from "node:path";
|
|
|
2
2
|
import type { Api, Model } from "@oh-my-pi/pi-ai";
|
|
3
3
|
import { logger } from "@oh-my-pi/pi-utils";
|
|
4
4
|
import type { ControlledGit } from "../../commit/git";
|
|
5
|
+
import { CHANGELOG_CATEGORIES } from "../../commit/types";
|
|
5
6
|
import { detectChangelogBoundaries } from "./detect";
|
|
6
7
|
import { generateChangelogEntries } from "./generate";
|
|
7
8
|
import { parseUnreleasedSection } from "./parse";
|
|
8
9
|
|
|
9
|
-
const CHANGELOG_SECTIONS =
|
|
10
|
+
const CHANGELOG_SECTIONS = CHANGELOG_CATEGORIES;
|
|
10
11
|
|
|
11
12
|
const DEFAULT_MAX_DIFF_CHARS = 120_000;
|
|
12
13
|
|
package/src/commit/pipeline.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as path from "node:path";
|
|
2
2
|
import type { Api, Model } from "@oh-my-pi/pi-ai";
|
|
3
|
-
import { logger } from "@oh-my-pi/pi-utils";
|
|
4
|
-
import { getProjectDir } from "@oh-my-pi/pi-utils/dirs";
|
|
3
|
+
import { getProjectDir, logger } from "@oh-my-pi/pi-utils";
|
|
5
4
|
import { ModelRegistry } from "../config/model-registry";
|
|
6
5
|
import { renderPromptTemplate } from "../config/prompt-templates";
|
|
7
6
|
import { Settings } from "../config/settings";
|
|
@@ -10,7 +10,7 @@ Determine:
|
|
|
10
10
|
4. CHANGELOG: Metadata for user-visible changes
|
|
11
11
|
</instructions>
|
|
12
12
|
<scope-rules>
|
|
13
|
-
- Component name if
|
|
13
|
+
- Component name if ≥60% changes target it
|
|
14
14
|
- null if spread across multiple components
|
|
15
15
|
- scope_candidates as primary source
|
|
16
16
|
- Valid: specific component names (api, parser, config, etc.)
|
package/src/commit/types.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Types for the omp commit pipeline.
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
4
|
export type CommitType =
|
|
6
5
|
| "feat"
|
|
7
6
|
| "fix"
|
|
@@ -24,6 +23,16 @@ export type ChangelogCategory =
|
|
|
24
23
|
| "Fixed"
|
|
25
24
|
| "Security";
|
|
26
25
|
|
|
26
|
+
export const CHANGELOG_CATEGORIES: ChangelogCategory[] = [
|
|
27
|
+
"Breaking Changes",
|
|
28
|
+
"Added",
|
|
29
|
+
"Changed",
|
|
30
|
+
"Deprecated",
|
|
31
|
+
"Removed",
|
|
32
|
+
"Fixed",
|
|
33
|
+
"Security",
|
|
34
|
+
];
|
|
35
|
+
|
|
27
36
|
export interface CommitCommandArgs {
|
|
28
37
|
/** Push after commit */
|
|
29
38
|
push: boolean;
|
|
@@ -8,8 +8,7 @@ import {
|
|
|
8
8
|
matchesKey,
|
|
9
9
|
setEditorKeybindings,
|
|
10
10
|
} from "@oh-my-pi/pi-tui";
|
|
11
|
-
import { isEnoent, logger } from "@oh-my-pi/pi-utils";
|
|
12
|
-
import { getAgentDir } from "@oh-my-pi/pi-utils/dirs";
|
|
11
|
+
import { getAgentDir, isEnoent, logger } from "@oh-my-pi/pi-utils";
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* Application-level actions (coding agent specific).
|
|
@@ -47,7 +47,7 @@ export const MODEL_ROLES: Record<ModelRole, ModelRoleInfo> = {
|
|
|
47
47
|
smol: { tag: "SMOL", name: "Fast", color: "warning" },
|
|
48
48
|
slow: { tag: "SLOW", name: "Thinking", color: "accent" },
|
|
49
49
|
plan: { tag: "PLAN", name: "Architect", color: "muted" },
|
|
50
|
-
commit: { name: "Commit" },
|
|
50
|
+
commit: { tag: "COMMIT", name: "Commit", color: "dim" },
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
export const MODEL_ROLE_IDS: ModelRole[] = ["default", "smol", "slow", "plan", "commit"];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
-
import { logger } from "@oh-my-pi/pi-utils";
|
|
4
|
-
import { getProjectDir, getProjectPromptsDir, getPromptsDir } from "@oh-my-pi/pi-utils/dirs";
|
|
3
|
+
import { getProjectDir, getProjectPromptsDir, getPromptsDir, logger } from "@oh-my-pi/pi-utils";
|
|
5
4
|
import Handlebars from "handlebars";
|
|
6
5
|
import { computeLineHash } from "../patch/hashline";
|
|
7
6
|
import { jtdToTypeScript } from "../tools/jtd-to-typescript";
|
|
@@ -230,6 +229,19 @@ handlebars.registerHelper("jtdToTypeScript", (schema: unknown): string => jtdToT
|
|
|
230
229
|
|
|
231
230
|
handlebars.registerHelper("jsonStringify", (value: unknown): string => JSON.stringify(value));
|
|
232
231
|
|
|
232
|
+
/**
|
|
233
|
+
* Renders a section separator:
|
|
234
|
+
*
|
|
235
|
+
* ═══════════════════════════════
|
|
236
|
+
* Name
|
|
237
|
+
* ═══════════════════════════════
|
|
238
|
+
*/
|
|
239
|
+
export function sectionSeparator(name: string): string {
|
|
240
|
+
return `\n\n═══════════${name}═══════════\n`;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
handlebars.registerHelper("SECTION_SEPERATOR", (name: unknown): string => sectionSeparator(String(name)));
|
|
244
|
+
|
|
233
245
|
/**
|
|
234
246
|
* {{hlineref lineNum "content"}} — compute a real hashline ref for prompt examples.
|
|
235
247
|
* Returns `"lineNum#hash"` using the actual hash algorithm.
|
package/src/config/settings.ts
CHANGED
|
@@ -13,8 +13,15 @@
|
|
|
13
13
|
|
|
14
14
|
import * as fs from "node:fs";
|
|
15
15
|
import * as path from "node:path";
|
|
16
|
-
import {
|
|
17
|
-
|
|
16
|
+
import {
|
|
17
|
+
getAgentDbPath,
|
|
18
|
+
getAgentDir,
|
|
19
|
+
getProjectDir,
|
|
20
|
+
isEnoent,
|
|
21
|
+
logger,
|
|
22
|
+
procmgr,
|
|
23
|
+
setDefaultTabWidth,
|
|
24
|
+
} from "@oh-my-pi/pi-utils";
|
|
18
25
|
import { YAML } from "bun";
|
|
19
26
|
import { type Settings as SettingsCapabilityItem, settingsCapability } from "../capability/settings";
|
|
20
27
|
import type { ModelRole } from "../config/model-registry";
|
package/src/config.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as os from "node:os";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
-
import { isEnoent, logger } from "@oh-my-pi/pi-utils";
|
|
5
|
-
import { CONFIG_DIR_NAME, getAgentDir, getProjectDir } from "@oh-my-pi/pi-utils/dirs";
|
|
4
|
+
import { CONFIG_DIR_NAME, getAgentDir, getProjectDir, isEnoent, logger } from "@oh-my-pi/pi-utils";
|
|
6
5
|
import type { TSchema } from "@sinclair/typebox";
|
|
7
6
|
import { Value } from "@sinclair/typebox/value";
|
|
8
7
|
import { Ajv, type ErrorObject, type ValidateFunction } from "ajv";
|