@jvittechs/jai1-cli 1.0.3 → 1.0.4

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
@@ -33,7 +33,7 @@ var NetworkError = class extends Jai1Error {
33
33
  // package.json
34
34
  var package_default = {
35
35
  name: "@jvittechs/jai1-cli",
36
- version: "1.0.3",
36
+ version: "1.0.4",
37
37
  description: "A unified CLI tool for JV-IT TECHS developers to manage Jai1 Framework. Please contact TeamAI for usage instructions.",
38
38
  type: "module",
39
39
  bin: {
@@ -1132,7 +1132,15 @@ ${reference}
1132
1132
  for (const ide of ides) {
1133
1133
  const config = IDE_MIGRATION_CONFIGS[ide];
1134
1134
  if (!config) continue;
1135
+ if (ide === "opencode" && contentTypes.includes("rules") && content.rules.length > 0) {
1136
+ const agentsResult = await this.migrateOpenCodeRules(content.rules);
1137
+ results.push(agentsResult);
1138
+ onProgress?.(agentsResult);
1139
+ }
1135
1140
  for (const type of contentTypes) {
1141
+ if (ide === "opencode" && type === "rules") {
1142
+ continue;
1143
+ }
1136
1144
  const items = type === "rules" ? content.rules : type === "workflows" ? content.workflows : content.commands;
1137
1145
  for (const item of items) {
1138
1146
  const result = await this.migrateItem(ide, config, item);
@@ -1143,6 +1151,58 @@ ${reference}
1143
1151
  }
1144
1152
  return results;
1145
1153
  }
1154
+ /**
1155
+ * Migrate rules for OpenCode by creating/updating AGENTS.md
1156
+ */
1157
+ async migrateOpenCodeRules(rules) {
1158
+ const agentsPath = path.join(this.projectPath, "AGENTS.md");
1159
+ try {
1160
+ let status = "created";
1161
+ try {
1162
+ await fs4.access(agentsPath);
1163
+ status = "updated";
1164
+ } catch {
1165
+ }
1166
+ const lines = [
1167
+ "# AGENTS.md",
1168
+ "",
1169
+ "> Auto-generated by jai1 ide sync for OpenCode",
1170
+ ""
1171
+ ];
1172
+ for (const rule of rules) {
1173
+ lines.push(`@${rule.relativePath}`);
1174
+ }
1175
+ lines.push("");
1176
+ await fs4.writeFile(agentsPath, lines.join("\n"), "utf-8");
1177
+ return {
1178
+ source: {
1179
+ type: "rules",
1180
+ name: "AGENTS",
1181
+ filepath: agentsPath,
1182
+ relativePath: "AGENTS.md",
1183
+ description: `Merged ${rules.length} rules for OpenCode`,
1184
+ alwaysApply: true
1185
+ },
1186
+ targetIDE: "opencode",
1187
+ targetPath: agentsPath,
1188
+ status
1189
+ };
1190
+ } catch (error) {
1191
+ return {
1192
+ source: {
1193
+ type: "rules",
1194
+ name: "AGENTS",
1195
+ filepath: agentsPath,
1196
+ relativePath: "AGENTS.md",
1197
+ alwaysApply: true
1198
+ },
1199
+ targetIDE: "opencode",
1200
+ targetPath: agentsPath,
1201
+ status: "error",
1202
+ error: error instanceof Error ? error.message : "Unknown error"
1203
+ };
1204
+ }
1205
+ }
1146
1206
  /**
1147
1207
  * Migrate a single item
1148
1208
  */