@taj-special/dravix-code 1.1.9 → 1.1.11

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 (2) hide show
  1. package/dist/cli/repl.js +4 -95
  2. package/package.json +1 -1
package/dist/cli/repl.js CHANGED
@@ -2,93 +2,14 @@ import * as fs from 'fs';
2
2
  import * as path from 'path';
3
3
  import * as os from 'os';
4
4
  import chalk from 'chalk';
5
- import { streamChat, fetchSystemPrompt, FLASH_MODEL, PRO_MODEL } from '../services/ai.js';
5
+ import { streamChat, fetchSystemPrompt, FLASH_MODEL } from '../services/ai.js';
6
6
  import { buildContext } from '../services/context.js';
7
7
  import { parseOps, executeSingleOp, computeDiff } from '../services/executor.js';
8
8
  import { handleCommand } from './commands.js';
9
9
  import { printOpResult, printError, printInfo, colors } from '../utils/display.js';
10
10
  import { saveConversation, loadConversation, listConversations, generateTitle, generateId } from '../services/conversations.js';
11
- import { getToken, getSavedUser } from '../services/auth.js';
11
+ import { getToken } from '../services/auth.js';
12
12
  import { checkUsage, reportUsage, estimateTokens, usageBar, fmtNum, formatResetTime } from '../services/usage.js';
13
- // System prompt is fetched from server at runtime — not stored in this package
14
- const BASE_PROMPT = ``;
15
- // Critical behavioral rules — always injected into system prompt for every session
16
- const BEHAVIORAL_RULES = `
17
-
18
- ## EXECUTE IMMEDIATELY — never ask what to do, never explain before acting.
19
-
20
- ## FILE OPERATIONS — use these exact tag formats:
21
-
22
- ### READ a file (when content not yet provided):
23
- <read_file path="filename"/>
24
-
25
- ### CHANGE something:
26
- <edit_file path="file.js">
27
- <find>
28
- exact old text copied from file
29
- </find>
30
- <replace>
31
- new text goes here
32
- </replace>
33
- </edit_file>
34
-
35
- ### DELETE something — <replace> tag is COMPLETELY EMPTY, no spaces, no newlines inside:
36
- <edit_file path="file.js">
37
- <find>
38
- exact text to remove copied from file
39
- </find>
40
- <replace></replace>
41
- </edit_file>
42
-
43
- ### CREATE or fully rewrite a file:
44
- <write_file path="file.js">
45
- full file content here
46
- </write_file>
47
-
48
- ### RUN a command:
49
- <run_command>command here</run_command>
50
-
51
- ### ACTIVATE Web Designer mode — MANDATORY before building any website, UI, or HTML file:
52
- BEFORE writing any HTML/CSS/JS, you MUST output this tag first:
53
- <design_mode>
54
- Modern responsive layout
55
- Clean typography and spacing
56
- Professional color palette
57
- Smooth animations and transitions
58
- Mobile-first design
59
- </design_mode>
60
- List design features relevant to the project inside the tag. Only after this tag, proceed to build with <write_file>.
61
-
62
- ## RULES:
63
- - File content labeled [File: name — FULL] is already provided — use it, do NOT read again.
64
- - Copy <find> text CHARACTER BY CHARACTER from the actual file — never write from memory.
65
- - Include enough surrounding lines so <find> matches exactly ONE location.
66
- - DELETE = <replace></replace> with nothing inside — if you put anything inside, it is NOT a delete.
67
- - "Found N identical occurrences" → add more lines to <find> until it is unique.
68
-
69
- ## PERSONALITY & COMMUNICATION:
70
- - Be warm, friendly, and professional — like a skilled teammate who enjoys the work.
71
- - Before acting: one short sentence saying what you are about to do — write it in the SAME language the user used.
72
- - After acting: confirm what was done in a natural, friendly tone — in the SAME language the user used.
73
- - If the task is interesting or you notice something worth mentioning (a side effect, a tip, a related thing), say it briefly.
74
- - CRITICAL: Detect the user's language from their message and use that EXACT language for your entire response. Tajik → Tajik. Russian → Russian. English → English. This applies to ALL messages including when doing file operations.`;
75
- // Full prompt used when server returns empty
76
- const FALLBACK_PROMPT = `You are Dravix Code — a hyper-professional AI coding assistant running in the terminal.
77
- You are an elite software engineer who takes immediate, precise action on every request.
78
-
79
- Core identity:
80
- - You write production-quality code with no unnecessary comments or fluff
81
- - You take action first, explain only when absolutely necessary
82
- - You handle any language: TypeScript, JavaScript, Python, Go, Rust, HTML/CSS, SQL, and more
83
- - You work on any project type: web apps, mobile apps, CLIs, APIs, databases, scripts
84
-
85
- ${BEHAVIORAL_RULES}`;
86
- // prompts removed
87
- // Removed — fetched from server
88
- const CREATOR_EXTRA = ``;
89
- // Removed — fetched from server at runtime
90
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
91
- function buildSystemPrompt(_userEmail) { return BASE_PROMPT; }
92
13
  let _serverWebDesignerSkill = '';
