awesome-slash 2.4.4 → 2.5.1

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 (151) hide show
  1. package/.claude-plugin/marketplace.json +6 -6
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +123 -1
  4. package/README.md +186 -159
  5. package/SECURITY.md +25 -81
  6. package/adapters/codex/install.sh +58 -16
  7. package/adapters/opencode/install.sh +92 -23
  8. package/lib/index.js +47 -4
  9. package/lib/patterns/review-patterns.js +58 -11
  10. package/lib/patterns/slop-patterns.js +154 -147
  11. package/lib/platform/detect-platform.js +99 -350
  12. package/lib/platform/detection-configs.js +93 -0
  13. package/lib/platform/state-dir.js +122 -0
  14. package/lib/platform/verify-tools.js +10 -78
  15. package/lib/schemas/README.md +195 -0
  16. package/lib/schemas/validator.js +247 -0
  17. package/lib/sources/custom-handler.js +199 -0
  18. package/lib/sources/policy-questions.js +239 -0
  19. package/lib/sources/source-cache.js +164 -0
  20. package/lib/state/workflow-state.js +368 -665
  21. package/lib/types/README.md +292 -0
  22. package/lib/types/agent-frontmatter.d.ts +134 -0
  23. package/lib/types/command-frontmatter.d.ts +107 -0
  24. package/lib/types/hook-frontmatter.d.ts +115 -0
  25. package/lib/types/index.d.ts +84 -0
  26. package/lib/types/plugin-manifest.d.ts +102 -0
  27. package/lib/types/skill-frontmatter.d.ts +89 -0
  28. package/lib/utils/cache-manager.js +154 -0
  29. package/lib/utils/context-optimizer.js +5 -36
  30. package/lib/utils/deprecation.js +37 -0
  31. package/lib/utils/shell-escape.js +88 -0
  32. package/mcp-server/index.js +513 -22
  33. package/package.json +6 -2
  34. package/plugins/deslop-around/.claude-plugin/plugin.json +1 -1
  35. package/plugins/deslop-around/lib/index.js +170 -0
  36. package/plugins/deslop-around/lib/patterns/review-patterns.js +58 -11
  37. package/plugins/deslop-around/lib/patterns/slop-patterns.js +169 -129
  38. package/plugins/deslop-around/lib/platform/detect-platform.js +162 -316
  39. package/plugins/deslop-around/lib/platform/detection-configs.js +93 -0
  40. package/plugins/deslop-around/lib/platform/state-dir.js +122 -0
  41. package/plugins/deslop-around/lib/platform/verify-tools.js +10 -78
  42. package/plugins/deslop-around/lib/schemas/README.md +195 -0
  43. package/plugins/deslop-around/lib/schemas/validator.js +247 -0
  44. package/plugins/deslop-around/lib/sources/custom-handler.js +199 -0
  45. package/plugins/deslop-around/lib/sources/policy-questions.js +239 -0
  46. package/plugins/deslop-around/lib/sources/source-cache.js +164 -0
  47. package/plugins/deslop-around/lib/state/workflow-state.js +387 -484
  48. package/plugins/deslop-around/lib/types/README.md +292 -0
  49. package/plugins/deslop-around/lib/types/agent-frontmatter.d.ts +134 -0
  50. package/plugins/deslop-around/lib/types/command-frontmatter.d.ts +107 -0
  51. package/plugins/deslop-around/lib/types/hook-frontmatter.d.ts +115 -0
  52. package/plugins/deslop-around/lib/types/index.d.ts +84 -0
  53. package/plugins/deslop-around/lib/types/plugin-manifest.d.ts +102 -0
  54. package/plugins/deslop-around/lib/types/skill-frontmatter.d.ts +89 -0
  55. package/plugins/deslop-around/lib/utils/cache-manager.js +154 -0
  56. package/plugins/deslop-around/lib/utils/context-optimizer.js +115 -37
  57. package/plugins/deslop-around/lib/utils/deprecation.js +37 -0
  58. package/plugins/deslop-around/lib/utils/shell-escape.js +88 -0
  59. package/plugins/next-task/.claude-plugin/plugin.json +1 -1
  60. package/plugins/next-task/agents/delivery-validator.md +2 -2
  61. package/plugins/next-task/agents/implementation-agent.md +3 -4
  62. package/plugins/next-task/agents/planning-agent.md +77 -19
  63. package/plugins/next-task/agents/review-orchestrator.md +21 -122
  64. package/plugins/next-task/agents/task-discoverer.md +164 -23
  65. package/plugins/next-task/commands/next-task.md +180 -14
  66. package/plugins/next-task/lib/index.js +170 -0
  67. package/plugins/next-task/lib/patterns/review-patterns.js +58 -11
  68. package/plugins/next-task/lib/patterns/slop-patterns.js +169 -129
  69. package/plugins/next-task/lib/platform/detect-platform.js +162 -316
  70. package/plugins/next-task/lib/platform/detection-configs.js +93 -0
  71. package/plugins/next-task/lib/platform/state-dir.js +122 -0
  72. package/plugins/next-task/lib/platform/verify-tools.js +10 -78
  73. package/plugins/next-task/lib/schemas/README.md +195 -0
  74. package/plugins/next-task/lib/schemas/validator.js +247 -0
  75. package/plugins/next-task/lib/sources/custom-handler.js +199 -0
  76. package/plugins/next-task/lib/sources/policy-questions.js +239 -0
  77. package/plugins/next-task/lib/sources/source-cache.js +164 -0
  78. package/plugins/next-task/lib/state/workflow-state.js +387 -484
  79. package/plugins/next-task/lib/types/README.md +292 -0
  80. package/plugins/next-task/lib/types/agent-frontmatter.d.ts +134 -0
  81. package/plugins/next-task/lib/types/command-frontmatter.d.ts +107 -0
  82. package/plugins/next-task/lib/types/hook-frontmatter.d.ts +115 -0
  83. package/plugins/next-task/lib/types/index.d.ts +84 -0
  84. package/plugins/next-task/lib/types/plugin-manifest.d.ts +102 -0
  85. package/plugins/next-task/lib/types/skill-frontmatter.d.ts +89 -0
  86. package/plugins/next-task/lib/utils/cache-manager.js +154 -0
  87. package/plugins/next-task/lib/utils/context-optimizer.js +115 -37
  88. package/plugins/next-task/lib/utils/deprecation.js +37 -0
  89. package/plugins/next-task/lib/utils/shell-escape.js +88 -0
  90. package/plugins/project-review/.claude-plugin/plugin.json +1 -1
  91. package/plugins/project-review/lib/index.js +170 -0
  92. package/plugins/project-review/lib/patterns/review-patterns.js +58 -11
  93. package/plugins/project-review/lib/patterns/slop-patterns.js +169 -129
  94. package/plugins/project-review/lib/platform/detect-platform.js +162 -316
  95. package/plugins/project-review/lib/platform/detection-configs.js +93 -0
  96. package/plugins/project-review/lib/platform/state-dir.js +122 -0
  97. package/plugins/project-review/lib/platform/verify-tools.js +10 -78
  98. package/plugins/project-review/lib/schemas/README.md +195 -0
  99. package/plugins/project-review/lib/schemas/validator.js +247 -0
  100. package/plugins/project-review/lib/sources/custom-handler.js +199 -0
  101. package/plugins/project-review/lib/sources/policy-questions.js +239 -0
  102. package/plugins/project-review/lib/sources/source-cache.js +164 -0
  103. package/plugins/project-review/lib/state/workflow-state.js +387 -484
  104. package/plugins/project-review/lib/types/README.md +292 -0
  105. package/plugins/project-review/lib/types/agent-frontmatter.d.ts +134 -0
  106. package/plugins/project-review/lib/types/command-frontmatter.d.ts +107 -0
  107. package/plugins/project-review/lib/types/hook-frontmatter.d.ts +115 -0
  108. package/plugins/project-review/lib/types/index.d.ts +84 -0
  109. package/plugins/project-review/lib/types/plugin-manifest.d.ts +102 -0
  110. package/plugins/project-review/lib/types/skill-frontmatter.d.ts +89 -0
  111. package/plugins/project-review/lib/utils/cache-manager.js +154 -0
  112. package/plugins/project-review/lib/utils/context-optimizer.js +115 -37
  113. package/plugins/project-review/lib/utils/deprecation.js +37 -0
  114. package/plugins/project-review/lib/utils/shell-escape.js +88 -0
  115. package/plugins/reality-check/.claude-plugin/plugin.json +1 -1
  116. package/plugins/reality-check/agents/code-explorer.md +1 -1
  117. package/plugins/ship/.claude-plugin/plugin.json +1 -1
  118. package/plugins/ship/lib/index.js +170 -0
  119. package/plugins/ship/lib/patterns/review-patterns.js +58 -11
  120. package/plugins/ship/lib/patterns/slop-patterns.js +169 -129
  121. package/plugins/ship/lib/platform/detect-platform.js +162 -316
  122. package/plugins/ship/lib/platform/detection-configs.js +93 -0
  123. package/plugins/ship/lib/platform/state-dir.js +122 -0
  124. package/plugins/ship/lib/platform/verify-tools.js +10 -78
  125. package/plugins/ship/lib/schemas/README.md +195 -0
  126. package/plugins/ship/lib/schemas/validator.js +247 -0
  127. package/plugins/ship/lib/sources/custom-handler.js +199 -0
  128. package/plugins/ship/lib/sources/policy-questions.js +239 -0
  129. package/plugins/ship/lib/sources/source-cache.js +164 -0
  130. package/plugins/ship/lib/state/workflow-state.js +387 -484
  131. package/plugins/ship/lib/types/README.md +292 -0
  132. package/plugins/ship/lib/types/agent-frontmatter.d.ts +134 -0
  133. package/plugins/ship/lib/types/command-frontmatter.d.ts +107 -0
  134. package/plugins/ship/lib/types/hook-frontmatter.d.ts +115 -0
  135. package/plugins/ship/lib/types/index.d.ts +84 -0
  136. package/plugins/ship/lib/types/plugin-manifest.d.ts +102 -0
  137. package/plugins/ship/lib/types/skill-frontmatter.d.ts +89 -0
  138. package/plugins/ship/lib/utils/cache-manager.js +154 -0
  139. package/plugins/ship/lib/utils/context-optimizer.js +115 -37
  140. package/plugins/ship/lib/utils/deprecation.js +37 -0
  141. package/plugins/ship/lib/utils/shell-escape.js +88 -0
  142. package/scripts/install/codex.sh +216 -72
  143. package/scripts/install/opencode.sh +197 -21
  144. package/lib/state/workflow-state.schema.json +0 -282
  145. package/plugins/deslop-around/lib/state/workflow-state.schema.json +0 -282
  146. package/plugins/next-task/agents/policy-selector.md +0 -248
  147. package/plugins/next-task/lib/state/tasks-registry.schema.json +0 -85
  148. package/plugins/next-task/lib/state/workflow-state.schema.json +0 -282
  149. package/plugins/next-task/lib/state/worktree-status.schema.json +0 -219
  150. package/plugins/project-review/lib/state/workflow-state.schema.json +0 -282
  151. package/plugins/ship/lib/state/workflow-state.schema.json +0 -282
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Awesome-Slash Core Library
3
+ *
4
+ * Unified entry point for all core library modules.
5
+ * Provides platform detection, pattern matching, workflow state management,
6
+ * configuration management, and context optimization utilities.
7
+ *
8
+ * @module awesome-slash/lib
9
+ * @author Avi Fenesh
10
+ * @license MIT
11
+ */
12
+
13
+ const detectPlatform = require('./platform/detect-platform');
14
+ const verifyTools = require('./platform/verify-tools');
15
+ const reviewPatterns = require('./patterns/review-patterns');
16
+ const slopPatterns = require('./patterns/slop-patterns');
17
+ const workflowState = require('./state/workflow-state');
18
+ const contextOptimizer = require('./utils/context-optimizer');
19
+ const shellEscape = require('./utils/shell-escape');
20
+ const config = require('./config');
21
+ const sourceCache = require('./sources/source-cache');
22
+ const customHandler = require('./sources/custom-handler');
23
+ const policyQuestions = require('./sources/policy-questions');
24
+
25
+ /**
26
+ * Platform detection and verification utilities
27
+ */
28
+ const platform = {
29
+ /**
30
+ * Detect project platform configuration
31
+ * @see module:platform/detect-platform
32
+ */
33
+ detect: detectPlatform.detect,
34
+ detectAsync: detectPlatform.detectAsync,
35
+ detectCI: detectPlatform.detectCI,
36
+ detectDeployment: detectPlatform.detectDeployment,
37
+ detectProjectType: detectPlatform.detectProjectType,
38
+ detectPackageManager: detectPlatform.detectPackageManager,
39
+ detectBranchStrategy: detectPlatform.detectBranchStrategy,
40
+ detectMainBranch: detectPlatform.detectMainBranch,
41
+ invalidateCache: detectPlatform.invalidateCache,
42
+
43
+ /**
44
+ * Verify tool availability
45
+ * @see module:platform/verify-tools
46
+ */
47
+ verifyTools: verifyTools.verify,
48
+ verifyToolsAsync: verifyTools.verifyAsync,
49
+ checkTool: verifyTools.checkTool,
50
+ checkToolAsync: verifyTools.checkToolAsync,
51
+ TOOL_DEFINITIONS: verifyTools.TOOL_DEFINITIONS
52
+ };
53
+
54
+ /**
55
+ * Code pattern matching utilities
56
+ */
57
+ const patterns = {
58
+ /**
59
+ * Review patterns for code quality analysis
60
+ * @see module:patterns/review-patterns
61
+ */
62
+ review: reviewPatterns,
63
+
64
+ /**
65
+ * Slop patterns for AI-generated code detection
66
+ * @see module:patterns/slop-patterns
67
+ */
68
+ slop: slopPatterns
69
+ };
70
+
71
+ /**
72
+ * Workflow state management
73
+ * @see module:state/workflow-state
74
+ */
75
+ const state = {
76
+ // Constants
77
+ SCHEMA_VERSION: workflowState.SCHEMA_VERSION,
78
+ PHASES: workflowState.PHASES,
79
+ DEFAULT_POLICY: workflowState.DEFAULT_POLICY,
80
+
81
+ // Core functions
82
+ generateWorkflowId: workflowState.generateWorkflowId,
83
+ getStatePath: workflowState.getStatePath,
84
+ ensureStateDir: workflowState.ensureStateDir,
85
+ validateStateSchema: workflowState.validateStateSchema,
86
+
87
+ // CRUD operations
88
+ createState: workflowState.createState,
89
+ readState: workflowState.readState,
90
+ writeState: workflowState.writeState,
91
+ updateState: workflowState.updateState,
92
+ deleteState: workflowState.deleteState,
93
+
94
+ // Phase management
95
+ startPhase: workflowState.startPhase,
96
+ completePhase: workflowState.completePhase,
97
+ failPhase: workflowState.failPhase,
98
+ skipToPhase: workflowState.skipToPhase,
99
+
100
+ // Workflow lifecycle
101
+ completeWorkflow: workflowState.completeWorkflow,
102
+ abortWorkflow: workflowState.abortWorkflow,
103
+ hasActiveWorkflow: workflowState.hasActiveWorkflow,
104
+ getWorkflowSummary: workflowState.getWorkflowSummary,
105
+
106
+ // Agent management
107
+ updateAgentResult: workflowState.updateAgentResult,
108
+ incrementIteration: workflowState.incrementIteration
109
+ };
110
+
111
+ /**
112
+ * Git command optimization and string escaping utilities
113
+ * @see module:utils/context-optimizer
114
+ * @see module:utils/shell-escape
115
+ */
116
+ const utils = {
117
+ contextOptimizer,
118
+ shellEscape
119
+ };
120
+
121
+ /**
122
+ * Task source management
123
+ * @see module:sources/source-cache
124
+ * @see module:sources/custom-handler
125
+ * @see module:sources/policy-questions
126
+ */
127
+ const sources = {
128
+ // Main entry point - returns ready-to-use question structure
129
+ getPolicyQuestions: policyQuestions.getPolicyQuestions,
130
+ getCustomTypeQuestions: policyQuestions.getCustomTypeQuestions,
131
+ getCustomNameQuestion: policyQuestions.getCustomNameQuestion,
132
+ parseAndCachePolicy: policyQuestions.parseAndCachePolicy,
133
+ isUsingCached: policyQuestions.isUsingCached,
134
+ needsCustomFollowUp: policyQuestions.needsCustomFollowUp,
135
+ needsOtherDescription: policyQuestions.needsOtherDescription,
136
+
137
+ // Cache operations (direct access if needed)
138
+ getPreference: sourceCache.getPreference,
139
+ savePreference: sourceCache.savePreference,
140
+ getToolCapabilities: sourceCache.getToolCapabilities,
141
+ saveToolCapabilities: sourceCache.saveToolCapabilities,
142
+ clearCache: sourceCache.clearCache,
143
+
144
+ // Custom source handling (direct access if needed)
145
+ SOURCE_TYPES: customHandler.SOURCE_TYPES,
146
+ probeCLI: customHandler.probeCLI,
147
+ buildCustomConfig: customHandler.buildCustomConfig
148
+ };
149
+
150
+ // Main exports
151
+ module.exports = {
152
+ platform,
153
+ patterns,
154
+ state,
155
+ utils,
156
+ config,
157
+ sources,
158
+
159
+ // Direct module access for backward compatibility
160
+ detectPlatform,
161
+ verifyTools,
162
+ reviewPatterns,
163
+ slopPatterns,
164
+ workflowState,
165
+ contextOptimizer,
166
+ shellEscape,
167
+ sourceCache,
168
+ customHandler,
169
+ policyQuestions
170
+ };
@@ -328,8 +328,24 @@ const _patternCountByFramework = new Map();
328
328
  */
