@dotdotgod/opencode 0.0.0-stage → 0.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/LICENSE +94 -0
  2. package/README.md +84 -2
  3. package/commands/impact.md +26 -0
  4. package/commands/init.md +38 -0
  5. package/commands/load.md +28 -0
  6. package/index.js +1 -0
  7. package/mcp/cli.mjs +7161 -0
  8. package/mcp/impact-state.mjs +133 -0
  9. package/mcp/parsers/IGNORE_LICENSE +21 -0
  10. package/mcp/parsers/LICENSE +21 -0
  11. package/mcp/parsers/TYPESCRIPT_LICENSE +21 -0
  12. package/mcp/parsers/tree-sitter-bash.wasm +0 -0
  13. package/mcp/parsers/tree-sitter-c-sharp.wasm +0 -0
  14. package/mcp/parsers/tree-sitter-cpp.wasm +0 -0
  15. package/mcp/parsers/tree-sitter-css.wasm +0 -0
  16. package/mcp/parsers/tree-sitter-go.wasm +0 -0
  17. package/mcp/parsers/tree-sitter-ini.wasm +0 -0
  18. package/mcp/parsers/tree-sitter-java.wasm +0 -0
  19. package/mcp/parsers/tree-sitter-javascript.wasm +0 -0
  20. package/mcp/parsers/tree-sitter-php.wasm +0 -0
  21. package/mcp/parsers/tree-sitter-powershell.wasm +0 -0
  22. package/mcp/parsers/tree-sitter-python.wasm +0 -0
  23. package/mcp/parsers/tree-sitter-regex.wasm +0 -0
  24. package/mcp/parsers/tree-sitter-ruby.wasm +0 -0
  25. package/mcp/parsers/tree-sitter-rust.wasm +0 -0
  26. package/mcp/parsers/tree-sitter-tsx.wasm +0 -0
  27. package/mcp/parsers/tree-sitter-typescript.wasm +0 -0
  28. package/mcp/parsers/tree-sitter.cjs +4075 -0
  29. package/mcp/parsers/tree-sitter.wasm +0 -0
  30. package/mcp/server.mjs +23716 -0
  31. package/package.json +41 -3
  32. package/server.js +1 -0
  33. package/skills/doc-first-planning/SKILL.md +30 -0
  34. package/skills/document-clarify/SKILL.md +41 -0
  35. package/skills/impact-review/SKILL.md +25 -0
  36. package/skills/project-initializer/SKILL.md +37 -0
  37. package/skills/project-initializer/references/agent-docs.md +42 -0
  38. package/skills/project-initializer/scripts/init_project.sh +525 -0
  39. package/skills/project-initializer/templates/case-and-evidence.json +219 -0
  40. package/skills/project-initializer/templates/dotdotgod.config.json +234 -0
  41. package/skills/project-initializer/templates/policy.json +241 -0
  42. package/skills/project-initializer/templates/portfolio.json +255 -0
  43. package/skills/project-initializer/templates/publication.json +265 -0
  44. package/skills/project-initializer/templates/research.json +287 -0
  45. package/skills/project-initializer/templates/software.json +234 -0
  46. package/skills/project-load/SKILL.md +27 -0
  47. package/src/impact.mjs +25 -0
  48. package/src/index.mjs +17 -0
  49. package/src/location.mjs +7 -0
  50. package/src/mcp.mjs +37 -0
  51. package/src/plan.mjs +65 -0
  52. package/src/resources.mjs +28 -0
