superintent 0.0.1

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 (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +226 -0
  3. package/bin/superintent.js +2 -0
  4. package/dist/commands/extract.d.ts +2 -0
  5. package/dist/commands/extract.js +66 -0
  6. package/dist/commands/init.d.ts +2 -0
  7. package/dist/commands/init.js +56 -0
  8. package/dist/commands/knowledge.d.ts +2 -0
  9. package/dist/commands/knowledge.js +647 -0
  10. package/dist/commands/search.d.ts +2 -0
  11. package/dist/commands/search.js +153 -0
  12. package/dist/commands/spec.d.ts +2 -0
  13. package/dist/commands/spec.js +283 -0
  14. package/dist/commands/status.d.ts +2 -0
  15. package/dist/commands/status.js +43 -0
  16. package/dist/commands/ticket.d.ts +4 -0
  17. package/dist/commands/ticket.js +942 -0
  18. package/dist/commands/ui.d.ts +2 -0
  19. package/dist/commands/ui.js +954 -0
  20. package/dist/db/client.d.ts +4 -0
  21. package/dist/db/client.js +26 -0
  22. package/dist/db/init-schema.d.ts +2 -0
  23. package/dist/db/init-schema.js +28 -0
  24. package/dist/db/parsers.d.ts +24 -0
  25. package/dist/db/parsers.js +79 -0
  26. package/dist/db/schema.d.ts +7 -0
  27. package/dist/db/schema.js +64 -0
  28. package/dist/db/usage.d.ts +8 -0
  29. package/dist/db/usage.js +24 -0
  30. package/dist/embed/model.d.ts +5 -0
  31. package/dist/embed/model.js +34 -0
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.js +31 -0
  34. package/dist/types.d.ts +120 -0
  35. package/dist/types.js +1 -0
  36. package/dist/ui/components/index.d.ts +6 -0
  37. package/dist/ui/components/index.js +13 -0
  38. package/dist/ui/components/knowledge.d.ts +33 -0
  39. package/dist/ui/components/knowledge.js +238 -0
  40. package/dist/ui/components/layout.d.ts +1 -0
  41. package/dist/ui/components/layout.js +323 -0
  42. package/dist/ui/components/search.d.ts +15 -0
  43. package/dist/ui/components/search.js +114 -0
  44. package/dist/ui/components/spec.d.ts +11 -0
  45. package/dist/ui/components/spec.js +253 -0
  46. package/dist/ui/components/ticket.d.ts +90 -0
  47. package/dist/ui/components/ticket.js +604 -0
  48. package/dist/ui/components/utils.d.ts +26 -0
  49. package/dist/ui/components/utils.js +34 -0
  50. package/dist/ui/styles.css +2 -0
  51. package/dist/utils/cli.d.ts +21 -0
  52. package/dist/utils/cli.js +31 -0
  53. package/dist/utils/config.d.ts +12 -0
  54. package/dist/utils/config.js +116 -0
  55. package/dist/utils/id.d.ts +6 -0
  56. package/dist/utils/id.js +13 -0
  57. package/dist/utils/io.d.ts +8 -0
  58. package/dist/utils/io.js +15 -0
  59. package/package.json +60 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Acodera
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 ADDED
@@ -0,0 +1,226 @@
1
+ # superintent
2
+
3
+ The CLI backend for [Superintent Development](https://github.com/acoderacom/superintent) — a framework where your intent drives the entire development cycle, and knowledge compounds with every iteration.
4
+
5
+ Built on Turso/libSQL for ticket management, RAG-powered knowledge storage, and feature spec planning. Designed to work as the data layer for the **Superintent** Claude Code plugin.
6
+
7
+ ## The Loop
8
+
9
+ ```
10
+ ┌──────────────────────────────────┐
11
+ │ │
12
+ ▼ │
13
+ Intent ──► Work ──► Test ──► Compound
14
+
15
+ knowledge extracted
16
+ ```
17
+
18
+ **Intent** — Say what you want. Superintent figures out the right size: `/spec` for big features, `/ticket` for standard work, `/task` for quick fixes.
19
+
20
+ **Work** — AI builds it, informed by knowledge from past cycles — patterns, architecture, gotchas, decisions.
21
+
22
+ **Compound** — Knowledge is extracted from completed work and stored. What was built, how, why, what went wrong. This feeds back into the next cycle.
23
+
24
+ ## Features
25
+
26
+ - **Ticket Management** — Structured tickets with intent, constraints, tasks, definition-of-done, change classification, and execution plans. Full lifecycle: Backlog → In Progress → In Review → Done.
27
+ - **Knowledge Base (RAG)** — Semantic vector storage with 384-dimensional embeddings ([all-MiniLM-L6-v2](https://huggingface.co/Xenova/all-MiniLM-L6-v2)). Categories: `pattern`, `truth`, `principle`, `architecture`, `gotcha`. Confidence scoring with usage-based growth and staleness decay.
28
+ - **Semantic Search** — Cosine similarity search across knowledge entries with namespace, category, tag, and ticket-type filters.
29
+ - **Feature Specs** — Break big features into sequenced tickets. Specs link to their derived tickets.
30
+ - **Knowledge Extraction** — Auto-generates knowledge proposals when tickets are marked Done. Extracts patterns, truths, principles, decisions, and trade-offs.
31
+ - **Web Dashboard** — Kanban board, semantic search, knowledge browser, and spec viewer. Built with Hono + HTMX.
32
+
33
+ ## Requirements
34
+
35
+ - Node.js >= 18.0.0
36
+
37
+ ## Installation
38
+
39
+ ```bash
40
+ npm install -g superintent
41
+ ```
42
+
43
+ Or use directly via npx:
44
+
45
+ ```bash
46
+ npx superintent init
47
+ ```
48
+
49
+ ## Quick Start
50
+
51
+ ### Local Database (no account needed)
52
+
53
+ ```bash
54
+ npx superintent init --url "file:.superintent/local.db"
55
+ ```
56
+
57
+ ### Cloud Database (Turso)
58
+
59
+ Create `.superintent/.env`:
60
+
61
+ ```env
62
+ TURSO_URL="libsql://your-db.turso.io"
63
+ TURSO_AUTH_TOKEN="your-token"
64
+ ```
65
+
66
+ Then initialize:
67
+
68
+ ```bash
69
+ npx superintent init
70
+ ```
71
+
72
+ ### Verify
73
+
74
+ ```bash
75
+ npx superintent status
76
+ ```
77
+
78
+ ## CLI Commands
79
+
80
+ All commands output JSON in the format `{ success: boolean, data?: T, error?: string }`.
81
+
82
+ ### Setup
83
+
84
+ | Command | Description |
85
+ | --- | --- |
86
+ | `superintent init [--url <url>] [--token <token>]` | Create database tables |
87
+ | `superintent status` | Check connection and counts |
88
+ | `superintent ui [-p <port>] [-o]` | Start web dashboard (default: port 3456) |
89
+
90
+ ### Tickets
91
+
92
+ ```bash
93
+ # Create from markdown via stdin
94
+ superintent ticket create --stdin <<'EOF'
95
+ # Add user authentication
96
+
97
+ **Type:** feature
98
+ **Intent:** Add JWT-based authentication to the API
99
+ **Context:** Currently no auth, all endpoints are public
100
+ **Constraints:**
101
+ - Use: jsonwebtoken, bcrypt
102
+ - Avoid: session cookies
103
+ **Assumptions:** PostgreSQL already stores user table
104
+ **Change Class:** B - Adds new middleware to all routes
105
+ EOF
106
+
107
+ # Get, list, update, delete
108
+ superintent ticket get TICKET-20260210-143000
109
+ superintent ticket list --status "In Progress" --limit 10
110
+ superintent ticket update TICKET-20260210-143000 --status "Done"
111
+ superintent ticket delete TICKET-20260210-143000
112
+ ```
113
+
114
+ **Update options:** `--status`, `--context`, `--comment`, `--spec`, `--plan-stdin`, `--complete-task <indices>`, `--complete-dod <indices>`, `--complete-all`
115
+
116
+ ### Knowledge
117
+
118
+ ```bash
119
+ # Create from markdown via stdin
120
+ superintent knowledge create --stdin <<'EOF'
121
+ # API Error Handling Pattern
122
+
123
+ **Namespace:** my-project
124
+ **Category:** pattern
125
+ **Source:** discovery
126
+ **Confidence:** 0.85
127
+ **Scope:** new-only
128
+ **Tags:** api, error-handling, express
129
+
130
+ ## Content
131
+
132
+ Why:
133
+ Consistent error responses improve debugging and client experience.
134
+
135
+ When:
136
+ All new API endpoints.
137
+
138
+ Pattern:
139
+ Wrap route handlers in try/catch, return { success: false, error: message }.
140
+ EOF
141
+
142
+ # Search, list, get, update, activate/deactivate
143
+ superintent search "error handling patterns" --limit 5
144
+ superintent knowledge list --category pattern --namespace my-project
145
+ superintent knowledge get KNOWLEDGE-20260210-150000
146
+ superintent knowledge update KNOWLEDGE-20260210-150000 --confidence 0.9
147
+ superintent knowledge deactivate KNOWLEDGE-20260210-150000
148
+ superintent knowledge recalculate --dry-run
149
+ ```
150
+
151
+ ### Specs
152
+
153
+ ```bash
154
+ # Create from markdown via stdin
155
+ superintent spec create --stdin <<'EOF'
156
+ # User Authentication System
157
+
158
+ ## Summary
159
+ Full auth system with registration, login, JWT tokens, and middleware.
160
+
161
+ ## Tickets
162
+ 1. Add user model and registration endpoint
163
+ 2. Add login endpoint with JWT generation
164
+ 3. Add auth middleware to protected routes
165
+ EOF
166
+
167
+ # Get, list, update, delete
168
+ superintent spec get SPEC-20260210-160000
169
+ superintent spec list --limit 10
170
+ superintent spec delete SPEC-20260210-160000
171
+ ```
172
+
173
+ ### Knowledge Extraction
174
+
175
+ ```bash
176
+ # Extract knowledge proposals from a completed ticket
177
+ superintent extract TICKET-20260210-143000
178
+ ```
179
+
180
+ ## Web Dashboard
181
+
182
+ ```bash
183
+ superintent ui --open
184
+ ```
185
+
186
+ Opens a web UI at `http://localhost:3456` with four tabs:
187
+
188
+ 1. **Kanban** — Ticket board with status columns, quick create, edit, and detail modals
189
+ 2. **Search** — Real-time semantic search across the knowledge base
190
+ 3. **Knowledge** — Filterable list with category, namespace, scope, and status filters
191
+ 4. **Specs** — Feature specs with linked ticket counts
192
+
193
+ ## Claude Code Plugin
194
+
195
+ This CLI is the data layer for the [Superintent plugin](https://github.com/acoderacom/superintent). Install the plugin in Claude Code to get skill-driven workflows:
196
+
197
+ | Skill | Trigger | What It Does |
198
+ | --- | --- | --- |
199
+ | `/ticket` | "I want...", "Add...", "Build..." | Create and execute structured tickets with planning, implementation, review, and knowledge extraction |
200
+ | `/task` | "quick fix", "just do it" | Fast execution for confident, low-risk changes (Class A only) |
201
+ | `/spec` | "spec", "plan feature", "big feature" | Write comprehensive specs for big features, then derive tickets |
202
+ | `/learn` | "learn how...", "document how..." | Explore codebase and capture understanding as searchable knowledge |
203
+ | `/explain` | "explain...", "why do we..." | Answer questions from the knowledge base before codebase exploration |
204
+ | `/maintain` | "maintain", "sync knowledge" | Distill the knowledge database into CLAUDE.md between managed markers |
205
+
206
+ The plugin auto-approves CLI commands via hooks, searches knowledge before every action, and extracts knowledge when tickets are completed — closing the compound loop.
207
+
208
+ ## Database
209
+
210
+ Three tables:
211
+
212
+ - **tickets** — Work items with structured metadata (tasks, DoD, plan, constraints, etc.)
213
+ - **knowledge** — RAG entries with `F32_BLOB(384)` vector column and cosine similarity index
214
+ - **specs** — Feature specifications linking to tickets via `origin_spec_id`
215
+
216
+ Supports both local SQLite (`file:` URLs) and Turso Cloud (`libsql://` URLs).
217
+
218
+ ## Configuration
219
+
220
+ Config is read from `.superintent/.env` or environment variables (`TURSO_URL`, `TURSO_AUTH_TOKEN`). Environment variables take priority.
221
+
222
+ Local file URLs (`file:...`) do not require an auth token.
223
+
224
+ ## License
225
+
226
+ MIT
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import('../dist/index.js');
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare const extractCommand: Command;
@@ -0,0 +1,66 @@
1
+ import { Command } from 'commander';
2
+ import { getClient, closeClient } from '../db/client.js';
3
+ import { parseTicketRow } from '../db/parsers.js';
4
+ import { getProjectNamespace } from '../utils/config.js';
5
+ import { generateExtractProposals } from './ticket.js';
6
+ export const extractCommand = new Command('extract')
7
+ .description('Extract knowledge from a completed ticket')
8
+ .argument('<ticket-id>', 'Ticket ID to extract knowledge from')
9
+ .option('--namespace <namespace>', 'Override namespace (default: derived from ticket)')
10
+ .action(async (ticketId, options) => {
11
+ try {
12
+ const client = await getClient();
13
+ const result = await client.execute({
14
+ sql: 'SELECT * FROM tickets WHERE id = ?',
15
+ args: [ticketId],
16
+ });
17
+ closeClient();
18
+ if (result.rows.length === 0) {
19
+ const response = {
20
+ success: false,
21
+ error: `Ticket ${ticketId} not found`,
22
+ };
23
+ console.log(JSON.stringify(response));
24
+ process.exit(1);
25
+ }
26
+ const ticket = parseTicketRow(result.rows[0]);
27
+ if (ticket.status !== 'Done') {
28
+ const response = {
29
+ success: false,
30
+ error: `Ticket ${ticketId} is not Done (status: ${ticket.status}). Only completed tickets can have knowledge extracted.`,
31
+ };
32
+ console.log(JSON.stringify(response));
33
+ process.exit(1);
34
+ }
35
+ const namespace = options.namespace || getProjectNamespace();
36
+ const suggestions = generateExtractProposals(ticket, namespace);
37
+ // Output proposal for AI to review and confirm
38
+ const proposal = {
39
+ action: 'propose',
40
+ ticketId,
41
+ namespace,
42
+ ticket: {
43
+ intent: ticket.intent,
44
+ context: ticket.context || null,
45
+ assumptions: ticket.assumptions || null,
46
+ constraints_use: ticket.constraints_use || null,
47
+ constraints_avoid: ticket.constraints_avoid || null,
48
+ plan: ticket.plan || null,
49
+ },
50
+ suggestedKnowledge: suggestions,
51
+ };
52
+ const response = {
53
+ success: true,
54
+ data: proposal,
55
+ };
56
+ console.log(JSON.stringify(response));
57
+ }
58
+ catch (error) {
59
+ const response = {
60
+ success: false,
61
+ error: `Failed to extract knowledge: ${error.message}`,
62
+ };
63
+ console.log(JSON.stringify(response));
64
+ process.exit(1);
65
+ }
66
+ });
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare const initCommand: Command;
@@ -0,0 +1,56 @@
1
+ import { Command } from 'commander';
2
+ import { createClientWithConfig } from '../db/client.js';
3
+ import { initSchema } from '../db/init-schema.js';
4
+ import { saveConfig, loadConfig } from '../utils/config.js';
5
+ export const initCommand = new Command('init')
6
+ .description('Create database tables (reads credentials from .superintent/.env)')
7
+ .option('--url <url>', 'Turso database URL (file:local.db for local, libsql://... for cloud)')
8
+ .option('--token <token>', 'Turso auth token (required for cloud, optional for local)')
9
+ .action(async (options) => {
10
+ try {
11
+ let url;
12
+ let token;
13
+ // If URL provided via CLI, use it
14
+ if (options.url) {
15
+ url = options.url;
16
+ token = options.token; // May be undefined for local URLs
17
+ saveConfig({ url, authToken: token });
18
+ }
19
+ else {
20
+ // Try to load from .env
21
+ try {
22
+ const config = loadConfig();
23
+ url = config.url;
24
+ token = config.authToken;
25
+ }
26
+ catch {
27
+ const response = {
28
+ success: false,
29
+ error: 'Create .superintent/.env with TURSO_URL (and TURSO_AUTH_TOKEN for cloud)',
30
+ };
31
+ console.log(JSON.stringify(response));
32
+ process.exit(1);
33
+ }
34
+ }
35
+ // Test connection and create tables
36
+ const client = await createClientWithConfig(url, token);
37
+ await initSchema(client);
38
+ client.close();
39
+ const response = {
40
+ success: true,
41
+ data: {
42
+ message: 'Database tables created successfully',
43
+ configPath: '.superintent/.env',
44
+ },
45
+ };
46
+ console.log(JSON.stringify(response));
47
+ }
48
+ catch (error) {
49
+ const response = {
50
+ success: false,
51
+ error: `Initialization failed: ${error.message}`,
52
+ };
53
+ console.log(JSON.stringify(response));
54
+ process.exit(1);
55
+ }
56
+ });
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare const knowledgeCommand: Command;