@jvittechs/j 1.0.47 → 1.0.48

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
@@ -149,7 +149,7 @@ import { basename as basename5 } from "path";
149
149
  // package.json
150
150
  var package_default = {
151
151
  name: "@jvittechs/j",
152
- version: "1.0.47",
152
+ version: "1.0.48",
153
153
  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.",
154
154
  type: "module",
155
155
  bin: {
@@ -919,22 +919,18 @@ var MigrateIdeService = class {
919
919
  } catch {
920
920
  return items;
921
921
  }
922
- const files = await fs4.readdir(dirPath);
923
- for (const file of files) {
924
- if (!file.endsWith(".md")) continue;
925
- const filepath = path.join(dirPath, file);
926
- const stat = await fs4.stat(filepath);
927
- if (!stat.isFile()) continue;
922
+ const mdFiles = await this.collectMdFiles(dirPath, dirPath);
923
+ for (const { filepath, relativeName } of mdFiles) {
928
924
  const content = await fs4.readFile(filepath, "utf-8");
929
925
  let frontmatter = {};
930
926
  try {
931
927
  const { data } = matter(content);
932
928
  frontmatter = data;
933
929
  } catch (e) {
934
- console.warn(`\u26A0\uFE0F Skipping ${file}: Invalid YAML frontmatter`);
930
+ console.warn(`\u26A0\uFE0F Skipping ${relativeName}: Invalid YAML frontmatter`);
935
931
  continue;
936
932
  }
937
- const name = path.basename(file, ".md");
933
+ const name = relativeName;
938
934
  const trigger = this.extractTrigger(frontmatter);
939
935
  const alwaysApply = this.isAlwaysTrigger(trigger);
940
936
  items.push({
@@ -1124,6 +1120,34 @@ ${bodyContent}
1124
1120
  return path.join(this.projectPath, config.basePath, contentPath, filename);
1125
1121
  }
1126
1122
  // Helper methods
1123
+ /**
1124
+ * Recursively collect .md files from a directory.
1125
+ * Supports both flat layout (core v1) and subdirectory layout (core v2).
1126
+ * Returns relative name preserving subdirectory structure:
1127
+ * - Flat: 'commit-it' (from commit-it.md)
1128
+ * - Subdir: 'dev/feature' (from dev/feature.md)
1129
+ */
1130
+ async collectMdFiles(rootDir, currentDir) {
1131
+ const results = [];
1132
+ let entries;
1133
+ try {
1134
+ entries = await fs4.readdir(currentDir, { withFileTypes: true });
1135
+ } catch {
1136
+ return results;
1137
+ }
1138
+ for (const entry of entries) {
1139
+ const fullPath = path.join(currentDir, entry.name);
1140
+ if (entry.isDirectory()) {
1141
+ const subResults = await this.collectMdFiles(rootDir, fullPath);
1142
+ results.push(...subResults);
1143
+ } else if (entry.isFile() && entry.name.endsWith(".md")) {
1144
+ const relativePath = path.relative(rootDir, fullPath);
1145
+ const relativeName = relativePath.replace(/\.md$/, "");
1146
+ results.push({ filepath: fullPath, relativeName });
1147
+ }
1148
+ }
1149
+ return results;
1150
+ }
1127
1151
  /**
1128
1152
  * Extract trigger from frontmatter
1129
1153
  * Jai1 source format uses 'trigger' field (Windsurf/Antigravity compatible)