@jvittechs/j 1.0.47 → 1.0.49

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.49",
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: {
@@ -738,6 +738,7 @@ var IDE_MIGRATION_CONFIGS = {
738
738
  workflowsPath: "workflows",
739
739
  commandsPath: null,
740
740
  fileExtension: ".md",
741
+ flattenSubdirs: true,
741
742
  generateFrontmatter: (opts) => {
742
743
  let trigger;
743
744
  if (opts.trigger) {
@@ -763,6 +764,7 @@ trigger: ${trigger}
763
764
  workflowsPath: "workflows",
764
765
  commandsPath: null,
765
766
  fileExtension: ".md",
767
+ flattenSubdirs: true,
766
768
  generateFrontmatter: (opts) => {
767
769
  let trigger;
768
770
  if (opts.trigger) {
@@ -919,22 +921,18 @@ var MigrateIdeService = class {
919
921
  } catch {
920
922
  return items;
921
923
  }
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;
924
+ const mdFiles = await this.collectMdFiles(dirPath, dirPath);
925
+ for (const { filepath, relativeName } of mdFiles) {
928
926
  const content = await fs4.readFile(filepath, "utf-8");
929
927
  let frontmatter = {};
930
928
  try {
931
929
  const { data } = matter(content);
932
930
  frontmatter = data;
933
931
  } catch (e) {
934
- console.warn(`\u26A0\uFE0F Skipping ${file}: Invalid YAML frontmatter`);
932
+ console.warn(`\u26A0\uFE0F Skipping ${relativeName}: Invalid YAML frontmatter`);
935
933
  continue;
936
934
  }
937
- const name = path.basename(file, ".md");
935
+ const name = relativeName;
938
936
  const trigger = this.extractTrigger(frontmatter);
939
937
  const alwaysApply = this.isAlwaysTrigger(trigger);
940
938
  items.push({
@@ -1120,10 +1118,39 @@ ${bodyContent}
1120
1118
  if (!contentPath) {
1121
1119
  return null;
1122
1120
  }
1123
- const filename = `${item.name}${extension}`;
1121
+ const itemName = config.flattenSubdirs ? item.name.replace(/\//g, ":") : item.name;
1122
+ const filename = `${itemName}${extension}`;
1124
1123
  return path.join(this.projectPath, config.basePath, contentPath, filename);
1125
1124
  }
1126
1125
  // Helper methods
1126
+ /**
1127
+ * Recursively collect .md files from a directory.
1128
+ * Supports both flat layout (core v1) and subdirectory layout (core v2).
1129
+ * Returns relative name preserving subdirectory structure:
1130
+ * - Flat: 'commit-it' (from commit-it.md)
1131
+ * - Subdir: 'dev/feature' (from dev/feature.md)
1132
+ */
1133
+ async collectMdFiles(rootDir, currentDir) {
1134
+ const results = [];
1135
+ let entries;
1136
+ try {
1137
+ entries = await fs4.readdir(currentDir, { withFileTypes: true });
1138
+ } catch {
1139
+ return results;
1140
+ }
1141
+ for (const entry of entries) {
1142
+ const fullPath = path.join(currentDir, entry.name);
1143
+ if (entry.isDirectory()) {
1144
+ const subResults = await this.collectMdFiles(rootDir, fullPath);
1145
+ results.push(...subResults);
1146
+ } else if (entry.isFile() && entry.name.endsWith(".md")) {
1147
+ const relativePath = path.relative(rootDir, fullPath);
1148
+ const relativeName = relativePath.replace(/\.md$/, "");
1149
+ results.push({ filepath: fullPath, relativeName });
1150
+ }
1151
+ }
1152
+ return results;
1153
+ }
1127
1154
  /**
1128
1155
  * Extract trigger from frontmatter
1129
1156
  * Jai1 source format uses 'trigger' field (Windsurf/Antigravity compatible)