Skip to content

Commit f171bd1

Browse files
committed
Sync commands, scripts, skills: add port-to-opencode.sh, update convention-sync to include scripts dir, update author skill with node-over-python principle
1 parent 09a8058 commit f171bd1

File tree

10 files changed

+701
-6
lines changed

10 files changed

+701
-6
lines changed

.cursor/commands/convention-sync.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
# convention-sync.sh — Sync ~/.cursor/ files with the edge-conventions repo.
33
# Usage: ./convention-sync.sh <repo-dir> [--stage] [--commit -m "message"] [--repo-to-user]
4-
# Compares ~/.cursor/{commands,rules,skills} against <repo-dir>/.cursor/ and
4+
# Compares ~/.cursor/{commands,rules,skills,scripts} against <repo-dir>/.cursor/ and
55
# outputs a structured JSON summary of new, modified, and deleted files.
66
# With --stage: copies changed files and stages them in git (or copies to user dir with --repo-to-user).
77
# With --commit: stages + commits (requires -m). Only valid for user-to-repo direction.
@@ -36,7 +36,7 @@ fi
3636

3737
USER_DIR="$HOME/.cursor"
3838
REPO_CURSOR="$REPO_DIR/.cursor"
39-
DIRS="commands rules skills"
39+
DIRS="commands rules skills scripts"
4040
SYNCIGNORE="$USER_DIR/.syncignore"
4141

4242
# Load ignore patterns from .syncignore (one glob per line, # comments, blank lines skipped)

.cursor/commands/edge-repo.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,19 @@ function ghGraphql(query, variables = {}) {
133133
return parsed.data;
134134
}
135135

136+
function installAndPrepare(repoDir) {
137+
const script = path.join(__dirname, "install-deps.sh");
138+
execSync(`"${script}" "${repoDir}"`, { stdio: "inherit" });
139+
}
140+
136141
module.exports = {
137142
getRepoDir,
138143
getUpstreamBranch,
139144
runGit,
140145
parseConflictFiles,
141146
isChangelogOnly,
142147
runVerification,
148+
installAndPrepare,
143149
ghApi,
144150
ghGraphql,
145151
};

.cursor/commands/im.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ After Step 0 determines the target repo (or if no Asana task, use the current re
3636
- **On the correct feature branch**: Continue.
3737
3. **Branch naming**: `$GIT_BRANCH_PREFIX/<short-description>` or `$GIT_BRANCH_PREFIX/fix/<short-description>` for bug fixes. Use kebab-case. Example: `<prefix>/some-feature` or `<prefix>/fix/some-bug`
3838
4. **Assume a new branch is needed** unless the current branch clearly matches the task. Do NOT ask for confirmation — the existing branch has its own committed work and is unaffected.
39+
5. **Install dependencies**: After creating or switching to the feature branch, run `~/.cursor/commands/install-deps.sh` to ensure dependencies match the base branch state.
3940

4041
If the task spans multiple repos, note the additional repos but implement in the primary repo first.
4142
</step>

.cursor/commands/install-deps.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# install-deps.sh — Install dependencies and run prepare script.
5+
# Usage: install-deps.sh [repo-dir]
6+
#
7+
# Runs `yarn install` and `yarn prepare` (if prepare script exists in package.json).
8+
# Use after: branch creation, rebase onto upstream, checkout.
9+
#
10+
# Exit codes:
11+
# 0 = Success (or no package.json — skipped)
12+
# 1 = Install or prepare failed
13+
14+
repo_dir="${1:-.}"
15+
16+
if [ ! -f "$repo_dir/package.json" ]; then
17+
echo "⏭ No package.json — skipping dependency install" >&2
18+
exit 0
19+
fi
20+
21+
echo "Installing dependencies..." >&2
22+
(cd "$repo_dir" && yarn install)
23+
24+
if (cd "$repo_dir" && node -e "process.exit(require('./package.json').scripts?.prepare ? 0 : 1)" 2>/dev/null); then
25+
echo "Running prepare..." >&2
26+
(cd "$repo_dir" && yarn prepare)
27+
fi
28+
29+
echo "✓ Dependencies installed and prepared" >&2

.cursor/commands/pr-land-merge.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const {
3535
isChangelogOnly,
3636
runVerification,
3737
ghApi,
38+
installAndPrepare,
3839
} = require(path.join(__dirname, "edge-repo.js"));
3940

4041
function sanitizeBranchLabel(branch) {
@@ -287,6 +288,21 @@ async function main() {
287288

288289
console.error("✓ Rebase complete");
289290

291+
// STEP 1b: Install dependencies and prepare after rebase
292+
try {
293+
installAndPrepare(repoDir);
294+
} catch (e) {
295+
console.error(`✗ Dependency install failed: ${e.message}`);
296+
results.failed.push({
297+
repo,
298+
prNumber,
299+
branch,
300+
success: false,
301+
message: `Dependency install failed: ${e.message}`,
302+
});
303+
continue;
304+
}
305+
290306
// STEP 2: Push rebased branch
291307
console.error("Pushing rebased branch...");
292308
const pushResult = runGit(

.cursor/commands/pr-land-prepare.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const {
2828
parseConflictFiles,
2929
isChangelogOnly,
3030
runVerification,
31+
installAndPrepare,
3132
} = require(path.join(__dirname, "edge-repo.js"));
3233

3334
function describeBranchState(repoDir, branch) {
@@ -148,7 +149,16 @@ async function prepareBranch(repo, branch) {
148149

149150
console.error("✓ Rebase complete");
150151

151-
// Step 5: Run verification (lint scoped to files changed vs upstream)
152+
// Step 5: Install dependencies and prepare
153+
try {
154+
installAndPrepare(repoDir);
155+
} catch (e) {
156+
result.status = "install_failed";
157+
result.message = `Dependency install failed: ${e.message}`;
158+
return result;
159+
}
160+
161+
// Step 6: Run verification (lint scoped to files changed vs upstream)
152162
console.error("\nRunning verification...");
153163
const verifyResult = runVerification(repoDir, upstream);
154164

.cursor/commands/pr-land-publish.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
const { execSync } = require("child_process");
2626
const { existsSync, readFileSync, writeFileSync } = require("fs");
2727
const path = require("path");
28-
const { getRepoDir, runGit: _runGit } = require(path.join(__dirname, "edge-repo.js"));
28+
const { getRepoDir, runGit: _runGit, installAndPrepare } = require(path.join(__dirname, "edge-repo.js"));
2929

3030
// Thin wrapper: publish only needs the stdout string from runGit
3131
function runGit(args, cwd) {
@@ -173,8 +173,8 @@ async function publishRepo(repo, branch) {
173173
// Run verification
174174
console.error("\nRunning verification...");
175175
try {
176-
execSync("yarn install && yarn prepare", { cwd: repoDir, stdio: "inherit" });
177-
176+
installAndPrepare(repoDir);
177+
178178
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
179179
if (pkg.scripts?.verify) {
180180
execSync("yarn verify", { cwd: repoDir, stdio: "inherit" });

0 commit comments

Comments
 (0)