@alori/cli 0.1.4 → 0.1.5

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/lib/git.mjs CHANGED
@@ -57,12 +57,25 @@ export function ensureIgnored(dir, lines) {
57
57
  export function hadChanges(dir) {
58
58
  if (repoOf(dir) !== "own") return false;
59
59
  try {
60
- return git(dir, ["status", "--porcelain"]).trim() !== "";
60
+ // The .gitignore comes fresh with every pull, and a file it now leaves out stops being tracked in the pull's commit.
61
+ const alorisOwn = new Set([".gitignore", ...trackedIgnored(dir)]);
62
+ return git(dir, ["status", "--porcelain", "-z"])
63
+ .split("\0")
64
+ .filter(Boolean)
65
+ .some((entry) => !alorisOwn.has(entry.slice(3)));
61
66
  } catch {
62
67
  return false;
63
68
  }
64
69
  }
65
70
 
71
+ /**
72
+ * Tracked files the .gitignore now leaves out, such as the route tree an older pull committed. The pull's commit stops
73
+ * tracking them; they stay on disk.
74
+ */
75
+ function trackedIgnored(dir) {
76
+ return git(dir, ["ls-files", "-ci", "--exclude-standard", "-z"]).split("\0").filter(Boolean);
77
+ }
78
+
66
79
  /**
67
80
  * A pull into a folder pulled before it had git: starts the repository with Alori's version alone as its first commit,
68
81
  * built from the folder `snapshot()` makes (the downloaded code), so the person's own edits in `dir` show as changes on top of it, never
@@ -101,6 +114,8 @@ export function commitPull(dir, version, { hadChanges }) {
101
114
  console.log("Your folder had changes not committed, so this pull isn't a commit of its own. Commit when ready.");
102
115
  return;
103
116
  }
117
+ const stale = trackedIgnored(dir);
118
+ if (stale.length > 0) git(dir, ["rm", "--cached", "-q", "--", ...stale]);
104
119
  git(dir, ["add", "-A"]);
105
120
  if (git(dir, ["status", "--porcelain"]).trim() === "") return;
106
121
  git(dir, ["commit", "-q", "-m", `Pulled version ${version} from Alori`]);
package/lib/sync.mjs CHANGED
@@ -72,8 +72,25 @@ function copyInto(from, to, path) {
72
72
  copyFileSync(join(from, path), join(to, path));
73
73
  }
74
74
 
75
- /** Kept out of git: installed packages, builds, secrets, the pull snapshot and the copies a pull puts beside files. */
76
- const ignoreLines = ["node_modules/", `${stateDir}/`, "dist/", ".output/", ".tanstack/", ".vercel/", ".env*", "*.alori-theirs", "*.alori-mine"];
75
+ /**
76
+ * Kept out of git: installed packages, builds, secrets, the pull snapshot and the copies a pull puts beside files, plus
77
+ * what this computer makes on its own: the lockfile the install writes, the route tree the dev server regenerates for
78
+ * the app's own pages, and macOS's folder files. Left tracked, a fresh pull shows changes nobody made.
79
+ */
80
+ const ignoreLines = [
81
+ "node_modules/",
82
+ `${stateDir}/`,
83
+ "dist/",
84
+ ".output/",
85
+ ".tanstack/",
86
+ ".vercel/",
87
+ ".env*",
88
+ "*.alori-theirs",
89
+ "*.alori-mine",
90
+ "pnpm-lock.yaml",
91
+ "src/routeTree.gen.ts",
92
+ ".DS_Store",
93
+ ];
77
94
 
78
95
  /** pnpm 11 stops `pnpm install` until each package's build script is allowed or refused. */
79
96
  const workspaceFile = `allowBuilds:
@@ -153,6 +170,8 @@ function snapshotOf(dir, folder, temp) {
153
170
  async function pullOver(dir, state, me) {
154
171
  const { folder, temp, version } = await download();
155
172
  const repo = startRepoFrom(dir, () => snapshotOf(dir, folder, temp), version);
173
+ // The ignore list first, so what this computer generated (the lockfile, .DS_Store) doesn't count as the person's changes.
174
+ ensureIgnored(dir, ignoreLines);
156
175
  const uncommitted = hadChanges(dir);
157
176
  const lockBefore = fileHash(dir, "pnpm-lock.yaml");
158
177
  const code = mergeInto(dir, folder, new Set([...Object.keys(codeHashes(folder)), ...Object.keys(codeHashes(dir)), ...Object.keys(state.hashes)]), state.hashes);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alori/cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Build your Alori app with your own Claude Code: pull its code, change it, push it back.",
5
5
  "type": "module",
6
6
  "bin": {