feat(core): reserved-port and API-key guardrails in the default system prompt (#24)

Co-authored-by: Alice <alice@prismshadow.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Yaowei Zheng
2026-07-22 22:04:30 +08:00
committed by GitHub
parent 849f2fa6d2
commit c9cd1f9dc5
10 changed files with 47 additions and 5 deletions
+3 -2
View File
@@ -14,11 +14,12 @@
* Docs: /docs/cli § "penguin server / penguin web".
*/
import { spawn } from "node:child_process";
import { DEFAULT_SERVER_PORT } from "@prismshadow/penguin-core";
import type { Command } from "commander";
import type { Messages } from "../i18n.js";
/** Default service port (deliberately avoids common defaults like 3000/8080). */
export const DEFAULT_PORT = 7364;
/** Default service port — core's DEFAULT_SERVER_PORT (7364), the single source of truth. */
export const DEFAULT_PORT = DEFAULT_SERVER_PORT;
/** Default service listen host. */
export const DEFAULT_HOST = "127.0.0.1";
+4
View File
@@ -1,5 +1,6 @@
import { describe, expect, it } from "vitest";
import { Command } from "commander";
import { DEFAULT_SERVER_PORT } from "@prismshadow/penguin-core";
import {
DEFAULT_HOST,
DEFAULT_PORT,
@@ -11,6 +12,9 @@ import {
import { getMessages } from "../src/i18n.js";
describe("resolvePort (option > env var > default 7364)", () => {
it("derives DEFAULT_PORT from core's DEFAULT_SERVER_PORT", () => {
expect(DEFAULT_PORT).toBe(DEFAULT_SERVER_PORT);
});
it("uses the default 7364 when neither is given", () => {
expect(DEFAULT_PORT).toBe(7364);
expect(resolvePort(undefined, undefined)).toBe(7364);