@specship/specship-win32-arm64 0.14.3 → 0.16.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 (82) hide show
  1. package/lib/dist/activation/steering.d.ts +26 -0
  2. package/lib/dist/activation/steering.d.ts.map +1 -0
  3. package/lib/dist/activation/steering.js +79 -0
  4. package/lib/dist/activation/steering.js.map +1 -0
  5. package/lib/dist/bin/specship.js +97 -8
  6. package/lib/dist/bin/specship.js.map +1 -1
  7. package/lib/dist/extraction/specs/markdown-spec-extractor.d.ts +9 -7
  8. package/lib/dist/extraction/specs/markdown-spec-extractor.d.ts.map +1 -1
  9. package/lib/dist/extraction/specs/markdown-spec-extractor.js +17 -10
  10. package/lib/dist/extraction/specs/markdown-spec-extractor.js.map +1 -1
  11. package/lib/dist/extraction/specs/spec-file-writeback.d.ts +37 -0
  12. package/lib/dist/extraction/specs/spec-file-writeback.d.ts.map +1 -0
  13. package/lib/dist/extraction/specs/spec-file-writeback.js +159 -0
  14. package/lib/dist/extraction/specs/spec-file-writeback.js.map +1 -0
  15. package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
  16. package/lib/dist/extraction/tree-sitter-helpers.js +12 -1
  17. package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
  18. package/lib/dist/installer/index.d.ts +26 -7
  19. package/lib/dist/installer/index.d.ts.map +1 -1
  20. package/lib/dist/installer/index.js +121 -17
  21. package/lib/dist/installer/index.js.map +1 -1
  22. package/lib/dist/installer/purge.d.ts +83 -0
  23. package/lib/dist/installer/purge.d.ts.map +1 -0
  24. package/lib/dist/installer/purge.js +144 -0
  25. package/lib/dist/installer/purge.js.map +1 -0
  26. package/lib/dist/installer/targets/claude.d.ts +11 -2
  27. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  28. package/lib/dist/installer/targets/claude.js +83 -7
  29. package/lib/dist/installer/targets/claude.js.map +1 -1
  30. package/lib/dist/installer/targets/shared.d.ts +10 -2
  31. package/lib/dist/installer/targets/shared.d.ts.map +1 -1
  32. package/lib/dist/installer/targets/shared.js +22 -11
  33. package/lib/dist/installer/targets/shared.js.map +1 -1
  34. package/lib/dist/installer/targets/types.d.ts +10 -0
  35. package/lib/dist/installer/targets/types.d.ts.map +1 -1
  36. package/lib/dist/mcp/model-context.d.ts +51 -0
  37. package/lib/dist/mcp/model-context.d.ts.map +1 -0
  38. package/lib/dist/mcp/model-context.js +229 -0
  39. package/lib/dist/mcp/model-context.js.map +1 -0
  40. package/lib/dist/mcp/spec-tools.d.ts.map +1 -1
  41. package/lib/dist/mcp/spec-tools.js +44 -1
  42. package/lib/dist/mcp/spec-tools.js.map +1 -1
  43. package/lib/dist/mcp/tools.d.ts +21 -0
  44. package/lib/dist/mcp/tools.d.ts.map +1 -1
  45. package/lib/dist/mcp/tools.js +71 -5
  46. package/lib/dist/mcp/tools.js.map +1 -1
  47. package/lib/dist/resolution/spec-link-resolver.d.ts.map +1 -1
  48. package/lib/dist/resolution/spec-link-resolver.js +42 -28
  49. package/lib/dist/resolution/spec-link-resolver.js.map +1 -1
  50. package/lib/dist/server/ingest/index.js +1 -1
  51. package/lib/dist/server/ingest/ingestor.js +24 -4
  52. package/lib/dist/server/routes/claude.js +31 -5
  53. package/lib/dist/server/routes/spec.js +13 -0
  54. package/lib/dist/server/routes/workflow.js +15 -1
  55. package/lib/dist/server/server.js +2 -2
  56. package/lib/dist/statusline/index.d.ts.map +1 -1
  57. package/lib/dist/statusline/index.js +6 -0
  58. package/lib/dist/statusline/index.js.map +1 -1
  59. package/lib/dist/statusline/paths.d.ts +2 -0
  60. package/lib/dist/statusline/paths.d.ts.map +1 -1
  61. package/lib/dist/statusline/paths.js +5 -0
  62. package/lib/dist/statusline/paths.js.map +1 -1
  63. package/lib/dist/types.d.ts +8 -3
  64. package/lib/dist/types.d.ts.map +1 -1
  65. package/lib/dist/ui/assets/index-CjjaftDw.js +50 -0
  66. package/lib/dist/ui/index.html +1 -1
  67. package/lib/dist/workflows/defaults/spec-implement.yaml +5 -0
  68. package/lib/dist/workflows/defaults/spec-verify.yaml +23 -9
  69. package/lib/dist/workflows/executor.d.ts +19 -0
  70. package/lib/dist/workflows/executor.d.ts.map +1 -1
  71. package/lib/dist/workflows/executor.js +131 -18
  72. package/lib/dist/workflows/executor.js.map +1 -1
  73. package/lib/dist/workflows/runners/bash.d.ts.map +1 -1
  74. package/lib/dist/workflows/runners/bash.js +14 -1
  75. package/lib/dist/workflows/runners/bash.js.map +1 -1
  76. package/lib/node_modules/.package-lock.json +1 -1
  77. package/lib/package.json +1 -1
  78. package/package.json +1 -1
  79. package/lib/dist/server/chat/classify.js +0 -130
  80. package/lib/dist/server/routes/chat-answer.js +0 -499
  81. package/lib/dist/server/routes/chat.js +0 -144
  82. package/lib/dist/ui/assets/index-CpBBlEO2.js +0 -51
