prjct-cli 0.46.0 → 0.48.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 +49 -3787
- package/bin/prjct.ts +3 -47
- package/core/agentic/command-executor.ts +8 -1
- package/core/agentic/context-builder.ts +4 -4
- package/core/agentic/memory-system.ts +3 -1
- package/core/agentic/prompt-builder.ts +6 -2
- package/core/agentic/smart-context.ts +2 -2
- package/core/ai-tools/generator.ts +11 -1
- package/core/cli/linear.ts +5 -4
- package/core/commands/analytics.ts +3 -1
- package/core/commands/command-data.ts +16 -0
- package/core/commands/commands.ts +8 -1
- package/core/commands/register.ts +1 -0
- package/core/commands/registry.ts +3 -2
- package/core/commands/setup.ts +4 -4
- package/core/commands/shipping.ts +26 -3
- package/core/commands/workflow.ts +105 -2
- package/core/constants/index.ts +3 -1
- package/core/context-tools/imports-tool.ts +1 -1
- package/core/context-tools/signatures-tool.ts +1 -1
- package/core/plugin/hooks.ts +1 -1
- package/core/services/agent-generator.ts +58 -6
- package/core/services/context-generator.ts +35 -15
- package/core/utils/help.ts +320 -0
- package/core/utils/markdown-builder.ts +9 -3
- package/core/utils/preserve-sections.ts +1 -1
- package/core/utils/project-commands.ts +0 -6
- 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 +4540 -3902
- package/package.json +1 -1
- package/templates/commands/workflow.md +150 -0
- package/templates/global/CLAUDE.md +27 -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
|
+
```
|
|
@@ -147,6 +147,33 @@ fs.writeFileSync(path, JSON.stringify(data, null, 2))
|
|
|
147
147
|
|
|
148
148
|
**Full specification**: Install prjct-cli and see `{npm root -g}/prjct-cli/templates/global/STORAGE-SPEC.md`
|
|
149
149
|
|
|
150
|
+
### 6. Preserve Markers (User Customizations)
|
|
151
|
+
|
|
152
|
+
User customizations in context files and agents survive regeneration using preserve markers:
|
|
153
|
+
|
|
154
|
+
```markdown
|
|
155
|
+
<!-- prjct:preserve -->
|
|
156
|
+
# My Custom Rules
|
|
157
|
+
- Always use tabs
|
|
158
|
+
- Prefer functional patterns
|
|
159
|
+
<!-- /prjct:preserve -->
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**How it works:**
|
|
163
|
+
- Content between markers is extracted before regeneration
|
|
164
|
+
- After regeneration, preserved content is appended under "Your Customizations"
|
|
165
|
+
- Named sections: `<!-- prjct:preserve:my-rules -->` for identification
|
|
166
|
+
|
|
167
|
+
**Where to use:**
|
|
168
|
+
- `context/CLAUDE.md` - Project-specific AI instructions
|
|
169
|
+
- `agents/*.md` - Domain-specific patterns
|
|
170
|
+
- Any regenerated context file
|
|
171
|
+
|
|
172
|
+
**⚠️ Invalid blocks show warnings:**
|
|
173
|
+
- Unclosed markers are ignored
|
|
174
|
+
- Nested blocks are not supported
|
|
175
|
+
- Mismatched markers trigger console warnings
|
|
176
|
+
|
|
150
177
|
---
|
|
151
178
|
|
|
152
179
|
## CORE WORKFLOW
|