@harness-lab/cli 0.1.4 → 0.1.5
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 +1 -1
- package/package.json +1 -1
- package/src/run-cli.js +22 -5
- package/src/skill-install.js +21 -1
package/README.md
CHANGED
|
@@ -66,7 +66,7 @@ harness skill install
|
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
This creates `.agents/skills/harness-lab-workshop` in the current Harness Lab repo checkout.
|
|
69
|
-
After install, the CLI prints the first recommended agent commands, starting with
|
|
69
|
+
After install, the CLI prints the first recommended agent commands, starting with `Codex: $workshop reference` and `OpenCode: /workshop reference`.
|
|
70
70
|
|
|
71
71
|
Default device/browser login:
|
|
72
72
|
|
package/package.json
CHANGED
package/src/run-cli.js
CHANGED
|
@@ -4,6 +4,7 @@ import { prompt, writeLine } from "./io.js";
|
|
|
4
4
|
import { deleteSession, readSession, sanitizeSession, writeSession, getSessionStorageMode, SessionStoreError } from "./session-store.js";
|
|
5
5
|
import { installWorkshopSkill, SkillInstallError } from "./skill-install.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
|
+
import { pathToFileURL } from "node:url";
|
|
7
8
|
|
|
8
9
|
const require = createRequire(import.meta.url);
|
|
9
10
|
const { version } = require("../package.json");
|
|
@@ -84,13 +85,18 @@ function printVersion(io) {
|
|
|
84
85
|
async function handleSkillInstall(io, deps, flags) {
|
|
85
86
|
try {
|
|
86
87
|
const result = await installWorkshopSkill(deps.cwd ?? process.cwd(), { force: flags.force === true });
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
if (result.mode === "already_bundled") {
|
|
89
|
+
writeLine(io.stdout, `Harness Lab workshop skill is already bundled at ${result.installPath}`);
|
|
90
|
+
writeLine(io.stdout, "Codex and OpenCode should discover it from this repo via .agents/skills.");
|
|
91
|
+
} else {
|
|
92
|
+
writeLine(io.stdout, `Installed Harness Lab workshop skill to ${result.installPath}`);
|
|
93
|
+
writeLine(io.stdout, "Codex and OpenCode should now discover it from this repo via .agents/skills.");
|
|
94
|
+
}
|
|
89
95
|
writeLine(io.stdout, "Next steps:");
|
|
90
96
|
writeLine(io.stdout, " 1. Open Codex or OpenCode in this repo.");
|
|
91
|
-
writeLine(io.stdout, " 2.
|
|
92
|
-
writeLine(io.stdout, " 3.
|
|
93
|
-
writeLine(io.stdout, " 4.
|
|
97
|
+
writeLine(io.stdout, " 2. In Codex, start with `$workshop reference`. In OpenCode, use `/workshop reference`.");
|
|
98
|
+
writeLine(io.stdout, " 3. If your environment is not ready yet, use `$workshop setup` in Codex or `/workshop setup` in OpenCode.");
|
|
99
|
+
writeLine(io.stdout, " 4. For other help, keep the same pattern: `$workshop ...` in Codex, `/workshop ...` in OpenCode.");
|
|
94
100
|
return 0;
|
|
95
101
|
} catch (error) {
|
|
96
102
|
if (error instanceof SkillInstallError) {
|
|
@@ -571,3 +577,14 @@ export async function runCli(argv, io, deps = {}) {
|
|
|
571
577
|
printUsage(io);
|
|
572
578
|
return 1;
|
|
573
579
|
}
|
|
580
|
+
|
|
581
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
582
|
+
const exitCode = await runCli(process.argv.slice(2), {
|
|
583
|
+
stdin: process.stdin,
|
|
584
|
+
stdout: process.stdout,
|
|
585
|
+
stderr: process.stderr,
|
|
586
|
+
env: process.env,
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
process.exitCode = exitCode;
|
|
590
|
+
}
|
package/src/skill-install.js
CHANGED
|
@@ -41,6 +41,10 @@ export function getInstalledSkillPath(repoRoot) {
|
|
|
41
41
|
return path.join(repoRoot, ".agents", "skills", SKILL_NAME);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
async function hasBundledRepoSkill(repoRoot) {
|
|
45
|
+
return pathExists(path.join(getInstalledSkillPath(repoRoot), "SKILL.md"));
|
|
46
|
+
}
|
|
47
|
+
|
|
44
48
|
export async function installWorkshopSkill(startDir, options = {}) {
|
|
45
49
|
const repoRoot = await findHarnessLabRepoRoot(startDir);
|
|
46
50
|
if (!repoRoot) {
|
|
@@ -51,6 +55,17 @@ export async function installWorkshopSkill(startDir, options = {}) {
|
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
const installPath = getInstalledSkillPath(repoRoot);
|
|
58
|
+
const bundledRepoSkill = await hasBundledRepoSkill(repoRoot);
|
|
59
|
+
|
|
60
|
+
if (bundledRepoSkill) {
|
|
61
|
+
return {
|
|
62
|
+
repoRoot,
|
|
63
|
+
installPath,
|
|
64
|
+
skillName: SKILL_NAME,
|
|
65
|
+
mode: "already_bundled",
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
54
69
|
if ((await pathExists(installPath)) && options.force !== true) {
|
|
55
70
|
throw new SkillInstallError(
|
|
56
71
|
`Skill already installed at ${installPath}. Re-run with --force to replace it.`,
|
|
@@ -78,5 +93,10 @@ export async function installWorkshopSkill(startDir, options = {}) {
|
|
|
78
93
|
path.join(installPath, "docs", "harness-cli-foundation.md"),
|
|
79
94
|
);
|
|
80
95
|
|
|
81
|
-
return {
|
|
96
|
+
return {
|
|
97
|
+
repoRoot,
|
|
98
|
+
installPath,
|
|
99
|
+
skillName: SKILL_NAME,
|
|
100
|
+
mode: "installed",
|
|
101
|
+
};
|
|
82
102
|
}
|