wp-studio 1.7.9 → 1.7.10-beta1
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/cli/{_events-ByiJRMQ1.mjs → _events-MbsmeZ64.mjs} +5 -5
- package/dist/cli/{certificate-manager-Bp1E0km4.mjs → certificate-manager-SVYcCL_i.mjs} +6 -1
- package/dist/cli/{delete-D1lAYFtg.mjs → delete-Br0zEYcv.mjs} +8 -4
- package/dist/cli/{helpers-Bh-WikQr.mjs → helpers-DE340RS-.mjs} +4 -153
- package/dist/cli/{index-CyYXE85k.mjs → index-4lan3TI_.mjs} +24 -4
- package/dist/cli/{index-DBCpWm8k.mjs → index-B-JMTSj2.mjs} +525 -256
- package/dist/cli/{index-BiCiEz-r.mjs → index-upH2G_fw.mjs} +510 -365
- package/dist/cli/{list-COLca0rr.mjs → list-CqctqyGC.mjs} +4 -3
- package/dist/cli/{login-OvZJPTV5.mjs → login-IwZhKWzT.mjs} +3 -3
- package/dist/cli/{logout-BaG-QFSN.mjs → logout-BJ7AzNzE.mjs} +3 -3
- package/dist/cli/main.mjs +2 -2
- package/dist/cli/paths-CqXGLB7R.mjs +195 -0
- package/dist/cli/plugin/.claude-plugin/plugin.json +5 -0
- package/dist/cli/plugin/skills/need-for-speed/SKILL.md +55 -0
- package/dist/cli/plugin/skills/site-spec/SKILL.md +35 -0
- package/dist/cli/plugin/skills/taxonomist/SKILL.md +270 -0
- package/dist/cli/plugin/skills/taxonomist/scripts/apply-changes.php +223 -0
- package/dist/cli/plugin/skills/taxonomist/scripts/backup.php +112 -0
- package/dist/cli/plugin/skills/taxonomist/scripts/export-posts.php +119 -0
- package/dist/cli/plugin/skills/taxonomist/scripts/restore.php +233 -0
- package/dist/cli/process-manager-daemon.mjs +11 -4
- package/dist/cli/{process-manager-ipc-heiF195f.mjs → process-manager-ipc-BisO0qtU.mjs} +1 -1
- package/dist/cli/proxy-daemon.mjs +1 -1
- package/dist/cli/prune-pm-logs-COryxqeo.mjs +41 -0
- package/dist/cli/resume-CNesCmkg.mjs +113 -0
- package/dist/cli/{rewrite-wp-cli-post-content-DH3hRTU5.mjs → rewrite-wp-cli-post-content-2zlfFnKT.mjs} +1 -1
- package/dist/cli/{set-DY9OcXFg.mjs → set-C4J6ru7I.mjs} +3 -3
- package/dist/cli/{set-BX9MWFxi.mjs → set-T8A1lBPU.mjs} +4 -4
- package/dist/cli/{status-CgY39wpU.mjs → status-CPcjT8jc.mjs} +2 -2
- package/dist/cli/{well-known-paths-CG_o9mSO.mjs → well-known-paths-BYA1Bw5o.mjs} +1 -1
- package/dist/cli/wordpress-server-child.mjs +2 -2
- package/dist/cli/{wp-DeUSBbLc.mjs → wp-A9VDe8QE.mjs} +2 -2
- package/dist/cli/wp-files/latest/available-site-translations.json +1 -1
- package/dist/cli/wp-files/skills/STUDIO.md +1 -1
- package/dist/cli/wp-files/skills/studio-cli/SKILL.md +1 -1
- package/package.json +9 -10
- package/patches/@mariozechner+pi-tui+0.54.0.patch +12 -0
- package/scripts/postinstall-npm.mjs +1 -0
- package/dist/cli/paths-BPK_RySX.mjs +0 -31
- package/dist/cli/resume-DshNzC7q.mjs +0 -62
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import fs__default from "fs";
|
|
2
|
-
import { o as socketEventSchema, j as SITE_EVENTS, S as SNAPSHOT_EVENTS, A as AUTH_EVENTS, r as readCliConfig, p as siteDetailsSchema } from "./certificate-manager-
|
|
3
|
-
import { v as isEmptyDir } from "./rewrite-wp-cli-post-content-
|
|
2
|
+
import { o as socketEventSchema, j as SITE_EVENTS, S as SNAPSHOT_EVENTS, A as AUTH_EVENTS, r as readCliConfig, p as siteDetailsSchema } from "./certificate-manager-SVYcCL_i.mjs";
|
|
3
|
+
import { v as isEmptyDir } from "./rewrite-wp-cli-post-content-2zlfFnKT.mjs";
|
|
4
4
|
import { s as sequential } from "./sequential-BQFuixXz.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { M as SITE_EVENTS_SOCKET_PATH, w as SiteCommandLoggerAction, B as connectToDaemon, N as getDaemonBus, O as SITE_PROCESS_PREFIX, J as disconnectFromDaemon, Q as removeSiteFromConfig, m as getSiteUrl, l as isSiteRunning } from "./index-upH2G_fw.mjs";
|
|
6
6
|
import { __ } from "@wordpress/i18n";
|
|
7
|
-
import { g as SocketServer } from "./process-manager-ipc-
|
|
8
|
-
import { L as LoggerError, d as Logger } from "./well-known-paths-
|
|
7
|
+
import { g as SocketServer } from "./process-manager-ipc-BisO0qtU.mjs";
|
|
8
|
+
import { L as LoggerError, d as Logger } from "./well-known-paths-BYA1Bw5o.mjs";
|
|
9
9
|
const logger = new Logger();
|
|
10
10
|
function toSiteDetails(site) {
|
|
11
11
|
return siteDetailsSchema.parse({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs__default from "fs";
|
|
2
2
|
import path__default from "path";
|
|
3
|
-
import { i as commonjsGlobal, g as getDefaultExportFromCjs, k as getConfigDirectory, C as CLI_CONFIG_LOCKFILE_NAME, u as getCliConfigPath, L as LoggerError, a as LOCKFILE_STALE_TIME, b as LOCKFILE_WAIT_TIME, v as getCertificatesPath, w as CERT_UNTRUSTED_ROOT, x as SERVER_AUTH_OID } from "./well-known-paths-
|
|
3
|
+
import { i as commonjsGlobal, g as getDefaultExportFromCjs, k as getConfigDirectory, C as CLI_CONFIG_LOCKFILE_NAME, u as getCliConfigPath, L as LoggerError, a as LOCKFILE_STALE_TIME, b as LOCKFILE_WAIT_TIME, v as getCertificatesPath, w as CERT_UNTRUSTED_ROOT, x as SERVER_AUTH_OID } from "./well-known-paths-BYA1Bw5o.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { execFile } from "child_process";
|
|
6
6
|
import require$$1 from "constants";
|
|
@@ -678,12 +678,17 @@ const updateCheckSchema = z.object({
|
|
|
678
678
|
lastChecked: z.number(),
|
|
679
679
|
latestVersion: z.string()
|
|
680
680
|
});
|
|
681
|
+
const approvedPermissionSchema = z.object({
|
|
682
|
+
toolName: z.string(),
|
|
683
|
+
approvalPath: z.string()
|
|
684
|
+
});
|
|
681
685
|
const cliConfigSchema = z.object({
|
|
682
686
|
version: z.literal(CLI_CONFIG_VERSION),
|
|
683
687
|
sites: z.array(siteSchema).default(() => []),
|
|
684
688
|
snapshots: z.array(snapshotSchema).default(() => []),
|
|
685
689
|
aiProvider: aiProviderSchema.optional(),
|
|
686
690
|
anthropicApiKey: z.string().optional(),
|
|
691
|
+
approvedPermissions: z.array(approvedPermissionSchema).optional(),
|
|
687
692
|
lastBumpStats: z.record(z.string(), z.partialRecord(z.enum(StatsMetric), z.number())).optional(),
|
|
688
693
|
lastDependencyCheckTime: z.number().optional(),
|
|
689
694
|
updateCheck: updateCheckSchema.optional()
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { l as listAiSessions, g as getAiSessionsRootDirectory, d as deleteAiSession } from "./paths-CqXGLB7R.mjs";
|
|
1
2
|
import { __ } from "@wordpress/i18n";
|
|
2
|
-
import { c as chooseSessionForAction
|
|
3
|
-
import { L as LoggerError, d as Logger } from "./well-known-paths-
|
|
3
|
+
import { c as chooseSessionForAction } from "./helpers-DE340RS-.mjs";
|
|
4
|
+
import { L as LoggerError, d as Logger } from "./well-known-paths-BYA1Bw5o.mjs";
|
|
4
5
|
const logger = new Logger();
|
|
5
6
|
async function runCommand(sessionIdOrPrefix) {
|
|
6
7
|
let resolvedSessionIdOrPrefix = sessionIdOrPrefix?.trim();
|
|
@@ -15,13 +16,16 @@ async function runCommand(sessionIdOrPrefix) {
|
|
|
15
16
|
resolvedSessionIdOrPrefix = selectedSession.id;
|
|
16
17
|
}
|
|
17
18
|
if (resolvedSessionIdOrPrefix.toLowerCase() === "latest") {
|
|
18
|
-
const sessions = await listAiSessions();
|
|
19
|
+
const sessions = await listAiSessions(getAiSessionsRootDirectory());
|
|
19
20
|
if (sessions.length === 0) {
|
|
20
21
|
throw new Error(__("No code sessions found"));
|
|
21
22
|
}
|
|
22
23
|
resolvedSessionIdOrPrefix = sessions[0].id;
|
|
23
24
|
}
|
|
24
|
-
const deletedSession = await deleteAiSession(
|
|
25
|
+
const deletedSession = await deleteAiSession(
|
|
26
|
+
getAiSessionsRootDirectory(),
|
|
27
|
+
resolvedSessionIdOrPrefix
|
|
28
|
+
);
|
|
25
29
|
console.log(`${__("Deleted code session")}: ${deletedSession.id}`);
|
|
26
30
|
}
|
|
27
31
|
const registerCommand = (yargs) => {
|
|
@@ -1,154 +1,8 @@
|
|
|
1
1
|
import { select } from "@inquirer/prompts";
|
|
2
2
|
import { visibleWidth, truncateToWidth } from "@mariozechner/pi-tui";
|
|
3
|
+
import { l as listAiSessions, g as getAiSessionsRootDirectory } from "./paths-CqXGLB7R.mjs";
|
|
4
|
+
import { h as chalk } from "./index-upH2G_fw.mjs";
|
|
3
5
|
import { __ } from "@wordpress/i18n";
|
|
4
|
-
import chalk from "chalk";
|
|
5
|
-
import fs from "fs/promises";
|
|
6
|
-
import path__default from "path";
|
|
7
|
-
import { e as extractAiSessionIdFromFilePath, a as getAiSessionsRootDirectory } from "./paths-BPK_RySX.mjs";
|
|
8
|
-
async function readAiSessionSummaryFromEvents(filePath, events) {
|
|
9
|
-
if (events.length === 0) {
|
|
10
|
-
return void 0;
|
|
11
|
-
}
|
|
12
|
-
const linkedAgentSessionIds = [];
|
|
13
|
-
let createdAt;
|
|
14
|
-
let updatedAt;
|
|
15
|
-
let sessionId = extractAiSessionIdFromFilePath(filePath);
|
|
16
|
-
let firstPrompt;
|
|
17
|
-
let selectedSiteName;
|
|
18
|
-
let endReason;
|
|
19
|
-
let eventCount = 0;
|
|
20
|
-
for (const event of events) {
|
|
21
|
-
eventCount += 1;
|
|
22
|
-
updatedAt = event.timestamp;
|
|
23
|
-
if (event.type === "session.started") {
|
|
24
|
-
createdAt = event.timestamp;
|
|
25
|
-
if (event.sessionId.trim().length > 0) {
|
|
26
|
-
sessionId = event.sessionId;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (event.type === "session.linked" && !linkedAgentSessionIds.includes(event.agentSessionId)) {
|
|
30
|
-
linkedAgentSessionIds.push(event.agentSessionId);
|
|
31
|
-
}
|
|
32
|
-
if (event.type === "site.selected") {
|
|
33
|
-
selectedSiteName = event.siteName;
|
|
34
|
-
}
|
|
35
|
-
if (event.type === "user.message" && event.source === "prompt" && !firstPrompt) {
|
|
36
|
-
firstPrompt = event.text;
|
|
37
|
-
}
|
|
38
|
-
if (event.type === "turn.closed") {
|
|
39
|
-
if (event.status === "error") {
|
|
40
|
-
endReason = "error";
|
|
41
|
-
} else if (event.status === "interrupted") {
|
|
42
|
-
endReason = "stopped";
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const stats = await fs.stat(filePath);
|
|
47
|
-
const fallbackTimestamp = stats.mtime.toISOString();
|
|
48
|
-
return {
|
|
49
|
-
id: sessionId,
|
|
50
|
-
filePath,
|
|
51
|
-
createdAt: createdAt ?? fallbackTimestamp,
|
|
52
|
-
updatedAt: updatedAt ?? createdAt ?? fallbackTimestamp,
|
|
53
|
-
agentSessionId: linkedAgentSessionIds[linkedAgentSessionIds.length - 1],
|
|
54
|
-
linkedAgentSessionIds,
|
|
55
|
-
firstPrompt,
|
|
56
|
-
selectedSiteName,
|
|
57
|
-
endReason,
|
|
58
|
-
eventCount
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
async function readAiSessionEventsFromFile(filePath) {
|
|
62
|
-
const content = await fs.readFile(filePath, "utf8");
|
|
63
|
-
const lines = content.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
64
|
-
const events = [];
|
|
65
|
-
for (const line of lines) {
|
|
66
|
-
try {
|
|
67
|
-
events.push(JSON.parse(line));
|
|
68
|
-
} catch {
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return events;
|
|
72
|
-
}
|
|
73
|
-
async function listSessionFilesRecursively(directory) {
|
|
74
|
-
try {
|
|
75
|
-
const entries = await fs.readdir(directory, { withFileTypes: true, encoding: "utf8" });
|
|
76
|
-
const nestedFiles = await Promise.all(
|
|
77
|
-
entries.map(async (entry) => {
|
|
78
|
-
const fullPath = path__default.join(directory, entry.name);
|
|
79
|
-
if (entry.isDirectory()) {
|
|
80
|
-
return listSessionFilesRecursively(fullPath);
|
|
81
|
-
}
|
|
82
|
-
if (entry.isFile() && entry.name.endsWith(".jsonl")) {
|
|
83
|
-
return [fullPath];
|
|
84
|
-
}
|
|
85
|
-
return [];
|
|
86
|
-
})
|
|
87
|
-
);
|
|
88
|
-
return nestedFiles.flat();
|
|
89
|
-
} catch (error) {
|
|
90
|
-
const fsError = error;
|
|
91
|
-
if (fsError.code === "ENOENT") {
|
|
92
|
-
return [];
|
|
93
|
-
}
|
|
94
|
-
throw error;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
async function resolveSessionByIdOrPrefix(sessionIdOrPrefix) {
|
|
98
|
-
const sessions = await listAiSessions();
|
|
99
|
-
const exactMatch = sessions.find((session) => session.id === sessionIdOrPrefix);
|
|
100
|
-
const candidates = exactMatch ? [exactMatch] : sessions.filter((session) => session.id.startsWith(sessionIdOrPrefix));
|
|
101
|
-
if (candidates.length === 0) {
|
|
102
|
-
throw new Error(`Code session not found: ${sessionIdOrPrefix}`);
|
|
103
|
-
}
|
|
104
|
-
if (candidates.length > 1) {
|
|
105
|
-
const sample = candidates.slice(0, 5).map((session) => session.id).join(", ");
|
|
106
|
-
throw new Error(
|
|
107
|
-
`Session id prefix is ambiguous: ${sessionIdOrPrefix}. Matches: ${sample}${candidates.length > 5 ? ", …" : ""}`
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
return candidates[0];
|
|
111
|
-
}
|
|
112
|
-
async function pruneEmptySessionDirectories(startDirectory) {
|
|
113
|
-
const rootDirectory = getAiSessionsRootDirectory();
|
|
114
|
-
let currentDirectory = startDirectory;
|
|
115
|
-
while (currentDirectory.startsWith(rootDirectory + path__default.sep) && currentDirectory !== rootDirectory) {
|
|
116
|
-
try {
|
|
117
|
-
await fs.rmdir(currentDirectory);
|
|
118
|
-
} catch (error) {
|
|
119
|
-
const fsError = error;
|
|
120
|
-
if (fsError.code === "ENOTEMPTY" || fsError.code === "ENOENT") {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
throw error;
|
|
124
|
-
}
|
|
125
|
-
currentDirectory = path__default.dirname(currentDirectory);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
async function listAiSessions() {
|
|
129
|
-
const sessionFiles = await listSessionFilesRecursively(getAiSessionsRootDirectory());
|
|
130
|
-
const results = await Promise.allSettled(
|
|
131
|
-
sessionFiles.map(async (filePath) => {
|
|
132
|
-
const events = await readAiSessionEventsFromFile(filePath);
|
|
133
|
-
return readAiSessionSummaryFromEvents(filePath, events);
|
|
134
|
-
})
|
|
135
|
-
);
|
|
136
|
-
const sessions = results.filter(
|
|
137
|
-
(result) => result.status === "fulfilled"
|
|
138
|
-
).map((result) => result.value).filter((session) => !!session);
|
|
139
|
-
return sessions.sort((a, b) => Date.parse(b.updatedAt) - Date.parse(a.updatedAt));
|
|
140
|
-
}
|
|
141
|
-
async function loadAiSession(sessionIdOrPrefix) {
|
|
142
|
-
const summary = await resolveSessionByIdOrPrefix(sessionIdOrPrefix);
|
|
143
|
-
const events = await readAiSessionEventsFromFile(summary.filePath);
|
|
144
|
-
return { summary, events };
|
|
145
|
-
}
|
|
146
|
-
async function deleteAiSession(sessionIdOrPrefix) {
|
|
147
|
-
const sessionToDelete = await resolveSessionByIdOrPrefix(sessionIdOrPrefix);
|
|
148
|
-
await fs.rm(sessionToDelete.filePath, { force: false });
|
|
149
|
-
await pruneEmptySessionDirectories(path__default.dirname(sessionToDelete.filePath));
|
|
150
|
-
return sessionToDelete;
|
|
151
|
-
}
|
|
152
6
|
function formatSessionTimestamp(timestamp) {
|
|
153
7
|
const parsed = Date.parse(timestamp);
|
|
154
8
|
if (Number.isNaN(parsed)) {
|
|
@@ -301,7 +155,7 @@ async function pickSessionInteractively(sessions, message) {
|
|
|
301
155
|
}
|
|
302
156
|
}
|
|
303
157
|
async function chooseSessionForAction(actionLabel, noSessionsMessage) {
|
|
304
|
-
const sessions = await listAiSessions();
|
|
158
|
+
const sessions = await listAiSessions(getAiSessionsRootDirectory());
|
|
305
159
|
if (sessions.length === 0) {
|
|
306
160
|
console.log(noSessionsMessage);
|
|
307
161
|
return void 0;
|
|
@@ -309,9 +163,6 @@ async function chooseSessionForAction(actionLabel, noSessionsMessage) {
|
|
|
309
163
|
return pickSessionInteractively(sessions, actionLabel);
|
|
310
164
|
}
|
|
311
165
|
export {
|
|
312
|
-
displaySessionsCompact as a,
|
|
313
|
-
loadAiSession as b,
|
|
314
166
|
chooseSessionForAction as c,
|
|
315
|
-
|
|
316
|
-
listAiSessions as l
|
|
167
|
+
displaySessionsCompact as d
|
|
317
168
|
};
|
|
@@ -2,11 +2,13 @@ import { execFile } from "child_process";
|
|
|
2
2
|
import fs__default from "fs";
|
|
3
3
|
import path__default from "path";
|
|
4
4
|
import { confirm } from "@inquirer/prompts";
|
|
5
|
-
import { y as getAppConfigPath, k as getConfigDirectory } from "./well-known-paths-
|
|
5
|
+
import { y as getAppConfigPath, k as getConfigDirectory } from "./well-known-paths-BYA1Bw5o.mjs";
|
|
6
6
|
import { __ } from "@wordpress/i18n";
|
|
7
|
-
import { G as getAppdataDirectory } from "./rewrite-wp-cli-post-content-
|
|
7
|
+
import { G as getAppdataDirectory } from "./rewrite-wp-cli-post-content-2zlfFnKT.mjs";
|
|
8
8
|
import fs from "node:fs";
|
|
9
|
-
import { h as hideDirectoryOnWindows, n as isDirectoryHiddenOnWindows } from "./certificate-manager-
|
|
9
|
+
import { h as hideDirectoryOnWindows, n as isDirectoryHiddenOnWindows } from "./certificate-manager-SVYcCL_i.mjs";
|
|
10
|
+
import os from "node:os";
|
|
11
|
+
import path from "node:path";
|
|
10
12
|
function isInstalledOnMacOs() {
|
|
11
13
|
return new Promise((resolve, reject) => {
|
|
12
14
|
execFile(
|
|
@@ -115,9 +117,27 @@ const hideStudioDirWindows = {
|
|
|
115
117
|
await hideDirectoryOnWindows(getConfigDirectory());
|
|
116
118
|
}
|
|
117
119
|
};
|
|
120
|
+
function getStudioCliHome() {
|
|
121
|
+
return path.join(os.homedir(), ".studio");
|
|
122
|
+
}
|
|
123
|
+
function getLegacyPmHome() {
|
|
124
|
+
return path.join(getStudioCliHome(), "pm2");
|
|
125
|
+
}
|
|
126
|
+
function getNewPmHome() {
|
|
127
|
+
return path.join(getStudioCliHome(), "daemon");
|
|
128
|
+
}
|
|
129
|
+
const renameProcessManagerHome = {
|
|
130
|
+
needsToRun: async () => {
|
|
131
|
+
return fs.existsSync(getLegacyPmHome()) && !fs.existsSync(getNewPmHome());
|
|
132
|
+
},
|
|
133
|
+
run: async () => {
|
|
134
|
+
fs.renameSync(getLegacyPmHome(), getNewPmHome());
|
|
135
|
+
}
|
|
136
|
+
};
|
|
118
137
|
const migrations = [
|
|
119
138
|
checkStudioCompatibilityForInitialMigration,
|
|
120
|
-
hideStudioDirWindows
|
|
139
|
+
hideStudioDirWindows,
|
|
140
|
+
renameProcessManagerHome
|
|
121
141
|
];
|
|
122
142
|
export {
|
|
123
143
|
migrations
|