agentsys 5.7.0 → 5.8.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agentsys",
3
- "description": "17 specialized plugins for AI workflow automation - task orchestration, PR workflow, slop detection, code review, drift detection, enhancement analysis, documentation sync, unified static analysis, perf investigations, topic research, agent config linting, cross-tool AI consultation, structured AI debate, workflow pattern learning, codebase onboarding, and contributor guidance",
4
- "version": "5.7.0",
3
+ "description": "19 specialized plugins for AI workflow automation - task orchestration, PR workflow, slop detection, code review, drift detection, enhancement analysis, documentation sync, unified static analysis, perf investigations, topic research, agent config linting, cross-tool AI consultation, structured AI debate, workflow pattern learning, codebase onboarding, and contributor guidance",
4
+ "version": "5.8.1",
5
5
  "owner": {
6
6
  "name": "Avi Fenesh",
7
7
  "url": "https://github.com/avifenesh"
@@ -28,11 +28,33 @@
28
28
  "source": "url",
29
29
  "url": "https://github.com/agent-sh/next-task.git"
30
30
  },
31
- "description": "Master workflow orchestrator: autonomous workflow with model optimization (opus/sonnet/haiku), two-file state management, workflow enforcement gates, 14 specialist agents",
32
- "version": "1.0.0",
31
+ "description": "Master workflow orchestrator: autonomous workflow with model optimization (opus/sonnet/haiku), two-file state management, workflow enforcement gates, 8 specialist agents",
32
+ "version": "1.1.0",
33
33
  "category": "productivity",
34
34
  "homepage": "https://github.com/agent-sh/next-task"
35
35
  },
36
+ {
37
+ "name": "prepare-delivery",
38
+ "source": {
39
+ "source": "url",
40
+ "url": "https://github.com/agent-sh/prepare-delivery.git"
41
+ },
42
+ "description": "Pre-ship quality gates: deslop, simplify, agnix, enhance, review loop, delivery validation, docs sync",
43
+ "version": "0.1.0",
44
+ "category": "productivity",
45
+ "homepage": "https://github.com/agent-sh/prepare-delivery"
46
+ },
47
+ {
48
+ "name": "gate-and-ship",
49
+ "source": {
50
+ "source": "url",
51
+ "url": "https://github.com/agent-sh/gate-and-ship.git"
52
+ },
53
+ "description": "Quality gates then ship - chains /prepare-delivery then /ship in one command",
54
+ "version": "0.1.0",
55
+ "category": "productivity",
56
+ "homepage": "https://github.com/agent-sh/gate-and-ship"
57
+ },
36
58
  {
37
59
  "name": "ship",
38
60
  "source": {
@@ -106,7 +128,7 @@
106
128
  "url": "https://github.com/agent-sh/repo-intel.git"
107
129
  },
108
130
  "description": "Unified static analysis via agent-analyzer - git history, AST symbols, project metadata, and doc-code sync",
109
- "version": "1.0.0",
131
+ "version": "0.2.0",
110
132
  "category": "development",
111
133
  "homepage": "https://github.com/agent-sh/repo-intel"
112
134
  },
@@ -138,7 +160,7 @@
138
160
  "source": "url",
139
161
  "url": "https://github.com/agent-sh/agnix.git"
140
162
  },
141
- "description": "Lint agent configuration files (SKILL.md, CLAUDE.md, hooks, MCP) against 342 rules across 10+ AI tools",
163
+ "description": "Lint agent configuration files (SKILL.md, CLAUDE.md, hooks, MCP) against 385 rules across 10+ AI tools",
142
164
  "version": "1.0.0",
143
165
  "category": "development",
144
166
  "homepage": "https://github.com/agent-sh/agnix"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentsys",
3
- "version": "5.7.0",
3
+ "version": "5.8.1",
4
4
  "description": "Professional-grade slash commands for Claude Code with cross-platform support",
