@jvittechs/j 1.0.16 → 1.0.17
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 +28 -14
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
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.
|
|
172
|
+
version: "1.0.17",
|
|
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: {
|
|
@@ -1140,6 +1140,15 @@ function getMigrationIDEs() {
|
|
|
1140
1140
|
return Object.keys(IDE_MIGRATION_CONFIGS);
|
|
1141
1141
|
}
|
|
1142
1142
|
|
|
1143
|
+
// src/utils/heading-utils.ts
|
|
1144
|
+
function downshiftHeadings(content) {
|
|
1145
|
+
return content.replace(/^(#{1,5})\s/gm, (_match, hashes) => "#" + hashes + " ");
|
|
1146
|
+
}
|
|
1147
|
+
function extractBody(content) {
|
|
1148
|
+
const match = content.match(/^---\n[\s\S]*?\n---\n?([\s\S]*)$/);
|
|
1149
|
+
return match ? match[1].trim() : content.trim();
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1143
1152
|
// src/services/migrate-ide.service.ts
|
|
1144
1153
|
var MigrateIdeService = class {
|
|
1145
1154
|
projectPath;
|
|
@@ -1248,9 +1257,10 @@ var MigrateIdeService = class {
|
|
|
1248
1257
|
return items;
|
|
1249
1258
|
}
|
|
1250
1259
|
/**
|
|
1251
|
-
* Generate
|
|
1260
|
+
* Generate copied content for IDE rule file.
|
|
1261
|
+
* Reads the actual source file and combines IDE-specific frontmatter with the body content.
|
|
1252
1262
|
*/
|
|
1253
|
-
|
|
1263
|
+
async generateCopiedContent(ide, sourceItem) {
|
|
1254
1264
|
const config = IDE_MIGRATION_CONFIGS[ide];
|
|
1255
1265
|
if (!config) throw new Error(`Unknown IDE: ${ide}`);
|
|
1256
1266
|
const frontmatter = config.generateFrontmatter({
|
|
@@ -1260,14 +1270,15 @@ var MigrateIdeService = class {
|
|
|
1260
1270
|
alwaysApply: sourceItem.alwaysApply,
|
|
1261
1271
|
sourceFile: sourceItem.relativePath
|
|
1262
1272
|
});
|
|
1263
|
-
const
|
|
1273
|
+
const sourceContent = await fs5.readFile(sourceItem.filepath, "utf-8");
|
|
1274
|
+
const bodyContent = extractBody(sourceContent);
|
|
1264
1275
|
if (frontmatter) {
|
|
1265
1276
|
return `${frontmatter}
|
|
1266
1277
|
|
|
1267
|
-
${
|
|
1278
|
+
${bodyContent}
|
|
1268
1279
|
`;
|
|
1269
1280
|
}
|
|
1270
|
-
return `${
|
|
1281
|
+
return `${bodyContent}
|
|
1271
1282
|
`;
|
|
1272
1283
|
}
|
|
1273
1284
|
/**
|
|
@@ -1316,7 +1327,12 @@ ${reference}
|
|
|
1316
1327
|
""
|
|
1317
1328
|
];
|
|
1318
1329
|
for (const rule of rules) {
|
|
1319
|
-
|
|
1330
|
+
const content = await fs5.readFile(rule.filepath, "utf-8");
|
|
1331
|
+
const body = extractBody(content);
|
|
1332
|
+
if (body.trim()) {
|
|
1333
|
+
lines.push(downshiftHeadings(body));
|
|
1334
|
+
lines.push("");
|
|
1335
|
+
}
|
|
1320
1336
|
}
|
|
1321
1337
|
lines.push("");
|
|
1322
1338
|
await fs5.writeFile(agentsPath, lines.join("\n"), "utf-8");
|
|
@@ -1372,8 +1388,8 @@ ${reference}
|
|
|
1372
1388
|
status = "updated";
|
|
1373
1389
|
} catch {
|
|
1374
1390
|
}
|
|
1375
|
-
const
|
|
1376
|
-
await fs5.writeFile(targetPath,
|
|
1391
|
+
const copiedContent = await this.generateCopiedContent(ide, item);
|
|
1392
|
+
await fs5.writeFile(targetPath, copiedContent, "utf-8");
|
|
1377
1393
|
return {
|
|
1378
1394
|
source: item,
|
|
1379
1395
|
targetIDE: ide,
|
|
@@ -12053,7 +12069,7 @@ ${body.trim()}
|
|
|
12053
12069
|
`;
|
|
12054
12070
|
}
|
|
12055
12071
|
/**
|
|
12056
|
-
* Generate Antigravity format (.md files with trigger metadata +
|
|
12072
|
+
* Generate Antigravity format (.md files with trigger metadata + actual content)
|
|
12057
12073
|
*/
|
|
12058
12074
|
generateAntigravityFiles(bundle, format) {
|
|
12059
12075
|
const files = [];
|
|
@@ -12084,9 +12100,7 @@ ${body.trim()}
|
|
|
12084
12100
|
}
|
|
12085
12101
|
const antigravityFrontmatter = `---
|
|
12086
12102
|
trigger: ${trigger}
|
|
12087
|
-
|
|
12088
|
-
|
|
12089
|
-
@AGENTS.md`;
|
|
12103
|
+
---`;
|
|
12090
12104
|
return `${antigravityFrontmatter}
|
|
12091
12105
|
|
|
12092
12106
|
${body.trim()}
|
|
@@ -12156,7 +12170,7 @@ ${body.trim()}
|
|
|
12156
12170
|
const content = bundle.files[filename];
|
|
12157
12171
|
const withoutFrontmatter = this.removeFrontmatter(content);
|
|
12158
12172
|
if (withoutFrontmatter.trim()) {
|
|
12159
|
-
sections.push(withoutFrontmatter.trim());
|
|
12173
|
+
sections.push(downshiftHeadings(withoutFrontmatter.trim()));
|
|
12160
12174
|
sections.push("\n");
|
|
12161
12175
|
}
|
|
12162
12176
|
}
|