prjct-cli 0.45.5 → 0.47.0
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 +60 -0
- package/bin/prjct.ts +3 -47
- package/core/__tests__/utils/preserve-sections.test.ts +216 -0
- package/core/agentic/command-executor.ts +8 -1
- package/core/ai-tools/generator.ts +10 -1
- package/core/commands/command-data.ts +16 -0
- package/core/commands/commands.ts +7 -0
- package/core/commands/register.ts +1 -0
- package/core/commands/setup.ts +4 -4
- package/core/commands/shipping.ts +26 -3
- package/core/commands/workflow.ts +105 -2
- package/core/services/context-generator.ts +12 -1
- package/core/utils/help.ts +321 -0
- package/core/utils/preserve-sections.ts +218 -0
- package/core/utils/subtask-table.ts +234 -0
- package/core/workflow/index.ts +1 -0
- package/core/workflow/workflow-preferences.ts +312 -0
- package/dist/bin/prjct.mjs +4464 -3830
- package/package.json +1 -1
- package/templates/commands/workflow.md +150 -0
package/package.json
CHANGED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
---
|
|
2
|
+
allowed-tools: [Read, Write, Bash, AskUserQuestion]
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# p. workflow
|
|
6
|
+
|
|
7
|
+
Manage workflow preferences using natural language.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
prjct context workflow
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## If NO argument provided
|
|
16
|
+
|
|
17
|
+
Show current workflow preferences:
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
IMPORT: { listWorkflowPreferences, formatWorkflowPreferences } from core/workflow/workflow-preferences
|
|
21
|
+
CALL: preferences = listWorkflowPreferences(projectId)
|
|
22
|
+
OUTPUT: formatWorkflowPreferences(preferences)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## If argument provided (natural language)
|
|
28
|
+
|
|
29
|
+
Parse the user's intent and update preferences accordingly.
|
|
30
|
+
|
|
31
|
+
### Patterns to detect:
|
|
32
|
+
|
|
33
|
+
| Pattern | Hook | Command | Action |
|
|
34
|
+
|---------|------|---------|--------|
|
|
35
|
+
| "antes de ship corre X" | before | ship | X |
|
|
36
|
+
| "before ship run X" | before | ship | X |
|
|
37
|
+
| "después de done X" | after | done | X |
|
|
38
|
+
| "after done run X" | after | done | X |
|
|
39
|
+
| "no quiero X en ship" | skip | ship | true |
|
|
40
|
+
| "skip tests on ship" | skip | ship | true |
|
|
41
|
+
| "quita el hook de ship" | * | ship | REMOVE |
|
|
42
|
+
| "remove ship hook" | * | ship | REMOVE |
|
|
43
|
+
|
|
44
|
+
### Flow:
|
|
45
|
+
|
|
46
|
+
1. **Detect intent** from natural language
|
|
47
|
+
2. **Ask for scope** (ALWAYS):
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
AskUserQuestion:
|
|
51
|
+
question: "¿Cuándo quieres que aplique esto?"
|
|
52
|
+
header: "Scope"
|
|
53
|
+
options:
|
|
54
|
+
- label: "Siempre (Recommended)"
|
|
55
|
+
description: "Guardo en tus preferencias permanentemente"
|
|
56
|
+
- label: "Solo esta sesión"
|
|
57
|
+
description: "Hasta que cierres la terminal"
|
|
58
|
+
- label: "Solo el próximo comando"
|
|
59
|
+
description: "Se usa una vez y se elimina"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
3. **Apply preference**:
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
IMPORT: { setWorkflowPreference, removeWorkflowPreference } from core/workflow/workflow-preferences
|
|
66
|
+
|
|
67
|
+
// For adding/updating
|
|
68
|
+
CALL: setWorkflowPreference(projectId, {
|
|
69
|
+
hook: detected.hook, // 'before' | 'after' | 'skip'
|
|
70
|
+
command: detected.command, // 'task' | 'done' | 'ship' | 'sync'
|
|
71
|
+
action: detected.action, // command to run or 'true' for skip
|
|
72
|
+
scope: userChoice, // 'permanent' | 'session' | 'once'
|
|
73
|
+
createdAt: new Date().toISOString()
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
// For removal
|
|
77
|
+
CALL: removeWorkflowPreference(projectId, hook, command)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
4. **Confirm**:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
IF scope == 'permanent':
|
|
84
|
+
OUTPUT: "Guardado. Antes de cada {command} correré: {action}"
|
|
85
|
+
ELSE IF scope == 'session':
|
|
86
|
+
OUTPUT: "OK. Durante esta sesión, antes de {command} correré: {action}"
|
|
87
|
+
ELSE:
|
|
88
|
+
OUTPUT: "OK. En el próximo {command} correré: {action}"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Examples
|
|
94
|
+
|
|
95
|
+
### Setting a hook
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
User: "p. workflow antes de ship corre bun test"
|
|
99
|
+
|
|
100
|
+
→ Detect: hook=before, command=ship, action="bun test"
|
|
101
|
+
→ Ask scope
|
|
102
|
+
→ User: "siempre"
|
|
103
|
+
→ Save: setWorkflowPreference(projectId, { hook: 'before', command: 'ship', action: 'bun test', scope: 'permanent', ... })
|
|
104
|
+
→ Output: "Guardado. Antes de cada ship correré: bun test"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Removing a hook
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
User: "p. workflow quita el hook de ship"
|
|
111
|
+
|
|
112
|
+
→ Detect: REMOVE for ship
|
|
113
|
+
→ Remove: removeWorkflowPreference(projectId, 'before', 'ship')
|
|
114
|
+
→ Remove: removeWorkflowPreference(projectId, 'after', 'ship')
|
|
115
|
+
→ Output: "Eliminado. Los hooks de ship ya no están activos."
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Skipping a step
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
User: "p. workflow no corras lint en ship"
|
|
122
|
+
|
|
123
|
+
→ Detect: hook=skip, command=ship (interpreted as skip lint step)
|
|
124
|
+
→ Ask scope
|
|
125
|
+
→ User: "solo ahora"
|
|
126
|
+
→ Save: setWorkflowPreference(projectId, { hook: 'skip', command: 'ship', action: 'lint', scope: 'once', ... })
|
|
127
|
+
→ Output: "OK. En el próximo ship se saltará el lint."
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Output Format
|
|
133
|
+
|
|
134
|
+
**When showing preferences**:
|
|
135
|
+
```
|
|
136
|
+
WORKFLOW PREFERENCES
|
|
137
|
+
────────────────────────────
|
|
138
|
+
[permanent] before ship → bun test
|
|
139
|
+
[session] after done → npm run docs
|
|
140
|
+
|
|
141
|
+
Modify: "p. workflow antes de ship corre npm test"
|
|
142
|
+
Remove: "p. workflow quita el hook de ship"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**When no preferences**:
|
|
146
|
+
```
|
|
147
|
+
No workflow preferences configured.
|
|
148
|
+
|
|
149
|
+
Set one: "p. workflow antes de ship corre los tests"
|
|
150
|
+
```
|