@cleocode/caamp 1.5.1 → 1.6.0

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/cli.js CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  buildCleoProfile,
8
8
  buildServerConfig,
9
9
  buildSkillSubPathCandidates,
10
+ buildSkillsMap,
10
11
  checkAllInjections,
11
12
  checkCommandReachability,
12
13
  checkSkillUpdate,
@@ -21,9 +22,11 @@ import {
21
22
  formatSkillRecommendations,
22
23
  generateInjectionContent,
23
24
  getAllProviders,
25
+ getCommonHookEvents,
24
26
  getInstalledProviders,
25
27
  getProvider,
26
28
  getProviderCount,
29
+ getProvidersByHookEvent,
27
30
  getProvidersByPriority,
28
31
  getRegistryVersion,
29
32
  getSkill,
@@ -47,6 +50,7 @@ import {
47
50
  normalizeCleoChannel,
48
51
  parseEnvAssignments,
49
52
  parseSource,
53
+ providerSupports,
50
54
  readConfig,
51
55
  readLockFile,
52
56
  recommendSkills,
@@ -74,7 +78,7 @@ import {
74
78
  tokenizeCriteriaValue,
75
79
  updateInstructionsSingleOperation,
76
80
  validateSkill
77
- } from "./chunk-ZEXRZTQX.js";
81
+ } from "./chunk-N5E7BZM2.js";
78
82
 
79
83
  // src/cli.ts
80
84
  import { Command } from "commander";
@@ -2873,6 +2877,241 @@ ${provider.toolName}`));
2873
2877
  console.log(` Project skills: ${provider.pathProjectSkills || "(none)"}`);
2874
2878
  console.log();
2875
2879
  });
2880
+ providers.command("skills-map").description("Show skills path map for all providers").option("--json", "Output as JSON (default)").option("--human", "Output in human-readable format").option("--provider <id>", "Filter to a specific provider").action(async (opts) => {
2881
+ const operation = "providers.skills-map";
2882
+ const mvi = "standard";
2883
+ let format;
2884
+ try {
2885
+ format = resolveOutputFormat2({
2886
+ jsonFlag: opts.json ?? false,
2887
+ humanFlag: (opts.human ?? false) || isHuman(),
2888
+ projectDefault: "json"
2889
+ }).format;
2890
+ } catch (error) {
2891
+ const message = error instanceof Error ? error.message : String(error);
2892
+ emitJsonError2(operation, mvi, "E_FORMAT_CONFLICT", message, "VALIDATION");
2893
+ process.exit(1);
2894
+ }
2895
+ let map = buildSkillsMap();
2896
+ if (opts.provider) {
2897
+ map = map.filter((entry) => entry.providerId === opts.provider);
2898
+ if (map.length === 0) {
2899
+ const message = `Provider not found: ${opts.provider}`;
2900
+ if (format === "json") {
2901
+ emitJsonError2(operation, mvi, "E_PROVIDER_NOT_FOUND", message, "NOT_FOUND", {
2902
+ id: opts.provider
2903
+ });
2904
+ } else {
2905
+ console.error(pc11.red(message));
2906
+ }
2907
+ process.exit(1);
2908
+ }
2909
+ }
2910
+ if (format === "json") {
2911
+ const envelope = buildEnvelope4(
2912
+ operation,
2913
+ mvi,
2914
+ {
2915
+ skillsMap: map,
2916
+ count: map.length
2917
+ },
2918
+ null
2919
+ );
2920
+ console.log(JSON.stringify(envelope, null, 2));
2921
+ return;
2922
+ }
2923
+ console.log(pc11.bold("\nProvider Skills Map\n"));
2924
+ console.log(
2925
+ ` ${pc11.bold("Provider".padEnd(22))} ${pc11.bold("Precedence".padEnd(30))} ${pc11.bold("Global Path".padEnd(40))} ${pc11.bold("Project Path")}`
2926
+ );
2927
+ console.log(` ${"\u2500".repeat(22)} ${"\u2500".repeat(30)} ${"\u2500".repeat(40)} ${"\u2500".repeat(30)}`);
2928
+ for (const entry of map) {
2929
+ console.log(
2930
+ ` ${entry.toolName.padEnd(22)} ${entry.precedence.padEnd(30)} ${(entry.paths.global ?? "-").padEnd(40)} ${entry.paths.project ?? "-"}`
2931
+ );
2932
+ }
2933
+ console.log(pc11.dim(`
2934
+ ${map.length} providers shown`));
2935
+ console.log();
2936
+ });
2937
+ providers.command("hooks").description("Show provider hook event support").option("--json", "Output as JSON (default)").option("--human", "Output in human-readable format").option("--event <event>", "Filter to providers supporting a specific hook event").option("--common", "Show hook events common to all providers").action(async (opts) => {
2938
+ const operation = "providers.hooks";
2939
+ const mvi = "standard";
2940
+ let format;
2941
+ try {
2942
+ format = resolveOutputFormat2({
2943
+ jsonFlag: opts.json ?? false,
2944
+ humanFlag: (opts.human ?? false) || isHuman(),
2945
+ projectDefault: "json"
2946
+ }).format;
2947
+ } catch (error) {
2948
+ const message = error instanceof Error ? error.message : String(error);
2949
+ emitJsonError2(operation, mvi, "E_FORMAT_CONFLICT", message, "VALIDATION");
2950
+ process.exit(1);
2951
+ }
2952
+ if (opts.event) {
2953
+ const event = opts.event;
2954
+ const matching = getProvidersByHookEvent(event);
2955
+ if (format === "json") {
2956
+ const envelope = buildEnvelope4(
2957
+ operation,
2958
+ mvi,
2959
+ {
2960
+ event,
2961
+ providers: matching.map((p) => ({
2962
+ id: p.id,
2963
+ toolName: p.toolName,
2964
+ supportedEvents: p.capabilities.hooks.supported
2965
+ })),
2966
+ count: matching.length
2967
+ },
2968
+ null
2969
+ );
2970
+ console.log(JSON.stringify(envelope, null, 2));
2971
+ return;
2972
+ }
2973
+ console.log(pc11.bold(`
2974
+ Providers supporting ${pc11.green(event)}:
2975
+ `));
2976
+ if (matching.length === 0) {
2977
+ console.log(pc11.dim(" No providers support this event."));
2978
+ } else {
2979
+ for (const p of matching) {
2980
+ console.log(` ${pc11.bold(p.toolName.padEnd(22))} ${pc11.dim(p.id)}`);
2981
+ }
2982
+ }
2983
+ console.log();
2984
+ return;
2985
+ }
2986
+ if (opts.common) {
2987
+ const common = getCommonHookEvents();
2988
+ if (format === "json") {
2989
+ const envelope = buildEnvelope4(
2990
+ operation,
2991
+ mvi,
2992
+ {
2993
+ commonEvents: common,
2994
+ count: common.length
2995
+ },
2996
+ null
2997
+ );
2998
+ console.log(JSON.stringify(envelope, null, 2));
2999
+ return;
3000
+ }
3001
+ console.log(pc11.bold("\nHook events common to all providers:\n"));
3002
+ if (common.length === 0) {
3003
+ console.log(pc11.dim(" No events are common to all providers."));
3004
+ } else {
3005
+ for (const event of common) {
3006
+ console.log(` ${pc11.green(event)}`);
3007
+ }
3008
+ }
3009
+ console.log();
3010
+ return;
3011
+ }
3012
+ const all = getAllProviders();
3013
+ const withHooks = all.filter((p) => p.capabilities.hooks.supported.length > 0);
3014
+ if (format === "json") {
3015
+ const envelope = buildEnvelope4(
3016
+ operation,
3017
+ mvi,
3018
+ {
3019
+ providers: all.map((p) => ({
3020
+ id: p.id,
3021
+ toolName: p.toolName,
3022
+ supportedEvents: p.capabilities.hooks.supported
3023
+ })),
3024
+ withHooksCount: withHooks.length,
3025
+ totalCount: all.length
3026
+ },
3027
+ null
3028
+ );
3029
+ console.log(JSON.stringify(envelope, null, 2));
3030
+ return;
3031
+ }
3032
+ console.log(pc11.bold(`
3033
+ Provider Hook Support
3034
+ `));
3035
+ if (withHooks.length === 0) {
3036
+ console.log(pc11.dim(" No providers have hook support."));
3037
+ } else {
3038
+ for (const p of withHooks) {
3039
+ console.log(` ${pc11.bold(p.toolName.padEnd(22))} ${pc11.dim(p.capabilities.hooks.supported.join(", "))}`);
3040
+ }
3041
+ }
3042
+ const withoutHooks = all.length - withHooks.length;
3043
+ if (withoutHooks > 0) {
3044
+ console.log(pc11.dim(`
3045
+ ${withoutHooks} providers without hook support`));
3046
+ }
3047
+ console.log();
3048
+ });
3049
+ providers.command("capabilities").description("Show provider capability matrix").option("--json", "Output as JSON (default)").option("--human", "Output in human-readable format").option("--filter <path>", "Filter to providers supporting a capability dot-path (e.g. spawn.supportsSubagents)").action(async (opts) => {
3050
+ const operation = "providers.capabilities";
3051
+ const mvi = "standard";
3052
+ let format;
3053
+ try {
3054
+ format = resolveOutputFormat2({
3055
+ jsonFlag: opts.json ?? false,
3056
+ humanFlag: (opts.human ?? false) || isHuman(),
3057
+ projectDefault: "json"
3058
+ }).format;
3059
+ } catch (error) {
3060
+ const message = error instanceof Error ? error.message : String(error);
3061
+ emitJsonError2(operation, mvi, "E_FORMAT_CONFLICT", message, "VALIDATION");
3062
+ process.exit(1);
3063
+ }
3064
+ let all = getAllProviders();
3065
+ if (opts.filter) {
3066
+ all = all.filter((p) => providerSupports(p, opts.filter));
3067
+ }
3068
+ const matrix = all.map((p) => ({
3069
+ id: p.id,
3070
+ toolName: p.toolName,
3071
+ skillsPrecedence: p.capabilities.skills.precedence,
3072
+ hooksCount: p.capabilities.hooks.supported.length,
3073
+ spawnMechanism: p.capabilities.spawn.spawnMechanism,
3074
+ spawnFlags: {
3075
+ supportsSubagents: p.capabilities.spawn.supportsSubagents,
3076
+ supportsProgrammaticSpawn: p.capabilities.spawn.supportsProgrammaticSpawn,
3077
+ supportsInterAgentComms: p.capabilities.spawn.supportsInterAgentComms,
3078
+ supportsParallelSpawn: p.capabilities.spawn.supportsParallelSpawn
3079
+ }
3080
+ }));
3081
+ if (format === "json") {
3082
+ const envelope = buildEnvelope4(
3083
+ operation,
3084
+ mvi,
3085
+ {
3086
+ capabilities: matrix,
3087
+ count: matrix.length,
3088
+ filter: opts.filter || null
3089
+ },
3090
+ null
3091
+ );
3092
+ console.log(JSON.stringify(envelope, null, 2));
3093
+ return;
3094
+ }
3095
+ console.log(pc11.bold("\nProvider Capability Matrix\n"));
3096
+ if (opts.filter) {
3097
+ console.log(pc11.dim(` Filter: ${opts.filter}
3098
+ `));
3099
+ }
3100
+ console.log(
3101
+ ` ${pc11.bold("Provider".padEnd(22))} ${pc11.bold("Skills Precedence".padEnd(20))} ${pc11.bold("Hooks".padEnd(8))} ${pc11.bold("Spawn")}`
3102
+ );
3103
+ console.log(` ${"\u2500".repeat(22)} ${"\u2500".repeat(20)} ${"\u2500".repeat(8)} ${"\u2500".repeat(20)}`);
3104
+ for (const row of matrix) {
3105
+ const hooks = row.hooksCount > 0 ? String(row.hooksCount) : "-";
3106
+ const spawn = row.spawnMechanism ?? "-";
3107
+ console.log(
3108
+ ` ${row.toolName.padEnd(22)} ${row.skillsPrecedence.padEnd(20)} ${hooks.padEnd(8)} ${spawn}`
3109
+ );
3110
+ }
3111
+ console.log(pc11.dim(`
3112
+ ${matrix.length} providers shown`));
3113
+ console.log();
3114
+ });
2876
3115
  }
2877
3116
  function buildEnvelope4(operation, mvi, result, error) {
2878
3117
  return {