@@ -1,144 +0,0 @@
1
- /**
2
- * POST /api/chat (REQ-DASH-CHAT-001).
3
- *
4
- * The dashboard chat's server endpoint. It answers a free-form question
5
- * **deterministically from the project's own indexed knowledge base** — the
6
- * code graph, specs, and domain facts — with **no language model and no
7
- * network call** (A2). All the answering logic lives in the pure, Fastify-free
8
- * core (`chat-answer.ts`) so determinism / no-LLM is unit-testable in isolation;
9
- * this file is only the HTTP shell.
10
- *
11
- * Project-scoped like the spec / domain / maintainability routes: chat answers
12
- * come from one project's graph + spec layer, so the handler resolves the
13
- * active instance and 409s when no project is selectable (mirrors
14
- * `domain.ts`). Driven entirely through instance methods via the core, so the
15
- * server never runtime-imports the `@specship/specship` package (which would
16
- * silently serve a stale build).
17
- *
18
- * The question is routed by the deterministic, I/O-free classifier
19
- * (`../chat/classify.ts`, REQ-DASH-CHAT-002) to the matching knowledge-base
20
- * query via `answerForIntent`. Two shapes are served:
21
- *
22
- * - `POST /api/chat` — returns the fully-composed answer in one JSON response.
23
- * - `GET /api/chat/stream` — faux-streams the SAME answer as a paced SSE
24
- * event sequence (REQ-DASH-CHAT-003): the full answer is computed first,
25
- * then emitted as `thinking` → `tool` → `result_summary` → `chunk`… →
26
- * `done`. The chunking is presentation pacing only; a client disconnect ends
27
- * the stream cleanly without throwing (A4).
28
- */
29
- import { writeSseHead } from './sse.js';
30
- import { answerForIntent, chunkAnswer } from './chat-answer.js';
31
- import { classifyIntent } from '../chat/classify.js';
32
- export async function registerChatRoutes(app) {
33
- app.post('/api/chat', async (req, reply) => {
34
- const cg = await app.activeCg(req);
35
- if (!cg) {
36
- reply.code(409).send({ error: 'no project selected', code: 'no_project' });
37
- return;
38
- }
39
- const body = (req.body ?? {});
40
- const question = typeof body.question === 'string' ? body.question.trim() : '';
41
- if (question.length === 0) {
42
- reply.code(400).send({ error: 'question is required', code: 'bad_request' });
43
- return;
44
- }
45
- const classified = classifyIntent(question);
46
- const { found, answer, sources } = answerForIntent(cg, classified);
47
- return { found, answer, sources };
48
- });
49
- // ---------------------------------------------------------------------------
50
- // GET /api/chat/stream (REQ-DASH-CHAT-003) — the faux-streaming variant.
51
- //
52
- // GET + SSE so the browser's native `EventSource` (via ApiService) drives it.
53
- // The answer is composed in full BEFORE the first chunk is written (A3), then
54
- // paced out as named events. Writes go straight to `reply.raw` and the handler
55
- // returns without awaiting the pacing — mirrors `events.ts`; the setTimeout
56
- // chain keeps writing after the handler resolves and `reply.raw.end()` closes
57
- // the stream after the `done` sentinel. Every write is guarded so a client
58
- // disconnect (which flips `closed` and clears the timer) ends cleanly (A4).
59
- // ---------------------------------------------------------------------------
60
- app.get('/api/chat/stream', async (req, reply) => {
61
- const cg = await app.activeCg(req);
62
- if (!cg) {
63
- reply.code(409).send({ error: 'no project selected', code: 'no_project' });
64
- return;
65
- }
66
- const q = req.query?.question;
67
- const question = typeof q === 'string' ? q.trim() : '';
68
- if (question.length === 0) {
69
- reply.code(400).send({ error: 'question is required', code: 'bad_request' });
70
- return;
71
- }
72
- // Compose the whole answer up front — chunk boundaries/pacing below affect
73
- // presentation only, never content (A3).
74
- const classified = classifyIntent(question);
75
- const { found, answer, sources } = answerForIntent(cg, classified);
76
- const chunks = chunkAnswer(answer);
77
- const tool = toolForIntent(classified);
78
- writeSseHead(req, reply);
79
- let closed = false;
80
- let timer;
81
- const write = (event, data) => {
82
- if (closed)
83
- return;
84
- try {
85
- reply.raw.write(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
86
- }
87
- catch {
88
- /* peer gone — stop writing */
89
- }
90
- };
91
- // A client disconnect ends the stream cleanly: stop the pacing, write no more.
92
- req.raw.on('close', () => {
93
- closed = true;
94
- if (timer)
95
- clearTimeout(timer);
96
- });
97
- // Pre-chunk events, in the order the spec fixes (A1).
98
- write('thinking', { started: true });
99
- write('tool', { name: tool.name, input: tool.input });
100
- write('result_summary', { found, sourceCount: sources.length });
101
- // Pace the answer chunks, then the terminal `done` sentinel.
102
- let idx = 0;
103
- const step = () => {
104
- if (closed)
105
- return;
106
- if (idx >= chunks.length) {
107
- write('done', { found, sources });
108
- if (!closed) {
109
- try {
110
- reply.raw.end();
111
- }
112
- catch { /* already closed */ }
113
- }
114
- return;
115
- }
116
- write('chunk', { text: chunks[idx] });
117
- idx += 1;
118
- timer = setTimeout(step, CHUNK_PACING_MS);
119
- };
120
- step();
121
- });
122
- }
123
- /** Inter-chunk delay for the faux-stream — small, presentation-only pacing. */
124
- const CHUNK_PACING_MS = 24;
125
- /**
126
- * The truthful tool-call the answer came from (REQ-DASH-CHAT-004.A2) — the
127
- * capability name the UI renders in its tool card, plus the real query input.
128
- * Maps each classified intent to the specship capability that answered it; the
129
- * input is the classifier's own query so the card reflects what actually ran.
130
- */
131
- function toolForIntent(classified) {
132
- const input = classified.query.trim();
133
- switch (classified.intent) {
134
- case 'callers': return { name: 'specship_callers', input };
135
- case 'callees': return { name: 'specship_callees', input };
136
- case 'impact': return { name: 'specship_impact', input };
137
- case 'spec': return { name: 'specship_spec', input };
138
- case 'domain': return { name: 'specship_spec', input };
139
- case 'drift': return { name: 'specship_drifted', input };
140
- case 'explore': return { name: 'specship_explore', input };
141
- case 'search':
142
- default: return { name: 'specship_search', input };
143
- }
144
- }