@remits/remits-cli 0.1.69 → 0.1.71

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 +1 -1
  2. package/index.js +35 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -63,7 +63,7 @@ remits-cli install --skills --overwrite true
63
63
  - Guide sync requires authentication. If no valid session exists and the terminal is interactive, the CLI auto-authenticates first; in non-interactive contexts (CI, agent sandboxes) it skips silently so guides are only ever delivered to users who can authenticate to the platform.
64
64
  - During account-repo discovery, `remits-cli` also overwrites the installed remits-cli `SKILL.md` for `claude`, `codex`, and `gemini` so local agents stay on the latest packaged instructions.
65
65
  - The platform repo's `docs/guides/` tree remains the single source of truth; the platform serves it from the classpath, so published CLI versions never carry guide content.
66
- - Authenticated users also get the **core Remits platform repo** locally. After guide sync (and on `auth` / discovery), `remits-cli` ensures `git@github.com:tmillhouse/remits.git` is cloned (default `~/remits`, override with `REMITS_PLATFORM_DIR`; cloning only runs in an interactive terminal). On each authenticated run it also fast-forwards the repo (`git pull --ff-only`, once per process) so back-stage analysis runs against current code — skipped automatically if the working tree is dirty, so local work is never clobbered. The clone is tracked in `~/.remits-cli/account-repos.json` under the reserved `platform` entry so agents can analyze back-stage seams and open a fix PR when a front-stage failure turns out to be platform brittleness. An existing copy found during a `remits-cli start` scan (or the running CLI source in dev) is recorded instead of cloning a duplicate.
66
+ - Authenticated users also get the **core Remits platform repo** locally. After guide sync (and on `auth` / discovery), `remits-cli` first reuses any existing local copy it already knows about, can detect directly (`REMITS_PLATFORM_DIR`, the running CLI source in dev, `~/remits`), or can discover under the configured scan roots; only if none is found does it clone `git@github.com:tmillhouse/remits.git` (default `~/remits`, override with `REMITS_PLATFORM_DIR`; cloning only runs in an interactive terminal). On each authenticated run it also fast-forwards the repo (`git pull --ff-only`, once per process) so back-stage analysis runs against current code — skipped automatically if the working tree is dirty, so local work is never clobbered. The repo is tracked in `~/.remits-cli/account-repos.json` under the reserved `platform` entry so agents can analyze back-stage seams and open a fix PR when a front-stage failure turns out to be platform brittleness.
67
67
  - Branch defaults to the current local git branch.
68
68
  - Data mode defaults to `test`. Use `remits-cli data-mode set prod` only for production investigation.
69
69
  - Test activity is streamed from websocket `TestSuite` events while final status is also polled from `/cli/test`.
package/index.js CHANGED
@@ -707,6 +707,16 @@ function looksLikePlatformRepo(dir) {
707
707
  }
708
708
  }
709
709
 
710
+ function findPlatformRepoInScanRoots() {
711
+ const platformMatches = [];
712
+ const visited = new Set();
713
+ const roots = defaultAccountScanRoots();
714
+ for (const root of roots) {
715
+ walkForAccountInfo(root, 0, [], visited, platformMatches);
716
+ }
717
+ return platformMatches.find(looksLikePlatformRepo) || null;
718
+ }
719
+
710
720
  function getPlatformRepoEntry(index) {
711
721
  const idx = index || readAccountRepoIndex();
712
722
  const entry = idx[PLATFORM_REPO_INVENTORY_KEY];
@@ -727,6 +737,17 @@ function setPlatformRepoEntry(directory, source) {
727
737
  return index[PLATFORM_REPO_INVENTORY_KEY];
728
738
  }
729
739
 
740
+ function readGitRemoteUrl(dir, remoteName) {
741
+ try {
742
+ return execSync(
743
+ 'git -C ' + shellQuote(dir) + ' remote get-url ' + shellQuote(remoteName),
744
+ { stdio: ['ignore', 'pipe', 'ignore'] }
745
+ ).toString().trim();
746
+ } catch (_) {
747
+ return null;
748
+ }
749
+ }
750
+
730
751
  // Fast-forward an existing platform repo so back-stage analysis runs against
731
752
  // up-to-date code. Best-effort and safe: skips a dirty tree (never clobbers
732
753
  // local work) and uses --ff-only so it no-ops rather than creating merge
@@ -743,6 +764,11 @@ function maybePullPlatformRepo(dir, options) {
743
764
  console.log('[platform] Skipping git pull: ' + dir + ' has uncommitted changes.');
744
765
  return;
745
766
  }
767
+ const originUrl = readGitRemoteUrl(dir, 'origin');
768
+ if (originUrl && originUrl !== PLATFORM_REPO_GIT_URL) {
769
+ console.log('[platform] Found Remits platform repo at ' + dir + ', but its origin remote is ' + originUrl + ' (expected ' + PLATFORM_REPO_GIT_URL + ').');
770
+ console.log('[platform] Fix it with: git -C ' + dir + ' remote set-url origin ' + PLATFORM_REPO_GIT_URL);
771
+ }
746
772
  console.log('[platform] Updating Remits platform repo (git pull)...');
747
773
  execSync('git -C ' + shellQuote(dir) + ' pull --ff-only', { stdio: 'inherit' });
748
774
  } catch (err) {
@@ -778,6 +804,15 @@ function ensurePlatformRepoLocal(options = {}) {
778
804
  }
779
805
  }
780
806
 
807
+ // 2b. Bounded local scan so a manually cloned repo (for example `~/Code/remits`)
808
+ // is discovered and reused before we fall back to cloning `~/remits`.
809
+ const scanned = findPlatformRepoInScanRoots();
810
+ if (scanned) {
811
+ setPlatformRepoEntry(scanned, 'scan');
812
+ maybePullPlatformRepo(scanned, options);
813
+ return scanned;
814
+ }
815
+
781
816
  // 3. Clone it (one-time, interactive only).
782
817
  if (!options.allowClone || PLATFORM_REPO_CLONE_ATTEMPTED) {
783
818
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remits/remits-cli",
3
- "version": "0.1.69",
3
+ "version": "0.1.71",
4
4
  "description": "Local CLI for auth, component sync, and live test execution against Remits",
5
5
  "license": "MIT",
6
6
  "private": false,