329
329
  const _flattenedPatterns = new Map();
330
330
 
331
- // Build indexes at module load time
332
- (function buildIndexes() {
331
+ /**
332
+ * Track if indexes have been built (lazy initialization)
333
+ */
334
+ let _indexesBuilt = false;
335
+
336
+ /**
337
+ * Cached arrays for getAvailableFrameworks/Categories (computed once)
338
+ */
339
+ let _cachedFrameworks = null;
340
+ let _cachedCategories = null;
341
+
342
+ /**
343
+ * Build indexes on first access (lazy initialization)
344
+ * This improves module load time by deferring work until needed
345
+ */
346
+ function ensureIndexesBuilt() {
347
+ if (_indexesBuilt) return;
348
+
333
349
  for (const [framework, categories] of Object.entries(reviewPatterns)) {
334
350
  let totalPatterns = 0;
335
351
  const flattened = [];
@@ -355,11 +371,13 @@ const _flattenedPatterns = new Map();
355
371
  _patternCountByFramework.set(framework, totalPatterns);
356
372
  _flattenedPatterns.set(framework, flattened);
357
373
  }
358
- })();
359
374
 
360
- // Freeze the index Sets
361
- Object.freeze(_frameworksSet);
362
- Object.freeze(_categoriesSet);
375
+ // Cache the arrays (avoid repeated Array.from calls)
376
+ _cachedFrameworks = Array.from(_frameworksSet);
377
+ _cachedCategories = Array.from(_categoriesSet);
378
+
379
+ _indexesBuilt = true;
380
+ }
363
381
 
