feat(monorepo): domain-driven package split foundation — @gt/core + boundary guard (approach 3 of 3)#192
feat(monorepo): domain-driven package split foundation — @gt/core + boundary guard (approach 3 of 3)#192genesiscz wants to merge 2 commits into
Conversation
Extract the import-closed leaf set (json/SafeJSON, date, date-locale, format, string, array, object, math, hash, tokens, Stopwatch) into a no-build Bun workspace package @gt/core whose exports point at raw .ts. Every old @app/utils/<mod> path keeps working via a pure re-export shim, so the 70+ unmigrated tools compile unchanged. Migrate 6 representative tools (timer, last-changes, files-to-prompt, usage, json, benchmark) to import @gt/core directly. Add scripts/ci/check-package-boundaries.ts (fails on @gt/core impurity, warns on the §0.3 reverse-dep backlog). Whole-repo tsgo --noEmit = 0 errors (== master baseline); boundary + logging guards green; moved tests pass (171) in their new home; ./tools + all 6 tools smoke-run. date-locale.ts moved alongside date.ts: date.ts lazy-requires ./date-locale at runtime — invisible to a static-import audit and to tsgo; caught by the functional last-changes smoke run.
📝 WalkthroughWalkthroughThis PR extracts a foundational ChangesMonorepo Foundation Setup
Sequence Diagram(s)A sequence diagram would not add clarity here; the changes are primarily architectural (file structure, re-exports, config) and documentation rather than multi-component interaction flows. Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Code Review
This pull request implements the foundation milestone of a domain-driven monorepo migration. It enables Bun workspaces, scaffolds the @gt/core package, moves several leaf utility modules to the new package, and leaves re-export shims at their original paths to maintain backward compatibility. Additionally, six representative tools are migrated to consume @gt/core directly, and a package-boundary guard script is introduced to enforce dependency layers. Feedback suggests adding a defensive length check in the cosineDistance utility to prevent out-of-bounds access and NaN calculations.
| export function cosineDistance(a: Float32Array, b: Float32Array): number { | ||
| let dot = 0; | ||
| let normA = 0; | ||
| let normB = 0; | ||
|
|
||
| for (let i = 0; i < a.length; i++) { | ||
| dot += a[i] * b[i]; | ||
| normA += a[i] * a[i]; | ||
| normB += b[i] * b[i]; | ||
| } | ||
|
|
||
| const denom = Math.sqrt(normA) * Math.sqrt(normB); | ||
|
|
||
| if (denom === 0) { | ||
| return 2; | ||
| } | ||
|
|
||
| return 1 - dot / denom; | ||
| } |
There was a problem hiding this comment.
Add a defensive check to ensure both input vectors have the same length. If their lengths differ, accessing elements beyond the shorter vector's bounds will result in NaN calculations without throwing a clear error.
export function cosineDistance(a: Float32Array, b: Float32Array): number {
if (a.length !== b.length) {
throw new RangeError(`Vector lengths must match (got ${a.length} and ${b.length})`);
}
let dot = 0;
let normA = 0;
let normB = 0;
for (let i = 0; i < a.length; i++) {
dot += a[i] * b[i];
normA += a[i] * a[i];
normB += b[i] * b[i];
}
const denom = Math.sqrt(normA) * Math.sqrt(normB);
if (denom === 0) {
return 2;
}
return 1 - dot / denom;
}There was a problem hiding this comment.
Actionable comments posted: 12
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@MONOREPO-PLAN.md`:
- Line 19: Replace the machine-specific hardcoded command "cd
/Users/Martin/Tresors/Projects/GenesisTools-monorepo-3" in MONOREPO-PLAN.md with
a repo-relative instruction telling contributors to run the following steps from
the repository root (e.g., “From the repo root, run …”) or to change directory
using a generic method (e.g., determine the repo root with git) so the plan is
portable; locate the exact hardcoded string in the file and update the line to a
generic, non-machine-specific instruction.
In `@MONOREPO-SPEC.md`:
- Around line 297-310: The unlabeled code fence containing the ASCII dependency
graph (the block that starts with the tree showing L0 through L4 and modules
like `@gt/core`, `@gt/cli-core`, `@gt/logger`, `@gt/ai`, `@gt/ui`, etc.) needs a language
identifier to satisfy markdownlint; update the opening fence from ``` to a
labeled fence such as ```text (or ```txt) so the graph block is recognized as
plain text.
In `@packages/core/src/date-locale.ts`:
- Line 49: The locale precedence is wrong: the envLocale const currently prefers
LANG before LC_ALL; update the lookup so LC_ALL takes highest precedence (e.g.,
check process.env.LC_ALL first, then process.env.LC_TIME, then process.env.LANG)
to ensure LC_ALL overrides other locale variables — change the envLocale
assignment in this file (the const envLocale) accordingly.
In `@packages/core/src/format.ts`:
- Line 405: The JSDoc in packages/core/src/format.ts that references the
Stopwatch module with the stale path "`@app/utils/Stopwatch`" needs to be updated
to the new module path "`@gt/core`"; locate the comment mentioning "Stopwatch"
(the line reading "For a full-featured stopwatch with laps/stamps, use Stopwatch
class from `@app/utils/Stopwatch`.") and change the import path text to "`@gt/core`"
so documentation points to the correct module (leave the rest of the JSDoc and
the "Stopwatch" identifier unchanged).
In `@packages/core/src/index.ts`:
- Around line 1-10: The root barrel (packages/core/src/index.ts) is missing a
re-export for the date-locale module; update the barrel to expose the
date-locale module by adding a re-export entry for "./date-locale" so consumers
can import date-locale from the package root (ensure the new export line matches
the style used for the other modules like "./date" and "./string").
In `@packages/core/src/math.ts`:
- Around line 14-27: Validate that the input vectors have the same length before
the loop in the cosine-distance computation: add a check that a.length ===
b.length at the top of the function (the function that computes cosine distance
using arrays a and b) and handle the mismatch by throwing a clear Error (e.g.
"Vectors must have same length: a.length=..., b.length=...") or returning a
defined value per project convention; this prevents out-of-range reads from b
inside the for loop and avoids NaN results.
In `@packages/core/src/object.ts`:
- Around line 8-10: The current isObject/deepMerge logic treats non-plain
objects as mergeable and uses for...in which can iterate prototype keys and
corrupt values (e.g., Date) or allow prototype pollution; update isObject to
only return true for plain objects (e.g., typeof value === "object" && value !==
null && (Object.getPrototypeOf(value) === Object.prototype ||
Object.getPrototypeOf(value) === null)) so Dates/RegExps/instances are excluded,
then change deepMerge to iterate only own property keys (use Object.keys and
Object.getOwnPropertySymbols if needed) instead of for...in, and explicitly skip
unsafe keys like "__proto__", "prototype", and "constructor" before merging;
reference functions: isObject and deepMerge and replace for...in usage with
own-key iteration and plain-object checks.
In `@packages/core/src/tokens.ts`:
- Around line 37-42: Validate and normalize maxTokens before performing
truncation in limitToTokens: coerce maxTokens to an integer via Math.floor,
treat non-positive values as a request to return an empty truncated result
(return { text: '', tokens: 0, truncated: true } when maxTokens <= 0), and then
use the normalized integer to compute slicing so tokens/counts cannot become
negative; apply the same validation/normalization to the other truncation blocks
in this file (the blocks around the original function and the sections noted at
47-51 and 55-60) so all truncation code consistently floors the value and
handles zero/negative inputs safely.
In `@scripts/ci/check-package-boundaries.ts`:
- Around line 70-71: The import scanner only matches "from '...'" forms, missing
side-effect imports like import "pkg"; update the regex in the pattern variable
to also capture bare imports (for example use a combined regex such as
(?:from\s+["']([^"']+)["']|import\s+["']([^"']+)["'])) and adjust the code that
consumes the match (the place that reads the capture groups from raw) to take
the non-null capture (group1 || group2); apply the same change to the other
occurrence referenced (the similar pattern around lines 87-88) so both scanners
collect side-effect imports.
- Line 51: The TOOL_IMPORT_RE currently requires a trailing "/" or quote which
misses bare imports like "`@app/logger`"; update the regex used for tool import
detection (TOOL_IMPORT_RE) to allow the end-of-string (or a closing quote) after
the captured tool name instead of requiring a slash, and apply the same fix to
the other occurrences referenced around lines 111-114 so bare specifiers like
"`@app/`<tool>" are matched and subject to Rule 3/4/5 checks.
In `@src/json/index.ts`:
- Line 6: The import in src/json/index.ts pulls SafeJSON from the wrong module;
replace the import of SafeJSON from "`@gt/core/json`" with the repo-mandated path
"`@app/utils/json`" so that SafeJSON used in this file (and any exports/functions
here) come from the canonical source; update the import statement that
references SafeJSON accordingly and ensure subsequent uses still call
SafeJSON.parse()/SafeJSON.stringify().
In `@src/usage/index.ts`:
- Line 7: Replace the incorrect import of SafeJSON from "`@gt/core/json`" with the
mandated module "`@app/utils/json`" in the file that imports SafeJSON; update the
import statement to reference "`@app/utils/json`" and ensure all usages within the
file continue to call SafeJSON.parse() and SafeJSON.stringify() as required by
the src/** guideline.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: d6ede303-4775-4006-bbeb-dc68663924db
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (49)
MONOREPO-PLAN.mdMONOREPO-SPEC.mdpackage.jsonpackages/core/package.jsonpackages/core/src/Stopwatch.tspackages/core/src/array.test.tspackages/core/src/array.tspackages/core/src/date-locale.tspackages/core/src/date.test.tspackages/core/src/date.tspackages/core/src/format.test.tspackages/core/src/format.tspackages/core/src/hash.tspackages/core/src/index.tspackages/core/src/json.test.tspackages/core/src/json.tspackages/core/src/math.test.tspackages/core/src/math.tspackages/core/src/object.test.tspackages/core/src/object.tspackages/core/src/string.test.tspackages/core/src/string.tspackages/core/src/tokens.test.tspackages/core/src/tokens.tspackages/core/tsconfig.jsonscripts/ci/check-package-boundaries.tsscripts/ci/logging-guard.shsrc/benchmark/commands/history.tssrc/benchmark/commands/show.tssrc/benchmark/lib/display.tssrc/benchmark/lib/results.tssrc/benchmark/lib/runner.tssrc/files-to-prompt/index.tssrc/json/index.tssrc/last-changes/index.tssrc/timer/index.tssrc/usage/index.tssrc/utils/Stopwatch.tssrc/utils/array.tssrc/utils/date-locale.tssrc/utils/date.tssrc/utils/format.tssrc/utils/hash.tssrc/utils/json.tssrc/utils/math.tssrc/utils/object.tssrc/utils/string.tssrc/utils/tokens.tstsconfig.json
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test (ubuntu-latest, 4)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.ts: Never add a file-path comment as the first line of files (e.g.,// src/path/to/file.ts)
Do not add comments that restate what the code already says; avoid obvious comments like// Build initial contextbeforebuildContext()
Files:
packages/core/src/hash.tspackages/core/src/array.tssrc/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tspackages/core/src/index.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tspackages/core/src/object.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tspackages/core/src/Stopwatch.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tspackages/core/src/math.tsscripts/ci/check-package-boundaries.tssrc/utils/string.tssrc/utils/hash.tspackages/core/src/tokens.tssrc/utils/format.tspackages/core/src/date-locale.tspackages/core/src/json.tssrc/utils/Stopwatch.tspackages/core/src/string.tssrc/benchmark/commands/show.tssrc/timer/index.tspackages/core/src/date.tspackages/core/src/format.ts
src/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
src/**/*.ts: Always import and useSafeJSONfrom@app/utils/jsoninstead of the globalJSONobject; useSafeJSON.parse()andSafeJSON.stringify()everywhere
Uselogger(from@app/logger) for diagnostics; write to day-stamped file always and to stderr only when log level permits; useout.result()as the only writer to stdout
Log enough context to triage issues from logs alone without re-running the tool; log key decision branches, external-resource access, mode/config resolution, and result counts
Prefererror: errovererror: err instanceof Error ? err.message : String(err)when the error field accepts unknown type
Files:
src/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tssrc/utils/string.tssrc/utils/hash.tssrc/utils/format.tssrc/utils/Stopwatch.tssrc/benchmark/commands/show.tssrc/timer/index.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
src/**/*.{ts,tsx}: Do not useas anytype assertions; use proper type narrowing, type guards, or explicit interfaces instead
When working with union types, use discriminant checks (e.g.entity.className === "User") instead of type assertions
Never use barecatch {}blocks; at minimum log the caught error with context usinglogger.debug()orlogger.warn()
For functions with 3+ parameters or optional parameters, use an object parameter instead of positional parameters
Do not use one-lineifstatements, even for early returns; always use block form with braces
Add an empty line beforeifstatements unless the preceding line is a variable declaration used by thatif
Add an empty line after closing}unless followed byelse,catch,finally, or another}
Always checkisInteractive()from@app/utils/clibefore showing prompts; provide sensible defaults or error withsuggestCommand()in non-interactive mode
Files:
src/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tssrc/utils/string.tssrc/utils/hash.tssrc/utils/format.tssrc/utils/Stopwatch.tssrc/benchmark/commands/show.tssrc/timer/index.ts
src/utils/
📄 CodeRabbit inference engine (CLAUDE.md)
When creating a new tool, check if helper functions are general-purpose and usable by other tools; if so, place them in
src/utils/instead of inside the tool directory
Files:
src/utils/math.tssrc/utils/array.tssrc/utils/date-locale.tssrc/utils/object.tssrc/utils/tokens.tssrc/utils/json.tssrc/utils/date.tssrc/utils/string.tssrc/utils/hash.tssrc/utils/format.tssrc/utils/Stopwatch.ts
src/**/index.ts
📄 CodeRabbit inference engine (CLAUDE.md)
src/**/index.ts: Tool entry points must use a TypeScript file with shebang that shows an interactive tool selector when run without arguments, and executes the specified tool viabun runwhen given arguments
Tool entry points must end withawait runTool(program, { tool })from@app/utils/cli, which owns-v/--readme/help registration and console-level resolution
Files:
src/usage/index.tssrc/files-to-prompt/index.tssrc/json/index.tssrc/last-changes/index.tssrc/timer/index.ts
src/*/index.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Tool directories must contain either
index.ts/index.tsxor standalone.ts/.tsxfiles; tool name is derived from directory name or filename without extension
Files:
src/usage/index.tssrc/files-to-prompt/index.tssrc/json/index.tssrc/last-changes/index.tssrc/timer/index.ts
src/**/commands/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Commands should be thin wrappers that parse arguments and delegate to business logic in
src/<tool>/lib/files; keep command files lean
Files:
src/benchmark/commands/history.tssrc/benchmark/commands/show.ts
🧠 Learnings (23)
📚 Learning: 2026-02-24T15:32:44.925Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 54
File: src/github/lib/review-output.ts:18-20
Timestamp: 2026-02-24T15:32:44.925Z
Learning: In TypeScript files, do not require a blank line between the opening brace of a function and the first statement if the first statement is the if statement immediately after the signature. The blank-line rule applies to separating an if from unrelated preceding code within the same block, not to spacing after the function opening brace. Apply this rule to all TS functions across the codebase.
Applied to files:
packages/core/src/hash.tspackages/core/src/array.tssrc/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tspackages/core/src/index.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tspackages/core/src/object.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tspackages/core/src/Stopwatch.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tspackages/core/src/math.tsscripts/ci/check-package-boundaries.tssrc/utils/string.tssrc/utils/hash.tspackages/core/src/tokens.tssrc/utils/format.tspackages/core/src/date-locale.tspackages/core/src/json.tssrc/utils/Stopwatch.tspackages/core/src/string.tssrc/benchmark/commands/show.tssrc/timer/index.tspackages/core/src/date.tspackages/core/src/format.ts
📚 Learning: 2026-03-12T01:26:03.611Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 95
File: src/ask/lib/ChatSessionManager.ts:0-0
Timestamp: 2026-03-12T01:26:03.611Z
Learning: Use SafeJSON.parse(text, { strict: true }) for strict RFC 8259 validation in all non-config boundaries (API responses, JSONL, cache, subprocess output). The 3-arg form SafeJSON.parse(text, null, { strict: true }) is invalid and should not be used. Only lenient default (no options) is appropriate for user-authored config files that may contain comments/trailing commas. Apply this guideline across TypeScript files (src/**/*.ts) wherever SafeJSON.parse is used.
Applied to files:
packages/core/src/hash.tspackages/core/src/array.tssrc/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tspackages/core/src/index.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tspackages/core/src/object.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tspackages/core/src/Stopwatch.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tspackages/core/src/math.tsscripts/ci/check-package-boundaries.tssrc/utils/string.tssrc/utils/hash.tspackages/core/src/tokens.tssrc/utils/format.tspackages/core/src/date-locale.tspackages/core/src/json.tssrc/utils/Stopwatch.tspackages/core/src/string.tssrc/benchmark/commands/show.tssrc/timer/index.tspackages/core/src/date.tspackages/core/src/format.ts
📚 Learning: 2026-03-12T01:26:18.985Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 95
File: src/claude/lib/history/search.ts:0-0
Timestamp: 2026-03-12T01:26:18.985Z
Learning: When using SafeJSON.parse in TypeScript code, prefer the two-argument form SafeJSON.parse(text, { strict: true }) to enable strict RFC 8259 validation via the native JSON.parse. Do NOT use the three-argument form SafeJSON.parse(text, null, { strict: true }). Apply strict parsing at remote/third-party API boundaries, JSONL parsing points, and subprocess output. Fall back to the lenient/default form only for user-authored config files that may legitimately contain comments or trailing commas. This pattern keeps strict validation where appropriate and preserves leniency for internal/config data.
Applied to files:
packages/core/src/hash.tspackages/core/src/array.tssrc/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tspackages/core/src/index.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tspackages/core/src/object.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tspackages/core/src/Stopwatch.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tspackages/core/src/math.tsscripts/ci/check-package-boundaries.tssrc/utils/string.tssrc/utils/hash.tspackages/core/src/tokens.tssrc/utils/format.tspackages/core/src/date-locale.tspackages/core/src/json.tssrc/utils/Stopwatch.tspackages/core/src/string.tssrc/benchmark/commands/show.tssrc/timer/index.tspackages/core/src/date.tspackages/core/src/format.ts
📚 Learning: 2026-03-12T01:26:27.000Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 95
File: src/debugging-master/commands/tail.ts:0-0
Timestamp: 2026-03-12T01:26:27.000Z
Learning: In the genesiscz/GenesisTools repository, prefer using SafeJSON.parse(text, { strict: true }) (2-argument form) at all non-config JSON boundaries such as API responses, JSONL parsers, cache files, and subprocess stdout. Reserve the lenient default (SafeJSON.parse(text) with no options) only for user-authored config files that may legitimately contain comments or trailing commas.
Applied to files:
packages/core/src/hash.tspackages/core/src/array.tssrc/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tspackages/core/src/index.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tspackages/core/src/object.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tspackages/core/src/Stopwatch.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tspackages/core/src/math.tsscripts/ci/check-package-boundaries.tssrc/utils/string.tssrc/utils/hash.tspackages/core/src/tokens.tssrc/utils/format.tspackages/core/src/date-locale.tspackages/core/src/json.tssrc/utils/Stopwatch.tspackages/core/src/string.tssrc/benchmark/commands/show.tssrc/timer/index.tspackages/core/src/date.tspackages/core/src/format.ts
📚 Learning: 2026-03-12T01:26:24.859Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 95
File: src/azure-devops/commands/history-sync.ts:0-0
Timestamp: 2026-03-12T01:26:24.859Z
Learning: In GenesisTools, ensure SafeJSON.parse is called with exactly two arguments. Use SafeJSON.parse(text, { strict: true }) for strict RFC 8259 validation, or pass a reviver function as the second argument. Do not call SafeJSON.parse(text, null, { strict: true }) since the function signature does not support a three-argument form. Apply this guideline to all TypeScript files that use SafeJSON.parse (e.g., src/utils/json.ts) and other related code.
Applied to files:
packages/core/src/hash.tspackages/core/src/array.tssrc/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tspackages/core/src/index.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tspackages/core/src/object.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tspackages/core/src/Stopwatch.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tspackages/core/src/math.tsscripts/ci/check-package-boundaries.tssrc/utils/string.tssrc/utils/hash.tspackages/core/src/tokens.tssrc/utils/format.tspackages/core/src/date-locale.tspackages/core/src/json.tssrc/utils/Stopwatch.tspackages/core/src/string.tssrc/benchmark/commands/show.tssrc/timer/index.tspackages/core/src/date.tspackages/core/src/format.ts
📚 Learning: 2026-03-17T01:30:56.939Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 107
File: src/utils/macos/tts.ts:130-139
Timestamp: 2026-03-17T01:30:56.939Z
Learning: In genesiscz/GenesisTools, do not suggest converting two-argument functions with an optional second parameter (for example setMute(muted: boolean, app?: string)) to an object-parameter form. The project prefers simple positional parameters for short utility functions, even when an optional argument is present. The object-parameter guideline should only apply when a function has 3 or more parameters.
Applied to files:
packages/core/src/hash.tspackages/core/src/array.tssrc/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tspackages/core/src/index.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tspackages/core/src/object.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tspackages/core/src/Stopwatch.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tspackages/core/src/math.tsscripts/ci/check-package-boundaries.tssrc/utils/string.tssrc/utils/hash.tspackages/core/src/tokens.tssrc/utils/format.tspackages/core/src/date-locale.tspackages/core/src/json.tssrc/utils/Stopwatch.tspackages/core/src/string.tssrc/benchmark/commands/show.tssrc/timer/index.tspackages/core/src/date.tspackages/core/src/format.ts
📚 Learning: 2026-03-22T22:19:49.876Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 119
File: src/indexer/index.ts:41-56
Timestamp: 2026-03-22T22:19:49.876Z
Learning: When using Bun projects, treat `import.meta.dir` as an absolute directory path provided by Bun. If you build paths by concatenating with `import.meta.dir` (e.g., `import.meta.dir + "/file.ts"`), do not require `path.resolve()` as it would be redundant. Only apply `path.resolve()` guidance when the base path is relative (not when the base is already an absolute `import.meta.dir`).
Applied to files:
packages/core/src/hash.tspackages/core/src/array.tssrc/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tspackages/core/src/index.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tspackages/core/src/object.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tspackages/core/src/Stopwatch.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tspackages/core/src/math.tsscripts/ci/check-package-boundaries.tssrc/utils/string.tssrc/utils/hash.tspackages/core/src/tokens.tssrc/utils/format.tspackages/core/src/date-locale.tspackages/core/src/json.tssrc/utils/Stopwatch.tspackages/core/src/string.tssrc/benchmark/commands/show.tssrc/timer/index.tspackages/core/src/date.tspackages/core/src/format.ts
📚 Learning: 2026-03-12T03:48:42.474Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 104
File: src/darwinkit/index.ts:146-156
Timestamp: 2026-03-12T03:48:42.474Z
Learning: In TypeScript files that use Commander subcommands and exit after showing help, replace code after Command.help() with the pattern: call sub.outputHelp(); (returns void) followed by process.exit(0) or process.exit(1). This avoids TS7027 unreachable-code because Command.help() returns never. Apply this pattern in all src/**/*.ts files where subcommands need to display help before exiting.
Applied to files:
packages/core/src/hash.tspackages/core/src/array.tssrc/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tspackages/core/src/index.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tspackages/core/src/object.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tspackages/core/src/Stopwatch.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tspackages/core/src/math.tssrc/utils/string.tssrc/utils/hash.tspackages/core/src/tokens.tssrc/utils/format.tspackages/core/src/date-locale.tspackages/core/src/json.tssrc/utils/Stopwatch.tspackages/core/src/string.tssrc/benchmark/commands/show.tssrc/timer/index.tspackages/core/src/date.tspackages/core/src/format.ts
📚 Learning: 2026-05-05T11:58:33.420Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 163
File: src/indexer/lib/sources/mail-source.dateSent.probe.test.ts:0-0
Timestamp: 2026-05-05T11:58:33.420Z
Learning: This repo uses Biome 2.x. The console lint rule is `noConsole` (located at `lint/suspicious/noConsole`), not `noConsoleLog`. In this codebase, `noConsole` is disabled in `biome.json`, so adding a `// biome-ignore lint/suspicious/noConsole:<...>` suppression comment is a no-op and should be avoided (CI flags it as having no effect). When reviewing, do not suggest adding Biome suppression comments for console usage; if a `console.*` call must remain, leave it without a `biome-ignore` comment.
Applied to files:
packages/core/src/hash.tspackages/core/src/array.tssrc/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tspackages/core/src/index.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tspackages/core/src/object.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tspackages/core/src/Stopwatch.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tspackages/core/src/math.tsscripts/ci/check-package-boundaries.tssrc/utils/string.tssrc/utils/hash.tspackages/core/src/tokens.tssrc/utils/format.tspackages/core/src/date-locale.tspackages/core/src/json.tssrc/utils/Stopwatch.tspackages/core/src/string.tssrc/benchmark/commands/show.tssrc/timer/index.tspackages/core/src/date.tspackages/core/src/format.ts
📚 Learning: 2026-05-18T14:02:30.445Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 171
File: src/utils/ui/layouts/AuthLayout.tsx:34-34
Timestamp: 2026-05-18T14:02:30.445Z
Learning: When reviewing a PR, before leaving any comment on a specific file and hunk, verify that the file (and the relevant lines) actually exist in the PR’s current diff. For example, use `git diff --name-only <base>...<head>` (or the PR’s file list) to confirm the file is part of the diff, since pre-rebase/stale hunk references can lead to incorrect or outdated comments.
Applied to files:
packages/core/src/hash.tspackages/core/src/array.tssrc/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tspackages/core/src/index.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tspackages/core/src/object.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tspackages/core/src/Stopwatch.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tspackages/core/src/math.tsscripts/ci/check-package-boundaries.tssrc/utils/string.tssrc/utils/hash.tspackages/core/src/tokens.tssrc/utils/format.tspackages/core/src/date-locale.tspackages/core/src/json.tssrc/utils/Stopwatch.tspackages/core/src/string.tssrc/benchmark/commands/show.tssrc/timer/index.tspackages/core/src/date.tspackages/core/src/format.ts
📚 Learning: 2026-02-24T15:32:37.494Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 54
File: src/github/lib/output.ts:109-113
Timestamp: 2026-02-24T15:32:37.494Z
Learning: In TypeScript files under src/, do not require a leading blank line before an if statement that is the first statement inside a function body (immediately after the function signature). The blank line rule should only apply to if statements that come after other statements within the function body. Apply this guideline consistently across TS files in src to reduce unnecessary vertical whitespace and keep concise function bodies.
Applied to files:
src/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tssrc/utils/string.tssrc/utils/hash.tssrc/utils/format.tssrc/utils/Stopwatch.tssrc/benchmark/commands/show.tssrc/timer/index.ts
📚 Learning: 2026-03-09T13:13:58.786Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 81
File: src/github/commands/get.ts:209-212
Timestamp: 2026-03-09T13:13:58.786Z
Learning: In the GenesisTools repo (genesiscz/GenesisTools), do not treat CI formatter warnings as enforceable formatting rules for TypeScript files under src/. Focus reviews on logical correctness and consistency with existing code patterns. For files under src (e.g., src/github/commands/get.ts), prioritize code structure, readability, naming, correctness, and adherence to project conventions over automated formatting warnings from CI tools.
Applied to files:
src/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tssrc/utils/string.tssrc/utils/hash.tssrc/utils/format.tssrc/utils/Stopwatch.tssrc/benchmark/commands/show.tssrc/timer/index.ts
📚 Learning: 2026-03-12T01:26:31.610Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 95
File: src/timely/utils/entry-processor.ts:0-0
Timestamp: 2026-03-12T01:26:31.610Z
Learning: In code paths where JSON is consumed, prefer strict RFC 8259 validation by using SafeJSON.parse(text, { strict: true }) instead of the lenient default. Apply this at non-config boundaries (e.g., API responses, JSONL, cache outputs, subprocess outputs). Reserve the lenient comment-json behavior only for user-authored config files that may legitimately contain comments or trailing commas. For src/timely/utils/entry-processor.ts and similar modules, replace or wrap JSON parsing with SafeJSON.parse(text, { strict: true }) unless you are explicitly handling config files that require comments.
Applied to files:
src/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tssrc/utils/string.tssrc/utils/hash.tssrc/utils/format.tssrc/utils/Stopwatch.tssrc/benchmark/commands/show.tssrc/timer/index.ts
📚 Learning: 2026-03-12T01:58:27.831Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 103
File: src/port/index.ts:137-144
Timestamp: 2026-03-12T01:58:27.831Z
Learning: In GenesisTools, apply a no-obvious-comments rule: do not add inline comments for well-known POSIX patterns or standard idioms (e.g., a process.kill(pid, 0) probe) when surrounding code is self-documenting through descriptive function/variable names. This guidance applies to TypeScript files under src (src/**/*.ts). Only include comments if they add non-obvious rationale, edge-case behavior, or explain complex logic that cannot be inferred from code alone.
Applied to files:
src/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tssrc/utils/string.tssrc/utils/hash.tssrc/utils/format.tssrc/utils/Stopwatch.tssrc/benchmark/commands/show.tssrc/timer/index.ts
📚 Learning: 2026-03-22T22:19:44.520Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 119
File: src/indexer/commands/graph.ts:34-34
Timestamp: 2026-03-22T22:19:44.520Z
Learning: In genesiscz/GenesisTools, when using `SafeJSON.parse` in `src/**/*.ts`, it is acceptable to omit `{ strict: true }` if (and only if) the JSON being parsed is internal cache/state written by the same codebase (e.g., data saved by one internal writer and later read from a corresponding cached file). Do not require strict mode for these internal, machine-generated cache files. Require `{ strict: true }` at external/untrusted boundaries instead (e.g., API responses, third-party JSONL, subprocess output, or any JSON whose contents may not have been produced by trusted internal code).
Applied to files:
src/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tssrc/utils/string.tssrc/utils/hash.tssrc/utils/format.tssrc/utils/Stopwatch.tssrc/benchmark/commands/show.tssrc/timer/index.ts
📚 Learning: 2026-03-25T19:55:27.917Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 129
File: src/utils/search/stores/vector-store.ts:19-23
Timestamp: 2026-03-25T19:55:27.917Z
Learning: When reviewing this codebase’s “3+ parameters → object parameter” guideline, only suggest object-parameter refactoring when the function’s parameters are ambiguous or include optional/unclear semantics. Do not flag tightly-defined utility/helper functions where (1) all parameters are required, (2) meanings are semantically clear from parameter names, and (3) the ordering is well-ordered and obvious. For example, functions like bruteForceVectorSearch(memoryIndex, queryVector, limit) should be allowed to keep positional parameters because the intent is clear.
Applied to files:
src/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tssrc/utils/string.tssrc/utils/hash.tssrc/utils/format.tssrc/utils/Stopwatch.tssrc/benchmark/commands/show.tssrc/timer/index.ts
📚 Learning: 2026-05-05T03:52:21.057Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 163
File: src/debugging-master/core/dashboard-server.ts:115-127
Timestamp: 2026-05-05T03:52:21.057Z
Learning: When reviewing Bun.serve fetch handlers in this repo, don’t treat `req.signal` as possibly `undefined` at runtime. Bun guarantees an `AbortSignal` on every incoming Request, so `req.signal?.addEventListener(...)` is unnecessary for runtime safety and is only a TypeScript narrowing artifact (e.g., the type might be `AbortSignal | null`). Therefore, don’t raise concerns about SSE/subscription cleanup being skipped because `req.signal` could be missing; cleanup decisions should be based on the actual handler lifecycle, not an imagined runtime absence of `req.signal`.
Applied to files:
src/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tssrc/utils/string.tssrc/utils/hash.tssrc/utils/format.tssrc/utils/Stopwatch.tssrc/benchmark/commands/show.tssrc/timer/index.ts
📚 Learning: 2026-03-25T21:01:55.569Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 129
File: src/utils/string.ts:104-111
Timestamp: 2026-03-25T21:01:55.569Z
Learning: For GenesisTools utilities under src/utils/**, Windows path support is required. When reviewing files in src/utils, treat POSIX-only path handling as a CRITICAL issue—e.g., code that searches for only "/" as the path separator or ignores "\\". Ensure path utility functions correctly handle both separators ("/" and "\\"), for example by using regex patterns like /[\\/]/ when parsing or splitting paths.
Applied to files:
src/utils/math.tssrc/utils/array.tssrc/utils/date-locale.tssrc/utils/object.tssrc/utils/tokens.tssrc/utils/json.tssrc/utils/date.tssrc/utils/string.tssrc/utils/hash.tssrc/utils/format.tssrc/utils/Stopwatch.ts
📚 Learning: 2026-03-26T00:12:19.016Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 129
File: src/utils/string.ts:100-103
Timestamp: 2026-03-26T00:12:19.016Z
Learning: In this repo’s utility files (src/utils/**/*.ts), prefer minimal JSDoc for functions like truncatePath(path, maxLength). Do not add “obvious” implementation details (e.g., explicitly listing handled path separators such as / and \\) when the function/parameter names are self-documenting. Only expand JSDoc when there is non-obvious rationale, important design constraints, or edge-case behavior that would otherwise be unclear to reviewers.
Applied to files:
src/utils/math.tssrc/utils/array.tssrc/utils/date-locale.tssrc/utils/object.tssrc/utils/tokens.tssrc/utils/json.tssrc/utils/date.tssrc/utils/string.tssrc/utils/hash.tssrc/utils/format.tssrc/utils/Stopwatch.ts
📚 Learning: 2026-05-18T15:39:25.103Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 173
File: src/question/commands/log.ts:0-0
Timestamp: 2026-05-18T15:39:25.103Z
Learning: In genesiscz/GenesisTools, when implementing colored terminal/CLI output in TypeScript code under src/, use `picocolors` imported as `pc` (e.g., `import pc from 'picocolors'`). Do not propose `chalk` for CLI coloring. For chained styling (e.g., what chalk would express as `bold` + `blue`), compose picocolors calls by nesting, such as `pc.bold(pc.blue(text))`. Treat any mention of chalk in outdated docs (e.g., CLAUDE.md) as non-authoritative for this guideline.
Applied to files:
src/utils/math.tssrc/usage/index.tssrc/benchmark/lib/display.tssrc/utils/array.tssrc/utils/date-locale.tssrc/utils/object.tssrc/files-to-prompt/index.tssrc/benchmark/lib/runner.tssrc/benchmark/commands/history.tssrc/utils/tokens.tssrc/json/index.tssrc/last-changes/index.tssrc/utils/json.tssrc/utils/date.tssrc/benchmark/lib/results.tssrc/utils/string.tssrc/utils/hash.tssrc/utils/format.tssrc/utils/Stopwatch.tssrc/benchmark/commands/show.tssrc/timer/index.ts
📚 Learning: 2026-05-19T18:33:15.211Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 176
File: src/telegram/index.ts:25-28
Timestamp: 2026-05-19T18:33:15.211Z
Learning: When reviewing legacy CLI entrypoint files (e.g., src/**/index.ts) that call `await runTool(program, { tool: "..." })`, allow the `.catch()` handler to keep `console.error(err); process.exit(1)` without requiring a switch to `logger.error` **only** for minimal-touch migrations that were done solely to satisfy the “no-default-import” gate and that add no new feature/behavior code. If the PR introduces any new feature logic or expands the catch-handling beyond that migration, prefer `logger.error` (and follow the repo’s normal logging conventions).
Applied to files:
src/usage/index.tssrc/files-to-prompt/index.tssrc/json/index.tssrc/last-changes/index.tssrc/timer/index.ts
📚 Learning: 2026-02-25T23:00:07.620Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 56
File: plugins/genesis-tools/commands/github-pr.md:131-131
Timestamp: 2026-02-25T23:00:07.620Z
Learning: Adopt the style: use lowercase 'markdown' (not 'Markdown') in the GenesisTools documentation. Apply this consistently across all Markdown files in the repository (any .md file), including generated docs and READMEs.
Applied to files:
MONOREPO-PLAN.mdMONOREPO-SPEC.md
📚 Learning: 2026-05-22T18:53:48.562Z
Learnt from: genesiscz
Repo: genesiscz/GenesisTools PR: 183
File: scripts/benchmarks/clones/microbenches/README.md:4-4
Timestamp: 2026-05-22T18:53:48.562Z
Learning: In GenesisTools markdown docs, do not treat `macos` (lowercase) inside backticks as a capitalization error. When `macos` is used as a literal CLI subcommand token (e.g., `tools macos clones ...`) corresponding to the `src/macos/` command implementation, keep it lowercase and ignore capitalization suggestions such as LanguageTool rule `MAC_OS` (it would document the wrong command). Only capitalize `MacOS`/`macOS` when it is clearly prose about the operating system, not when it’s a code-formatted command token.
Applied to files:
MONOREPO-PLAN.mdMONOREPO-SPEC.md
🪛 ast-grep (0.42.3)
packages/core/src/string.ts
[warning] 123-123: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(^${escaped}$, "i")
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
🪛 LanguageTool
MONOREPO-PLAN.md
[uncategorized] ~273-~273: Do not mix variants of the same word (‘co-locate’ and ‘colocate’) within a single text.
Context: ...logger or a @gt/core log contract, OR co-locate logger+prompts+cli-core into o...
(EN_WORD_COHERENCY)
[uncategorized] ~285-~285: The operating system from Apple is written “macOS”.
Context: ...ns (cycle-breaking work) - **@gt/ai + @gt/macos (break the ai↔macos cycle, SPEC §0.3/§...
(MAC_OS)
[uncategorized] ~285-~285: The operating system from Apple is written “macOS”.
Context: ... @gt/ai + @gt/macos (break the ai↔macos cycle, SPEC §0.3/§2.1): define `@gt...
(MAC_OS)
[uncategorized] ~287-~287: The operating system from Apple is written “macOS”.
Context: ...e the macOS-backed implementations into @gt/macos which depends on @gt/ai. @gt/ai ...
(MAC_OS)
[uncategorized] ~288-~288: The operating system from Apple is written “macOS”.
Context: ...on @gt/ai. @gt/ai must never import @gt/macos. Verify with the guard (flip ai↔maco...
(MAC_OS)
[uncategorized] ~290-~290: The official name of this software platform is spelled with a capital “H”.
Context: ... to fail). - @gt/github: move the @app/github/* helpers that `utils/github/url-parse...
(GITHUB)
[uncategorized] ~291-~291: The official name of this software platform is spelled with a capital “H”.
Context: ...ls/github/utilsreach into *down* into@gt/github` (they were mis-located); reverse the...
(GITHUB)
[uncategorized] ~303-~303: The official name of this popular video platform is spelled with a capital “T”.
Context: ...er. - **@gt/ui+ youtube fix:** moveui/components/youtube/*` (8 files) into the youtube tool (o...
(YOUTUBE)
[uncategorized] ~330-~330: The operating system from Apple is written “macOS”.
Context: ...test` collected-count; SPEC §3.6 | | ai↔macos / logger→cli cycles re-introduced durin...
(MAC_OS)
MONOREPO-SPEC.md
[style] ~16-~16: Consider removing “of” to be more concise
Context: ...cal findings that shape every decision All of the following were measured in this worktre...
(ALL_OF_THE)
[uncategorized] ~24-~24: The operating system from Apple is written “macOS”.
Context: ... (json, ui, cli, ai, prompts, macos, format, storage, claude, `githu...
(MAC_OS)
[uncategorized] ~25-~25: The official name of this software platform is spelled with a capital “H”.
Context: ...macos, format, storage, claude, github, database, search, audio, `cmu...
(GITHUB)
[uncategorized] ~49-~49: The operating system from Apple is written “macOS”.
Context: ... inside utils:** src/utils/ai imports src/utils/macos (5 files: LanguageDetector, `AIDar...
(MAC_OS)
[uncategorized] ~51-~51: The operating system from Apple is written “macOS”.
Context: ...oSpeechProvider, Translator) **and** src/utils/macos/tts.ts importssrc/utils/ai`. Naive...
(MAC_OS)
[uncategorized] ~52-~52: The operating system from Apple is written “macOS”.
Context: ...ils/ai. Naively splitting @gt/aiand@gt/macos` into separate packages would be **ci...
(MAC_OS)
[style] ~58-~58: Try using a descriptive adverb here.
Context: ...rs), decide how to break > each cycle on purpose, and then gate them in CI so they can...
(ON_PURPOSE_DELIBERATELY)
[uncategorized] ~232-~232: The operating system from Apple is written “macOS”.
Context: ...grations, Migrator, base accessor), src/utils/macos/MacDatabase base. Depends on `@gt/core...
(MAC_OS)
[uncategorized] ~245-~245: The operating system from Apple is written “macOS”.
Context: ... macOS-backed implementations move to @gt/macos, which depends on @gt/ai (one dire...
(MAC_OS)
[uncategorized] ~246-~246: The operating system from Apple is written “macOS”.
Context: ...ne direction). @gt/ai never imports @gt/macos. (Alternative considered: merge ai+m...
(MAC_OS)
[uncategorized] ~249-~249: The operating system from Apple is written “macOS”.
Context: ...wnership boundary.) - @gt/macos — src/utils/macos/* (darwinkit, MailDatabase, calendar, ...
(MAC_OS)
[uncategorized] ~252-~252: The official name of this software platform is spelled with a capital “H”.
Context: ...gt/ai/contracts). - **@gt/github** — src/utils/github/*` (octokit, url-parser). Depends on ...
(GITHUB)
[uncategorized] ~255-~255: The official name of this software platform is spelled with a capital “H”.
Context: ...se tool-side helpers move down into @gt/github (they were mis-located) so the edge po...
(GITHUB)
[uncategorized] ~273-~273: The official name of this popular video platform is spelled with a capital “T”.
Context: ...ds on @gt/core. Violation to fix: ui/components/youtube/* (8 files) → @app/youtube; these ar...
(YOUTUBE)
[uncategorized] ~274-~274: The official name of this popular video platform is spelled with a capital “T”.
Context: ... ui/components/youtube/* (8 files) → @app/youtube; these are youtube feature compone...
(YOUTUBE)
[uncategorized] ~274-~274: The official name of this popular video platform is spelled with a capital “T”.
Context: ... (8 files) → @app/youtube; these are youtube feature components mis-placed in sha...
(YOUTUBE)
[uncategorized] ~275-~275: The official name of this popular video platform is spelled with a capital “T”.
Context: ...laced in shared UI — they move into the youtube tool (or a @gt/youtube-ui feature p...
(YOUTUBE)
[uncategorized] ~311-~311: The operating system from Apple is written “macOS”.
Context: ...ndency direction (toward lower layers). @gt/macos → @gt/ai`` is the inverted edge that bre...
(MAC_OS)
[uncategorized] ~312-~312: The operating system from Apple is written “macOS”.
Context: ...is the inverted edge that breaks the ai↔macos cycle; @gt/logger → @gt/cli-core`` is t...
(MAC_OS)
[uncategorized] ~368-~368: Do not mix variants of the same word (‘colocate’ and ‘co-locate’) within a single text.
Context: ...s bun test is unchanged in mechanism. Colocated *.test.ts move with their source ...
(EN_WORD_COHERENCY)
[uncategorized] ~410-~410: The operating system from Apple is written “macOS”.
Context: ...mains with their cycle-breaks (ai/macos inversion, github/notifications ...
(MAC_OS)
[uncategorized] ~410-~410: The official name of this software platform is spelled with a capital “H”.
Context: ... cycle-breaks* (ai/macos inversion, github/notifications edge fixes) → L4 UI/...
(GITHUB)
[uncategorized] ~427-~427: The operating system from Apple is written “macOS”.
Context: ...ighest — must decide and break the ai↔macos cycle, the logger→cli coupling, and 48 ...
(MAC_OS)
🪛 markdownlint-cli2 (0.22.1)
MONOREPO-PLAN.md
[warning] 52-52: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 63-63: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 70-70: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 77-77: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 85-85: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 105-105: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 113-113: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 120-120: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 140-140: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 152-152: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 155-155: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 170-170: Blank line inside blockquote
(MD028, no-blanks-blockquote)
[warning] 190-190: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 193-193: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 230-230: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 232-232: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 256-256: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 260-260: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 279-279: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 284-284: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 298-298: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 309-309: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
MONOREPO-SPEC.md
[warning] 20-20: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 28-28: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 36-36: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 62-62: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 69-69: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 91-91: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 109-109: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 119-119: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 134-134: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 153-153: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 165-165: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 297-297: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 310-310: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 319-319: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 331-331: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 347-347: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 353-353: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 358-358: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
[warning] 367-367: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
🔇 Additional comments (27)
packages/core/src/Stopwatch.ts (1)
1-61: LGTM!packages/core/src/hash.ts (1)
1-7: LGTM!packages/core/src/json.ts (1)
1-82: LGTM!packages/core/src/array.ts (1)
1-15: LGTM!packages/core/src/date.ts (1)
1-443: LGTM!packages/core/src/string.ts (1)
1-199: LGTM!src/utils/Stopwatch.ts (1)
1-1: LGTM!src/utils/date-locale.ts (1)
1-1: LGTM!src/utils/date.ts (1)
1-1: LGTM!src/utils/format.ts (1)
1-1: LGTM!src/utils/json.ts (1)
1-1: LGTM!src/last-changes/index.ts (1)
6-7: LGTM!src/timer/index.ts (1)
10-10: LGTM!src/utils/array.ts (1)
1-1: LGTM!src/utils/hash.ts (1)
1-1: LGTM!src/utils/math.ts (1)
1-1: LGTM!src/files-to-prompt/index.ts (1)
8-8: LGTM!src/usage/index.ts (1)
6-6: LGTM!scripts/ci/logging-guard.sh (1)
37-37: LGTM!src/utils/object.ts (1)
1-1: LGTM!src/utils/string.ts (1)
1-1: LGTM!src/utils/tokens.ts (1)
1-1: LGTM!src/benchmark/commands/history.ts (1)
3-3: LGTM!src/benchmark/commands/show.ts (1)
2-2: LGTM!src/benchmark/lib/display.ts (1)
3-3: LGTM!src/benchmark/lib/results.ts (1)
4-4: LGTM!src/benchmark/lib/runner.ts (1)
4-4: LGTM!
| ever in doubt. | ||
|
|
||
| ```bash | ||
| cd /Users/Martin/Tresors/Projects/GenesisTools-monorepo-3 |
There was a problem hiding this comment.
Replace machine-specific absolute path with repo-relative setup steps.
Line 19 hardcodes a local path (/Users/Martin/...), which makes the plan non-portable for other contributors. Use repo-relative instructions (e.g., “from repo root”) instead.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@MONOREPO-PLAN.md` at line 19, Replace the machine-specific hardcoded command
"cd /Users/Martin/Tresors/Projects/GenesisTools-monorepo-3" in MONOREPO-PLAN.md
with a repo-relative instruction telling contributors to run the following steps
from the repository root (e.g., “From the repo root, run …”) or to change
directory using a generic method (e.g., determine the repo root with git) so the
plan is portable; locate the exact hardcoded string in the file and update the
line to a generic, non-machine-specific instruction.
| ``` | ||
| tools (src/<tool>/) — thin entrypoints | ||
| │ (depend on @gt/* only; never on another tool) | ||
| ┌──────────────┬──────────┴───────────┬───────────────┬──────────────┐ | ||
| L4 @gt/ui @gt/tui @gt/cmux/@gt/tmux (feature UIs) | ||
| │ │ │ | ||
| L3 @gt/ai ◀──── @gt/macos @gt/github @gt/claude ─ @gt/agents @gt/markdown @gt/audio @gt/notifications | ||
| │ │ │ │ │ | ||
| L2 @gt/database @gt/net @gt/search | ||
| │ │ │ | ||
| L1 @gt/logger ──▶ @gt/cli-core ◀── @gt/prompts @gt/storage @gt/fs @gt/process | ||
| │ | ||
| L0 ─────────────── @gt/core ─────────────────────────────────────────────── | ||
| ``` |
There was a problem hiding this comment.
Add a language identifier to the dependency graph code fence.
The fence starting at Line 297 is unlabeled. Add a language tag (e.g., text) to satisfy markdownlint and improve tooling consistency.
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 297-297: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 310-310: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@MONOREPO-SPEC.md` around lines 297 - 310, The unlabeled code fence containing
the ASCII dependency graph (the block that starts with the tree showing L0
through L4 and modules like `@gt/core`, `@gt/cli-core`, `@gt/logger`, `@gt/ai`, `@gt/ui`,
etc.) needs a language identifier to satisfy markdownlint; update the opening
fence from ``` to a labeled fence such as ```text (or ```txt) so the graph block
is recognized as plain text.
| } | ||
| } | ||
|
|
||
| const envLocale = process.env.LC_TIME || process.env.LANG || process.env.LC_ALL; |
There was a problem hiding this comment.
Fix locale env precedence to honor LC_ALL override.
Line 49 currently prefers LANG before LC_ALL, which can resolve an incorrect locale when both are set.
Suggested patch
- const envLocale = process.env.LC_TIME || process.env.LANG || process.env.LC_ALL;
+ const envLocale = process.env.LC_ALL || process.env.LC_TIME || process.env.LANG;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const envLocale = process.env.LC_TIME || process.env.LANG || process.env.LC_ALL; | |
| const envLocale = process.env.LC_ALL || process.env.LC_TIME || process.env.LANG; |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/core/src/date-locale.ts` at line 49, The locale precedence is wrong:
the envLocale const currently prefers LANG before LC_ALL; update the lookup so
LC_ALL takes highest precedence (e.g., check process.env.LC_ALL first, then
process.env.LC_TIME, then process.env.LANG) to ensure LC_ALL overrides other
locale variables — change the envLocale assignment in this file (the const
envLocale) accordingly.
|
|
||
| /** | ||
| * Create a simple stopwatch function that returns formatted elapsed time. | ||
| * For a full-featured stopwatch with laps/stamps, use Stopwatch class from @app/utils/Stopwatch. |
There was a problem hiding this comment.
Fix stale import path in docs.
The JSDoc points users to @app/utils/Stopwatch, but this module now lives in @gt/core. Keeping this stale path will drive incorrect imports.
Suggested fix
- * For a full-featured stopwatch with laps/stamps, use Stopwatch class from `@app/utils/Stopwatch`.
+ * For a full-featured stopwatch with laps/stamps, use Stopwatch from `@gt/core/Stopwatch`.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| * For a full-featured stopwatch with laps/stamps, use Stopwatch class from @app/utils/Stopwatch. | |
| * For a full-featured stopwatch with laps/stamps, use Stopwatch from `@gt/core/Stopwatch`. |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/core/src/format.ts` at line 405, The JSDoc in
packages/core/src/format.ts that references the Stopwatch module with the stale
path "`@app/utils/Stopwatch`" needs to be updated to the new module path
"`@gt/core`"; locate the comment mentioning "Stopwatch" (the line reading "For a
full-featured stopwatch with laps/stamps, use Stopwatch class from
`@app/utils/Stopwatch`.") and change the import path text to "`@gt/core`" so
documentation points to the correct module (leave the rest of the JSDoc and the
"Stopwatch" identifier unchanged).
| export * from "./array"; | ||
| export * from "./date"; | ||
| export * from "./format"; | ||
| export * from "./hash"; | ||
| export * from "./json"; | ||
| export * from "./math"; | ||
| export * from "./object"; | ||
| export * from "./Stopwatch"; | ||
| export * from "./string"; | ||
| export * from "./tokens"; |
There was a problem hiding this comment.
Barrel is missing date-locale re-export.
date-locale is part of the extracted core utility set, but it is not exposed from the root barrel. This leaves the package surface incomplete and can break root-level imports.
Suggested fix
export * from "./array";
export * from "./date";
+export * from "./date-locale";
export * from "./format";
export * from "./hash";
export * from "./json";🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/core/src/index.ts` around lines 1 - 10, The root barrel
(packages/core/src/index.ts) is missing a re-export for the date-locale module;
update the barrel to expose the date-locale module by adding a re-export entry
for "./date-locale" so consumers can import date-locale from the package root
(ensure the new export line matches the style used for the other modules like
"./date" and "./string").
| export function limitToTokens(text: string, maxTokens?: number): { text: string; tokens: number; truncated: boolean } { | ||
| const tokens = countTokens(text); | ||
|
|
||
| if (maxTokens == null || tokens <= maxTokens) { | ||
| return { text, tokens, truncated: false }; | ||
| } |
There was a problem hiding this comment.
Validate maxTokens before truncation.
Negative or non-integer maxTokens currently produces invalid outputs (e.g., negative tokens metadata and unintended slicing).
Suggested patch
export function limitToTokens(text: string, maxTokens?: number): { text: string; tokens: number; truncated: boolean } {
const tokens = countTokens(text);
- if (maxTokens == null || tokens <= maxTokens) {
+ if (maxTokens == null) {
return { text, tokens, truncated: false };
}
+ if (!Number.isInteger(maxTokens) || maxTokens < 0) {
+ throw new Error(`maxTokens must be a non-negative integer, got: ${maxTokens}`);
+ }
+
+ if (tokens <= maxTokens) {
+ return { text, tokens, truncated: false };
+ }
+
+ if (maxTokens === 0) {
+ return { text: "", tokens: 0, truncated: text.length > 0 };
+ }
+
try {
const { encode, decode } = require("gpt-3-encoder");
const encoded = encode(text);Also applies to: 47-51, 55-60
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/core/src/tokens.ts` around lines 37 - 42, Validate and normalize
maxTokens before performing truncation in limitToTokens: coerce maxTokens to an
integer via Math.floor, treat non-positive values as a request to return an
empty truncated result (return { text: '', tokens: 0, truncated: true } when
maxTokens <= 0), and then use the normalized integer to compute slicing so
tokens/counts cannot become negative; apply the same validation/normalization to
the other truncation blocks in this file (the blocks around the original
function and the sections noted at 47-51 and 55-60) so all truncation code
consistently floors the value and handles zero/negative inputs safely.
| }; | ||
|
|
||
| /** Tool dirs/files under src/ that are NOT shared packages (for tool->tool detection). */ | ||
| const TOOL_IMPORT_RE = /@app\/([a-zA-Z0-9._-]+)(?:\/|")/; |
There was a problem hiding this comment.
Boundary detection misses bare @app/<tool> imports.
The regex requires / or " after the tool segment, so specifiers like @app/logger are not matched and can bypass Rule 3/4/5 checks.
Suggested fix
-const TOOL_IMPORT_RE = /@app\/([a-zA-Z0-9._-]+)(?:\/|")/;
+const TOOL_IMPORT_RE = /^`@app`\/([a-zA-Z0-9._-]+)(?:\/|$)/;Also applies to: 111-114
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/ci/check-package-boundaries.ts` at line 51, The TOOL_IMPORT_RE
currently requires a trailing "/" or quote which misses bare imports like
"`@app/logger`"; update the regex used for tool import detection (TOOL_IMPORT_RE)
to allow the end-of-string (or a closing quote) after the captured tool name
instead of requiring a slash, and apply the same fix to the other occurrences
referenced around lines 111-114 so bare specifiers like "`@app/`<tool>" are
matched and subject to Rule 3/4/5 checks.
| const pattern = "from\\s+[\"']([^\"']+)[\"']"; | ||
| const raw = await $`rg -n --no-heading -g ${excludeNodeModules} -g ${globTs} -g ${globTsx} ${pattern} ${scope}` |
There was a problem hiding this comment.
Import scanner ignores side-effect imports, allowing boundary bypass.
Rules are enforced only for from "..." imports. import "@app/x" and import "@gt/x" are not collected, so violations can slip through CI.
Suggested fix
- const pattern = "from\\s+[\"']([^\"']+)[\"']";
+ const pattern = "(?:from\\s+[\"']([^\"']+)[\"']|^\\s*import\\s+[\"']([^\"']+)[\"'])";
...
- const specMatch = rest.match(/from\s+["']([^"']+)["']/);
+ const specMatch =
+ rest.match(/from\s+["']([^"']+)["']/) ??
+ rest.match(/^\s*import\s+["']([^"']+)["']/);Also applies to: 87-88
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/ci/check-package-boundaries.ts` around lines 70 - 71, The import
scanner only matches "from '...'" forms, missing side-effect imports like import
"pkg"; update the regex in the pattern variable to also capture bare imports
(for example use a combined regex such as
(?:from\s+["']([^"']+)["']|import\s+["']([^"']+)["'])) and adjust the code that
consumes the match (the place that reads the capture groups from raw) to take
the non-null capture (group1 || group2); apply the same change to the other
occurrence referenced (the similar pattern around lines 87-88) so both scanners
collect side-effect imports.
| import { runTool } from "@app/utils/cli"; | ||
| import { SafeJSON } from "@app/utils/json"; | ||
| import { handleReadmeFlag } from "@app/utils/readme"; | ||
| import { SafeJSON } from "@gt/core/json"; |
There was a problem hiding this comment.
Use the repo-mandated SafeJSON import path in src/**.
SafeJSON in src/json/index.ts should come from @app/utils/json, not @gt/core/json, to keep the enforced source-of-truth contract in src/**.
Suggested fix
-import { SafeJSON } from "`@gt/core/json`";
+import { SafeJSON } from "`@app/utils/json`";📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { SafeJSON } from "@gt/core/json"; | |
| import { SafeJSON } from "`@app/utils/json`"; |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/json/index.ts` at line 6, The import in src/json/index.ts pulls SafeJSON
from the wrong module; replace the import of SafeJSON from "`@gt/core/json`" with
the repo-mandated path "`@app/utils/json`" so that SafeJSON used in this file (and
any exports/functions here) come from the canonical source; update the import
statement that references SafeJSON accordingly and ensure subsequent uses still
call SafeJSON.parse()/SafeJSON.stringify().
| import { formatDateTime } from "@app/utils/date"; | ||
| import { SafeJSON } from "@app/utils/json"; | ||
| import { formatDateTime } from "@gt/core/date"; | ||
| import { SafeJSON } from "@gt/core/json"; |
There was a problem hiding this comment.
Switch SafeJSON back to the mandated @app/utils/json source in src/**.
This import path breaks the repository rule for src/**/*.ts and should use @app/utils/json.
Suggested fix
-import { SafeJSON } from "`@gt/core/json`";
+import { SafeJSON } from "`@app/utils/json`";📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { SafeJSON } from "@gt/core/json"; | |
| import { SafeJSON } from "`@app/utils/json`"; |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/usage/index.ts` at line 7, Replace the incorrect import of SafeJSON from
"`@gt/core/json`" with the mandated module "`@app/utils/json`" in the file that
imports SafeJSON; update the import statement to reference "`@app/utils/json`" and
ensure all usages within the file continue to call SafeJSON.parse() and
SafeJSON.stringify() as required by the src/** guideline.
Monorepo foundation — Approach 3: Domain-driven package split (enforced boundaries)
One of three competing monorepo designs (
feat/monorepo-1/-2/-3). Each was independently designed, implemented, and verified by a separate agent. Pick one; close the other two. This is the clean-architecture / long-term-maintainability option.What it does
exports→ raw.ts). Keeps the@app/* → ./src/*alias forever; every moved file leaves a pureexport * from "@gt/..."re-export shim.@gt/core→ L1 cli-core/logger/prompts/storage/fs/process → L2 database/net/search → L3 ai/macos/github/claude/agents/markdown/audio/notifications → L4 ui/tui/cmux/tmux), with documented cycle-breaks (e.g.ai ↔ macosvia@gt/ai/contracts,notifications → @app/telegram-botvia aNotifierChannelinterface). SeeMONOREPO-SPEC.md.@gt/core(packages/core/): json/SafeJSON, date, date-locale, format, string, array, object, math, hash, tokens, Stopwatch. Migrates 6 tools (timer,last-changes,files-to-prompt,usage,json,benchmark).scripts/ci/check-package-boundaries.ts(repo-idiomatic, like the existing logging-guard / palette checks): fails on layer back-edges /package → @app/<tool>imports / tool↔tool imports; currently warns on the 205 known reverse-dep backlog sites (flip warn→fail per phase).Green bar (independently verified)
tsgo --noEmit= 0 errors (== master baseline)@app/loggerinto@gt/coremakes it fail); logging-guard + biome clean./tools+ all 6 tools functional smoke-run (caught adate → date-localeruntimerequire()trap that static analysis/tsgo miss)Trade-offs vs the other two
Cleanest long-term architecture, explicit ownership, enforced dependency direction. Largest eventual change and most upfront design; foundation extracts only
@gt/core(the rest is a documented, layered roadmap).Full design on the branch:
MONOREPO-SPEC.md+MONOREPO-PLAN.md.🤖 Generated via a multi-agent design→implement→verify workflow.
Summary by CodeRabbit
New Features
@gt/coreutility package containing formatting, date/time, hashing, JSON parsing, and string manipulation utilities.Documentation