@leing2021/super-pi 0.19.3 → 0.19.5

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/README.md CHANGED
@@ -178,7 +178,7 @@ Single `npm install` output filtered once pays for the entire overhead. Full eva
178
178
 
179
179
  ## Code Scale
180
180
 
181
- ~2800 lines of TypeScript implementing 16 tools, 22 Markdown reference files + 78 rule files driving 10 skills, 170 tests covering all tool logic.
181
+ ~2800 lines of TypeScript implementing 16 tools, 22 Markdown reference files + 78 rule files driving 10 skills, 175 tests covering all tool logic.
182
182
 
183
183
  Not a heavy framework. Each tool has a single responsibility, each skill works independently, and together they form a complete workflow.
184
184
 
@@ -275,7 +275,7 @@ Three CE skills auto-trigger rule loading at their entry points:
275
275
 
276
276
  | Skill | Rules pre-loaded |
277
277
  |-------|-----------------|
278
- | `02-plan` | `common/development-workflow.md` + `common/testing.md` |
278
+ | `02-plan` | `common/` rules + language detection + matching language rules (e.g. `rules/typescript/`) |
279
279
  | `03-work` | Language-specific rules matching the active codebase |
280
280
  | `04-review` | `common/code-review.md` + language rules for changed files |
281
281
 
@@ -381,6 +381,19 @@ Not a fork. Not a wrapper. Methodologies extracted and rebuilt with Pi's native
381
381
 
382
382
  ## Changelog
383
383
 
384
+ ### 0.19.5 — Plan skill missing language rules fix
385
+ - Fixed `02-plan` not loading language-specific rules (e.g. `rules/typescript/`) during the planning phase — only `common/` rules were loaded.
386
+ - Updated `10-rules` SKILL.md Pre-flight to require language detection in the planning phase.
387
+ - Updated `02-plan` SKILL.md Core rules to a 4-step progressive loading strategy (common → language detection → language rules → web rules).
388
+ - Synced `README.md` and `README_CN.md` skill table to reflect the change.
389
+
390
+ ### 0.19.4 — Read output filter markdown truncation fix
391
+ - Fixed `read-output-filter` over-truncating markdown files: raised markdown threshold from 2KB → 8KB.
392
+ - Improved `filterMarkdown()` to fully preserve list items (`-`, `*`, numbered) and keep first 3 lines of paragraphs (was 1).
393
+ - Filter notice now includes actual file path in actionable guidance (`bash cat <path>`).
394
+ - Added 5 new tests covering list preservation, markdown threshold gate, and path-in-notice.
395
+ - 175 tests passing.
396
+
384
397
  ### 0.19.3 — Terminate fix + runtime model routing + autoContinue removal
385
398
  - Fixed 6 ce-core tools (`brainstorm_dialog`, `workflow_state`, `review_router`, `session_checkpoint`, `session_history`, `pattern_extractor`) incorrectly returning `terminate: true`, which caused agent turns to end prematurely (brainstorm questions not shown, "type continue to proceed" interruptions).
386
399
  - Implemented runtime stage model routing via ce-core extension `input` hook: reads `.pi/settings.json` `modelStrategy`, auto-switches model before skill execution. Supports full reference (`anthropic/claude-opus-4-1`) and bare model id (`claude-opus-4-1`).
@@ -9,7 +9,7 @@
9
9
  // 1. Lock / generated files → extreme compression (summary only)
10
10
  // 2. package.json → keep scripts + dep summary, drop full version lists
11
11
  // 3. Large code files → keep signatures/structure, collapse bodies
12
- // 4. Large markdown → keep headings + first paragraph per section
12
+ // 4. Large markdown → keep headings + code blocks + lists + expanded paragraphs per section
13
13
  // 5. Generic → head/tail truncation for very large files
14
14
 
15
15
  // ============================================================================