364
382
  /**
365
383
  * Get review patterns for a detected framework (O(1) lookup)
@@ -377,6 +395,7 @@ function getPatternsForFramework(framework) {
377
395
  * @returns {Map<string, Array>} Map of framework -> patterns for that category
378
396
  */
379
397
  function getPatternsByCategory(category) {
398
+ ensureIndexesBuilt();
380
399
  return _patternsByCategory.get(category) || new Map();
381
400
  }
382
401
 
@@ -393,19 +412,23 @@ function getPatternsForFrameworkCategory(framework, category) {
393
412
  }
394
413
 
395
414
  /**
396
- * Get all available frameworks (O(1) via pre-computed Set)
415
+ * Get all available frameworks (O(1) via cached array)
416
+ * Optimized: returns cached array instead of Array.from() on every call
397
417
  * @returns {Array<string>} List of framework names
398
418
  */
399
419
  function getAvailableFrameworks() {
400
- return Array.from(_frameworksSet);
420
+ ensureIndexesBuilt();
421
+ return _cachedFrameworks;
401
422
  }
402
423
 
403
424
  /**
404
- * Get all available categories across all frameworks
425
+ * Get all available categories across all frameworks (O(1) via cached array)
426
+ * Optimized: returns cached array instead of Array.from() on every call
405
427
  * @returns {Array<string>} List of category names
406
428
  */
