@jvittechs/j 1.0.20 → 1.0.22

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/dist/cli.js CHANGED
@@ -169,7 +169,7 @@ import { basename as basename4 } from "path";
169
169
  // package.json
170
170
  var package_default = {
171
171
  name: "@jvittechs/j",
172
- version: "1.0.20",
172
+ version: "1.0.22",
173
173
  description: "A unified CLI tool for JV-IT TECHS developers to manage Jai1 Framework. Supports both `j` and `jai1` commands. Please contact TeamAI for usage instructions.",
174
174
  type: "module",
175
175
  bin: {
@@ -3717,6 +3717,7 @@ var IDE_FORMATS = {
3717
3717
  };
3718
3718
 
3719
3719
  // src/services/ide-detection.service.ts
3720
+ var DEFAULT_RULE_KEYWORD = "jai1";
3720
3721
  var IdeDetectionService = class {
3721
3722
  projectPath;
3722
3723
  constructor(projectPath = process.cwd()) {
@@ -3748,27 +3749,43 @@ var IdeDetectionService = class {
3748
3749
  confidence: "low"
3749
3750
  };
3750
3751
  if (ideId === "agentsmd") {
3751
- const exists = await this.pathExists("AGENTS.md");
3752
+ const agentsPath = join5(this.projectPath, "AGENTS.md");
3753
+ const exists = await this.pathExists(agentsPath);
3752
3754
  detection.detected = exists;
3753
- detection.hasRules = exists;
3754
- detection.ruleCount = exists ? 1 : 0;
3755
- detection.confidence = exists ? "high" : "low";
3755
+ if (exists) {
3756
+ const customCount = await this.countAgentsMdCustomSections(agentsPath);
3757
+ detection.hasRules = customCount > 0;
3758
+ detection.ruleCount = customCount;
3759
+ }
3760
+ detection.confidence = exists ? detection.hasRules ? "high" : "medium" : "low";
3756
3761
  return detection;
3757
3762
  }
3758
3763
  if (ideId === "gemini") {
3759
- const exists = await this.pathExists("GEMINI.md");
3764
+ const geminiPath = join5(this.projectPath, "GEMINI.md");
3765
+ const exists = await this.pathExists(geminiPath);
3760
3766
  detection.detected = exists;
3761
- detection.hasRules = exists;
3762
- detection.ruleCount = exists ? 1 : 0;
3763
- detection.confidence = exists ? "high" : "low";
3767
+ if (exists) {
3768
+ const agentsPath = join5(this.projectPath, "AGENTS.md");
3769
+ const agentsExists = await this.pathExists(agentsPath);
3770
+ if (agentsExists) {
3771
+ const customCount = await this.countAgentsMdCustomSections(agentsPath);
3772
+ detection.hasRules = customCount > 0;
3773
+ detection.ruleCount = customCount;
3774
+ }
3775
+ }
3776
+ detection.confidence = exists ? detection.hasRules ? "high" : "medium" : "low";
3764
3777
  return detection;
3765
3778
  }
3766
3779
  if (ideId === "opencode") {
3767
- const hasAgents = await this.pathExists("AGENTS.md");
3780
+ const agentsPath = join5(this.projectPath, "AGENTS.md");
3781
+ const hasAgents = await this.pathExists(agentsPath);
3768
3782
  const commandPath = join5(this.projectPath, ".opencode/command");
3769
3783
  const hasCommands = await this.pathExists(commandPath);
3770
- detection.hasRules = hasAgents;
3771
- detection.ruleCount = hasAgents ? 1 : 0;
3784
+ if (hasAgents) {
3785
+ const customCount = await this.countAgentsMdCustomSections(agentsPath);
3786
+ detection.hasRules = customCount > 0;
3787
+ detection.ruleCount = customCount;
3788
+ }
3772
3789
  if (hasCommands) {
3773
3790
  detection.hasWorkflows = true;
3774
3791
  detection.workflowCount = await this.countFiles(commandPath, ".md");
@@ -3780,9 +3797,11 @@ var IdeDetectionService = class {
3780
3797
  const rulesPath = join5(this.projectPath, format.rulesPath);
3781
3798
  const rulesExist = await this.pathExists(rulesPath);
3782
3799
  if (rulesExist) {
3783
- detection.hasRules = true;
3784
- detection.ruleCount = await this.countFiles(rulesPath, format.fileExtension);
3785
- if (detection.ruleCount > 0) {
3800
+ const totalRules = await this.countFiles(rulesPath, format.fileExtension);
3801
+ const customRules = await this.countFiles(rulesPath, format.fileExtension, [DEFAULT_RULE_KEYWORD]);
3802
+ detection.hasRules = customRules > 0;
3803
+ detection.ruleCount = customRules;
3804
+ if (totalRules > 0) {
3786
3805
  detection.detected = true;
3787
3806
  }
3788
3807
  }
@@ -3902,10 +3921,32 @@ var IdeDetectionService = class {
3902
3921
  /**
3903
3922
  * Count files with specific extension in a directory
3904
3923
  */
3905
- async countFiles(dirPath, extension) {
3924
+ async countFiles(dirPath, extension, excludeKeywords = []) {
3906
3925
  try {
3907
3926
  const entries = await fs8.readdir(dirPath, { withFileTypes: true });
3908
- return entries.filter((entry) => entry.isFile() && entry.name.endsWith(extension)).length;
3927
+ return entries.filter((entry) => {
3928
+ if (!entry.isFile() || !entry.name.endsWith(extension)) return false;
3929
+ if (excludeKeywords.length > 0) {
3930
+ const nameLower = entry.name.toLowerCase();
3931
+ return !excludeKeywords.some((kw) => nameLower.includes(kw));
3932
+ }
3933
+ return true;
3934
+ }).length;
3935
+ } catch {
3936
+ return 0;
3937
+ }
3938
+ }
3939
+ /**
3940
+ * Count custom (non-jai1) sections in AGENTS.md
3941
+ * Counts H2 headings (## ) that do not contain the keyword 'jai1'
3942
+ */
3943
+ async countAgentsMdCustomSections(filePath) {
3944
+ try {
3945
+ const content = await fs8.readFile(filePath, "utf-8");
3946
+ const h2Headings = content.match(/^## .+$/gm) || [];
3947
+ return h2Headings.filter(
3948
+ (h) => !h.toLowerCase().includes(DEFAULT_RULE_KEYWORD)
3949
+ ).length;
3909
3950
  } catch {
3910
3951
  return 0;
3911
3952
  }