12 Commits
Author SHA1 Message Date
Ali Arslan 770eb29b9f fix(opencode): remove the pre-fix declined stub the legacy migration leaves behind 2026-10-28 23:30:39 +05:00
Ali Arslan 73f61801db fix(opencode): make the declined-hooks plugin stub satisfy the V2 loader schema
The inert stub written when hook consent is not granted was
`export default async () => ({})`. OpenCode v2 validates every plugin
module before running it and requires the default export to be a definition
object with an `id` and an `effect` or `setup` function, so a declined or
runtime-less home install printed the same startup error as the V1 hook
plugin:

  PluginModule.LoadError: Plugin must export a default definition with an id
  and an effect or setup function.
  (cause: SchemaError(Expected object at ["default"]))

Write `export default { id: "ecc-hooks", setup() {} }` instead. It keeps the
inert behaviour (no imports, no module initialization of the replaced
plugin) and satisfies the loader.

Tests that pinned the generated bytes now compare against
getDisabledOpenCodePluginContent() rather than a duplicated literal, and
tests/opencode-plugin-loader-contract.test.js asserts the loader contract on
the generated payload. That test fails on the previous stub
("default export must be an object, got function").

Refs #3537. The same assertion should cover .opencode/plugins/*.ts once a V2
entrypoint lands (#3536, #3224); those plugins are scanned independently in
home installs, so both the barrel and the implementation are loaded.
2026-10-28 22:32:41 +05:00
haelyra 7f0b6ce500 fix(install): reject malformed empty-container JSONC commas 2026-10-25 18:20:40 -04:00
Hemang Varshney 8e2cdefba6 fix(install): reject unterminated comments, keep plugin shape check, handle CR endings
Address review findings on #3590:

- Unterminated block comments now throw instead of silently passing:
  {'plugin':[]} /* no longer parses, so the install keeps its
  source-context error for genuinely malformed configs (CodeRabbit,
  Greptile).
- Line-comment scanners stop at CR as well as LF, so CR-only line
  endings do not consume the rest of the file (CodeRabbit).
- activationIsInactive restores the 'plugin must be an array' shape
  check that the strict parser surfaced, so a non-array plugin no
  longer counts as inactive (Greptile).

Regression tests: unterminated comment with source context, CR-only
endings, and non-array plugin across apply/repair/doctor modes.
2026-10-15 17:49:10 +05:30
Hemang Varshney ced82ccf9f fix(install): tolerate JSONC comments in the OpenCode config membership check
The read-only plugin-membership check in activationIsInactive and the
validation inside disableOpenCodeHookPluginRegistration used strict
JSON.parse, so any user whose ~/.config/opencode/opencode.json contains
JSONC comments (which OpenCode itself accepts) could not install the
OpenCode catalog. The plan never writes the user-owned config; this
parse is purely a membership read (issue #3546).

Add a string-aware JSONC parser (line/block comments, the trailing
commas they hide, URL strings untouched) and route both call sites
through it. Truly malformed JSON keeps its source-context error.

Tests: unit coverage for comment/trailing-comma/URL handling, plus an
apply-level regression test that installs over an inactive JSONC user
config byte-for-byte, across default and declined consent modes.
2026-10-15 17:02:16 +05:30
Huanyi Xie 990e45e177 fix(opencode): avoid duplicate home plugin initialization 2026-10-06 19:41:18 +03:00
affaan-m ef8c2d8b9c fix(opencode): guard legacy cleanup and portable consent fixtures
Preserve contributor history and current-main behavior while resolving the exact reviewed follow-up.

Source-PR: https://github.com/affaan-m/ECC/pull/3008
Source-Parent: d0dc1fcb08
Review-Manifest-SHA256: 8f15febd33dfa9f9ac6e70cb41f75ffee7aca47dd21782e841c33d4874341d6e
2026-09-28 00:54:21 -04:00
affaan-m 4be4eb4cf3 fix(install): reconcile OpenCode hook consent with current main
Preserve the contributor change and current installer contracts. Make automatically discovered plugin entrypoints inert without explicit runtime consent, verify managed ownership before deactivation, and retain prior consent on incomplete migration.

Source-PR: https://github.com/affaan-m/ECC/pull/3008
Source-Head: f8c0c2c182
2026-09-18 18:35:19 -04:00
Samarjeet Singh Tomar f8c0c2c182 fix(install): gate OpenCode hook activation
Signed-off-by: Samarjeet  Singh Tomar <samar_tomar@hotmail.com>
2026-09-07 02:26:37 -05:00
wellkilo 569e5a36bb feat(install): register manual Claude hooks 2026-09-07 00:53:13 +08:00
haelyra 64d0d9436f fix(install): preserve opencode non-hook defaults 2026-08-30 15:35:47 -04:00
6aaa41e028 feat(install): require an explicit hook decision at the apply layer
The guided installer asks how ECC hooks should run, but that consent
lived only in the wizard path. Running install-apply directly with a
profile that includes hooks-runtime still materialized the hook runtime
with no disclosure and no decision.

Gate the apply layer instead, so every entry point is covered:

- disclose the six hook capability groups when a plan would materialize
  the hook runtime, and refuse to apply until the caller decides
- --enable-hooks confirms the hook runtime; --no-hooks installs the rest
  of the selection without it and records the reduced module closure in
  install-state
- surface the pending decision as a dry-run warning
- show the same capability disclosure in the guided installer's plan
  preview, so the wizard's hook question states what it is asking about

Plans that never materialize hooks (Kimi, --profile minimal,
--without baseline:hooks) are unaffected and need no flag. Repair and
uninstall operate on already-recorded state and stay unchanged.

The capability taxonomy and the held-materialization behavior come from
Samarjeet Singh Tomar's PR #2634, reworked to fit the single-decision
consent model that shipped with the guided installer in #2649.

Co-Authored-By: Samarjeet Singh Tomar <samar_tomar@hotmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-30 15:09:34 -04:00