@vibedropio/publisher 0.22.8 → 0.23.0
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "git-publisher",
|
|
3
3
|
"displayName": "Git Publisher",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.23.0",
|
|
5
5
|
"description": "Publish an app folder to the platform and keep it updated (\"publish my app\", \"update my app\", \"fetch the engineered version\").",
|
|
6
6
|
"author": { "name": "VibeDrop" },
|
|
7
7
|
"keywords": ["git", "publish", "deploy", "serverless"]
|
|
@@ -28,7 +28,7 @@ Every command accepts `--json` and prints exactly one JSON object on stdout. Exi
|
|
|
28
28
|
publisher --version
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
If the command is not found, or the version is older than 0.
|
|
31
|
+
If the command is not found, or the version is older than 0.23.0, install it:
|
|
32
32
|
`npm install -g @vibedropio/publisher@latest` (it needs Node.js 22 (22.12 or later) or Node.js 24). In a Claude Cowork task
|
|
33
33
|
this is normal: the sandbox starts empty every time, so install it without asking. On the person's
|
|
34
34
|
own computer, say in one line that you are installing the publisher. If `npm` itself is missing,
|
|
@@ -111,7 +111,7 @@ then `publisher start <starter> --replaces "<what it replaces>"`.
|
|
|
111
111
|
To say where the folder stands without changing anything:
|
|
112
112
|
|
|
113
113
|
```bash
|
|
114
|
-
publisher
|
|
114
|
+
publisher checkout-status . --json # state + hint; exit 2 means conflict
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
| state | meaning | what to do |
|
package/dist/publisher.cjs
CHANGED
|
@@ -20732,7 +20732,7 @@ async function writeAssociation(repoDir, a) {
|
|
|
20732
20732
|
await setConfig(repoDir, "publisher.remote", a.remote);
|
|
20733
20733
|
}
|
|
20734
20734
|
|
|
20735
|
-
// ../client/src/folder/
|
|
20735
|
+
// ../client/src/folder/checkout.ts
|
|
20736
20736
|
var import_promises2 = require("node:fs/promises");
|
|
20737
20737
|
var import_node_path2 = require("node:path");
|
|
20738
20738
|
var import_node_crypto2 = require("node:crypto");
|
|
@@ -20903,10 +20903,10 @@ async function listPending(repoDir) {
|
|
|
20903
20903
|
return (await openPending(repoDir)).list();
|
|
20904
20904
|
}
|
|
20905
20905
|
|
|
20906
|
-
// ../client/src/folder/
|
|
20907
|
-
var NS = "publisher.
|
|
20906
|
+
// ../client/src/folder/checkout.ts
|
|
20907
|
+
var NS = "publisher.checkout";
|
|
20908
20908
|
var PARTIAL_MARKER = ".gitpub-checkout.json";
|
|
20909
|
-
async function
|
|
20909
|
+
async function getCheckoutMapping(directory) {
|
|
20910
20910
|
const dir = (0, import_node_path2.resolve)(directory);
|
|
20911
20911
|
const section = await getConfigSection(dir, "publisher").catch(() => null);
|
|
20912
20912
|
if (!section) {
|
|
@@ -20945,10 +20945,10 @@ async function writeMapping(dir, m) {
|
|
|
20945
20945
|
await setConfig(dir, `${NS}.checkedoutat`, m.checkedOutAt);
|
|
20946
20946
|
await setConfig(dir, `${NS}.baseadvancedat`, m.baseAdvancedAt);
|
|
20947
20947
|
}
|
|
20948
|
-
async function
|
|
20949
|
-
const m = await
|
|
20948
|
+
async function advanceCheckoutBase(directory, next, now = /* @__PURE__ */ new Date()) {
|
|
20949
|
+
const m = await getCheckoutMapping(directory);
|
|
20950
20950
|
if (!m) {
|
|
20951
|
-
throw new PublisherError("LOCAL_STATE", "not a
|
|
20951
|
+
throw new PublisherError("LOCAL_STATE", "not a checkout (no publisher.checkout mapping)");
|
|
20952
20952
|
}
|
|
20953
20953
|
if (next.generation < m.baseGeneration) {
|
|
20954
20954
|
return m;
|
|
@@ -20966,7 +20966,7 @@ async function noteAcceptedPublication(directory, outcome2, now = /* @__PURE__ *
|
|
|
20966
20966
|
if (outcome2.state !== "accepted" || outcome2.resultGeneration === null) {
|
|
20967
20967
|
return;
|
|
20968
20968
|
}
|
|
20969
|
-
const m = await
|
|
20969
|
+
const m = await getCheckoutMapping(directory).catch(() => null);
|
|
20970
20970
|
if (!m || m.repoId !== outcome2.repoId) {
|
|
20971
20971
|
return;
|
|
20972
20972
|
}
|
|
@@ -20974,11 +20974,11 @@ async function noteAcceptedPublication(directory, outcome2, now = /* @__PURE__ *
|
|
|
20974
20974
|
if (!oid) {
|
|
20975
20975
|
return;
|
|
20976
20976
|
}
|
|
20977
|
-
await
|
|
20977
|
+
await advanceCheckoutBase(directory, { oid, generation: outcome2.resultGeneration }, now);
|
|
20978
20978
|
}
|
|
20979
|
-
async function
|
|
20979
|
+
async function adoptCheckout(client, directory, call2 = {}, now = /* @__PURE__ */ new Date()) {
|
|
20980
20980
|
const dir = (0, import_node_path2.resolve)(directory);
|
|
20981
|
-
const existing = await
|
|
20981
|
+
const existing = await getCheckoutMapping(dir);
|
|
20982
20982
|
if (existing) {
|
|
20983
20983
|
return existing;
|
|
20984
20984
|
}
|
|
@@ -21023,7 +21023,7 @@ async function adoptWorkspace(client, directory, call2 = {}, now = /* @__PURE__
|
|
|
21023
21023
|
checkedOutAt: now.toISOString(),
|
|
21024
21024
|
baseAdvancedAt: now.toISOString()
|
|
21025
21025
|
});
|
|
21026
|
-
return await
|
|
21026
|
+
return await getCheckoutMapping(dir);
|
|
21027
21027
|
}
|
|
21028
21028
|
async function isEmptyDir(p) {
|
|
21029
21029
|
try {
|
|
@@ -21066,7 +21066,7 @@ async function removeStalePartials(target, repoId) {
|
|
|
21066
21066
|
}
|
|
21067
21067
|
return removed;
|
|
21068
21068
|
}
|
|
21069
|
-
async function
|
|
21069
|
+
async function createCheckout(client, opts, call2 = {}, now = /* @__PURE__ */ new Date()) {
|
|
21070
21070
|
const target = (0, import_node_path2.resolve)(opts.directory);
|
|
21071
21071
|
const remote = opts.remote ?? "publisher";
|
|
21072
21072
|
const empty2 = await isEmptyDir(target);
|
|
@@ -21123,7 +21123,7 @@ async function checkoutWorkspace(client, opts, call2 = {}, now = /* @__PURE__ */
|
|
|
21123
21123
|
}
|
|
21124
21124
|
throw e;
|
|
21125
21125
|
}
|
|
21126
|
-
return await
|
|
21126
|
+
return await getCheckoutMapping(target);
|
|
21127
21127
|
}
|
|
21128
21128
|
async function isAncestor(dir, ancestor, descendant) {
|
|
21129
21129
|
const r = await runGit(["merge-base", "--is-ancestor", ancestor, descendant], { cwd: dir, allowFailure: true });
|
|
@@ -21133,9 +21133,9 @@ async function countCommits(dir, range) {
|
|
|
21133
21133
|
const r = await runGit(["rev-list", "--count", range], { cwd: dir, allowFailure: true });
|
|
21134
21134
|
return r.code === 0 ? Number(r.stdout.toString("utf8").trim()) : 0;
|
|
21135
21135
|
}
|
|
21136
|
-
async function
|
|
21136
|
+
async function inspectCheckout(client, directory, call2 = {}) {
|
|
21137
21137
|
const dir = (0, import_node_path2.resolve)(directory);
|
|
21138
|
-
const mapping = await
|
|
21138
|
+
const mapping = await getCheckoutMapping(dir);
|
|
21139
21139
|
const pending = await listPending(dir).catch(() => []);
|
|
21140
21140
|
if (!mapping) {
|
|
21141
21141
|
return {
|
|
@@ -21145,7 +21145,7 @@ async function inspectWorkspace(client, directory, call2 = {}) {
|
|
|
21145
21145
|
remote: null,
|
|
21146
21146
|
pending,
|
|
21147
21147
|
conflicts: [],
|
|
21148
|
-
hint: "not a
|
|
21148
|
+
hint: "not a checkout yet; run sync here (an associated folder adopts itself), or checkout to create one"
|
|
21149
21149
|
};
|
|
21150
21150
|
}
|
|
21151
21151
|
const branchRef = `refs/heads/${mapping.branch}`;
|
|
@@ -21168,7 +21168,7 @@ async function inspectWorkspace(client, directory, call2 = {}) {
|
|
|
21168
21168
|
if (checkedOut !== mapping.branch && !(checkedOut === null && head === null && tip === null)) {
|
|
21169
21169
|
return done(
|
|
21170
21170
|
"detached",
|
|
21171
|
-
checkedOut === null ? `HEAD is detached at ${head?.slice(0, 12) ?? "unknown"}; check out ${mapping.branch} (git checkout ${mapping.branch}) before syncing or publishing` : `branch ${checkedOut} is checked out, the
|
|
21171
|
+
checkedOut === null ? `HEAD is detached at ${head?.slice(0, 12) ?? "unknown"}; check out ${mapping.branch} (git checkout ${mapping.branch}) before syncing or publishing` : `branch ${checkedOut} is checked out, the checkout tracks ${mapping.branch}; check it out before syncing or publishing`
|
|
21172
21172
|
);
|
|
21173
21173
|
}
|
|
21174
21174
|
if (!remoteOid) {
|
|
@@ -21210,16 +21210,16 @@ async function inspectWorkspace(client, directory, call2 = {}) {
|
|
|
21210
21210
|
}
|
|
21211
21211
|
return done(
|
|
21212
21212
|
"conflict",
|
|
21213
|
-
`both sides changed ${merge2.conflicts.map((c) => c.path).join(", ")}; resolve with git merge ${remoteOid} in the
|
|
21213
|
+
`both sides changed ${merge2.conflicts.map((c) => c.path).join(", ")}; resolve with git merge ${remoteOid} in the checkout, then publish`,
|
|
21214
21214
|
merge2.conflicts.map((c) => c.path)
|
|
21215
21215
|
);
|
|
21216
21216
|
}
|
|
21217
|
-
async function
|
|
21217
|
+
async function syncCheckout(client, opts, call2 = {}, now = /* @__PURE__ */ new Date()) {
|
|
21218
21218
|
const dir = (0, import_node_path2.resolve)(opts.directory);
|
|
21219
|
-
await
|
|
21220
|
-
const before = await
|
|
21219
|
+
await adoptCheckout(client, dir, call2, now);
|
|
21220
|
+
const before = await inspectCheckout(client, dir, call2);
|
|
21221
21221
|
if (!before.mapping) {
|
|
21222
|
-
throw new PublisherError("LOCAL_STATE", "not a
|
|
21222
|
+
throw new PublisherError("LOCAL_STATE", "not a checkout; run checkout");
|
|
21223
21223
|
}
|
|
21224
21224
|
const mapping = before.mapping;
|
|
21225
21225
|
const branchRef = `refs/heads/${mapping.branch}`;
|
|
@@ -21246,10 +21246,10 @@ async function syncWorkspace(client, opts, call2 = {}, now = /* @__PURE__ */ new
|
|
|
21246
21246
|
if (before.remote?.oid) {
|
|
21247
21247
|
const tipNow = await revParse(dir, branchRef);
|
|
21248
21248
|
if (tipNow && (tipNow === before.remote.oid || await isAncestor(dir, before.remote.oid, tipNow))) {
|
|
21249
|
-
updated = await
|
|
21249
|
+
updated = await advanceCheckoutBase(dir, { oid: before.remote.oid, generation: before.remote.generation }, now);
|
|
21250
21250
|
}
|
|
21251
21251
|
}
|
|
21252
|
-
const after = applied ? (await
|
|
21252
|
+
const after = applied ? (await inspectCheckout(client, dir, call2)).state : before.state;
|
|
21253
21253
|
return { before, applied, mapping: updated, after };
|
|
21254
21254
|
}
|
|
21255
21255
|
|
|
@@ -23346,26 +23346,26 @@ var Publisher = class {
|
|
|
23346
23346
|
await noteAcceptedPublication(options.repoDir, outcome2);
|
|
23347
23347
|
return outcome2;
|
|
23348
23348
|
}
|
|
23349
|
-
// ----
|
|
23350
|
-
/** Create a NEW editable
|
|
23349
|
+
// ---- checkouts (docs/archive/checkout-parity.md) -------------------------------------------------
|
|
23350
|
+
/** Create a NEW editable checkout (clone + mapping) for a published repository. */
|
|
23351
23351
|
async checkout(options, call2 = {}) {
|
|
23352
|
-
return
|
|
23352
|
+
return createCheckout(this, options, call2);
|
|
23353
23353
|
}
|
|
23354
|
-
/** Make an associated folder a
|
|
23355
|
-
async
|
|
23356
|
-
return
|
|
23354
|
+
/** Make an associated folder a checkout (idempotent); `init` and `sync` both call it. */
|
|
23355
|
+
async adoptCheckout(directory, call2 = {}) {
|
|
23356
|
+
return adoptCheckout(this, directory, call2);
|
|
23357
23357
|
}
|
|
23358
|
-
/** Offline: the persisted
|
|
23359
|
-
async
|
|
23360
|
-
return
|
|
23358
|
+
/** Offline: the persisted checkout mapping, or null. */
|
|
23359
|
+
async checkoutMapping(directory) {
|
|
23360
|
+
return getCheckoutMapping(directory);
|
|
23361
23361
|
}
|
|
23362
|
-
/** Where the
|
|
23363
|
-
async
|
|
23364
|
-
return
|
|
23362
|
+
/** Where the checkout stands relative to the server (decided on real objects). */
|
|
23363
|
+
async checkoutStatus(directory, call2 = {}) {
|
|
23364
|
+
return inspectCheckout(this, directory, call2);
|
|
23365
23365
|
}
|
|
23366
23366
|
/** Fetch and, with `apply`, fast-forward or merge cleanly; advances the base. */
|
|
23367
23367
|
async sync(options, call2 = {}) {
|
|
23368
|
-
return
|
|
23368
|
+
return syncCheckout(this, options, call2);
|
|
23369
23369
|
}
|
|
23370
23370
|
/**
|
|
23371
23371
|
* A creator's whole round trip in one call, so nobody runs git: record their changes, bring in
|
|
@@ -23373,8 +23373,8 @@ var Publisher = class {
|
|
|
23373
23373
|
* having published nothing, on a conflict; the recorded commit stays, so nothing is lost.
|
|
23374
23374
|
*
|
|
23375
23375
|
* Everything that can refuse without touching the folder refuses first: a folder with no
|
|
23376
|
-
* association (or one pinned elsewhere) and a HEAD off the
|
|
23377
|
-
* a commit and then an error. `
|
|
23376
|
+
* association (or one pinned elsewhere) and a HEAD off the checkout branch would otherwise get
|
|
23377
|
+
* a commit and then an error. `syncCheckout` itself still never commits or publishes; this is
|
|
23378
23378
|
* the composition, and the only one.
|
|
23379
23379
|
*/
|
|
23380
23380
|
async syncChanges(options, call2 = {}) {
|
|
@@ -23384,12 +23384,12 @@ var Publisher = class {
|
|
|
23384
23384
|
if (!branch) {
|
|
23385
23385
|
throw new PublisherError("LOCAL_STATE", "HEAD is detached; check out the branch this folder publishes, then run sync again");
|
|
23386
23386
|
}
|
|
23387
|
-
const mapped = await
|
|
23387
|
+
const mapped = await getCheckoutMapping(dir);
|
|
23388
23388
|
if (mapped && mapped.branch !== branch) {
|
|
23389
23389
|
throw new PublisherError("LOCAL_STATE", `branch ${branch} is checked out, but this folder publishes ${mapped.branch}; check it out, then run sync again`);
|
|
23390
23390
|
}
|
|
23391
23391
|
const recorded = await recordChanges({ dir, ...options.message ? { message: options.message } : {} });
|
|
23392
|
-
const reconciled = await
|
|
23392
|
+
const reconciled = await syncCheckout(this, { directory: dir, apply: true }, call2);
|
|
23393
23393
|
const base = { recorded: { commit: recorded.commit, committed: recorded.committed, excluded: recorded.excluded }, reconciled };
|
|
23394
23394
|
if (reconciled.after === "conflict") {
|
|
23395
23395
|
const remote = reconciled.before.remote?.oid ?? null;
|
|
@@ -24309,7 +24309,7 @@ async function finish(ctx, got, clock) {
|
|
|
24309
24309
|
isDefault: named !== null && file2.defaultProfile === named,
|
|
24310
24310
|
server: caps.server,
|
|
24311
24311
|
credentialsFile: path,
|
|
24312
|
-
// Which setting chose that path: a sandbox that keeps only
|
|
24312
|
+
// Which setting chose that path: a sandbox that keeps only one folder needs it to be in that folder.
|
|
24313
24313
|
credentialsFrom: credentialsLocation().from,
|
|
24314
24314
|
timings
|
|
24315
24315
|
});
|
|
@@ -24613,14 +24613,14 @@ async function linkFolder(inv, p, endpoint, dir, attach) {
|
|
|
24613
24613
|
await p.getRepository(repoId);
|
|
24614
24614
|
}
|
|
24615
24615
|
await p.associate(dir, repoId);
|
|
24616
|
-
const
|
|
24616
|
+
const checkout2 = await p.adoptCheckout(dir).catch(() => null);
|
|
24617
24617
|
return {
|
|
24618
24618
|
repoId,
|
|
24619
24619
|
appId,
|
|
24620
24620
|
created: attach.repoId === void 0,
|
|
24621
24621
|
placement,
|
|
24622
24622
|
onboarding: onboarding ? { commit: onboarding.commit, committed: onboarding.committed.length, excluded: onboarding.excluded } : null,
|
|
24623
|
-
|
|
24623
|
+
checkout: checkout2 === null ? null : { branch: checkout2.branch, baseOid: checkout2.baseOid, baseGeneration: checkout2.baseGeneration }
|
|
24624
24624
|
};
|
|
24625
24625
|
}
|
|
24626
24626
|
|
|
@@ -25149,7 +25149,7 @@ function syncHint(state, conflicts, marked) {
|
|
|
25149
25149
|
}
|
|
25150
25150
|
}
|
|
25151
25151
|
|
|
25152
|
-
// src/commands/
|
|
25152
|
+
// src/commands/checkout.ts
|
|
25153
25153
|
var fetch2 = {
|
|
25154
25154
|
git: true,
|
|
25155
25155
|
async run(inv) {
|
|
@@ -25171,16 +25171,16 @@ var checkout = {
|
|
|
25171
25171
|
const { p } = await inv.client();
|
|
25172
25172
|
const branch = inv.str("branch");
|
|
25173
25173
|
const m = await p.checkout({ directory: dir, repoId, ...branch ? { branch } : {} }, { onProgress: inv.progress });
|
|
25174
|
-
inv.out({ ok: true,
|
|
25174
|
+
inv.out({ ok: true, checkout: m });
|
|
25175
25175
|
return 0;
|
|
25176
25176
|
}
|
|
25177
25177
|
};
|
|
25178
|
-
var
|
|
25178
|
+
var checkoutStatus = {
|
|
25179
25179
|
git: true,
|
|
25180
25180
|
async run(inv) {
|
|
25181
25181
|
const dir = inv.dirArg(1);
|
|
25182
25182
|
const { p } = await inv.client(dir);
|
|
25183
|
-
const s = await p.
|
|
25183
|
+
const s = await p.checkoutStatus(dir, { onProgress: inv.progress });
|
|
25184
25184
|
inv.out(s);
|
|
25185
25185
|
return s.state === "conflict" ? 2 : 0;
|
|
25186
25186
|
}
|
|
@@ -25393,15 +25393,15 @@ Usage:
|
|
|
25393
25393
|
publisher init [dir] [--name <name>] [--repo <id>] [--cell <cell>]
|
|
25394
25394
|
create (or attach to) a repository, associate this folder; --cell names
|
|
25395
25395
|
where a new app runs
|
|
25396
|
-
and record it as a
|
|
25396
|
+
and record it as a checkout (so sync works here)
|
|
25397
25397
|
publisher publish [dir] [--ref <ref>]... [--force] [--no-wait] publish commits as they are; to save and publish
|
|
25398
25398
|
a change, use sync
|
|
25399
25399
|
publisher status [dir] [--publication <id>] resolve pending/interrupted publications
|
|
25400
25400
|
publisher fetch [dir]
|
|
25401
25401
|
publisher list [--archived] [--after <next>] the apps you published, newest first, each with the
|
|
25402
25402
|
checkout command that brings it into a new folder
|
|
25403
|
-
publisher checkout <dir> --repo <id> [--branch <name>] create a NEW editable
|
|
25404
|
-
publisher
|
|
25403
|
+
publisher checkout <dir> --repo <id> [--branch <name>] create a NEW editable checkout (never overlays a folder)
|
|
25404
|
+
publisher checkout-status [dir] offline mapping + where the checkout stands (real three-way check)
|
|
25405
25405
|
publisher sync [dir] [--message <text>] [--name <app>] THE way to publish: a folder linked to nothing first gets its
|
|
25406
25406
|
application and repository (what init does); then it records the
|
|
25407
25407
|
changes (never .env, keys or node_modules), brings in what
|
|
@@ -25480,7 +25480,7 @@ var COMMANDS = /* @__PURE__ */ new Map([
|
|
|
25480
25480
|
["fetch", fetch2],
|
|
25481
25481
|
["list", list],
|
|
25482
25482
|
["checkout", checkout],
|
|
25483
|
-
["
|
|
25483
|
+
["checkout-status", checkoutStatus],
|
|
25484
25484
|
["sync", sync],
|
|
25485
25485
|
["follow", follow],
|
|
25486
25486
|
["question", question],
|