@junejs/cli 0.0.52-dev.1 → 0.0.52-dev.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.
package/dist/cli.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
//#region src/cli.d.ts
|
|
2
|
-
type Parsed = {
|
|
2
|
+
export type Parsed = {
|
|
3
3
|
verb: string;
|
|
4
4
|
positional: string[];
|
|
5
5
|
flags: Record<string, string | boolean>;
|
|
6
6
|
};
|
|
7
|
-
declare function parse(argv: string[]): Parsed;
|
|
8
|
-
declare function run(argv: string[]): Promise<number | undefined>;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { Parsed, parse, run };
|
|
7
|
+
export declare function parse(argv: string[]): Parsed;
|
|
8
|
+
export declare function run(argv: string[]): Promise<number | undefined>;
|
|
9
|
+
//#endregion
|
package/dist/cli.js
CHANGED
|
@@ -31,7 +31,7 @@ Commands:
|
|
|
31
31
|
dev Start the dev server --port <n> --no-watch
|
|
32
32
|
build Build a workerd-ready bundle --out <dir>
|
|
33
33
|
deploy Build + deploy (workers/vercel) --dry-run --prod --skip-migrate --allow-destructive
|
|
34
|
-
gen Freeze content
|
|
34
|
+
gen Freeze content + agent module --check
|
|
35
35
|
db Database tasks (db migrate, db types) --allow-destructive
|
|
36
36
|
info Show routes + the agent surface
|
|
37
37
|
help Show this help
|
|
@@ -59,8 +59,12 @@ async function info(root) {
|
|
|
59
59
|
for (const r of routes) console.log(` ${r}`);
|
|
60
60
|
if (agent.enabled) {
|
|
61
61
|
console.log(`\nAgent surface:`);
|
|
62
|
-
if (agent.discovery)
|
|
62
|
+
if (agent.discovery) {
|
|
63
|
+
console.log(` discovery /llms.txt · /sitemap.xml · /.well-known/api-catalog`);
|
|
64
|
+
console.log(` /.well-known/ai-catalog.json · /.well-known/agent-skills/index.json`);
|
|
65
|
+
}
|
|
63
66
|
if (agent.mcp) console.log(` mcp /mcp (tools: ${tools.length ? tools.join(", ") : "none"})`);
|
|
67
|
+
if (agent.api) console.log(` api POST /api/<tool> · /openapi.json`);
|
|
64
68
|
} else console.log(`\nAgent surface: disabled`);
|
|
65
69
|
return 0;
|
|
66
70
|
}
|
|
@@ -75,7 +79,7 @@ async function run(argv) {
|
|
|
75
79
|
return 1;
|
|
76
80
|
}
|
|
77
81
|
if (!process.env.JUNE_DEV_CHILD && !flags["no-watch"]) {
|
|
78
|
-
const { superviseDev } = await import("./watch-
|
|
82
|
+
const { superviseDev } = await import("./watch-BcQz4ONx.js");
|
|
79
83
|
return superviseDev(root);
|
|
80
84
|
}
|
|
81
85
|
const { startDevServer } = await import("@junejs/server");
|
|
@@ -103,12 +107,25 @@ async function run(argv) {
|
|
|
103
107
|
return 0;
|
|
104
108
|
}
|
|
105
109
|
case "gen": {
|
|
106
|
-
const { generateContent } = await import("@junejs/server");
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
const { generateContent, loadJuneConfig, generateAgentModule, findAgentDir } = await import("@junejs/server");
|
|
111
|
+
if (!flags.check && existsSync(join(root, "app"))) {
|
|
112
|
+
const cols = await generateContent(root);
|
|
113
|
+
console.log(cols.length ? `generated content: ${cols.join(", ")}` : "no content/ collections");
|
|
114
|
+
const { generateMessages } = await import("./messages-CofbPnix.js");
|
|
115
|
+
const locales = await generateMessages(root);
|
|
116
|
+
if (locales) console.log(`generated messages: ${locales.join(", ")}`);
|
|
117
|
+
}
|
|
118
|
+
const { resolveAgent } = await import("@junejs/core/config");
|
|
119
|
+
const agentCfg = resolveAgent((await loadJuneConfig(root)).agent);
|
|
120
|
+
const agentDir = agentCfg.runtime.enabled ? findAgentDir(root, agentCfg.runtime.dir) : null;
|
|
121
|
+
const agent = agentDir ? generateAgentModule(agentDir, { check: !!flags.check }) : null;
|
|
122
|
+
if (agent) {
|
|
123
|
+
if (flags.check && agent.stale) {
|
|
124
|
+
console.error(`june gen --check: ${agent.file} is stale — run \`june gen\`.`);
|
|
125
|
+
return 1;
|
|
126
|
+
}
|
|
127
|
+
console.log(agent.written ? `generated agent module: ${agent.file}` : `agent module up to date: ${agent.file}`);
|
|
128
|
+
}
|
|
112
129
|
return 0;
|
|
113
130
|
}
|
|
114
131
|
case "db": {
|
|
@@ -146,7 +163,8 @@ async function run(argv) {
|
|
|
146
163
|
console.log("nothing to generate");
|
|
147
164
|
return 0;
|
|
148
165
|
}
|
|
149
|
-
|
|
166
|
+
const out = join(dbRoot, "db", "schema.d.ts");
|
|
167
|
+
await writeFile(out, text);
|
|
150
168
|
console.log("wrote db/schema.d.ts");
|
|
151
169
|
return 0;
|
|
152
170
|
}
|
|
@@ -11,7 +11,8 @@ async function generateMessages(root) {
|
|
|
11
11
|
if (!existsSync(messagesDir)) return null;
|
|
12
12
|
let codegen;
|
|
13
13
|
try {
|
|
14
|
-
|
|
14
|
+
const resolved = createRequire(resolve(root, "package.json")).resolve("@junejs/i18n/codegen");
|
|
15
|
+
codegen = await import(pathToFileURL(resolved).href);
|
|
15
16
|
} catch {
|
|
16
17
|
console.warn("[june] messages/ found but @junejs/i18n is not installed — skipping (run: bun add @junejs/i18n)");
|
|
17
18
|
return null;
|
|
@@ -41,7 +41,7 @@ function superviseDev(root) {
|
|
|
41
41
|
console.error("[june] content regen failed:", err);
|
|
42
42
|
}
|
|
43
43
|
if (file.startsWith(`messages${sep}`)) try {
|
|
44
|
-
const { generateMessages } = await import("./messages-
|
|
44
|
+
const { generateMessages } = await import("./messages-CofbPnix.js");
|
|
45
45
|
await generateMessages(root);
|
|
46
46
|
} catch (err) {
|
|
47
47
|
console.error("[june] messages regen failed:", err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junejs/cli",
|
|
3
|
-
"version": "0.0.52-dev.
|
|
3
|
+
"version": "0.0.52-dev.3",
|
|
4
4
|
"description": "The `june` CLI — dev / build / deploy / gen / info. A thin bin over @junejs/server.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"build": "tsdown"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@junejs/core": ">=0.2.0-dev.
|
|
31
|
-
"@junejs/server": ">=1.0.0-dev.
|
|
30
|
+
"@junejs/core": ">=0.2.0-dev.51",
|
|
31
|
+
"@junejs/server": ">=1.0.0-dev.31"
|
|
32
32
|
},
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|
package/src/cli.ts
CHANGED
|
@@ -43,7 +43,7 @@ Commands:
|
|
|
43
43
|
dev Start the dev server --port <n> --no-watch
|
|
44
44
|
build Build a workerd-ready bundle --out <dir>
|
|
45
45
|
deploy Build + deploy (workers/vercel) --dry-run --prod --skip-migrate --allow-destructive
|
|
46
|
-
gen Freeze content
|
|
46
|
+
gen Freeze content + agent module --check
|
|
47
47
|
db Database tasks (db migrate, db types) --allow-destructive
|
|
48
48
|
info Show routes + the agent surface
|
|
49
49
|
help Show this help
|
|
@@ -72,8 +72,12 @@ async function info(root: string): Promise<number> {
|
|
|
72
72
|
for (const r of routes) console.log(` ${r}`);
|
|
73
73
|
if (agent.enabled) {
|
|
74
74
|
console.log(`\nAgent surface:`);
|
|
75
|
-
if (agent.discovery)
|
|
75
|
+
if (agent.discovery) {
|
|
76
|
+
console.log(` discovery /llms.txt · /sitemap.xml · /.well-known/api-catalog`);
|
|
77
|
+
console.log(` /.well-known/ai-catalog.json · /.well-known/agent-skills/index.json`);
|
|
78
|
+
}
|
|
76
79
|
if (agent.mcp) console.log(` mcp /mcp (tools: ${tools.length ? tools.join(", ") : "none"})`);
|
|
80
|
+
if (agent.api) console.log(` api POST /api/<tool> · /openapi.json`);
|
|
77
81
|
} else {
|
|
78
82
|
console.log(`\nAgent surface: disabled`);
|
|
79
83
|
}
|
|
@@ -135,12 +139,35 @@ export async function run(argv: string[]): Promise<number | undefined> {
|
|
|
135
139
|
return 0;
|
|
136
140
|
}
|
|
137
141
|
case "gen": {
|
|
138
|
-
const { generateContent } = await import("@junejs/server");
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
const { generateContent, loadJuneConfig, generateAgentModule, findAgentDir } = await import("@junejs/server");
|
|
143
|
+
// The content/messages freeze targets a June app (it writes into app/).
|
|
144
|
+
// A wrangler-first worker running `june gen` for its agent module has no
|
|
145
|
+
// app/ directory — don't create one just to hold an empty _content.ts.
|
|
146
|
+
// --check is a NO-WRITE gate: those generators have no compare mode, so
|
|
147
|
+
// skip them entirely under --check rather than write during a check
|
|
148
|
+
// (their staleness stays covered by `june gen && git diff --exit-code`;
|
|
149
|
+
// a compare mode for the freeze is a separate follow-up).
|
|
150
|
+
if (!flags.check && existsSync(join(root, "app"))) {
|
|
151
|
+
const cols = await generateContent(root);
|
|
152
|
+
console.log(cols.length ? `generated content: ${cols.join(", ")}` : "no content/ collections");
|
|
153
|
+
const { generateMessages } = await import("./messages");
|
|
154
|
+
const locales = await generateMessages(root);
|
|
155
|
+
if (locales) console.log(`generated messages: ${locales.join(", ")}`);
|
|
156
|
+
}
|
|
157
|
+
// Agent module: compile the agent directory (app/agent in a June app,
|
|
158
|
+
// ./agent in a wrangler-first worker) into _agent.gen.ts so the same
|
|
159
|
+
// directory convention mounts on the edge (workerd has no fs discovery).
|
|
160
|
+
const { resolveAgent } = await import("@junejs/core/config");
|
|
161
|
+
const agentCfg = resolveAgent((await loadJuneConfig(root)).agent);
|
|
162
|
+
const agentDir = agentCfg.runtime.enabled ? findAgentDir(root, agentCfg.runtime.dir) : null;
|
|
163
|
+
const agent = agentDir ? generateAgentModule(agentDir, { check: !!flags.check }) : null;
|
|
164
|
+
if (agent) {
|
|
165
|
+
if (flags.check && agent.stale) {
|
|
166
|
+
console.error(`june gen --check: ${agent.file} is stale — run \`june gen\`.`);
|
|
167
|
+
return 1;
|
|
168
|
+
}
|
|
169
|
+
console.log(agent.written ? `generated agent module: ${agent.file}` : `agent module up to date: ${agent.file}`);
|
|
170
|
+
}
|
|
144
171
|
return 0;
|
|
145
172
|
}
|
|
146
173
|
case "db": {
|