407
429
  function getAvailableCategories() {
408
- return Array.from(_categoriesSet);
430
+ ensureIndexesBuilt();
431
+ return _cachedCategories;
409
432
  }
410
433
 
411
434
  /**
@@ -435,6 +458,7 @@ function hasPatternsFor(framework) {
435
458
  * @returns {boolean} True if category exists
436
459
  */
437
460
  function hasCategory(category) {
461
+ ensureIndexesBuilt();
438
462
  return _categoriesSet.has(category);
439
463
  }
440
464
 
@@ -444,6 +468,7 @@ function hasCategory(category) {
444
468
  * @returns {number} Number of patterns
445
469
  */
446
470
  function getPatternCount(framework) {
471
+ ensureIndexesBuilt();
447
472
  return _patternCountByFramework.get(framework.toLowerCase()) || 0;
448
473
  }
449
474
 
@@ -452,6 +477,7 @@ function getPatternCount(framework) {
452
477
  * @returns {number} Total pattern count
453
478
  */
454
479
  function getTotalPatternCount() {
480
+ ensureIndexesBuilt();
455
481
  let total = 0;
456
482
  for (const count of _patternCountByFramework.values()) {
457
483
  total += count;
@@ -461,17 +487,37 @@ function getTotalPatternCount() {
461
487
 
462
488
  /**
463
489
  * Search patterns by keyword across all frameworks
490
+ * Optimized: supports pagination to avoid returning thousands of results
464
491
  * @param {string} keyword - Search term (case-insensitive)
492
+ * @param {Object} [options] - Search options
493
+ * @param {number} [options.limit] - Maximum number of results (default: unlimited)
494
+ * @param {number} [options.offset=0] - Number of results to skip
465
495
  * @returns {Array<{framework: string, category: string, pattern: string}>} Matching patterns
466
496
  */
467
- function searchPatterns(keyword) {
497
+ function searchPatterns(keyword, options = {}) {
498
+ ensureIndexesBuilt();
468
499
  const lowerKeyword = keyword.toLowerCase();
500
+ const { limit, offset = 0 } = options;
469
501
  const results = [];
502
+ let skipped = 0;
503
+ let collected = 0;
470
504
 
471
505
  for (const [framework, patterns] of _flattenedPatterns) {
472
506
  for (const { category, pattern } of patterns) {
473
507
  if (pattern.toLowerCase().includes(lowerKeyword)) {
508
+ // Skip results until we reach offset
509
+ if (skipped < offset) {
510
+ skipped++;
511
+ continue;
512
+ }
513
+
474
514
  results.push({ framework, category, pattern });
515
+ collected++;
516
+
517
+ // Stop if we've collected enough results
518
+ if (limit && collected >= limit) {
519
+ return results;
520
+ }
475
521
  }
476
522
  }
477
523
  }
@@ -485,6 +531,7 @@ function searchPatterns(keyword) {
485
531
  * @returns {Array<string>} List of frameworks with this category
486
532
  */
487
533
  function getFrameworksWithCategory(category) {
534
+ ensureIndexesBuilt();
488
535
  const categoryMap = _patternsByCategory.get(category);
489
536
  if (!categoryMap) return [];
490
537
  return Array.from(categoryMap.keys());