@paw-workflow/cli 0.0.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 +124 -0
- package/bin/paw.js +82 -0
- package/dist/agents/PAW-Review.agent.md +86 -0
- package/dist/agents/PAW.agent.md +171 -0
- package/dist/skills/paw-code-research/SKILL.md +209 -0
- package/dist/skills/paw-docs-guidance/SKILL.md +163 -0
- package/dist/skills/paw-git-operations/SKILL.md +196 -0
- package/dist/skills/paw-impl-review/SKILL.md +178 -0
- package/dist/skills/paw-implement/SKILL.md +153 -0
- package/dist/skills/paw-init/SKILL.md +118 -0
- package/dist/skills/paw-plan-review/SKILL.md +117 -0
- package/dist/skills/paw-planning/SKILL.md +217 -0
- package/dist/skills/paw-pr/SKILL.md +157 -0
- package/dist/skills/paw-review-baseline/SKILL.md +268 -0
- package/dist/skills/paw-review-correlation/SKILL.md +307 -0
- package/dist/skills/paw-review-critic/SKILL.md +373 -0
- package/dist/skills/paw-review-feedback/SKILL.md +437 -0
- package/dist/skills/paw-review-gap/SKILL.md +639 -0
- package/dist/skills/paw-review-github/SKILL.md +336 -0
- package/dist/skills/paw-review-impact/SKILL.md +569 -0
- package/dist/skills/paw-review-response/SKILL.md +118 -0
- package/dist/skills/paw-review-understanding/SKILL.md +372 -0
- package/dist/skills/paw-review-workflow/SKILL.md +239 -0
- package/dist/skills/paw-spec/SKILL.md +257 -0
- package/dist/skills/paw-spec-research/SKILL.md +138 -0
- package/dist/skills/paw-spec-review/SKILL.md +101 -0
- package/dist/skills/paw-status/SKILL.md +160 -0
- package/dist/skills/paw-transition/SKILL.md +134 -0
- package/dist/skills/paw-work-shaping/SKILL.md +99 -0
- package/dist/skills/paw-workflow/SKILL.md +142 -0
- package/lib/commands/install.js +103 -0
- package/lib/commands/list.js +18 -0
- package/lib/commands/uninstall.js +95 -0
- package/lib/commands/upgrade.js +119 -0
- package/lib/manifest.js +42 -0
- package/lib/paths.js +42 -0
- package/lib/registry.js +41 -0
- package/package.json +40 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: paw-transition
|
|
3
|
+
description: Workflow transition gate for PAW. Handles stage boundaries, session policy, preflight checks, and next activity determination.
|
|
4
|
+
metadata:
|
|
5
|
+
version: "0.0.1"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Workflow Transition
|
|
9
|
+
|
|
10
|
+
> **Execution Context**: This skill runs in a **subagent** session, delegated by the PAW orchestrator when processing a `paw-transition` TODO. Return structured output—do not make orchestration decisions beyond the transition.
|
|
11
|
+
|
|
12
|
+
## Purpose
|
|
13
|
+
|
|
14
|
+
Gate between workflow activities. Ensures:
|
|
15
|
+
- Session policy is respected at stage boundaries
|
|
16
|
+
- Correct branch state before implementation
|
|
17
|
+
- Required artifacts exist before proceeding
|
|
18
|
+
- Next activity is correctly identified and queued
|
|
19
|
+
|
|
20
|
+
## Procedure
|
|
21
|
+
|
|
22
|
+
Execute these steps in order. Do not skip steps.
|
|
23
|
+
|
|
24
|
+
### Step 1: Identify Current State
|
|
25
|
+
|
|
26
|
+
Read WorkflowContext.md to determine:
|
|
27
|
+
- Work ID and target branch
|
|
28
|
+
- Session Policy (`per-stage` | `continuous`)
|
|
29
|
+
- Review Strategy (`prs` | `local`)
|
|
30
|
+
- Review Policy (`always` | `milestones` | `planning-only` | `never`)
|
|
31
|
+
- If missing, check for legacy `Handoff Mode:` field and map: `manual`→`always`, `semi-auto`→`milestones`, `auto`→`never`
|
|
32
|
+
- If neither present, default to `milestones`
|
|
33
|
+
|
|
34
|
+
Identify last completed activity from TODOs or artifacts.
|
|
35
|
+
|
|
36
|
+
### Step 2: Determine Next Activity
|
|
37
|
+
|
|
38
|
+
Use the Mandatory Transitions table:
|
|
39
|
+
|
|
40
|
+
| After Activity | Required Next | Skippable? |
|
|
41
|
+
|----------------|---------------|------------|
|
|
42
|
+
| paw-init | paw-spec or paw-work-shaping | Per user intent |
|
|
43
|
+
| paw-implement (any phase) | paw-impl-review | NO |
|
|
44
|
+
| paw-spec | paw-spec-review | NO |
|
|
45
|
+
| paw-planning | paw-plan-review | NO |
|
|
46
|
+
| paw-impl-review (passes) | paw-implement (next phase) or paw-pr | Per Review Policy |
|
|
47
|
+
|
|
48
|
+
**Skippable = NO**: Add activity TODO and execute immediately after transition completes.
|
|
49
|
+
|
|
50
|
+
### Step 3: Check Stage Boundary and Milestone Pause
|
|
51
|
+
|
|
52
|
+
**Stage boundaries** occur when moving between these stages:
|
|
53
|
+
- spec-review passes → code-research
|
|
54
|
+
- plan-review passes → implement (Phase 1)
|
|
55
|
+
- phase N complete → phase N+1
|
|
56
|
+
- all phases complete → final-pr
|
|
57
|
+
|
|
58
|
+
**Milestones** (require pause check): Spec.md complete, ImplementationPlan.md complete, Phase PR completion, Final PR
|
|
59
|
+
|
|
60
|
+
**Determine pause_at_milestone**:
|
|
61
|
+
- If at a milestone AND Review Policy ∈ {`always`, `milestones`}: set `pause_at_milestone = true`
|
|
62
|
+
- If Review Policy = `planning-only`:
|
|
63
|
+
- If milestone is Spec.md, ImplementationPlan.md, or Final PR: set `pause_at_milestone = true`
|
|
64
|
+
- If milestone is Phase PR/phase completion: set `pause_at_milestone = false`
|
|
65
|
+
- If Review Policy = `never`: set `pause_at_milestone = false`
|
|
66
|
+
- If not at a milestone: set `pause_at_milestone = false`
|
|
67
|
+
|
|
68
|
+
**Determine session_action**:
|
|
69
|
+
- If crossing a stage boundary AND Session Policy = `per-stage`: set `session_action = new_session`
|
|
70
|
+
- Otherwise: set `session_action = continue`
|
|
71
|
+
|
|
72
|
+
If `session_action = new_session`, set inline_instruction to: next activity and phase (e.g., "Phase 2: Tool Enhancement")
|
|
73
|
+
|
|
74
|
+
Continue to Step 4 (preflight still needed for inline_instruction context).
|
|
75
|
+
|
|
76
|
+
### Step 4: Preflight Checks
|
|
77
|
+
|
|
78
|
+
Before the next activity can start, verify:
|
|
79
|
+
|
|
80
|
+
**For paw-implement**:
|
|
81
|
+
- [ ] On correct branch per Review Strategy
|
|
82
|
+
- `prs`: phase branch (e.g., `<target>_phase1`)
|
|
83
|
+
- `local`: target branch
|
|
84
|
+
- [ ] ImplementationPlan.md exists and has the target phase
|
|
85
|
+
|
|
86
|
+
**For paw-code-research**:
|
|
87
|
+
- [ ] Spec.md exists (unless minimal mode)
|
|
88
|
+
|
|
89
|
+
**For paw-pr**:
|
|
90
|
+
- [ ] All phases complete
|
|
91
|
+
- [ ] On target branch or ready to merge
|
|
92
|
+
|
|
93
|
+
**Artifact Tracking Check** (for all activities):
|
|
94
|
+
- Check if `.paw/work/<work-id>/.gitignore` exists
|
|
95
|
+
- If exists with `*` pattern: artifact_tracking = `disabled`
|
|
96
|
+
- Otherwise: artifact_tracking = `enabled`
|
|
97
|
+
|
|
98
|
+
If any check fails, report blocker and stop.
|
|
99
|
+
|
|
100
|
+
### Step 5: Queue Next Activity
|
|
101
|
+
|
|
102
|
+
Add TODO for next activity:
|
|
103
|
+
- `[ ] <activity-name> (<context>)`
|
|
104
|
+
- `[ ] paw-transition`
|
|
105
|
+
|
|
106
|
+
## Completion
|
|
107
|
+
|
|
108
|
+
After completing all steps, return structured output:
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
TRANSITION RESULT:
|
|
112
|
+
- session_action: [continue | new_session]
|
|
113
|
+
- pause_at_milestone: [true | false]
|
|
114
|
+
- next_activity: [activity name and context]
|
|
115
|
+
- artifact_tracking: [enabled | disabled]
|
|
116
|
+
- preflight: [passed | blocked: <reason>]
|
|
117
|
+
- work_id: [current work ID]
|
|
118
|
+
- inline_instruction: [for new_session only: resume hint]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**If pause_at_milestone = true**: The PAW agent must PAUSE and wait for user confirmation before proceeding.
|
|
122
|
+
|
|
123
|
+
**If session_action = new_session**: The PAW agent must call `paw_new_session` with the provided work_id and inline_instruction.
|
|
124
|
+
|
|
125
|
+
**If preflight = blocked**: The PAW agent must report the blocker to the user.
|
|
126
|
+
|
|
127
|
+
Mark the `paw-transition` TODO complete after returning this output.
|
|
128
|
+
|
|
129
|
+
## Guardrails
|
|
130
|
+
|
|
131
|
+
- Do NOT skip the stage boundary check (Step 3)
|
|
132
|
+
- Do NOT return session_action = continue if boundary + per-stage policy
|
|
133
|
+
- Do NOT return preflight = passed if checks actually failed
|
|
134
|
+
- Do NOT call paw_new_session directly—return the decision for PAW agent to act on
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: paw-work-shaping
|
|
3
|
+
description: Interactive pre-spec ideation utility skill. Agent-led Q&A to progressively clarify vague ideas, research codebase context, and produce structured WorkShaping.md artifact.
|
|
4
|
+
metadata:
|
|
5
|
+
version: "0.0.1"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Work Shaping
|
|
9
|
+
|
|
10
|
+
> **Execution Context**: This skill runs **directly** in the PAW session (not a subagent)—interactive Q&A by design.
|
|
11
|
+
|
|
12
|
+
Interactive ideation session to transform vague ideas into structured, spec-ready work items.
|
|
13
|
+
|
|
14
|
+
## When to Use
|
|
15
|
+
|
|
16
|
+
- User explicitly asks to explore, shape, or flesh out an idea
|
|
17
|
+
- Request has exploratory language ("what if", "maybe we could", "I'm thinking about")
|
|
18
|
+
- User expresses uncertainty ("I'm not sure if...", "not sure how to approach")
|
|
19
|
+
- Idea is too vague for direct specification
|
|
20
|
+
|
|
21
|
+
## Session Flow
|
|
22
|
+
|
|
23
|
+
### 1. Opening
|
|
24
|
+
|
|
25
|
+
Acknowledge the idea and set expectations:
|
|
26
|
+
- This is an exploratory conversation to clarify the work
|
|
27
|
+
- You'll ask questions to understand intent, constraints, and scope
|
|
28
|
+
- User can end anytime; you'll signal when "complete enough"
|
|
29
|
+
|
|
30
|
+
### 2. Progressive Clarification
|
|
31
|
+
|
|
32
|
+
Agent-led Q&A to build understanding:
|
|
33
|
+
|
|
34
|
+
**Question strategy**:
|
|
35
|
+
- One question at a time
|
|
36
|
+
- Start broad (intent, value proposition), then narrow (boundaries, constraints)
|
|
37
|
+
- Offer recommendations when you have informed opinions
|
|
38
|
+
- Prefer multiple choice when options are enumerable
|
|
39
|
+
|
|
40
|
+
**Topics to explore** (adapt based on idea):
|
|
41
|
+
- Core value: What problem does this solve? Who benefits?
|
|
42
|
+
- Scope boundaries: What's definitely in? What's explicitly out?
|
|
43
|
+
- User interactions: How will users engage with this?
|
|
44
|
+
- Edge cases: What happens when X fails/is empty/conflicts?
|
|
45
|
+
- Success definition: How will we know it works?
|
|
46
|
+
- Constraints: Performance, security, compatibility requirements?
|
|
47
|
+
|
|
48
|
+
**Codebase research**: When questions arise about existing system behavior, patterns, or integration points, delegate to `paw-code-research` skill via subagent with specific questions. Request findings returned in chat summary rather than full artifact generation. Integrate findings into the conversation.
|
|
49
|
+
|
|
50
|
+
### 3. Completion Detection
|
|
51
|
+
|
|
52
|
+
Signal "complete enough" when:
|
|
53
|
+
- Core value proposition is clear
|
|
54
|
+
- Scope boundaries are defined
|
|
55
|
+
- Major edge cases identified
|
|
56
|
+
- No critical unknowns remain
|
|
57
|
+
|
|
58
|
+
Offer to:
|
|
59
|
+
- Continue exploring specific areas
|
|
60
|
+
- Generate the WorkShaping.md artifact
|
|
61
|
+
- Hand off to specification stage
|
|
62
|
+
|
|
63
|
+
User can also end anytime with "that's enough", "let's write it up", etc.
|
|
64
|
+
|
|
65
|
+
### 4. Artifact Generation
|
|
66
|
+
|
|
67
|
+
Synthesize the conversation into WorkShaping.md.
|
|
68
|
+
|
|
69
|
+
## Artifact Content
|
|
70
|
+
|
|
71
|
+
WorkShaping.md should capture:
|
|
72
|
+
- Problem statement (who benefits, what problem is solved)
|
|
73
|
+
- Work breakdown (core functionality vs supporting features)
|
|
74
|
+
- Edge cases with expected handling
|
|
75
|
+
- Rough architecture (component interactions, data flow)
|
|
76
|
+
- Critical analysis (value assessment, build vs modify tradeoffs)
|
|
77
|
+
- Codebase fit (similar features, reuse opportunities)
|
|
78
|
+
- Risk assessment (potential negative impacts, gotchas)
|
|
79
|
+
- Open questions for downstream stages
|
|
80
|
+
- Session notes: key decisions and insights from the Q&A (e.g., scope decisions, rejected alternatives, surprising discoveries)
|
|
81
|
+
|
|
82
|
+
Use clear section headers. Omit sections that don't apply.
|
|
83
|
+
|
|
84
|
+
## Artifact Location
|
|
85
|
+
|
|
86
|
+
**Primary**: `.paw/work/<work-id>/WorkShaping.md` (if work directory exists)
|
|
87
|
+
|
|
88
|
+
**Fallback**: Workspace root. Prompt user for alternate location if needed.
|
|
89
|
+
|
|
90
|
+
## Quality Checklist
|
|
91
|
+
|
|
92
|
+
- [ ] Problem statement is clear and user-focused
|
|
93
|
+
- [ ] Work breakdown covers core and supporting functionality
|
|
94
|
+
- [ ] Edge cases enumerated with expected handling
|
|
95
|
+
- [ ] Architecture sketch shows component relationships
|
|
96
|
+
- [ ] Critical analysis includes value assessment and tradeoffs
|
|
97
|
+
- [ ] Codebase fit identifies reuse opportunities
|
|
98
|
+
- [ ] Risks and gotchas documented
|
|
99
|
+
- [ ] Open questions captured for downstream stages
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: paw-workflow
|
|
3
|
+
description: Reference documentation for PAW multi-phase implementation workflows. Provides activity tables, artifact structure, stage guidance, and PR routing patterns. Workflow enforcement rules are in PAW.agent.md.
|
|
4
|
+
metadata:
|
|
5
|
+
version: "0.0.1"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# PAW Implementation Workflow Skill
|
|
9
|
+
|
|
10
|
+
**Reference Documentation**: This skill provides guidance on typical patterns, artifact structure, and stage sequences. Workflow enforcement (mandatory transitions, TODO tracking, pause rules) is in the PAW agent, not this skill.
|
|
11
|
+
|
|
12
|
+
Prerequisite: WorkflowContext.md must exist (created by `paw-init`).
|
|
13
|
+
|
|
14
|
+
## Core Implementation Principles
|
|
15
|
+
|
|
16
|
+
These principles apply to ALL implementation stages.
|
|
17
|
+
|
|
18
|
+
### 1. Evidence-Based Documentation
|
|
19
|
+
|
|
20
|
+
Code-related claims in any artifact MUST be supported by:
|
|
21
|
+
- Specific file:line references for code claims
|
|
22
|
+
- Concrete code patterns or test results
|
|
23
|
+
- Direct evidence from the codebase
|
|
24
|
+
|
|
25
|
+
For non-code claims (e.g., requirements or planning decisions), cite the source when available (issue/discussion/user input) and clearly label assumptions.
|
|
26
|
+
|
|
27
|
+
Do not present speculation, assumptions, or unverified claims as fact.
|
|
28
|
+
|
|
29
|
+
### 2. File:Line Reference Requirement
|
|
30
|
+
|
|
31
|
+
All code-related claims require specific file:line citations:
|
|
32
|
+
- `[src/module.ts:45](src/module.ts#L45)` for single lines
|
|
33
|
+
- `[src/module.ts:45-52](src/module.ts#L45-L52)` for ranges
|
|
34
|
+
- Multiple locations listed explicitly
|
|
35
|
+
|
|
36
|
+
### 3. No Fabrication Guardrail
|
|
37
|
+
|
|
38
|
+
**CRITICAL**: Do not fabricate, invent, or assume information:
|
|
39
|
+
- If information is unavailable, state "Not found" or "Unable to determine"
|
|
40
|
+
- Do not hallucinate file contents, function behaviors, or patterns
|
|
41
|
+
- When uncertain, document the uncertainty explicitly
|
|
42
|
+
|
|
43
|
+
### 4. Artifact Completeness
|
|
44
|
+
|
|
45
|
+
Each stage produces complete, well-structured artifacts:
|
|
46
|
+
- No placeholders or "TBD" markers
|
|
47
|
+
- No unresolved questions blocking downstream stages
|
|
48
|
+
- Each artifact is self-contained and traceable to sources
|
|
49
|
+
|
|
50
|
+
### 5. Human Authority
|
|
51
|
+
|
|
52
|
+
Humans have final authority over all workflow decisions:
|
|
53
|
+
- Review pauses honor human review preferences
|
|
54
|
+
- Implementation choices can be overridden
|
|
55
|
+
- Artifacts are advisory until human-approved
|
|
56
|
+
|
|
57
|
+
## Activities
|
|
58
|
+
|
|
59
|
+
| Skill | Capabilities | Primary Artifacts |
|
|
60
|
+
|-------|--------------|-------------------|
|
|
61
|
+
| `paw-spec` | Create spec, revise spec | Spec.md |
|
|
62
|
+
| `paw-spec-research` | Answer factual questions about existing system | SpecResearch.md |
|
|
63
|
+
| `paw-spec-review` | Review spec for quality, completeness, clarity | Review feedback |
|
|
64
|
+
| `paw-code-research` | Document implementation details with file:line refs | CodeResearch.md |
|
|
65
|
+
| `paw-planning` | Create implementation plan, revise plan | ImplementationPlan.md |
|
|
66
|
+
| `paw-plan-review` | Review plan for feasibility, spec alignment | Review feedback |
|
|
67
|
+
| `paw-implement` | Execute plan phases, make code changes | Code files, Docs.md |
|
|
68
|
+
| `paw-impl-review` | Review implementation quality, return verdict | Review feedback |
|
|
69
|
+
| `paw-pr` | Pre-flight validation, create final PR | Final PR |
|
|
70
|
+
|
|
71
|
+
**Note**: Phase PR creation is handled by PAW agent (using `paw-git-operations`) after `paw-impl-review` passes.
|
|
72
|
+
|
|
73
|
+
**Utility skills**: `paw-git-operations` (branching, Phase PRs), `paw-review-response` (PR comments), `paw-docs-guidance` (documentation).
|
|
74
|
+
|
|
75
|
+
## Artifact Directory Structure
|
|
76
|
+
|
|
77
|
+
All implementation artifacts are stored in a consistent directory structure:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
.paw/work/<work-id>/
|
|
81
|
+
├── WorkflowContext.md # Configuration and state
|
|
82
|
+
├── WorkShaping.md # Pre-spec ideation output (optional, from paw-work-shaping)
|
|
83
|
+
├── Spec.md # Feature specification
|
|
84
|
+
├── SpecResearch.md # Research answers (optional)
|
|
85
|
+
├── CodeResearch.md # Implementation details with file:line refs
|
|
86
|
+
├── ImplementationPlan.md # Phased implementation plan
|
|
87
|
+
├── Docs.md # Technical documentation (created during final implementation phase)
|
|
88
|
+
└── prompts/ # Generated prompt files (optional)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Work ID Derivation**: Normalized from Work Title, lowercase with hyphens (e.g., "Auth System" → "auth-system").
|
|
92
|
+
|
|
93
|
+
## Default Flow Guidance
|
|
94
|
+
|
|
95
|
+
Typical greenfield progression (adapt based on user intent and workflow state):
|
|
96
|
+
|
|
97
|
+
### Specification Stage
|
|
98
|
+
1. `paw-spec`: Create specification from brief/issue
|
|
99
|
+
2. `paw-spec-research` (if needed): Answer factual questions
|
|
100
|
+
3. `paw-spec-review`: Review spec quality
|
|
101
|
+
|
|
102
|
+
### Planning Stage
|
|
103
|
+
1. `paw-code-research`: Document implementation details with file:line references
|
|
104
|
+
2. `paw-planning`: Create phased implementation plan
|
|
105
|
+
3. `paw-plan-review`: Review plan feasibility
|
|
106
|
+
|
|
107
|
+
### Implementation Stage
|
|
108
|
+
Per phase in ImplementationPlan.md:
|
|
109
|
+
1. `paw-implement`: Execute phase, make code changes
|
|
110
|
+
2. `paw-impl-review`: Review changes (returns verdict)
|
|
111
|
+
3. Phase PR created (PRs strategy) or push (local strategy)
|
|
112
|
+
|
|
113
|
+
Final phase typically includes documentation (Docs.md, README, CHANGELOG).
|
|
114
|
+
|
|
115
|
+
### Finalization Stage
|
|
116
|
+
1. `paw-pr`: Pre-flight validation, create final PR
|
|
117
|
+
|
|
118
|
+
## PR Comment Response Routing
|
|
119
|
+
|
|
120
|
+
| PR Type | Skill to Load | Notes |
|
|
121
|
+
|---------|--------------|-------|
|
|
122
|
+
| Planning PR | `paw-planning` | Comments on ImplementationPlan.md |
|
|
123
|
+
| Phase PR | `paw-implement` → `paw-impl-review` | Code changes then verify |
|
|
124
|
+
| Final PR | `paw-implement` → `paw-impl-review` | May require code changes |
|
|
125
|
+
|
|
126
|
+
Load `paw-review-response` utility skill for comment mechanics.
|
|
127
|
+
|
|
128
|
+
## Execution Model
|
|
129
|
+
|
|
130
|
+
**Direct execution**: `paw-spec`, `paw-planning`, `paw-implement`, `paw-pr`, `paw-init`, `paw-status`, `paw-work-shaping`
|
|
131
|
+
|
|
132
|
+
**Subagent delegation**: `paw-spec-research`, `paw-code-research`, `paw-spec-review`, `paw-plan-review`, `paw-impl-review`
|
|
133
|
+
|
|
134
|
+
**Orchestrator-handled**: Push and Phase PR creation (after `paw-impl-review` passes, using `paw-git-operations`)
|
|
135
|
+
|
|
136
|
+
Activities may return `blocked` status with open questions. Apply Review Policy to determine resolution approach (`never`: research autonomously; `always`/`milestones`: ask user).
|
|
137
|
+
|
|
138
|
+
## Workflow Mode
|
|
139
|
+
|
|
140
|
+
- **Full**: All stages, multiple phases, PRs or local strategy
|
|
141
|
+
- **Minimal**: May skip spec stage, single phase, forces local strategy
|
|
142
|
+
- **Custom**: Read Custom Workflow Instructions from WorkflowContext.md
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readdirSync, copyFileSync } from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { createInterface } from 'readline';
|
|
4
|
+
import {
|
|
5
|
+
getCopilotAgentsDir,
|
|
6
|
+
getCopilotSkillsDir,
|
|
7
|
+
getDistAgentsDir,
|
|
8
|
+
getDistSkillsDir,
|
|
9
|
+
} from '../paths.js';
|
|
10
|
+
import { readManifest, writeManifest, createManifest } from '../manifest.js';
|
|
11
|
+
|
|
12
|
+
const VERSION = '0.0.1';
|
|
13
|
+
|
|
14
|
+
const SUPPORTED_TARGETS = ['copilot'];
|
|
15
|
+
|
|
16
|
+
async function confirm(message) {
|
|
17
|
+
const rl = createInterface({
|
|
18
|
+
input: process.stdin,
|
|
19
|
+
output: process.stdout,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return new Promise((resolve) => {
|
|
23
|
+
rl.question(`${message} (y/N) `, (answer) => {
|
|
24
|
+
rl.close();
|
|
25
|
+
resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function copyDirectory(srcDir, destDir, fileList) {
|
|
31
|
+
if (!existsSync(destDir)) {
|
|
32
|
+
mkdirSync(destDir, { recursive: true });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const entries = readdirSync(srcDir, { withFileTypes: true });
|
|
36
|
+
|
|
37
|
+
for (const entry of entries) {
|
|
38
|
+
const srcPath = join(srcDir, entry.name);
|
|
39
|
+
const destPath = join(destDir, entry.name);
|
|
40
|
+
|
|
41
|
+
if (entry.isDirectory()) {
|
|
42
|
+
copyDirectory(srcPath, destPath, fileList);
|
|
43
|
+
} else if (entry.isFile()) {
|
|
44
|
+
copyFileSync(srcPath, destPath);
|
|
45
|
+
fileList.push(destPath);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export async function installCommand(target, flags = {}) {
|
|
51
|
+
if (!SUPPORTED_TARGETS.includes(target)) {
|
|
52
|
+
throw new Error(`Unsupported target: ${target}. Supported: ${SUPPORTED_TARGETS.join(', ')}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const distAgentsDir = getDistAgentsDir();
|
|
56
|
+
const distSkillsDir = getDistSkillsDir();
|
|
57
|
+
|
|
58
|
+
if (!existsSync(distAgentsDir) || !existsSync(distSkillsDir)) {
|
|
59
|
+
throw new Error('Distribution files not found. Package may be corrupted.');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const existingManifest = readManifest();
|
|
63
|
+
const copilotAgentsDir = getCopilotAgentsDir();
|
|
64
|
+
const copilotSkillsDir = getCopilotSkillsDir();
|
|
65
|
+
|
|
66
|
+
// Check for existing installation
|
|
67
|
+
const hasExistingFiles = existingManifest ||
|
|
68
|
+
existsSync(copilotAgentsDir) && readdirSync(copilotAgentsDir).some(f => f.includes('PAW'));
|
|
69
|
+
|
|
70
|
+
if (hasExistingFiles && !flags.force) {
|
|
71
|
+
const proceed = await confirm('PAW files already exist. Overwrite?');
|
|
72
|
+
if (!proceed) {
|
|
73
|
+
console.log('Installation cancelled.');
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
console.log(`Installing PAW to ${target}...`);
|
|
79
|
+
|
|
80
|
+
const installedFiles = {
|
|
81
|
+
agents: [],
|
|
82
|
+
skills: [],
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Copy agents
|
|
86
|
+
console.log(' Copying agents...');
|
|
87
|
+
copyDirectory(distAgentsDir, copilotAgentsDir, installedFiles.agents);
|
|
88
|
+
|
|
89
|
+
// Copy skills
|
|
90
|
+
console.log(' Copying skills...');
|
|
91
|
+
copyDirectory(distSkillsDir, copilotSkillsDir, installedFiles.skills);
|
|
92
|
+
|
|
93
|
+
// Write manifest
|
|
94
|
+
const manifest = createManifest(VERSION, target, installedFiles);
|
|
95
|
+
writeManifest(manifest);
|
|
96
|
+
|
|
97
|
+
const agentCount = readdirSync(distAgentsDir).filter(f => f.endsWith('.md')).length;
|
|
98
|
+
const skillCount = readdirSync(distSkillsDir, { withFileTypes: true })
|
|
99
|
+
.filter(e => e.isDirectory()).length;
|
|
100
|
+
|
|
101
|
+
console.log(`\nInstalled ${agentCount} agents and ${skillCount} skills to ~/.copilot/`);
|
|
102
|
+
console.log('Manifest written to ~/.paw/copilot-cli/manifest.json');
|
|
103
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { readManifest } from '../manifest.js';
|
|
2
|
+
|
|
3
|
+
export async function listCommand() {
|
|
4
|
+
const manifest = readManifest();
|
|
5
|
+
|
|
6
|
+
if (!manifest) {
|
|
7
|
+
console.log('PAW is not installed.');
|
|
8
|
+
console.log('Run "paw install copilot" to install.');
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
console.log(`PAW v${manifest.version}`);
|
|
13
|
+
console.log(`Target: ${manifest.target}`);
|
|
14
|
+
console.log(`Installed: ${new Date(manifest.installedAt).toLocaleString()}`);
|
|
15
|
+
console.log('');
|
|
16
|
+
console.log(`Agents: ${manifest.files.agents.length}`);
|
|
17
|
+
console.log(`Skills: ${manifest.files.skills.length}`);
|
|
18
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { existsSync, unlinkSync, rmdirSync, readdirSync } from 'fs';
|
|
2
|
+
import { dirname } from 'path';
|
|
3
|
+
import { createInterface } from 'readline';
|
|
4
|
+
import { readManifest } from '../manifest.js';
|
|
5
|
+
import { getCopilotAgentsDir, getCopilotSkillsDir, getManifestPath } from '../paths.js';
|
|
6
|
+
|
|
7
|
+
async function confirm(message) {
|
|
8
|
+
const rl = createInterface({
|
|
9
|
+
input: process.stdin,
|
|
10
|
+
output: process.stdout,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
return new Promise((resolve) => {
|
|
14
|
+
rl.question(`${message} (y/N) `, (answer) => {
|
|
15
|
+
rl.close();
|
|
16
|
+
resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function removeEmptyDirs(dir) {
|
|
22
|
+
if (!existsSync(dir)) return;
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
const entries = readdirSync(dir);
|
|
26
|
+
if (entries.length === 0) {
|
|
27
|
+
rmdirSync(dir);
|
|
28
|
+
removeEmptyDirs(dirname(dir));
|
|
29
|
+
}
|
|
30
|
+
} catch {
|
|
31
|
+
// Ignore errors when cleaning up
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export async function uninstallCommand(flags = {}) {
|
|
36
|
+
const manifest = readManifest();
|
|
37
|
+
|
|
38
|
+
if (!manifest) {
|
|
39
|
+
// Check for orphaned files
|
|
40
|
+
const agentsDir = getCopilotAgentsDir();
|
|
41
|
+
const skillsDir = getCopilotSkillsDir();
|
|
42
|
+
const hasPawAgents = existsSync(agentsDir) &&
|
|
43
|
+
readdirSync(agentsDir).some(f => f.includes('PAW'));
|
|
44
|
+
const hasPawSkills = existsSync(skillsDir) &&
|
|
45
|
+
readdirSync(skillsDir).some(f => f.startsWith('paw-'));
|
|
46
|
+
|
|
47
|
+
if (!hasPawAgents && !hasPawSkills) {
|
|
48
|
+
console.log('PAW is not installed.');
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
console.log('Warning: PAW files found but no manifest. Cannot determine exact files to remove.');
|
|
53
|
+
console.log('Please manually remove PAW files from ~/.copilot/agents/ and ~/.copilot/skills/');
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (!flags.force) {
|
|
58
|
+
const proceed = await confirm('Remove all PAW agents and skills?');
|
|
59
|
+
if (!proceed) {
|
|
60
|
+
console.log('Uninstall cancelled.');
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
console.log('Uninstalling PAW...');
|
|
66
|
+
|
|
67
|
+
let removedAgents = 0;
|
|
68
|
+
let removedSkills = 0;
|
|
69
|
+
|
|
70
|
+
// Remove agents
|
|
71
|
+
for (const filePath of manifest.files.agents) {
|
|
72
|
+
if (existsSync(filePath)) {
|
|
73
|
+
unlinkSync(filePath);
|
|
74
|
+
removedAgents++;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Remove skills
|
|
79
|
+
for (const filePath of manifest.files.skills) {
|
|
80
|
+
if (existsSync(filePath)) {
|
|
81
|
+
unlinkSync(filePath);
|
|
82
|
+
removedSkills++;
|
|
83
|
+
removeEmptyDirs(dirname(filePath));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Remove manifest
|
|
88
|
+
const manifestPath = getManifestPath();
|
|
89
|
+
if (existsSync(manifestPath)) {
|
|
90
|
+
unlinkSync(manifestPath);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
console.log(`Removed ${removedAgents} agent files and ${removedSkills} skill files.`);
|
|
94
|
+
console.log('PAW has been uninstalled.');
|
|
95
|
+
}
|