@tianhai/pi-workflow-kit 0.8.2 → 0.8.3
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
CHANGED
|
@@ -13,7 +13,7 @@ brainstorm → plan → execute → finalize
|
|
|
13
13
|
**1 extension** that enforces the rules:
|
|
14
14
|
|
|
15
15
|
- During brainstorming and planning, `write` and `edit` are **hard-blocked** outside `docs/plans/`. The agent can only read code and discuss the design with you — it literally cannot modify source files.
|
|
16
|
-
- `bash` is **restricted to read-only commands** — file writes, installs, git mutations, and editors are blocked. Safe commands like `grep`, `find`, `git status`, `cat`, `curl` remain available.
|
|
16
|
+
- `bash` is **restricted to read-only commands** — file writes, installs, git mutations, and editors are blocked. Safe commands like `grep`, `find`, `git status`, `cat`, `curl`, `go doc`, `go list` remain available.
|
|
17
17
|
|
|
18
18
|
No configuration required. Skills and extensions activate automatically after install.
|
|
19
19
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Add Go read-only commands to workflow-guard safe list
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
|
|
5
|
+
Go toolchain read-only commands (`go doc`, `go list`, `go version`, `go env`) are blocked during brainstorm/plan phases because they're not in `SAFE_PATTERNS`. These are purely read-only with no side effects and are commonly needed during code exploration.
|
|
6
|
+
|
|
7
|
+
## Tasks
|
|
8
|
+
|
|
9
|
+
### 1 — Add Go safe patterns [Modifying tested code]
|
|
10
|
+
|
|
11
|
+
**File:** `extensions/workflow-guard.ts`
|
|
12
|
+
|
|
13
|
+
Add four entries to `SAFE_PATTERNS`, after the `git describe` entry:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
/^\s*go\s+doc\b/,
|
|
17
|
+
/^\s*go\s+list\b/,
|
|
18
|
+
/^\s*go\s+version\b/,
|
|
19
|
+
/^\s*go\s+env\b/,
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Verify:** run `npx vitest run tests/workflow-guard.test.ts` — all existing tests should pass.
|
|
23
|
+
|
|
24
|
+
**Commit:** `feat(workflow-guard): add Go read-only commands to safe list`
|
|
25
|
+
|
|
26
|
+
### 2 — Add tests for Go safe commands [New feature]
|
|
27
|
+
|
|
28
|
+
**File:** `tests/workflow-guard.test.ts`
|
|
29
|
+
|
|
30
|
+
Add a new `it` block inside the `describe("isSafeCommand", ...)` suite:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
it("allows go read-only subcommands", () => {
|
|
34
|
+
expect(isSafeCommand("go doc go.opentelemetry.io/otel/label")).toBe(true);
|
|
35
|
+
expect(isSafeCommand("go doc go.opentelemetry.io/otel/codes 2>&1 | head -20")).toBe(true);
|
|
36
|
+
expect(isSafeCommand("go list -m -versions go.opentelemetry.io/otel 2>&1 | tr ' ' '\\n' | grep -E '^v1\\\\.(2[89]|[3-9][0-9])' | head -20")).toBe(true);
|
|
37
|
+
expect(isSafeCommand("go version")).toBe(true);
|
|
38
|
+
expect(isSafeCommand("go env GOOS GOARCH")).toBe(true);
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Also add a `go build` block test to ensure write-oriented Go commands stay blocked:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
it("blocks go write subcommands", () => {
|
|
46
|
+
expect(isSafeCommand("go build ./...")).toBe(false);
|
|
47
|
+
expect(isSafeCommand("go install golang.org/x/tools/gopls@latest")).toBe(false);
|
|
48
|
+
expect(isSafeCommand("go mod tidy")).toBe(false);
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Verify:** run `npx vitest run tests/workflow-guard.test.ts` — all tests pass.
|
|
53
|
+
|
|
54
|
+
**Commit:** `test(workflow-guard): add tests for Go read-only safe commands`
|
|
@@ -110,6 +110,10 @@ const SAFE_PATTERNS = [
|
|
|
110
110
|
/^\s*git\s+stash\s+list\b/i,
|
|
111
111
|
/^\s*git\s+tag\s+(-l|--list)\b/i,
|
|
112
112
|
/^\s*git\s+describe\b/,
|
|
113
|
+
/^\s*go\s+doc\b/,
|
|
114
|
+
/^\s*go\s+list\b/,
|
|
115
|
+
/^\s*go\s+version\b/,
|
|
116
|
+
/^\s*go\s+env\b/,
|
|
113
117
|
];
|
|
114
118
|
|
|
115
119
|
/** Split a compound command into individual sub-commands.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tianhai/pi-workflow-kit",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "Workflow skills and enforcement extensions for pi",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"author": "yinloo-ola",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/yinloo-ola/pi-workflow-kit.git"
|
|
17
|
+
"url": "git+https://github.com/yinloo-ola/pi-workflow-kit.git"
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"extensions/",
|