@triedotdev/mcp 1.0.149 → 1.0.151

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 (104) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +116 -30
  3. package/dist/{autonomy-config-ZCOSTMPD.js → autonomy-config-3APNC6QF.js} +3 -3
  4. package/dist/{chat-store-OJLJCJFI.js → chat-store-HMTDL7I2.js} +3 -3
  5. package/dist/{chunk-LD7ZEFNY.js → chunk-3KZBC3RJ.js} +2 -2
  6. package/dist/{chunk-SH7H3WRU.js → chunk-4TQQP7JD.js} +3 -3
  7. package/dist/{chunk-SH7H3WRU.js.map → chunk-4TQQP7JD.js.map} +1 -1
  8. package/dist/{chunk-GAL7OIYU.js → chunk-4UDBGYI3.js} +15 -15
  9. package/dist/{chunk-72KSLD7A.js → chunk-74R4XSFB.js} +5 -5
  10. package/dist/{chunk-ZDDE442Q.js → chunk-7HYOJ4Q7.js} +8 -8
  11. package/dist/{chunk-ZDDE442Q.js.map → chunk-7HYOJ4Q7.js.map} +1 -1
  12. package/dist/{chunk-OTQEFXHU.js → chunk-ABY2R7OK.js} +2 -2
  13. package/dist/{chunk-QH77RQB3.js → chunk-ED7PLRQA.js} +5 -6
  14. package/dist/chunk-ED7PLRQA.js.map +1 -0
  15. package/dist/{chunk-23RJT5WT.js → chunk-F7BMFOZ6.js} +2 -2
  16. package/dist/{chunk-53KUI7RQ.js → chunk-G7Q23IGF.js} +35 -10
  17. package/dist/{chunk-53KUI7RQ.js.map → chunk-G7Q23IGF.js.map} +1 -1
  18. package/dist/{chunk-CU5VDH6F.js → chunk-GLY76TSI.js} +2 -2
  19. package/dist/{chunk-B2AHQ2IR.js → chunk-IFBEAOHH.js} +12 -12
  20. package/dist/{chunk-ILGMFND2.js → chunk-JIS2OCZR.js} +4 -4
  21. package/dist/{chunk-FG467PDD.js → chunk-LNUMECBJ.js} +2 -2
  22. package/dist/{chunk-FPEMP54L.js → chunk-OJXFQRUE.js} +2 -2
  23. package/dist/{chunk-5KJ4UJOY.js → chunk-QQG42HCI.js} +2 -2
  24. package/dist/{chunk-7OJ6JIPL.js → chunk-REHKDCI6.js} +7 -150
  25. package/dist/chunk-REHKDCI6.js.map +1 -0
  26. package/dist/{chunk-HYNDXZAU.js → chunk-SU3WCAC4.js} +103 -75
  27. package/dist/chunk-SU3WCAC4.js.map +1 -0
  28. package/dist/{chunk-4C67GV3O.js → chunk-TCNCNWGV.js} +2 -2
  29. package/dist/{chunk-NKHO34UZ.js → chunk-TU7D5DEW.js} +2 -2
  30. package/dist/{chunk-ZUEAHFSY.js → chunk-TWPX6PHF.js} +313 -61
  31. package/dist/chunk-TWPX6PHF.js.map +1 -0
  32. package/dist/{chunk-FH335WL5.js → chunk-TWQPOVRA.js} +2 -2
  33. package/dist/{chunk-YOJGSRZK.js → chunk-V3O7C2LY.js} +2 -2
  34. package/dist/{chunk-V7AY2EJO.js → chunk-WOTLY5NA.js} +2 -2
  35. package/dist/cli/create-agent.js +8 -40
  36. package/dist/cli/create-agent.js.map +1 -1
  37. package/dist/cli/main.js +55 -93
  38. package/dist/cli/main.js.map +1 -1
  39. package/dist/cli/yolo-daemon.js +20 -20
  40. package/dist/{client-INNE2GGZ.js → client-5L64D5SQ.js} +3 -3
  41. package/dist/{codebase-index-FMIULFZQ.js → codebase-index-OOE7OAHP.js} +3 -3
  42. package/dist/{fast-analyzer-CTT3MCPE.js → fast-analyzer-FMU3X4AZ.js} +5 -5
  43. package/dist/github-ingester-C66ZRUYC.js +11 -0
  44. package/dist/{goal-manager-IGUMDGCA.js → goal-manager-VTBFFYN4.js} +7 -7
  45. package/dist/{goal-validator-DV6DRSGF.js → goal-validator-EM5XVWVC.js} +6 -6
  46. package/dist/{graph-J4OGTYCO.js → graph-26JPZ3DF.js} +3 -3
  47. package/dist/{hypothesis-O72ZLVOW.js → hypothesis-4UPE7KXU.js} +7 -7
  48. package/dist/{incident-index-BWW2UEY7.js → incident-index-H6APJ4S3.js} +3 -3
  49. package/dist/index.js +118 -313
  50. package/dist/index.js.map +1 -1
  51. package/dist/{insight-store-Q62UGMTF.js → insight-store-QEEUQR5L.js} +3 -3
  52. package/dist/{issue-store-4FPABLC6.js → issue-store-C6XYENE5.js} +4 -4
  53. package/dist/{ledger-43SIVE7X.js → ledger-VNA4DX3Z.js} +13 -5
  54. package/dist/linear-ingester-WIUBWF55.js +11 -0
  55. package/dist/{tiered-storage-VZL7KK64.js → tiered-storage-P6Z3NV2Q.js} +3 -3
  56. package/dist/trie-agent-GJJJCL6P.js +27 -0
  57. package/package.json +4 -6
  58. package/dist/chunk-7OJ6JIPL.js.map +0 -1
  59. package/dist/chunk-G76DYVGX.js +0 -136
  60. package/dist/chunk-G76DYVGX.js.map +0 -1
  61. package/dist/chunk-HYNDXZAU.js.map +0 -1
  62. package/dist/chunk-QH77RQB3.js.map +0 -1
  63. package/dist/chunk-ZUEAHFSY.js.map +0 -1
  64. package/dist/comprehension-46F7ZNKL.js +0 -821
  65. package/dist/comprehension-46F7ZNKL.js.map +0 -1
  66. package/dist/github-ingester-J2ZFYXVE.js +0 -11
  67. package/dist/linear-ingester-JRDQAIAA.js +0 -11
  68. package/dist/trie-agent-ET3DAP5Y.js +0 -27
  69. package/dist/workers/agent-worker.d.ts +0 -2
  70. package/dist/workers/agent-worker.js +0 -28
  71. package/dist/workers/agent-worker.js.map +0 -1
  72. /package/dist/{autonomy-config-ZCOSTMPD.js.map → autonomy-config-3APNC6QF.js.map} +0 -0
  73. /package/dist/{chat-store-OJLJCJFI.js.map → chat-store-HMTDL7I2.js.map} +0 -0
  74. /package/dist/{chunk-LD7ZEFNY.js.map → chunk-3KZBC3RJ.js.map} +0 -0
  75. /package/dist/{chunk-GAL7OIYU.js.map → chunk-4UDBGYI3.js.map} +0 -0
  76. /package/dist/{chunk-72KSLD7A.js.map → chunk-74R4XSFB.js.map} +0 -0
  77. /package/dist/{chunk-OTQEFXHU.js.map → chunk-ABY2R7OK.js.map} +0 -0
  78. /package/dist/{chunk-23RJT5WT.js.map → chunk-F7BMFOZ6.js.map} +0 -0
  79. /package/dist/{chunk-CU5VDH6F.js.map → chunk-GLY76TSI.js.map} +0 -0
  80. /package/dist/{chunk-B2AHQ2IR.js.map → chunk-IFBEAOHH.js.map} +0 -0
  81. /package/dist/{chunk-ILGMFND2.js.map → chunk-JIS2OCZR.js.map} +0 -0
  82. /package/dist/{chunk-FG467PDD.js.map → chunk-LNUMECBJ.js.map} +0 -0
  83. /package/dist/{chunk-FPEMP54L.js.map → chunk-OJXFQRUE.js.map} +0 -0
  84. /package/dist/{chunk-5KJ4UJOY.js.map → chunk-QQG42HCI.js.map} +0 -0
  85. /package/dist/{chunk-4C67GV3O.js.map → chunk-TCNCNWGV.js.map} +0 -0
  86. /package/dist/{chunk-NKHO34UZ.js.map → chunk-TU7D5DEW.js.map} +0 -0
  87. /package/dist/{chunk-FH335WL5.js.map → chunk-TWQPOVRA.js.map} +0 -0
  88. /package/dist/{chunk-YOJGSRZK.js.map → chunk-V3O7C2LY.js.map} +0 -0
  89. /package/dist/{chunk-V7AY2EJO.js.map → chunk-WOTLY5NA.js.map} +0 -0
  90. /package/dist/{client-INNE2GGZ.js.map → client-5L64D5SQ.js.map} +0 -0
  91. /package/dist/{codebase-index-FMIULFZQ.js.map → codebase-index-OOE7OAHP.js.map} +0 -0
  92. /package/dist/{fast-analyzer-CTT3MCPE.js.map → fast-analyzer-FMU3X4AZ.js.map} +0 -0
  93. /package/dist/{github-ingester-J2ZFYXVE.js.map → github-ingester-C66ZRUYC.js.map} +0 -0
  94. /package/dist/{goal-manager-IGUMDGCA.js.map → goal-manager-VTBFFYN4.js.map} +0 -0
  95. /package/dist/{goal-validator-DV6DRSGF.js.map → goal-validator-EM5XVWVC.js.map} +0 -0
  96. /package/dist/{graph-J4OGTYCO.js.map → graph-26JPZ3DF.js.map} +0 -0
  97. /package/dist/{hypothesis-O72ZLVOW.js.map → hypothesis-4UPE7KXU.js.map} +0 -0
  98. /package/dist/{incident-index-BWW2UEY7.js.map → incident-index-H6APJ4S3.js.map} +0 -0
  99. /package/dist/{insight-store-Q62UGMTF.js.map → insight-store-QEEUQR5L.js.map} +0 -0
  100. /package/dist/{issue-store-4FPABLC6.js.map → issue-store-C6XYENE5.js.map} +0 -0
  101. /package/dist/{ledger-43SIVE7X.js.map → ledger-VNA4DX3Z.js.map} +0 -0
  102. /package/dist/{linear-ingester-JRDQAIAA.js.map → linear-ingester-WIUBWF55.js.map} +0 -0
  103. /package/dist/{tiered-storage-VZL7KK64.js.map → tiered-storage-P6Z3NV2Q.js.map} +0 -0
  104. /package/dist/{trie-agent-ET3DAP5Y.js.map → trie-agent-GJJJCL6P.js.map} +0 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Trie Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,48 +1,59 @@
