@tianhai/pi-workflow-kit 0.8.0 → 0.8.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.
@@ -101,10 +101,27 @@ const SAFE_PATTERNS = [
101
101
  /^\s*eza\b/,
102
102
  ];
103
103
 
104
+ /** Split a compound command into individual sub-commands.
105
+ * Handles &&, ||, ;, and | (pipe) operators, ignoring leading whitespace.
106
+ */
107
+ function splitCompoundCommand(command: string): string[] {
108
+ // Match sub-commands separated by &&, ||, ; (with optional whitespace)
109
+ // We don't split on | to allow piping (e.g. `git log | head`)
110
+ return command
111
+ .split(/&&|\|\||;/)
112
+ .map((s) => s.trim())
113
+ .filter((s) => s.length > 0);
114
+ }
115
+
104
116
  export function isSafeCommand(command: string): boolean {
105
- const isDestructive = DESTRUCTIVE_PATTERNS.some((p) => p.test(command));
106
- const isSafe = SAFE_PATTERNS.some((p) => p.test(command));
107
- return !isDestructive && isSafe;
117
+ const parts = splitCompoundCommand(command);
118
+ return parts.every(
119
+ (part) => {
120
+ const isDestructive = DESTRUCTIVE_PATTERNS.some((p) => p.test(part));
121
+ const isSafe = SAFE_PATTERNS.some((p) => p.test(part));
122
+ return !isDestructive && isSafe;
123
+ },
124
+ );
108
125
  }
109
126
 
110
127
  const SKILL_TO_PHASE: Record<string, Phase> = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tianhai/pi-workflow-kit",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Workflow skills and enforcement extensions for pi",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -13,11 +13,7 @@ Read-only exploration. You may **not** edit or create any files except under `do
13
13
  2. **Understand the idea** — read existing code, docs, and recent commits. Ask questions one at a time to refine the idea. Prefer multiple choice when possible.
14
14
  3. **Explore approaches** — propose 2-3 approaches with trade-offs. Lead with your recommendation.
15
15
  4. **Present the design** — break it into sections of 200-300 words. Check after each section whether it looks right. Cover: architecture, components, data flow, error handling, testing.
16
- 5. **Set up workspace & write the design doc** — create a branch for this work. For larger features, use a git worktree for isolation:
17
- ```
18
- git worktree add ../<repo>-<feature-name> -b <feature-name>
19
- ```
20
- Save the design doc to `docs/plans/YYYY-MM-DD-<topic>-design.md` and commit on the new branch.
16
+ 5. **Write the design doc** — save it to `docs/plans/YYYY-MM-DD-<topic>-design.md`. Ask the user to commit it. Branch creation and worktree setup should be deferred to the execution phase (`/skill:executing-tasks`).
21
17
 
22
18
  ## Principles
23
19
 
@@ -7,6 +7,27 @@ description: "Use this to implement an approved plan task-by-task. Run after wri
7
7
 
8
8
  Implement the plan from `docs/plans/*-implementation.md` task by task.
9
9
 
10
+ ## Before you start
11
+
12
+ 1. **Check git state** — run `git status` and `git log --oneline -5`. Note any uncommitted changes.
13
+ 2. **Suggest workspace isolation** — if the user isn't already on a feature branch or worktree, present the options:
14
+
15
+ - **Branch** (smaller changes):
16
+ ```
17
+ git checkout -b <feature-name>
18
+ ```
19
+ - **Worktree** (larger features, keeps main clean):
20
+ ```
21
+ git worktree add ../<repo>-<feature-name> -b <feature-name>
22
+ ```
23
+
24
+ Derive `<feature-name>` from the plan doc (e.g. `docs/plans/2026-04-16-auth-design.md` → `auth`). Ask the user which they prefer, then wait for confirmation before proceeding.
25
+
26
+ 3. **Commit the plan docs** — if `docs/plans/` has uncommitted files, commit them on the new branch:
27
+ ```
28
+ git add docs/plans/ && git commit -m "docs: add design and implementation plan"
29
+ ```
30
+
10
31
  ## Per-task lifecycle
11
32
 
12
33
  Check each task for a `checkpoint` label and follow the appropriate flow:
@@ -9,7 +9,7 @@ Read-only exploration. You may **not** edit or create any files except under `do
9
9
 
10
10
  ## Process
11
11
 
12
- 1. **Check for a design doc & workspace** — look for `docs/plans/*-design.md`. If one exists, use it as the basis for the plan. Verify you're on the feature branch (or in its worktree) created during brainstorming. If no design doc exists, ask the user to describe what they want to build, read relevant code, create a branch, and create the plan directly.
12
+ 1. **Check for a design doc** — look for `docs/plans/*-design.md`. If one exists, use it as the basis for the plan. If no design doc exists, ask the user to describe what they want to build and read relevant code.
13
13
  2. **Write the implementation plan** — break the design into tasks. Save to `docs/plans/YYYY-MM-DD-<topic>-implementation.md`.
14
14
 
15
15
  ## Task format