@spences10/pi-tool-guidance 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 +53 -2
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
## Tool workflow guidance
|
|
15
15
|
|
|
16
16
|
Distributes native Pi skills and concise system-prompt reminders for
|
|
17
|
-
nopeek, Omnisearch, and
|
|
18
|
-
local files.
|
|
17
|
+
nopeek, Omnisearch, SQLite, and language-aware validation. It does not
|
|
18
|
+
depend on the maintainer's local files.
|
|
19
19
|
|
|
20
20
|
## What ships
|
|
21
21
|
|
|
@@ -37,6 +37,57 @@ conditional on reachable tools or Pi's configured indirect-server
|
|
|
37
37
|
listing. Both codemode and tool-search exposure work without requiring
|
|
38
38
|
direct tool declarations.
|
|
39
39
|
|
|
40
|
+
## Language-aware validation
|
|
41
|
+
|
|
42
|
+
When editing and shell tools are reachable, the prompt reminds the
|
|
43
|
+
agent to use the project's configured linter, type checker, Svelte
|
|
44
|
+
tooling, and tests for code correctness. Coding-preference regexes
|
|
45
|
+
remain workflow/text policies; Svelte guardrails block `$effect` by
|
|
46
|
+
default, with explicit user-controlled exceptions. No parser,
|
|
47
|
+
classifier gate, new validation tool, or automatic command execution
|
|
48
|
+
is added.
|
|
49
|
+
|
|
50
|
+
Use native Codemode to coordinate existing tools:
|
|
51
|
+
|
|
52
|
+
1. Read project instructions and package scripts to select the
|
|
53
|
+
affected checks; do not assume every project uses the same
|
|
54
|
+
commands.
|
|
55
|
+
2. Apply edits through `tools.edit()` / `tools.write()` and await them
|
|
56
|
+
before checking. Native nested calls retain the same guardrail
|
|
57
|
+
hooks as direct calls; do not scan the outer JavaScript as source
|
|
58
|
+
code.
|
|
59
|
+
3. Run independent checks together only when they do not share mutable
|
|
60
|
+
outputs. Keep dependent edits, builds, and checks sequential.
|
|
61
|
+
4. Inspect exit codes and tool errors, then summarize diagnostics. Do
|
|
62
|
+
not infer success from a fulfilled promise: `bash` resolves even
|
|
63
|
+
when its command exits nonzero.
|
|
64
|
+
5. Correct the findings and rerun affected checks before reporting
|
|
65
|
+
completion. Code validation runs after the edit; it is not an
|
|
66
|
+
atomic pre-write security boundary.
|
|
67
|
+
|
|
68
|
+
For example, after choosing this repository's `check` script:
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
const result = await tools.bash({
|
|
72
|
+
command: 'pnpm run check',
|
|
73
|
+
timeout: 120,
|
|
74
|
+
});
|
|
75
|
+
text({
|
|
76
|
+
exit_code: result.exit_code,
|
|
77
|
+
truncated: result.truncated,
|
|
78
|
+
output: result.output.slice(-12000),
|
|
79
|
+
full_output_path: result.full_output_path,
|
|
80
|
+
});
|
|
81
|
+
if (result.exit_code !== 0) throw new Error('Project checks failed');
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Inspect omitted output before diagnosing a failure. For multiple
|
|
85
|
+
independent tool calls, `Promise.allSettled()` preserves successful
|
|
86
|
+
results when another call rejects; inspect each result as well as each
|
|
87
|
+
command's exit code. Codemode is orchestration, not a syntax checker
|
|
88
|
+
or a way around guardrails. No classifier or paid model call is
|
|
89
|
+
needed.
|
|
90
|
+
|
|
40
91
|
## User configuration remains yours
|
|
41
92
|
|
|
42
93
|
The package does not install the nopeek CLI, start MCP servers, set
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,8 @@ const OMNISEARCH_GUIDANCE = `## Web research
|
|
|
4
4
|
For research and current external facts, prefer the configured Omnisearch MCP server. Read the bundled my-pi-omnisearch skill. Discover its actual tools with tool search or codemode, and read source content before presenting claims; snippets alone are not verification.`;
|
|
5
5
|
const SQLITE_GUIDANCE = `## SQLite databases
|
|
6
6
|
Prefer the configured SQLite MCP tools over ad-hoc shell SQL. Read the bundled my-pi-sqlite skill; inspect schema before querying, keep result limits small, and prefer a backup plus an explicit transaction before authorized writes. Do not bypass safety gates to make destructive operations easier.`;
|
|
7
|
+
const VALIDATION_GUIDANCE = `## Language-aware validation
|
|
8
|
+
Use the project's configured linter, type checker, Svelte tooling, and tests for naming and language correctness. Regex guardrails enforce workflow or explicit local policy, not syntax. After edits, run the affected checks. When codemode is available, use it to coordinate independent checks and summarize diagnostics; inspect command exit codes and tool errors before reporting success. Keep edits dependent on earlier results sequential.`;
|
|
7
9
|
export function tool_guidance(options, tools) {
|
|
8
10
|
const selected = options.selectedTools ?? [
|
|
9
11
|
'read',
|
|
@@ -30,8 +32,11 @@ export function tool_guidance(options, tools) {
|
|
|
30
32
|
const available = `${names}\n${servers}`.toLowerCase();
|
|
31
33
|
const shell = selected.some((name) => ['bash', 'powershell'].includes(name)) ||
|
|
32
34
|
reachable.some((tool) => ['bash', 'powershell'].includes(tool.name));
|
|
35
|
+
const editing = selected.some((name) => ['edit', 'write'].includes(name)) ||
|
|
36
|
+
reachable.some((tool) => ['edit', 'write'].includes(tool.name));
|
|
33
37
|
return [
|
|
34
38
|
shell ? NOPEEK_GUIDANCE : '',
|
|
39
|
+
shell && editing ? VALIDATION_GUIDANCE : '',
|
|
35
40
|
available.includes('omnisearch') ? OMNISEARCH_GUIDANCE : '',
|
|
36
41
|
available.includes('sqlite') ? SQLITE_GUIDANCE : '',
|
|
37
42
|
]
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,MAAM,eAAe,GAAG;0VACkU,CAAC;AAE3V,MAAM,mBAAmB,GAAG;8QACkP,CAAC;AAE/Q,MAAM,eAAe,GAAG;0SACkR,CAAC;AAE3S,MAAM,UAAU,aAAa,CAC5B,OAAiC,EACjC,KAAsB;IAEtB,MAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,IAAI;QACzC,MAAM;QACN,MAAM;QACN,MAAM;QACN,OAAO;KACP,CAAC;IACF,MAAM,QAAQ,GACb,QAAQ,CAAC,QA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