@amsterdamdatalabs/enact-extensions 0.1.34 → 0.1.35

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amsterdamdatalabs/enact-extensions",
3
- "version": "0.1.34",
3
+ "version": "0.1.35",
4
4
  "description": "Create and validate Enact multi-platform plugin manifests",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -938,6 +938,8 @@ if (command === "serve") {
938
938
  // Reads a UserPromptSubmit hook payload from stdin, extracts the prompt,
939
939
  // builds the skill catalog from the bundled extensions dir, routes the
940
940
  // prompt, and writes the hook response to stdout.
941
+ // Set ENACT_EXTENSIONS_UPS_ROUTER=0 to disable this hook locally without
942
+ // removing the installed plugin.
941
943
  //
942
944
  // Output contract (Claude Code hooks):
943
945
  // Match: { continue: true, hookSpecificOutput: { hookEventName: "UserPromptSubmit", additionalContext: <string> } }
@@ -973,6 +975,11 @@ if (command === "hook") {
973
975
  process.exit(0);
974
976
  }
975
977
 
978
+ if (process.env.ENACT_EXTENSIONS_UPS_ROUTER === "0") {
979
+ process.stdout.write(JSON.stringify({ continue: true }) + "\n");
980
+ process.exit(0);
981
+ }
982
+
976
983
  // Read stdin to get the hook payload JSON.
977
984
  let payload;
978
985
  try {
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * ups-router.mjs — pure, testable module for the UserPromptSubmit keyword-router.
3
3
  *
4
- * Discovers plugin bundles and their skills, extracts trigger keywords from
5
- * SKILL.md frontmatter, and routes a user prompt to matching skills.
4
+ * Discovers plugin bundles and their skills, extracts explicit trigger phrases
5
+ * from SKILL.md frontmatter, and routes a user prompt to matching skills.
6
6
  *
7
7
  * Two exports:
8
8
  * buildSkillCatalog(extensionsDir) → CatalogEntry[]
@@ -147,49 +147,11 @@ function extractExplicitTriggers(description) {
147
147
  return quoted;
148
148
  }
149
149
 
150
- /**
151
- * Derive salient keywords from a skill's description text.
152
- *
153
- * Conservative: only extracts tokens that are plausibly skill identifiers:
154
- * - Hyphenated compound tokens (e.g. "contract-runner", "test-driven")
155
- * - $skill-name mentions (e.g. "$loop", "$tdd")
156
- * - Quoted short phrases other than the "Triggers on" section
157
- * - Unquoted tokens that are longer (>=6 chars) and not stop-words
158
- *
159
- * @param {string} description
160
- * @returns {string[]}
161
- */
162
- function descriptionKeywords(description) {
163
- const tokens = new Set();
164
-
165
- // $skill mentions: "$foo", "$foo-bar"
166
- const dollarRe = /\$([a-z][a-z0-9-]+)/gi;
167
- let m;
168
- while ((m = dollarRe.exec(description)) !== null) {
169
- tokens.add(m[1].toLowerCase());
170
- }
171
-
172
- // Hyphenated compound tokens: at least two segments, each 2+ chars
173
- const hyphenRe = /\b([a-z][a-z0-9]*(?:-[a-z][a-z0-9]*)+)\b/gi;
174
- while ((m = hyphenRe.exec(description)) !== null) {
175
- const tok = m[1].toLowerCase();
176
- if (!isStopWord(tok)) tokens.add(tok);
177
- }
178
-
179
- // Longer bare words (>=6 chars) that don't look like common English prose.
180
- const longWordRe = /\b([a-z]{6,})\b/gi;
181
- while ((m = longWordRe.exec(description)) !== null) {
182
- const tok = m[1].toLowerCase();
183
- if (!isStopWord(tok)) tokens.add(tok);
184
- }
185
-
186
- return [...tokens];
187
- }
188
-
189
150
  /**
190
151
  * Derive the full keyword set for a single skill.
191
- * Priority: explicit "Triggers on" > skill name > salient description terms.
192
- * Deduplicates and excludes stop-words.
152
+ * Only explicit `Triggers on "..."` phrases and the skill name are used.
153
+ * Do not mine arbitrary words from descriptions; that makes everyday prompts
154
+ * like "change this contract" trigger unrelated skill hints.
193
155
  *
194
156
  * @param {string} skillName
195
157
  * @param {string|null} description
@@ -208,8 +170,6 @@ function deriveKeywords(skillName, description) {
208
170
  if (description) {
209
171
  // Explicit triggers have highest priority.
210
172
  for (const t of extractExplicitTriggers(description)) push(t);
211
- // Salient terms from the description.
212
- for (const t of descriptionKeywords(description)) push(t);
213
173
  }
214
174
 
215
175
  return [...seen];