Skip to content

feat: add @hikkaku/gobox#142

Merged
nakasyou merged 13 commits into
mainfrom
feat/gobox-runtime-publish
Feb 21, 2026
Merged

feat: add @hikkaku/gobox#142
nakasyou merged 13 commits into
mainfrom
feat/gobox-runtime-publish

Conversation

@nakasyou

Copy link
Copy Markdown
Member

Summary

  • add new @hikkaku/gobox package (value, types, functions) with scoped list-backed memory runtime
  • add unstable build-scope APIs in hikkaku core for scope-exit/stop restrictions used by gobox
  • add examples/gobox-counter using struct, trait, useImpl, useSignal, useEffect
  • switch signal effects to procedure-based dispatch
  • add publish support for gobox in .github/workflows/publish.yml
  • enforce non-empty repository in package metadata during publish flow

API updates

  • defineFunction -> useFunction
  • remove callFunction; use fn.call(...)
  • impl -> useImpl
  • useImpl can accept function option objects directly (no explicit useFunction(...) wrapper required)

Verification

  • bun run --cwd packages/gobox test
  • bun run --cwd examples/gobox-counter build
  • bun run typecheck

Copilot AI review requested due to automatic review settings February 19, 2026 13:37
@nakasyou nakasyou changed the title feat: add @hikkaku/gobox runtime and publish flow feat: add @hikkaku/gobox Feb 19, 2026
@codecov

codecov Bot commented Feb 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.33528% with 32 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/gobox/src/functions.ts 92.88% 8 Missing and 10 partials ⚠️
packages/hikkaku/src/core/composer.ts 82.08% 6 Missing and 6 partials ⚠️
packages/gobox/src/internal/runtime.ts 97.75% 1 Missing and 1 partial ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #142      +/-   ##
==========================================
+ Coverage   78.68%   80.72%   +2.03%     
==========================================
  Files          46       50       +4     
  Lines        3542     4098     +556     
  Branches      499      595      +96     
