Skip to content

Commit 3b0a80d

Browse files
authored
Merge pull request #11 from SemanticVoxelProtocol/dev
v0.1.8: host selection, --version fix, cleanup
2 parents 9a31209 + bd63dc7 commit 3b0a80d

5 files changed

Lines changed: 34 additions & 48 deletions

File tree

package-lock.json

Lines changed: 3 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@svporg/forge",
3-
"version": "0.1.7",
3+
"version": "0.1.8",
44
"type": "module",
55
"description": "Semantic Voxel Protocol — five-layer observability framework for AI-assisted development",
66
"license": "MIT",
@@ -47,7 +47,6 @@
4747
"dependencies": {
4848
"@inquirer/prompts": "^8.3.2",
4949
"commander": "^14.0.3",
50-
"typescript": "^5.9.3",
51-
"yaml": "^2.8.2"
50+
"typescript": "^5.9.3"
5251
}
5352
}

packages/cli/commands/init.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,14 +431,15 @@ describe("forge init", () => {
431431
expect(stdout).toContain("Windsurf");
432432
});
433433

434-
it("shows message when multiple hosts detected and no --host", async () => {
434+
it("uses first detected host when multiple hosts found in non-interactive mode", async () => {
435435
await mkdir(path.join(testRoot, ".claude"), { recursive: true });
436436
await mkdir(path.join(testRoot, ".cursor"), { recursive: true });
437437

438438
const { stdout, exitCode } = await runInit(testRoot, ["--name", "My App"]);
439439

440440
expect(exitCode).toBe(0);
441-
expect(stdout).toContain("Multiple hosts detected");
441+
// Non-interactive: uses the first detected host (claude-code)
442+
expect(stdout).toContain("Claude Code");
442443
});
443444

444445
// ── Parameterized i18n tests ──

packages/cli/commands/init.ts

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -81,30 +81,31 @@ export function registerInit(program: Command): void {
8181
} else if (options.host === undefined) {
8282
// Auto-detect from project directory markers
8383
const detected = await detectHosts(options.root);
84-
if (detected.length === 1) {
85-
hostIds = detected;
86-
} else if (detected.length > 1) {
87-
if (process.stdin.isTTY && options.yes !== true) {
88-
const { select } = await import("@inquirer/prompts");
89-
const choices: Array<{ name: string; value: string }> = [
90-
...detected.map((h) => ({ name: getAdapter(h).displayName, value: h })),
91-
{ name: t(lang, "cli.init.promptHostAll"), value: "__all__" },
92-
{ name: t(lang, "cli.init.promptHostSkip"), value: "__skip__" },
93-
];
94-
const answer = await select({
95-
message: t(lang, "cli.init.promptHostSelect"),
96-
choices,
97-
});
98-
if (answer === "__all__") {
99-
hostIds = detected;
100-
} else if (answer !== "__skip__") {
101-
hostIds = [answer as HostId];
102-
}
103-
} else {
104-
console.log(
105-
`Multiple hosts detected: ${detected.join(", ")}. Use --host to specify one.`,
106-
);
84+
if (process.stdin.isTTY && options.yes !== true) {
85+
const { select } = await import("@inquirer/prompts");
86+
// Build choices: detected hosts first, then remaining hosts
87+
const detectedSet = new Set<string>(detected);
88+
const otherHosts = VALID_HOSTS.filter((h) => !detectedSet.has(h));
89+
const choices: Array<{ name: string; value: string }> = [
90+
...detected.map((h) => ({
91+
name: `${getAdapter(h).displayName} (detected)`,
92+
value: h,
93+
})),
94+
...otherHosts.map((h) => ({
95+
name: getAdapter(h).displayName,
96+
value: h,
97+
})),
98+
{ name: t(lang, "cli.init.promptHostSkip"), value: "__skip__" },
99+
];
100+
const answer = await select({
101+
message: t(lang, "cli.init.promptHostSelect"),
102+
choices,
103+
});
104+
if (answer !== "__skip__") {
105+
hostIds = [answer as HostId];
107106
}
107+
} else if (detected.length > 0) {
108+
hostIds = [detected[0]];
108109
}
109110
} else {
110111
// Explicit single host

packages/cli/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// forge CLI — SVP 工具链的命令行入口
33

44
import { Command } from "commander";
5+
import { VERSION } from "../core/version.js";
56
import { registerCheck } from "./commands/check.js";
67
import { registerCompilePlan } from "./commands/compile-plan.js";
78
import { registerFix } from "./commands/fix.js";
@@ -16,7 +17,7 @@ export function createCLI(): Command {
1617
const program = new Command()
1718
.name("forge")
1819
.description("SVP — Semantic Voxel Protocol toolchain")
19-
.version("0.1.0");
20+
.version(VERSION);
2021

2122
registerCheck(program);
2223
registerCompilePlan(program);

0 commit comments

Comments
 (0)