prjct-cli 0.44.1 → 0.45.3
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 +114 -0
- package/bin/prjct.ts +131 -10
- package/core/__tests__/agentic/memory-system.test.ts +39 -26
- package/core/__tests__/agentic/plan-mode.test.ts +64 -46
- package/core/__tests__/agentic/prompt-builder.test.ts +14 -14
- package/core/__tests__/services/project-index.test.ts +353 -0
- package/core/__tests__/types/fs.test.ts +3 -3
- package/core/__tests__/utils/date-helper.test.ts +10 -10
- package/core/__tests__/utils/output.test.ts +9 -6
- package/core/__tests__/utils/project-commands.test.ts +5 -6
- package/core/agentic/agent-router.ts +9 -10
- package/core/agentic/chain-of-thought.ts +16 -4
- package/core/agentic/command-executor.ts +66 -40
- package/core/agentic/context-builder.ts +8 -5
- package/core/agentic/ground-truth.ts +15 -9
- package/core/agentic/index.ts +145 -152
- package/core/agentic/loop-detector.ts +40 -11
- package/core/agentic/memory-system.ts +98 -35
- package/core/agentic/orchestrator-executor.ts +135 -71
- package/core/agentic/plan-mode.ts +46 -16
- package/core/agentic/prompt-builder.ts +108 -42
- package/core/agentic/services.ts +10 -9
- package/core/agentic/skill-loader.ts +9 -15
- package/core/agentic/smart-context.ts +129 -79
- package/core/agentic/template-executor.ts +13 -12
- package/core/agentic/template-loader.ts +7 -4
- package/core/agentic/tool-registry.ts +16 -13
- package/core/agents/index.ts +1 -1
- package/core/agents/performance.ts +10 -27
- package/core/ai-tools/formatters.ts +8 -6
- package/core/ai-tools/generator.ts +4 -4
- package/core/ai-tools/index.ts +1 -1
- package/core/ai-tools/registry.ts +21 -11
- package/core/bus/bus.ts +23 -16
- package/core/bus/index.ts +2 -2
- package/core/cli/linear.ts +3 -5
- package/core/cli/start.ts +28 -25
- package/core/commands/analysis.ts +287 -29
- package/core/commands/analytics.ts +52 -44
- package/core/commands/base.ts +15 -13
- package/core/commands/cleanup.ts +6 -13
- package/core/commands/command-data.ts +49 -8
- package/core/commands/commands.ts +60 -23
- package/core/commands/context.ts +4 -4
- package/core/commands/design.ts +3 -10
- package/core/commands/index.ts +5 -8
- package/core/commands/maintenance.ts +7 -4
- package/core/commands/planning.ts +179 -56
- package/core/commands/register.ts +14 -9
- package/core/commands/registry.ts +15 -14
- package/core/commands/setup.ts +26 -14
- package/core/commands/shipping.ts +11 -16
- package/core/commands/snapshots.ts +16 -32
- package/core/commands/uninstall.ts +541 -0
- package/core/commands/workflow.ts +24 -28
- package/core/constants/index.ts +10 -22
- package/core/context/generator.ts +82 -33
- package/core/context-tools/files-tool.ts +583 -0
- package/core/context-tools/imports-tool.ts +403 -0
- package/core/context-tools/index.ts +433 -0
- package/core/context-tools/recent-tool.ts +307 -0
- package/core/context-tools/signatures-tool.ts +501 -0
- package/core/context-tools/summary-tool.ts +307 -0
- package/core/context-tools/token-counter.ts +284 -0
- package/core/context-tools/types.ts +253 -0
- package/core/domain/agent-generator.ts +7 -5
- package/core/domain/agent-loader.ts +2 -2
- package/core/domain/analyzer.ts +19 -16
- package/core/domain/architecture-generator.ts +6 -3
- package/core/domain/context-estimator.ts +3 -4
- package/core/domain/snapshot-manager.ts +25 -22
- package/core/domain/task-stack.ts +24 -14
- package/core/errors.ts +1 -1
- package/core/events/events.ts +2 -4
- package/core/events/index.ts +1 -2
- package/core/index.ts +28 -12
- package/core/infrastructure/agent-detector.ts +3 -3
- package/core/infrastructure/ai-provider.ts +23 -20
- package/core/infrastructure/author-detector.ts +16 -10
- package/core/infrastructure/capability-installer.ts +2 -2
- package/core/infrastructure/claude-agent.ts +6 -6
- package/core/infrastructure/command-installer.ts +22 -17
- package/core/infrastructure/config-manager.ts +18 -14
- package/core/infrastructure/editors-config.ts +8 -4
- package/core/infrastructure/path-manager.ts +8 -6
- package/core/infrastructure/permission-manager.ts +20 -17
- package/core/infrastructure/setup.ts +42 -38
- package/core/infrastructure/update-checker.ts +5 -5
- package/core/integrations/issue-tracker/enricher.ts +8 -19
- package/core/integrations/issue-tracker/index.ts +2 -2
- package/core/integrations/issue-tracker/manager.ts +15 -15
- package/core/integrations/issue-tracker/types.ts +5 -22
- package/core/integrations/jira/client.ts +67 -59
- package/core/integrations/jira/index.ts +11 -14
- package/core/integrations/jira/mcp-adapter.ts +5 -10
- package/core/integrations/jira/service.ts +10 -10
- package/core/integrations/linear/client.ts +27 -18
- package/core/integrations/linear/index.ts +9 -12
- package/core/integrations/linear/service.ts +11 -11
- package/core/integrations/linear/sync.ts +8 -8
- package/core/outcomes/analyzer.ts +5 -18
- package/core/outcomes/index.ts +2 -2
- package/core/outcomes/recorder.ts +3 -3
- package/core/plugin/builtin/webhook.ts +19 -15
- package/core/plugin/hooks.ts +29 -21
- package/core/plugin/index.ts +7 -7
- package/core/plugin/loader.ts +19 -19
- package/core/plugin/registry.ts +12 -23
- package/core/schemas/agents.ts +1 -1
- package/core/schemas/analysis.ts +1 -1
- package/core/schemas/enriched-task.ts +62 -49
- package/core/schemas/ideas.ts +13 -13
- package/core/schemas/index.ts +17 -27
- package/core/schemas/issues.ts +40 -25
- package/core/schemas/metrics.ts +143 -0
- package/core/schemas/outcomes.ts +70 -62
- package/core/schemas/permissions.ts +15 -12
- package/core/schemas/prd.ts +27 -14
- package/core/schemas/project.ts +3 -3
- package/core/schemas/roadmap.ts +47 -34
- package/core/schemas/schemas.ts +3 -4
- package/core/schemas/shipped.ts +3 -3
- package/core/schemas/state.ts +43 -29
- package/core/server/index.ts +5 -6
- package/core/server/routes-extended.ts +68 -72
- package/core/server/routes.ts +3 -3
- package/core/server/server.ts +31 -26
- package/core/services/agent-generator.ts +237 -0
- package/core/services/agent-service.ts +2 -2
- package/core/services/breakdown-service.ts +2 -4
- package/core/services/context-generator.ts +299 -0
- package/core/services/context-selector.ts +420 -0
- package/core/services/doctor-service.ts +426 -0
- package/core/services/file-categorizer.ts +448 -0
- package/core/services/file-scorer.ts +270 -0
- package/core/services/git-analyzer.ts +267 -0
- package/core/services/index.ts +27 -10
- package/core/services/memory-service.ts +3 -4
- package/core/services/project-index.ts +911 -0
- package/core/services/project-service.ts +4 -4
- package/core/services/skill-installer.ts +14 -17
- package/core/services/skill-lock.ts +3 -3
- package/core/services/skill-service.ts +12 -6
- package/core/services/stack-detector.ts +245 -0
- package/core/services/sync-service.ts +170 -329
- package/core/services/watch-service.ts +294 -0
- package/core/session/compaction.ts +23 -31
- package/core/session/index.ts +11 -5
- package/core/session/log-migration.ts +3 -3
- package/core/session/metrics.ts +19 -14
- package/core/session/session-log-manager.ts +12 -17
- package/core/session/task-session-manager.ts +25 -25
- package/core/session/utils.ts +1 -1
- package/core/storage/ideas-storage.ts +41 -57
- package/core/storage/index-storage.ts +514 -0
- package/core/storage/index.ts +41 -13
- package/core/storage/metrics-storage.ts +320 -0
- package/core/storage/queue-storage.ts +35 -45
- package/core/storage/shipped-storage.ts +17 -20
- package/core/storage/state-storage.ts +50 -30
- package/core/storage/storage-manager.ts +6 -6
- package/core/storage/storage.ts +18 -15
- package/core/sync/auth-config.ts +3 -3
- package/core/sync/index.ts +13 -19
- package/core/sync/oauth-handler.ts +3 -3
- package/core/sync/sync-client.ts +4 -9
- package/core/sync/sync-manager.ts +12 -14
- package/core/types/commands.ts +42 -7
- package/core/types/index.ts +284 -302
- package/core/types/integrations.ts +3 -3
- package/core/types/storage.ts +49 -0
- package/core/types/utils.ts +3 -3
- package/core/utils/agent-stream.ts +3 -1
- package/core/utils/animations.ts +14 -11
- package/core/utils/branding.ts +7 -7
- package/core/utils/cache.ts +1 -3
- package/core/utils/collection-filters.ts +3 -15
- package/core/utils/date-helper.ts +2 -7
- package/core/utils/file-helper.ts +13 -8
- package/core/utils/jsonl-helper.ts +13 -10
- package/core/utils/keychain.ts +4 -8
- package/core/utils/logger.ts +1 -1
- package/core/utils/next-steps.ts +3 -3
- package/core/utils/output.ts +58 -11
- package/core/utils/project-commands.ts +6 -6
- package/core/utils/project-credentials.ts +5 -12
- package/core/utils/runtime.ts +2 -2
- package/core/utils/session-helper.ts +3 -4
- package/core/utils/version.ts +3 -3
- package/core/wizard/index.ts +13 -0
- package/core/wizard/onboarding.ts +633 -0
- package/core/workflow/state-machine.ts +7 -7
- package/dist/bin/prjct.mjs +18907 -13189
- package/dist/core/infrastructure/command-installer.js +96 -111
- package/dist/core/infrastructure/editors-config.js +6 -6
- package/dist/core/infrastructure/setup.js +256 -257
- package/dist/core/utils/version.js +9 -9
- package/package.json +11 -12
- package/scripts/build.js +3 -3
- package/scripts/postinstall.js +2 -2
- package/templates/mcp-config.json +6 -1
- package/templates/permissions/permissive.jsonc +1 -1
- package/templates/permissions/strict.jsonc +5 -9
- package/templates/global/docs/agents.md +0 -88
- package/templates/global/docs/architecture.md +0 -103
- package/templates/global/docs/commands.md +0 -96
- package/templates/global/docs/validation.md +0 -95
package/core/schemas/roadmap.ts
CHANGED
|
@@ -23,20 +23,25 @@ import { z } from 'zod'
|
|
|
23
23
|
|
|
24
24
|
export const FeatureStatusSchema = z.enum(['planned', 'active', 'completed', 'shipped'])
|
|
25
25
|
export const FeatureImpactSchema = z.enum(['low', 'medium', 'high'])
|
|
26
|
-
export const FeatureTypeSchema = z.enum([
|
|
26
|
+
export const FeatureTypeSchema = z.enum([
|
|
27
|
+
'feature',
|
|
28
|
+
'breaking_change',
|
|
29
|
+
'refactor',
|
|
30
|
+
'infrastructure',
|
|
31
|
+
])
|
|
27
32
|
export const PhaseStatusSchema = z.enum(['completed', 'active', 'planned'])
|
|
28
33
|
export const QuarterStatusSchema = z.enum(['planned', 'active', 'completed'])
|
|
29
34
|
export const InferredFromSchema = z.enum(['git', 'git-branch', 'manual', 'prd'])
|
|
30
35
|
|
|
31
36
|
export const FeatureTaskSchema = z.object({
|
|
32
|
-
id: z.string(),
|
|
37
|
+
id: z.string(), // task_xxxxxxxx
|
|
33
38
|
description: z.string(),
|
|
34
39
|
completed: z.boolean(),
|
|
35
40
|
completedAt: z.string().optional(),
|
|
36
41
|
})
|
|
37
42
|
|
|
38
43
|
export const RoadmapPhaseSchema = z.object({
|
|
39
|
-
id: z.string(),
|
|
44
|
+
id: z.string(), // P0, P1, etc.
|
|
40
45
|
name: z.string(),
|
|
41
46
|
status: PhaseStatusSchema,
|
|
42
47
|
completedAt: z.string().optional(),
|
|
@@ -73,10 +78,14 @@ export const GitCommitSchema = z.object({
|
|
|
73
78
|
export const EffortEstimateSchema = z.object({
|
|
74
79
|
hours: z.number(),
|
|
75
80
|
confidence: z.enum(['low', 'medium', 'high']).optional(),
|
|
76
|
-
breakdown: z
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
breakdown: z
|
|
82
|
+
.array(
|
|
83
|
+
z.object({
|
|
84
|
+
area: z.string(),
|
|
85
|
+
hours: z.number(),
|
|
86
|
+
})
|
|
87
|
+
)
|
|
88
|
+
.optional(),
|
|
80
89
|
})
|
|
81
90
|
|
|
82
91
|
export const EffortActualSchema = z.object({
|
|
@@ -98,19 +107,19 @@ export const FeatureEffortSchema = z.object({
|
|
|
98
107
|
export const QuarterCapacitySchema = z.object({
|
|
99
108
|
totalHours: z.number(),
|
|
100
109
|
allocatedHours: z.number(),
|
|
101
|
-
bufferPercent: z.number().optional(),
|
|
110
|
+
bufferPercent: z.number().optional(), // % reserved for unknowns
|
|
102
111
|
})
|
|
103
112
|
|
|
104
113
|
export const QuarterSchema = z.object({
|
|
105
|
-
id: z.string(),
|
|
106
|
-
name: z.string(),
|
|
107
|
-
theme: z.string().optional(),
|
|
114
|
+
id: z.string(), // Q1-2026
|
|
115
|
+
name: z.string(), // "Q1 2026"
|
|
116
|
+
theme: z.string().optional(), // "Foundation"
|
|
108
117
|
goals: z.array(z.string()).optional(),
|
|
109
|
-
features: z.array(z.string()),
|
|
118
|
+
features: z.array(z.string()), // Feature IDs
|
|
110
119
|
capacity: QuarterCapacitySchema.optional(),
|
|
111
120
|
status: QuarterStatusSchema,
|
|
112
|
-
startDate: z.string().optional(),
|
|
113
|
-
endDate: z.string().optional(),
|
|
121
|
+
startDate: z.string().optional(), // ISO8601
|
|
122
|
+
endDate: z.string().optional(), // ISO8601
|
|
114
123
|
})
|
|
115
124
|
|
|
116
125
|
// -----------------------------------------------------------------------------
|
|
@@ -118,23 +127,23 @@ export const QuarterSchema = z.object({
|
|
|
118
127
|
// -----------------------------------------------------------------------------
|
|
119
128
|
|
|
120
129
|
export const FeatureItemSchema = z.object({
|
|
121
|
-
id: z.string(),
|
|
130
|
+
id: z.string(), // feat_xxxxxxxx
|
|
122
131
|
name: z.string(),
|
|
123
132
|
description: z.string().optional(),
|
|
124
|
-
date: z.string(),
|
|
133
|
+
date: z.string(), // YYYY-MM-DD creation date
|
|
125
134
|
status: FeatureStatusSchema,
|
|
126
135
|
impact: FeatureImpactSchema,
|
|
127
136
|
effort: z.string().optional(),
|
|
128
|
-
progress: z.number(),
|
|
137
|
+
progress: z.number(), // 0-100
|
|
129
138
|
// Enriched fields from MD
|
|
130
139
|
type: FeatureTypeSchema.optional(),
|
|
131
|
-
roi: z.number().optional(),
|
|
140
|
+
roi: z.number().optional(), // 1-5 from star count
|
|
132
141
|
why: z.array(z.string()).optional(),
|
|
133
142
|
technicalNotes: z.array(z.string()).optional(),
|
|
134
143
|
compatibility: z.string().optional(),
|
|
135
144
|
phase: z.string().optional(), // P0, P1, etc.
|
|
136
145
|
tasks: z.array(FeatureTaskSchema),
|
|
137
|
-
createdAt: z.string(),
|
|
146
|
+
createdAt: z.string(), // ISO8601
|
|
138
147
|
shippedAt: z.string().optional(),
|
|
139
148
|
version: z.string().optional(),
|
|
140
149
|
// ZERO DATA LOSS - additional fields
|
|
@@ -149,29 +158,29 @@ export const FeatureItemSchema = z.object({
|
|
|
149
158
|
// =========================================================================
|
|
150
159
|
|
|
151
160
|
// PRD Integration
|
|
152
|
-
prdId: z.string().nullable().optional(),
|
|
161
|
+
prdId: z.string().nullable().optional(), // Link to PRD (prd_xxxxxxxx)
|
|
153
162
|
|
|
154
163
|
// Legacy Support (for existing projects)
|
|
155
|
-
legacy: z.boolean().optional(),
|
|
156
|
-
inferredFrom: InferredFromSchema.optional(),
|
|
164
|
+
legacy: z.boolean().optional(), // true = no PRD required
|
|
165
|
+
inferredFrom: InferredFromSchema.optional(), // git, git-branch, manual, prd
|
|
157
166
|
|
|
158
167
|
// Quarter Planning
|
|
159
|
-
quarter: z.string().nullable().optional(),
|
|
168
|
+
quarter: z.string().nullable().optional(), // Q1-2026, etc.
|
|
160
169
|
|
|
161
170
|
// Dependency Tracking
|
|
162
|
-
dependencies: z.array(z.string()).optional(),
|
|
163
|
-
blockedBy: z.array(z.string()).optional(),
|
|
171
|
+
dependencies: z.array(z.string()).optional(), // Feature IDs this depends on
|
|
172
|
+
blockedBy: z.array(z.string()).optional(), // Feature IDs blocking this
|
|
164
173
|
|
|
165
174
|
// Effort Tracking (for PRD comparison)
|
|
166
175
|
effortTracking: FeatureEffortSchema.optional(),
|
|
167
176
|
|
|
168
177
|
// Value Scoring (calculated from PRD)
|
|
169
|
-
valueScore: z.number().optional(),
|
|
178
|
+
valueScore: z.number().optional(), // Calculated priority score
|
|
170
179
|
|
|
171
180
|
// Git Data (for legacy features)
|
|
172
|
-
commits: z.array(GitCommitSchema).optional(),
|
|
173
|
-
branch: z.string().optional(),
|
|
174
|
-
commitsAhead: z.number().optional(),
|
|
181
|
+
commits: z.array(GitCommitSchema).optional(), // Commits for this feature
|
|
182
|
+
branch: z.string().optional(), // Branch name (for active)
|
|
183
|
+
commitsAhead: z.number().optional(), // Commits ahead of main
|
|
175
184
|
})
|
|
176
185
|
|
|
177
186
|
// -----------------------------------------------------------------------------
|
|
@@ -184,7 +193,7 @@ export const BacklogItemSchema = z.object({
|
|
|
184
193
|
prdId: z.string().nullable().optional(),
|
|
185
194
|
valueScore: z.number().optional(),
|
|
186
195
|
effortEstimate: z.number().optional(),
|
|
187
|
-
reason: z.string().optional(),
|
|
196
|
+
reason: z.string().optional(), // Why in backlog
|
|
188
197
|
})
|
|
189
198
|
|
|
190
199
|
// -----------------------------------------------------------------------------
|
|
@@ -194,7 +203,7 @@ export const BacklogItemSchema = z.object({
|
|
|
194
203
|
export const RoadmapJsonSchema = z.object({
|
|
195
204
|
strategy: RoadmapStrategySchema.nullable().optional(),
|
|
196
205
|
features: z.array(FeatureItemSchema),
|
|
197
|
-
backlog: z.array(z.union([z.string(), BacklogItemSchema])),
|
|
206
|
+
backlog: z.array(z.union([z.string(), BacklogItemSchema])), // Support both formats
|
|
198
207
|
lastUpdated: z.string(),
|
|
199
208
|
|
|
200
209
|
// AI ORCHESTRATION FIELDS (v0.29.0)
|
|
@@ -274,7 +283,11 @@ export const DEFAULT_ROADMAP: RoadmapJson = {
|
|
|
274
283
|
* Check if a feature is legacy (no PRD required)
|
|
275
284
|
*/
|
|
276
285
|
export const isLegacyFeature = (feature: FeatureSchema): boolean => {
|
|
277
|
-
return
|
|
286
|
+
return (
|
|
287
|
+
feature.legacy === true ||
|
|
288
|
+
feature.inferredFrom === 'git' ||
|
|
289
|
+
feature.inferredFrom === 'git-branch'
|
|
290
|
+
)
|
|
278
291
|
}
|
|
279
292
|
|
|
280
293
|
/**
|
|
@@ -294,14 +307,14 @@ export const calculateFeaturePriority = (feature: FeatureSchema): number => {
|
|
|
294
307
|
* Get features for a specific quarter
|
|
295
308
|
*/
|
|
296
309
|
export const getQuarterFeatures = (roadmap: RoadmapJson, quarterId: string): FeatureSchema[] => {
|
|
297
|
-
return roadmap.features.filter(f => f.quarter === quarterId)
|
|
310
|
+
return roadmap.features.filter((f) => f.quarter === quarterId)
|
|
298
311
|
}
|
|
299
312
|
|
|
300
313
|
/**
|
|
301
314
|
* Get quarter capacity utilization percentage
|
|
302
315
|
*/
|
|
303
316
|
export const getQuarterUtilization = (roadmap: RoadmapJson, quarterId: string): number => {
|
|
304
|
-
const quarter = roadmap.quarters?.find(q => q.id === quarterId)
|
|
317
|
+
const quarter = roadmap.quarters?.find((q) => q.id === quarterId)
|
|
305
318
|
if (!quarter?.capacity) return 0
|
|
306
319
|
|
|
307
320
|
const { allocatedHours, totalHours } = quarter.capacity
|
package/core/schemas/schemas.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* ID generators and path helpers for project data.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import crypto from 'crypto'
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import crypto from 'node:crypto'
|
|
8
|
+
import { homedir } from 'node:os'
|
|
9
|
+
import { join } from 'node:path'
|
|
10
10
|
|
|
11
11
|
// ============================================
|
|
12
12
|
// ID GENERATORS - UUID ONLY
|
|
@@ -36,4 +36,3 @@ export const GLOBAL_STORAGE = join(homedir(), '.prjct-cli', 'projects')
|
|
|
36
36
|
export function getProjectPath(projectId: string): string {
|
|
37
37
|
return join(GLOBAL_STORAGE, projectId)
|
|
38
38
|
}
|
|
39
|
-
|
package/core/schemas/shipped.ts
CHANGED
|
@@ -50,7 +50,7 @@ export const CommitInfoSchema = z.object({
|
|
|
50
50
|
})
|
|
51
51
|
|
|
52
52
|
export const ShippedItemSchema = z.object({
|
|
53
|
-
id: z.string(),
|
|
53
|
+
id: z.string(), // ship_xxxxxxxx
|
|
54
54
|
name: z.string(),
|
|
55
55
|
version: z.string().nullable().optional(),
|
|
56
56
|
type: ShipTypeSchema,
|
|
@@ -64,7 +64,7 @@ export const ShippedItemSchema = z.object({
|
|
|
64
64
|
quantitativeImpact: z.string().optional(),
|
|
65
65
|
duration: DurationSchema.optional(),
|
|
66
66
|
tasksCompleted: z.number().nullable().optional(),
|
|
67
|
-
shippedAt: z.string(),
|
|
67
|
+
shippedAt: z.string(), // ISO8601
|
|
68
68
|
featureId: z.string().optional(),
|
|
69
69
|
})
|
|
70
70
|
|
|
@@ -105,5 +105,5 @@ export const safeParseShipped = (data: unknown) => ShippedJsonSchema.safeParse(d
|
|
|
105
105
|
|
|
106
106
|
export const DEFAULT_SHIPPED: ShippedJson = {
|
|
107
107
|
items: [],
|
|
108
|
-
lastUpdated: ''
|
|
108
|
+
lastUpdated: '',
|
|
109
109
|
}
|
package/core/schemas/state.ts
CHANGED
|
@@ -17,17 +17,31 @@ import { z } from 'zod'
|
|
|
17
17
|
export const PrioritySchema = z.enum(['low', 'medium', 'high', 'critical'])
|
|
18
18
|
export const TaskTypeSchema = z.enum(['feature', 'bug', 'improvement', 'chore'])
|
|
19
19
|
export const TaskSectionSchema = z.enum(['active', 'backlog', 'previously_active'])
|
|
20
|
-
export const TaskStatusSchema = z.enum([
|
|
21
|
-
|
|
20
|
+
export const TaskStatusSchema = z.enum([
|
|
21
|
+
'pending',
|
|
22
|
+
'in_progress',
|
|
23
|
+
'completed',
|
|
24
|
+
'blocked',
|
|
25
|
+
'paused',
|
|
26
|
+
'failed',
|
|
27
|
+
])
|
|
28
|
+
export const ActivityTypeSchema = z.enum([
|
|
29
|
+
'task_completed',
|
|
30
|
+
'feature_shipped',
|
|
31
|
+
'idea_captured',
|
|
32
|
+
'session_started',
|
|
33
|
+
])
|
|
22
34
|
|
|
23
35
|
// Subtask summary for context handoff between agents
|
|
24
36
|
export const SubtaskSummarySchema = z.object({
|
|
25
37
|
title: z.string(),
|
|
26
38
|
description: z.string(),
|
|
27
|
-
filesChanged: z.array(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
39
|
+
filesChanged: z.array(
|
|
40
|
+
z.object({
|
|
41
|
+
path: z.string(),
|
|
42
|
+
action: z.enum(['created', 'modified', 'deleted']),
|
|
43
|
+
})
|
|
44
|
+
),
|
|
31
45
|
whatWasDone: z.array(z.string()),
|
|
32
46
|
outputForNextAgent: z.string().optional(),
|
|
33
47
|
notes: z.string().optional(),
|
|
@@ -35,15 +49,15 @@ export const SubtaskSummarySchema = z.object({
|
|
|
35
49
|
|
|
36
50
|
// Subtask schema for task fragmentation
|
|
37
51
|
export const SubtaskSchema = z.object({
|
|
38
|
-
id: z.string(),
|
|
52
|
+
id: z.string(), // subtask-xxx
|
|
39
53
|
description: z.string(),
|
|
40
|
-
domain: z.string(),
|
|
41
|
-
agent: z.string(),
|
|
54
|
+
domain: z.string(), // frontend, backend, database, testing, etc.
|
|
55
|
+
agent: z.string(), // agent file name (e.g., "frontend.md")
|
|
42
56
|
status: TaskStatusSchema,
|
|
43
|
-
dependsOn: z.array(z.string()),
|
|
44
|
-
startedAt: z.string().optional(),
|
|
57
|
+
dependsOn: z.array(z.string()), // IDs of dependent subtasks
|
|
58
|
+
startedAt: z.string().optional(), // ISO8601
|
|
45
59
|
completedAt: z.string().optional(), // ISO8601
|
|
46
|
-
output: z.string().optional(),
|
|
60
|
+
output: z.string().optional(), // Brief output description
|
|
47
61
|
summary: SubtaskSummarySchema.optional(), // Full summary for context handoff
|
|
48
62
|
})
|
|
49
63
|
|
|
@@ -55,26 +69,26 @@ export const SubtaskProgressSchema = z.object({
|
|
|
55
69
|
})
|
|
56
70
|
|
|
57
71
|
export const CurrentTaskSchema = z.object({
|
|
58
|
-
id: z.string(),
|
|
72
|
+
id: z.string(), // task_xxxxxxxx
|
|
59
73
|
description: z.string(),
|
|
60
|
-
startedAt: z.string(),
|
|
61
|
-
sessionId: z.string(),
|
|
74
|
+
startedAt: z.string(), // ISO8601
|
|
75
|
+
sessionId: z.string(), // sess_xxxxxxxx
|
|
62
76
|
featureId: z.string().optional(), // feat_xxxxxxxx
|
|
63
77
|
// Subtask tracking for fragmented tasks
|
|
64
78
|
subtasks: z.array(SubtaskSchema).optional(),
|
|
65
79
|
currentSubtaskIndex: z.number().optional(),
|
|
66
80
|
subtaskProgress: SubtaskProgressSchema.optional(),
|
|
67
81
|
// Linear integration - bidirectional sync
|
|
68
|
-
linearId: z.string().optional(),
|
|
69
|
-
linearUuid: z.string().optional(),
|
|
82
|
+
linearId: z.string().optional(), // "PRJ-123" - Linear identifier
|
|
83
|
+
linearUuid: z.string().optional(), // Linear internal UUID for API calls
|
|
70
84
|
})
|
|
71
85
|
|
|
72
86
|
export const PreviousTaskSchema = z.object({
|
|
73
87
|
id: z.string(),
|
|
74
88
|
description: z.string(),
|
|
75
89
|
status: z.literal('paused'),
|
|
76
|
-
startedAt: z.string(),
|
|
77
|
-
pausedAt: z.string(),
|
|
90
|
+
startedAt: z.string(), // ISO8601
|
|
91
|
+
pausedAt: z.string(), // ISO8601
|
|
78
92
|
pauseReason: z.string().optional(),
|
|
79
93
|
})
|
|
80
94
|
|
|
@@ -85,20 +99,20 @@ export const StateJsonSchema = z.object({
|
|
|
85
99
|
})
|
|
86
100
|
|
|
87
101
|
export const QueueTaskSchema = z.object({
|
|
88
|
-
id: z.string(),
|
|
102
|
+
id: z.string(), // task_xxxxxxxx
|
|
89
103
|
description: z.string(),
|
|
90
104
|
priority: PrioritySchema,
|
|
91
|
-
type: TaskTypeSchema,
|
|
105
|
+
type: TaskTypeSchema, // detect from emoji 🐛=bug
|
|
92
106
|
featureId: z.string().optional(),
|
|
93
107
|
originFeature: z.string().optional(),
|
|
94
108
|
completed: z.boolean(),
|
|
95
109
|
completedAt: z.string().optional(),
|
|
96
|
-
createdAt: z.string(),
|
|
110
|
+
createdAt: z.string(), // ISO8601
|
|
97
111
|
section: TaskSectionSchema,
|
|
98
112
|
// Additional fields for ZERO DATA LOSS
|
|
99
|
-
agent: z.string().optional(),
|
|
113
|
+
agent: z.string().optional(), // "fe", "be", "fe + be"
|
|
100
114
|
groupName: z.string().optional(), // "Sales Reports", "Stock Audits"
|
|
101
|
-
groupId: z.string().optional(),
|
|
115
|
+
groupId: z.string().optional(), // For grouping related tasks
|
|
102
116
|
})
|
|
103
117
|
|
|
104
118
|
export const QueueJsonSchema = z.object({
|
|
@@ -117,7 +131,7 @@ export const StatsSchema = z.object({
|
|
|
117
131
|
export const RecentActivitySchema = z.object({
|
|
118
132
|
type: ActivityTypeSchema,
|
|
119
133
|
description: z.string(),
|
|
120
|
-
timestamp: z.string(),
|
|
134
|
+
timestamp: z.string(), // ISO8601
|
|
121
135
|
duration: z.string().optional(),
|
|
122
136
|
})
|
|
123
137
|
|
|
@@ -127,7 +141,7 @@ export const StateSchemaFull = z.object({
|
|
|
127
141
|
queue: z.array(QueueTaskSchema),
|
|
128
142
|
stats: StatsSchema,
|
|
129
143
|
recentActivity: z.array(RecentActivitySchema),
|
|
130
|
-
lastSync: z.string(),
|
|
144
|
+
lastSync: z.string(), // ISO8601
|
|
131
145
|
})
|
|
132
146
|
|
|
133
147
|
// =============================================================================
|
|
@@ -176,12 +190,12 @@ export const safeParseQueue = (data: unknown) => QueueJsonSchema.safeParse(data)
|
|
|
176
190
|
|
|
177
191
|
export const DEFAULT_STATE: StateJson = {
|
|
178
192
|
currentTask: null,
|
|
179
|
-
lastUpdated: ''
|
|
193
|
+
lastUpdated: '',
|
|
180
194
|
}
|
|
181
195
|
|
|
182
196
|
export const DEFAULT_QUEUE: QueueJson = {
|
|
183
197
|
tasks: [],
|
|
184
|
-
lastUpdated: ''
|
|
198
|
+
lastUpdated: '',
|
|
185
199
|
}
|
|
186
200
|
|
|
187
201
|
export const DEFAULT_STATS: Stats = {
|
|
@@ -189,5 +203,5 @@ export const DEFAULT_STATS: Stats = {
|
|
|
189
203
|
tasksThisWeek: 0,
|
|
190
204
|
streak: 0,
|
|
191
205
|
velocity: '0/day',
|
|
192
|
-
avgDuration: '0m'
|
|
206
|
+
avgDuration: '0m',
|
|
193
207
|
}
|
package/core/server/index.ts
CHANGED
|
@@ -7,16 +7,15 @@
|
|
|
7
7
|
* @version 1.0.0
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
export { createServer, startServer, DEFAULT_PORT } from './server'
|
|
11
|
-
export { createRoutes } from './routes'
|
|
12
|
-
export { createExtendedRoutes } from './routes-extended'
|
|
13
|
-
export { createSSEManager, SSE_EVENTS } from './sse'
|
|
14
|
-
|
|
15
10
|
// Re-export types from canonical location
|
|
16
11
|
export type {
|
|
17
12
|
ServerConfig,
|
|
18
13
|
ServerInstance,
|
|
19
14
|
SSEClient,
|
|
20
|
-
SSEManager,
|
|
21
15
|
SSEEventType,
|
|
16
|
+
SSEManager,
|
|
22
17
|
} from '../types'
|
|
18
|
+
export { createRoutes } from './routes'
|
|
19
|
+
export { createExtendedRoutes } from './routes-extended'
|
|
20
|
+
export { createServer, DEFAULT_PORT, startServer } from './server'
|
|
21
|
+
export { createSSEManager, SSE_EVENTS } from './sse'
|