@startanaicompany/cli 1.4.14 → 1.4.15
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/CLAUDE.md +2 -2
- package/package.json +1 -1
- package/src/commands/create.js +61 -1
- package/src/commands/status.js +3 -1
package/CLAUDE.md
CHANGED
|
@@ -493,7 +493,7 @@ The wrapper API expects Git repositories to be hosted on the StartAnAiCompany Gi
|
|
|
493
493
|
- During registration, Gitea username can be auto-detected or manually provided
|
|
494
494
|
- Applications reference repositories in the format: `git@git.startanaicompany.com:user/repo.git`
|
|
495
495
|
|
|
496
|
-
## Current Status - Version 1.4.
|
|
496
|
+
## Current Status - Version 1.4.15
|
|
497
497
|
|
|
498
498
|
### Completed Features
|
|
499
499
|
|
|
@@ -706,4 +706,4 @@ Before publishing to npm:
|
|
|
706
706
|
- `dotenv` - Environment variables
|
|
707
707
|
- `open` - Open browser for OAuth (v8.4.2 for compatibility with chalk v4)
|
|
708
708
|
|
|
709
|
-
**Version:** 1.4.
|
|
709
|
+
**Version:** 1.4.15 (current)
|
package/package.json
CHANGED
package/src/commands/create.js
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
const api = require('../lib/api');
|
|
6
|
-
const { isAuthenticated, saveProjectConfig, getUser } = require('../lib/config');
|
|
6
|
+
const { isAuthenticated, saveProjectConfig, getUser, getProjectConfig } = require('../lib/config');
|
|
7
7
|
const logger = require('../lib/logger');
|
|
8
8
|
const oauth = require('../lib/oauth');
|
|
9
9
|
const inquirer = require('inquirer');
|
|
10
|
+
const { execSync } = require('child_process');
|
|
10
11
|
|
|
11
12
|
async function create(name, options) {
|
|
12
13
|
try {
|
|
@@ -19,6 +20,65 @@ async function create(name, options) {
|
|
|
19
20
|
process.exit(1);
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
// Check if application already exists in this directory
|
|
24
|
+
const existingConfig = getProjectConfig();
|
|
25
|
+
if (existingConfig) {
|
|
26
|
+
logger.error('Application already published');
|
|
27
|
+
logger.newline();
|
|
28
|
+
logger.info('This directory is already linked to an application:');
|
|
29
|
+
if (existingConfig.applicationName) {
|
|
30
|
+
logger.field('Name', existingConfig.applicationName);
|
|
31
|
+
}
|
|
32
|
+
if (existingConfig.subdomain && existingConfig.domainSuffix) {
|
|
33
|
+
const domain = `https://${existingConfig.subdomain}.${existingConfig.domainSuffix}`;
|
|
34
|
+
logger.field('Domain', domain);
|
|
35
|
+
logger.newline();
|
|
36
|
+
logger.info(`Your application should be available at: ${domain}`);
|
|
37
|
+
}
|
|
38
|
+
logger.newline();
|
|
39
|
+
logger.info('To manage this application, use:');
|
|
40
|
+
logger.log(' saac deploy Deploy changes');
|
|
41
|
+
logger.log(' saac update [options] Update configuration');
|
|
42
|
+
logger.log(' saac env set KEY=VALUE Set environment variables');
|
|
43
|
+
logger.log(' saac logs --follow View logs');
|
|
44
|
+
logger.log(' saac status Check status');
|
|
45
|
+
logger.newline();
|
|
46
|
+
logger.warn('To create a new application, use a different directory');
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Check current git branch
|
|
51
|
+
let currentBranch = null;
|
|
52
|
+
try {
|
|
53
|
+
currentBranch = execSync('git rev-parse --abbrev-ref HEAD', {
|
|
54
|
+
encoding: 'utf8',
|
|
55
|
+
stdio: ['pipe', 'pipe', 'ignore']
|
|
56
|
+
}).trim();
|
|
57
|
+
} catch (error) {
|
|
58
|
+
// Not in a git repository or git not available - continue anyway
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (currentBranch && currentBranch !== 'master' && currentBranch !== 'main') {
|
|
62
|
+
const specifiedBranch = options.branch;
|
|
63
|
+
|
|
64
|
+
if (!specifiedBranch || specifiedBranch !== currentBranch) {
|
|
65
|
+
logger.error(`You are currently on branch: ${logger.chalk.yellow(currentBranch)}`);
|
|
66
|
+
logger.newline();
|
|
67
|
+
logger.warn('This is not the master or main branch!');
|
|
68
|
+
logger.newline();
|
|
69
|
+
logger.info('If you really want to use this branch, confirm by specifying it explicitly:');
|
|
70
|
+
logger.log(` saac create ${name} -s ${options.subdomain || '<subdomain>'} -r ${options.repository || '<repository>'} --branch ${currentBranch}`);
|
|
71
|
+
logger.newline();
|
|
72
|
+
logger.info('Or switch to master/main branch:');
|
|
73
|
+
logger.log(' git checkout master');
|
|
74
|
+
logger.log(' git checkout main');
|
|
75
|
+
process.exit(1);
|
|
76
|
+
} else {
|
|
77
|
+
logger.warn(`Using branch: ${logger.chalk.yellow(currentBranch)}`);
|
|
78
|
+
logger.newline();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
22
82
|
// Validate required fields
|
|
23
83
|
if (!name) {
|
|
24
84
|
logger.error('Application name is required');
|
package/src/commands/status.js
CHANGED
|
@@ -92,12 +92,13 @@ async function status() {
|
|
|
92
92
|
const hasMore = applications.length > 5;
|
|
93
93
|
|
|
94
94
|
const data = [
|
|
95
|
-
['Name', 'Domain', 'Status', 'Created'],
|
|
95
|
+
['Name', 'Domain', 'Status', 'Branch', 'Created'],
|
|
96
96
|
];
|
|
97
97
|
|
|
98
98
|
displayApps.forEach((app) => {
|
|
99
99
|
const created = new Date(app.created_at).toLocaleDateString();
|
|
100
100
|
const status = app.status || 'unknown';
|
|
101
|
+
const branch = app.git_branch || 'unknown';
|
|
101
102
|
|
|
102
103
|
// Status with icons (handle both Coolify format and documented format)
|
|
103
104
|
let statusDisplay;
|
|
@@ -128,6 +129,7 @@ async function status() {
|
|
|
128
129
|
app.name,
|
|
129
130
|
app.domain || `${app.subdomain}.startanaicompany.com`,
|
|
130
131
|
statusDisplay,
|
|
132
|
+
branch,
|
|
131
133
|
created
|
|
132
134
|
]);
|
|
133
135
|
});
|