semantu-agents 1.2.1 → 1.2.2

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.
Files changed (3) hide show
  1. package/README.md +3 -3
  2. package/cli.mjs +30 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -23,13 +23,13 @@ For normal users, rerun:
23
23
  npx semantu-agents global
24
24
  ```
25
25
 
26
- For contributors with an editable checkout at `~/.agents-src`, run:
26
+ For contributors with an editable checkout at `~/.agents-src`, run this from anywhere:
27
27
 
28
28
  ```bash
29
- semantu-agents update
29
+ npx semantu-agents update
30
30
  ```
31
31
 
32
- This pulls `~/.agents-src` and syncs it to `~/.claude/skills` and `~/.agents/skills`.
32
+ This updates `~/.agents-src/main`, syncs it to `~/.claude/skills` and `~/.agents/skills`, then restores your previous branch when possible. If `~/.agents-src` has uncommitted changes, commit or stash them first.
33
33
 
34
34
  ## Contributing Skill Changes
35
35
 
package/cli.mjs CHANGED
@@ -24,6 +24,10 @@ function run(cmd, opts) {
24
24
  return execSync(cmd, {stdio: 'inherit', ...opts});
25
25
  }
26
26
 
27
+ function output(cmd, opts) {
28
+ return execSync(cmd, {encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], ...opts}).trim();
29
+ }
30
+
27
31
  function cloneOrPull(dir) {
28
32
  if (existsSync(path.join(dir, '.git'))) {
29
33
  console.log('Updating agents repo...');
@@ -34,6 +38,15 @@ function cloneOrPull(dir) {
34
38
  }
35
39
  }
36
40
 
41
+ function cloneIfMissing(dir) {
42
+ if (existsSync(path.join(dir, '.git'))) {
43
+ console.log('Using existing editable agents repo at ~/.agents-src');
44
+ } else {
45
+ console.log('Cloning agents repo...');
46
+ run(`git clone ${skillsRepo} ${dir}`);
47
+ }
48
+ }
49
+
37
50
  function globalTargets() {
38
51
  const home = homedir();
39
52
  return [
@@ -89,7 +102,7 @@ cd "$(git rev-parse --show-toplevel)" && node cli.mjs sync
89
102
  function setupDev() {
90
103
  const srcDir = path.join(homedir(), '.agents-src');
91
104
 
92
- cloneOrPull(srcDir);
105
+ cloneIfMissing(srcDir);
93
106
  installPostMergeHook(srcDir);
94
107
  syncFromSource(srcDir, '~/.agents-src');
95
108
 
@@ -109,8 +122,23 @@ function updateDevCheckout() {
109
122
  process.exit(1);
110
123
  }
111
124
 
112
- cloneOrPull(srcDir);
125
+ const currentBranch = output('git branch --show-current', {cwd: srcDir});
126
+ const dirty = output('git status --porcelain', {cwd: srcDir});
127
+
128
+ if (dirty) {
129
+ console.log('Cannot update ~/.agents-src because it has uncommitted changes.');
130
+ console.log('Commit, stash, or discard them, then rerun `npx semantu-agents update`.');
131
+ process.exit(1);
132
+ }
133
+
134
+ run('git fetch origin main', {cwd: srcDir});
135
+ run('git switch main', {cwd: srcDir});
136
+ run('git pull --ff-only origin main', {cwd: srcDir});
113
137
  syncFromSource(srcDir, '~/.agents-src');
138
+
139
+ if (currentBranch && currentBranch !== 'main') {
140
+ run(`git switch ${currentBranch}`, {cwd: srcDir});
141
+ }
114
142
  }
115
143
 
116
144
  function setupProject() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semantu-agents",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Reusable Claude Code skills and hooks for Semantu projects",
5
5
  "type": "module",
6
6
  "bin": "cli.mjs",