deployai 0.1.0-beta.41 → 0.1.0-beta.42
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/dist/index.js +118 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -23232,8 +23232,8 @@ function addPageTags(site, page3, path) {
|
|
|
23232
23232
|
for (const text2 of page3.events) if (!site.events.some((x) => x.text === text2)) site.events.push({ text: text2, page: path });
|
|
23233
23233
|
for (const v of page3.verification) if (!site.verification.some((x) => x.service === v.service && x.value === v.value)) site.verification.push({ ...v, page: path });
|
|
23234
23234
|
for (const f of page3.forms) {
|
|
23235
|
-
const
|
|
23236
|
-
if (!
|
|
23235
|
+
const same3 = site.forms.some((x) => x.id === f.id && x.action === f.action && x.classes === f.classes);
|
|
23236
|
+
if (!same3 && site.forms.length < FORMS_KEPT) site.forms.push({ ...f, page: path });
|
|
23237
23237
|
}
|
|
23238
23238
|
}
|
|
23239
23239
|
function addBrowserRequests(site, urls, siteUrl) {
|
|
@@ -23476,7 +23476,80 @@ function moveQuestions(r) {
|
|
|
23476
23476
|
function dashboardParts(r) {
|
|
23477
23477
|
return [...r.forms.length ? ["forms"] : [], ...r.pages.some((p) => p.type === "post") ? ["blog"] : []];
|
|
23478
23478
|
}
|
|
23479
|
+
var SAME_AS_QUESTION = { serverPixel: /conversions api|server.?side|server pixel/i, thankYou: /thank.?you/i, verificationFile: /search console/i };
|
|
23480
|
+
var GROUP_ORDER = ["notPossible", "partly", "replaced", "moved"];
|
|
23481
|
+
function moveWaiting(r, answers) {
|
|
23482
|
+
const keys = moveQuestions(r);
|
|
23483
|
+
const rows2 = r.features.map((f) => {
|
|
23484
|
+
const [prefix, state] = FEATURE_STATES.find(([s]) => f.status.toLowerCase().startsWith(s)) ?? ["", "partly"];
|
|
23485
|
+
return { name: f.name.replace(/\s*\(tags\.json\)/gi, "").trim(), state, detail: f.status.slice(prefix.length).trim() || null, note: f.note ?? null };
|
|
23486
|
+
});
|
|
23487
|
+
const askedBy = (row2) => keys.find((k) => SAME_AS_QUESTION[k].test(row2.name));
|
|
23488
|
+
const waiting = (row2) => row2.state === "needsYou" || row2.state === "outside";
|
|
23489
|
+
const questions = keys.map((key2) => ({ key: key2, answer: answers[key2] ?? null, note: rows2.find((row2) => waiting(row2) && askedBy(row2) === key2)?.note ?? null }));
|
|
23490
|
+
const todo = rows2.filter((row2) => waiting(row2) && !askedBy(row2));
|
|
23491
|
+
const listed = [...r.outside.map((o) => o.host), ...r.tags.map((t) => TAG_CATALOG.find((c) => c.key === t.key)?.name ?? t.key)].map((s) => s.toLowerCase());
|
|
23492
|
+
const elsewhere = (row2) => row2.state === "moved" && listed.some((s) => row2.name.toLowerCase().includes(s));
|
|
23493
|
+
const groups = GROUP_ORDER.map((state) => ({ state, rows: rows2.filter((row2) => row2.state === state && !elsewhere(row2)) })).filter((g) => g.rows.length);
|
|
23494
|
+
return { questions, todo, count: questions.filter((q) => !q.answer).length + todo.length, groups };
|
|
23495
|
+
}
|
|
23496
|
+
var same = (a) => (b) => a.key === b.key && sameTagId(a.key, a.id, b.id);
|
|
23497
|
+
function planLineFor(features, names) {
|
|
23498
|
+
const want = names.filter((n2) => n2 && n2.length > 2).map((n2) => n2.toLowerCase());
|
|
23499
|
+
for (const f of features ?? []) {
|
|
23500
|
+
const name = f.name.toLowerCase();
|
|
23501
|
+
if (!want.some((w) => name.includes(w))) continue;
|
|
23502
|
+
const [prefix, state] = FEATURE_STATES.find(([st]) => f.status.toLowerCase().startsWith(st)) ?? ["", "partly"];
|
|
23503
|
+
return { state, detail: f.status.slice(prefix.length).trim() || null, note: f.note ?? null };
|
|
23504
|
+
}
|
|
23505
|
+
return null;
|
|
23506
|
+
}
|
|
23479
23507
|
var tagRowKey = (t) => `${t.key}|${t.id ?? ""}`;
|
|
23508
|
+
function tagRows(r, opts = {}) {
|
|
23509
|
+
const rows2 = [];
|
|
23510
|
+
for (const t of r.tags) {
|
|
23511
|
+
const entry = TAG_CATALOG.find((c) => c.key === t.key);
|
|
23512
|
+
if (!entry) continue;
|
|
23513
|
+
const removed = r.verify?.removed.some((x) => [t.id ?? "", t.key, entry.name].some((w) => w && x.toLowerCase() === w.toLowerCase()));
|
|
23514
|
+
const plan = planLineFor(r.features, [entry.name, t.key]);
|
|
23515
|
+
const replaced = plan?.state === "replaced" && !r.verify?.seen.some(same(t));
|
|
23516
|
+
const inPages = t.source === "page";
|
|
23517
|
+
const onLive = opts.live?.some(same(t));
|
|
23518
|
+
const status = replaced ? "replaced" : removed ? "removed" : opts.live && !onLive && inPages ? "missing" : opts.confirmed?.[tagRowKey(t)] ? "confirmed" : onLive ? "live" : r.verify?.fired?.some(same(t)) ? "fired" : r.verify?.seen.some(same(t)) ? "preview" : r.verify && inPages ? "missing" : t.source === "container" ? "container" : t.source === "browser" ? "browser" : "found";
|
|
23519
|
+
rows2.push({ key: t.key, name: entry.name, kind: entry.kind, id: t.id, source: t.source, pages: t.pages, pageCount: t.pageCount, domainLocked: Boolean(entry.domainLocked), checkUrl: entry.checkUrl ?? null, status, ...status === "replaced" ? { replacedBy: plan?.detail ?? null } : {} });
|
|
23520
|
+
}
|
|
23521
|
+
const order = ["missing", "found", "container", "browser", "preview", "fired", "live", "confirmed", "replaced", "removed"];
|
|
23522
|
+
return rows2.sort((a, b) => order.indexOf(a.status) - order.indexOf(b.status) || a.name.localeCompare(b.name));
|
|
23523
|
+
}
|
|
23524
|
+
function pageOpened(v, path) {
|
|
23525
|
+
if (!v) return null;
|
|
23526
|
+
const trim = (p) => p.replace(/\/+$/, "");
|
|
23527
|
+
if (v.pageFindings) return !v.pageFindings.some((f) => trim(f.path) === trim(path));
|
|
23528
|
+
return v.pageProblems === 0 ? true : null;
|
|
23529
|
+
}
|
|
23530
|
+
function selfChecks(r, opts = {}) {
|
|
23531
|
+
const confirmed = opts.confirmed ?? {};
|
|
23532
|
+
const out2 = [];
|
|
23533
|
+
const add = (c) => {
|
|
23534
|
+
if (!out2.some((x) => x.key === c.key)) out2.push({ ...c, done: confirmed[c.key] ?? null });
|
|
23535
|
+
};
|
|
23536
|
+
if (!r.verify) return out2;
|
|
23537
|
+
const rows2 = tagRows(r, opts);
|
|
23538
|
+
const kept = (t) => ["preview", "fired", "live", "confirmed"].includes(t.status);
|
|
23539
|
+
for (const t of rows2) {
|
|
23540
|
+
if (t.status === "replaced") add({ key: `self|replaced|${tagRowKey(t)}`, kind: "replaced", name: t.name, detail: t.replacedBy ?? null, checkUrl: null });
|
|
23541
|
+
else if (kept(t) && t.checkUrl && t.key !== "ua") add({ key: tagRowKey(t), kind: "arrive", name: t.name, detail: t.id, checkUrl: t.checkUrl });
|
|
23542
|
+
else if (kept(t) && (t.kind === "chat" || t.kind === "calls")) add({ key: `self|tap|${tagRowKey(t)}`, kind: "tap", name: t.name, detail: t.id, checkUrl: null });
|
|
23543
|
+
}
|
|
23544
|
+
if (r.forms.some((f) => f.id !== "commentform") || (r.kit?.forms.length ?? 0) > 0) add({ key: "self|form", kind: "form", name: r.kit?.forms[0]?.label ?? "", detail: null, checkUrl: null });
|
|
23545
|
+
for (const o of r.outside) {
|
|
23546
|
+
if (outsideService(o.host)) continue;
|
|
23547
|
+
const plan = planLineFor(r.features, [o.host]);
|
|
23548
|
+
add({ key: `self|outside|${o.host}`, kind: "outside", name: o.host, detail: plan ? [plan.detail, plan.note].filter(Boolean).join(". ") || null : null, checkUrl: null });
|
|
23549
|
+
}
|
|
23550
|
+
for (const p of r.kit?.pages ?? []) if (pageOpened(r.verify, p.path) === null) add({ key: `self|page|${p.path}`, kind: "page", name: p.path, detail: p.title, checkUrl: null });
|
|
23551
|
+
return out2;
|
|
23552
|
+
}
|
|
23480
23553
|
|
|
23481
23554
|
// ../shared/src/env-scopes.ts
|
|
23482
23555
|
var ENV_KEYS = {
|
|
@@ -23670,6 +23743,7 @@ var KEEP_DATA_RULES = [
|
|
|
23670
23743
|
"Never delete the old database, files or storage service."
|
|
23671
23744
|
];
|
|
23672
23745
|
var AGENT_POINTER = "Read DEPLOYAI.md before your first answer and before you write code, change the plan or add a dependency: this project is published with DeployAI.";
|
|
23746
|
+
var SITE_COPY_RULE = "Words on the site: write each language from what a visitor must know, the way a native writer of that language says it, never word for word from another language. Read each page alone in its own language: if it sounds translated, rewrite it. Keep one term for each thing in every language (when .deployai/glossary.md exists, use its terms and add new ones to it), and dates, prices, phone numbers and addresses in the local form of that language. Never reword text the owner wrote without asking. When you wrote a language you are not sure of, or a legal page, say in one line that a native speaker should read it.";
|
|
23673
23747
|
var FOLDER_READY_RULE = `This folder is already set up. When the owner has not asked for anything yet, say only, in their language: "The folder is set up and ready. What do you want to change?" Add the site's name when .deployai/project.json has it. If the folder has no site files yet, ask instead: "The folder is set up and ready. What do you want to build?" Never ask them for a start line, a command or an id. While the folder holds a site, never offer a sample or a new start: go on with that site.`;
|
|
23674
23748
|
|
|
23675
23749
|
// ../shared/src/deployai-md.ts
|
|
@@ -23723,6 +23797,10 @@ ${ASK_OWNER_RULE}
|
|
|
23723
23797
|
|
|
23724
23798
|
Never stop building for an account, a plan or a limit. Build what the owner asks; say once, in one plain line, what going live will need, and ask about it only at the deploy step.
|
|
23725
23799
|
|
|
23800
|
+
## Words on the site
|
|
23801
|
+
|
|
23802
|
+
${SITE_COPY_RULE}
|
|
23803
|
+
|
|
23726
23804
|
## A site's first version
|
|
23727
23805
|
|
|
23728
23806
|
${FIRST_SITE_RULE}
|
|
@@ -23759,7 +23837,8 @@ var DEPLOYAI_LATER_RULES = [
|
|
|
23759
23837
|
{ has: "deployai@latest feedback", text: AGENT_FEEDBACK_RULES.join(" ") },
|
|
23760
23838
|
{ has: "never been live", text: FIRST_SITE_RULE },
|
|
23761
23839
|
{ has: "local preview", text: LOCAL_PREVIEW_RULE },
|
|
23762
|
-
{ has: "git history", text: GIT_HISTORY_RULE }
|
|
23840
|
+
{ has: "git history", text: GIT_HISTORY_RULE },
|
|
23841
|
+
{ has: "never word for word", text: SITE_COPY_RULE }
|
|
23763
23842
|
];
|
|
23764
23843
|
function parseLaterRules(json2) {
|
|
23765
23844
|
try {
|
|
@@ -25107,7 +25186,7 @@ function formatBytes(n2) {
|
|
|
25107
25186
|
}
|
|
25108
25187
|
|
|
25109
25188
|
// src/version.ts
|
|
25110
|
-
var CLI_VERSION = "0.1.0-beta.
|
|
25189
|
+
var CLI_VERSION = "0.1.0-beta.42";
|
|
25111
25190
|
|
|
25112
25191
|
// src/api.ts
|
|
25113
25192
|
function apiContext(apiFlag, root) {
|
|
@@ -27386,7 +27465,38 @@ async function sendReport(root, ctx, host, open2, verify) {
|
|
|
27386
27465
|
const browser = firstTime ? openBrowser(url2) : false;
|
|
27387
27466
|
out();
|
|
27388
27467
|
out(`Move report for the owner${browser ? " (opened in the browser)" : ""}: ${url2}`);
|
|
27389
|
-
if (firstTime) out("Give the owner this link in one line. It
|
|
27468
|
+
if (firstTime) out("Give the owner this link in one line. It only shows what we found and what moved, and it updates by itself: anything that needs the owner, you ask in the chat.");
|
|
27469
|
+
if (open2 === "verify") for (const line of reportAsksLines(report2)) out(line);
|
|
27470
|
+
}
|
|
27471
|
+
var ASK_WORDS = {
|
|
27472
|
+
serverPixel: "Does the site send conversions to Meta or Google from the server?",
|
|
27473
|
+
thankYou: "Does a page open after sending the form, and what is its address?",
|
|
27474
|
+
verificationFile: "Was the site verified in Google Search Console with a file, and what is its name?"
|
|
27475
|
+
};
|
|
27476
|
+
function reportAsksLines(report2) {
|
|
27477
|
+
const tries = selfChecks(report2).map((c) => {
|
|
27478
|
+
const id = c.detail ? ` (${c.detail})` : "";
|
|
27479
|
+
switch (c.kind) {
|
|
27480
|
+
case "replaced":
|
|
27481
|
+
return `${c.name}: now ${c.detail ?? "ours"}. Try that it does the same job on the preview.`;
|
|
27482
|
+
case "arrive":
|
|
27483
|
+
return `${c.name}${id}: open the preview, then see the visit arrive in ${c.name}.`;
|
|
27484
|
+
case "form":
|
|
27485
|
+
return "The form: send one test message from the preview and see it arrive by email and in the dashboard, Messages.";
|
|
27486
|
+
case "tap":
|
|
27487
|
+
return `${c.name}${id}: tap it once on a phone and see the chat or call open with the right number.`;
|
|
27488
|
+
case "outside":
|
|
27489
|
+
return `${c.name}: a service our checks do not cover. See that its part of the page works on the preview.`;
|
|
27490
|
+
case "page":
|
|
27491
|
+
return `${c.name}: open this address on the preview.`;
|
|
27492
|
+
}
|
|
27493
|
+
});
|
|
27494
|
+
const waiting = moveWaiting(report2, report2.answers ?? {});
|
|
27495
|
+
const asks = [...waiting.todo.map((f) => `${f.name}${f.note ? `: ${f.note}` : ""}`), ...waiting.questions.filter((q) => !q.answer).map((q) => `${ASK_WORDS[q.key]} npx deployai@latest migrate tags --answer ${q.key}=yes|no|unsure`)];
|
|
27496
|
+
const lines = [];
|
|
27497
|
+
if (tries.length) lines.push("", `The report lists ${tries.length} things for the owner to try on the preview. In the same message as the link, name each in plain words, one short line each, and say they tick them on the site's Move tab:`, ...tries.map((x) => ` ${x}`));
|
|
27498
|
+
if (asks.length) lines.push("", "The report says these wait for the owner. Ask about each in the chat now, so nothing on the report is new to them:", ...asks.map((x) => ` ${x}`));
|
|
27499
|
+
return lines;
|
|
27390
27500
|
}
|
|
27391
27501
|
async function migrateScanCommand(root, raw, opts = {}) {
|
|
27392
27502
|
const source = normalizeSourceUrl(raw);
|
|
@@ -28365,7 +28475,7 @@ function filesOf(gz) {
|
|
|
28365
28475
|
}
|
|
28366
28476
|
return map2;
|
|
28367
28477
|
}
|
|
28368
|
-
var
|
|
28478
|
+
var same2 = (a, b) => a === void 0 && b === void 0 || a !== void 0 && b !== void 0 && a.equals(b);
|
|
28369
28479
|
var isBinary = (b) => !!b && b.subarray(0, 8e3).includes(0);
|
|
28370
28480
|
function migrationNumber(path) {
|
|
28371
28481
|
const m = /(^|\/)migrations\/(\d+)[_-][^/]*\.sql$/i.exec(path);
|
|
@@ -28440,8 +28550,8 @@ async function syncCommand(root, ctx) {
|
|
|
28440
28550
|
const b = baseFiles.get(path);
|
|
28441
28551
|
const l = liveFiles.get(path);
|
|
28442
28552
|
const o = ourFiles.get(path);
|
|
28443
|
-
if (
|
|
28444
|
-
if (
|
|
28553
|
+
if (same2(o, l) || same2(l, b)) continue;
|
|
28554
|
+
if (same2(o, b)) {
|
|
28445
28555
|
write(path, l);
|
|
28446
28556
|
taken++;
|
|
28447
28557
|
continue;
|