@jvittechs/jai1-cli 1.0.2 → 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 +126 -19
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
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.
|
|
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: {
|
|
@@ -969,24 +969,24 @@ trigger: ${trigger}
|
|
|
969
969
|
name: "OpenCode",
|
|
970
970
|
icon: "\u{1F4BB}",
|
|
971
971
|
basePath: ".opencode",
|
|
972
|
-
rulesPath:
|
|
973
|
-
|
|
974
|
-
|
|
972
|
+
rulesPath: null,
|
|
973
|
+
// OpenCode uses AGENTS.md for rules
|
|
974
|
+
workflowsPath: null,
|
|
975
|
+
commandsPath: "command",
|
|
976
|
+
// Note: singular "command" not "commands"
|
|
975
977
|
fileExtension: ".md",
|
|
976
978
|
generateFrontmatter: (opts) => {
|
|
977
|
-
|
|
978
|
-
if (opts.
|
|
979
|
-
|
|
980
|
-
} else if (opts.alwaysApply) {
|
|
981
|
-
trigger = "always_on";
|
|
982
|
-
} else if (opts.globs && opts.globs.length > 0) {
|
|
983
|
-
trigger = opts.globs[0];
|
|
984
|
-
} else {
|
|
985
|
-
trigger = "always_on";
|
|
979
|
+
const lines = ["---"];
|
|
980
|
+
if (opts.description) {
|
|
981
|
+
lines.push(`description: ${opts.description}`);
|
|
986
982
|
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
983
|
+
const agent = opts.agent ?? "code";
|
|
984
|
+
lines.push(`agent: ${agent}`);
|
|
985
|
+
if (opts.model) {
|
|
986
|
+
lines.push(`model: ${opts.model}`);
|
|
987
|
+
}
|
|
988
|
+
lines.push("---");
|
|
989
|
+
return lines.join("\n");
|
|
990
990
|
}
|
|
991
991
|
}
|
|
992
992
|
};
|
|
@@ -1031,7 +1031,8 @@ var MigrateIdeService = class {
|
|
|
1031
1031
|
}
|
|
1032
1032
|
const files = await fs4.readdir(presetDir);
|
|
1033
1033
|
for (const file of files) {
|
|
1034
|
-
if (!file.endsWith(".mdc")) continue;
|
|
1034
|
+
if (!file.endsWith(".md") && !file.endsWith(".mdc")) continue;
|
|
1035
|
+
if (file === "preset.json") continue;
|
|
1035
1036
|
const filepath = path.join(presetDir, file);
|
|
1036
1037
|
const stat = await fs4.stat(filepath);
|
|
1037
1038
|
if (!stat.isFile()) continue;
|
|
@@ -1042,7 +1043,7 @@ var MigrateIdeService = class {
|
|
|
1042
1043
|
frontmatter = data;
|
|
1043
1044
|
} catch {
|
|
1044
1045
|
}
|
|
1045
|
-
const name = path.basename(file, ".mdc");
|
|
1046
|
+
const name = file.endsWith(".mdc") ? path.basename(file, ".mdc") : path.basename(file, ".md");
|
|
1046
1047
|
const trigger = this.extractTrigger(frontmatter);
|
|
1047
1048
|
const alwaysApply = this.isAlwaysTrigger(trigger);
|
|
1048
1049
|
items.push({
|
|
@@ -1131,7 +1132,15 @@ ${reference}
|
|
|
1131
1132
|
for (const ide of ides) {
|
|
1132
1133
|
const config = IDE_MIGRATION_CONFIGS[ide];
|
|
1133
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
|
+
}
|
|
1134
1140
|
for (const type of contentTypes) {
|
|
1141
|
+
if (ide === "opencode" && type === "rules") {
|
|
1142
|
+
continue;
|
|
1143
|
+
}
|
|
1135
1144
|
const items = type === "rules" ? content.rules : type === "workflows" ? content.workflows : content.commands;
|
|
1136
1145
|
for (const item of items) {
|
|
1137
1146
|
const result = await this.migrateItem(ide, config, item);
|
|
@@ -1142,6 +1151,58 @@ ${reference}
|
|
|
1142
1151
|
}
|
|
1143
1152
|
return results;
|
|
1144
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
|
+
}
|
|
1145
1206
|
/**
|
|
1146
1207
|
* Migrate a single item
|
|
1147
1208
|
*/
|
|
@@ -3355,6 +3416,19 @@ var IDE_FORMATS = {
|
|
|
3355
3416
|
supportsReference: false,
|
|
3356
3417
|
dependencies: ["agentsmd"]
|
|
3357
3418
|
// Gemini requires AGENTS.md
|
|
3419
|
+
},
|
|
3420
|
+
opencode: {
|
|
3421
|
+
id: "opencode",
|
|
3422
|
+
name: "OpenCode",
|
|
3423
|
+
description: "OpenCode (AGENTS.md + .opencode/command/)",
|
|
3424
|
+
rulesPath: ".",
|
|
3425
|
+
// Uses AGENTS.md
|
|
3426
|
+
workflowsPath: ".opencode/command",
|
|
3427
|
+
fileExtension: ".md",
|
|
3428
|
+
metadataFormat: "yaml-frontmatter",
|
|
3429
|
+
supportsReference: true,
|
|
3430
|
+
dependencies: ["agentsmd"]
|
|
3431
|
+
// OpenCode requires AGENTS.md for rules
|
|
3358
3432
|
}
|
|
3359
3433
|
};
|
|
3360
3434
|
|
|
@@ -3405,6 +3479,20 @@ var IdeDetectionService = class {
|
|
|
3405
3479
|
detection.confidence = exists ? "high" : "low";
|
|
3406
3480
|
return detection;
|
|
3407
3481
|
}
|
|
3482
|
+
if (ideId === "opencode") {
|
|
3483
|
+
const hasAgents = await this.pathExists("AGENTS.md");
|
|
3484
|
+
const commandPath = join4(this.projectPath, ".opencode/command");
|
|
3485
|
+
const hasCommands = await this.pathExists(commandPath);
|
|
3486
|
+
detection.hasRules = hasAgents;
|
|
3487
|
+
detection.ruleCount = hasAgents ? 1 : 0;
|
|
3488
|
+
if (hasCommands) {
|
|
3489
|
+
detection.hasWorkflows = true;
|
|
3490
|
+
detection.workflowCount = await this.countFiles(commandPath, ".md");
|
|
3491
|
+
}
|
|
3492
|
+
detection.detected = hasAgents || hasCommands && detection.workflowCount > 0;
|
|
3493
|
+
detection.confidence = detection.detected ? hasAgents && hasCommands ? "high" : "medium" : "low";
|
|
3494
|
+
return detection;
|
|
3495
|
+
}
|
|
3408
3496
|
const rulesPath = join4(this.projectPath, format.rulesPath);
|
|
3409
3497
|
const rulesExist = await this.pathExists(rulesPath);
|
|
3410
3498
|
if (rulesExist) {
|
|
@@ -3480,6 +3568,13 @@ var IdeDetectionService = class {
|
|
|
3480
3568
|
if (await this.pathExists("GEMINI.md")) {
|
|
3481
3569
|
detected.push(ideId);
|
|
3482
3570
|
}
|
|
3571
|
+
} else if (ideId === "opencode") {
|
|
3572
|
+
const hasAgents = await this.pathExists("AGENTS.md");
|
|
3573
|
+
const commandPath = join4(this.projectPath, ".opencode/command");
|
|
3574
|
+
const hasCommands = await this.pathExists(commandPath);
|
|
3575
|
+
if (hasAgents || hasCommands) {
|
|
3576
|
+
detected.push(ideId);
|
|
3577
|
+
}
|
|
3483
3578
|
} else {
|
|
3484
3579
|
const rulesPath = join4(this.projectPath, format.rulesPath);
|
|
3485
3580
|
if (await this.pathExists(rulesPath)) {
|
|
@@ -3573,6 +3668,15 @@ var IdeDetectionService = class {
|
|
|
3573
3668
|
priority: "high"
|
|
3574
3669
|
});
|
|
3575
3670
|
}
|
|
3671
|
+
const hasOpenCodeConfig = await this.pathExists(join4(this.projectPath, ".opencode"));
|
|
3672
|
+
if (hasOpenCodeConfig) {
|
|
3673
|
+
suggestions.push({
|
|
3674
|
+
ideId: "opencode",
|
|
3675
|
+
name: "OpenCode",
|
|
3676
|
+
reason: ".opencode directory detected",
|
|
3677
|
+
priority: "high"
|
|
3678
|
+
});
|
|
3679
|
+
}
|
|
3576
3680
|
return suggestions;
|
|
3577
3681
|
}
|
|
3578
3682
|
};
|
|
@@ -3624,6 +3728,8 @@ async function runStatus(options) {
|
|
|
3624
3728
|
console.log(` Location: AGENTS.md`);
|
|
3625
3729
|
} else if (ide.id === "gemini") {
|
|
3626
3730
|
console.log(` Location: GEMINI.md`);
|
|
3731
|
+
} else if (ide.id === "opencode") {
|
|
3732
|
+
console.log(` Location: AGENTS.md + .opencode/command/`);
|
|
3627
3733
|
} else {
|
|
3628
3734
|
console.log(` Location: ${format.rulesPath}/`);
|
|
3629
3735
|
}
|
|
@@ -11645,7 +11751,8 @@ function createKitCreateCommand() {
|
|
|
11645
11751
|
{ name: "Cursor", value: "cursor" },
|
|
11646
11752
|
{ name: "Windsurf", value: "windsurf" },
|
|
11647
11753
|
{ name: "Claude Code", value: "claude-code" },
|
|
11648
|
-
{ name: "Antigravity", value: "antigravity" }
|
|
11754
|
+
{ name: "Antigravity", value: "antigravity" },
|
|
11755
|
+
{ name: "OpenCode", value: "opencode" }
|
|
11649
11756
|
];
|
|
11650
11757
|
let selectedIdes = [];
|
|
11651
11758
|
if (isAutoMode) {
|