needware-cli 1.5.21 → 1.5.22

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.
@@ -1 +1 @@
1
- {"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/commands/system-prompt.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,UAAU,cAAc;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAoKD,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,cAAc,GACxB,MAAM,CA+YR"}
1
+ {"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/commands/system-prompt.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,UAAU,cAAc;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,cAAc,GACxB,MAAM,CA8YR"}
@@ -1,163 +1,6 @@
1
1
  /**
2
2
  * System prompt for Agent command
3
3
  */
4
- function getDatabaseInstructions(supabase) {
5
- const hasSupabaseProject = supabase?.hasSelectedProject && supabase?.projectId && supabase?.publishableKey;
6
- if (!hasSupabaseProject && !supabase) {
7
- return `
8
- ## Database Instructions
9
-
10
- CRITICAL: Use Supabase for databases by default, unless specified otherwise. Supabase can provide login, register, database query, authorization, storage, Edge Functions etc.
11
-
12
- Supabase project setup handled separately by user!
13
- `;
14
- }
15
- if (supabase && !supabase.hasSelectedProject) {
16
- return `
17
- ## Database Instructions
18
-
19
- CRITICAL: Use Supabase for databases by default, unless specified otherwise. Supabase can provide login, register, database query, authorization, storage, Edge Functions etc.
20
-
21
- Supabase project setup handled separately by user! No project selected. Remind user to select project in chat box.
22
- `;
23
- }
24
- const envConfig = hasSupabaseProject && supabase.url
25
- ? ` with:
26
- VITE_SUPABASE_PROJECT_ID="${supabase.projectId}"
27
- VITE_SUPABASE_PUBLISHABLE_KEY="${supabase.publishableKey}"
28
- VITE_SUPABASE_URL="${supabase.url}"`
29
- : '.';
30
- return `
31
- ## Database Instructions
32
-
33
- CRITICAL: Use Supabase for databases by default, unless specified otherwise. Supabase can provide login, register, database query, authorization, storage, Edge Functions etc.
34
-
35
- Create .env file if it doesn't exist${envConfig}
36
-
37
- ### IMPORTANT: If user says "Enable Cloud" or asks to initialize Supabase:
38
-
39
- You MUST immediately perform these steps WITHOUT asking for clarification:
40
-
41
- 1. **Install Supabase client** (if not already installed):
42
- Run: \`pnpm add @supabase/supabase-js\`
43
-
44
- 2. **Create/Update .env file** with project credentials:
45
- \`\`\`
46
- VITE_SUPABASE_PROJECT_ID=${supabase.projectId}
47
- VITE_SUPABASE_PUBLISHABLE_KEY=${supabase.publishableKey}
48
- VITE_SUPABASE_URL=${supabase.url}
49
- \`\`\`
50
-
51
- 3. **Create Supabase client file** at \`src/lib/supabase.ts\`:
52
- \`\`\`typescript
53
- import { createClient } from '@supabase/supabase-js';
54
-
55
- const supabaseUrl = import.meta.env.VITE_SUPABASE_URL;
56
- const supabaseKey = import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY;
57
-
58
- if (!supabaseUrl || !supabaseKey) {
59
- throw new Error('Missing Supabase environment variables');
60
- }
61
-
62
- export const supabase = createClient(supabaseUrl, supabaseKey);
63
- \`\`\`
64
-
65
- 4. **Create migrations directory**: \`supabase/migrations/\` (if not exists)
66
-
67
- 5. **Inform user** that Supabase is now initialized and ready to use
68
-
69
- ### DATA PRESERVATION REQUIREMENTS:
70
- - DATA INTEGRITY IS HIGHEST PRIORITY - users must NEVER lose data
71
- - FORBIDDEN: Destructive operations (DROP, DELETE) that could cause data loss
72
- - FORBIDDEN: Transaction control (BEGIN, COMMIT, ROLLBACK, END)
73
- Note: DO $$ BEGIN ... END $$ blocks (PL/pgSQL) are allowed
74
-
75
- ### SQL Migrations - CRITICAL:
76
- For EVERY database change, create a migration file in /supabase/migrations/ directory:
77
-
78
- 1. Create a new .sql file with descriptive name (e.g., create_users_table.sql)
79
- 2. Write complete SQL migration content with comments
80
- 3. Include safety checks (IF EXISTS/IF NOT EXISTS)
81
- 4. Always enable RLS and add appropriate policies
82
-
83
- ### Migration Rules:
84
- - NEVER use diffs, ALWAYS provide COMPLETE file content
85
- - Create new migration file for each change in /home/project/supabase/migrations
86
- - NEVER update existing migration files
87
- - Descriptive names without number prefix (e.g., create_users.sql)
88
- - ALWAYS enable RLS: \`alter table users enable row level security;\`
89
- - Add appropriate RLS policies for CRUD operations
90
- - Use default values: DEFAULT false/true, DEFAULT 0, DEFAULT '', DEFAULT now()
91
- - Start with markdown summary in multi-line comment explaining changes
92
- - Use IF EXISTS/IF NOT EXISTS for safe operations
93
-
94
- ### Migration Example:
95
- \`\`\`sql
96
- /*
97
- # Create users table
98
- 1. New Tables: users (id uuid, email text, created_at timestamp)
99
- 2. Security: Enable RLS, add read policy for authenticated users
100
- */
101
- CREATE TABLE IF NOT EXISTS users (
102
- id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
103
- email text UNIQUE NOT NULL,
104
- created_at timestamptz DEFAULT now()
105
- );
106
- ALTER TABLE users ENABLE ROW LEVEL SECURITY;
107
- CREATE POLICY "Users read own data" ON users FOR SELECT TO authenticated USING (auth.uid() = id);
108
- \`\`\`
109
-
110
- ### Client Setup:
111
- - Use @supabase/supabase-js
112
- - Create singleton client instance in \`src/lib/supabase.ts\`
113
- - Use environment variables: VITE_SUPABASE_URL and VITE_SUPABASE_PUBLISHABLE_KEY
114
- - Example client setup:
115
- \`\`\`typescript
116
- import { createClient } from '@supabase/supabase-js';
117
-
118
- const supabaseUrl = import.meta.env.VITE_SUPABASE_URL;
119
- const supabaseKey = import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY;
120
-
121
- export const supabase = createClient(supabaseUrl, supabaseKey);
122
- \`\`\`
123
-
124
- ### Authentication:
125
- - ALWAYS use email/password signup
126
- - FORBIDDEN: magic links, social providers, SSO (unless explicitly stated)
127
- - FORBIDDEN: custom auth systems, ALWAYS use Supabase's built-in auth
128
- - Email confirmation ALWAYS disabled unless stated
129
-
130
- ### User Profiles:
131
- - ALWAYS create public.profiles table linked to auth.users
132
- - Use: \`user_id uuid REFERENCES auth.users(id) ON DELETE CASCADE UNIQUE NOT NULL\`
133
- - Include common fields: username, avatar_url, created_at, updated_at
134
- - Create trigger to auto-insert profile on user signup (INSERT INTO profiles on auth.users INSERT)
135
-
136
- ### Storage (If the user needs):
137
- - Use Supabase Storage for file uploads (images, documents, etc.)
138
- - Create buckets in migrations: \`INSERT INTO storage.buckets (id, name, public) VALUES ('avatars', 'avatars', true)\`
139
- - ALWAYS add RLS policies for storage.objects table with bucket_id filter
140
- - Common operations: .upload(), .download(), .getPublicUrl(), .remove(), .list()
141
- - Organize files with user ID prefix: '{userId}/filename' for private files
142
-
143
- ### Edge Functions (If the user needs):
144
- - Use Supabase Edge Functions for server-side logic, background tasks, webhooks, and API integrations
145
- - Create functions in /supabase/functions/<function-name>/index.ts
146
- - Use Deno runtime with TypeScript support
147
- - Import from: 'https://esm.sh/@supabase/supabase-js@2' for Supabase client
148
- - Access environment variables via Deno.env.get('VARIABLE_NAME')
149
- - Invoke from client: supabase.functions.invoke('function-name', { body: { ... } })
150
- - Common use cases: webhooks, scheduled jobs, third-party API calls, complex business logic
151
- - Return Response object: new Response(JSON.stringify(data), { headers: { 'Content-Type': 'application/json' } })
152
-
153
- ### Security:
154
- - ALWAYS enable RLS for every new table
155
- - Create policies based on user authentication
156
- - One migration per logical change
157
- - Use descriptive policy names
158
- - Add indexes for frequently queried columns
159
- `;
160
- }
161
4
  export function getSystemPrompt(workingDir, supabase) {
162
5
  return `
163
6
  ## Working Directory Context
@@ -194,7 +37,6 @@ CRITICAL SECURITY RULES:
194
37
  - FORBIDDEN: Spawning daemon processes or background jobs
195
38
  - You may run standard development commands (pnpm, node, etc.) but NEVER manage system processes
196
39
 
197
- ${getDatabaseInstructions(supabase)}
198
40
 
199
41
  ## Project Structure
200
42
 
@@ -1 +1 @@
1
- {"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/commands/system-prompt.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,SAAS,uBAAuB,CAAC,QAAyB;IACxD,MAAM,kBAAkB,GAAG,QAAQ,EAAE,kBAAkB,IAAI,QAAQ,EAAE,SAAS,IAAI,QAAQ,EAAE,cAAc,CAAC;IAE3G,IAAI,CAAC,kBAAkB,IAAI,CAAC,QAAQ,EAAE,CAAC;QACrC,OAAO;;;;;;CAMV,CAAC;IACA,CAAC;IAED,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC;QAC7C,OAAO;;;;;;CAMV,CAAC;IACA,CAAC;IAED,MAAM,SAAS,GAAG,kBAAkB,IAAI,QAAQ,CAAC,GAAG;QAClD,CAAC,CAAC;8BACwB,QAAQ,CAAC,SAAS;mCACb,QAAQ,CAAC,cAAc;uBACnC,QAAQ,CAAC,GAAG,GAAG;QAClC,CAAC,CAAC,GAAG,CAAC;IAER,OAAO;;;;;sCAK6B,SAAS;;;;;;;;;;;8BAWjB,QAAQ,CAAC,SAAS;mCACb,QAAQ,CAAC,cAAc;uBACnC,QAAQ,CAAC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+GlC,CAAC;AACF,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,UAAkB,EAClB,QAAyB;IAEzB,OAAO;;;+CAGsC,UAAU;;wEAEe,UAAU;;;;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C;AACnB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "needware-cli",
3
- "version": "1.5.21",
3
+ "version": "1.5.22",
4
4
  "description": "一个功能强大的 Node.js 命令行工具",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",