replicas-engine 0.1.47 → 0.1.49

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.
Files changed (2) hide show
  1. package/dist/src/index.js +53 -0
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -2831,6 +2831,42 @@ import { promisify as promisify2 } from "util";
2831
2831
  import { readFile as readFile7 } from "fs/promises";
2832
2832
  import { join as join11 } from "path";
2833
2833
  var execFileAsync = promisify2(execFile);
2834
+ async function installSkill(params) {
2835
+ const timeout = clampWarmHookTimeoutMs(params.timeoutMs);
2836
+ try {
2837
+ const { stdout, stderr } = await execFileAsync(
2838
+ "npx",
2839
+ ["skills", "add", params.source, "--all", "--global"],
2840
+ {
2841
+ cwd: params.cwd,
2842
+ timeout,
2843
+ maxBuffer: 1024 * 1024,
2844
+ env: process.env
2845
+ }
2846
+ );
2847
+ const combined = [`$ npx skills add ${params.source} --all --global`, stdout ?? "", stderr ?? ""].filter(Boolean).join("\n");
2848
+ return {
2849
+ exitCode: 0,
2850
+ output: truncateWarmHookOutput(combined),
2851
+ timedOut: false
2852
+ };
2853
+ } catch (error) {
2854
+ const execError = error;
2855
+ const timedOut = execError.signal === "SIGTERM" || execError.killed === true;
2856
+ const exitCode = typeof execError.code === "number" ? execError.code : 1;
2857
+ const combined = [
2858
+ `$ npx skills add ${params.source} --all --global`,
2859
+ execError.stdout ?? "",
2860
+ execError.stderr ?? "",
2861
+ execError.message
2862
+ ].filter(Boolean).join("\n");
2863
+ return {
2864
+ exitCode,
2865
+ output: truncateWarmHookOutput(combined),
2866
+ timedOut
2867
+ };
2868
+ }
2869
+ }
2834
2870
  async function executeHookScript(params) {
2835
2871
  const timeout = clampWarmHookTimeoutMs(params.timeoutMs);
2836
2872
  try {
@@ -2895,7 +2931,23 @@ async function collectRepoWarmHooks() {
2895
2931
  }
2896
2932
  async function runWarmHooks(params) {
2897
2933
  const outputBlocks = [];
2934
+ const skills = params.skills ?? [];
2898
2935
  const orgHook = params.organizationWarmHook?.trim();
2936
+ for (const source of skills) {
2937
+ const installResult = await installSkill({
2938
+ source,
2939
+ cwd: gitService.getWorkspaceRoot(),
2940
+ timeoutMs: params.timeoutMs
2941
+ });
2942
+ outputBlocks.push(installResult.output);
2943
+ if (installResult.exitCode !== 0) {
2944
+ return {
2945
+ exitCode: installResult.exitCode,
2946
+ output: outputBlocks.join("\n\n"),
2947
+ timedOut: installResult.timedOut
2948
+ };
2949
+ }
2950
+ }
2899
2951
  if (orgHook) {
2900
2952
  const orgResult = await executeHookScript({
2901
2953
  label: "org-warm-hook",
@@ -3171,6 +3223,7 @@ function createV1Routes(deps) {
3171
3223
  try {
3172
3224
  const body = await c.req.json();
3173
3225
  const result = await runWarmHooks({
3226
+ skills: Array.isArray(body.skills) ? body.skills : [],
3174
3227
  organizationWarmHook: body.organizationWarmHook,
3175
3228
  includeRepoHooks: body.includeRepoHooks,
3176
3229
  timeoutMs: body.timeoutMs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.47",
3
+ "version": "0.1.49",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",