==========================================
+ Hits         2787     3308     +521     
- Misses        534      548      +14     
- Partials      221      242      +21     
Flag Coverage Δ
tests 80.69% <95.33%> (+2.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/gobox/src/internal/impl.ts 100.00% <100.00%> (ø)
packages/gobox/src/value.ts 100.00% <100.00%> (ø)
packages/hikkaku/src/blocks/control.ts 97.36% <100.00%> (ø)
packages/hikkaku/src/blocks/data.ts 100.00% <100.00%> (ø)
packages/hikkaku/src/blocks/events.ts 100.00% <100.00%> (ø)
packages/hikkaku/src/blocks/looks.ts 100.00% <100.00%> (ø)
packages/hikkaku/src/blocks/motion.ts 100.00% <100.00%> (ø)
packages/hikkaku/src/blocks/music.ts 100.00% <100.00%> (ø)
packages/hikkaku/src/blocks/operator.ts 100.00% <100.00%> (ø)
packages/hikkaku/src/blocks/pen.ts 100.00% <100.00%> (ø)
... and 8 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request introduces a new @hikkaku/gobox package that provides higher-level typed value, signal, and function abstractions on top of the core hikkaku library. The PR adds scoped memory management using list-backed runtime, reactive signals with procedure-based effects, struct/trait systems, and custom function definitions with return values.

Changes:

  • Adds @hikkaku/gobox package with value, types, and functions modules implementing a type system, scoped memory management, signals/effects, and custom functions
  • Introduces unstable build-scope APIs in hikkaku core (__unstable_getBuildTarget, __unstable_getBuildScopeFrame, __unstable_onBuildScopeExit, __unstable_forbidStopInCurrentScope) to support gobox's scope management
  • Adds examples/gobox-counter demonstrating struct, trait, useImpl, useSignal, and useEffect usage
  • Updates publish workflow to support gobox package releases and enforce non-empty repository field validation

Reviewed changes

Copilot reviewed 26 out of 29 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/hikkaku/src/core/project.ts Adds build target stack to track current target during run()
packages/hikkaku/src/core/composer.ts Implements build scope tracking with exit callbacks and stop restrictions
packages/hikkaku/src/core/project.test.ts Tests for build target exposure
packages/hikkaku/src/core/composer.test.ts Tests for build scope frame APIs
packages/gobox/src/types.ts Type system for number, string, boolean, vector, struct, and trait
packages/gobox/src/value.ts Scoped values, signals, and effects implementation
packages/gobox/src/functions.ts Custom function definitions with return values
packages/gobox/src/internal/runtime.ts Memory management with static and dynamic allocation
packages/gobox/src/index.ts Package entry point and exports
packages/gobox/package.json Package configuration
packages/gobox/vite.config.ts Build configuration
packages/gobox/tsconfig.json TypeScript configuration
examples/gobox-counter/src/main.ts Example counter application using gobox
examples/gobox-counter/package.json Example package configuration
.github/workflows/publish.yml Publish workflow updates for gobox
bun.lock Dependency lock updates

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/gobox/src/types.ts Outdated
Comment on lines +163 to +201
export function useImpl<
TStruct extends GoboxStructLike,
TMethods extends Record<string, unknown>,
>(type: TStruct, methods: TMethods): TStruct & { methods: TMethods }
export function useImpl<
TStruct extends GoboxStructLike,
TTraitMethods extends Record<string, unknown>,
TMethods extends TTraitMethods & Record<string, unknown>,
>(
type: TStruct,
traitDef: GoboxTrait<TTraitMethods>,
methods: TMethods,
): TStruct & { methods: TMethods }
export function useImpl<
TStruct extends GoboxStructLike,
TMethods extends Record<string, unknown>,
>(
type: TStruct,
methodsOrTrait: TMethods | GoboxTraitLike,
maybeMethods?: TMethods,
): TStruct & { methods: TMethods } {
let methods: TMethods
if (maybeMethods !== undefined) {
const traitDef = methodsOrTrait as GoboxTraitLike
methods = maybeMethods
for (const methodName of traitDef.methodNames) {
if (!(methodName in methods)) {
throw new Error(`Missing trait method: ${String(methodName)}`)
}
}
} else {
methods = methodsOrTrait as TMethods
}

return {
...type,
methods,
}
}

Copilot AI Feb 19, 2026

Copy link

Choose a reason for hiding this comment

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

There is a naming conflict: useImpl is exported from both types.ts and functions.ts. Since index.ts does export * from './functions' before export * from './value', the functions.ts version will take precedence, but this creates ambiguity. The functions.ts version calls normalizeImplMethods while this version doesn't, making them functionally different.

Consider renaming the types.ts version to something like implWithMethods or removing it entirely if the functions.ts version is meant to be the canonical implementation.

Copilot uses AI. Check for mistakes.
Comment thread packages/gobox/package.json
Comment thread packages/gobox/package.json Outdated
Comment on lines +118 to +122
has_repository="$(node -e "const fs=require('fs');const pkg=JSON.parse(fs.readFileSync(process.argv[1],'utf8'));const repo=pkg.repository;const ok=(typeof repo==='string'&&repo.trim()!=='')||(repo&&typeof repo==='object'&&typeof repo.url==='string'&&repo.url.trim()!=='');process.stdout.write(ok?'yes':'no')" "$package_json_path")"
if [ "$has_repository" != "yes" ]; then
echo "package.json must contain a non-empty repository field: $package_json_path"
exit 1
fi

Copilot AI Feb 19, 2026

Copy link

Choose a reason for hiding this comment

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

The repository field validation logic uses complex inline Node.js code that could be more maintainable. The logic checks if repository is either a non-empty string or an object with a non-empty url string. Consider extracting this into a separate script file for better readability and testability, similar to how version bumping might be handled.

Copilot uses AI. Check for mistakes.

Copilot AI commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

@nakasyou I've opened a new pull request, #143, to work on those changes. Once the pull request is ready, I'll request review from you.

nakasyou and others added 11 commits February 19, 2026 23:10
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Initial plan

* fix(gobox): add "files" field to package.json for publish

Co-authored-by: nakasyou <79000684+nakasyou@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: nakasyou <79000684+nakasyou@users.noreply.github.com>
@nakasyou nakasyou merged commit ec8fa8a into main Feb 21, 2026
3 checks passed
@nakasyou nakasyou deleted the feat/gobox-runtime-publish branch February 21, 2026 15:18
Sign up for free to 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.

3 participants