@ekkos/cli 1.3.1 → 1.3.5

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 (131) hide show
  1. package/dist/capture/jsonl-rewriter.d.ts +1 -1
  2. package/dist/capture/jsonl-rewriter.js +3 -3
  3. package/dist/capture/transcript-repair.d.ts +2 -2
  4. package/dist/capture/transcript-repair.js +2 -2
  5. package/dist/commands/claw.d.ts +13 -0
  6. package/dist/commands/claw.js +253 -0
  7. package/dist/commands/dashboard.js +742 -118
  8. package/dist/commands/doctor.d.ts +3 -3
  9. package/dist/commands/doctor.js +6 -79
  10. package/dist/commands/gemini.d.ts +19 -0
  11. package/dist/commands/gemini.js +193 -0
  12. package/dist/commands/init.d.ts +1 -0
  13. package/dist/commands/init.js +56 -41
  14. package/dist/commands/run.d.ts +0 -1
  15. package/dist/commands/run.js +288 -263
  16. package/dist/commands/scan.d.ts +21 -0
  17. package/dist/commands/scan.js +386 -0
  18. package/dist/commands/status.d.ts +4 -1
  19. package/dist/commands/status.js +165 -27
  20. package/dist/commands/swarm-dashboard.js +156 -28
  21. package/dist/commands/swarm.d.ts +1 -1
  22. package/dist/commands/swarm.js +1 -1
  23. package/dist/commands/test-claude.d.ts +2 -2
  24. package/dist/commands/test-claude.js +3 -3
  25. package/dist/deploy/index.d.ts +0 -2
  26. package/dist/deploy/index.js +0 -2
  27. package/dist/deploy/settings.d.ts +6 -5
  28. package/dist/deploy/settings.js +64 -16
  29. package/dist/deploy/skills.js +1 -2
  30. package/dist/index.js +86 -96
  31. package/dist/lib/usage-parser.d.ts +1 -1
  32. package/dist/lib/usage-parser.js +9 -6
  33. package/dist/local/index.d.ts +14 -0
  34. package/dist/local/index.js +28 -0
  35. package/dist/local/local-embeddings.d.ts +49 -0
  36. package/dist/local/local-embeddings.js +232 -0
  37. package/dist/local/offline-fallback.d.ts +44 -0
  38. package/dist/local/offline-fallback.js +159 -0
  39. package/dist/local/sqlite-store.d.ts +126 -0
  40. package/dist/local/sqlite-store.js +393 -0
  41. package/dist/local/sync-engine.d.ts +42 -0
  42. package/dist/local/sync-engine.js +223 -0
  43. package/dist/utils/platform.d.ts +5 -1
  44. package/dist/utils/platform.js +24 -4
  45. package/dist/utils/proxy-url.d.ts +21 -0
  46. package/dist/utils/proxy-url.js +34 -0
  47. package/dist/utils/state.d.ts +1 -1
  48. package/dist/utils/state.js +11 -3
  49. package/dist/utils/templates.js +1 -1
  50. package/package.json +11 -4
  51. package/templates/CLAUDE.md +49 -107
  52. package/dist/agent/daemon.d.ts +0 -130
  53. package/dist/agent/daemon.js +0 -606
  54. package/dist/agent/health-check.d.ts +0 -35
  55. package/dist/agent/health-check.js +0 -243
  56. package/dist/agent/pty-runner.d.ts +0 -53
  57. package/dist/agent/pty-runner.js +0 -190
  58. package/dist/commands/agent.d.ts +0 -50
  59. package/dist/commands/agent.js +0 -544
  60. package/dist/commands/setup-remote.d.ts +0 -20
  61. package/dist/commands/setup-remote.js +0 -582
  62. package/dist/utils/verify-remote-terminal.d.ts +0 -10
  63. package/dist/utils/verify-remote-terminal.js +0 -415
  64. package/templates/README.md +0 -378
  65. package/templates/claude-plugins/PHASE2_COMPLETION.md +0 -346
  66. package/templates/claude-plugins/PLUGIN_PROPOSALS.md +0 -1776
  67. package/templates/claude-plugins/README.md +0 -587
  68. package/templates/claude-plugins/agents/code-reviewer.json +0 -14
  69. package/templates/claude-plugins/agents/debug-detective.json +0 -15
  70. package/templates/claude-plugins/agents/git-companion.json +0 -14
  71. package/templates/claude-plugins/blog-manager/.claude-plugin/plugin.json +0 -8
  72. package/templates/claude-plugins/blog-manager/commands/blog.md +0 -691
  73. package/templates/claude-plugins/golden-loop-monitor/.claude-plugin/plugin.json +0 -8
  74. package/templates/claude-plugins/golden-loop-monitor/commands/loop-status.md +0 -434
  75. package/templates/claude-plugins/learning-tracker/.claude-plugin/plugin.json +0 -8
  76. package/templates/claude-plugins/learning-tracker/commands/my-patterns.md +0 -282
  77. package/templates/claude-plugins/memory-lens/.claude-plugin/plugin.json +0 -8
  78. package/templates/claude-plugins/memory-lens/commands/memory-search.md +0 -181
  79. package/templates/claude-plugins/pattern-coach/.claude-plugin/plugin.json +0 -8
  80. package/templates/claude-plugins/pattern-coach/commands/forge.md +0 -365
  81. package/templates/claude-plugins/project-schema-validator/.claude-plugin/plugin.json +0 -8
  82. package/templates/claude-plugins/project-schema-validator/commands/validate-schema.md +0 -582
  83. package/templates/claude-plugins-admin/AGENT_TEAM_PROPOSALS.md +0 -819
  84. package/templates/claude-plugins-admin/README.md +0 -446
  85. package/templates/claude-plugins-admin/autonomous-admin-agent/.claude-plugin/plugin.json +0 -8
  86. package/templates/claude-plugins-admin/autonomous-admin-agent/commands/agent.md +0 -595
  87. package/templates/claude-plugins-admin/backend-agent/.claude-plugin/plugin.json +0 -8
  88. package/templates/claude-plugins-admin/backend-agent/commands/backend.md +0 -798
  89. package/templates/claude-plugins-admin/deploy-guardian/.claude-plugin/plugin.json +0 -8
  90. package/templates/claude-plugins-admin/deploy-guardian/commands/deploy.md +0 -554
  91. package/templates/claude-plugins-admin/frontend-agent/.claude-plugin/plugin.json +0 -8
  92. package/templates/claude-plugins-admin/frontend-agent/commands/frontend.md +0 -881
  93. package/templates/claude-plugins-admin/mcp-server-manager/.claude-plugin/plugin.json +0 -8
  94. package/templates/claude-plugins-admin/mcp-server-manager/commands/mcp.md +0 -85
  95. package/templates/claude-plugins-admin/memory-system-monitor/.claude-plugin/plugin.json +0 -8
  96. package/templates/claude-plugins-admin/memory-system-monitor/commands/memory-health.md +0 -569
  97. package/templates/claude-plugins-admin/qa-agent/.claude-plugin/plugin.json +0 -8
  98. package/templates/claude-plugins-admin/qa-agent/commands/qa.md +0 -863
  99. package/templates/claude-plugins-admin/tech-lead-agent/.claude-plugin/plugin.json +0 -8
  100. package/templates/claude-plugins-admin/tech-lead-agent/commands/lead.md +0 -732
  101. package/templates/commands/continue.md +0 -47
  102. package/templates/cursor-rules/ekkos-memory.md +0 -127
  103. package/templates/ekkos-manifest.json +0 -223
  104. package/templates/helpers/json-parse.cjs +0 -101
  105. package/templates/hooks-node/lib/state.js +0 -187
  106. package/templates/hooks-node/stop.js +0 -416
  107. package/templates/hooks-node/user-prompt-submit.js +0 -337
  108. package/templates/plan-template.md +0 -306
  109. package/templates/rules/00-hooks-contract.mdc +0 -89
  110. package/templates/rules/30-ekkos-core.mdc +0 -188
  111. package/templates/rules/31-ekkos-messages.mdc +0 -78
  112. package/templates/shared/hooks-enabled.json +0 -22
  113. package/templates/shared/session-words.json +0 -45
  114. package/templates/skills/ekkOS_Deep_Recall/Skill.md +0 -282
  115. package/templates/skills/ekkOS_Learn/Skill.md +0 -265
  116. package/templates/skills/ekkOS_Memory_First/Skill.md +0 -206
  117. package/templates/skills/ekkOS_Plan_Assist/Skill.md +0 -302
  118. package/templates/skills/ekkOS_Preferences/Skill.md +0 -247
  119. package/templates/skills/ekkOS_Reflect/Skill.md +0 -257
  120. package/templates/skills/ekkOS_Safety/Skill.md +0 -265
  121. package/templates/skills/ekkOS_Schema/Skill.md +0 -251
  122. package/templates/skills/ekkOS_Summary/Skill.md +0 -257
  123. package/templates/spec-template.md +0 -159
  124. package/templates/windsurf-rules/ekkos-memory.md +0 -127
  125. package/templates/windsurf-skills/README.md +0 -58
  126. package/templates/windsurf-skills/ekkos-continue/SKILL.md +0 -81
  127. package/templates/windsurf-skills/ekkos-golden-loop/SKILL.md +0 -225
  128. package/templates/windsurf-skills/ekkos-insights/SKILL.md +0 -138
  129. package/templates/windsurf-skills/ekkos-recall/SKILL.md +0 -96
  130. package/templates/windsurf-skills/ekkos-safety/SKILL.md +0 -89
  131. package/templates/windsurf-skills/ekkos-vault/SKILL.md +0 -86
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Offline MCP Fallback
3
+ *
4
+ * When the remote API is unreachable, falls back to local SQLite.
5
+ * Transparent to callers — same interface, different backend.
6
+ *
7
+ * Tool coverage:
8
+ * ekkOS_Search → localStore.searchPatterns
9
+ * ekkOS_Forge → localStore.forgePattern
10
+ * ekkOS_Track → localStore.trackApplication
11
+ * ekkOS_Outcome → localStore.recordOutcome
12
+ * ekkOS_Directive→ localStore.createDirective
13
+ * ekkOS_Stats → localStore.getStats
14
+ */
15
+ declare const OFFLINE_CAPABLE_TOOLS: readonly ["ekkOS_Search", "ekkOS_Forge", "ekkOS_Track", "ekkOS_Outcome", "ekkOS_Directive", "ekkOS_Stats"];
16
+ export interface ToolCallResult {
17
+ success: boolean;
18
+ data?: any;
19
+ error?: string;
20
+ /** Present when the call was served from local store rather than the cloud */
21
+ _degraded?: boolean;
22
+ /** Present when the call was served from local store */
23
+ _local?: boolean;
24
+ }
25
+ export type RemoteCallFn = () => Promise<any>;
26
+ /**
27
+ * Attempt the remote MCP call. If it times out or throws, transparently fall
28
+ * back to the local SQLite store for supported tools.
29
+ *
30
+ * @param tool - ekkOS tool name (e.g. 'ekkOS_Search')
31
+ * @param args - Arguments to pass to the tool / local equivalent
32
+ * @param remoteCall - Zero-arg async function that performs the actual remote call
33
+ *
34
+ * @returns ToolCallResult with optional `_local: true` flag when served locally
35
+ */
36
+ export declare function callWithFallback(tool: string, args: Record<string, any>, remoteCall: RemoteCallFn): Promise<ToolCallResult>;
37
+ /**
38
+ * Convenience check: is the offline fallback layer ready to serve requests?
39
+ */
40
+ export declare function isOfflineFallbackReady(): boolean;
41
+ /**
42
+ * Exported constant for consumers that need to know which tools work offline.
43
+ */
44
+ export { OFFLINE_CAPABLE_TOOLS };
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ /**
3
+ * Offline MCP Fallback
4
+ *
5
+ * When the remote API is unreachable, falls back to local SQLite.
6
+ * Transparent to callers — same interface, different backend.
7
+ *
8
+ * Tool coverage:
9
+ * ekkOS_Search → localStore.searchPatterns
10
+ * ekkOS_Forge → localStore.forgePattern
11
+ * ekkOS_Track → localStore.trackApplication
12
+ * ekkOS_Outcome → localStore.recordOutcome
13
+ * ekkOS_Directive→ localStore.createDirective
14
+ * ekkOS_Stats → localStore.getStats
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.OFFLINE_CAPABLE_TOOLS = void 0;
18
+ exports.callWithFallback = callWithFallback;
19
+ exports.isOfflineFallbackReady = isOfflineFallbackReady;
20
+ const sqlite_store_1 = require("./sqlite-store");
21
+ // ---------------------------------------------------------------------------
22
+ // Constants
23
+ // ---------------------------------------------------------------------------
24
+ const MCP_TIMEOUT = 3000; // 3 seconds
25
+ const OFFLINE_CAPABLE_TOOLS = [
26
+ 'ekkOS_Search',
27
+ 'ekkOS_Forge',
28
+ 'ekkOS_Track',
29
+ 'ekkOS_Outcome',
30
+ 'ekkOS_Directive',
31
+ 'ekkOS_Stats',
32
+ ];
33
+ exports.OFFLINE_CAPABLE_TOOLS = OFFLINE_CAPABLE_TOOLS;
34
+ // ---------------------------------------------------------------------------
35
+ // Helpers
36
+ // ---------------------------------------------------------------------------
37
+ function isOfflineCapable(tool) {
38
+ return OFFLINE_CAPABLE_TOOLS.includes(tool);
39
+ }
40
+ function withTimeout(promise, ms) {
41
+ return Promise.race([
42
+ promise,
43
+ new Promise((_, reject) => setTimeout(() => reject(new Error(`Timeout after ${ms}ms`)), ms)),
44
+ ]);
45
+ }
46
+ // ---------------------------------------------------------------------------
47
+ // Local tool dispatch
48
+ // ---------------------------------------------------------------------------
49
+ function dispatchLocal(tool, args) {
50
+ if (!sqlite_store_1.localStore.isAvailable()) {
51
+ return {
52
+ success: false,
53
+ error: 'Local store not available (better-sqlite3 not installed)',
54
+ _degraded: true,
55
+ };
56
+ }
57
+ try {
58
+ switch (tool) {
59
+ case 'ekkOS_Search': {
60
+ const { user_id, query, limit } = args;
61
+ const patterns = sqlite_store_1.localStore.searchPatterns(user_id, query, limit);
62
+ return {
63
+ success: true,
64
+ data: { patterns, source: 'local', total: patterns.length },
65
+ _local: true,
66
+ };
67
+ }
68
+ case 'ekkOS_Forge': {
69
+ const { user_id, title, problem, solution, tags } = args;
70
+ const patternId = sqlite_store_1.localStore.forgePattern(user_id, { title, problem, solution, tags });
71
+ return {
72
+ success: true,
73
+ data: { pattern_id: patternId, source: 'local' },
74
+ _local: true,
75
+ };
76
+ }
77
+ case 'ekkOS_Track': {
78
+ const { pattern_id } = args;
79
+ sqlite_store_1.localStore.trackApplication(pattern_id);
80
+ return { success: true, data: { tracked: true, source: 'local' }, _local: true };
81
+ }
82
+ case 'ekkOS_Outcome': {
83
+ const { pattern_id, success } = args;
84
+ sqlite_store_1.localStore.recordOutcome(pattern_id, success);
85
+ return { success: true, data: { recorded: true, source: 'local' }, _local: true };
86
+ }
87
+ case 'ekkOS_Directive': {
88
+ const { user_id, type, rule, reason, priority, scope } = args;
89
+ const id = sqlite_store_1.localStore.createDirective(user_id, { type, rule, reason, priority, scope });
90
+ return {
91
+ success: true,
92
+ data: { id, source: 'local' },
93
+ _local: true,
94
+ };
95
+ }
96
+ case 'ekkOS_Stats': {
97
+ const { user_id } = args;
98
+ const stats = sqlite_store_1.localStore.getStats(user_id);
99
+ return { success: true, data: { ...stats, source: 'local' }, _local: true };
100
+ }
101
+ default: {
102
+ // TypeScript exhaustiveness guard — should never reach here
103
+ const _never = tool;
104
+ return {
105
+ success: false,
106
+ error: `Unknown offline-capable tool: ${_never}`,
107
+ _degraded: true,
108
+ };
109
+ }
110
+ }
111
+ }
112
+ catch (err) {
113
+ return {
114
+ success: false,
115
+ error: `Local store error: ${err.message}`,
116
+ _degraded: true,
117
+ };
118
+ }
119
+ }
120
+ // ---------------------------------------------------------------------------
121
+ // Main export: callWithFallback
122
+ // ---------------------------------------------------------------------------
123
+ /**
124
+ * Attempt the remote MCP call. If it times out or throws, transparently fall
125
+ * back to the local SQLite store for supported tools.
126
+ *
127
+ * @param tool - ekkOS tool name (e.g. 'ekkOS_Search')
128
+ * @param args - Arguments to pass to the tool / local equivalent
129
+ * @param remoteCall - Zero-arg async function that performs the actual remote call
130
+ *
131
+ * @returns ToolCallResult with optional `_local: true` flag when served locally
132
+ */
133
+ async function callWithFallback(tool, args, remoteCall) {
134
+ // Attempt remote call with timeout
135
+ try {
136
+ const data = await withTimeout(remoteCall(), MCP_TIMEOUT);
137
+ return { success: true, data };
138
+ }
139
+ catch (err) {
140
+ const reason = err.message;
141
+ // Check whether we can serve this tool locally
142
+ if (!isOfflineCapable(tool)) {
143
+ return {
144
+ success: false,
145
+ error: `Offline — tool not available locally (${reason})`,
146
+ _degraded: true,
147
+ };
148
+ }
149
+ // Log the fallback so callers / users are aware
150
+ console.warn(`[OfflineFallback] Remote call failed for ${tool} (${reason}) — using local store`);
151
+ return dispatchLocal(tool, args);
152
+ }
153
+ }
154
+ /**
155
+ * Convenience check: is the offline fallback layer ready to serve requests?
156
+ */
157
+ function isOfflineFallbackReady() {
158
+ return sqlite_store_1.localStore.isAvailable();
159
+ }
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Local SQLite Memory Store
3
+ *
4
+ * Provides offline-capable memory storage using SQLite with WAL mode.
5
+ * Mirrors the Supabase schema for seamless sync.
6
+ * Location: ~/.ekkos/memory.db
7
+ *
8
+ * Dependency: better-sqlite3
9
+ * Add to package.json: "better-sqlite3": "^9.4.0"
10
+ * Dev dep: "@types/better-sqlite3": "^7.6.8"
11
+ */
12
+ export interface Pattern {
13
+ pattern_id: string;
14
+ user_id: string;
15
+ title: string;
16
+ problem: string;
17
+ solution: string;
18
+ status: string;
19
+ applied_count: number;
20
+ success_rate: number;
21
+ tags: string[];
22
+ quarantined: boolean;
23
+ created_at: string;
24
+ updated_at: string;
25
+ synced_at: string | null;
26
+ }
27
+ export interface Directive {
28
+ id: string;
29
+ user_id: string;
30
+ type: 'MUST' | 'NEVER' | 'PREFER' | 'AVOID';
31
+ rule: string;
32
+ reason: string;
33
+ priority: number;
34
+ scope: string | null;
35
+ is_active: boolean;
36
+ created_at: string;
37
+ synced_at: string | null;
38
+ }
39
+ export interface EpisodicMemory {
40
+ id: string;
41
+ user_id: string;
42
+ problem: string;
43
+ solution: string;
44
+ session_name: string | null;
45
+ quality_score: number;
46
+ created_at: string;
47
+ synced_at: string | null;
48
+ }
49
+ export interface SyncQueueItem {
50
+ id: number;
51
+ table_name: string;
52
+ record_id: string;
53
+ operation: 'insert' | 'update' | 'delete';
54
+ payload: any;
55
+ created_at: string;
56
+ synced_at: string | null;
57
+ }
58
+ export interface StoreStats {
59
+ pattern_count: number;
60
+ active_pattern_count: number;
61
+ directive_count: number;
62
+ episodic_count: number;
63
+ pending_sync_count: number;
64
+ db_path: string;
65
+ }
66
+ export declare class LocalMemoryStore {
67
+ private db;
68
+ constructor();
69
+ private init;
70
+ private get database();
71
+ private migrate;
72
+ private rowToPattern;
73
+ private parseTags;
74
+ /**
75
+ * Full-text search across title, problem, solution, and tags using LIKE.
76
+ * Falls back gracefully when FTS5 is unavailable.
77
+ */
78
+ searchPatterns(userId: string, query: string, limit?: number): Pattern[];
79
+ /**
80
+ * Insert a new pattern and enqueue it for sync.
81
+ * Returns the generated pattern_id.
82
+ */
83
+ forgePattern(userId: string, input: {
84
+ title: string;
85
+ problem: string;
86
+ solution: string;
87
+ tags?: string[];
88
+ }): string;
89
+ /**
90
+ * Increment applied_count and mark as needing sync.
91
+ */
92
+ trackApplication(patternId: string): void;
93
+ /**
94
+ * Update success_rate using a weighted moving average and enqueue sync.
95
+ * Weight: 0.1 for new observation (exponential moving average).
96
+ */
97
+ recordOutcome(patternId: string, success: boolean): void;
98
+ /**
99
+ * Get active directives for a user, optionally filtered by type.
100
+ */
101
+ getDirectives(userId: string, types?: string[]): Directive[];
102
+ /**
103
+ * Insert a new directive and enqueue for sync.
104
+ * Returns the generated id.
105
+ */
106
+ createDirective(userId: string, input: {
107
+ type: string;
108
+ rule: string;
109
+ reason: string;
110
+ priority?: number;
111
+ scope?: string;
112
+ }): string;
113
+ /**
114
+ * Soft-delete a directive by setting is_active = 0.
115
+ */
116
+ deleteDirective(id: string): void;
117
+ private rowToDirective;
118
+ getStats(userId: string): StoreStats;
119
+ getPendingSync(): SyncQueueItem[];
120
+ markSynced(id: number): void;
121
+ getMeta(key: string): string | null;
122
+ setMeta(key: string, value: string): void;
123
+ private queueSync;
124
+ isAvailable(): boolean;
125
+ }
126
+ export declare const localStore: LocalMemoryStore;