@clawtrail/init 2.5.0 → 2.5.2
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/index.js +57 -31
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -98,27 +98,7 @@ async function downloadSkillFiles(targetDir, staging = false) {
|
|
|
98
98
|
return { succeeded, failed };
|
|
99
99
|
}
|
|
100
100
|
async function installContextGraph(staging, agentId, apiKey) {
|
|
101
|
-
const spinner = ora("
|
|
102
|
-
try {
|
|
103
|
-
execSync(
|
|
104
|
-
"npm install -g @clawtrail/context-graph @clawtrail/context-graph-openclaw",
|
|
105
|
-
{ stdio: "pipe", timeout: 12e4 }
|
|
106
|
-
);
|
|
107
|
-
} catch (err) {
|
|
108
|
-
try {
|
|
109
|
-
execSync(
|
|
110
|
-
"npm install @clawtrail/context-graph @clawtrail/context-graph-openclaw",
|
|
111
|
-
{ stdio: "pipe", timeout: 12e4 }
|
|
112
|
-
);
|
|
113
|
-
} catch {
|
|
114
|
-
spinner.warn(
|
|
115
|
-
chalk.yellow(
|
|
116
|
-
"Could not install context-graph packages \u2014 install manually:\n npm install @clawtrail/context-graph @clawtrail/context-graph-openclaw"
|
|
117
|
-
)
|
|
118
|
-
);
|
|
119
|
-
return { installed: false, configPath: null, error: err.message };
|
|
120
|
-
}
|
|
121
|
-
}
|
|
101
|
+
const spinner = ora("Setting up context-graph provenance...").start();
|
|
122
102
|
const openclawDir = path.join(os.homedir(), ".openclaw");
|
|
123
103
|
const pluginDir = path.join(openclawDir, "plugins", "context-graph");
|
|
124
104
|
await ensureDirectory(pluginDir);
|
|
@@ -153,14 +133,54 @@ async function installContextGraph(staging, agentId, apiKey) {
|
|
|
153
133
|
);
|
|
154
134
|
} catch {
|
|
155
135
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
136
|
+
let packagesInstalled = false;
|
|
137
|
+
let installError = "";
|
|
138
|
+
try {
|
|
139
|
+
execSync(
|
|
140
|
+
`npm install --prefix "${pluginDir}" @clawtrail/context-graph @clawtrail/context-graph-openclaw`,
|
|
141
|
+
{ stdio: "pipe", timeout: 12e4 }
|
|
142
|
+
);
|
|
143
|
+
packagesInstalled = true;
|
|
144
|
+
} catch (err) {
|
|
145
|
+
const localErr = err.stderr?.toString().trim() || err.stdout?.toString().trim() || err.message || "Unknown error";
|
|
146
|
+
try {
|
|
147
|
+
execSync(
|
|
148
|
+
"npm install -g @clawtrail/context-graph @clawtrail/context-graph-openclaw",
|
|
149
|
+
{ stdio: "pipe", timeout: 12e4 }
|
|
150
|
+
);
|
|
151
|
+
packagesInstalled = true;
|
|
152
|
+
} catch (err2) {
|
|
153
|
+
const globalErr = err2.stderr?.toString().trim() || err2.stdout?.toString().trim() || err2.message || "Unknown error";
|
|
154
|
+
installError = `Local install failed:
|
|
155
|
+
${localErr.split("\n").slice(-3).join("\n ")}
|
|
156
|
+
Global install failed:
|
|
157
|
+
${globalErr.split("\n").slice(-3).join("\n ")}`;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (packagesInstalled) {
|
|
161
|
+
spinner.succeed(
|
|
162
|
+
chalk.green(
|
|
163
|
+
`Context-graph configured \u2192 auto-submit to ${staging ? "staging" : "production"}`
|
|
164
|
+
)
|
|
165
|
+
);
|
|
166
|
+
} else {
|
|
167
|
+
spinner.warn(
|
|
168
|
+
chalk.yellow(
|
|
169
|
+
`Context-graph configured but packages not installed \u2014 run manually:
|
|
170
|
+
npm install -g @clawtrail/context-graph @clawtrail/context-graph-openclaw`
|
|
171
|
+
)
|
|
172
|
+
);
|
|
173
|
+
if (installError) {
|
|
174
|
+
console.log(chalk.dim(`
|
|
175
|
+
Install errors:
|
|
176
|
+
${installError}
|
|
177
|
+
`));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
161
180
|
return {
|
|
162
181
|
installed: true,
|
|
163
|
-
configPath: "~/.openclaw/plugins/context-graph/config.json"
|
|
182
|
+
configPath: "~/.openclaw/plugins/context-graph/config.json",
|
|
183
|
+
packagesInstalled
|
|
164
184
|
};
|
|
165
185
|
}
|
|
166
186
|
async function configureOpenClaw(staging, apiKey) {
|
|
@@ -467,7 +487,7 @@ async function main() {
|
|
|
467
487
|
const program = new Command();
|
|
468
488
|
program.name("clawtrail-init").description(
|
|
469
489
|
"Install ClawTrail skill files, configure heartbeat, and optionally register an agent"
|
|
470
|
-
).version("2.5.
|
|
490
|
+
).version("2.5.2").option(
|
|
471
491
|
"-d, --dir <path>",
|
|
472
492
|
"Download directory for skill files",
|
|
473
493
|
"./clawtrail-skills"
|
|
@@ -670,9 +690,15 @@ CLAWTRAIL_API_KEY=${apiKey}
|
|
|
670
690
|
);
|
|
671
691
|
}
|
|
672
692
|
if (cgResult?.installed) {
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
693
|
+
if (cgResult.packagesInstalled) {
|
|
694
|
+
console.log(
|
|
695
|
+
chalk.white(" Provenance: ") + chalk.green("context-graph installed (auto-submit enabled)")
|
|
696
|
+
);
|
|
697
|
+
} else {
|
|
698
|
+
console.log(
|
|
699
|
+
chalk.white(" Provenance: ") + chalk.yellow("configured (packages need manual install)")
|
|
700
|
+
);
|
|
701
|
+
}
|
|
676
702
|
if (cgResult.configPath) {
|
|
677
703
|
console.log(
|
|
678
704
|
chalk.white(" CG config: ") + chalk.cyan(cgResult.configPath)
|