opencode-multidevice-sync 0.1.0

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 (107) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +15 -0
  3. package/README.md +111 -0
  4. package/README.ru.md +57 -0
  5. package/dist/cli/index.d.ts +3 -0
  6. package/dist/cli/index.d.ts.map +1 -0
  7. package/dist/cli/index.js +460 -0
  8. package/dist/cli/index.js.map +1 -0
  9. package/dist/cli/render.d.ts +45 -0
  10. package/dist/cli/render.d.ts.map +1 -0
  11. package/dist/cli/render.js +167 -0
  12. package/dist/cli/render.js.map +1 -0
  13. package/dist/cli/theme.d.ts +45 -0
  14. package/dist/cli/theme.d.ts.map +1 -0
  15. package/dist/cli/theme.js +88 -0
  16. package/dist/cli/theme.js.map +1 -0
  17. package/dist/core/backup.d.ts +13 -0
  18. package/dist/core/backup.d.ts.map +1 -0
  19. package/dist/core/backup.js +102 -0
  20. package/dist/core/backup.js.map +1 -0
  21. package/dist/core/fsx.d.ts +81 -0
  22. package/dist/core/fsx.d.ts.map +1 -0
  23. package/dist/core/fsx.js +353 -0
  24. package/dist/core/fsx.js.map +1 -0
  25. package/dist/core/git.d.ts +62 -0
  26. package/dist/core/git.d.ts.map +1 -0
  27. package/dist/core/git.js +162 -0
  28. package/dist/core/git.js.map +1 -0
  29. package/dist/core/guard.d.ts +5 -0
  30. package/dist/core/guard.d.ts.map +1 -0
  31. package/dist/core/guard.js +97 -0
  32. package/dist/core/guard.js.map +1 -0
  33. package/dist/core/health.d.ts +18 -0
  34. package/dist/core/health.d.ts.map +1 -0
  35. package/dist/core/health.js +88 -0
  36. package/dist/core/health.js.map +1 -0
  37. package/dist/core/host.d.ts +20 -0
  38. package/dist/core/host.d.ts.map +1 -0
  39. package/dist/core/host.js +50 -0
  40. package/dist/core/host.js.map +1 -0
  41. package/dist/core/index.d.ts +18 -0
  42. package/dist/core/index.d.ts.map +1 -0
  43. package/dist/core/index.js +18 -0
  44. package/dist/core/index.js.map +1 -0
  45. package/dist/core/jsonc.d.ts +20 -0
  46. package/dist/core/jsonc.d.ts.map +1 -0
  47. package/dist/core/jsonc.js +115 -0
  48. package/dist/core/jsonc.js.map +1 -0
  49. package/dist/core/lock.d.ts +14 -0
  50. package/dist/core/lock.d.ts.map +1 -0
  51. package/dist/core/lock.js +111 -0
  52. package/dist/core/lock.js.map +1 -0
  53. package/dist/core/overrides.d.ts +43 -0
  54. package/dist/core/overrides.d.ts.map +1 -0
  55. package/dist/core/overrides.js +169 -0
  56. package/dist/core/overrides.js.map +1 -0
  57. package/dist/core/paths.d.ts +36 -0
  58. package/dist/core/paths.d.ts.map +1 -0
  59. package/dist/core/paths.js +55 -0
  60. package/dist/core/paths.js.map +1 -0
  61. package/dist/core/preview.d.ts +3 -0
  62. package/dist/core/preview.d.ts.map +1 -0
  63. package/dist/core/preview.js +56 -0
  64. package/dist/core/preview.js.map +1 -0
  65. package/dist/core/repo.d.ts +57 -0
  66. package/dist/core/repo.d.ts.map +1 -0
  67. package/dist/core/repo.js +196 -0
  68. package/dist/core/repo.js.map +1 -0
  69. package/dist/core/reporter.d.ts +50 -0
  70. package/dist/core/reporter.d.ts.map +1 -0
  71. package/dist/core/reporter.js +63 -0
  72. package/dist/core/reporter.js.map +1 -0
  73. package/dist/core/sessions.d.ts +83 -0
  74. package/dist/core/sessions.d.ts.map +1 -0
  75. package/dist/core/sessions.js +508 -0
  76. package/dist/core/sessions.js.map +1 -0
  77. package/dist/core/settings.d.ts +68 -0
  78. package/dist/core/settings.d.ts.map +1 -0
  79. package/dist/core/settings.js +126 -0
  80. package/dist/core/settings.js.map +1 -0
  81. package/dist/core/setup.d.ts +48 -0
  82. package/dist/core/setup.d.ts.map +1 -0
  83. package/dist/core/setup.js +186 -0
  84. package/dist/core/setup.js.map +1 -0
  85. package/dist/core/sqlite.d.ts +37 -0
  86. package/dist/core/sqlite.d.ts.map +1 -0
  87. package/dist/core/sqlite.js +108 -0
  88. package/dist/core/sqlite.js.map +1 -0
  89. package/dist/core/stage.d.ts +44 -0
  90. package/dist/core/stage.d.ts.map +1 -0
  91. package/dist/core/stage.js +304 -0
  92. package/dist/core/stage.js.map +1 -0
  93. package/dist/core/sync.d.ts +52 -0
  94. package/dist/core/sync.d.ts.map +1 -0
  95. package/dist/core/sync.js +423 -0
  96. package/dist/core/sync.js.map +1 -0
  97. package/dist/plugin/index.d.ts +29 -0
  98. package/dist/plugin/index.d.ts.map +1 -0
  99. package/dist/plugin/index.js +88 -0
  100. package/dist/plugin/index.js.map +1 -0
  101. package/docs/MIGRATION.md +29 -0
  102. package/docs/ROADMAP.md +29 -0
  103. package/docs/SAFETY.md +31 -0
  104. package/examples/home-laptop.jsonc +31 -0
  105. package/examples/opencode-sync.overrides.jsonc +4 -0
  106. package/examples/work-laptop.jsonc +26 -0
  107. package/package.json +81 -0
