@thinksoftai/cli 1.0.2 → 1.0.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.
package/dist/commands/create.js
CHANGED
|
@@ -41,9 +41,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
exports.create = create;
|
|
43
43
|
const ora_1 = __importDefault(require("ora"));
|
|
44
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
44
45
|
const api = __importStar(require("../utils/api"));
|
|
45
46
|
const config = __importStar(require("../utils/config"));
|
|
46
47
|
const logger = __importStar(require("../utils/logger"));
|
|
48
|
+
const aiContext_1 = require("../utils/aiContext");
|
|
47
49
|
async function create(description, options) {
|
|
48
50
|
if (!config.isLoggedIn()) {
|
|
49
51
|
logger.error('Not logged in');
|
|
@@ -95,11 +97,60 @@ async function create(description, options) {
|
|
|
95
97
|
logger.newLine();
|
|
96
98
|
logger.info(`Tables created: ${app.tables.map((t) => t.name).join(', ')}`);
|
|
97
99
|
}
|
|
100
|
+
const appId = app.app_id || app.short_id;
|
|
101
|
+
// Auto-initialize project (create thinksoft.json)
|
|
102
|
+
logger.newLine();
|
|
103
|
+
if (config.projectConfigExists()) {
|
|
104
|
+
// Ask user if they want to connect to new app
|
|
105
|
+
const existing = config.getProjectConfig();
|
|
106
|
+
const { connect } = await inquirer_1.default.prompt([{
|
|
107
|
+
type: 'confirm',
|
|
108
|
+
name: 'connect',
|
|
109
|
+
message: `thinksoft.json exists (app: ${existing?.appId}). Connect to new app ${appId}?`,
|
|
110
|
+
default: false
|
|
111
|
+
}]);
|
|
112
|
+
if (connect) {
|
|
113
|
+
config.saveProjectConfig({
|
|
114
|
+
appId,
|
|
115
|
+
name: app.name,
|
|
116
|
+
outputDir: 'dist'
|
|
117
|
+
});
|
|
118
|
+
logger.success('Project connected to new app');
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
logger.info(`To connect later: thinksoft init --app ${appId}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
// Auto-create thinksoft.json
|
|
126
|
+
config.saveProjectConfig({
|
|
127
|
+
appId,
|
|
128
|
+
name: app.name,
|
|
129
|
+
outputDir: 'dist'
|
|
130
|
+
});
|
|
131
|
+
logger.success('Project initialized (thinksoft.json created)');
|
|
132
|
+
}
|
|
133
|
+
// Generate AI context files
|
|
134
|
+
const { files } = (0, aiContext_1.generateAIContextFiles)({
|
|
135
|
+
appId,
|
|
136
|
+
name: app.name,
|
|
137
|
+
description: app.description,
|
|
138
|
+
tables: app.tables
|
|
139
|
+
});
|
|
140
|
+
logger.success(`AI context files created (${files.join(', ')})`);
|
|
141
|
+
logger.info('Tip: Open CONTEXT.md in Cursor/Claude for AI-assisted development');
|
|
142
|
+
// Get first table name for SDK example
|
|
143
|
+
const exampleTable = app.tables?.[0]?.name?.toLowerCase().replace(/\s+/g, '_') || 'items';
|
|
98
144
|
logger.newLine();
|
|
99
145
|
logger.info('Next steps:');
|
|
100
|
-
logger.log(' 1. Create your frontend
|
|
101
|
-
logger.log(
|
|
102
|
-
logger.log(' 3.
|
|
103
|
-
logger.
|
|
146
|
+
logger.log(' 1. Create your frontend (React, Vue, Next.js, etc.)');
|
|
147
|
+
logger.log(' 2. Install SDK: npm install @thinksoftai/sdk');
|
|
148
|
+
logger.log(' 3. Use in your code:');
|
|
149
|
+
logger.newLine();
|
|
150
|
+
logger.log(` import { ThinkSoft } from '@thinksoftai/sdk'`);
|
|
151
|
+
logger.log(` const client = new ThinkSoft({ appId: '${appId}' })`);
|
|
152
|
+
logger.log(` const { data } = await client.${exampleTable}.list()`);
|
|
153
|
+
logger.newLine();
|
|
154
|
+
logger.log(' 4. Build & deploy: npm run build && thinksoft deploy');
|
|
104
155
|
}
|
|
105
156
|
//# sourceMappingURL=create.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASH,wBA6HC;AApID,8CAAqB;AACrB,wDAA+B;AAC/B,kDAAmC;AACnC,wDAAyC;AACzC,wDAAyC;AACzC,kDAA2D;AAEpD,KAAK,UAAU,MAAM,CAAC,WAAmB,EAAE,OAA0B;IAC1E,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;QACzB,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;QAC7B,MAAM,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAA;QACpD,OAAM;IACR,CAAC;IAED,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC;QACxC,MAAM,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;QAC3C,MAAM,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAA;QAC7D,OAAM;IACR,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,IAAI,SAAS,CAAA;IAEzC,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAA;IACnC,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,CAAA;IAC3C,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,MAAM,CAAC,OAAO,EAAE,CAAA;IAEhB,MAAM,OAAO,GAAG,IAAA,aAAG,EAAC,uDAAuD,CAAC,CAAC,KAAK,EAAE,CAAA;IAEpF,MAAM,MAAM,GAAQ,MAAM,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;IAE7D,IAAI,MAAM,CAAC,KAAK,EA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AAC,CAAA;IACvE,MAAM,CAAC,OAAO,EAAE,CAAA;IAChB,MAAM,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAA;AACtE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Context Generator - Creates files for AI coding assistants
|
|
3
|
+
*/
|
|
4
|
+
interface AppInfo {
|
|
5
|
+
appId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
tables?: Array<{
|
|
9
|
+
name: string;
|
|
10
|
+
fields?: Array<{
|
|
11
|
+
name: string;
|
|
12
|
+
type: string;
|
|
13
|
+
}>;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
export declare function generateAIContextFiles(app: AppInfo): {
|
|
17
|
+
files: string[];
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AI Context Generator - Creates files for AI coding assistants
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.generateAIContextFiles = generateAIContextFiles;
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
function generateAIContextFiles(app) {
|
|
43
|
+
const generatedFiles = [];
|
|
44
|
+
const cwd = process.cwd();
|
|
45
|
+
// Generate table info
|
|
46
|
+
const tableNames = app.tables?.map(t => t.name) || [];
|
|
47
|
+
const tableSlug = (name) => name.toLowerCase().replace(/\s+/g, '_');
|
|
48
|
+
// 1. Generate CONTEXT.md
|
|
49
|
+
const contextMd = `# ThinkSoft App: ${app.name}
|
|
50
|
+
|
|
51
|
+
## App Details
|
|
52
|
+
- **App ID:** ${app.appId}
|
|
53
|
+
- **Description:** ${app.description || 'N/A'}
|
|
54
|
+
- **Admin UI:** https://thinksoftai.com/app/${app.appId}
|
|
55
|
+
- **Deploy URL:** https://${app.appId.toLowerCase()}.thinksoftai.com
|
|
56
|
+
- **API Base:** https://api.thinksoftai.com/v1/apps/${app.appId}
|
|
57
|
+
|
|
58
|
+
## Tables/Schema
|
|
59
|
+
${tableNames.map(name => `- **${name}** → \`client.${tableSlug(name)}\``).join('\n')}
|
|
60
|
+
|
|
61
|
+
## SDK Installation
|
|
62
|
+
\`\`\`bash
|
|
63
|
+
npm install @thinksoftai/sdk
|
|
64
|
+
\`\`\`
|
|
65
|
+
|
|
66
|
+
## SDK Usage
|
|
67
|
+
\`\`\`typescript
|
|
68
|
+
import { ThinkSoft } from '@thinksoftai/sdk'
|
|
69
|
+
|
|
70
|
+
const client = new ThinkSoft({ appId: '${app.appId}' })
|
|
71
|
+
|
|
72
|
+
// List all records
|
|
73
|
+
const { data } = await client.${tableSlug(tableNames[0] || 'items')}.list()
|
|
74
|
+
|
|
75
|
+
// Create a record
|
|
76
|
+
await client.${tableSlug(tableNames[0] || 'items')}.create({
|
|
77
|
+
// your data here
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
// Get single record
|
|
81
|
+
await client.${tableSlug(tableNames[0] || 'items')}.get(id)
|
|
82
|
+
|
|
83
|
+
// Update a record
|
|
84
|
+
await client.${tableSlug(tableNames[0] || 'items')}.update(id, {
|
|
85
|
+
// updated data
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
// Delete a record
|
|
89
|
+
await client.${tableSlug(tableNames[0] || 'items')}.delete(id)
|
|
90
|
+
\`\`\`
|
|
91
|
+
|
|
92
|
+
## Available Tables & Operations
|
|
93
|
+
${tableNames.map(name => `
|
|
94
|
+
### ${name}
|
|
95
|
+
\`\`\`typescript
|
|
96
|
+
client.${tableSlug(name)}.list() // Get all ${name.toLowerCase()}
|
|
97
|
+
client.${tableSlug(name)}.create({}) // Create new ${name.toLowerCase()}
|
|
98
|
+
client.${tableSlug(name)}.get(id) // Get by ID
|
|
99
|
+
client.${tableSlug(name)}.update(id, {}) // Update by ID
|
|
100
|
+
client.${tableSlug(name)}.delete(id) // Delete by ID
|
|
101
|
+
\`\`\`
|
|
102
|
+
`).join('')}
|
|
103
|
+
|
|
104
|
+
## Build & Deploy
|
|
105
|
+
\`\`\`bash
|
|
106
|
+
npm run build
|
|
107
|
+
thinksoft deploy
|
|
108
|
+
\`\`\`
|
|
109
|
+
|
|
110
|
+
## Useful Commands
|
|
111
|
+
\`\`\`bash
|
|
112
|
+
thinksoft apps # List your apps
|
|
113
|
+
thinksoft open # Open app in browser
|
|
114
|
+
thinksoft whoami # Check logged in user
|
|
115
|
+
\`\`\`
|
|
116
|
+
`;
|
|
117
|
+
fs.writeFileSync(path.join(cwd, 'CONTEXT.md'), contextMd);
|
|
118
|
+
generatedFiles.push('CONTEXT.md');
|
|
119
|
+
// 2. Generate .cursorrules
|
|
120
|
+
const cursorrules = `# ThinkSoft App: ${app.name}
|
|
121
|
+
# App ID: ${app.appId}
|
|
122
|
+
|
|
123
|
+
You are helping build a frontend for a ThinkSoft backend application.
|
|
124
|
+
|
|
125
|
+
## Backend Info
|
|
126
|
+
- This app uses ThinkSoft as the backend (database, API, auth, hosting)
|
|
127
|
+
- App ID: ${app.appId}
|
|
128
|
+
- Tables: ${tableNames.join(', ')}
|
|
129
|
+
|
|
130
|
+
## SDK Usage
|
|
131
|
+
Always use @thinksoftai/sdk for data operations:
|
|
132
|
+
|
|
133
|
+
\`\`\`typescript
|
|
134
|
+
import { ThinkSoft } from '@thinksoftai/sdk'
|
|
135
|
+
const client = new ThinkSoft({ appId: '${app.appId}' })
|
|
136
|
+
\`\`\`
|
|
137
|
+
|
|
138
|
+
## Available Data Operations
|
|
139
|
+
${tableNames.map(name => `- client.${tableSlug(name)}.list() / .create() / .get(id) / .update(id, data) / .delete(id)`).join('\n')}
|
|
140
|
+
|
|
141
|
+
## Rules
|
|
142
|
+
1. Use the ThinkSoft SDK for all CRUD operations
|
|
143
|
+
2. Do not create mock data - use real API calls
|
|
144
|
+
3. Handle loading and error states
|
|
145
|
+
4. Use TypeScript for type safety
|
|
146
|
+
5. Build output should go to 'dist' folder
|
|
147
|
+
|
|
148
|
+
## Deploy
|
|
149
|
+
After building, deploy with: thinksoft deploy
|
|
150
|
+
`;
|
|
151
|
+
fs.writeFileSync(path.join(cwd, '.cursorrules'), cursorrules);
|
|
152
|
+
generatedFiles.push('.cursorrules');
|
|
153
|
+
// 3. Generate thinksoft-prompt.txt
|
|
154
|
+
const promptTxt = `I'm building a frontend for a ThinkSoft backend application.
|
|
155
|
+
|
|
156
|
+
APP DETAILS:
|
|
157
|
+
- Name: ${app.name}
|
|
158
|
+
- App ID: ${app.appId}
|
|
159
|
+
- Description: ${app.description || 'N/A'}
|
|
160
|
+
|
|
161
|
+
AVAILABLE TABLES:
|
|
162
|
+
${tableNames.map(name => `- ${name} (use client.${tableSlug(name)})`).join('\n')}
|
|
163
|
+
|
|
164
|
+
SDK SETUP:
|
|
165
|
+
\`\`\`
|
|
166
|
+
npm install @thinksoftai/sdk
|
|
167
|
+
|
|
168
|
+
import { ThinkSoft } from '@thinksoftai/sdk'
|
|
169
|
+
const client = new ThinkSoft({ appId: '${app.appId}' })
|
|
170
|
+
\`\`\`
|
|
171
|
+
|
|
172
|
+
CRUD OPERATIONS:
|
|
173
|
+
${tableNames.map(name => `
|
|
174
|
+
${name}:
|
|
175
|
+
- client.${tableSlug(name)}.list() - Get all
|
|
176
|
+
- client.${tableSlug(name)}.create({ ... }) - Create new
|
|
177
|
+
- client.${tableSlug(name)}.get(id) - Get by ID
|
|
178
|
+
- client.${tableSlug(name)}.update(id, { ... }) - Update
|
|
179
|
+
- client.${tableSlug(name)}.delete(id) - Delete
|
|
180
|
+
`).join('')}
|
|
181
|
+
|
|
182
|
+
DEPLOYMENT:
|
|
183
|
+
After building (npm run build), deploy with: thinksoft deploy
|
|
184
|
+
The app will be live at: https://${app.appId.toLowerCase()}.thinksoftai.com
|
|
185
|
+
|
|
186
|
+
Please help me build a React/Vue/Next.js frontend for this application.
|
|
187
|
+
`;
|
|
188
|
+
fs.writeFileSync(path.join(cwd, 'thinksoft-prompt.txt'), promptTxt);
|
|
189
|
+
generatedFiles.push('thinksoft-prompt.txt');
|
|
190
|
+
return { files: generatedFiles };
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=aiContext.js.map
|
|
@@ -0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