1
- # Trie: A trainable AI agent with cryptographic governance and portable context
1
+ # Trie: A trainable AI agent with a cryptographic governance ledger and portable context
2
2
 
3
3
 
4
- **The ledger that keeps your work compliant when agents and humans ship together.**
4
+ **The ledger that keeps agents and humans aligned when shipping together.**
5
5
 
6
6
  [![Download Workspace](https://img.shields.io/badge/Download-Trie%20Workspace-blue)](https://www.trie.dev) [![Follow on X](https://img.shields.io/badge/Follow-@louiskishfy-1DA1F2?logo=x)](https://x.com/louiskishfy)
7
7
 
8
8
  ## What Trie Does
9
9
 
10
- Trie is governance for teams where agents and humans ship together. Every decision, direction change, and tradeoff gets recorded in a cryptographic ledger that every contributor—human or agent—reads from and writes to, across every tool in the stack.
10
+ Trie is governance for teams where agents and humans ship together. Every decision, direction change, and tradeoff gets recorded in a governance ledger that every contributor—human or agent—reads from and writes to, across every tool in the stack.
11
11
 
12
12
  - **Autonomous Operation**: Run `trie watch` and the agent monitors your codebase 24/7
13
13
  - **Intelligent Extraction**: Automatically extracts decisions, facts, blockers from every change
14
- - **Cryptographic governance ledger**: Tamper-evident, append-only chain of blocks—the shared memory that travels from Cursor/Claude Code → CLI → CI/CD
14
+ - **Governance ledger**: Tamper-evident chain with digital signatures—the shared memory that travels from Cursor/Claude Code → CLI → CI/CD
15
15
  - **Predictive Intelligence**: `trie gotcha` queries the ledger to predict problems before they happen
16
16
  - **Continuous Learning**: Feed it incidents with `trie tell`, teach it patterns with your history
17
17
 
18
18
  The work stays coherent not because someone held it together, but because the ledger did. When any contributor flags a direction change, the ledger surfaces the relevant history instantly. When an agent acts, it does so with full context of what was decided before and why.
19
19
 
20
- ### The Context-Across-Tools Problem
20
+ ### The Agent Coordination Problem
21
21
 
22
- **The problem**: When work happens across Cursor, Claude Code, VS Code, the terminal, and more, context fragments. An agent makes a decision in one tool; a human forgets it in another. Accountability and context diffuse across tools, models, and people until they belong to no one.
22
+ **The problem**: When agents and humans ship code together across Cursor, Claude Code, VS Code, and CI/CD, who's accountable for what? An agent makes a decision in one tool; a human modifies it in another; a second agent undoes both. Without a shared record, coordination becomes chaos.
23
23
 
24
- **The solution**: Trie stores every decision, incident, fix, and tradeoff in a cryptographic governance ledger—a tamper-evident, append-only chain of blocks that lives in your `.trie/` folder and syncs across your team. Every tool reads from the same source of truth. The ledger surfaces the relevant history instantly in each contributor's native tool. No more context loss. No more conflicting memories.
24
+ **The solution**: Trie's governance ledger provides a shared source of truth that both agents and humans can trust. Every decision, every incident, every fix gets recorded with cryptographic signatures proving who (or what) made each change. When an agent queries the ledger, it gets the full context. When you review changes, you see the reasoning. When something breaks, the ledger shows you exactly what led there.
25
25
 
26
- ## Why It Matters
26
+ Think of it as **double-entry bookkeeping for code decisions**—not blockchain-level immutability, but tamper-evident accountability that works with Git and your existing workflow.
27
27
 
28
- Code is solved. The bottleneck isn't building—it's deciding what to build and whether the change aligns with how you got here.
28
+ ## Why It Matters for Agent Collaboration
29
29
 
30
- When agents and non-technical contributors can ship production changes, coordination tools built to manage engineering capacity break down. Linear tells you what's in the queue. GitHub tells you what changed. Neither tells you whether the change aligns with the decisions that came before.
30
+ When agents can ship production changes, you need governance that works for both humans and AI:
31
31
 
32
- Every bug you fix teaches the ledger a pattern that protects all your projects. Every incident you report becomes institutional knowledge that travels with your code. Every decision you make—and the tradeoffs you considered—gets extracted and stored automatically.
32
+ **Traditional tools fall short:**
33
+ - Linear tracks tasks, not decisions or reasoning
34
+ - GitHub shows changes, not why they were made
35
+ - Slack/Discord: context vanishes in chat history
36
+ - No tool tells you if an agent's change conflicts with yesterday's decision
33
37
 
34
- The result: faster development with fewer production fires, because the ledger gets smarter every time something breaks—and every agent and human on the team benefits.
38
+ **Trie's ledger provides:**
39
+ - **Tamper-evident history**: Ed25519 signatures detect if entries are modified
40
+ - **Automatic recording**: Agents and humans write to the same ledger
41
+ - **Cross-tool context**: Works in Cursor, CLI, CI/CD, MCP servers
42
+ - **Accountability**: See who (human or agent) made each decision and when
43
+ - **Pattern learning**: Every incident makes the system smarter
44
+
45
+ The ledger ensures nothing is lost. When an agent queries it, answers come with full provenance. When you review changes, you see the reasoning trail. When something breaks, the audit trail is already there.
35
46
 
36
47
  ### How the Agent Works
37
48
 
38
49
  1. **`trie watch`** - Start the agent, it monitors your codebase autonomously
39
50
  2. **Agent Extracts** - Every file change → extract decisions, facts, blockers
40
- 3. **Agent Stores** - Builds decision ledger with rich metadata and tag expansion
51
+ 3. **Agent Stores** - Builds decision ledger with signatures and metadata
41
52
  4. **`trie gotcha`** - Agent queries ledger to predict problems in your current changes
42
53
  5. **`trie tell`** - Feed agent incidents to improve its predictions
43
54
  6. **Agent Learns** - Gets better at predicting what matters in YOUR codebase
44
55
 
45
- Your decisions persist across tools. Your edge cases don't get forgotten. The ledger keeps agents and humans compliant—so you ship the right thing every time.
56
+ Your decisions persist across tools. Your edge cases don't get forgotten. The ledger keeps agents and humans aligned—so you ship the right thing every time.
46
57
 
47
58
  ## Quick Start
48
59
 
@@ -91,13 +102,22 @@ Tools like Cursor Bugbot flag issues—but flagging doesn't help you avoid simil
91
102
 
92
103
  ## Key Features
93
104
 
105
+ ### Built for Agent + Human Collaboration
106
+
107
+ - **Shared governance ledger** - Single source of truth that agents and humans both read from and write to
108
+ - **Digital signatures** - Ed25519 signatures prove who (human or agent) created each entry, automatic and zero-config
109
+ - **Accountability trail** - See exactly what decisions agents made and when, verify authenticity
110
+ - **Cross-tool context** - Works in Cursor, Claude Code, CLI, CI/CD—same ledger everywhere
111
+ - **Tamper detection** - Signatures and Git history make modifications visible
112
+ - **No coordination needed** - Agents and humans write concurrently; Git handles conflicts
113
+
94
114
  ### Governance That Scales
95
115
 
96
- - **Cryptographic ledger** - Tamper-evident, append-only chain of blocks; every tool reads from the same source of truth
97
- - **True immutability** - Ledger entries never deleted, only marked as corrected; full audit trail for compliance
98
- - **Decision memory** - Captures architectural choices, tradeoffs, and context across Cursor, Claude, VS Code, CLI, and CI/CD
99
- - **Judgment artifacts** - Not just what shipped, but why, what was considered, and who decided
100
- - **Git-based storage** - Your project's memory travels with your code in `.trie/` folder
116
+ - **Tamper-evident ledger** - Append-only chain with cryptographic signatures (not blockchain, think double-entry bookkeeping)
117
+ - **Correction pattern** - Entries never deleted, only marked as corrected with full audit trail
118
+ - **Decision memory** - Captures architectural choices, tradeoffs, and context across all tools
119
+ - **Judgment artifacts** - Not just what shipped, but why, what was considered, and who (or what) decided
120
+ - **Git integration** - Auto-commits ledger changes; distributed backup via Git history
101
121
 
102
122
  ### Intelligence That Compounds
103
123
 
@@ -109,7 +129,7 @@ Tools like Cursor Bugbot flag issues—but flagging doesn't help you avoid simil
109
129
 
110
130
  ### Integration Built for Speed
111
131
 
112
- - **Multiple interfaces** - CLI, MCP tools for Claude/Cursor, visual dashboards, Slack notifications
132
+ - **Multiple interfaces** - CLI, MCP tools for Claude/Cursor, visual dashboards
113
133
  - **Git hooks** - Automatic checks before commits and pushes
114
134
  - **Watch mode** - Real-time monitoring while you code
115
135
  - **Fast performance** - Sub-500ms checks, won't slow down your workflow
@@ -161,7 +181,6 @@ your-project/
161
181
  ├── src/
162
182
  └── .git/
163
183
  ```
164
- Different machines
165
184
 
166
185
  ### Decision Memory Across Tools
167
186
 
@@ -796,8 +815,6 @@ trie ledger corrections --entries <entry-id1> <entry-id2>
796
815
  - Learn from false positives to improve detection
797
816
  - Track correction rates over time
798
817
 
799
- See [docs/LEDGER_CORRECTIONS.md](./docs/LEDGER_CORRECTIONS.md) for detailed usage.
800
-
801
818
  ## CI/CD Integration
802
819
 
803
820
  ### GitHub Actions
@@ -826,16 +843,40 @@ Trie maintains two complementary memory systems that work together:
826
843
  ### 1. Governance Ledger (Primary Product)
827
844
 
828
845
  **Location:** `.trie/memory/ledger.json`
829
- **Purpose:** Cryptographic, tamper-evident record of what was detected and when
830
- **Architecture:** Append-only chain of blocks with merkle roots
846
+ **Purpose:** Tamper-evident record of decisions, incidents, and fixes
847
+ **Architecture:** Append-only chain of blocks with Ed25519 signatures
831
848
 
832
- This is the **core governance layer** - the immutable audit trail that:
849
+ This is the **core governance layer** that:
833
850
  - Powers `trie gotcha` predictions
834
- - Provides compliance and trust
851
+ - Provides accountability for agent and human decisions
852
+ - Uses digital signatures to detect tampering
835
853
  - Never deleted, only corrected (see [Ledger Corrections](./docs/LEDGER_CORRECTIONS.md))
836
- - Syncs across team via `.trie-shared/`
854
+ - Auto-commits to Git for distributed backup
855
+
856
+ **How it works:**
857
+ - Every entry gets signed with Ed25519 (automatic, zero config)
858
+ - Signatures prove who created each entry and detect modifications
859
+ - Git integration provides distributed backup and history
860
+ - Think: **double-entry bookkeeping**, not blockchain
861
+
862
+ **Security model:**
863
+ - ✅ **Tamper-evident**: Signatures detect if entries are modified
864
+ - ✅ **Accountability**: See who (human or agent) made each decision
865
+ - ✅ **Git backup**: Distributed history via automatic commits
866
+ - ✅ **Verification**: `trie ledger verify` checks integrity
867
+ - ⚠️ **Not encrypted**: Ledger is plaintext (can add encryption if needed)
868
+ - ⚠️ **Not access-controlled**: Standard file permissions apply
869
+ - ⚠️ **Not deletion-proof**: Can still `rm .trie/` (but Git history remains)
837
870
 
838
- The ledger is what makes Trie's governance verifiable and trustworthy. It's the permanent record.
871
+ **Real protection comes from:** Git history + Team workflow + PR reviews
872
+
873
+ Perfect for agent collaboration because:
874
+ - Agents can trust ledger contents (signatures verify authenticity)
875
+ - Humans can audit agent decisions (full provenance trail)
876
+ - Cross-tool context works (same ledger in Cursor, CLI, CI/CD)
877
+ - Conflicts are visible (Git shows competing changes)
878
+
879
+ Learn more: [Signatures & Git Integration](./docs/SIGNATURES_AND_GIT.md)
839
880
 
840
881
  ### 2. Issue Memory (Query Cache)
841
882
 
@@ -897,6 +938,51 @@ trie goal list
897
938
  ### Getting Help
898
939
  - Issues: [Report bugs and request features](https://x.com/louiskishfy)
899
940
 
941
+ ## Contributing
942
+
943
+ We welcome contributions from the community! Whether you're fixing bugs, adding features, improving documentation, or sharing feedback, your contributions help make Trie better for everyone.
944
+
945
+ ### Quick Start for Contributors
946
+
947
+ 1. **Fork and clone** the repository
948
+ 2. **Install dependencies**: `npm install`
949
+ 3. **Set up environment**: Copy `.env.example` to `.env.local` and add your API keys
950
+ 4. **Build the project**: `npm run build`
951
+ 5. **Run tests**: `npm test`
952
+
953
+ ### Before Submitting
954
+
955
+ - Ensure all tests pass (`npm test`)
956
+ - Run type checking (`npm run typecheck`)
957
+ - Follow our code style (`npm run lint`)
958
+ - Update documentation for new features
959
+ - Never commit secrets or API keys
960
+
961
+ **Read our full [Contributing Guide](CONTRIBUTING.md) for detailed guidelines.**
962
+
963
+ ### Ways to Contribute
964
+
965
+ - 🐛 **Report bugs** - Open an issue with reproduction steps
966
+ - 💡 **Suggest features** - Share ideas for improvements
967
+ - 📝 **Improve docs** - Fix typos, add examples, clarify instructions
968
+ - 🔧 **Submit PRs** - Fix bugs or implement features
969
+ - 🧪 **Add tests** - Improve test coverage
970
+ - 🔐 **Security** - Report vulnerabilities privately (see [SECURITY.md](SECURITY.md))
971
+
972
+ ### Code of Conduct
973
+
974
+ Be respectful, inclusive, and professional. We're building this together.
975
+
976
+ ## Security
977
+
978
+ Please report security vulnerabilities privately. See [SECURITY.md](SECURITY.md) for details.
979
+
980
+ **Never commit:**
981
+ - API keys or secrets
982
+ - `.env.local` or `.env` files
983
+ - Private signing keys (`.trie/keys/`)
984
+ - Personal configuration
985
+
900
986
  ## License
901
987
 
902
- MIT License
988
+ MIT License - See [LICENSE](LICENSE) for details.
@@ -10,8 +10,8 @@ import {
10
10
  shouldAutoFix,
11
11
  shouldBlockPush,
12
12
  trackIssueOccurrence
13
- } from "./chunk-5KJ4UJOY.js";
14
- import "./chunk-SH7H3WRU.js";
13
+ } from "./chunk-QQG42HCI.js";
14
+ import "./chunk-4TQQP7JD.js";
15
15
  import "./chunk-APMV77PU.js";
16
16
  import "./chunk-DGUM43GV.js";
17
17
  export {
@@ -27,4 +27,4 @@ export {
27
27
  shouldBlockPush,
28
28
  trackIssueOccurrence
29
29
  };
30
- //# sourceMappingURL=autonomy-config-ZCOSTMPD.js.map
30
+ //# sourceMappingURL=autonomy-config-3APNC6QF.js.map
@@ -2,9 +2,9 @@ import {
2
2
  ChatStore,
3
3
  clearChatStores,
4
4
  getChatStore
5
- } from "./chunk-23RJT5WT.js";
5
+ } from "./chunk-F7BMFOZ6.js";
6
6
  import "./chunk-43X6JBEM.js";
7
- import "./chunk-SH7H3WRU.js";
7
+ import "./chunk-4TQQP7JD.js";
8
8
  import "./chunk-APMV77PU.js";
9
9
  import "./chunk-DGUM43GV.js";
10
10
  export {
@@ -12,4 +12,4 @@ export {
12
12
  clearChatStores,
13
13
  getChatStore
14
14
  };
15
- //# sourceMappingURL=chat-store-OJLJCJFI.js.map
15
+ //# sourceMappingURL=chat-store-HMTDL7I2.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  loadConfig
3
- } from "./chunk-NKHO34UZ.js";
3
+ } from "./chunk-TU7D5DEW.js";
4
4
 
5
5
  // src/ingest/linear-ingester.ts
6
6
  import path from "path";
@@ -129,4 +129,4 @@ var LinearIngester = class {
129
129
  export {
130
130
  LinearIngester
131
131
  };
132
- //# sourceMappingURL=chunk-LD7ZEFNY.js.map
132
+ //# sourceMappingURL=chunk-3KZBC3RJ.js.map
@@ -176,8 +176,8 @@ function getWorkingDirectory(explicitDir, silent = false) {
176
176
  console.error(" Or set DEBUG_TRIE_WORKSPACE=1 to debug workspace detection");
177
177
  console.error(` Current working directory: ${cwd}`);
178
178
  console.error(" Examples:");
179
- console.error(' Use trie_security with directory: "/path/to/your/project"');
180
- console.error(' Use trie_scan with directory: "./your-project"');
179
+ console.error(' Use trie_fix with directory: "/path/to/your/project"');
180
+ console.error(' Use trie watch with directory: "./your-project"');
181
181
  }
182
182
  return cwd;
183
183
  }
@@ -186,4 +186,4 @@ export {
186
186
  getTrieDirectory,
187
187
  getWorkingDirectory
188
188
  };
189
- //# sourceMappingURL=chunk-SH7H3WRU.js.map
189
+ //# sourceMappingURL=chunk-4TQQP7JD.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/workspace.ts"],"sourcesContent":["/**\n * Workspace detection utilities\n * \n * MCP servers run as separate processes where process.cwd() may not be\n * the user's workspace. These utilities detect the actual project root\n * by looking for common project indicators.\n */\n\nimport { execSync } from 'node:child_process';\nimport { existsSync, readFileSync } from 'fs';\nimport { basename, dirname, join, resolve } from 'path';\nimport { isInteractiveMode } from './progress.js';\n\n// Project root indicators - files/directories that indicate a project root\n// Ordered by strength: primary indicators first\nconst PROJECT_ROOT_INDICATORS = [\n 'package.json', // Node.js/npm projects\n '.git', // Git repository root\n 'Cargo.toml', // Rust projects\n 'go.mod', // Go modules\n 'pyproject.toml', // Python projects (modern)\n 'pom.xml', // Maven (Java)\n 'build.gradle', // Gradle (Java/Kotlin)\n 'deno.json', // Deno projects\n // Note: .trie/config.json would be a better indicator, but empty .trie dirs exist\n // tsconfig.json is secondary as it can exist in subdirectories\n];\n\n// Directories that indicate we're in an npm package, not a user workspace\nconst NPM_PACKAGE_INDICATORS = [\n 'node_modules/@', // Scoped packages\n 'node_modules/', // Regular packages\n '.npm/', // npm cache\n '.nvm/', // nvm\n 'lib/node_modules/', // Global npm\n];\n\nfunction getGitCommonDir(startDir: string): string | null {\n try {\n const output = execSync('git rev-parse --git-common-dir', {\n cwd: startDir,\n stdio: ['ignore', 'pipe', 'ignore'],\n })\n .toString()\n .trim();\n if (!output) return null;\n return resolve(startDir, output);\n } catch {\n return null;\n }\n}\n\nfunction getSharedWorktreeRoot(startDir: string): string | null {\n const commonDir = getGitCommonDir(startDir);\n if (!commonDir) return null;\n if (basename(commonDir) !== '.git') return null;\n return dirname(commonDir);\n}\n\nexport function getTrieDirectory(workDir: string): string {\n const mode = process.env.TRIE_WORKTREE_MODE?.toLowerCase();\n if (mode === 'isolated') {\n return join(workDir, '.trie');\n }\n const sharedRoot = getSharedWorktreeRoot(workDir);\n if (sharedRoot) {\n return join(sharedRoot, '.trie');\n }\n return join(workDir, '.trie');\n}\n\n/**\n * Find the nearest project root by walking up from a starting directory\n * Returns the directory containing a project root indicator, or null if none found\n */\nexport function findProjectRoot(startDir: string, maxLevels: number = 10): string | null {\n let currentDir = resolve(startDir);\n let levels = 0;\n \n while (levels < maxLevels) {\n // Check if any project root indicator exists in this directory\n for (const indicator of PROJECT_ROOT_INDICATORS) {\n const indicatorPath = join(currentDir, indicator);\n if (existsSync(indicatorPath)) {\n return currentDir;\n }\n }\n \n // Move up one directory\n const parentDir = dirname(currentDir);\n if (parentDir === currentDir) {\n // Reached filesystem root\n break;\n }\n currentDir = parentDir;\n levels++;\n }\n \n return null;\n}\n\n/**\n * Check if a path looks like it's inside an npm package installation\n */\nfunction isInsideNpmPackage(dir: string): boolean {\n const normalizedPath = dir.replace(/\\\\/g, '/');\n return NPM_PACKAGE_INDICATORS.some(indicator => normalizedPath.includes(indicator));\n}\n\n/**\n * Try to get workspace from environment variables\n * Various tools set these when invoking MCP servers\n */\nfunction getWorkspaceFromEnv(): string | null {\n // Common environment variables that might contain workspace path\n const envVars = [\n 'CURSOR_WORKSPACE', // Cursor IDE\n 'CURSOR_WORKSPACE_ROOT', // Alternative Cursor env var\n 'VSCODE_WORKSPACE', // VS Code\n 'VSCODE_CWD', // VS Code working directory\n 'WORKSPACE_FOLDER', // Generic workspace\n 'PROJECT_ROOT', // Generic project root\n 'INIT_CWD', // npm's original directory\n 'PWD', // Original shell directory\n ];\n \n for (const envVar of envVars) {\n const value = process.env[envVar];\n if (value && existsSync(value)) {\n // Verify it looks like a project\n const hasProjectIndicator = PROJECT_ROOT_INDICATORS.some(\n indicator => existsSync(join(value, indicator))\n );\n if (hasProjectIndicator) {\n return value;\n }\n }\n }\n \n return null;\n}\n\n/**\n * Get the best working directory for scanning/operations\n * Priority: \n * 1. Explicit directory arg\n * 2. Environment variable (CURSOR_WORKSPACE, etc.)\n * 3. Detected project root from cwd (if not inside npm package)\n * 4. process.cwd() with warning\n * \n * @param explicitDir - Optional explicit directory from user\n * @param silent - If true, don't log warnings when falling back to cwd\n */\nexport function getWorkingDirectory(explicitDir?: string, silent: boolean = false): string {\n // If explicitly provided, use it\n if (explicitDir) {\n return resolve(explicitDir);\n }\n\n // Suppress all logs in interactive mode (TUI handles its own display)\n const shouldLog = !silent && !isInteractiveMode();\n\n // Debug: Log all relevant environment variables\n if (shouldLog && process.env.DEBUG_TRIE_WORKSPACE) {\n console.error('Debug: Environment variables:');\n console.error(` CURSOR_WORKSPACE: ${process.env.CURSOR_WORKSPACE || 'not set'}`);\n console.error(` CURSOR_WORKSPACE_ROOT: ${process.env.CURSOR_WORKSPACE_ROOT || 'not set'}`);\n console.error(` VSCODE_CWD: ${process.env.VSCODE_CWD || 'not set'}`);\n console.error(` INIT_CWD: ${process.env.INIT_CWD || 'not set'}`);\n console.error(` PWD: ${process.env.PWD || 'not set'}`);\n console.error(` process.cwd(): ${process.cwd()}`);\n }\n\n // Try environment variables first\n const envWorkspace = getWorkspaceFromEnv();\n if (envWorkspace) {\n if (shouldLog) {\n console.error(`Using workspace from environment: ${envWorkspace}`);\n }\n return envWorkspace;\n }\n \n // Try to find a project root from cwd\n const cwd = process.cwd();\n \n // Check if we're running from inside an npm package (common for MCP servers)\n if (isInsideNpmPackage(cwd)) {\n if (shouldLog) {\n console.error('Warning: MCP server running from npm package directory.');\n console.error(' Please pass the \"directory\" parameter with your project path.');\n console.error(` Current directory: ${cwd}`);\n }\n // Still return cwd, but we've warned\n return cwd;\n }\n \n const projectRoot = findProjectRoot(cwd);\n \n if (projectRoot) {\n // Extra check: make sure we're not returning the Trie package itself\n const packageJsonPath = join(projectRoot, 'package.json');\n if (existsSync(packageJsonPath)) {\n try {\n const pkg = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n if (pkg.name === '@triedotdev/mcp' || pkg.name === 'trie-mcp-agent') {\n if (shouldLog) {\n console.error('Warning: Detected Trie package directory, not user workspace.');\n console.error(' Please pass the \"directory\" parameter with your project path.');\n }\n return cwd;\n }\n } catch {\n // Ignore parse errors\n }\n }\n return projectRoot;\n }\n \n // Fallback to cwd, but warn\n if (shouldLog) {\n console.error('Warning: Could not detect project root. Operating from:', cwd);\n console.error(' Tip: Pass directory parameter or run from a directory with package.json/.git');\n console.error(' Or set DEBUG_TRIE_WORKSPACE=1 to debug workspace detection');\n console.error(` Current working directory: ${cwd}`);\n\n // Show how to properly call with directory\n console.error(' Examples:');\n console.error(' Use trie_security with directory: \"/path/to/your/project\"');\n console.error(' Use trie_scan with directory: \"./your-project\"');\n }\n\n return cwd;\n}\n"],"mappings":";;;;;AAQA,SAAS,gBAAgB;AACzB,SAAS,YAAY,oBAAoB;AACzC,SAAS,UAAU,SAAS,MAAM,eAAe;AAKjD,IAAM,0BAA0B;AAAA,EAC9B;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA;AAAA;AAGF;AAGA,IAAM,yBAAyB;AAAA,EAC7B;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF;AAEA,SAAS,gBAAgB,UAAiC;AACxD,MAAI;AACF,UAAM,SAAS,SAAS,kCAAkC;AAAA,MACxD,KAAK;AAAA,MACL,OAAO,CAAC,UAAU,QAAQ,QAAQ;AAAA,IACpC,CAAC,EACE,SAAS,EACT,KAAK;AACR,QAAI,CAAC,OAAQ,QAAO;AACpB,WAAO,QAAQ,UAAU,MAAM;AAAA,EACjC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,sBAAsB,UAAiC;AAC9D,QAAM,YAAY,gBAAgB,QAAQ;AAC1C,MAAI,CAAC,UAAW,QAAO;AACvB,MAAI,SAAS,SAAS,MAAM,OAAQ,QAAO;AAC3C,SAAO,QAAQ,SAAS;AAC1B;AAEO,SAAS,iBAAiB,SAAyB;AACxD,QAAM,OAAO,QAAQ,IAAI,oBAAoB,YAAY;AACzD,MAAI,SAAS,YAAY;AACvB,WAAO,KAAK,SAAS,OAAO;AAAA,EAC9B;AAC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,GAAG;AAC5E,YAAQ,MAAM,iFAAiF;AAC/F,YAAQ,MAAM,+DAA+D;AAC7E,YAAQ,MAAM,iCAAiC,GAAG,EAAE;AAGpD,YAAQ,MAAM,cAAc;AAC5B,YAAQ,MAAM,gEAAgE;AAC9E,YAAQ,MAAM,qDAAqD;AAAA,EACrE;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/utils/workspace.ts"],"sourcesContent":["/**\n * Workspace detection utilities\n * \n * MCP servers run as separate processes where process.cwd() may not be\n * the user's workspace. These utilities detect the actual project root\n * by looking for common project indicators.\n */\n\nimport { execSync } from 'node:child_process';\nimport { existsSync, readFileSync } from 'fs';\nimport { basename, dirname, join, resolve } from 'path';\nimport { isInteractiveMode } from './progress.js';\n\n// Project root indicators - files/directories that indicate a project root\n// Ordered by strength: primary indicators first\nconst PROJECT_ROOT_INDICATORS = [\n 'package.json', // Node.js/npm projects\n '.git', // Git repository root\n 'Cargo.toml', // Rust projects\n 'go.mod', // Go modules\n 'pyproject.toml', // Python projects (modern)\n 'pom.xml', // Maven (Java)\n 'build.gradle', // Gradle (Java/Kotlin)\n 'deno.json', // Deno projects\n // Note: .trie/config.json would be a better indicator, but empty .trie dirs exist\n // tsconfig.json is secondary as it can exist in subdirectories\n];\n\n// Directories that indicate we're in an npm package, not a user workspace\nconst NPM_PACKAGE_INDICATORS = [\n 'node_modules/@', // Scoped packages\n 'node_modules/', // Regular packages\n '.npm/', // npm cache\n '.nvm/', // nvm\n 'lib/node_modules/', // Global npm\n];\n\nfunction getGitCommonDir(startDir: string): string | null {\n try {\n const output = execSync('git rev-parse --git-common-dir', {\n cwd: startDir,\n stdio: ['ignore', 'pipe', 'ignore'],\n })\n .toString()\n .trim();\n if (!output) return null;\n return resolve(startDir, output);\n } catch {\n return null;\n }\n}\n\nfunction getSharedWorktreeRoot(startDir: string): string | null {\n const commonDir = getGitCommonDir(startDir);\n if (!commonDir) return null;\n if (basename(commonDir) !== '.git') return null;\n return dirname(commonDir);\n}\n\nexport function getTrieDirectory(workDir: string): string {\n const mode = process.env.TRIE_WORKTREE_MODE?.toLowerCase();\n if (mode === 'isolated') {\n return join(workDir, '.trie');\n }\n const sharedRoot = getSharedWorktreeRoot(workDir);\n if (sharedRoot) {\n return join(sharedRoot, '.trie');\n }\n return join(workDir, '.trie');\n}\n\n/**\n * Find the nearest project root by walking up from a starting directory\n * Returns the directory containing a project root indicator, or null if none found\n */\nexport function findProjectRoot(startDir: string, maxLevels: number = 10): string | null {\n let currentDir = resolve(startDir);\n let levels = 0;\n \n while (levels < maxLevels) {\n // Check if any project root indicator exists in this directory\n for (const indicator of PROJECT_ROOT_INDICATORS) {\n const indicatorPath = join(currentDir, indicator);\n if (existsSync(indicatorPath)) {\n return currentDir;\n }\n }\n \n // Move up one directory\n const parentDir = dirname(currentDir);\n if (parentDir === currentDir) {\n // Reached filesystem root\n break;\n }\n currentDir = parentDir;\n levels++;\n }\n \n return null;\n}\n\n/**\n * Check if a path looks like it's inside an npm package installation\n */\nfunction isInsideNpmPackage(dir: string): boolean {\n const normalizedPath = dir.replace(/\\\\/g, '/');\n return NPM_PACKAGE_INDICATORS.some(indicator => normalizedPath.includes(indicator));\n}\n\n/**\n * Try to get workspace from environment variables\n * Various tools set these when invoking MCP servers\n */\nfunction getWorkspaceFromEnv(): string | null {\n // Common environment variables that might contain workspace path\n const envVars = [\n 'CURSOR_WORKSPACE', // Cursor IDE\n 'CURSOR_WORKSPACE_ROOT', // Alternative Cursor env var\n 'VSCODE_WORKSPACE', // VS Code\n 'VSCODE_CWD', // VS Code working directory\n 'WORKSPACE_FOLDER', // Generic workspace\n 'PROJECT_ROOT', // Generic project root\n 'INIT_CWD', // npm's original directory\n 'PWD', // Original shell directory\n ];\n \n for (const envVar of envVars) {\n const value = process.env[envVar];\n if (value && existsSync(value)) {\n // Verify it looks like a project\n const hasProjectIndicator = PROJECT_ROOT_INDICATORS.some(\n indicator => existsSync(join(value, indicator))\n );\n if (hasProjectIndicator) {\n return value;\n }\n }\n }\n \n return null;\n}\n\n/**\n * Get the best working directory for scanning/operations\n * Priority: \n * 1. Explicit directory arg\n * 2. Environment variable (CURSOR_WORKSPACE, etc.)\n * 3. Detected project root from cwd (if not inside npm package)\n * 4. process.cwd() with warning\n * \n * @param explicitDir - Optional explicit directory from user\n * @param silent - If true, don't log warnings when falling back to cwd\n */\nexport function getWorkingDirectory(explicitDir?: string, silent: boolean = false): string {\n // If explicitly provided, use it\n if (explicitDir) {\n return resolve(explicitDir);\n }\n\n // Suppress all logs in interactive mode (TUI handles its own display)\n const shouldLog = !silent && !isInteractiveMode();\n\n // Debug: Log all relevant environment variables\n if (shouldLog && process.env.DEBUG_TRIE_WORKSPACE) {\n console.error('Debug: Environment variables:');\n console.error(` CURSOR_WORKSPACE: ${process.env.CURSOR_WORKSPACE || 'not set'}`);\n console.error(` CURSOR_WORKSPACE_ROOT: ${process.env.CURSOR_WORKSPACE_ROOT || 'not set'}`);\n console.error(` VSCODE_CWD: ${process.env.VSCODE_CWD || 'not set'}`);\n console.error(` INIT_CWD: ${process.env.INIT_CWD || 'not set'}`);\n console.error(` PWD: ${process.env.PWD || 'not set'}`);\n console.error(` process.cwd(): ${process.cwd()}`);\n }\n\n // Try environment variables first\n const envWorkspace = getWorkspaceFromEnv();\n if (envWorkspace) {\n if (shouldLog) {\n console.error(`Using workspace from environment: ${envWorkspace}`);\n }\n return envWorkspace;\n }\n \n // Try to find a project root from cwd\n const cwd = process.cwd();\n \n // Check if we're running from inside an npm package (common for MCP servers)\n if (isInsideNpmPackage(cwd)) {\n if (shouldLog) {\n console.error('Warning: MCP server running from npm package directory.');\n console.error(' Please pass the \"directory\" parameter with your project path.');\n console.error(` Current directory: ${cwd}`);\n }\n // Still return cwd, but we've warned\n return cwd;\n }\n \n const projectRoot = findProjectRoot(cwd);\n \n if (projectRoot) {\n // Extra check: make sure we're not returning the Trie package itself\n const packageJsonPath = join(projectRoot, 'package.json');\n if (existsSync(packageJsonPath)) {\n try {\n const pkg = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n if (pkg.name === '@triedotdev/mcp' || pkg.name === 'trie-mcp-agent') {\n if (shouldLog) {\n console.error('Warning: Detected Trie package directory, not user workspace.');\n console.error(' Please pass the \"directory\" parameter with your project path.');\n }\n return cwd;\n }\n } catch {\n // Ignore parse errors\n }\n }\n return projectRoot;\n }\n \n // Fallback to cwd, but warn\n if (shouldLog) {\n console.error('Warning: Could not detect project root. Operating from:', cwd);\n console.error(' Tip: Pass directory parameter or run from a directory with package.json/.git');\n console.error(' Or set DEBUG_TRIE_WORKSPACE=1 to debug workspace detection');\n console.error(` Current working directory: ${cwd}`);\n\n // Show how to properly call with directory\n console.error(' Examples:');\n console.error(' Use trie_fix with directory: \"/path/to/your/project\"');\n console.error(' Use trie watch with directory: \"./your-project\"');\n }\n\n return cwd;\n}\n"],"mappings":";;;;;AAQA,SAAS,gBAAgB;AACzB,SAAS,YAAY,oBAAoB;AACzC,SAAS,UAAU,SAAS,MAAM,eAAe;AAKjD,IAAM,0BAA0B;AAAA,EAC9B;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA;AAAA;AAGF;AAGA,IAAM,yBAAyB;AAAA,EAC7B;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF;AAEA,SAAS,gBAAgB,UAAiC;AACxD,MAAI;AACF,UAAM,SAAS,SAAS,kCAAkC;AAAA,MACxD,KAAK;AAAA,MACL,OAAO,CAAC,UAAU,QAAQ,QAAQ;AAAA,IACpC,CAAC,EACE,SAAS,EACT,KAAK;AACR,QAAI,CAAC,OAAQ,QAAO;AACpB,WAAO,QAAQ,UAAU,MAAM;AAAA,EACjC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,sBAAsB,UAAiC;AAC9D,QAAM,Y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C;AAC7D,YAAI,IAAI,SAAS,qBAAqB,IAAI,SAAS,kBAAkB;AACnE,cAAI,WAAW;AACb,oBAAQ,MAAM,+DAA+D;AAC7E,oBAAQ,MAAM,kEAAkE;AAAA,UAClF;AACA,iBAAO;AAAA,QACT;AAAA,MACF,QAAQ;AAAA,MAER;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAGA,MAAI,WAAW;AACb,YAAQ,MAAM,2DAA2D,GAAG;AAC5E,YAAQ,MAAM,iFAAiF;AAC/F,YAAQ,MAAM,+DAA+D;AAC7E,YAAQ,MAAM,iCAAiC,GAAG,EAAE;AAGpD,YAAQ,MAAM,cAAc;AAC5B,YAAQ,MAAM,2DAA2D;AACzE,YAAQ,MAAM,sDAAsD;AAAA,EACtE;AAEA,SAAO;AACT;","names":[]}
@@ -1,38 +1,38 @@
1
1
  import {
2
2
  getGoalManager
3
- } from "./chunk-ILGMFND2.js";
3
+ } from "./chunk-JIS2OCZR.js";
4
4
  import {
5
5
  getHypothesisEngine
6
- } from "./chunk-72KSLD7A.js";
6
+ } from "./chunk-74R4XSFB.js";
7
7
  import {
8
8
  getInsightStore
9
- } from "./chunk-OTQEFXHU.js";
9
+ } from "./chunk-ABY2R7OK.js";
10
10
  import {
11
11
  GotchaPredictor,
12
12
  SlackIntegration,
13
13
  findCrossProjectPatterns,
14
14
  recordToGlobalMemory
15
- } from "./chunk-B2AHQ2IR.js";
16
- import {
17
- getStorage
18
- } from "./chunk-FG467PDD.js";
15
+ } from "./chunk-IFBEAOHH.js";
19
16
  import {
20
17
  ContextGraph
21
- } from "./chunk-FH335WL5.js";
18
+ } from "./chunk-TWQPOVRA.js";
22
19
  import {
23
20
  isAIAvailable,
24
21
  runAIAnalysis
25
- } from "./chunk-FPEMP54L.js";
22
+ } from "./chunk-OJXFQRUE.js";
26
23
  import {
27
24
  getProjectState
28
- } from "./chunk-CU5VDH6F.js";
25
+ } from "./chunk-GLY76TSI.js";
26
+ import {
27
+ getStorage
28
+ } from "./chunk-LNUMECBJ.js";
29
29
  import {
30
30
  autoResolveIssues,
31
31
  getHistoricalInsights,
32
32
  getIssueHash,
33
33
  searchIssues,
34
34
  storeIssues
35
- } from "./chunk-QH77RQB3.js";
35
+ } from "./chunk-ED7PLRQA.js";
36
36
 
37
37
  // src/agent/trie-agent.ts
38
38
  import { basename as basename2 } from "path";
@@ -1322,9 +1322,9 @@ var TrieAgent = class {
1322
1322
  }
1323
1323
  if (issues.length >= 5 && this.canCreateInsight("pattern-discovery")) {
1324
1324
  try {
1325
- const { IncidentIndex } = await import("./incident-index-BWW2UEY7.js");
1325
+ const { IncidentIndex } = await import("./incident-index-H6APJ4S3.js");
1326
1326
  const { TriePatternDiscovery } = await import("./pattern-discovery-F7LU5K6E.js");
1327
- const { ContextGraph: ContextGraph2 } = await import("./graph-J4OGTYCO.js");
1327
+ const { ContextGraph: ContextGraph2 } = await import("./graph-26JPZ3DF.js");
1328
1328
  const graph = new ContextGraph2(this.projectPath);
1329
1329
  const incidentIndex = await IncidentIndex.build(graph, this.projectPath);
1330
1330
  const discovery = new TriePatternDiscovery(graph, incidentIndex);
@@ -1581,7 +1581,7 @@ var TrieAgent = class {
1581
1581
  await this.projectState.recordScan();
1582
1582
  try {
1583
1583
  const riskLevel = issues.filter((i) => i.severity === "critical").length > 0 ? "critical" : issues.filter((i) => i.severity === "serious").length >= 3 ? "high" : issues.length > 10 ? "medium" : "low";
1584
- const { calculateAdaptiveScanFrequency } = await import("./goal-manager-IGUMDGCA.js");
1584
+ const { calculateAdaptiveScanFrequency } = await import("./goal-manager-VTBFFYN4.js");
1585
1585
  const result = await calculateAdaptiveScanFrequency(riskLevel);
1586
1586
  await this.projectState.setScanFrequency(result.frequencyMs);
1587
1587
  } catch {
@@ -1810,4 +1810,4 @@ export {
1810
1810
  TrieAgent,
1811
1811
  getTrieAgent
1812
1812
  };
1813
- //# sourceMappingURL=chunk-GAL7OIYU.js.map
1813
+ //# sourceMappingURL=chunk-4UDBGYI3.js.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  getInsightStore
3
- } from "./chunk-OTQEFXHU.js";
3
+ } from "./chunk-ABY2R7OK.js";
4
4
  import {
5
5
  getProjectState
6
- } from "./chunk-CU5VDH6F.js";
6
+ } from "./chunk-GLY76TSI.js";
7
7
  import {
8
8
  searchIssues
9
- } from "./chunk-QH77RQB3.js";
9
+ } from "./chunk-ED7PLRQA.js";
10
10
 
11
11
  // src/agent/hypothesis.ts
12
12
  import { dirname } from "path";
@@ -134,7 +134,7 @@ var HypothesisEngine = class {
134
134
  * This enables fully agentic hypothesis creation based on actual codebase observations
135
135
  */
136
136
  async generateHypothesesWithAI(context) {
137
- const { isAIAvailable, runAIAnalysis } = await import("./client-INNE2GGZ.js");
137
+ const { isAIAvailable, runAIAnalysis } = await import("./client-5L64D5SQ.js");
138
138
  if (!isAIAvailable()) {
139
139
  return [];
140
140
  }
@@ -724,4 +724,4 @@ export {
724
724
  clearHypothesisEngines,
725
725
  gatherEvidenceForHypothesis
726
726
  };
727
- //# sourceMappingURL=chunk-72KSLD7A.js.map
727
+ //# sourceMappingURL=chunk-74R4XSFB.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  getProjectState
3
- } from "./chunk-CU5VDH6F.js";
3
+ } from "./chunk-GLY76TSI.js";
4
4
  import {
5
5
  searchIssues
6
- } from "./chunk-QH77RQB3.js";
6
+ } from "./chunk-ED7PLRQA.js";
7
7
 
8
8
  // src/agent/goal-validator.ts
9
9
  async function getActiveGoals(projectPath) {
@@ -38,9 +38,9 @@ async function recordGoalViolationFixed(goal, file, projectPath) {
38
38
  lastFixedFile: file
39
39
  }
40
40
  });
41
- const { resolveGoalViolation } = await import("./issue-store-4FPABLC6.js");
41
+ const { resolveGoalViolation } = await import("./issue-store-C6XYENE5.js");
42
42
  await resolveGoalViolation(file, goal.description, projectPath);
43
- const { getGoalManager } = await import("./goal-manager-IGUMDGCA.js");
43
+ const { getGoalManager } = await import("./goal-manager-VTBFFYN4.js");
44
44
  const goalManager = getGoalManager(projectPath);
45
45
  await goalManager.updateGoalProgress();
46
46
  }
@@ -88,8 +88,8 @@ async function measureInitialGoalValue(description, projectPath) {
88
88
  }
89
89
  }
90
90
  async function checkFilesForGoalViolations(goals, projectPath, filesToCheck, onProgress, signal) {
91
- const { isAIAvailable, runAIAnalysis } = await import("./client-INNE2GGZ.js");
92
- const { CodebaseIndex } = await import("./codebase-index-FMIULFZQ.js");
91
+ const { isAIAvailable, runAIAnalysis } = await import("./client-5L64D5SQ.js");
92
+ const { CodebaseIndex } = await import("./codebase-index-OOE7OAHP.js");
93
93
  if (!isAIAvailable()) {
94
94
  throw new Error("AI not available - ANTHROPIC_API_KEY not set");
95
95
  }
@@ -241,7 +241,7 @@ This is a MANUAL CHECK requested by the user. Report ALL goal violations you fin
241
241
  For emoji detection, look for Unicode emoji characters.
242
242
  `;
243
243
  const result = await runAIAnalysis({
244
- signal,
244
+ ...signal && { signal },
245
245
  systemPrompt: `You are checking code for GOAL VIOLATIONS ONLY.
246
246
  ${goalsSection}
247
247
  Reply ONLY with a JSON array. Each element must have:
@@ -351,4 +351,4 @@ export {
351
351
  measureInitialGoalValue,
352
352
  checkFilesForGoalViolations
353
353
  };
354
- //# sourceMappingURL=chunk-ZDDE442Q.js.map
354
+ //# sourceMappingURL=chunk-7HYOJ4Q7.js.map