@@ -93,6 +93,9 @@ function classifyFile(path: string): FileCategory {
93
93
  /** Minimum output size (bytes) to trigger any filtering */
94
94
  const MIN_FILTER_THRESHOLD = 2048 // 2KB
95
95
 
96
+ /** Minimum output size (bytes) to trigger markdown filtering */
97
+ const MARKDOWN_FILTER_THRESHOLD = 8192 // 8KB — markdown docs are dense, don't filter small ones
98
+
96
99
  /** Maximum size for structural code compression trigger */
97
100
  const CODE_COMPRESS_THRESHOLD = 8192 // 8KB
98
101
 
@@ -308,6 +311,9 @@ function filterMarkdown(output: string): string {
308
311
  let inParagraph = false
309
312
  let paragraphLineCount = 0
310
313
  let inCodeBlock = false
314
+ let omitMarkerPlaced = false
315
+
316
+ const MAX_PARAGRAPH_LINES = 3 // Keep first N lines of each paragraph (vs 1 before)
311
317
 
312
318
  for (const line of lines) {
313
319
  const trimmed = line.trim()
@@ -322,6 +328,7 @@ function filterMarkdown(output: string): string {
322
328
  // Keep all lines inside code blocks
323
329
  if (inCodeBlock) {
324
330
  kept.push(line)
331
+ omitMarkerPlaced = false
325
332
  continue
326
333
  }
327
334
 
@@ -330,27 +337,43 @@ function filterMarkdown(output: string): string {
330
337
  kept.push(line)
331
338
  inParagraph = false
332
339
  paragraphLineCount = 0
340
+ omitMarkerPlaced = false
333
341
  continue
334
342
  }
335
343
 
336
- // Empty lines
344
+ // Empty lines — reset paragraph state
337
345
  if (trimmed === "") {
338
346
  kept.push(line)
339
347
  inParagraph = false
340
348
  paragraphLineCount = 0
349
+ omitMarkerPlaced = false
350
+ continue
351
+ }
352
+
353
+ // Always keep list items (-, *, numbered) — they often contain key definitions
354
+ if (/^[-*+]\s/.test(trimmed) || /^\d+\.\s/.test(trimmed)) {
355
+ kept.push(line)
356
+ omitMarkerPlaced = false
357
+ // List items don't count as paragraph continuation
341
358
  continue
342
359
  }
343
360
 
344
- // Keep first paragraph line after heading, skip the rest
361
+ // Keep first N lines of each paragraph
345
362
  if (!inParagraph) {
346
363
  kept.push(line)
347
364
  inParagraph = true
348
365
  paragraphLineCount = 1
366
+ omitMarkerPlaced = false
349
367
  } else {
350
368
  paragraphLineCount++
351
- // Skip subsequent paragraph lines
352
- if (paragraphLineCount === 2) {
353
- kept.push(` [... additional paragraph content omitted]`)
369
+ if (paragraphLineCount <= MAX_PARAGRAPH_LINES) {
370
+ kept.push(line)
371
+ } else {
372
+ // Place omit marker once per paragraph
373
+ if (!omitMarkerPlaced) {
374
+ kept.push(` [... additional paragraph content omitted]`)
375
+ omitMarkerPlaced = true
376
+ }
354
377
  }
355
378
  }
356
379
  }
@@ -400,9 +423,11 @@ function appendFilterNotice(
400
423
  originalBytes: number,
401
424
  filteredBytes: number,
402
425
  strategy: string,
426
+ path?: string,
403
427
  ): string {
404
428
  const saved = formatBytes(originalBytes - filteredBytes)
405
- return `${output}\n\n[Read output filtered: ${formatBytes(originalBytes)} ${formatBytes(filteredBytes)} (${saved} saved, strategy: ${strategy})]`
429
+ const pathHint = path ? `: bash cat ${path}` : ": bash cat <path>"
430
+ return `${output}\n\n[Read output filtered: ${formatBytes(originalBytes)} → ${formatBytes(filteredBytes)} (${saved} saved, strategy: ${strategy}). If you need the full content, use${pathHint}]`
406
431
  }
407
432
 
408
433
  // ============================================================================
@@ -464,8 +489,12 @@ export function filterReadOutput(input: ReadOutputFilterInput): ReadOutputFilter
464
489
  break
465
490
 
466
491
  case "markdown":
467
- filtered = filterMarkdown(output)
468
- strategyName = "markdown (headings + first paragraph)"
492
+ if (originalBytes >= MARKDOWN_FILTER_THRESHOLD) {
493
+ filtered = filterMarkdown(output)
494
+ strategyName = "markdown (headings + code + lists + expanded paragraphs)"
495
+ } else {
496
+ return { output, filtered: false, originalBytes, filteredBytes: originalBytes, strategy: "none (markdown below 8KB threshold)" }
497
+ }
469
498
  break
470
499
 
471
500
  case "config":
@@ -497,7 +526,7 @@ export function filterReadOutput(input: ReadOutputFilterInput): ReadOutputFilter
497
526
  }
498
527
 
499
528
  return {
500
- output: appendFilterNotice(filtered, originalBytes, filteredBytes, strategyName),
529
+ output: appendFilterNotice(filtered, originalBytes, filteredBytes, strategyName, path),
501
530
  filtered: true,
502
531
  originalBytes,
503
532
  filteredBytes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leing2021/super-pi",
3
- "version": "0.19.3",
3
+ "version": "0.19.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Pi-native Compound Engineering package for iterative development workflows",
@@ -11,7 +11,11 @@ See [shared pipeline instructions](../references/pipeline-config.md) for model r
11
11
 
12
12
  ## Core rules
13
13
 
14
- - Before planning, read the `10-rules` skill and load `rules/common/development-workflow.md` and `rules/common/testing.md` for coding standards context.
14
+ - Before planning, read the `10-rules` skill and load:
15
+ 1. `rules/common/development-workflow.md` and `rules/common/testing.md`
16
+ 2. **Detect the project's primary language** (check for `tsconfig.json` → typescript, `package.json` without tsconfig → javascript, `Cargo.toml` → rust, `go.mod` → golang, `pubspec.yaml` → dart, `pom.xml`/`build.gradle` → java, `*.sln`/`*.csproj` → csharp, `Package.swift` → swift, `requirements.txt`/`pyproject.toml`/`setup.py` → python, `composer.json` → php, `Makefile.PL`/`cpanfile` → perl, `build.gradle.kts` → kotlin)
17
+ 3. Load all files in the matching language-specific rules directory (e.g. `rules/typescript/`)
18
+ 4. If the task involves frontend/browser concerns, also load `rules/web/` files
15
19
  - Search `docs/brainstorms/` for a relevant requirements artifact first.
16
20
  - Search solutions with grep-first strategy: extract keywords from the task → `bash grep -rl "tags:.*keyword" docs/solutions/ ~/.pi/agent/docs/solutions/` → read only frontmatter (first 15 lines) of matching files → score by severity + tag relevance → fully read top 3. Search both project-level (`docs/solutions/`) and global-level (`~/.pi/agent/docs/solutions/`). If no matches, report "No relevant solutions found" and proceed.
17
21
  - Write the final plan to `docs/plans/`.
@@ -23,6 +23,8 @@ Do not load the entire rules tree by default. Read only the files needed for the
23
23
  Read at minimum:
24
24
  - `rules/common/development-workflow.md`
25
25
  - `rules/common/testing.md`
26
+ - **Detect the active language** from the project: check for `tsconfig.json` → typescript, `package.json` (without tsconfig) → javascript, `Cargo.toml` → rust, `go.mod` → golang, `pubspec.yaml` → dart, `pom.xml`/`build.gradle` → java, `*.sln`/`*.csproj` → csharp, `Package.swift` → swift, `requirements.txt`/`pyproject.toml`/`setup.py` → python, `composer.json` → php, `Makefile.PL`/`cpanfile` → perl, `build.gradle.kts` → kotlin. Load all files in the matching language directory (e.g. `rules/typescript/`).
27
+ - `rules/web/` files if the task involves frontend/browser concerns
26
28
 
27
29
  ### Before implementation (03-work)
28
30