@augurworks/augur 0.15.2 → 0.15.3

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.
@@ -25,6 +25,7 @@ import { readFile } from "node:fs/promises";
25
25
  import path from "node:path";
26
26
  import { fileURLToPath } from "node:url";
27
27
  import { findShellDir, deployConfig, originHost } from "./lib/instance.mjs";
28
+ import { draftsServed } from "./lib/draft.mjs";
28
29
  import { composePublish, filterLitter, unitPaths } from "./lib/publish-compose.mjs";
29
30
  import { collectEvidence } from "./lib/publish-evidence.mjs";
30
31
  import { stripVolatileHead } from "./lib/publish-conflict.mjs";
@@ -115,6 +116,17 @@ let ORIGIN = (process.env.AUGUR_ORIGIN || DEPLOY_ENV.AUGUR_ORIGIN ||
115
116
  deployConfig(ROOT, originHost(cwdSpaceOrigin)).siteOrigin || cwdSpaceOrigin || "")
116
117
  .replace(/\/+$/, "");
117
118
  if (!ORIGIN) die("no target origin — set AUGUR_ORIGIN, or add \"siteOrigin\" to space.json.");
119
+ // Where the instance serves drafts, a TREE is not what goes live any more: a prototype is
120
+ // changed by opening it and landing it (docs/drafts-that-land.md), and publishing a whole
121
+ // checkout there would put every session's half-done work on the site at once. The engine
122
+ // chrome (`--engine`) is not content and still goes this way.
123
+ if (!ENGINE_ONLY && await draftsServed(ORIGIN)) {
124
+ die(`${ORIGIN} serves drafts, so a prototype is changed by opening it, not by publishing a tree:\n\n` +
125
+ ` augur open <opportunity>/<prototype> # a folder of its own, live at once at its draft address\n` +
126
+ ` …edit; every save is live there…\n` +
127
+ ` augur land # the real URL moves; the last line printed is the live URL\n\n` +
128
+ `A prototype that does not exist yet: augur open --new <opportunity>/<name>. Read agents/drafts.md in the engine clone.`);
129
+ }
118
130
  // A WORKSPACE THAT MOVED answers its old address with a redirect. A checkout that still
119
131
  // names the old address (space.json not yet pulled, a stale AUGUR_ORIGIN) would otherwise
120
132
  // POST through that redirect and read the answer as a bad token. One GET with redirects
@@ -642,6 +654,13 @@ function selfUpdate(why) {
642
654
  if (NO_SELF_UPDATE || selfUpdateTried || process.env.AUGUR_SELF_UPDATED === "1") return false;
643
655
  selfUpdateTried = true;
644
656
  const git = (...a) => execFileSync("git", ["-C", ROOT, ...a], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
657
+ // A package install (`npm i -g @augurworks/augur`, or an `npx` run) has no clone to
658
+ // fast-forward. Say the one line that updates it, in the same place the clone would
659
+ // have updated itself, and let the caller report the skew.
660
+ if (!existsSync(path.join(ROOT, ".git"))) {
661
+ log(`this engine is a package install and is behind what the instance speaks (${why}) — update it: npm i -g @augurworks/augur@latest`);
662
+ return false;
663
+ }
645
664
  try {
646
665
  if (git("rev-parse", "--is-inside-work-tree") !== "true") return false;
647
666
  if (git("status", "--porcelain")) {
package/scripts/read.mjs CHANGED
@@ -4,8 +4,7 @@
4
4
  // refuses edits there. `augur close` inside it removes it. See docs/drafts-that-land.md §7.
5
5
  import path from "node:path";
6
6
  import { target } from "./lib/store.mjs";
7
- import { markPathFor } from "./lib/marks.mjs";
8
- import { unitClient, doRead, readDirFor } from "./lib/draft.mjs";
7
+ import { unitClient, doRead, readDirFor, unitPathFor } from "./lib/draft.mjs";
9
8
  import { normUnit } from "../src/unit-core.mjs";
10
9
 
11
10
  const log = (m) => console.error(`\x1b[35m[read]\x1b[0m ${m}`);
@@ -15,7 +14,7 @@ const opt = (n) => { const i = argv.indexOf(n); return i > -1 ? argv[i + 1] : nu
15
14
  const positional = argv.filter((a, i) => !a.startsWith("--") && !(i > 0 && argv[i - 1].startsWith("--")));
16
15
  const raw = positional[0];
17
16
  if (!raw) die("name a prototype: `augur read <opportunity>/<prototype>`.");
18
- const unit = normUnit(markPathFor(raw) || raw);
17
+ const unit = normUnit(unitPathFor(raw) || raw);
19
18
  if (!unit) die(`"${raw}" is not a prototype path.`);
20
19
  let origin, token;
21
20
  try { ({ origin, token } = target({ needToken: true })); } catch (e) { die(e.message); }
@@ -16,7 +16,6 @@ import { execFileSync } from "node:child_process";
16
16
  import { existsSync, readFileSync, readdirSync } from "node:fs";
17
17
  import path from "node:path";
18
18
  import { resolveOrigin, resolveToken, apiClient, buildStamp, ENGINE_ROOT } from "./lib/store.mjs";
19
- import { fetchMarks, markLine } from "./lib/marks.mjs";
20
19
  import { registryList, unitClient, draftsReport } from "./lib/draft.mjs";
21
20
 
22
21
  const args = process.argv.slice(2);
@@ -123,28 +122,11 @@ console.log("");
123
122
  console.log(` ${C.dim}engine chrome ${eng.sha ? eng.sha.slice(0, 12) : "—"}` +
124
123
  `${eng.version ? ` (v${eng.version})` : ""}${eng.publishedAt ? ` · shipped ${eng.publishedAt}` : ""}${C.off}`);
125
124
 
126
- // ── who is working where, right now ─────────────────────────────────────────
127
- //
128
- // `F-presence-marks`. The three numbers above answer "is what I have what is live"; they
129
- // cannot answer "is somebody else in here", and that is the question that decides whether
130
- // the next hour of work is going to be merged or forked.
131
- //
132
- // NEEDS A TOKEN and does not ask for one. `status` has always been the command that runs
133
- // with nothing configured — the build stamp is public — so a missing credential quietly
134
- // costs the marks section and nothing else. It affects the exit code in no way: marks
135
- // refuse nothing, and a mark is not a problem.
136
- const markToken = resolveToken(origin);
137
- if (markToken) {
138
- const marks = await fetchMarks(apiClient(origin, markToken));
139
- if (marks.length) {
140
- console.log("");
141
- console.log(` ${C.dim}being worked on right now${C.off}`);
142
- for (const m of marks) console.log(` ${C.dim} ${markLine(m)}${C.off}`);
143
- }
144
- } else {
145
- // The one thing a fresh agent needs to know and has no other way to learn: this machine
146
- // holds no token, and the way to get one is pairing, not a password. Same words as the
147
- // instance's own /llms.txt. Costs nothing here — status never needed the token.
125
+ // ── not paired? say how, once ───────────────────────────────────────────────
126
+ // The one thing a fresh agent needs to know and has no other way to learn: this machine
127
+ // holds no token, and the way to get one is pairing, not a password. Same words as the
128
+ // instance's own /llms.txt. Costs nothing here status never needed the token.
129
+ if (!resolveToken(origin)) {
148
130
  console.log("");
149
131
  console.log(` ${C.dim}not paired with ${origin}. Publishing from here needs a token; get one without a password:${C.off}`);
150
132
  console.log(` ${C.dim} augur connect --origin ${origin} (the owner approves a code in a signed-in browser)${C.off}`);