Skip to content

feat: sync recent upstream semble changes (savings output, agents, clear) - #20

Merged
amondnet merged 2 commits into
mainfrom
feat/upstream-semble-sync
Jun 17, 2026
Merged

feat: sync recent upstream semble changes (savings output, agents, clear)#20
amondnet merged 2 commits into
mainfrom
feat/upstream-semble-sync

Conversation

@amondnet

@amondnetamondnet commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Pulls in three batches of upstream MinishLab/semble changes reviewed up to commit eacbe43 (2026-06-12) and adapts them to the csp port.


Changes

1. Savings output redesign (semble #197)

src/stats.ts — rewrote formatSavingsReport with:

  • ANSI color helpers (useColor / color / colorRatio), automatically suppressed when NO_COLOR is set, terminal is dumb, or stdout is not a TTY.
  • New layout: Total saved / calls / Efficiency headline + "By Period" table always shown; "By Call Type" breakdown gated behind --verbose.
  • Added padLeft utility for right-aligned numeric columns.

Tests updated in src/stats.test.ts (+12 assertions covering color suppression, period bucketing, efficiency formatting, and verbose gating).

2. Four new agents (semble #196 / #192 / #183)

  • Added src/agents/antigravity.md, commandcode.md, pi.md, reasonix.md — agent-native frontmatter, body byte-equivalent to existing csp agents.
  • Extended Agent enum, _coerceAgent coercion map, and --agent help text in src/cli.ts.
  • Updated README.md and README.ko.md sub-agent lists (both kept in sync).

3. clear command (semble #181)

Adapted the upstream clear subcommand to csp:

  • clearSavings() helper in src/stats.ts (deletes ~/.csp/savings.jsonl, matching semble's unlink).
  • _runClear handler + dispatch entry + CLI_DISPATCH_ARGS registration in src/cli.ts.
  • clear sections added to both READMEs.

Note: JSON output flag (#147) was already present in the csp port prior to this batch and was not re-ported here.


Verification

Test results (bun test)

  • 297 pass / 5 fail / 3 errors
  • The 5 failures and 3 errors are pre-existing on clean HEAD (missing exports makeStubModel / searchResultToDict / DEFAULT_CONTENT, ContentType barrel, and a formatResultsr.toDict() mock mismatch) — all unrelated to this batch.
  • This batch added 12 passing tests and introduced zero new failures.

Lint / typecheck

  • eslint could not run cleanly in the local environment (jiti missing for flat config loading).
  • tsc --noEmit hits pre-existing stub type errors for CspIndex.save / loadFromDisk — unrelated to this batch.
  • Neither issue was introduced by these changes.

Related


Summary by cubic

Sync recent upstream MinishLab/semble changes into the CSP port: redesigned savings report, four new agent templates, and a clear subcommand. Improves reporting clarity, expands agent support, and adds a safe way to clear cached telemetry.

  • New Features

    • Savings report: colorized TTY output with auto-suppression; headline totals + By Period table; --verbose adds By Call Type.
    • Agents: added Antigravity, Command Code, Pi, and Reasonix templates; updated Agent enum/coercion/CLI help; READMEs updated.
    • Clear: csp clear <savings|index|all>; removes ~/.csp/savings.jsonl; index clear is a no-op until persistence exists; tests added.
  • Bug Fixes

    • Hardened clearSavings to swallow I/O errors and report cleared: false instead of crashing; keeps deletion (not truncation) for clean “No stats yet” behavior.

Written for commit 9e47418. Summary will update on new commits.

…ear)
- savings output redesign (semble #197): rewrote formatSavingsReport with
ANSI color helpers (useColor/color/colorRatio, suppressed under NO_COLOR /
dumb terminal / non-TTY) and a new layout — Total saved/calls/Efficiency
headline + "By Period" table; "By Call Type" breakdown gated behind
--verbose. Added padLeft helper.
- 4 new agents (semble #196/#192/#183): added agent markdown files for
antigravity, commandcode, pi, and reasonix; extended Agent enum,
_coerceAgent, and help text in cli.ts; updated both READMEs.
- clear command (semble #181): clearSavings() in stats.ts; _runClear +
dispatch + CLI_DISPATCH_ARGS + help in cli.ts; clear sections in both
READMEs. Note: JSON output flag (#147) was already present in the csp
port prior to this batch.

@gemini-code-assistgemini-code-assistBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

본 풀 리퀘스트는 Antigravity, Command Code, Pi, Reasonix 등 새로운 서브 에이전트 지원을 추가하고, 캐시된 데이터를 비우는 clear 서브커맨드를 도입하며, savings 보고서의 레이아웃을 ANSI 색상이 적용된 디자인으로 개선합니다. 리뷰어는 clearSavings 함수가 PR 설명과 달리 파일을 삭제(rmSync)하고 있어 심볼릭 링크가 깨지거나 예외가 발생할 수 있음을 지적했습니다. 이에 따라 파일 삭제 대신 writeFileSync를 사용해 안전하게 파일을 비우고(Truncate) 예외 처리를 추가할 것과, 관련 테스트 코드(src/stats.test.ts)도 파일이 비워졌는지 검증하도록 수정할 것을 제안했습니다.

Comment threadsrc/stats.ts
Comment threadsrc/stats.ts
Comment threadsrc/stats.test.ts
@amondnet

Copy link
Copy Markdown
ContributorAuthor

/gemini review

@gemini-code-assist

Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@codacy-production

codacy-productionBot commented Jun 17, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics25 complexity · 4 duplication

MetricResults
Complexity25
Duplication4

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Adopt gemini-code-assist's defensive try-catch in clearSavings so a
permission error or broken symlink reports cleared:false instead of
crashing the CLI. Keep deletion (not truncation) for parity with
semble's unlink and so `csp savings` still falls back to "No stats yet".
@amondnet
amondnet merged commit d1ff3f6 into mainJun 17, 2026
2 checks passed
@amondnet
amondnet deleted the feat/upstream-semble-sync branch June 17, 2026 12:57
This was referenced Jun 18, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@amondnet