93
14
  const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
94
15
  const SLASH_COMMANDS = [
@@ -2206,21 +2127,13 @@ async function showDesignModeLoader(skills) {
2206
2127
  }
2207
2128
  export async function startRepl(cwd) {
2208
2129
  const alwaysAllowed = new Set();
2209
- const { email: userEmail } = getSavedUser();
2210
- // Fetch system prompt from server — never stored in package
2211
2130
  const token = getToken() ?? '';
2212
2131
  let SYSTEM_PROMPT = '';
2213
2132
  if (token) {
2214
2133
  const { prompt, webDesignerSkill } = await fetchSystemPrompt(token);
2215
- // Always inject behavioral rules — append to server prompt so critical rules are never missing
2216
- SYSTEM_PROMPT = prompt
2217
- ? prompt + '\n' + BEHAVIORAL_RULES
2218
- : FALLBACK_PROMPT;
2134
+ SYSTEM_PROMPT = prompt;
2219
2135
  _serverWebDesignerSkill = webDesignerSkill;
2220
2136
  }
2221
- else {
2222
- SYSTEM_PROMPT = FALLBACK_PROMPT;
2223
- }
2224
2137
  // activeCwd can change when /resume loads a conversation from a different directory
2225
2138
  let activeCwd = cwd;
2226
2139
  const buildSystemMsg = (dir) => ({
@@ -2241,7 +2154,6 @@ export async function startRepl(cwd) {
2241
2154
  let pendingOutputTokens = 0;
2242
2155
  let pendingUserTokens = 0;
2243
2156
  let hasPendingReport = false;
2244
- let useProModel = false; // switched to PRO_MODEL after file op errors
2245
2157
  process.stdin.once('end', () => {
2246
2158
  console.log(colors.muted('\n Goodbye!\n'));
2247
2159
  process.exit(0);
@@ -2394,7 +2306,6 @@ export async function startRepl(cwd) {
2394
2306
  if (!skipInput) {
2395
2307
  readFileTurnCount = 0; // reset loop counter for each new user message
2396
2308
  forcedEditMode = false; // reset forced edit mode for each new user message
2397
- useProModel = false; // reset model selection for each new user message
2398
2309
  // ── Refresh project context (files may have changed since last turn) ──
2399
2310
  history[0] = buildSystemMsg(activeCwd);
2400
2311
  // ── Clear stale operational messages left from previous auto-continue turns ──
@@ -2843,7 +2754,6 @@ export async function startRepl(cwd) {
2843
2754
  if (inlineFileOpErrors.length > 0) {
2844
2755
  history.push({ role: 'system', content: inlineFileOpErrors.join('\n\n') + '\n\nFix the above errors and retry the failed operations.' });
2845
2756
  readFileContinue = true;
2846
- useProModel = true;
2847
2757
  }
2848
2758
  const allOps = parseOps(normalized);
2849
2759
  // ── Detect incomplete plan: AI described steps but didn't output tags ──
@@ -3166,7 +3076,6 @@ export async function startRepl(cwd) {
3166
3076
  if (fileOpErrors.length > 0) {
3167
3077
  history.push({ role: 'system', content: fileOpErrors.join('\n\n') + '\n\nFix the above errors and retry the failed operations.' });
3168
3078
  readFileContinue = true;
3169
- useProModel = true;
3170
3079
  }
3171
3080
  if (declinedCmds.length > 0) {
3172
3081
  const content = declinedCmds.map(cmd => `[User declined to run — ${cmd}]: User pressed No. Do not retry or ask about this command.`).join('\n\n');
@@ -3209,7 +3118,7 @@ export async function startRepl(cwd) {
3209
3118
  : raw;
3210
3119
  printError(msg);
3211
3120
  resolve();
3212
- }, streamAbort.signal, useProModel ? PRO_MODEL : FLASH_MODEL);
3121
+ }, streamAbort.signal, FLASH_MODEL);
3213
3122
  });
3214
3123
  // ── Remove streaming key listener ─────────────────────────
3215
3124
  process.stdin.removeListener('data', onStreamKey);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taj-special/dravix-code",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "description": "AI-powered coding assistant CLI — Dravix Code",
5
5
  "type": "module",
6
6
  "bin": {