prjct-cli 0.13.3 → 0.15.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/CHANGELOG.md +122 -0
- package/bin/prjct +10 -13
- package/core/agentic/memory-system/semantic-memories.ts +2 -1
- package/core/agentic/plan-mode/plan-mode.ts +2 -1
- package/core/agentic/prompt-builder.ts +22 -43
- package/core/agentic/services.ts +5 -5
- package/core/agentic/smart-context.ts +7 -2
- package/core/command-registry/core-commands.ts +54 -29
- package/core/command-registry/optional-commands.ts +64 -0
- package/core/command-registry/setup-commands.ts +18 -3
- package/core/commands/analysis.ts +21 -68
- package/core/commands/analytics.ts +247 -213
- package/core/commands/base.ts +1 -1
- package/core/commands/index.ts +41 -36
- package/core/commands/maintenance.ts +300 -31
- package/core/commands/planning.ts +233 -22
- package/core/commands/setup.ts +3 -8
- package/core/commands/shipping.ts +14 -18
- package/core/commands/types.ts +8 -6
- package/core/commands/workflow.ts +105 -100
- package/core/context/generator.ts +317 -0
- package/core/context-sync.ts +7 -350
- package/core/data/index.ts +13 -32
- package/core/data/md-ideas-manager.ts +155 -0
- package/core/data/md-queue-manager.ts +4 -3
- package/core/data/md-shipped-manager.ts +90 -0
- package/core/data/md-state-manager.ts +11 -7
- package/core/domain/agent-generator.ts +23 -63
- package/core/events/index.ts +143 -0
- package/core/index.ts +17 -14
- package/core/infrastructure/capability-installer.ts +13 -149
- package/core/infrastructure/migrator/project-scanner.ts +2 -1
- package/core/infrastructure/path-manager.ts +4 -6
- package/core/infrastructure/setup.ts +3 -0
- package/core/infrastructure/uuid-migration.ts +750 -0
- package/core/outcomes/recorder.ts +2 -1
- package/core/plugin/loader.ts +4 -7
- package/core/plugin/registry.ts +3 -3
- package/core/schemas/index.ts +23 -25
- package/core/schemas/state.ts +1 -0
- package/core/serializers/ideas-serializer.ts +187 -0
- package/core/serializers/index.ts +16 -0
- package/core/serializers/shipped-serializer.ts +108 -0
- package/core/session/utils.ts +3 -9
- package/core/storage/ideas-storage.ts +273 -0
- package/core/storage/index.ts +204 -0
- package/core/storage/queue-storage.ts +297 -0
- package/core/storage/shipped-storage.ts +223 -0
- package/core/storage/state-storage.ts +235 -0
- package/core/storage/storage-manager.ts +175 -0
- package/package.json +1 -1
- package/packages/web/app/api/projects/[id]/momentum/route.ts +257 -0
- package/packages/web/app/api/sessions/current/route.ts +132 -0
- package/packages/web/app/api/sessions/history/route.ts +96 -14
- package/packages/web/app/globals.css +5 -0
- package/packages/web/app/layout.tsx +2 -0
- package/packages/web/app/project/[id]/code/layout.tsx +18 -0
- package/packages/web/app/project/[id]/code/page.tsx +408 -0
- package/packages/web/app/project/[id]/page.tsx +359 -389
- package/packages/web/app/project/[id]/reports/page.tsx +59 -0
- package/packages/web/app/project/[id]/reports/print/page.tsx +58 -0
- package/packages/web/components/ActivityTimeline/ActivityTimeline.tsx +0 -1
- package/packages/web/components/AgentsCard/AgentsCard.tsx +64 -34
- package/packages/web/components/AgentsCard/AgentsCard.types.ts +1 -0
- package/packages/web/components/AppSidebar/AppSidebar.tsx +135 -11
- package/packages/web/components/BentoCard/BentoCard.constants.ts +3 -3
- package/packages/web/components/BentoCard/BentoCard.tsx +2 -1
- package/packages/web/components/BentoGrid/BentoGrid.tsx +2 -2
- package/packages/web/components/BlockersCard/BlockersCard.tsx +65 -57
- package/packages/web/components/BlockersCard/BlockersCard.types.ts +1 -0
- package/packages/web/components/CommandBar/CommandBar.tsx +67 -0
- package/packages/web/components/CommandBar/index.ts +1 -0
- package/packages/web/components/DashboardContent/DashboardContent.tsx +35 -5
- package/packages/web/components/DateGroup/DateGroup.tsx +1 -1
- package/packages/web/components/EmptyState/EmptyState.tsx +39 -21
- package/packages/web/components/EmptyState/EmptyState.types.ts +1 -0
- package/packages/web/components/EventRow/EventRow.tsx +4 -4
- package/packages/web/components/EventRow/EventRow.utils.ts +3 -3
- package/packages/web/components/HeroSection/HeroSection.tsx +52 -15
- package/packages/web/components/HeroSection/HeroSection.types.ts +4 -4
- package/packages/web/components/HeroSection/HeroSection.utils.ts +7 -3
- package/packages/web/components/IdeasCard/IdeasCard.tsx +94 -27
- package/packages/web/components/IdeasCard/IdeasCard.types.ts +1 -0
- package/packages/web/components/MasonryGrid/MasonryGrid.tsx +18 -0
- package/packages/web/components/MasonryGrid/index.ts +1 -0
- package/packages/web/components/MomentumWidget/MomentumWidget.tsx +119 -0
- package/packages/web/components/MomentumWidget/MomentumWidget.types.ts +16 -0
- package/packages/web/components/MomentumWidget/index.ts +2 -0
- package/packages/web/components/NowCard/NowCard.tsx +81 -56
- package/packages/web/components/NowCard/NowCard.types.ts +1 -0
- package/packages/web/components/PageHeader/PageHeader.tsx +24 -0
- package/packages/web/components/PageHeader/index.ts +1 -0
- package/packages/web/components/ProgressRing/ProgressRing.constants.ts +2 -2
- package/packages/web/components/ProjectAvatar/ProjectAvatar.tsx +2 -2
- package/packages/web/components/ProjectColorDot/ProjectColorDot.tsx +37 -0
- package/packages/web/components/ProjectColorDot/index.ts +1 -0
- package/packages/web/components/ProjectSelectorModal/ProjectSelectorModal.tsx +104 -0
- package/packages/web/components/ProjectSelectorModal/index.ts +1 -0
- package/packages/web/components/Providers/Providers.tsx +4 -1
- package/packages/web/components/QueueCard/QueueCard.tsx +78 -25
- package/packages/web/components/QueueCard/QueueCard.types.ts +1 -0
- package/packages/web/components/QueueCard/QueueCard.utils.ts +3 -3
- package/packages/web/components/RecoverCard/RecoverCard.tsx +72 -0
- package/packages/web/components/RecoverCard/RecoverCard.types.ts +16 -0
- package/packages/web/components/RecoverCard/index.ts +2 -0
- package/packages/web/components/RoadmapCard/RoadmapCard.tsx +101 -33
- package/packages/web/components/RoadmapCard/RoadmapCard.types.ts +1 -0
- package/packages/web/components/ShipsCard/ShipsCard.tsx +71 -28
- package/packages/web/components/ShipsCard/ShipsCard.types.ts +2 -0
- package/packages/web/components/SparklineChart/SparklineChart.tsx +20 -18
- package/packages/web/components/StatsMasonry/StatsMasonry.tsx +95 -0
- package/packages/web/components/StatsMasonry/index.ts +1 -0
- package/packages/web/components/StreakCard/StreakCard.tsx +37 -35
- package/packages/web/components/TasksCounter/TasksCounter.tsx +1 -1
- package/packages/web/components/TechStackBadges/TechStackBadges.tsx +12 -4
- package/packages/web/components/TerminalDock/DockToggleTab.tsx +29 -0
- package/packages/web/components/TerminalDock/TerminalDock.tsx +386 -0
- package/packages/web/components/TerminalDock/TerminalDockTab.tsx +130 -0
- package/packages/web/components/TerminalDock/TerminalTabBar.tsx +142 -0
- package/packages/web/components/TerminalDock/index.ts +2 -0
- package/packages/web/components/VelocityBadge/VelocityBadge.tsx +8 -3
- package/packages/web/components/VelocityCard/VelocityCard.tsx +49 -47
- package/packages/web/components/WeeklyReports/PrintableReport.tsx +259 -0
- package/packages/web/components/WeeklyReports/ReportPreviewCard.tsx +187 -0
- package/packages/web/components/WeeklyReports/WeekCalendar.tsx +288 -0
- package/packages/web/components/WeeklyReports/WeeklyReports.tsx +149 -0
- package/packages/web/components/WeeklyReports/index.ts +4 -0
- package/packages/web/components/WeeklySparkline/WeeklySparkline.tsx +16 -4
- package/packages/web/components/WeeklySparkline/WeeklySparkline.types.ts +1 -0
- package/packages/web/components/charts/SessionsChart.tsx +6 -3
- package/packages/web/components/ui/dialog.tsx +143 -0
- package/packages/web/components/ui/drawer.tsx +135 -0
- package/packages/web/components/ui/select.tsx +187 -0
- package/packages/web/context/GlobalTerminalContext.tsx +538 -0
- package/packages/web/lib/commands.ts +81 -0
- package/packages/web/lib/generate-week-report.ts +285 -0
- package/packages/web/lib/parse-prjct-files.ts +56 -55
- package/packages/web/lib/project-colors.ts +58 -0
- package/packages/web/lib/projects.ts +58 -5
- package/packages/web/lib/services/projects.server.ts +11 -1
- package/packages/web/next-env.d.ts +1 -1
- package/packages/web/package.json +5 -1
- package/templates/commands/analyze.md +39 -3
- package/templates/commands/ask.md +58 -3
- package/templates/commands/bug.md +117 -26
- package/templates/commands/dash.md +95 -158
- package/templates/commands/done.md +130 -148
- package/templates/commands/feature.md +125 -103
- package/templates/commands/git.md +18 -3
- package/templates/commands/idea.md +121 -38
- package/templates/commands/init.md +124 -20
- package/templates/commands/migrate-all.md +63 -28
- package/templates/commands/migrate.md +140 -0
- package/templates/commands/next.md +115 -5
- package/templates/commands/now.md +146 -82
- package/templates/commands/pause.md +89 -74
- package/templates/commands/redo.md +6 -4
- package/templates/commands/resume.md +141 -59
- package/templates/commands/setup.md +18 -3
- package/templates/commands/ship.md +103 -231
- package/templates/commands/spec.md +98 -8
- package/templates/commands/suggest.md +22 -2
- package/templates/commands/sync.md +192 -203
- package/templates/commands/undo.md +6 -4
- package/templates/mcp-config.json +20 -1
- package/core/data/agents-manager.ts +0 -76
- package/core/data/analysis-manager.ts +0 -83
- package/core/data/base-manager.ts +0 -156
- package/core/data/ideas-manager.ts +0 -81
- package/core/data/outcomes-manager.ts +0 -96
- package/core/data/project-manager.ts +0 -75
- package/core/data/roadmap-manager.ts +0 -118
- package/core/data/shipped-manager.ts +0 -65
- package/core/data/state-manager.ts +0 -214
- package/core/state/index.ts +0 -25
- package/core/state/manager.ts +0 -376
- package/core/state/types.ts +0 -185
- package/core/utils/project-capabilities.ts +0 -156
- package/core/view-generator.ts +0 -536
- package/packages/web/app/project/[id]/stats/loading.tsx +0 -43
- package/packages/web/app/project/[id]/stats/page.tsx +0 -253
- package/templates/agent-assignment.md +0 -72
- package/templates/analysis/project-analysis.md +0 -78
- package/templates/checklists/accessibility.md +0 -33
- package/templates/commands/build.md +0 -17
- package/templates/commands/decision.md +0 -226
- package/templates/commands/fix.md +0 -79
- package/templates/commands/help.md +0 -61
- package/templates/commands/progress.md +0 -14
- package/templates/commands/recap.md +0 -14
- package/templates/commands/roadmap.md +0 -52
- package/templates/commands/status.md +0 -17
- package/templates/commands/task.md +0 -63
- package/templates/commands/work.md +0 -44
- package/templates/commands/workflow.md +0 -12
|
@@ -2,25 +2,33 @@
|
|
|
2
2
|
allowed-tools: [Read, Write, Bash]
|
|
3
3
|
description: 'Complete current task with session metrics'
|
|
4
4
|
timestamp-rule: 'GetTimestamp() for all timestamps'
|
|
5
|
-
architecture: '
|
|
5
|
+
architecture: 'Write-Through (JSON → MD → Events)'
|
|
6
|
+
storage-layer: true
|
|
7
|
+
source-of-truth: 'storage/state.json'
|
|
8
|
+
claude-context: 'context/now.md'
|
|
9
|
+
backend-sync: 'sync/pending.json'
|
|
6
10
|
---
|
|
7
11
|
|
|
8
12
|
# /p:done - Complete Current Task with Session Metrics
|
|
9
13
|
|
|
10
|
-
## Architecture:
|
|
14
|
+
## Architecture: Write-Through Pattern
|
|
11
15
|
|
|
12
|
-
|
|
16
|
+
```
|
|
17
|
+
User Action → Storage (JSON) → Context (MD) → Sync Events
|
|
18
|
+
```
|
|
13
19
|
|
|
14
|
-
|
|
20
|
+
**Source of Truth**: `storage/state.json`
|
|
21
|
+
**Claude Context**: `context/now.md` (generated)
|
|
22
|
+
**Backend Sync**: `sync/pending.json` (events)
|
|
15
23
|
|
|
16
24
|
## Context Variables
|
|
17
25
|
- `{projectId}`: From `.prjct/prjct.config.json`
|
|
18
26
|
- `{globalPath}`: `~/.prjct-cli/projects/{projectId}`
|
|
19
|
-
- `{
|
|
20
|
-
- `{
|
|
21
|
-
- `{
|
|
22
|
-
- `{
|
|
23
|
-
- `{
|
|
27
|
+
- `{statePath}`: `{globalPath}/storage/state.json`
|
|
28
|
+
- `{nowContextPath}`: `{globalPath}/context/now.md`
|
|
29
|
+
- `{syncPath}`: `{globalPath}/sync/pending.json`
|
|
30
|
+
- `{memoryPath}`: `{globalPath}/memory/events.jsonl`
|
|
31
|
+
- `{sessionsPath}`: `{globalPath}/progress/sessions`
|
|
24
32
|
|
|
25
33
|
## Accuracy Calculation
|
|
26
34
|
|
|
@@ -43,47 +51,33 @@ IF file not found:
|
|
|
43
51
|
OUTPUT: "No prjct project. Run /p:init first."
|
|
44
52
|
STOP
|
|
45
53
|
|
|
46
|
-
## Step 2: Check
|
|
54
|
+
## Step 2: Check Current State
|
|
47
55
|
|
|
48
|
-
### Read
|
|
49
|
-
READ: `{
|
|
56
|
+
### Read state.json (source of truth)
|
|
57
|
+
READ: `{statePath}`
|
|
50
58
|
|
|
51
|
-
IF file
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
- Look for `Started: {timestamp}`
|
|
55
|
-
- Look for `Session: {sessionId}`
|
|
56
|
-
- Look for `Estimate: {estimate}` (optional)
|
|
57
|
-
EXTRACT: {task}, {startedAt}, {sessionId}, {estimate}
|
|
58
|
-
GOTO Step 3 (Session Completion)
|
|
59
|
-
|
|
60
|
-
### Try structured session (for detailed metrics)
|
|
61
|
-
READ: `{sessionPath}`
|
|
59
|
+
IF file not found OR no currentTask:
|
|
60
|
+
OUTPUT: "⚠️ No active task to complete. Use /p:now to start one."
|
|
61
|
+
STOP
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
EXTRACT: {session} object
|
|
66
|
-
ELSE:
|
|
67
|
-
CREATE session from now.md data
|
|
63
|
+
PARSE JSON
|
|
64
|
+
EXTRACT: {currentTask}
|
|
68
65
|
|
|
69
|
-
IF
|
|
66
|
+
IF {currentTask.status} != "active":
|
|
70
67
|
OUTPUT: "⚠️ No active task to complete. Use /p:now to start one."
|
|
71
68
|
STOP
|
|
72
69
|
|
|
73
|
-
## Step 3:
|
|
70
|
+
## Step 3: Calculate Metrics
|
|
74
71
|
|
|
75
|
-
### Calculate Final Duration
|
|
76
72
|
SET: {now} = GetTimestamp()
|
|
73
|
+
SET: {startedAt} = {currentTask.startedAt}
|
|
77
74
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
Calculate total active time
|
|
81
|
-
|
|
82
|
-
SET: {duration} = total active seconds
|
|
75
|
+
### Calculate Duration
|
|
76
|
+
SET: {durationSeconds} = seconds between {startedAt} and {now}
|
|
83
77
|
SET: {durationFormatted} = format as "Xh Ym" or "Xm"
|
|
84
78
|
|
|
85
79
|
### Calculate Git Metrics
|
|
86
|
-
BASH: `git rev-list --count --since="{
|
|
80
|
+
BASH: `git rev-list --count --since="{startedAt}" HEAD 2>/dev/null || echo "0"`
|
|
87
81
|
CAPTURE as {commits}
|
|
88
82
|
|
|
89
83
|
BASH: `git diff --stat HEAD~{commits} 2>/dev/null || git diff --stat`
|
|
@@ -93,59 +87,49 @@ PARSE output for:
|
|
|
93
87
|
- {linesRemoved}: deletions
|
|
94
88
|
|
|
95
89
|
### Calculate Accuracy (if estimate exists)
|
|
96
|
-
IF {
|
|
97
|
-
{accuracy} = 100 - Math.abs(((
|
|
90
|
+
IF {currentTask.estimateSeconds} exists AND > 0:
|
|
91
|
+
{accuracy} = 100 - Math.abs(((durationSeconds - estimateSeconds) / estimateSeconds) * 100)
|
|
98
92
|
{accuracy} = Math.max(0, Math.min(100, {accuracy})) // Cap between 0-100
|
|
99
93
|
{accuracyLabel} = accuracy >= 80 ? "✅" : accuracy >= 50 ? "⚠️" : "❌"
|
|
100
94
|
ELSE:
|
|
101
95
|
{accuracy} = null
|
|
102
96
|
{accuracyLabel} = null
|
|
103
97
|
|
|
104
|
-
|
|
98
|
+
## Step 4: Update Storage (SOURCE OF TRUTH)
|
|
99
|
+
|
|
100
|
+
### Prepare completed task
|
|
105
101
|
```json
|
|
106
102
|
{
|
|
107
|
-
"id": "{
|
|
108
|
-
"
|
|
109
|
-
"task": "{session.task}",
|
|
103
|
+
"id": "{currentTask.id}",
|
|
104
|
+
"description": "{currentTask.description}",
|
|
110
105
|
"status": "completed",
|
|
111
|
-
"startedAt": "{
|
|
112
|
-
"pausedAt": null,
|
|
106
|
+
"startedAt": "{currentTask.startedAt}",
|
|
113
107
|
"completedAt": "{now}",
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
108
|
+
"sessionId": "{currentTask.sessionId}",
|
|
109
|
+
"duration": {durationSeconds},
|
|
110
|
+
"estimate": "{currentTask.estimate}",
|
|
111
|
+
"estimateSeconds": {currentTask.estimateSeconds},
|
|
117
112
|
"accuracy": {accuracy},
|
|
118
113
|
"metrics": {
|
|
119
114
|
"filesChanged": {filesChanged},
|
|
120
115
|
"linesAdded": {linesAdded},
|
|
121
116
|
"linesRemoved": {linesRemoved},
|
|
122
|
-
"commits": {commits}
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
"timeline": [
|
|
126
|
-
...{session.timeline},
|
|
127
|
-
{"type": "complete", "at": "{now}"}
|
|
128
|
-
]
|
|
117
|
+
"commits": {commits}
|
|
118
|
+
}
|
|
129
119
|
}
|
|
130
120
|
```
|
|
131
121
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
BASH: `mkdir -p {archiveDir}/{yearMonth}`
|
|
139
|
-
|
|
140
|
-
### Write Archived Session
|
|
141
|
-
WRITE: `{archiveDir}/{yearMonth}/{session.id}.json`
|
|
142
|
-
Content: Updated session object from Step 3
|
|
143
|
-
|
|
144
|
-
## Step 5: Clear Current State (MD)
|
|
122
|
+
### Update state.json
|
|
123
|
+
READ: `{statePath}`
|
|
124
|
+
SET: state.previousTask = completed task object
|
|
125
|
+
SET: state.currentTask = null
|
|
126
|
+
SET: state.lastUpdated = {now}
|
|
127
|
+
WRITE: `{statePath}`
|
|
145
128
|
|
|
146
|
-
|
|
129
|
+
## Step 5: Generate Context (FOR CLAUDE)
|
|
147
130
|
|
|
148
|
-
|
|
131
|
+
### Clear now.md
|
|
132
|
+
WRITE: `{nowContextPath}`
|
|
149
133
|
|
|
150
134
|
```markdown
|
|
151
135
|
# NOW
|
|
@@ -155,19 +139,50 @@ _No active task_
|
|
|
155
139
|
Use `/p:now <task>` to start working.
|
|
156
140
|
```
|
|
157
141
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
142
|
+
## Step 6: Queue Sync Event (FOR BACKEND)
|
|
143
|
+
|
|
144
|
+
READ: `{syncPath}` or create empty array
|
|
145
|
+
APPEND event:
|
|
161
146
|
```json
|
|
162
|
-
{
|
|
147
|
+
{
|
|
148
|
+
"type": "task.completed",
|
|
149
|
+
"path": ["state"],
|
|
150
|
+
"data": {
|
|
151
|
+
"taskId": "{currentTask.id}",
|
|
152
|
+
"description": "{currentTask.description}",
|
|
153
|
+
"startedAt": "{currentTask.startedAt}",
|
|
154
|
+
"completedAt": "{now}",
|
|
155
|
+
"duration": {durationSeconds},
|
|
156
|
+
"accuracy": {accuracy},
|
|
157
|
+
"metrics": {
|
|
158
|
+
"filesChanged": {filesChanged},
|
|
159
|
+
"linesAdded": {linesAdded},
|
|
160
|
+
"linesRemoved": {linesRemoved},
|
|
161
|
+
"commits": {commits}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"timestamp": "{now}",
|
|
165
|
+
"projectId": "{projectId}"
|
|
166
|
+
}
|
|
163
167
|
```
|
|
168
|
+
WRITE: `{syncPath}`
|
|
169
|
+
|
|
170
|
+
## Step 7: Log to Daily Session (for Dashboard Charts)
|
|
171
|
+
|
|
172
|
+
GET: {date} = YYYY-MM-DD from {now}
|
|
173
|
+
GET: {yearMonth} = YYYY-MM from {now}
|
|
174
|
+
SET: {dailySessionPath} = `{sessionsPath}/{yearMonth}/{date}.jsonl`
|
|
164
175
|
|
|
165
|
-
|
|
176
|
+
BASH: `mkdir -p {sessionsPath}/{yearMonth}`
|
|
166
177
|
|
|
167
|
-
|
|
168
|
-
No separate metrics.json needed - all data is in MD files and JSONL logs.
|
|
178
|
+
APPEND to: `{dailySessionPath}`
|
|
169
179
|
|
|
170
|
-
|
|
180
|
+
Single line (JSONL format):
|
|
181
|
+
```json
|
|
182
|
+
{"ts":"{now}","type":"task_complete","task":"{currentTask.description}","duration":"{durationFormatted}","sessionId":"{currentTask.sessionId}"}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Step 8: Log to Memory (AUDIT TRAIL)
|
|
171
186
|
|
|
172
187
|
APPEND to: `{memoryPath}`
|
|
173
188
|
|
|
@@ -175,23 +190,23 @@ Single line (JSONL format):
|
|
|
175
190
|
|
|
176
191
|
IF {accuracy} exists:
|
|
177
192
|
```json
|
|
178
|
-
{"timestamp":"{now}","action":"
|
|
193
|
+
{"timestamp":"{now}","action":"task_completed","taskId":"{currentTask.id}","sessionId":"{currentTask.sessionId}","task":"{currentTask.description}","duration":{durationSeconds},"estimate":{estimateSeconds},"accuracy":{accuracy},"metrics":{"files":{filesChanged},"added":{linesAdded},"removed":{linesRemoved},"commits":{commits}}}
|
|
179
194
|
```
|
|
180
195
|
|
|
181
196
|
ELSE:
|
|
182
197
|
```json
|
|
183
|
-
{"timestamp":"{now}","action":"
|
|
198
|
+
{"timestamp":"{now}","action":"task_completed","taskId":"{currentTask.id}","sessionId":"{currentTask.sessionId}","task":"{currentTask.description}","duration":{durationSeconds},"metrics":{"files":{filesChanged},"added":{linesAdded},"removed":{linesRemoved},"commits":{commits}}}
|
|
184
199
|
```
|
|
185
200
|
|
|
186
201
|
## Output
|
|
187
202
|
|
|
188
203
|
SUCCESS (with estimate):
|
|
189
204
|
```
|
|
190
|
-
✅ {
|
|
205
|
+
✅ {currentTask.description} ({durationFormatted})
|
|
191
206
|
|
|
192
207
|
Estimate: {estimate} | Actual: {durationFormatted} | {accuracyLabel} Accuracy: {accuracy}%
|
|
193
208
|
|
|
194
|
-
Session: {
|
|
209
|
+
Session: {currentTask.sessionId}
|
|
195
210
|
Files: {filesChanged} | +{linesAdded}/-{linesRemoved}
|
|
196
211
|
Commits: {commits}
|
|
197
212
|
|
|
@@ -203,9 +218,9 @@ Next:
|
|
|
203
218
|
|
|
204
219
|
SUCCESS (without estimate):
|
|
205
220
|
```
|
|
206
|
-
✅ {
|
|
221
|
+
✅ {currentTask.description} ({durationFormatted})
|
|
207
222
|
|
|
208
|
-
Session: {
|
|
223
|
+
Session: {currentTask.sessionId}
|
|
209
224
|
Files: {filesChanged} | +{linesAdded}/-{linesRemoved}
|
|
210
225
|
Commits: {commits}
|
|
211
226
|
|
|
@@ -220,26 +235,40 @@ Next:
|
|
|
220
235
|
| Error | Response | Action |
|
|
221
236
|
|-------|----------|--------|
|
|
222
237
|
| Config not found | "No prjct project" | STOP |
|
|
223
|
-
| No
|
|
238
|
+
| No current task | "No active task" | STOP |
|
|
224
239
|
| Git fails | Use zeros for metrics | CONTINUE |
|
|
225
|
-
| Archive fails | Log warning | CONTINUE |
|
|
226
240
|
| Write fails | Log warning | CONTINUE |
|
|
227
241
|
|
|
242
|
+
## File Structure Reference
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
~/.prjct-cli/projects/{projectId}/
|
|
246
|
+
├── storage/
|
|
247
|
+
│ └── state.json # Source of truth
|
|
248
|
+
├── context/
|
|
249
|
+
│ └── now.md # Generated (cleared on done)
|
|
250
|
+
├── sync/
|
|
251
|
+
│ └── pending.json # Events for backend
|
|
252
|
+
├── progress/
|
|
253
|
+
│ └── sessions/{YYYY-MM}/ # Daily session logs
|
|
254
|
+
└── memory/
|
|
255
|
+
└── events.jsonl # Audit trail
|
|
256
|
+
```
|
|
257
|
+
|
|
228
258
|
## Examples
|
|
229
259
|
|
|
230
260
|
### Example 1: Full Session Completion (with estimate)
|
|
231
|
-
**
|
|
261
|
+
**State:**
|
|
232
262
|
```json
|
|
233
263
|
{
|
|
234
|
-
"
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
]
|
|
264
|
+
"currentTask": {
|
|
265
|
+
"id": "550e8400-e29b-41d4-a716-446655440000",
|
|
266
|
+
"description": "implement authentication",
|
|
267
|
+
"status": "active",
|
|
268
|
+
"startedAt": "2025-12-07T10:00:00.000Z",
|
|
269
|
+
"estimate": "2h",
|
|
270
|
+
"estimateSeconds": 7200
|
|
271
|
+
}
|
|
243
272
|
}
|
|
244
273
|
```
|
|
245
274
|
|
|
@@ -256,7 +285,7 @@ Next:
|
|
|
256
285
|
|
|
257
286
|
Estimate: 2h | Actual: 2h 15m | ✅ Accuracy: 88%
|
|
258
287
|
|
|
259
|
-
Session:
|
|
288
|
+
Session: 550e8400-e29b-41d4-a716-446655440000
|
|
260
289
|
Files: 5 | +120/-30
|
|
261
290
|
Commits: 3
|
|
262
291
|
|
|
@@ -266,12 +295,12 @@ Next:
|
|
|
266
295
|
• /p:progress - View metrics
|
|
267
296
|
```
|
|
268
297
|
|
|
269
|
-
### Example
|
|
298
|
+
### Example 2: Session Completion (without estimate)
|
|
270
299
|
**Output:**
|
|
271
300
|
```
|
|
272
301
|
✅ implement authentication (2h 15m)
|
|
273
302
|
|
|
274
|
-
Session:
|
|
303
|
+
Session: 550e8400-e29b-41d4-a716-446655440000
|
|
275
304
|
Files: 5 | +120/-30
|
|
276
305
|
Commits: 3
|
|
277
306
|
|
|
@@ -281,55 +310,8 @@ Next:
|
|
|
281
310
|
• /p:progress - View metrics
|
|
282
311
|
```
|
|
283
312
|
|
|
284
|
-
### Example
|
|
285
|
-
**Session with multiple pause/resume:**
|
|
286
|
-
```json
|
|
287
|
-
{
|
|
288
|
-
"id": "sess_xyz98765",
|
|
289
|
-
"task": "fix login bug",
|
|
290
|
-
"timeline": [
|
|
291
|
-
{"type": "start", "at": "2025-12-07T09:00:00.000Z"},
|
|
292
|
-
{"type": "pause", "at": "2025-12-07T10:00:00.000Z"},
|
|
293
|
-
{"type": "resume", "at": "2025-12-07T14:00:00.000Z"},
|
|
294
|
-
{"type": "pause", "at": "2025-12-07T15:30:00.000Z"},
|
|
295
|
-
{"type": "resume", "at": "2025-12-07T16:00:00.000Z"}
|
|
296
|
-
]
|
|
297
|
-
}
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
**Completion at 17:00:**
|
|
301
|
-
- Active time: 1h + 1.5h + 1h = 3.5h
|
|
302
|
-
- Duration: 3h 30m
|
|
303
|
-
|
|
313
|
+
### Example 3: No Active Task
|
|
304
314
|
**Output:**
|
|
305
315
|
```
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
Session: sess_xyz98765
|
|
309
|
-
Files: 2 | +45/-12
|
|
310
|
-
Commits: 1
|
|
311
|
-
|
|
312
|
-
Next:
|
|
313
|
-
• /p:now - Start next task
|
|
314
|
-
• /p:ship - Ship completed work
|
|
315
|
-
• /p:progress - View metrics
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
### Example 3: Legacy Fallback (No Session)
|
|
319
|
-
**now.md content:**
|
|
320
|
-
```
|
|
321
|
-
# NOW
|
|
322
|
-
|
|
323
|
-
**quick fix**
|
|
324
|
-
|
|
325
|
-
Started: 2025-12-07T16:45:00.000Z
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
**Output:**
|
|
329
|
-
```
|
|
330
|
-
✅ quick fix (15m)
|
|
331
|
-
|
|
332
|
-
Next:
|
|
333
|
-
• /p:now - Start next task
|
|
334
|
-
• /p:ship - Ship completed work
|
|
316
|
+
⚠️ No active task to complete. Use /p:now to start one.
|
|
335
317
|
```
|