@jvittechs/j 1.0.21 → 1.0.23

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.21",
172
+ version: "1.0.23",
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: {
@@ -3749,27 +3749,43 @@ var IdeDetectionService = class {
3749
3749
  confidence: "low"
3750
3750
  };
3751
3751
  if (ideId === "agentsmd") {
3752
- const exists = await this.pathExists("AGENTS.md");
3752
+ const agentsPath = join5(this.projectPath, "AGENTS.md");
3753
+ const exists = await this.pathExists(agentsPath);
3753
3754
  detection.detected = exists;
3754
- detection.hasRules = exists;
3755
- detection.ruleCount = exists ? 1 : 0;
3756
- 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";
3757
3761
  return detection;
3758
3762
  }
3759
3763
  if (ideId === "gemini") {
3760
- const exists = await this.pathExists("GEMINI.md");
3764
+ const geminiPath = join5(this.projectPath, "GEMINI.md");
3765
+ const exists = await this.pathExists(geminiPath);
3761
3766
  detection.detected = exists;
3762
- detection.hasRules = exists;
3763
- detection.ruleCount = exists ? 1 : 0;
3764
- 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";
3765
3777
  return detection;
3766
3778
  }
3767
3779
  if (ideId === "opencode") {
3768
- const hasAgents = await this.pathExists("AGENTS.md");
3780
+ const agentsPath = join5(this.projectPath, "AGENTS.md");
3781
+ const hasAgents = await this.pathExists(agentsPath);
3769
3782
  const commandPath = join5(this.projectPath, ".opencode/command");
3770
3783
  const hasCommands = await this.pathExists(commandPath);
3771
- detection.hasRules = hasAgents;
3772
- 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
+ }
3773
3789
  if (hasCommands) {
3774
3790
  detection.hasWorkflows = true;
3775
3791
  detection.workflowCount = await this.countFiles(commandPath, ".md");
@@ -3920,6 +3936,21 @@ var IdeDetectionService = class {
3920
3936
  return 0;
3921
3937
  }
3922
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;
3950
+ } catch {
3951
+ return 0;
3952
+ }
3953
+ }
3923
3954
  /**
3924
3955
  * Get IDE format by ID
3925
3956
  */
@@ -4226,7 +4257,11 @@ async function runDoctor(options) {
4226
4257
  }
4227
4258
  }
4228
4259
  if (!result.passed && result.suggestion) {
4229
- console.log(chalk9.yellow(` \u{1F4A1} ${result.suggestion}`));
4260
+ const lines = result.suggestion.split("\n");
4261
+ console.log(chalk9.yellow(` \u{1F4A1} ${lines[0]}`));
4262
+ for (const line of lines.slice(1)) {
4263
+ console.log(chalk9.yellow(` ${line}`));
4264
+ }
4230
4265
  }
4231
4266
  console.log();
4232
4267
  }
@@ -4381,7 +4416,12 @@ async function checkIde(cliName) {
4381
4416
  message: passed ? `${fullyConfigured.length} IDE \u0111\u1EA7y \u0111\u1EE7 rules & workflows: ${fullyConfigured.join(", ")}` : "Ch\u01B0a c\xF3 IDE n\xE0o \u0111\u1EA7y \u0111\u1EE7 c\u1EA3 rules v\xE0 workflows",
4382
4417
  details,
4383
4418
  ...!passed && {
4384
- suggestion: `Ch\u1EA1y "${cliName} rules apply" v\xE0 "${cliName} ide sync" \u0111\u1EC3 b\u1ED5 sung.`
4419
+ suggestion: [
4420
+ `C\xF3 nhi\u1EC1u c\xE1ch \u0111\u1EC3 t\u1EA1o rules cho project:`,
4421
+ ` - T\u1EF1 t\xECm tr\xEAn internet ph\xF9 h\u1EE3p v\u1EDBi techstack c\u1EE7a project v\xE0 s\u1EEDa l\u1EA1i.`,
4422
+ ` - T\xECm xem c\xF3 s\u1EB5n rule-preset n\xE0o tr\xEAn jai1 store kh\xF4ng b\u1EB1ng l\u1EC7nh: "${cliName} rules apply".`,
4423
+ ` - Ch\u1EA1y workflow c\u1EE7a jai1 "/generate-rules-preset" \u0111\u1EC3 t\u1EA1o rule-preset cho project, sau \u0111\xF3 \u0111\u1ED3ng b\u1ED9 cho c\xE1c IDE d\xF9ng l\u1EC7nh "${cliName} ide sync".`
4424
+ ].join("\n")
4385
4425
  }
4386
4426
  };
4387
4427
  return [ideCheck, rulesWorkflowsCheck];