prjct-cli 0.11.3 → 0.11.5
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 +14 -0
- package/bin/prjct +4 -0
- package/bin/serve.js +22 -6
- package/core/__tests__/utils/date-helper.test.js +416 -0
- package/core/agentic/agent-router.js +30 -18
- package/core/agentic/command-executor.js +20 -24
- package/core/agentic/context-builder.js +7 -8
- package/core/agentic/memory-system.js +14 -19
- package/core/agentic/prompt-builder.js +41 -27
- package/core/agentic/template-loader.js +8 -2
- package/core/infrastructure/agent-detector.js +7 -4
- package/core/infrastructure/migrator.js +10 -13
- package/core/infrastructure/session-manager.js +10 -10
- package/package.json +1 -1
- package/packages/web/app/project/[id]/stats/page.tsx +102 -343
- package/packages/web/components/stats/ActivityTimeline.tsx +201 -0
- package/packages/web/components/stats/AgentsCard.tsx +56 -0
- package/packages/web/components/stats/BentoCard.tsx +88 -0
- package/packages/web/components/stats/BentoGrid.tsx +22 -0
- package/packages/web/components/stats/EmptyState.tsx +67 -0
- package/packages/web/components/stats/HeroSection.tsx +172 -0
- package/packages/web/components/stats/IdeasCard.tsx +59 -0
- package/packages/web/components/stats/NowCard.tsx +71 -0
- package/packages/web/components/stats/ProgressRing.tsx +74 -0
- package/packages/web/components/stats/QueueCard.tsx +58 -0
- package/packages/web/components/stats/RoadmapCard.tsx +97 -0
- package/packages/web/components/stats/ShipsCard.tsx +70 -0
- package/packages/web/components/stats/SparklineChart.tsx +44 -0
- package/packages/web/components/stats/StreakCard.tsx +59 -0
- package/packages/web/components/stats/VelocityCard.tsx +60 -0
- package/packages/web/components/stats/index.ts +17 -0
- package/packages/web/components/ui/tooltip.tsx +2 -2
- package/packages/web/next-env.d.ts +1 -1
- package/packages/web/package.json +2 -1
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Context Builder
|
|
3
|
-
* Builds project context for Claude
|
|
4
|
-
* NO if/else logic - just data collection
|
|
3
|
+
* Builds project context for Claude with smart caching.
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - Session-based caching to avoid redundant reads
|
|
9
|
-
* - Selective loading based on command needs
|
|
10
|
-
*
|
|
11
|
-
* Source: Windsurf, Cursor patterns
|
|
5
|
+
* @module agentic/context-builder
|
|
6
|
+
* @version 0.1
|
|
12
7
|
*/
|
|
13
8
|
|
|
14
9
|
const fs = require('fs').promises
|
|
15
10
|
const pathManager = require('../infrastructure/path-manager')
|
|
16
11
|
const configManager = require('../infrastructure/config-manager')
|
|
17
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Builds and caches project context for Claude decisions.
|
|
15
|
+
* Features parallel reads, selective loading, and anti-hallucination mtime checks.
|
|
16
|
+
*/
|
|
18
17
|
class ContextBuilder {
|
|
19
18
|
constructor() {
|
|
20
19
|
// Session cache - cleared between commands or after timeout
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Layered Memory System
|
|
3
|
-
* Three-tier memory for learning user patterns and preferences
|
|
3
|
+
* Three-tier memory for learning user patterns and preferences.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* - Tier 2: Patterns (recurring decisions/preferences)
|
|
8
|
-
* - Tier 3: History (append-only JSONL for audit)
|
|
9
|
-
*
|
|
10
|
-
* P3.3: Enhanced with semantic tags and CRUD operations
|
|
11
|
-
* - Semantic tags for categorization
|
|
12
|
-
* - Auto-memory from user decisions
|
|
13
|
-
* - Relevance-based retrieval
|
|
14
|
-
* - CRUD operations (create/update/delete)
|
|
15
|
-
*
|
|
16
|
-
* Source: Windsurf create_memory, Augment remember patterns
|
|
5
|
+
* @module agentic/memory-system
|
|
6
|
+
* @version 3.3
|
|
17
7
|
*/
|
|
18
8
|
|
|
19
9
|
const fs = require('fs').promises
|
|
@@ -21,7 +11,8 @@ const path = require('path')
|
|
|
21
11
|
const pathManager = require('../infrastructure/path-manager')
|
|
22
12
|
|
|
23
13
|
/**
|
|
24
|
-
*
|
|
14
|
+
* Semantic tags for memory categorization
|
|
15
|
+
* @enum {string}
|
|
25
16
|
*/
|
|
26
17
|
const MEMORY_TAGS = {
|
|
27
18
|
// Code preferences
|
|
@@ -46,17 +37,21 @@ const MEMORY_TAGS = {
|
|
|
46
37
|
AGENT_PREFERENCE: 'agent_preference'
|
|
47
38
|
}
|
|
48
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Three-tier memory system for learning user patterns.
|
|
42
|
+
* Tier 1: Session (ephemeral), Tier 2: Patterns (persistent), Tier 3: History (JSONL)
|
|
43
|
+
*/
|
|
49
44
|
class MemorySystem {
|
|
50
45
|
constructor() {
|
|
51
|
-
|
|
46
|
+
/** @type {Map<string, {value: any, timestamp: number}>} */
|
|
52
47
|
this._sessionMemory = new Map()
|
|
53
|
-
|
|
54
|
-
// Pattern cache (loaded from disk)
|
|
48
|
+
/** @type {Object|null} */
|
|
55
49
|
this._patterns = null
|
|
50
|
+
/** @type {boolean} */
|
|
56
51
|
this._patternsLoaded = false
|
|
57
|
-
|
|
58
|
-
// P3.3: Memories database (semantic tagged)
|
|
52
|
+
/** @type {Object|null} */
|
|
59
53
|
this._memories = null
|
|
54
|
+
/** @type {boolean} */
|
|
60
55
|
this._memoriesLoaded = false
|
|
61
56
|
}
|
|
62
57
|
|
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Prompt Builder
|
|
3
|
-
* Builds prompts for Claude based on templates and context
|
|
4
|
-
* Claude decides what to do - NO if/else logic here
|
|
3
|
+
* Builds prompts for Claude based on templates and context.
|
|
4
|
+
* Claude decides what to do - NO if/else logic here.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* P3.3: Includes relevant memories from semantic database
|
|
9
|
-
* P3.4: Includes plan mode instructions
|
|
10
|
-
* P4.1: Includes quality checklists (Claude decides which to apply)
|
|
6
|
+
* @module agentic/prompt-builder
|
|
7
|
+
* @version 4.1
|
|
11
8
|
*/
|
|
12
9
|
|
|
13
10
|
const fs = require('fs')
|
|
14
11
|
const path = require('path')
|
|
15
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Builds prompts for Claude using templates, context, and learned patterns.
|
|
15
|
+
* Supports plan mode, think blocks, and quality checklists.
|
|
16
|
+
*/
|
|
16
17
|
class PromptBuilder {
|
|
17
18
|
constructor() {
|
|
19
|
+
/** @type {Object<string, string>|null} */
|
|
18
20
|
this._checklistsCache = null
|
|
21
|
+
/** @type {string|null} */
|
|
19
22
|
this._checklistRoutingCache = null
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
26
|
* Load quality checklists from templates/checklists/
|
|
24
|
-
*
|
|
25
|
-
*
|
|
27
|
+
*
|
|
28
|
+
* @returns {Object<string, string>} Map of checklist name to content
|
|
26
29
|
*/
|
|
27
30
|
loadChecklists() {
|
|
28
31
|
if (this._checklistsCache) return this._checklistsCache
|
|
@@ -48,8 +51,9 @@ class PromptBuilder {
|
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
/**
|
|
51
|
-
* Load checklist routing template
|
|
52
|
-
*
|
|
54
|
+
* Load checklist routing template for Claude to decide which checklists apply
|
|
55
|
+
*
|
|
56
|
+
* @returns {string|null} Routing template content or null if not found
|
|
53
57
|
*/
|
|
54
58
|
loadChecklistRouting() {
|
|
55
59
|
if (this._checklistRoutingCache) return this._checklistRoutingCache
|
|
@@ -67,12 +71,17 @@ class PromptBuilder {
|
|
|
67
71
|
return this._checklistRoutingCache || null
|
|
68
72
|
}
|
|
69
73
|
/**
|
|
70
|
-
* Build
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
74
|
+
* Build a complete prompt for Claude from template, context, and enhancements
|
|
75
|
+
*
|
|
76
|
+
* @param {Object} template - Template with frontmatter and content
|
|
77
|
+
* @param {Object} context - Project context (projectPath, projectId, files, params)
|
|
78
|
+
* @param {Object} state - Current prjct state (now, next, analysis, etc.)
|
|
79
|
+
* @param {Object|null} [agent] - Specialized agent config (name, role, skills)
|
|
80
|
+
* @param {Object|null} [learnedPatterns] - User preferences from memory system
|
|
81
|
+
* @param {Object|null} [thinkBlock] - Reasoning block (plan, conclusions, confidence)
|
|
82
|
+
* @param {Array|null} [relevantMemories] - Past decisions from semantic database
|
|
83
|
+
* @param {Object|null} [planInfo] - Plan mode status (isPlanning, requiresApproval)
|
|
84
|
+
* @returns {string} Complete prompt ready for Claude
|
|
76
85
|
*/
|
|
77
86
|
build(template, context, state, agent = null, learnedPatterns = null, thinkBlock = null, relevantMemories = null, planInfo = null) {
|
|
78
87
|
const parts = []
|
|
@@ -233,8 +242,10 @@ class PromptBuilder {
|
|
|
233
242
|
}
|
|
234
243
|
|
|
235
244
|
/**
|
|
236
|
-
* Filter only relevant
|
|
237
|
-
*
|
|
245
|
+
* Filter state data to include only relevant portions for the prompt
|
|
246
|
+
*
|
|
247
|
+
* @param {Object} state - Full prjct state object
|
|
248
|
+
* @returns {string|null} Formatted relevant state or null if empty
|
|
238
249
|
*/
|
|
239
250
|
filterRelevantState(state) {
|
|
240
251
|
if (!state || Object.keys(state).length === 0) return null
|
|
@@ -264,10 +275,10 @@ class PromptBuilder {
|
|
|
264
275
|
}
|
|
265
276
|
|
|
266
277
|
/**
|
|
267
|
-
* Build analysis prompt
|
|
268
|
-
*
|
|
269
|
-
* @param {string} analysisType - Type of analysis
|
|
270
|
-
* @param {Object} context -
|
|
278
|
+
* Build an analysis prompt for pre-action investigation tasks
|
|
279
|
+
*
|
|
280
|
+
* @param {string} analysisType - Type of analysis (e.g., 'patterns', 'stack')
|
|
281
|
+
* @param {Object} context - Project context with projectPath and projectId
|
|
271
282
|
* @returns {string} Analysis prompt
|
|
272
283
|
*/
|
|
273
284
|
buildAnalysis(analysisType, context) {
|
|
@@ -285,8 +296,10 @@ class PromptBuilder {
|
|
|
285
296
|
}
|
|
286
297
|
|
|
287
298
|
/**
|
|
288
|
-
* Extract pattern summary
|
|
289
|
-
*
|
|
299
|
+
* Extract compressed pattern summary (conventions + high-priority anti-patterns)
|
|
300
|
+
*
|
|
301
|
+
* @param {string} content - Full patterns file content
|
|
302
|
+
* @returns {string|null} Compressed summary (max 800 bytes) or null
|
|
290
303
|
*/
|
|
291
304
|
extractPatternSummary(content) {
|
|
292
305
|
if (!content) return null
|
|
@@ -317,8 +330,9 @@ class PromptBuilder {
|
|
|
317
330
|
}
|
|
318
331
|
|
|
319
332
|
/**
|
|
320
|
-
* Build critical
|
|
321
|
-
*
|
|
333
|
+
* Build critical anti-hallucination rules section
|
|
334
|
+
*
|
|
335
|
+
* @returns {string} Formatted rules block
|
|
322
336
|
*/
|
|
323
337
|
buildCriticalRules() {
|
|
324
338
|
const fileCount = this._currentContext?.files?.length || this._currentContext?.filteredSize || 0
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Template Loader
|
|
3
|
-
* Loads command templates with frontmatter
|
|
4
|
-
*
|
|
3
|
+
* Loads and parses command templates with frontmatter.
|
|
4
|
+
*
|
|
5
|
+
* @module agentic/template-loader
|
|
6
|
+
* @version 1.0.0
|
|
5
7
|
*/
|
|
6
8
|
|
|
7
9
|
const fs = require('fs').promises
|
|
8
10
|
const path = require('path')
|
|
9
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Loads command templates from templates/commands/ with caching.
|
|
14
|
+
* Parses YAML-like frontmatter for metadata extraction.
|
|
15
|
+
*/
|
|
10
16
|
class TemplateLoader {
|
|
11
17
|
constructor() {
|
|
12
18
|
this.templatesDir = path.join(__dirname, '..', '..', 'templates', 'commands')
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Agent
|
|
3
|
-
*
|
|
4
|
-
* 100% Claude-focused architecture
|
|
5
|
-
* Detects Claude Code and Claude Desktop environments
|
|
2
|
+
* Agent Detector
|
|
3
|
+
* Detects Claude Code and Claude Desktop environments.
|
|
6
4
|
*
|
|
5
|
+
* @module infrastructure/agent-detector
|
|
7
6
|
* @version 0.5.0
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
9
|
const fs = require('fs')
|
|
11
10
|
const path = require('path')
|
|
12
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Detects the current execution environment (Claude or Terminal).
|
|
14
|
+
* Provides appropriate capabilities and configuration for each environment.
|
|
15
|
+
*/
|
|
13
16
|
class AgentDetector {
|
|
14
17
|
constructor() {
|
|
15
18
|
this.detectedAgent = null
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migrator
|
|
3
|
+
* Handles migrations between prjct versions and structures.
|
|
4
|
+
*
|
|
5
|
+
* @module infrastructure/migrator
|
|
6
|
+
* @version 0.3.0
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
const fs = require('fs').promises
|
|
2
10
|
const path = require('path')
|
|
3
11
|
const pathManager = require('./path-manager')
|
|
@@ -5,19 +13,8 @@ const configManager = require('./config-manager')
|
|
|
5
13
|
const authorDetector = require('./author-detector')
|
|
6
14
|
|
|
7
15
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* Migration process:
|
|
11
|
-
* 1. Detect legacy .prjct directory (v0.1.0 → v0.2.x)
|
|
12
|
-
* 2. Detect author information
|
|
13
|
-
* 3. Create prjct.config.json
|
|
14
|
-
* 4. Create global directory structure
|
|
15
|
-
* 5. Copy all files to global location
|
|
16
|
-
* 6. Move authors/version/created/lastSync to global config (v0.2.x → v0.3.0)
|
|
17
|
-
* 7. Validate migration
|
|
18
|
-
* 8. Optionally remove local .prjct
|
|
19
|
-
*
|
|
20
|
-
* @version 0.3.0
|
|
16
|
+
* Handles version migrations and project structure updates.
|
|
17
|
+
* Supports legacy → global storage migration and config version upgrades.
|
|
21
18
|
*/
|
|
22
19
|
class Migrator {
|
|
23
20
|
/**
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Manager
|
|
3
|
+
* Manages temporal fragmentation of logs and progress data.
|
|
4
|
+
*
|
|
5
|
+
* @module infrastructure/session-manager
|
|
6
|
+
* @version 0.2.1
|
|
7
|
+
*/
|
|
8
|
+
|
|
1
9
|
const path = require('path')
|
|
2
10
|
const pathManager = require('./path-manager')
|
|
3
11
|
const { VERSION } = require('../utils/version')
|
|
@@ -6,16 +14,8 @@ const jsonlHelper = require('../utils/jsonl-helper')
|
|
|
6
14
|
const fileHelper = require('../utils/file-helper')
|
|
7
15
|
|
|
8
16
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* Handles:
|
|
12
|
-
* - Daily session creation and rotation
|
|
13
|
-
* - Writing logs to date-specific directories
|
|
14
|
-
* - Reading historical data across multiple sessions
|
|
15
|
-
* - Session consolidation and queries
|
|
16
|
-
* - Automatic migration from legacy single-file logs
|
|
17
|
-
*
|
|
18
|
-
* @version 0.2.1
|
|
17
|
+
* Manages daily sessions for logs and progress data.
|
|
18
|
+
* Handles rotation, historical queries, and legacy migration.
|
|
19
19
|
*/
|
|
20
20
|
class SessionManager {
|
|
21
21
|
constructor() {
|