@poli-page/cli 0.8.2 → 0.9.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.
- package/README.md +98 -20
- package/dist/api-client.d.ts +1 -15
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +54 -26
- package/dist/api-client.js.map +1 -1
- package/dist/commands/dev.d.ts +100 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +593 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/init.d.ts +42 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +153 -10
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/link.d.ts +8 -0
- package/dist/commands/link.d.ts.map +1 -1
- package/dist/commands/link.js +21 -13
- package/dist/commands/link.js.map +1 -1
- package/dist/commands/versions.d.ts +0 -8
- package/dist/commands/versions.d.ts.map +1 -1
- package/dist/commands/versions.js +0 -57
- package/dist/commands/versions.js.map +1 -1
- package/dist/commands/watch.d.ts +1 -1
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +14 -123
- package/dist/commands/watch.js.map +1 -1
- package/dist/credentials.d.ts.map +1 -1
- package/dist/credentials.js +15 -3
- package/dist/credentials.js.map +1 -1
- package/dist/dev-page.d.ts +22 -0
- package/dist/dev-page.d.ts.map +1 -0
- package/dist/dev-page.js +336 -0
- package/dist/dev-page.js.map +1 -0
- package/dist/dev-server.d.ts +51 -0
- package/dist/dev-server.d.ts.map +1 -0
- package/dist/dev-server.js +228 -0
- package/dist/dev-server.js.map +1 -0
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/exit-codes.js +3 -2
- package/dist/exit-codes.js.map +1 -1
- package/dist/manifest.schema.d.ts +1 -1
- package/dist/manifest.schema.d.ts.map +1 -1
- package/dist/manifest.schema.js +7 -12
- package/dist/manifest.schema.js.map +1 -1
- package/dist/program.js +2 -2
- package/dist/program.js.map +1 -1
- package/dist/project-sync.d.ts +49 -0
- package/dist/project-sync.d.ts.map +1 -0
- package/dist/project-sync.js +164 -0
- package/dist/project-sync.js.map +1 -0
- package/dist/template-importer.d.ts +15 -0
- package/dist/template-importer.d.ts.map +1 -1
- package/dist/template-importer.js +44 -0
- package/dist/template-importer.js.map +1 -1
- package/package.json +3 -3
- package/dist/commands/checkout.d.ts +0 -15
- package/dist/commands/checkout.d.ts.map +0 -1
- package/dist/commands/checkout.js +0 -145
- package/dist/commands/checkout.js.map +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type IncomingMessage, type ServerResponse } from 'node:http';
|
|
2
|
+
/**
|
|
3
|
+
* Loopback only. `poli dev` serves the rendered *draft* of a private
|
|
4
|
+
* project; binding to 0.0.0.0 would publish it to the local network.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEV_SERVER_HOST = "127.0.0.1";
|
|
7
|
+
/**
|
|
8
|
+
* Default port for `poli dev`.
|
|
9
|
+
*
|
|
10
|
+
* 7654 is `poli` spelled on a phone keypad (P=7, O=6, L=5, I=4). It sits
|
|
11
|
+
* in the unassigned range, well clear of the ports the popular front-end
|
|
12
|
+
* dev servers grab (3000, 4200, 4321, 5173, 8080), so `poli dev` can run
|
|
13
|
+
* next to them in the same `concurrently` block without a fight. When it
|
|
14
|
+
* is busy anyway the server walks upwards (7655, 7656, …).
|
|
15
|
+
*/
|
|
16
|
+
export declare const DEFAULT_DEV_PORT = 7654;
|
|
17
|
+
export interface DevServerRequest {
|
|
18
|
+
method: string;
|
|
19
|
+
pathname: string;
|
|
20
|
+
query: URLSearchParams;
|
|
21
|
+
req: IncomingMessage;
|
|
22
|
+
res: ServerResponse;
|
|
23
|
+
}
|
|
24
|
+
export interface DevServerOptions {
|
|
25
|
+
/** First port to try. Subsequent ports are tried on EADDRINUSE. */
|
|
26
|
+
port?: number;
|
|
27
|
+
maxPortAttempts?: number;
|
|
28
|
+
host?: string;
|
|
29
|
+
/** Path serving the Server-Sent Events stream. */
|
|
30
|
+
eventsPath?: string;
|
|
31
|
+
handleRequest: (request: DevServerRequest) => Promise<void> | void;
|
|
32
|
+
}
|
|
33
|
+
export interface DevServer {
|
|
34
|
+
readonly port: number;
|
|
35
|
+
readonly url: string;
|
|
36
|
+
/** Number of browsers currently attached to the SSE stream. */
|
|
37
|
+
readonly clientCount: number;
|
|
38
|
+
broadcast(event: string, payload: unknown): void;
|
|
39
|
+
close(): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Minimal `node:http` server with a Server-Sent Events channel.
|
|
43
|
+
*
|
|
44
|
+
* Everything except the SSE endpoint is delegated to `handleRequest`;
|
|
45
|
+
* this module owns only the transport concerns — port selection, the
|
|
46
|
+
* event stream, heartbeats, and a shutdown that actually terminates
|
|
47
|
+
* (SSE responses are long-lived, so `server.close()` alone would hang
|
|
48
|
+
* forever waiting for them).
|
|
49
|
+
*/
|
|
50
|
+
export declare function startDevServer(options: DevServerOptions): Promise<DevServer>;
|
|
51
|
+
//# sourceMappingURL=dev-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../src/dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,eAAe,EAAe,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAIjG;;;GAGG;AACH,eAAO,MAAM,eAAe,cAAc,CAAC;AAE3C;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAKrC,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,GAAG,EAAE,eAAe,CAAC;IACrB,GAAG,EAAE,cAAc,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAChC,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACnE;AAED,MAAM,WAAW,SAAS;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACjD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAsKlF"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { createServer } from 'node:http';
|
|
2
|
+
/**
|
|
3
|
+
* Loopback only. `poli dev` serves the rendered *draft* of a private
|
|
4
|
+
* project; binding to 0.0.0.0 would publish it to the local network.
|
|
5
|
+
*/
|
|
6
|
+
export const DEV_SERVER_HOST = '127.0.0.1';
|
|
7
|
+
/**
|
|
8
|
+
* Default port for `poli dev`.
|
|
9
|
+
*
|
|
10
|
+
* 7654 is `poli` spelled on a phone keypad (P=7, O=6, L=5, I=4). It sits
|
|
11
|
+
* in the unassigned range, well clear of the ports the popular front-end
|
|
12
|
+
* dev servers grab (3000, 4200, 4321, 5173, 8080), so `poli dev` can run
|
|
13
|
+
* next to them in the same `concurrently` block without a fight. When it
|
|
14
|
+
* is busy anyway the server walks upwards (7655, 7656, …).
|
|
15
|
+
*/
|
|
16
|
+
export const DEFAULT_DEV_PORT = 7654;
|
|
17
|
+
const DEFAULT_PORT_ATTEMPTS = 20;
|
|
18
|
+
const SSE_HEARTBEAT_MS = 25_000;
|
|
19
|
+
/**
|
|
20
|
+
* Minimal `node:http` server with a Server-Sent Events channel.
|
|
21
|
+
*
|
|
22
|
+
* Everything except the SSE endpoint is delegated to `handleRequest`;
|
|
23
|
+
* this module owns only the transport concerns — port selection, the
|
|
24
|
+
* event stream, heartbeats, and a shutdown that actually terminates
|
|
25
|
+
* (SSE responses are long-lived, so `server.close()` alone would hang
|
|
26
|
+
* forever waiting for them).
|
|
27
|
+
*/
|
|
28
|
+
export async function startDevServer(options) {
|
|
29
|
+
const host = options.host ?? DEV_SERVER_HOST;
|
|
30
|
+
const eventsPath = options.eventsPath ?? '/events';
|
|
31
|
+
const firstPort = options.port ?? DEFAULT_DEV_PORT;
|
|
32
|
+
const maxAttempts = options.maxPortAttempts ?? DEFAULT_PORT_ATTEMPTS;
|
|
33
|
+
const clients = new Set();
|
|
34
|
+
const sockets = new Set();
|
|
35
|
+
let closed = false;
|
|
36
|
+
const server = createServer((req, res) => {
|
|
37
|
+
// The request target is the first attacker-controlled input this
|
|
38
|
+
// listener touches, and the WHATWG parser throws on targets the
|
|
39
|
+
// HTTP parser lets through (an absolute-form URI with an
|
|
40
|
+
// out-of-range port, say). An uncaught throw here would take the
|
|
41
|
+
// whole process down — answer 400 instead.
|
|
42
|
+
let url;
|
|
43
|
+
try {
|
|
44
|
+
url = new URL(req.url ?? '/', `http://${host}`);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
res.writeHead(400, { 'Content-Type': 'application/json; charset=utf-8' });
|
|
48
|
+
res.end(JSON.stringify({ error: 'Malformed request URL.' }));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
// Any web page can fire requests at 127.0.0.1, and with DNS
|
|
52
|
+
// rebinding it can even read the responses. The Host header is the
|
|
53
|
+
// one thing the browser pins to the page's origin, so only the
|
|
54
|
+
// names a legitimate local browser sends are answered — everything
|
|
55
|
+
// else (CSRF against the POST endpoints, rebinding against the
|
|
56
|
+
// draft preview, the SSE stream) gets a 403. Applies to every
|
|
57
|
+
// route, the SSE endpoint included.
|
|
58
|
+
if (!isAllowedHost(req.headers.host)) {
|
|
59
|
+
res.writeHead(403, { 'Content-Type': 'application/json; charset=utf-8' });
|
|
60
|
+
res.end(JSON.stringify({
|
|
61
|
+
error: `Blocked request with unrecognized Host header. poli dev answers only ${host} and localhost on its own port.`,
|
|
62
|
+
}));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (url.pathname === eventsPath) {
|
|
66
|
+
attachSseClient(req, res);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
void Promise.resolve(options.handleRequest({
|
|
70
|
+
method: (req.method ?? 'GET').toUpperCase(),
|
|
71
|
+
pathname: url.pathname,
|
|
72
|
+
query: url.searchParams,
|
|
73
|
+
req,
|
|
74
|
+
res,
|
|
75
|
+
})).catch((err) => {
|
|
76
|
+
// A handler that throws must not take the process down — the
|
|
77
|
+
// dev server has to survive every failure mode of the loop.
|
|
78
|
+
if (res.headersSent) {
|
|
79
|
+
res.end();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const message = err instanceof Error ? err.message : 'Internal error';
|
|
83
|
+
res.writeHead(500, { 'Content-Type': 'application/json; charset=utf-8' });
|
|
84
|
+
res.end(JSON.stringify({ error: message }));
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
/**
|
|
88
|
+
* A Host header is acceptable when it names this server: the bind
|
|
89
|
+
* address (or `localhost`, which resolves to it) on the port actually
|
|
90
|
+
* bound. Parsed as a URL authority so `user@host` tricks and
|
|
91
|
+
* malformed values fail closed.
|
|
92
|
+
*/
|
|
93
|
+
function isAllowedHost(hostHeader) {
|
|
94
|
+
if (!hostHeader)
|
|
95
|
+
return false;
|
|
96
|
+
let authority;
|
|
97
|
+
try {
|
|
98
|
+
authority = new URL(`http://${hostHeader}`);
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
if (authority.username !== '' || authority.password !== '')
|
|
104
|
+
return false;
|
|
105
|
+
if (authority.hostname !== host && authority.hostname !== 'localhost')
|
|
106
|
+
return false;
|
|
107
|
+
const address = server.address();
|
|
108
|
+
if (!address)
|
|
109
|
+
return false;
|
|
110
|
+
const requestPort = authority.port === '' ? '80' : authority.port;
|
|
111
|
+
return requestPort === String(address.port);
|
|
112
|
+
}
|
|
113
|
+
server.on('connection', (socket) => {
|
|
114
|
+
sockets.add(socket);
|
|
115
|
+
socket.on('close', () => sockets.delete(socket));
|
|
116
|
+
});
|
|
117
|
+
function attachSseClient(req, res) {
|
|
118
|
+
res.writeHead(200, {
|
|
119
|
+
'Content-Type': 'text/event-stream; charset=utf-8',
|
|
120
|
+
'Cache-Control': 'no-cache, no-transform',
|
|
121
|
+
Connection: 'keep-alive',
|
|
122
|
+
// Disables buffering in any proxy the user might front this with.
|
|
123
|
+
'X-Accel-Buffering': 'no',
|
|
124
|
+
});
|
|
125
|
+
// Ask the browser to back off politely if we go away.
|
|
126
|
+
res.write('retry: 1000\n\n');
|
|
127
|
+
res.write(': connected\n\n');
|
|
128
|
+
clients.add(res);
|
|
129
|
+
const cleanup = () => {
|
|
130
|
+
clients.delete(res);
|
|
131
|
+
};
|
|
132
|
+
req.on('close', cleanup);
|
|
133
|
+
res.on('close', cleanup);
|
|
134
|
+
res.on('error', cleanup);
|
|
135
|
+
}
|
|
136
|
+
const heartbeat = setInterval(() => {
|
|
137
|
+
for (const client of clients) {
|
|
138
|
+
try {
|
|
139
|
+
client.write(': ping\n\n');
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
clients.delete(client);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}, SSE_HEARTBEAT_MS);
|
|
146
|
+
heartbeat.unref?.();
|
|
147
|
+
const port = await listenWithFallback(server, host, firstPort, maxAttempts);
|
|
148
|
+
return {
|
|
149
|
+
port,
|
|
150
|
+
url: `http://${host}:${port}`,
|
|
151
|
+
get clientCount() {
|
|
152
|
+
return clients.size;
|
|
153
|
+
},
|
|
154
|
+
broadcast(event, payload) {
|
|
155
|
+
if (closed)
|
|
156
|
+
return;
|
|
157
|
+
const frame = `event: ${event}\ndata: ${JSON.stringify(payload)}\n\n`;
|
|
158
|
+
for (const client of clients) {
|
|
159
|
+
try {
|
|
160
|
+
client.write(frame);
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
clients.delete(client);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
async close() {
|
|
168
|
+
if (closed)
|
|
169
|
+
return;
|
|
170
|
+
closed = true;
|
|
171
|
+
clearInterval(heartbeat);
|
|
172
|
+
for (const client of clients) {
|
|
173
|
+
try {
|
|
174
|
+
client.end();
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
// Already gone — nothing to do.
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
clients.clear();
|
|
181
|
+
await new Promise((resolve) => {
|
|
182
|
+
server.close(() => resolve());
|
|
183
|
+
// Keep-alive sockets would otherwise hold `close()` open.
|
|
184
|
+
for (const socket of sockets) {
|
|
185
|
+
socket.destroy();
|
|
186
|
+
}
|
|
187
|
+
sockets.clear();
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Bind to `port`, walking upwards while the OS reports the address as
|
|
194
|
+
* already in use. Any other listen error is surfaced untouched.
|
|
195
|
+
*/
|
|
196
|
+
async function listenWithFallback(server, host, firstPort, maxAttempts) {
|
|
197
|
+
let lastError = null;
|
|
198
|
+
for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
|
|
199
|
+
const candidate = firstPort === 0 ? 0 : firstPort + attempt;
|
|
200
|
+
try {
|
|
201
|
+
await new Promise((resolve, reject) => {
|
|
202
|
+
const onError = (err) => {
|
|
203
|
+
server.removeListener('listening', onListening);
|
|
204
|
+
reject(err);
|
|
205
|
+
};
|
|
206
|
+
const onListening = () => {
|
|
207
|
+
server.removeListener('error', onError);
|
|
208
|
+
resolve();
|
|
209
|
+
};
|
|
210
|
+
server.once('error', onError);
|
|
211
|
+
server.once('listening', onListening);
|
|
212
|
+
server.listen(candidate, host);
|
|
213
|
+
});
|
|
214
|
+
const address = server.address();
|
|
215
|
+
return address?.port ?? candidate;
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
const error = err;
|
|
219
|
+
if (error.code !== 'EADDRINUSE')
|
|
220
|
+
throw error;
|
|
221
|
+
lastError = error;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
throw new Error(`No free port found in the range ${firstPort}–${firstPort + maxAttempts - 1}. ` +
|
|
225
|
+
`Pass --port <n> to pick another range.` +
|
|
226
|
+
(lastError ? ` (last error: ${lastError.message})` : ''));
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=dev-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-server.js","sourceRoot":"","sources":["../src/dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA0D,MAAM,WAAW,CAAC;AAIjG;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;AAE3C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAErC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AA6BhC;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAyB;IAC7D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,eAAe,CAAC;IAC7C,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,SAAS,CAAC;IACnD,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,IAAI,gBAAgB,CAAC;IACnD,MAAM,WAAW,GAAG,OAAO,CAAC,eAAe,IAAI,qBAAqB,CAAC;IAErE,MAAM,OAAO,G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,CAAC;gBACtC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAwB,CAAC;YACvD,OAAO,OAAO,EAAE,IAAI,IAAI,SAAS,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,MAAM,KAAK,GAAG,GAA4B,CAAC;YAC3C,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY;gBAAE,MAAM,KAAK,CAAC;YAC7C,SAAS,GAAG,KAAK,CAAC;QACnB,CAAC;IACF,CAAC;IAED,MAAM,IAAI,KAAK,CACd,mCAAmC,SAAS,IAAI,SAAS,GAAG,WAAW,GAAG,CAAC,IAAI;QAC9E,wCAAwC;QACxC,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,SAAS,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CACzD,CAAC;AACH,CAAC"}
|
package/dist/exit-codes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit-codes.d.ts","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ;;;;;;;;CAQX,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"exit-codes.d.ts","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ;;;;;;;;CAQX,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AAoBrE;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,CA8D3D"}
|
package/dist/exit-codes.js
CHANGED
|
@@ -20,7 +20,7 @@ export const ExitCode = {
|
|
|
20
20
|
NOT_AUTHORIZED: 5,
|
|
21
21
|
INVALID_LOCAL_STATE: 6,
|
|
22
22
|
};
|
|
23
|
-
import { ApiError, NotAMemberError, OrgCancelledError, OrgPurgedError, OrgMigratingError, SystemProjectLockedError, SystemProjectImmutableError, ThumbnailsNotAvailableError, DocumentNotFoundError, DocumentGoneError, InvalidVersionFormatError, InvalidVersionForKeyEnvError, VersionRequiredError, MissingOrgContextError, } from './api-client.js';
|
|
23
|
+
import { ApiError, NotAMemberError, OrgCancelledError, OrgPaymentGraceError, OrgPurgedError, OrgMigratingError, SystemProjectLockedError, SystemProjectImmutableError, ThumbnailsNotAvailableError, DocumentNotFoundError, DocumentGoneError, InvalidVersionFormatError, InvalidVersionForKeyEnvError, VersionRequiredError, MissingOrgContextError, } from './api-client.js';
|
|
24
24
|
/**
|
|
25
25
|
* Map a thrown value to a CLI exit code. Use this in command handlers'
|
|
26
26
|
* catch blocks instead of hardcoding `process.exitCode = 1`.
|
|
@@ -36,8 +36,9 @@ export function errorToExitCode(err) {
|
|
|
36
36
|
}
|
|
37
37
|
if (err instanceof Error) {
|
|
38
38
|
// Auth-domain typed errors map to "not authorised" (insufficient role,
|
|
39
|
-
// org cancelled/purged, system project locked).
|
|
39
|
+
// org in payment grace/cancelled/purged, system project locked).
|
|
40
40
|
if (err instanceof NotAMemberError ||
|
|
41
|
+
err instanceof OrgPaymentGraceError ||
|
|
41
42
|
err instanceof OrgCancelledError ||
|
|
42
43
|
err instanceof OrgPurgedError ||
|
|
43
44
|
err instanceof SystemProjectLockedError ||
|
package/dist/exit-codes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit-codes.js","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACvB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AAI,GAAG,YAAY,QAAQ,IAAI,GAAG,YAAY,iBAAiB,EAAE,CAAC;YACjE,OAAO,QAAQ,CAAC,oBAAoB,CAAC;QACtC,CAAC;QAED,mEAAmE;QACnE,4BAA4B;QAC5B,IAAI,GAAG,YAAY,iBAAiB,EAAE,CAAC;YACtC,OAAO,QAAQ,CAAC,oBAAoB,CAAC;QACtC,CAAC;IACF,CAAC;IAED,OAAO,QAAQ,CAAC,YAAY,CAAC;AAC9B,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const manifestSchema: z.ZodObject<{
|
|
3
3
|
project: z.ZodObject<{
|
|
4
4
|
name: z.ZodString;
|
|
5
|
-
version: z.ZodString
|
|
5
|
+
version: z.ZodOptional<z.ZodString>;
|
|
6
6
|
description: z.ZodOptional<z.ZodString>;
|
|
7
7
|
}, z.core.$loose>;
|
|
8
8
|
engine: z.ZodOptional<z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.schema.d.ts","sourceRoot":"","sources":["../src/manifest.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"manifest.schema.d.ts","sourceRoot":"","sources":["../src/manifest.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2DxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQZ,CAAC;AAEhB,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE9D,MAAM,WAAW,uBAAuB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,uBAAwB,SAAQ,KAAK;aAGhC,MAAM,EAAE,uBAAuB,EAAE;gBADjD,OAAO,EAAE,MAAM,EACC,MAAM,EAAE,uBAAuB,EAAE;CAKlD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAW5D"}
|
package/dist/manifest.schema.js
CHANGED
|
@@ -17,11 +17,10 @@ const templateEntrySchema = z
|
|
|
17
17
|
})
|
|
18
18
|
.passthrough();
|
|
19
19
|
// `track` is the version family the project is currently working on
|
|
20
|
-
// (api-spec §9.1). Written by `poli
|
|
21
|
-
//
|
|
22
|
-
// enables hotfixing a LIVE version while a newer SANDBOX exists.
|
|
20
|
+
// (api-spec §9.1). Written and read by `poli push` to anchor --patch /
|
|
21
|
+
// --minor on the right family.
|
|
23
22
|
// Optional: a fresh project from `poli init` has no track until the
|
|
24
|
-
// first
|
|
23
|
+
// first push.
|
|
25
24
|
const TRACK_RE = /^\d+\.\d+$/;
|
|
26
25
|
const cloudSchema = z
|
|
27
26
|
.object({
|
|
@@ -29,17 +28,15 @@ const cloudSchema = z
|
|
|
29
28
|
orgId: z.string().optional(),
|
|
30
29
|
projectSlug: z.string().optional(),
|
|
31
30
|
projectId: z.string(),
|
|
32
|
-
track: z
|
|
33
|
-
.string()
|
|
34
|
-
.regex(TRACK_RE, 'Track must be `major.minor` (e.g. "1.0")')
|
|
35
|
-
.optional(),
|
|
31
|
+
track: z.string().regex(TRACK_RE, 'Track must be `major.minor` (e.g. "1.0")').optional(),
|
|
36
32
|
apiUrl: z.string().optional(),
|
|
37
33
|
})
|
|
38
34
|
.passthrough();
|
|
39
35
|
const projectSchema = z
|
|
40
36
|
.object({
|
|
41
37
|
name: z.string(),
|
|
42
|
-
|
|
38
|
+
// Optional: a starter (`poli init --starter`) carries no version (F3).
|
|
39
|
+
version: z.string().optional(),
|
|
43
40
|
description: z.string().optional(),
|
|
44
41
|
})
|
|
45
42
|
.passthrough();
|
|
@@ -79,9 +76,7 @@ export function parseManifest(raw) {
|
|
|
79
76
|
path: formatPath(issue.path),
|
|
80
77
|
message: issue.message,
|
|
81
78
|
}));
|
|
82
|
-
const summary = issues
|
|
83
|
-
.map((i) => (i.path ? `${i.path}: ${i.message}` : i.message))
|
|
84
|
-
.join('; ');
|
|
79
|
+
const summary = issues.map((i) => (i.path ? `${i.path}: ${i.message}` : i.message)).join('; ');
|
|
85
80
|
throw new ManifestValidationError(`Invalid poli-page.json — ${summary}`, issues);
|
|
86
81
|
}
|
|
87
82
|
function formatPath(path) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.schema.js","sourceRoot":"","sources":["../src/manifest.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,eAAe,GAAG,CAAC;KACvB,MAAM,CAAC;IACP,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC;KACD,WAAW,EAAE,CAAC;AAEhB,MAAM,mBAAmB,GAAG,CAAC;KAC3B,MAAM,CAAC;IACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC;KACD,WAAW,EAAE,CAAC;AAEhB,oEAAoE;AACpE,uEAAuE;AACvE
|
|
1
|
+
{"version":3,"file":"manifest.schema.js","sourceRoot":"","sources":["../src/manifest.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,eAAe,GAAG,CAAC;KACvB,MAAM,CAAC;IACP,MAAM,EAAE,CAAC,CAAC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AC;QAC7E,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC;QAC5B,OAAO,EAAE,KAAK,CAAC,OAAO;KACtB,CAAC,CAAC,CAAC;IACJ,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/F,MAAM,IAAI,uBAAuB,CAAC,4BAA4B,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;AAClF,CAAC;AAED,SAAS,UAAU,CAAC,IAAgC;IACnD,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,MAAM,OAAO,IAAI,IAAI,EAAE,CAAC;QAC5B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YACjC,GAAG,IAAI,IAAI,OAAO,GAAG,CAAC;QACvB,CAAC;aAAM,CAAC;YACP,GAAG,IAAI,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7D,CAAC;IACF,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
package/dist/program.js
CHANGED
|
@@ -6,12 +6,12 @@ import { registerRenderCommand } from './commands/render.js';
|
|
|
6
6
|
import { registerPreviewCommand } from './commands/preview.js';
|
|
7
7
|
import { registerAuthCommands } from './commands/auth.js';
|
|
8
8
|
import { registerLinkCommands } from './commands/link.js';
|
|
9
|
-
import { registerCheckoutCommand } from './commands/checkout.js';
|
|
10
9
|
import { registerVersionStateCommands } from './commands/version-state.js';
|
|
11
10
|
import { registerPushCommand } from './commands/push.js';
|
|
12
11
|
import { registerVersionsCommands } from './commands/versions.js';
|
|
13
12
|
import { registerDocumentsCommands } from './commands/documents/index.js';
|
|
14
13
|
import { registerWatchCommand } from './commands/watch.js';
|
|
14
|
+
import { registerDevCommand } from './commands/dev.js';
|
|
15
15
|
import { readCredentials } from './credentials.js';
|
|
16
16
|
import { readManifest } from './manifest.js';
|
|
17
17
|
const require = createRequire(import.meta.url);
|
|
@@ -57,12 +57,12 @@ export function createProgram() {
|
|
|
57
57
|
registerPreviewCommand(program);
|
|
58
58
|
registerAuthCommands(program);
|
|
59
59
|
registerLinkCommands(program);
|
|
60
|
-
registerCheckoutCommand(program);
|
|
61
60
|
registerVersionStateCommands(program);
|
|
62
61
|
registerPushCommand(program);
|
|
63
62
|
registerVersionsCommands(program);
|
|
64
63
|
registerDocumentsCommands(program);
|
|
65
64
|
registerWatchCommand(program);
|
|
65
|
+
registerDevCommand(program);
|
|
66
66
|
return program;
|
|
67
67
|
}
|
|
68
68
|
//# sourceMappingURL=program.js.map
|
package/dist/program.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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AC;IAClC,yBAAyB,CAAC,OAAO,CAAC,CAAC;IACnC,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC9B,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAE5B,OAAO,OAAO,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ApiClient } from './api-client.js';
|
|
2
|
+
import type { CloudContext } from './cloud-context.js';
|
|
3
|
+
export declare function isBinaryAsset(relPath: string): boolean;
|
|
4
|
+
export declare function shouldIgnoreProjectPath(relPath: string): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Read every syncable file of a project into a `path → content` map.
|
|
7
|
+
*
|
|
8
|
+
* Paths are project-relative and POSIX-normalised so the wire format
|
|
9
|
+
* matches the comparisons performed by the API regardless of host OS.
|
|
10
|
+
* Binary assets are base64-encoded; everything else is utf-8 verbatim.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readAllProjectFiles(cwd: string): Promise<Map<string, string>>;
|
|
13
|
+
export interface ProjectSyncOutcome {
|
|
14
|
+
/** `false` when the on-disk content was byte-identical to the snapshot. */
|
|
15
|
+
changed: boolean;
|
|
16
|
+
syncedAt?: string;
|
|
17
|
+
/** Project-relative POSIX paths touched by this sync (added + modified + deleted). */
|
|
18
|
+
changedPaths: string[];
|
|
19
|
+
}
|
|
20
|
+
export interface ProjectSyncerOptions {
|
|
21
|
+
cwd: string;
|
|
22
|
+
client: ApiClient;
|
|
23
|
+
ctx: CloudContext;
|
|
24
|
+
signal?: AbortSignal;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Stateful local ⇄ cloud-draft synchroniser shared by `poli watch` and
|
|
28
|
+
* `poli dev`.
|
|
29
|
+
*
|
|
30
|
+
* It owns the SHA-256 snapshot of the working tree; `sync()` diffs the
|
|
31
|
+
* current tree against that snapshot and pushes only the delta through
|
|
32
|
+
* `PATCH /files`, retrying transient failures via `syncWithRetry`.
|
|
33
|
+
*/
|
|
34
|
+
export interface ProjectSyncer {
|
|
35
|
+
/** Number of files in the current snapshot. */
|
|
36
|
+
readonly trackedCount: number;
|
|
37
|
+
/** Take the initial snapshot without pushing anything. */
|
|
38
|
+
prime(): Promise<number>;
|
|
39
|
+
/** Push the delta between the snapshot and the working tree. */
|
|
40
|
+
sync(): Promise<ProjectSyncOutcome>;
|
|
41
|
+
/**
|
|
42
|
+
* Push the whole working tree as `modified`, regardless of the
|
|
43
|
+
* snapshot. Used at `poli dev` start-up so the first render reflects
|
|
44
|
+
* the local files rather than whatever the draft happened to hold.
|
|
45
|
+
*/
|
|
46
|
+
syncAll(): Promise<ProjectSyncOutcome>;
|
|
47
|
+
}
|
|
48
|
+
export declare function createProjectSyncer(options: ProjectSyncerOptions): ProjectSyncer;
|
|
49
|
+
//# sourceMappingURL=project-sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-sync.d.ts","sourceRoot":"","sources":["../src/project-sync.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA0BvD,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAGtD;AAwBD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAehE;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAsBnF;AAED,MAAM,WAAW,kBAAkB;IAClC,2EAA2E;IAC3E,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sFAAsF;IACtF,YAAY,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,SAAS,CAAC;IAClB,GAAG,EAAE,YAAY,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC7B,+CAA+C;IAC/C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,0DAA0D;IAC1D,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,gEAAgE;IAChE,IAAI,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACpC;;;;OAIG;IACH,OAAO,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACvC;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAgFhF"}
|