5
5
  "keywords": [
6
6
  "workflow",
package/AGENTS.md CHANGED
@@ -94,6 +94,8 @@ bin/cli.js → npm CLI installer
94
94
 
95
95
  ### Core Workflow
96
96
  - `/next-task` - Master workflow: task → implementation → PR → merge
97
+ - `/prepare-delivery` - Pre-ship quality gates: deslop, review, validation, docs sync
98
+ - `/gate-and-ship` - Quality gates then ship (/prepare-delivery + /ship)
97
99
  - `/ship` - PR creation, CI monitoring, merge
98
100
  - `/enhance` - Run all enhancement analyzers
99
101
 
@@ -150,12 +152,12 @@ agentsys # Run installer
150
152
  <agents>
151
153
  ## Agents
152
154
 
153
- 35 agents across 15 plugins. Key agents by model:
155
+ 47 agents across 19 plugins. Key agents by model:
154
156
 
155
157
  | Model | Agents | Use Case |
156
158
  |-------|--------|----------|
157
159
  | **opus** | exploration, planning, implementation, perf-orchestrator, debate-orchestrator, skillers-recommender | Complex reasoning, analysis |
158
- | **sonnet** | task-discoverer, delivery-validator, ci-fixer, deslop-agent, reporters, learn, release-agent, skillers-compactor | Validation, pattern matching |
160
+ | **sonnet** | task-discoverer, delivery-validator (prepare-delivery), ci-fixer, deslop-agent, reporters, learn, release-agent, skillers-compactor | Validation, pattern matching |
159
161
  | **haiku** | worktree-manager, ci-monitor, simple-fixer | Mechanical execution |
160
162
 
161
163
  See [README.md](./README.md#command-details) and [docs/reference/AGENTS.md](./docs/reference/AGENTS.md) for full agent list.
@@ -164,7 +166,7 @@ See [README.md](./README.md#command-details) and [docs/reference/AGENTS.md](./do
164
166
  <skills>
165
167
  ## Skills
166
168
 
167
- 32 skills across plugins. Agents invoke skills for reusable implementation.
169
+ 40 skills across plugins. Agents invoke skills for reusable implementation.
168
170
 
169
171
  | Category | Key Skills |
170
172
  |----------|------------|
@@ -188,7 +190,7 @@ See [README.md](./README.md#skills) for full skill list.
188
190
 
189
191
  Platform-aware state directory:
190
192
  - Claude Code: `.claude/`
191
- - OpenCode: `config/.opencode/`
193
+ - OpenCode: `.opencode/`
192
194
  - Codex: `.codex/`
193
195
  - Cursor: `.cursor/`
194
196
  - Kiro: `.kiro/`
@@ -201,7 +203,7 @@ Cannot skip in /next-task:
201
203
  - `exploration-agent` → before planning
202
204
  - `planning-agent` → before implementation
203
205
  - **Phase 9 review loop** → MUST use orchestrate-review skill
204
- - `delivery-validator` → before sync-docs:sync-docs-agent
206
+ - `prepare-delivery:delivery-validator` → before sync-docs:sync-docs-agent
205
207
  - `sync-docs:sync-docs-agent` → before /ship
206
208
  </workflow-agents>
207
209
 
package/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ All notable changes to this project will be documented in this file.
7
7
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8
8
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
9
9
 
10
+ ## [Unreleased]
11
+
12
+ ## [5.8.0] - 2026-03-25
13
+
14
+ ### Added
15
+ - prepare-delivery plugin - pre-ship quality gates (deslop, simplify, agnix, enhance, review loop, validation, docs sync)
16
+ - gate-and-ship plugin - orchestrator that chains /prepare-delivery then /ship
17
+ - /prepare-delivery and /gate-and-ship commands in marketplace, README, and AGENTS.md
18
+ - 9 missing agent sections in docs/reference/AGENTS.md (prepare-delivery, consult, debate, web-ctl, ship, skillers, onboard, can-i-help)
19
+ - Cursor and Kiro platform entries in site/content.json
20
+
21
+ ### Changed
22
+ - Moved orchestrate-review, validate-delivery skills from next-task to prepare-delivery in STATIC_SKILLS
23
+ - Updated plugin count from 17 to 19 across marketplace.json, tests, and docs
24
+ - Comprehensive documentation sync: all command tables, agent counts, skill counts, platform lists updated across 22 files
25
+ - next-task marketplace entry: agent count 14 -> 8 (delivery agents moved to prepare-delivery), version 1.0.0 -> 1.1.0
26
+
10
27
  ## [5.7.0] - 2026-03-23
11
28
 
12
29
  ### Changed
package/README.md CHANGED
@@ -19,7 +19,7 @@
19
19
  </p>
20
20
 
21
21
  <p align="center">
22
- <b>19 plugins · 47 agents · 39 skills (across all repos) · 30k lines of lib code · 3,583 tests · 5 platforms</b><br>
22
+ <b>19 plugins · 47 agents · 40 skills (across all repos) · 30k lines of lib code · 3,583 tests · 5 platforms</b><br>
23
23
  <em>Plugins distributed as standalone repos under <a href="https://github.com/agent-sh">agent-sh</a> org — agentsys is the marketplace &amp; installer</em>
24
24
  </p>
25
25
 
@@ -41,11 +41,11 @@
41
41
  AI models can write code. That's not the hard part anymore. The hard part is everything around it — task selection, branch management, code review, artifact cleanup, CI, PR comments, deployment. **AgentSys is the runtime that orchestrates agents to handle all of it** — structured pipelines, gated phases, specialized agents, and persistent state that survives session boundaries.
42
42
 
43
43
  ---
44
- > Building custom skills, agents, hooks, or MCP tools? [agnix](https://github.com/agent-sh/agnix) is the CLI + LSP linter that catches config errors before they fail silently - real-time IDE validation, auto suggestions, auto-fix, and 342 rules for Claude Code, Codex, OpenCode, Cursor, Kiro, Copilot, Gemini CLI, Cline, Windsurf, Roo Code, Amp, and more.
44
+ > Building custom skills, agents, hooks, or MCP tools? [agnix](https://github.com/agent-sh/agnix) is the CLI + LSP linter that catches config errors before they fail silently - real-time IDE validation, auto suggestions, auto-fix, and 385 rules for Claude Code, Codex, OpenCode, Cursor, Kiro, Copilot, Gemini CLI, Cline, Windsurf, Roo Code, Amp, and more.
45
45
 
46
46
  ## What This Is
47
47
 
48
- An agent orchestration system — 19 plugins, 47 agents, and 39 skills that compose into structured pipelines for software development. Each plugin lives in its own standalone repo under the [agent-sh](https://github.com/agent-sh) org. agentsys is the marketplace and installer that ties them together.
48
+ An agent orchestration system — 19 plugins, 47 agents, and 40 skills that compose into structured pipelines for software development. Each plugin lives in its own standalone repo under the [agent-sh](https://github.com/agent-sh) org. agentsys is the marketplace and installer that ties them together.
49
49
 
50
50
  Each agent has a single responsibility, a specific model assignment, and defined inputs/outputs. Pipelines enforce phase gates so agents can't skip steps. State persists across sessions so work survives interruptions.
51
51
 
@@ -116,7 +116,9 @@ The investment shifts from model spend to pipeline design. Better prompts, riche
116
116
  | Command | What it does |
117
117
  |---------|--------------|
118
118
  | [`/next-task`](#next-task) | Task workflow: discovery, implementation, PR, merge |
119
- | [`/agnix`](#agnix) | Lint agent configurations (342 rules) |
119
+ | [`/prepare-delivery`](#prepare-delivery) | Pre-ship quality gates: deslop, review, validation, docs sync |
120
+ | [`/gate-and-ship`](#gate-and-ship) | Quality gates then ship (/prepare-delivery + /ship) |
121
+ | [`/agnix`](#agnix) | Lint agent configurations (385 rules) |
120
122
  | [`/ship`](#ship) | PR creation, CI monitoring, merge |
121
123
  | [`/deslop`](#deslop) | Clean AI slop patterns |
122
124
  | [`/perf`](#perf) | Performance investigation with baselines and profiling |
@@ -140,11 +142,11 @@ Each command works standalone. Together, they compose into end-to-end pipelines.
140
142
 
141
143
  ## Skills
142
144
 
143
- 38 skills included across the plugins:
145
+ 40 skills included across the plugins:
144
146
 
145
147
  | Category | Skills |
146
148
  |----------|--------|
147
- | **Workflow** | `discover-tasks`, `orchestrate-review`, `validate-delivery` |
149
+ | **Workflow** | `discover-tasks`, `prepare-delivery`, `check-test-coverage`, `orchestrate-review`, `validate-delivery` |
148
150
  | **Message Queues** | `glide-mq-migrate-bee`, `glide-mq-migrate-bullmq`, `glide-mq` |
149
151
  | **Enhancement** | `enhance-agent-prompts`, `enhance-claude-memory`, `enhance-cross-file`, `enhance-docs`, `enhance-hooks`, `enhance-orchestrator`, `enhance-plugins`, `enhance-prompts`, `enhance-skills` |
150
152
  | **Performance** | `baseline`, `benchmark`, `code-paths`, `investigation-logger`, `perf-analyzer`, `profile`, `theory-gatherer`, `theory-tester` |
@@ -172,8 +174,8 @@ Skills are the reusable implementation units. Agents invoke skills; commands orc
172
174
  |---------|--------------|
173
175
  | [The Approach](#the-approach) | Why it's built this way |
174
176
  | [Benchmarks](#benchmarks) | Sonnet + agentsys vs raw Opus |
175
- | [Commands](#commands) | All 19 commands overview |
176
- | [Skills](#skills) | 39 skills across plugins |
177
+ | [Commands](#commands) | All 20 commands overview |
178
+ | [Skills](#skills) | 40 skills across plugins |
177
179
  | [Skill-Only Plugins](#skill-only-plugins) | glide-mq and other non-command plugins |
178
180
  | [Command Details](#command-details) | Deep dive into each command |
179
181
  | [How Commands Work Together](#how-commands-work-together) | Standalone vs integrated |
@@ -219,7 +221,7 @@ Key features: per-key ordering, group concurrency, runtime group rate limiting (
219
221
  5. **Planning** - Designs implementation approach
220
222
  6. **User Approval** - You review and approve the plan (last human interaction)
221
223
  7. **Implementation** - Executes the plan
222
- 8. **Pre-Review** - Runs [deslop](#deslop)-agent and test-coverage-checker
224
+ 8. **Pre-Review** - Runs [deslop](#deslop)-agent and prepare-delivery:test-coverage-checker
223
225
  9. **Review Loop** - Multi-agent review iterates until clean
224
226
  10. **Delivery Validation** - Verifies tests pass, build passes, requirements met
225
227
  11. **Docs Update** - Updates CHANGELOG and related documentation
@@ -236,8 +238,8 @@ Phase 9 uses the `orchestrate-review` skill to spawn parallel reviewers (code qu
236
238
  | exploration-agent | sonnet | Deep codebase analysis before planning |
237
239
  | planning-agent | opus | Designs step-by-step implementation plan |
238
240
  | implementation-agent | opus | Writes the actual code |
239
- | test-coverage-checker | sonnet | Validates tests exist and are meaningful |
240
- | delivery-validator | sonnet | Final checks before shipping |
241
+ | prepare-delivery:test-coverage-checker | sonnet | Validates tests exist and are meaningful |
242
+ | prepare-delivery:delivery-validator | sonnet | Final checks before shipping |
241
243
  | ci-monitor | haiku | Watches CI status |
242
244
  | ci-fixer | sonnet | Fixes CI failures and review comments |
243
245
  | simple-fixer | haiku | Executes mechanical edits |
@@ -261,6 +263,49 @@ Phase 9 uses the `orchestrate-review` skill to spawn parallel reviewers (code qu
261
263
 
262
264
  ---
263
265
 
266
+ ### /prepare-delivery
267
+
268
+ **Purpose:** Run all pre-ship quality gates without shipping. Use after completing implementation manually or outside `/next-task`.
269
+
270
+ **What it runs (in order):**
271
+
272
+ 1. **Pre-review gates** (parallel) - deslop + /simplify + prepare-delivery:test-coverage-checker
273
+ 2. **Config lint** (conditional) - agnix + /enhance when changes touch agent/skill/plugin files
274
+ 3. **Review loop** - 4 core reviewers + conditional specialists, max 5 iterations
275
+ 4. **Delivery validation** - tests pass, build passes, requirements met
276
+ 5. **Docs sync** - sync-docs agent updates documentation
277
+
278
+ ```bash
279
+ /prepare-delivery # Run all quality gates
280
+ /prepare-delivery --skip-review # Skip review loop
281
+ /prepare-delivery --skip-docs # Skip docs sync
282
+ /prepare-delivery --base=develop # Against a specific base branch
283
+ ```
284
+
285
+ Does NOT create PRs or push - use `/ship` or `/gate-and-ship` after.
286
+
287
+ ---
288
+
289
+ ### /gate-and-ship
290
+
291
+ **Purpose:** Quality gates then ship in one command. Chains `/prepare-delivery` then `/ship`.
292
+
293
+ ```bash
294
+ /gate-and-ship # Full: quality gates + ship
295
+ /gate-and-ship --skip-review # Skip review, still ship
296
+ /gate-and-ship --base=develop # Against a specific base branch
297
+ ```
298
+
299
+ **Composability:**
300
+
301
+ ```
302
+ /gate-and-ship = /prepare-delivery + /ship
303
+ ```
304
+
305
+ Each piece runs independently - use `/prepare-delivery` alone to review before deciding to ship, or `/ship` alone if already validated.
306
+
307
+ ---
308
+
264
309
  ### /agnix
265
310
 
266
311
  **Purpose:** Lint agent configurations before they break your workflow. The first dedicated linter for AI agent configs.
@@ -283,7 +328,7 @@ agnix catches these issues before they cause problems.
283
328
  | **Best Practices** | Tool restrictions, model selection, trigger phrase quality |
284
329
  | **Cross-Platform** | Compatibility across Claude Code, Codex, OpenCode, Cursor, Kiro, Copilot, Gemini CLI, Cline, Windsurf, Roo Code, Amp, and more |
285
330
 
286
- **342 validation rules** (102 auto-fixable) derived from:
331
+ **385 validation rules** (102 auto-fixable) derived from:
287
332
  - Official tool specifications (Claude Code, Codex CLI, OpenCode, Cursor, Kiro, GitHub Copilot, Gemini CLI, Cline, Windsurf, Roo Code, Amp, and more)
288
333
  - Research papers on agent reliability and prompt injection
289
334
  - Real-world testing across 500+ repositories
@@ -983,11 +1028,22 @@ No per-turn overhead - it reads transcripts that Claude Code already saves.
983
1028
  ```bash
984
1029
  /deslop apply # Just clean up your code
985
1030
  /sync-docs # Just check if docs need updates
1031
+ /prepare-delivery # Run all quality gates (no ship)
986
1032
  /ship # Just ship this branch
1033
+ /gate-and-ship # Quality gates + ship in one command
987
1034
  /audit-project # Just review the codebase
988
1035
  ```
989
1036
 
990
- **Integrated workflow:**
1037
+ **Composable delivery chain:**
1038
+
1039
+ ```
1040
+ /prepare-delivery = quality gates only (deslop, review, validation, docs)
1041
+ /ship = PR + CI + merge only
1042
+ /gate-and-ship = /prepare-delivery + /ship
1043
+ /next-task = full workflow (discovery → implementation → /prepare-delivery → /ship)
1044
+ ```
1045
+
1046
+ **Full integrated workflow:**
991
1047
 
992
1048
  When you run [`/next-task`](#next-task), it orchestrates everything:
993
1049
 
@@ -996,15 +1052,15 @@ When you run [`/next-task`](#next-task), it orchestrates everything:
996
1052
 
997
1053
  implementation-agent writes code
998
1054
 
999
- deslop-agent cleans AI artifacts
1055
+ deslop-agent + prepare-delivery:test-coverage-checker + /simplify (parallel)
1000
1056
 
1001
- Phase 9 review loop iterates until approved
1057
+ review loop iterates until approved
1002
1058
 
1003
- delivery-validator checks requirements
1059
+ prepare-delivery:delivery-validator checks requirements
1004
1060
 
1005
1061
  sync-docs-agent syncs documentation
1006
1062
 
1007
- [/ship](#ship) creates PR → monitors CI → merges
1063
+ /ship creates PR → monitors CI → merges
1008
1064
  ```
1009
1065
 
1010
1066
  The workflow tracks state so you can resume from any point.
@@ -8,6 +8,7 @@
8
8
  */
9
9
 
10
10
  'use strict';
11
+ const { truncate } = require('../cross-platform');
11
12
 
12
13
  const fs = require('fs');
13
14
  const path = require('path');
@@ -108,7 +109,7 @@ function extractPlans(result, content) {
108
109
  for (const pattern of planPatterns) {
109
110
  let match;
110
111
  while ((match = pattern.exec(content)) !== null && result.plans.length < 15) {
111
- const plan = (match[1] || match[0]).slice(0, 100);
112
+ const plan = truncate(match[1] || match[0], 100);
112
113
  result.plans.push(plan);
113
114
  }
114
115
  }
@@ -9,6 +9,8 @@
9
9
 
10
10
  'use strict';
11
11
 
12
+ const { truncate } = require('../cross-platform');
13
+
12
14
  const { execFileSync } = require('child_process');
13
15
 
14
16
  const DEFAULT_OPTIONS = {
@@ -47,7 +49,7 @@ function execGhWithResult(args, options = {}) {
47
49
  error: {
48
50
  type: 'parse',
49
51
  message: `Failed to parse gh output as JSON: ${error.message}`,
50
- raw: output.slice(0, 500)
52
+ raw: truncate(output, 500)
51
53
  }
52
54
  };
53
55
  }
@@ -94,7 +96,7 @@ function summarizeIssue(item) {
94
96
  milestone: item.milestone?.title || item.milestone || null,
95
97
  createdAt: item.createdAt,
96
98
  updatedAt: item.updatedAt,
97
- snippet: item.body ? item.body.slice(0, 200).replace(/\n/g, ' ').trim() + (item.body.length > 200 ? '...' : '') : ''
99
+ snippet: item.body ? truncate(item.body.replace(/\n/g, ' '), 200) : ''
98
100
  };
99
101
  }
100
102
 
@@ -112,7 +114,7 @@ function summarizePR(item) {
112
114
  createdAt: item.createdAt,
113
115
  updatedAt: item.updatedAt,
114
116
  files: item.files || [],
115
- snippet: item.body ? item.body.slice(0, 150).replace(/\n/g, ' ').trim() + (item.body.length > 150 ? '...' : '') : ''
117
+ snippet: item.body ? truncate(item.body.replace(/\n/g, ' '), 150) : ''
116
118
  };
117
119
  }
118
120
 
@@ -310,8 +310,11 @@ function formatSection(title, content) {
310
310
  * @returns {string} Truncated text
311
311
  */
312
312
  function truncate(text, maxLength) {
313
- if (text.length <= maxLength) return text;
314
- return text.substring(0, maxLength - 3) + '...';
313
+ // Code-point safe: uses spread operator to avoid splitting surrogate pairs (emoji, flags, CJK).
314
+ if (maxLength < 0) return text;
315
+ const chars = [...text];
316
+ if (chars.length <= maxLength) return text;
317
+ return chars.slice(0, maxLength - 3).join('') + '...';
315
318
  }
316
319
 
317
320
  /**
@@ -12,6 +12,7 @@ const fs = require('fs');
12
12
  const path = require('path');
13
13
  const { parseMarkdownFrontmatter } = require('./agent-analyzer');
14
14
  const { crossFilePatterns, loadKnownTools } = require('./cross-file-patterns');
15
+ const { truncate } = require('../cross-platform');
15
16
 
16
17
  // ============================================
17
18
  // CONSTANTS
@@ -650,9 +651,9 @@ function analyzePromptConsistency(agents) {
650
651
  // Extract action keywords
651
652
  let action;
652
653
  if (isAlways) {
653
- action = line.replace(/.*\bALWAYS\b\s*/i, '').substring(0, ACTION_COMPARISON_LENGTH);
654
+ action = truncate(line.replace(/.*\bALWAYS\b\s*/i, ''), ACTION_COMPARISON_LENGTH);
654
655
  } else {
655
- action = line.replace(/.*\b(?:NEVER|DO NOT)\b\s*/i, '').substring(0, ACTION_COMPARISON_LENGTH);
656
+ action = truncate(line.replace(/.*\b(?:NEVER|DO NOT)\b\s*/i, ''), ACTION_COMPARISON_LENGTH);
656
657
  }
657
658
 
658
659
  // Extract significant keywords from action
@@ -11,6 +11,7 @@
11
11
  const fs = require('fs');
12
12
  const path = require('path');
13
13
  const { getStateDir, getPlatformName } = require('../platform/state-dir');
14
+ const { truncate } = require('../cross-platform');
14
15
 
15
16
  /**
16
17
  * Platform-specific default tools
@@ -214,7 +215,7 @@ const crossFilePatterns = {
214
215
  if (!instruction || !files || files.length < 2) return null;
215
216
 
216
217
  return {
217
- issue: `Duplicate instruction found in ${files.length} files: "${instruction.substring(0, 50)}..."`,
218
+ issue: `Duplicate instruction found in ${files.length} files: "${truncate(instruction, 50)}"`,
218
219
  fix: `Extract shared instruction to a common include or ensure intentional duplication`
219
220
  };
220
221
  }
@@ -234,7 +235,7 @@ const crossFilePatterns = {
234
235
  if (!rule1 || !rule2) return null;
235
236
 
236
237
  return {
237
- issue: `Contradictory rules: "${rule1.substring(0, 40)}..." vs "${rule2.substring(0, 40)}..."`,
238
+ issue: `Contradictory rules: "${truncate(rule1, 40)}" vs "${truncate(rule2, 40)}"`,
238
239
  fix: `Resolve conflict between ${file1} and ${file2}`
239
240
  };
240
241
  }
@@ -4,6 +4,8 @@
4
4
  * @license MIT
5
5
  */
6
6
 
7
+ const { truncate } = require('../cross-platform');
8
+
7
9
  function estimateTokens(text) {
8
10
  if (!text || typeof text !== 'string') return 0;
9
11
  return Math.ceil(text.length / 4);
@@ -159,7 +161,7 @@ const docsPatterns = {
159
161
  const tokens = estimateTokens(section);
160
162
  if (tokens > 1000) {
161
163
  // Get section title (first line)
162
- const title = section.split('\n')[0].trim().slice(0, 50);
164
+ const title = truncate(section.split('\n')[0].trim(), 50);
163
165
  longSections.push({ title, tokens });
164
166
  }
165
167
  }
@@ -371,7 +373,7 @@ const docsPatterns = {
371
373
 
372
374
  // Check if starts with dangling reference
373
375
  if (/^(?:It|This|These|Those|They|The above|As mentioned)\s/i.test(firstLine)) {
374
- const title = lines[0].slice(0, 30);
376
+ const title = truncate(lines[0], 30);
375
377
  issues.push(title);
376
378
  }
377
379
  }
@@ -461,7 +463,7 @@ const docsPatterns = {
461
463
  const tokens = estimateTokens(cleanPart);
462
464
 
463
465
  if (tokens > 500) {
464
- const preview = cleanPart.trim().split('\n')[0].slice(0, 50);
466
+ const preview = truncate(cleanPart.trim().split('\n')[0], 50);
465
467
  longBlocks.push({ tokens, preview });
466
468
  }
467
469
  }
@@ -502,7 +504,7 @@ const docsPatterns = {
502
504
  for (let i = lateThreshold; i < totalLines; i++) {
503
505
  for (const pattern of criticalKeywords) {
504
506
  if (pattern.test(lines[i])) {
505
- lateImportantLines.push(lines[i].trim().slice(0, 50));
507
+ lateImportantLines.push(truncate(lines[i].trim(), 50));
506
508
  break;
507
509
  }
508
510
  }
package/lib/package.json CHANGED
@@ -4,6 +4,38 @@
4
4
  "description": "Core library for AgentSys: platform detection, pattern matching, workflow state, and utilities",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
7
+ "exports": {
8
+ ".": "./index.js",
9
+ "./binary": "./binary/index.js",
10
+ "./collectors": "./collectors/index.js",
11
+ "./config": "./config/index.js",
12
+ "./cross-platform": "./cross-platform/index.js",
13
+ "./discovery": "./discovery/index.js",
14
+ "./enhance": "./enhance/index.js",
15
+ "./perf": "./perf/index.js",
16
+ "./repo-map": "./repo-map/index.js",
17
+ "./collectors/codebase": "./collectors/codebase.js",
18
+ "./collectors/docs-patterns": "./collectors/docs-patterns.js",
19
+ "./collectors/documentation": "./collectors/documentation.js",
20
+ "./collectors/github": "./collectors/github.js",
21
+ "./enhance/agent-analyzer": "./enhance/agent-analyzer.js",
22
+ "./enhance/agent-patterns": "./enhance/agent-patterns.js",
23
+ "./enhance/cross-file-analyzer": "./enhance/cross-file-analyzer.js",
24
+ "./enhance/cross-file-patterns": "./enhance/cross-file-patterns.js",
25
+ "./enhance/fixer": "./enhance/fixer.js",
26
+ "./enhance/plugin-patterns": "./enhance/plugin-patterns.js",
27
+ "./enhance/projectmemory-analyzer": "./enhance/projectmemory-analyzer.js",
28
+ "./enhance/projectmemory-patterns": "./enhance/projectmemory-patterns.js",
29
+ "./enhance/prompt-analyzer": "./enhance/prompt-analyzer.js",
30
+ "./enhance/prompt-patterns": "./enhance/prompt-patterns.js",
31
+ "./enhance/reporter": "./enhance/reporter.js",
32
+ "./enhance/security-patterns": "./enhance/security-patterns.js",
33
+ "./enhance/suppression": "./enhance/suppression.js",
34
+ "./enhance/tool-patterns": "./enhance/tool-patterns.js",
35
+ "./sources/custom-handler": "./sources/custom-handler.js",
36
+ "./sources/policy-questions": "./sources/policy-questions.js",
37
+ "./sources/source-cache": "./sources/source-cache.js"
38
+ },
7
39
  "engines": {
8
40
  "node": ">=18.0.0"
9
41
  },
@@ -6,7 +6,11 @@
6
6
  * Functions gracefully degrade when tools are not available.
7
7
  *
8
8
  * Supported languages: javascript, typescript, python, rust, go
9
- *
9
+ */
10
+
11
+ const { truncate } = require('../cross-platform');
12
+
13
+ /**
10
14
  * @module patterns/cli-enhancers
11
15
  * @author Avi Fenesh
12
16
  * @license MIT
@@ -380,7 +384,7 @@ function runDuplicateDetection(repoPath, options = {}) {
380
384
  secondLine: dup.secondFile?.start || 0,
381
385
  lines: dup.lines || 0,
382
386
  tokens: dup.tokens || 0,
383
- fragment: dup.fragment?.substring(0, 100) || ''
387
+ fragment: truncate(dup.fragment || '', 100)
384
388
  });
385
389
  }
386
390
  }
@@ -7,7 +7,11 @@
7
7
  * - Phase 3 (LLM handoff): certainty-tagged findings for agent review
8
8
  *
9
9
  * Inherits modes from deslop: report (analyze only) vs apply (fix issues)
10
- *
10
+ */
11
+
12
+ const { truncate } = require('../cross-platform');
13
+
14
+ /**
11
15
  * @module patterns/pipeline
12
16
  * @author Avi Fenesh
13
17
  * @license MIT
@@ -356,7 +360,7 @@ function runPhase1(repoPath, targetFiles, language, fileContents) {
356
360
  certainty: CERTAINTY.HIGH,
357
361
  description: pattern.description,
358
362
  autoFix: pattern.autoFix,
359
- content: line.trim().substring(0, 100),
363
+ content: truncate(line.trim(), 100),
360
364
  phase: 1
361
365
  });
362
366
  }
@@ -657,7 +661,7 @@ async function runMultiPassAnalyzers(repoPath, targetFiles, fileContents) {
657
661
  certainty: CERTAINTY.MEDIUM,
658
662
  description: `${shotgunPattern.description}: ${v.files.length} files change together ${v.count} times`,
659
663
  autoFix: shotgunPattern.autoFix,
660
- content: v.files.join(', ').substring(0, 100),
664
+ content: truncate(v.files.join(', '), 100),
661
665
  phase: 1,
662
666
  details: { files: v.files, changeCount: v.count }
663
667
  });
@@ -8,6 +8,8 @@
8
8
  * @license MIT
9
9
  */
10
10
 
11
+ const { truncate } = require('../cross-platform');
12
+
11
13
  /**
12
14
  * Analyze JSDoc-to-function ratio to detect excessive documentation
13
15
  *
@@ -1879,7 +1881,7 @@ function analyzeDeadCode(content, options = {}) {
1879
1881
  line: j + 1, // 1-indexed
1880
1882
  terminationType: terminationType,
1881
1883
  terminationLine: i + 1,
1882
- content: nextTrimmed.substring(0, 50) + (nextTrimmed.length > 50 ? '...' : ''),
1884
+ content: truncate(nextTrimmed, 50),
1883
1885
  severity: 'high'
1884
1886
  });
1885
1887
 
@@ -11,6 +11,7 @@
11
11
  */
12
12
 
13
13
  const fs = require('fs');
14
+ const { truncate } = require('../cross-platform');
14
15
  const path = require('path');
15
16
  const { exec } = require('child_process');
16
17
  const { promisify } = require('util');
@@ -84,7 +85,7 @@ function withTimeout(promise, timeoutMs = DEFAULT_ASYNC_TIMEOUT_MS, operation =
84
85
  * @returns {Promise<{stdout: string, stderr: string}>}
85
86
  */
86
87
  async function execWithTimeout(cmd, options = {}, timeoutMs = DEFAULT_ASYNC_TIMEOUT_MS) {
87
- return withTimeout(execAsync(cmd, options), timeoutMs, `exec: ${cmd.substring(0, 50)}`);
88
+ return withTimeout(execAsync(cmd, options), timeoutMs, `exec: ${truncate(cmd, 50)}`);
88
89
  }
89
90
 
90
91
  // Maximum cached file size constant
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  const sourceCache = require('./source-cache');
9
+ const { truncate } = require('../cross-platform');
9
10
  const customHandler = require('./custom-handler');
10
11
 
11
12
  /**
@@ -42,7 +43,7 @@ function getPolicyQuestions() {
42
43
  // Truncate to fit within 30 chars: "X (last used)" where X can be max 17 chars
43
44
  const maxBaseLen = 30 - ' (last used)'.length; // 18 chars for base
44
45
  const truncatedLabel = cachedLabel.length > maxBaseLen
45
- ? cachedLabel.substring(0, maxBaseLen - 1) + '…'
46
+ ? truncate(cachedLabel, maxBaseLen - 1) + '…'
46
47
  : cachedLabel;
47
48
 
48
49
  sourceOptions.push({
@@ -155,12 +156,12 @@ function parseAndCachePolicy(responses) {
155
156
  // Validate and merge follow-up responses
156
157
  const rawNum = String(responses.project.number).trim();
157
158
  if (!/^[1-9][0-9]*$/.test(rawNum)) {
158
- const safeNum = String(responses.project.number).replace(/[^\x20-\x7E]/g, '?').substring(0, 32);
159
+ const safeNum = truncate(String(responses.project.number).replace(/[^\x20-\x7E]/g, '?'), 32);
159
160
  throw new Error(`Invalid project number: "${safeNum}". Must be a positive integer.`);
160
161
  }
161
162
  const num = Number(rawNum);
162
163
  const owner = String(responses.project.owner || '').trim();
163
- const safeOwner = String(responses.project.owner || '').replace(/[^\x20-\x7E]/g, '?').substring(0, 64);
164
+ const safeOwner = truncate(String(responses.project.owner || '').replace(/[^\x20-\x7E]/g, '?'), 64);
164
165
  if (!owner || !/^(@me|[a-zA-Z0-9][a-zA-Z0-9_-]*)$/.test(owner)) {
165
166
  throw new Error(`Invalid project owner: "${safeOwner}" (use @me or an org/user name)`);
166
167
  }