@axiomatic-labs/cli 1.0.0 → 1.0.1
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/bin/cli.js +13 -13
- package/lib/init.js +29 -8
- package/lib/ui.js +53 -0
- package/lib/update.js +29 -15
- package/lib/version.js +15 -9
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -18,20 +18,20 @@ switch (command) {
|
|
|
18
18
|
break;
|
|
19
19
|
case '--help':
|
|
20
20
|
case '-h':
|
|
21
|
-
case undefined:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
axiomatic
|
|
27
|
-
axiomatic
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
--
|
|
32
|
-
|
|
33
|
-
`);
|
|
21
|
+
case undefined: {
|
|
22
|
+
const ui = require('../lib/ui.js');
|
|
23
|
+
ui.banner();
|
|
24
|
+
console.log(` ${ui.BOLD}Usage:${ui.RESET}`);
|
|
25
|
+
console.log(` axiomatic ${ui.CYAN}init${ui.RESET} Install the latest template files`);
|
|
26
|
+
console.log(` axiomatic ${ui.CYAN}update${ui.RESET} Update templates to latest version`);
|
|
27
|
+
console.log(` axiomatic ${ui.CYAN}version${ui.RESET} Show version info`);
|
|
28
|
+
console.log('');
|
|
29
|
+
console.log(` ${ui.BOLD}Options:${ui.RESET}`);
|
|
30
|
+
console.log(` --version, -v Show CLI version`);
|
|
31
|
+
console.log(` --help, -h Show this help`);
|
|
32
|
+
console.log('');
|
|
34
33
|
break;
|
|
34
|
+
}
|
|
35
35
|
default:
|
|
36
36
|
console.error(`Unknown command: ${command}`);
|
|
37
37
|
console.error('Run "axiomatic --help" for usage.');
|
package/lib/init.js
CHANGED
|
@@ -4,31 +4,38 @@ const { execSync } = require('child_process');
|
|
|
4
4
|
const { requireAuth } = require('./auth.js');
|
|
5
5
|
const { getLatestRelease, downloadReleaseAsset } = require('./download.js');
|
|
6
6
|
const { writeLocalVersion } = require('./version.js');
|
|
7
|
+
const { TEMPLATE_SKILLS, TEMPLATE_AGENTS } = require('./manifest.js');
|
|
8
|
+
const ui = require('./ui.js');
|
|
7
9
|
|
|
8
10
|
async function run() {
|
|
9
11
|
// Check if already initialized
|
|
10
12
|
const versionFile = path.join(process.cwd(), '.claude', '.axiomatic-version');
|
|
11
13
|
if (fs.existsSync(versionFile)) {
|
|
12
14
|
const current = fs.readFileSync(versionFile, 'utf-8').trim();
|
|
13
|
-
|
|
15
|
+
ui.banner(current);
|
|
16
|
+
ui.warn(`Already initialized at ${current}.`);
|
|
17
|
+
ui.info('Run: axiomatic update');
|
|
18
|
+
console.log('');
|
|
14
19
|
process.exit(1);
|
|
15
20
|
}
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
ui.banner();
|
|
23
|
+
|
|
24
|
+
ui.step('Authenticating with GitHub...');
|
|
18
25
|
const token = requireAuth();
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
ui.step('Fetching latest release...');
|
|
21
28
|
const release = await getLatestRelease(token);
|
|
22
29
|
const version = release.tag_name;
|
|
23
30
|
|
|
24
31
|
// Find the ZIP asset
|
|
25
32
|
const asset = release.assets.find((a) => a.name.endsWith('.zip'));
|
|
26
33
|
if (!asset) {
|
|
27
|
-
|
|
34
|
+
ui.error('No ZIP asset found in the latest release.');
|
|
28
35
|
process.exit(1);
|
|
29
36
|
}
|
|
30
37
|
|
|
31
|
-
|
|
38
|
+
ui.step(`Downloading ${version}...`);
|
|
32
39
|
const zipBuffer = await downloadReleaseAsset(asset, token);
|
|
33
40
|
|
|
34
41
|
// Write ZIP to temp file and extract
|
|
@@ -36,7 +43,7 @@ async function run() {
|
|
|
36
43
|
fs.writeFileSync(tmpZip, zipBuffer);
|
|
37
44
|
|
|
38
45
|
try {
|
|
39
|
-
|
|
46
|
+
ui.step('Extracting template files...');
|
|
40
47
|
execSync(`unzip -o "${tmpZip}" -d "${process.cwd()}"`, { stdio: 'pipe' });
|
|
41
48
|
} finally {
|
|
42
49
|
fs.unlinkSync(tmpZip);
|
|
@@ -48,8 +55,22 @@ async function run() {
|
|
|
48
55
|
// Write version file
|
|
49
56
|
writeLocalVersion(version);
|
|
50
57
|
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
// Count installed hooks
|
|
59
|
+
const hooksDir = path.join(process.cwd(), '.claude', 'hooks');
|
|
60
|
+
let hookCount = 0;
|
|
61
|
+
try {
|
|
62
|
+
hookCount = fs.readdirSync(hooksDir).filter((f) => f.endsWith('.js')).length;
|
|
63
|
+
} catch {}
|
|
64
|
+
|
|
65
|
+
console.log('');
|
|
66
|
+
ui.success(`${TEMPLATE_SKILLS.length} skills installed`);
|
|
67
|
+
ui.success(`${TEMPLATE_AGENTS.length} agents installed`);
|
|
68
|
+
ui.success(`${hookCount} hooks installed`);
|
|
69
|
+
|
|
70
|
+
ui.done(`Axiomatic ${version} installed.`);
|
|
71
|
+
ui.info('Next: claude');
|
|
72
|
+
ui.info('Then: /build <what you want to create>');
|
|
73
|
+
console.log('');
|
|
53
74
|
}
|
|
54
75
|
|
|
55
76
|
module.exports = run;
|
package/lib/ui.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Branding and UI helpers for the Axiomatic CLI.
|
|
2
|
+
|
|
3
|
+
const RESET = '\x1b[0m';
|
|
4
|
+
const BOLD = '\x1b[1m';
|
|
5
|
+
const DIM = '\x1b[2m';
|
|
6
|
+
const CYAN = '\x1b[36m';
|
|
7
|
+
const GREEN = '\x1b[32m';
|
|
8
|
+
const YELLOW = '\x1b[33m';
|
|
9
|
+
const RED = '\x1b[31m';
|
|
10
|
+
const WHITE = '\x1b[97m';
|
|
11
|
+
const MAGENTA = '\x1b[35m';
|
|
12
|
+
|
|
13
|
+
function banner(version) {
|
|
14
|
+
console.log('');
|
|
15
|
+
console.log(`${DIM} ╔═══════════════════════════════════════╗${RESET}`);
|
|
16
|
+
console.log(`${DIM} ║ ║${RESET}`);
|
|
17
|
+
console.log(`${DIM} ║${RESET} ${MAGENTA}${BOLD}◆${RESET} ${WHITE}${BOLD}A X I O M A T I C${RESET} ${DIM}║${RESET}`);
|
|
18
|
+
console.log(`${DIM} ║${RESET} ${DIM}AI-Powered Development${RESET} ${DIM}║${RESET}`);
|
|
19
|
+
console.log(`${DIM} ║ ║${RESET}`);
|
|
20
|
+
console.log(`${DIM} ╚═══════════════════════════════════════╝${RESET}`);
|
|
21
|
+
if (version) {
|
|
22
|
+
console.log(`${DIM} ${version}${RESET}`);
|
|
23
|
+
}
|
|
24
|
+
console.log('');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function step(msg) {
|
|
28
|
+
console.log(` ${DIM}...${RESET} ${msg}`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function success(msg) {
|
|
32
|
+
console.log(` ${GREEN}✓${RESET} ${msg}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function warn(msg) {
|
|
36
|
+
console.log(` ${YELLOW}!${RESET} ${msg}`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function error(msg) {
|
|
40
|
+
console.error(` ${RED}✗${RESET} ${msg}`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function info(msg) {
|
|
44
|
+
console.log(` ${CYAN}i${RESET} ${msg}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function done(msg) {
|
|
48
|
+
console.log('');
|
|
49
|
+
console.log(` ${GREEN}${BOLD}${msg}${RESET}`);
|
|
50
|
+
console.log('');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.exports = { banner, step, success, warn, error, info, done, BOLD, DIM, RESET, GREEN, YELLOW, CYAN, RED, WHITE, MAGENTA };
|
package/lib/update.js
CHANGED
|
@@ -5,36 +5,42 @@ const { requireAuth } = require('./auth.js');
|
|
|
5
5
|
const { getLatestRelease, downloadReleaseAsset } = require('./download.js');
|
|
6
6
|
const { readLocalVersion, writeLocalVersion } = require('./version.js');
|
|
7
7
|
const { isTemplatePath } = require('./manifest.js');
|
|
8
|
+
const ui = require('./ui.js');
|
|
8
9
|
|
|
9
10
|
async function run() {
|
|
10
11
|
const current = readLocalVersion();
|
|
11
12
|
if (!current) {
|
|
12
|
-
|
|
13
|
+
ui.banner();
|
|
14
|
+
ui.error('Not initialized. Run: axiomatic init');
|
|
15
|
+
console.log('');
|
|
13
16
|
process.exit(1);
|
|
14
17
|
}
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
ui.banner(current);
|
|
20
|
+
|
|
21
|
+
ui.step('Authenticating with GitHub...');
|
|
17
22
|
const token = requireAuth();
|
|
18
23
|
|
|
19
|
-
|
|
24
|
+
ui.step('Checking for updates...');
|
|
20
25
|
const release = await getLatestRelease(token);
|
|
21
26
|
const latest = release.tag_name;
|
|
22
27
|
|
|
23
28
|
if (current === latest) {
|
|
24
|
-
|
|
29
|
+
ui.success(`Already up to date (${current}).`);
|
|
30
|
+
console.log('');
|
|
25
31
|
return;
|
|
26
32
|
}
|
|
27
33
|
|
|
28
|
-
|
|
34
|
+
ui.info(`${current} ${ui.DIM}->${ui.RESET} ${ui.BOLD}${latest}${ui.RESET}`);
|
|
29
35
|
|
|
30
36
|
// Find the ZIP asset
|
|
31
37
|
const asset = release.assets.find((a) => a.name.endsWith('.zip'));
|
|
32
38
|
if (!asset) {
|
|
33
|
-
|
|
39
|
+
ui.error('No ZIP asset found in the latest release.');
|
|
34
40
|
process.exit(1);
|
|
35
41
|
}
|
|
36
42
|
|
|
37
|
-
|
|
43
|
+
ui.step(`Downloading ${latest}...`);
|
|
38
44
|
const zipBuffer = await downloadReleaseAsset(asset, token);
|
|
39
45
|
|
|
40
46
|
// Write ZIP to temp file
|
|
@@ -47,6 +53,8 @@ async function run() {
|
|
|
47
53
|
fs.mkdirSync(tmpDir, { recursive: true });
|
|
48
54
|
execSync(`unzip -o "${tmpZip}" -d "${tmpDir}"`, { stdio: 'pipe' });
|
|
49
55
|
|
|
56
|
+
ui.step('Updating template files...');
|
|
57
|
+
|
|
50
58
|
// Copy only template files
|
|
51
59
|
const updated = [];
|
|
52
60
|
copyTemplateFiles(tmpDir, process.cwd(), '', updated);
|
|
@@ -54,14 +62,20 @@ async function run() {
|
|
|
54
62
|
// Write version file
|
|
55
63
|
writeLocalVersion(latest);
|
|
56
64
|
|
|
57
|
-
console.log(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
+
console.log('');
|
|
66
|
+
const skills = updated.filter((f) => f.includes('/skills/')).length;
|
|
67
|
+
const agents = updated.filter((f) => f.includes('/agents/')).length;
|
|
68
|
+
const hooks = updated.filter((f) => f.includes('/hooks/')).length;
|
|
69
|
+
const other = updated.length - skills - agents - hooks;
|
|
70
|
+
|
|
71
|
+
if (skills) ui.success(`${skills} skills updated`);
|
|
72
|
+
if (agents) ui.success(`${agents} agents updated`);
|
|
73
|
+
if (hooks) ui.success(`${hooks} hooks updated`);
|
|
74
|
+
if (other) ui.success(`${other} other files updated`);
|
|
75
|
+
|
|
76
|
+
ui.done(`Updated to ${latest}.`);
|
|
77
|
+
ui.warn('Restart CLI to apply agent changes.');
|
|
78
|
+
console.log('');
|
|
65
79
|
} finally {
|
|
66
80
|
fs.unlinkSync(tmpZip);
|
|
67
81
|
fs.rmSync(tmpDir, { recursive: true, force: true });
|
package/lib/version.js
CHANGED
|
@@ -2,6 +2,7 @@ const fs = require('fs');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const { getGitHubToken } = require('./auth.js');
|
|
4
4
|
const { getLatestRelease } = require('./download.js');
|
|
5
|
+
const ui = require('./ui.js');
|
|
5
6
|
|
|
6
7
|
const VERSION_FILE = path.join(process.cwd(), '.claude', '.axiomatic-version');
|
|
7
8
|
|
|
@@ -20,36 +21,41 @@ function writeLocalVersion(version) {
|
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
async function run() {
|
|
23
|
-
const cliVersion = require('../package.json').version;
|
|
24
24
|
const local = readLocalVersion();
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
ui.banner(local);
|
|
27
|
+
|
|
28
|
+
const cliVersion = require('../package.json').version;
|
|
29
|
+
ui.info(`CLI version: v${cliVersion}`);
|
|
27
30
|
|
|
28
31
|
if (local) {
|
|
29
|
-
|
|
32
|
+
ui.info(`Installed: ${local}`);
|
|
30
33
|
} else {
|
|
31
|
-
|
|
34
|
+
ui.warn('Not installed. Run: axiomatic init');
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
const token = getGitHubToken();
|
|
35
38
|
if (!token) {
|
|
36
|
-
|
|
39
|
+
ui.warn('Authenticate with GitHub to check for updates.');
|
|
40
|
+
console.log('');
|
|
37
41
|
return;
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
try {
|
|
41
45
|
const release = await getLatestRelease(token);
|
|
42
46
|
const latest = release.tag_name;
|
|
43
|
-
|
|
47
|
+
ui.info(`Latest: ${latest}`);
|
|
44
48
|
|
|
49
|
+
console.log('');
|
|
45
50
|
if (local && local === latest) {
|
|
46
|
-
|
|
51
|
+
ui.success('Up to date.');
|
|
47
52
|
} else if (local) {
|
|
48
|
-
|
|
53
|
+
ui.warn(`Update available. Run: axiomatic update`);
|
|
49
54
|
}
|
|
50
55
|
} catch (err) {
|
|
51
|
-
|
|
56
|
+
ui.error(`Could not fetch latest release: ${err.message}`);
|
|
52
57
|
}
|
|
58
|
+
console.log('');
|
|
53
59
|
}
|
|
54
60
|
|
|
55
61
|
module.exports = run;
|