prjct-cli 1.6.4 → 1.6.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 CHANGED
@@ -1,11 +1,17 @@
1
1
  # Changelog
2
2
 
3
- ## [1.6.4] - 2026-02-07
3
+ ## [1.6.5] - 2026-02-07
4
4
 
5
- ### Bug Fixes
5
+ ### Refactoring
6
+
7
+ - extract common agent-base.md template (PRJ-95) (#128)
8
+
9
+
10
+ ## [1.6.7] - 2026-02-07
6
11
 
7
- - add type guards for error handling (PRJ-79) (#127)
12
+ ### Refactor
8
13
 
14
+ - **Extract common agent-base.md template (PRJ-95)**: Created `templates/subagents/agent-base.md` with shared project context (path resolution, storage locations, rules). Added `{{> partial }}` include resolution in `sync-service.ts` that resolves partials during agent generation. Updated all 9 agent templates (5 domain + 4 workflow) to use `{{> agent-base }}` instead of duplicated content. Saves ~200 tokens per additional agent template.
9
15
 
10
16
  ## [1.6.6] - 2026-02-07
11
17
 
@@ -666,6 +666,39 @@ class SyncService {
666
666
  return agents
667
667
  }
668
668
 
669
+ /**
670
+ * Resolve {{> partial-name }} includes in template content.
671
+ * Loads partials from templates/subagents/.
672
+ */
673
+ private async resolveTemplateIncludes(content: string): Promise<string> {
674
+ const includePattern = /\{\{>\s*([\w-]+)\s*\}\}/g
675
+ const matches = [...content.matchAll(includePattern)]
676
+
677
+ if (matches.length === 0) return content
678
+
679
+ let resolved = content
680
+ for (const match of matches) {
681
+ const partialName = match[1]
682
+ const partialPath = path.join(
683
+ __dirname,
684
+ '..',
685
+ '..',
686
+ 'templates',
687
+ 'subagents',
688
+ `${partialName}.md`
689
+ )
690
+ try {
691
+ const partialContent = await fs.readFile(partialPath, 'utf-8')
692
+ resolved = resolved.replace(match[0], partialContent.trim())
693
+ } catch {
694
+ // Partial not found — leave marker for debugging
695
+ resolved = resolved.replace(match[0], `<!-- partial "${partialName}" not found -->`)
696
+ }
697
+ }
698
+
699
+ return resolved
700
+ }
701
+
669
702
  private async generateWorkflowAgent(name: string, agentsPath: string): Promise<void> {
670
703
  // Try to read template
671
704
  let content = ''
@@ -680,6 +713,7 @@ class SyncService {
680
713
  `${name}.md`
681
714
  )
682
715
  content = await fs.readFile(templatePath, 'utf-8')
716
+ content = await this.resolveTemplateIncludes(content)
683
717
  } catch {
684
718
  // Generate minimal agent
685
719
  content = this.generateMinimalWorkflowAgent(name)
@@ -708,6 +742,9 @@ class SyncService {
708
742
  )
709
743
  content = await fs.readFile(templatePath, 'utf-8')
710
744
 
745
+ // Resolve includes before variable replacement
746
+ content = await this.resolveTemplateIncludes(content)
747
+
711
748
  // Inject project-specific context
712
749
  content = content.replace('{projectName}', stats.name)
713
750
  content = content.replace('{frameworks}', stack.frameworks.join(', ') || 'None detected')
@@ -22761,6 +22761,34 @@ var init_sync_service = __esm({
22761
22761
  }
22762
22762
  return agents;
22763
22763
  }
22764
+ /**
22765
+ * Resolve {{> partial-name }} includes in template content.
22766
+ * Loads partials from templates/subagents/.
22767
+ */
22768
+ async resolveTemplateIncludes(content) {
22769
+ const includePattern = /\{\{>\s*([\w-]+)\s*\}\}/g;
22770
+ const matches = [...content.matchAll(includePattern)];
22771
+ if (matches.length === 0) return content;
22772
+ let resolved = content;
22773
+ for (const match of matches) {
22774
+ const partialName = match[1];
22775
+ const partialPath = path49.join(
22776
+ __dirname,
22777
+ "..",
22778
+ "..",
22779
+ "templates",
22780
+ "subagents",
22781
+ `${partialName}.md`
22782
+ );
22783
+ try {
22784
+ const partialContent = await fs45.readFile(partialPath, "utf-8");
22785
+ resolved = resolved.replace(match[0], partialContent.trim());
22786
+ } catch {
22787
+ resolved = resolved.replace(match[0], `<!-- partial "${partialName}" not found -->`);
22788
+ }
22789
+ }
22790
+ return resolved;
22791
+ }
22764
22792
  async generateWorkflowAgent(name, agentsPath) {
22765
22793
  let content = "";
22766
22794
  try {
@@ -22774,6 +22802,7 @@ var init_sync_service = __esm({
22774
22802
  `${name}.md`
22775
22803
  );
22776
22804
  content = await fs45.readFile(templatePath, "utf-8");
22805
+ content = await this.resolveTemplateIncludes(content);
22777
22806
  } catch {
22778
22807
  content = this.generateMinimalWorkflowAgent(name);
22779
22808
  }
@@ -22792,6 +22821,7 @@ var init_sync_service = __esm({
22792
22821
  `${name}.md`
22793
22822
  );
22794
22823
  content = await fs45.readFile(templatePath, "utf-8");
22824
+ content = await this.resolveTemplateIncludes(content);
22795
22825
  content = content.replace("{projectName}", stats.name);
22796
22826
  content = content.replace("{frameworks}", stack.frameworks.join(", ") || "None detected");
22797
22827
  content = content.replace("{ecosystem}", stats.ecosystem);
@@ -28653,7 +28683,7 @@ var require_package = __commonJS({
28653
28683
  "package.json"(exports, module) {
28654
28684
  module.exports = {
28655
28685
  name: "prjct-cli",
28656
- version: "1.6.4",
28686
+ version: "1.6.5",
28657
28687
  description: "Context layer for AI agents. Project context for Claude Code, Gemini CLI, and more.",
28658
28688
  main: "core/index.ts",
28659
28689
  bin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prjct-cli",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "description": "Context layer for AI agents. Project context for Claude Code, Gemini CLI, and more.",
5
5
  "main": "core/index.ts",
6
6
  "bin": {
@@ -0,0 +1,20 @@
1
+ ## prjct Project Context
2
+
3
+ ### Setup
4
+ 1. Read `.prjct/prjct.config.json` → extract `projectId`
5
+ 2. Set `globalPath = ~/.prjct-cli/projects/{projectId}`
6
+
7
+ ### Available Storage
8
+
9
+ | File | Contents |
10
+ |------|----------|
11
+ | `{globalPath}/storage/state.json` | Current task & subtasks |
12
+ | `{globalPath}/storage/queue.json` | Task queue |
13
+ | `{globalPath}/storage/shipped.json` | Shipping history |
14
+ | `{globalPath}/storage/roadmap.json` | Feature roadmap |
15
+
16
+ ### Rules
17
+ - Storage (JSON) is **SOURCE OF TRUTH**
18
+ - Context (MD) is **GENERATED** from storage
19
+ - NEVER hardcode timestamps — use system time
20
+ - Log significant actions to `{globalPath}/memory/events.jsonl`
@@ -16,7 +16,9 @@ You are a backend specialist agent for this project.
16
16
  - **APIs**: REST, GraphQL, gRPC, WebSockets
17
17
  - **Auth**: JWT, OAuth, Sessions, API Keys
18
18
 
19
- ## Project Context
19
+ {{> agent-base }}
20
+
21
+ ## Domain Analysis
20
22
 
21
23
  When invoked, analyze the project's backend stack:
22
24
  1. Read `package.json`, `go.mod`, `requirements.txt`, or `Cargo.toml`
@@ -15,7 +15,9 @@ You are a database specialist agent for this project.
15
15
  - **ORMs**: Prisma, Drizzle, TypeORM, Sequelize, GORM
16
16
  - **Migrations**: Schema changes, data migrations
17
17
 
18
- ## Project Context
18
+ {{> agent-base }}
19
+
20
+ ## Domain Analysis
19
21
 
20
22
  When invoked, analyze the project's database setup:
21
23
  1. Check for ORM config (prisma/schema.prisma, drizzle.config.ts)
@@ -16,7 +16,9 @@ You are a DevOps specialist agent for this project.
16
16
  - **CI/CD**: GitHub Actions, GitLab CI, Jenkins
17
17
  - **Cloud**: AWS, GCP, Azure, Vercel, Railway
18
18
 
19
- ## Project Context
19
+ {{> agent-base }}
20
+
21
+ ## Domain Analysis
20
22
 
21
23
  When invoked, analyze the project's DevOps setup:
22
24
  1. Check for Dockerfile, docker-compose.yml
@@ -16,7 +16,9 @@ You are a frontend specialist agent for this project.
16
16
  - **State**: Redux, Zustand, Pinia, Context API
17
17
  - **Build**: Vite, webpack, esbuild, Turbopack
18
18
 
19
- ## Project Context
19
+ {{> agent-base }}
20
+
21
+ ## Domain Analysis
20
22
 
21
23
  When invoked, analyze the project's frontend stack:
22
24
  1. Read `package.json` for dependencies
@@ -17,7 +17,9 @@ You are a testing specialist agent for this project.
17
17
  - **Go**: testing package, testify
18
18
  - **E2E**: Playwright, Cypress, Puppeteer
19
19
 
20
- ## Project Context
20
+ {{> agent-base }}
21
+
22
+ ## Domain Analysis
21
23
 
22
24
  When invoked, analyze the project's testing setup:
23
25
  1. Check for test config (bunfig.toml, jest.config.js, pytest.ini)
@@ -13,13 +13,12 @@ You are the Chief Architect agent, the expert in creating Product Requirement Do
13
13
 
14
14
  You are responsible for ensuring every significant feature is properly documented BEFORE implementation begins. You follow a formal 8-phase methodology adapted from industry best practices.
15
15
 
16
- ## Project Context
16
+ {{> agent-base }}
17
17
 
18
- When invoked, FIRST load context:
19
- 1. Read `.prjct/prjct.config.json` → extract `projectId`
20
- 2. Read `~/.prjct-cli/projects/{projectId}/storage/roadmap.json` → existing features
21
- 3. Read `~/.prjct-cli/projects/{projectId}/storage/prds.json` → existing PRDs
22
- 4. Read `~/.prjct-cli/projects/{projectId}/analysis/repo-analysis.json` → project tech stack
18
+ When invoked, load these storage files:
19
+ - `roadmap.json` → existing features
20
+ - `prds.json` → existing PRDs
21
+ - `analysis/repo-analysis.json` → project tech stack
23
22
 
24
23
  ## Commands You Handle
25
24
 
@@ -9,13 +9,12 @@ skills: [feature-dev]
9
9
 
10
10
  You are the prjct planning agent, specializing in feature planning and task breakdown.
11
11
 
12
- ## Project Context
12
+ {{> agent-base }}
13
13
 
14
- When invoked, FIRST load context:
15
- 1. Read `.prjct/prjct.config.json` → extract `projectId`
16
- 2. Read `~/.prjct-cli/projects/{projectId}/storage/state.json` → current state
17
- 3. Read `~/.prjct-cli/projects/{projectId}/storage/queue.json` → task queue
18
- 4. Read `~/.prjct-cli/projects/{projectId}/storage/roadmap.json` → feature roadmap
14
+ When invoked, load these storage files:
15
+ - `state.json` → current task state
16
+ - `queue.json` → task queue
17
+ - `roadmap.json` → feature roadmap
19
18
 
20
19
  ## Commands You Handle
21
20
 
@@ -9,12 +9,11 @@ skills: [code-review]
9
9
 
10
10
  You are the prjct shipper agent, specializing in shipping features safely.
11
11
 
12
- ## Project Context
12
+ {{> agent-base }}
13
13
 
14
- When invoked, FIRST load context:
15
- 1. Read `.prjct/prjct.config.json` → extract `projectId`
16
- 2. Read `~/.prjct-cli/projects/{projectId}/storage/state.json` → current state
17
- 3. Read `~/.prjct-cli/projects/{projectId}/storage/shipped.json` → shipping history
14
+ When invoked, load these storage files:
15
+ - `state.json` → current task state
16
+ - `shipped.json` → shipping history
18
17
 
19
18
  ## Commands You Handle
20
19
 
@@ -8,12 +8,11 @@ effort: low
8
8
 
9
9
  You are the prjct workflow executor, specializing in task lifecycle management.
10
10
 
11
- ## Project Context
11
+ {{> agent-base }}
12
12
 
13
- When invoked, FIRST load context:
14
- 1. Read `.prjct/prjct.config.json` → extract `projectId`
15
- 2. Read `~/.prjct-cli/projects/{projectId}/storage/state.json` → current state
16
- 3. Read `~/.prjct-cli/projects/{projectId}/storage/queue.json` → task queue
13
+ When invoked, load these storage files:
14
+ - `state.json` → current task state
15
+ - `queue.json` → task queue
17
16
 
18
17
  ## Commands You Handle
19
18