package/docs/SAFETY.md ADDED
@@ -0,0 +1,31 @@
1
+ # Safety model and limits
2
+
3
+ ## Database boundaries
4
+
5
+ Live databases and journals stay local. Export reads a SQLite snapshot transaction and writes one canonical compressed JSON shard per selected session. Import validates supported tables, row ownership and columns. Existing projects are not replaced. Messages are inserted before parts, and a single transaction covers the import batch. Integrity is checked before COMMIT; a failure rolls back the transaction, not the database file underneath another process.
6
+
7
+ Before a non-empty import, `VACUUM INTO` creates a separate consistent snapshot by default. The snapshot is checked before it is accepted as a backup. Retention defaults to ten verified snapshots; failed backup creation blocks import. Backups can contain the entire private conversation history and must be protected like the original database.
8
+
9
+ Manual restore requires explicit offline confirmation, checks for OpenCode processes in the CLI, and refuses existing WAL/SHM/journal files. OS process checks are best-effort, so users must still ensure every database client is closed. No routine import replaces the live database file.
10
+
11
+ ## Conflicts
12
+
13
+ Local content baselines live beside the database in `.omds-bases.json`, outside Git. Hashes include session metadata and child rows. A two-sided change or an unknown divergent baseline blocks the batch. This is conflict detection, not a CRDT or an automatic conversation merge. Incoming snapshots that would silently drop existing child rows are refused.
14
+
15
+ ## Git and privacy
16
+
17
+ Only use trusted private repositories. Verification of sensitive GitHub sync uses `gh`. Local filesystem remotes are allowed for tests/development, not treated as cloud privacy guarantees. Local configuration backups are created before pull changes. Ordinary Git conflicts preserve a stash for manual recovery.
18
+
19
+ Credential-file sync is off by default. Known credential/runtime filenames and some inline JSON secrets are blocked on push. This is a heuristic, not comprehensive DLP: secrets in prose, tool output, arbitrary scripts, Git history or binary data may remain. No end-to-end encryption is implemented.
20
+
21
+ Synced plugins and skills can execute code. Anyone with write access to your sync repository is therefore trusted with your OpenCode environment. Do not add unknown collaborators or consume unreviewed sync repositories.
22
+
23
+ ## Preview and concurrency
24
+
25
+ Dry-run uses a disposable copy and does not update the original Git worktree or session DB. It can require significant temporary disk space. `extraPaths` previews are deliberately refused.
26
+
27
+ The lock coordinates processes on one computer only. Use one active device. Git rejects conflicting branch updates, but there is no distributed ownership lease or safe simultaneous editing guarantee. Auto-push waits for startup pull and reports errors; it is not a background system service and cannot finish after the application is terminated.
28
+
29
+ ## Compatibility
30
+
31
+ The initial target is OpenCode 1.18.30 on Windows with Node 22.13+ or 24. Node and OS combinations covered by CI are listed in the workflow. Real Desktop behavior and new OpenCode schemas require separate acceptance testing. Passing tests is not a guarantee against every form of data loss.
@@ -0,0 +1,31 @@
1
+ {
2
+ "repo": {
3
+ "owner": "YOUR_GITHUB_ACCOUNT",
4
+ "name": "my-opencode-config",
5
+ "branch": "main"
6
+ },
7
+ "machineAlias": "home-laptop",
8
+ "includeCredentials": false,
9
+ "includeSkills": true,
10
+ "includeState": false,
11
+ "extraPaths": [],
12
+ "sessions": {
13
+ "enabled": true,
14
+ "days": 30,
15
+ "maxSessions": 50,
16
+ "maxSessionBytes": 5242880,
17
+ "include": [],
18
+ "exclude": [],
19
+ "directories": [],
20
+ "backupBeforeImport": true,
21
+ "backupRetention": 10,
22
+ "pathMappings": [
23
+ {
24
+ "from": "C:/Projects",
25
+ "to": "D:/Projects"
26
+ }
27
+ ]
28
+ },
29
+ "autoPullOnStartup": true,
30
+ "autoPushOnIdle": false
31
+ }
@@ -0,0 +1,4 @@
1
+ // Machine-local only. Never commit to your sync repository.
2
+ {
3
+ "instructions": ["C:/Users/YOU/.config/opencode/AGENTS.md"]
4
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "repo": {
3
+ "owner": "YOUR_GITHUB_ACCOUNT",
4
+ "name": "my-opencode-config",
5
+ "branch": "main"
6
+ },
7
+ "machineAlias": "work-laptop",
8
+ "includeCredentials": false,
9
+ "includeSkills": true,
10
+ "includeState": false,
11
+ "extraPaths": [],
12
+ "sessions": {
13
+ "enabled": true,
14
+ "days": 30,
15
+ "maxSessions": 50,
16
+ "maxSessionBytes": 5242880,
17
+ "include": [],
18
+ "exclude": [],
19
+ "directories": [],
20
+ "backupBeforeImport": true,
21
+ "backupRetention": 10,
22
+ "pathMappings": []
23
+ },
24
+ "autoPullOnStartup": true,
25
+ "autoPushOnIdle": false
26
+ }
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "opencode-multidevice-sync",
3
+ "version": "0.1.0",
4
+ "description": "Reliable multi-device synchronization for OpenCode configuration, sessions, skills and plugins with safety checks, backups and recovery.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "logser13 and contributors",
8
+ "homepage": "https://github.com/logser13/opencode-multidevice-sync#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/logser13/opencode-multidevice-sync.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/logser13/opencode-multidevice-sync/issues"
15
+ },
16
+ "keywords": [
17
+ "opencode",
18
+ "opencode-plugin",
19
+ "sync",
20
+ "multi-device",
21
+ "session-sync",
22
+ "config-sync",
23
+ "backup",
24
+ "sqlite",
25
+ "github",
26
+ "cli"
27
+ ],
28
+ "engines": {
29
+ "node": ">=22.13.0"
30
+ },
31
+ "main": "./dist/plugin/index.js",
32
+ "types": "./dist/plugin/index.d.ts",
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/plugin/index.d.ts",
36
+ "default": "./dist/plugin/index.js"
37
+ },
38
+ "./core": {
39
+ "types": "./dist/core/index.d.ts",
40
+ "default": "./dist/core/index.js"
41
+ },
42
+ "./package.json": "./package.json"
43
+ },
44
+ "bin": {
45
+ "opencode-multidevice-sync": "./dist/cli/index.js",
46
+ "omds": "./dist/cli/index.js"
47
+ },
48
+ "files": [
49
+ "dist",
50
+ "README.md",
51
+ "README.ru.md",
52
+ "LICENSE",
53
+ "NOTICE",
54
+ "docs/*.md",
55
+ "examples/*.jsonc"
56
+ ],
57
+ "scripts": {
58
+ "build": "tsc -p tsconfig.build.json",
59
+ "dev": "tsc -p tsconfig.build.json --watch",
60
+ "test": "vitest run",
61
+ "test:watch": "vitest",
62
+ "lint": "biome check src tests",
63
+ "lint:fix": "biome check --write src tests",
64
+ "typecheck": "tsc --noEmit",
65
+ "check": "npm run lint && npm run typecheck && npm run build && npm run test",
66
+ "prepublishOnly": "npm run check && npm run build",
67
+ "test:regressions": "vitest run tests/regressions.test.ts",
68
+ "pack:check": "npm pack --dry-run",
69
+ "prepack": "npm run build"
70
+ },
71
+ "devDependencies": {
72
+ "@biomejs/biome": "^1.9.4",
73
+ "@types/node": "^22.10.2",
74
+ "typescript": "^5.7.2",
75
+ "vitest": "^4.1.11",
76
+ "vite": "^6.4.3"
77
+ },
78
+ "dependencies": {
79
+ "@opencode-ai/plugin": "1.18.30"
80
+ }
81
+ }