package/LICENSE ADDED
@@ -0,0 +1,94 @@
1
+ Elastic License 2.0 (ELv2)
2
+
3
+ Copyright 2026 JooYoung Kim
4
+
5
+ ## Acceptance
6
+
7
+ By using the software, you agree to all of the terms and conditions below.
8
+
9
+ ## Copyright License
10
+
11
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
12
+ non-sublicensable, non-transferable license to use, copy, distribute, make
13
+ available, and prepare derivative works of the software, in each case subject
14
+ to the limitations and conditions below.
15
+
16
+ ## Limitations
17
+
18
+ You may not provide the software to third parties as a hosted or managed
19
+ service, where the service provides users with access to any substantial set
20
+ of the features or functionality of the software.
21
+
22
+ You may not move, change, disable, or circumvent the license key
23
+ functionality in the software, and you may not remove or obscure any
24
+ functionality in the software that is protected by the license key.
25
+
26
+ You may not alter, remove, or obscure any licensing, copyright, or other
27
+ notices of the licensor in the software. Any use of the licensor's trademarks
28
+ is subject to applicable law.
29
+
30
+ ## Patents
31
+
32
+ The licensor grants you a license, under any patent claims the licensor can
33
+ license, or becomes able to license, to make, have made, use, sell, offer for
34
+ sale, import and have imported the software, in each case subject to the
35
+ limitations and conditions in this license. This license does not cover any
36
+ patent claims that you cause to be infringed by modifications or additions to
37
+ the software. If you or your company make any written claim that the software
38
+ infringes or contributes to infringement of any patent, your patent license
39
+ for the software granted under these terms ends immediately. If your company
40
+ makes such a claim, your patent license ends immediately for work on behalf
41
+ of your company.
42
+
43
+ ## Notices
44
+
45
+ You must ensure that anyone who gets a copy of any part of the software from
46
+ you also gets a copy of these terms.
47
+
48
+ If you modify the software, you must include in any modified copies of the
49
+ software prominent notices stating that you have modified the software.
50
+
51
+ ## No Other Rights
52
+
53
+ These terms do not imply any licenses other than those expressly granted in
54
+ these terms.
55
+
56
+ ## Termination
57
+
58
+ If you use the software in violation of these terms, such use is not
59
+ licensed, and your licenses will automatically terminate. If the licensor
60
+ provides you with a notice of your violation, and you cease all violation of
61
+ this license no later than 30 days after you receive that notice, your
62
+ licenses will be reinstated retroactively. However, if you violate these
63
+ terms after such reinstatement, any additional violation of these terms will
64
+ cause your licenses to terminate automatically and permanently.
65
+
66
+ ## No Liability
67
+
68
+ *As far as the law allows, the software comes as is, without any warranty or
69
+ condition, and the licensor will not be liable to you for any damages arising
70
+ out of these terms or the use or nature of the software, under any kind of
71
+ legal claim.*
72
+
73
+ ## Definitions
74
+
75
+ The **licensor** is the entity offering these terms, and the **software** is
76
+ the software the licensor makes available under these terms, including any
77
+ portion of it.
78
+
79
+ **you** refers to the individual or entity agreeing to these terms.
80
+
81
+ **your company** is any legal entity, sole proprietorship, or other kind of
82
+ organization that you work for, plus all organizations that have control over,
83
+ are under the control of, or are under common control with that organization.
84
+ **control** means ownership of substantially all the assets of an entity, or
85
+ the power to direct its management and policies by vote, contract, or
86
+ otherwise. Control can be direct or indirect.
87
+
88
+ **your licenses** are all the licenses granted to you for the software under
89
+ these terms.
90
+
91
+ **use** means anything you do with the software requiring one of your
92
+ licenses.
93
+
94
+ **trademark** means trademarks, service marks, and similar rights.
package/README.md CHANGED
@@ -1,3 +1,85 @@
1
- # Temporary Holding Version
1
+ # OpenCode Adapter
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Dotdotgod project-memory workflows for OpenCode V2: shared MCP execution and
4
+ retrieval, native plan-agent integration, and advisory changed-file impact.
5
+
6
+ ## Start Here
7
+
8
+ Requires Node.js >=22.5 on PATH. Plan integration targets OpenCode **2.1.2**.
9
+ Other versions retain native plan restrictions and report unavailable integration.
10
+
11
+ After publishing, add the package to the project's `opencode.jsonc`:
12
+
13
+ ```jsonc
14
+ {
15
+ "$schema": "https://opencode.ai/config.json",
16
+ "plugins": ["@dotdotgod/opencode"]
17
+ }
18
+ ```
19
+
20
+ From this source checkout, run `pnpm run generate` first, then use the absolute
21
+ `packages/opencode` directory as the plugin target in a disposable project.
22
+ Local directory loading uses `index.js`; npm loading uses the package exports.
23
+ No project `.opencode/` scaffold or `OPENCODE.md` is required. Keep `AGENTS.md`
24
+ canonical. Reload/restart OpenCode after installation changes.
25
+
26
+ ## Workflows
27
+
28
+ - `/dd:load`: bounded project map and optional focused query.
29
+ - `/dd:init`: initialize project memory; dry-run by default, writes confirmed.
30
+ - `/dd:impact`: review changed paths through the shared MCP tool.
31
+ - Five shared skills: project-load, doc-first-planning, project-initializer,
32
+ impact-review, and document-clarify.
33
+
34
+ There is no `/dd:plan`. Select OpenCode's built-in plan agent. Concrete plans
35
+ are automatically saved to `docs/plan/<task-slug>/README.md` without a separate
36
+ save request, and revised in place as decisions change. Initial questions and
37
+ explanation-only conversations need no file. Saving does not approve execution:
38
+ switch agents before implementation. File creation is performed by the agent's
39
+ normal edit tools, not an automatic transcript dump.
40
+
41
+ ## MCP Tools
42
+
43
+ The plugin registers `dotdotgod_context` with Code Mode enabled. Discover exact
44
+ tool names from OpenCode's catalog instead of guessing them. It supplies project
45
+ load/initialize/impact, execution, file processing, indexing, search, fetch,
46
+ diagnostics, and ingestion jobs. MCP replies retain content, structuredContent
47
+ and isError; inspect actual execution status and source IDs before claiming success.
48
+ Use auto output for unknown-size commands and bounded source-scoped retrieval.
49
+ Use native read for short, located source and images.
50
+
51
+ The nineteen shared catalog names have no `dotdotgod_` prefix: for example,
52
+ `project_load`, `project_impact`, `impact_status`, and `execute`. The server namespace
53
+ remains `dotdotgod_context`; no forwarding aliases are registered. Reload sessions
54
+ after upgrading and update saved calls/prompts that use removed names.
55
+
56
+ ## Advisory Impact
57
+
58
+ Successful observed edit/write/patch operations add project-relative pending
59
+ paths. State persists per host session in `.dotdotgod/context/impact.sqlite`.
60
+ Successful MCP impact clears only covered paths whose revision and content did
61
+ not change during review. Failed reviews retain pending state. The status tool
62
+ reports a bounded list; no pending paths are silently evicted.
63
+ Records expire 24 hours after their revision is stored; expiration is not review.
64
+
65
+ Pending impact **never blocks** tests, builds, edits, commits or publishing.
66
+ Native permissions and plan-safety restrictions still apply. Shell/script,
67
+ external editor, and unrecognized tool changes are not automatically attributed;
68
+ provide their paths explicitly for review. Existing user dirty files are not
69
+ automatically imported from the whole worktree.
70
+
71
+ ## Compatibility And Verification
72
+
73
+ Plan redirection recognizes the shipped reminder and replaces the shipped path
74
+ exception in place, preserving later user denies. Unsupported layouts warn rather
75
+ than force-allowing permissions. This is version-coupled integration, not an
76
+ OpenCode public path setting. MCP execution remains write-capable and is not a
77
+ filesystem sandbox; shell permission checks on MCP command strings do not
78
+ reproduce the host's full native shell scanner.
79
+
80
+ Run `pnpm --filter @dotdotgod/opencode verify`. The opt-in source-checkout command
81
+ `pnpm --filter @dotdotgod/opencode smoke` uses an installed OpenCode binary and a
82
+ local deterministic model endpoint, isolated HOME/XDG directories and its own
83
+ service port; it makes no paid model calls and stops only its isolated service.
84
+ Use `node packages/opencode/scripts/smoke.mjs <directory>` with an extracted
85
+ package to repeat that host smoke against a tarball instead of source files.
@@ -0,0 +1,26 @@
1
+ ---
2
+ description: Review changed-file impact
3
+ ---
4
+
5
+ <!-- Generated from packages/shared resources by scripts/generate-adapters.mjs. Do not edit this file directly; edit the shared source and run `pnpm run generate`. -->
6
+
7
+ # Review changed-file impact
8
+
9
+ Use the dotdotgod_context MCP server for project load, initialization, graph impact, execution and indexed retrieval. Discover its exact tool names in OpenCode Code Mode; inspect MCP isError and structuredContent and every execution results entry. For unknown output size use execute with a commands array and outputMode auto; search indexed.id with bounded source-scoped search. Run ancillary CLI checks through MCP execute rather than a duplicate native service. Keep direct read for short located source and images. Pending impact is advisory, never an execution gate. Preserve host permissions. Use the native plan agent, not dd:plan; concrete plans are automatically maintained in docs/plan/<task-slug>/README.md without a separate save request.
10
+
11
+ User arguments: $ARGUMENTS
12
+
13
+ ## Goal
14
+
15
+ Review task-relevant source, config, and documentation changes with dotdotgod impact evidence before broad verification, commits, pushes, publishing, or final handoff. OpenCode tracks observed edits per session; pending impact is advisory and never blocks tools.
16
+
17
+ ## Workflow
18
+
19
+ 1. Build the changed-file set from Git status. Preserve unrelated user work and exclude dependencies, caches, build output, secrets, and unrelated local memory.
20
+ 2. Call the shared MCP project_impact tool with up to twenty unique paths in first-seen order. Split larger sets into ordered batches of twenty. Inspect isError and structuredContent; only successful reviews of covered unchanged revisions clear pending state. Failures, cancellation and concurrent re-edits retain pending. When MCP is unavailable, follow README indexes, traceability, package metadata and focused search without claiming pending was cleared.
21
+ 3. Review the combined ranking and each seed's non-seed top results. Prioritize high-signal specs, tests, architecture, and source links, especially `implemented_by`, `verified_by`, and `related_doc` relationships.
22
+ 4. Resolve stale or contradictory related docs and tests that belong to the current task.
23
+ 5. Select focused tests, documentation validation, generated-resource checks, and package dry-runs from the evidence. For dotdotgod documentation changes, run `dotdotgod validate . --include-local-memory` and add `--check-index` when index freshness matters.
24
+ 6. Report the changed files reviewed, the strongest related findings and follow-up actions, and verification completed or skipped.
25
+
26
+ Keep raw impact payloads out of normal summaries. Optional hooks may remind agents about this workflow; default package resources leave full verification, index rebuilds, initialization, archive moves, and write blocking under explicit workflow control.
@@ -0,0 +1,38 @@
1
+ ---
2
+ description: Initialize project memory
3
+ ---
4
+
5
+ <!-- Generated from packages/shared resources by scripts/generate-adapters.mjs. Do not edit this file directly; edit the shared source and run `pnpm run generate`. -->
6
+
7
+ # Initialize project memory
8
+
9
+ Use the dotdotgod_context MCP server for project load, initialization, graph impact, execution and indexed retrieval. Discover its exact tool names in OpenCode Code Mode; inspect MCP isError and structuredContent and every execution results entry. For unknown output size use execute with a commands array and outputMode auto; search indexed.id with bounded source-scoped search. Run ancillary CLI checks through MCP execute rather than a duplicate native service. Keep direct read for short located source and images. Pending impact is advisory, never an execution gate. Preserve host permissions. Use the native plan agent, not dd:plan; concrete plans are automatically maintained in docs/plan/<task-slug>/README.md without a separate save request.
10
+
11
+ User arguments: $ARGUMENTS
12
+
13
+ ## Goal
14
+
15
+ Create a non-destructive dotdotgod baseline with canonical agent instructions, thin agent entrypoints, documentation indexes, a project config selected from an appropriate initialization template, and local-memory ignore rules.
16
+
17
+ ## Template Selection
18
+
19
+ 1. Inspect existing agent instructions, the root README, docs indexes, major top-level directories, config, and ignore rules.
20
+ 2. Discover custom templates as individual JSON files under `~/.dotdotgod/templates/`. Built-in templates are `software`, `research`, `case-and-evidence`, `publication`, `portfolio`, and `policy`.
21
+ 3. Choose from project evidence:
22
+ - `software`: application, library, or infrastructure projects organized around specs, architecture, source, and tests.
23
+ - `research`: research diaries, dated records, reports, artifacts, and evaluation evidence.
24
+ - `case-and-evidence`: canonical case records, evidence or legal grounds, and case outputs.
25
+ - `publication`: briefs, outlines, chapters, claims, manuscripts, and research sources.
26
+ - `portfolio`: strategy, positions, ledgers, journals, and market research.
27
+ - `policy`: policy sections, integrated proposals, evidence, and submission outputs.
28
+ 4. Consider custom templates by filename and config contents. A same-name custom template replaces the built-in template completely.
29
+ 5. Ask the user when multiple choices are plausible and materially change memory areas or traceability. With insufficient evidence, use `~/.dotdotgod/config.json` `defaultTemplate`, then `software`.
30
+ 6. Report the selected template and a concise reason.
31
+
32
+ ## Workflow
33
+
34
+ 1. Preserve existing files and unrelated user work.
35
+ 2. Call the shared MCP project_initialize tool with the selected template. Keep dryRun true initially; after explicit write approval call with dryRun false and confirmWrite true. Existing files are skipped, never replaced. Switch out of the native plan agent before initialization.
36
+ 3. Use bundled scripts only as an explicit fallback when MCP is unavailable. Custom templates require the CLI; do not silently substitute a bundled template.
37
+ 4. Validate the initialized project with `dotdotgod validate <project-root>` when available.
38
+ 5. Report created and skipped files, the selected template, validation failures, and unresolved instruction conflicts.
@@ -0,0 +1,28 @@
1
+ ---
2
+ description: Load project memory
3
+ ---
4
+
5
+ <!-- Generated from packages/shared resources by scripts/generate-adapters.mjs. Do not edit this file directly; edit the shared source and run `pnpm run generate`. -->
6
+
7
+ # Load project memory
8
+
9
+ Use the dotdotgod_context MCP server for project load, initialization, graph impact, execution and indexed retrieval. Discover its exact tool names in OpenCode Code Mode; inspect MCP isError and structuredContent and every execution results entry. For unknown output size use execute with a commands array and outputMode auto; search indexed.id with bounded source-scoped search. Run ancillary CLI checks through MCP execute rather than a duplicate native service. Keep direct read for short located source and images. Pending impact is advisory, never an execution gate. Preserve host permissions. Use the native plan agent, not dd:plan; concrete plans are automatically maintained in docs/plan/<task-slug>/README.md without a separate save request.
10
+
11
+ User arguments: $ARGUMENTS
12
+
13
+ ## Goal
14
+
15
+ Load the repository's dotdotgod project memory without modifying maintained files. Treat free-form arguments as query text, not mode switches.
16
+
17
+ ## Workflow
18
+
19
+ 1. Identify the repository root. Expose `Help: dotdotgod --help` as optional CLI discovery guidance without checking or reporting installation status, and do not require Help execution for Load to continue.
20
+ 2. When baseline context is missing, read `AGENTS.md`, the adapter entrypoint, `README.md`, and `docs/README.md` when present.
21
+ 3. Without arguments, call the shared MCP project_load tool with an empty focus and maxDepth 5. Its configured map owns documentation-root resolution, exclusions and boundary summaries.
22
+ 4. With arguments, call project_load with the arguments as focus, limit 30 and maxDepth 3. It returns the configured map plus documentation/code query results and retrieval warnings.
23
+ 5. If the CLI or shell execution is unavailable, preserve Load behavior by building the same tree from the configured documentation root when known, excluding local memory, and using README routing. At the depth boundary, list every direct Markdown file and immediate child directory, then summarize hidden descendants separately under each named child with exact recursive directory and Markdown-file counts.
24
+ 6. Query searches full documentation content and code outlines/comments, not implementation bodies. Preserve result kind, source ranges and retrieval warnings; verify source freshness before reading a symbol's implementation. Read bodies selectively from query results, explicit paths, and README indexes. Read relevant active plans only when needed, use `docs/archive/README.md` (or the configured archive `README.md` under an alternate documentation root) as the history map, and avoid broad generated, dependency, cache, or secret reads.
25
+
26
+ ## Output
27
+
28
+ Report the project purpose, key rules, relevant documentation routes, and only the active-plan or next-read hints needed for the request. Keep compact loads to a brief refresh.
package/index.js ADDED
@@ -0,0 +1 @@
1
+ export { default } from './src/index.mjs';