@mstar-harness/cli 0.5.3 → 0.5.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/mstar-harness.js +58 -16
- package/package.json +1 -1
package/dist/mstar-harness.js
CHANGED
|
@@ -4339,6 +4339,53 @@ function validateLocalHarnessRepo() {
|
|
|
4339
4339
|
}
|
|
4340
4340
|
return errors2;
|
|
4341
4341
|
}
|
|
4342
|
+
function ensureGitCheckout(repoUrl, checkoutPath, dryRun) {
|
|
4343
|
+
const notes = [];
|
|
4344
|
+
const parentDir = path3.dirname(checkoutPath);
|
|
4345
|
+
if (pathOrSymlinkExists(checkoutPath)) {
|
|
4346
|
+
const stat = fs2.lstatSync(checkoutPath);
|
|
4347
|
+
if (stat.isSymbolicLink()) {
|
|
4348
|
+
notes.push(dryRun ? `Would remove symlink at ${checkoutPath} and clone ${repoUrl}` : `Removed symlink at ${checkoutPath} (Cursor requires a real directory)`);
|
|
4349
|
+
if (dryRun)
|
|
4350
|
+
return notes;
|
|
4351
|
+
fs2.unlinkSync(checkoutPath);
|
|
4352
|
+
} else if (fs2.existsSync(path3.join(checkoutPath, ".git"))) {
|
|
4353
|
+
if (!dryRun) {
|
|
4354
|
+
runCommand(["git", "-C", checkoutPath, "pull", "--ff-only"], checkoutPath, dryRun);
|
|
4355
|
+
}
|
|
4356
|
+
notes.push(`Updated git checkout at ${checkoutPath}`);
|
|
4357
|
+
return notes;
|
|
4358
|
+
} else {
|
|
4359
|
+
throw new Error(`Path exists but is not a git checkout: ${checkoutPath}`);
|
|
4360
|
+
}
|
|
4361
|
+
}
|
|
4362
|
+
ensureDir(parentDir, dryRun);
|
|
4363
|
+
if (!dryRun) {
|
|
4364
|
+
runCommand(["git", "clone", repoUrl, checkoutPath], parentDir, dryRun);
|
|
4365
|
+
}
|
|
4366
|
+
notes.push(`${dryRun ? "Would clone" : "Cloned"} ${repoUrl} to ${checkoutPath}`);
|
|
4367
|
+
return notes;
|
|
4368
|
+
}
|
|
4369
|
+
function validateGitCheckout(checkoutPath, markerRelativePath) {
|
|
4370
|
+
const errors2 = [];
|
|
4371
|
+
if (!pathOrSymlinkExists(checkoutPath)) {
|
|
4372
|
+
errors2.push(`Missing checkout directory: ${checkoutPath}`);
|
|
4373
|
+
return errors2;
|
|
4374
|
+
}
|
|
4375
|
+
const stat = fs2.lstatSync(checkoutPath);
|
|
4376
|
+
if (stat.isSymbolicLink()) {
|
|
4377
|
+
errors2.push(`Path must be a real directory, not a symlink: ${checkoutPath}. Run: mstar-harness init --target cursor`);
|
|
4378
|
+
return errors2;
|
|
4379
|
+
}
|
|
4380
|
+
if (!fs2.existsSync(path3.join(checkoutPath, ".git"))) {
|
|
4381
|
+
errors2.push(`Path is not a git checkout: ${checkoutPath}`);
|
|
4382
|
+
}
|
|
4383
|
+
const marker = path3.join(checkoutPath, markerRelativePath);
|
|
4384
|
+
if (!fs2.existsSync(marker)) {
|
|
4385
|
+
errors2.push(`Missing marker file: ${marker}`);
|
|
4386
|
+
}
|
|
4387
|
+
return errors2;
|
|
4388
|
+
}
|
|
4342
4389
|
function ensureSymlink(target, linkPath, dryRun) {
|
|
4343
4390
|
if (pathOrSymlinkExists(linkPath)) {
|
|
4344
4391
|
const stat = fs2.lstatSync(linkPath);
|
|
@@ -4595,9 +4642,9 @@ function globalInstallPath() {
|
|
|
4595
4642
|
function projectInstallPath() {
|
|
4596
4643
|
return path5.join(resolveProjectRoot(), CURSOR_PLUGIN_LINK);
|
|
4597
4644
|
}
|
|
4598
|
-
function validatePluginAgents() {
|
|
4645
|
+
function validatePluginAgents(pluginRoot) {
|
|
4599
4646
|
const errors2 = [];
|
|
4600
|
-
const agentsDir = path5.join(
|
|
4647
|
+
const agentsDir = path5.join(pluginRoot, "agents");
|
|
4601
4648
|
if (!fs4.existsSync(agentsDir)) {
|
|
4602
4649
|
errors2.push(`Missing plugin agents directory: ${agentsDir}`);
|
|
4603
4650
|
return errors2;
|
|
@@ -4615,46 +4662,41 @@ function validatePluginAgents() {
|
|
|
4615
4662
|
}
|
|
4616
4663
|
return errors2;
|
|
4617
4664
|
}
|
|
4665
|
+
function ensureCursorPluginCheckout(location, dryRun) {
|
|
4666
|
+
return ensureGitCheckout(REPO_URL, location, dryRun);
|
|
4667
|
+
}
|
|
4618
4668
|
function globalInit(dryRun) {
|
|
4619
4669
|
const location = globalInstallPath();
|
|
4620
4670
|
const notes = ensureLocalHarnessRepo(dryRun);
|
|
4621
|
-
notes.push(
|
|
4671
|
+
notes.push(...ensureCursorPluginCheckout(location, dryRun));
|
|
4622
4672
|
return { location, notes };
|
|
4623
4673
|
}
|
|
4624
4674
|
function projectInit(dryRun) {
|
|
4625
4675
|
const projectRoot = resolveProjectRoot();
|
|
4626
4676
|
const location = projectInstallPath();
|
|
4627
4677
|
const notes = ensureLocalHarnessRepo(dryRun);
|
|
4628
|
-
notes.push(
|
|
4678
|
+
notes.push(...ensureCursorPluginCheckout(location, dryRun));
|
|
4629
4679
|
notes.push(...appendGitignore(projectRoot, [CURSOR_PLUGIN_LINK], dryRun));
|
|
4630
4680
|
return { location, notes };
|
|
4631
4681
|
}
|
|
4632
4682
|
function globalDoctor() {
|
|
4633
4683
|
const location = globalInstallPath();
|
|
4634
4684
|
const errors2 = validateLocalHarnessRepo();
|
|
4635
|
-
errors2.push(...
|
|
4636
|
-
|
|
4637
|
-
if (!fs4.existsSync(marker)) {
|
|
4638
|
-
errors2.push(`Missing Cursor plugin marker file: ${marker}`);
|
|
4639
|
-
}
|
|
4640
|
-
errors2.push(...validatePluginAgents());
|
|
4685
|
+
errors2.push(...validateGitCheckout(location, CURSOR_PLUGIN_MARKER));
|
|
4686
|
+
errors2.push(...validatePluginAgents(location));
|
|
4641
4687
|
return { location, errors: errors2 };
|
|
4642
4688
|
}
|
|
4643
4689
|
function projectDoctor() {
|
|
4644
4690
|
const projectRoot = resolveProjectRoot();
|
|
4645
4691
|
const location = projectInstallPath();
|
|
4646
4692
|
const errors2 = validateLocalHarnessRepo();
|
|
4647
|
-
errors2.push(...
|
|
4648
|
-
const marker = path5.join(location, CURSOR_PLUGIN_MARKER);
|
|
4649
|
-
if (!fs4.existsSync(marker)) {
|
|
4650
|
-
errors2.push(`Missing Cursor plugin marker file: ${marker}`);
|
|
4651
|
-
}
|
|
4693
|
+
errors2.push(...validateGitCheckout(location, CURSOR_PLUGIN_MARKER));
|
|
4652
4694
|
const gitignorePath = path5.join(projectRoot, ".gitignore");
|
|
4653
4695
|
const gitignore = fs4.existsSync(gitignorePath) ? fs4.readFileSync(gitignorePath, "utf8") : "";
|
|
4654
4696
|
if (!gitignore.split(/\r?\n/).includes(CURSOR_PLUGIN_LINK)) {
|
|
4655
4697
|
errors2.push(`Missing .gitignore entry: ${CURSOR_PLUGIN_LINK}`);
|
|
4656
4698
|
}
|
|
4657
|
-
errors2.push(...validatePluginAgents());
|
|
4699
|
+
errors2.push(...validatePluginAgents(location));
|
|
4658
4700
|
return { location, errors: errors2 };
|
|
4659
4701
|
}
|
|
4660
4702
|
var cursorAdapter = {
|