Skip to content

Commit 568ef21

Browse files
committed
feat: add mcp and skills command while bumping libs
1 parent 6669d99 commit 568ef21

File tree

18 files changed

+197
-41
lines changed

18 files changed

+197
-41
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: ⬇️ Checkout repo
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@v6
1515
with:
1616
fetch-depth: 0
1717
fetch-tags: false

.prettierrc.json renamed to .oxfmtrc.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"ignorePatterns": ["node_modules", "dist", "build"],
24
"tabWidth": 4,
35
"semi": true,
46
"useTabs": false,

.prettierignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [5.22.0]
6+
7+
- added `add-mcp` command to add the Crystallize MCP server to your environment
8+
- added `add-skills` command to add Crystallize AI skills
9+
- added `update-skills` command to update Crystallize AI skills
10+
- added bash completion for `serve`, `add-mcp`, `add-skills`, `update-skills` commands
11+
- bumped `@crystallize/schema` to 6.11.0
12+
- updated libraries (awilix, commander, ink, jotai, marked, meow, tar, zod, TypeScript 6)
13+
- moved from prettier to `oxfmt` for code formatting
14+
515
## [5.21.1]
616

717
- update the version checker to fetch the remote changelog file instead and get proper changes.

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ make run ARGS="<command>" # Run CLI locally (e.g. ARGS="whoami")
99
make staging-run ARGS="<command>" # Run against staging environment
1010
make build # Build single-platform binary
1111
make build-all # Build all platform binaries
12-
make codeclean # Format with prettier
12+
make codeclean # Format with oxfmt
1313
```
1414

1515
The runtime is **Bun** (>=1.3). No test framework is configured.
@@ -52,6 +52,6 @@ Resolved in priority order: env vars (`CRYSTALLIZE_ACCESS_TOKEN_ID`/`SECRET`)
5252

5353
## Code Style
5454

55-
- Prettier: 4-space indent, single quotes, trailing commas, semicolons, 120 char width
55+
- oxfmt: 4-space indent, single quotes, trailing commas, semicolons, 120 char width
5656
- Commit messages: conventional commits (feat, fix, chore, refactor, etc.)
5757
- TypeScript strict mode with `verbatimModuleSyntax`

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ list:
1717

1818
.PHONY: codeclean
1919
codeclean: ## Code Clean
20-
@$(BUN) prettier --write .
20+
@$(BUN) oxfmt .
21+
@$(BUN) oxfmt --check .
2122

2223
.PHONY: run
2324
run: ## Run ARGS=""

bun.lockb

6.17 KB
Binary file not shown.

package.json

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
{
22
"name": "@crystallize/cli",
3-
"version": "5.21.1",
3+
"version": "5.22.0",
44
"description": "Crystallize CLI",
5-
"module": "src/index.ts",
6-
"repository": "https://github.com/CrystallizeAPI/crystallize-cli",
75
"license": "MIT",
86
"contributors": [
97
"Sébastien Morel <sebastien@crystallize.com>"
108
],
9+
"repository": "https://github.com/CrystallizeAPI/crystallize-cli",
1110
"type": "module",
12-
"peerDependencies": {
13-
"typescript": "^5"
14-
},
15-
"engines": {
16-
"bun": ">=1.3"
17-
},
18-
"devDependencies": {
19-
"@commitlint/cli": "^20.3.0",
20-
"@commitlint/config-conventional": "^20.3.0",
21-
"@types/bun": "latest",
22-
"@types/marked": "^6.0.0",
23-
"@types/marked-terminal": "^6.1.1",
24-
"@types/react": "^19.2.10",
25-
"@types/signale": "^1.4.7",
26-
"react-devtools-core": "^7.0.1"
27-
},
11+
"module": "src/index.ts",
2812
"dependencies": {
2913
"@crystallize/js-api-client": "^5.3.0",
30-
"@crystallize/schema": "^6.9.0",
31-
"awilix": "^12.0.5",
14+
"@crystallize/schema": "^6.11.0",
15+
"awilix": "^13.0.3",
3216
"cli-spinners": "^3.4.0",
33-
"commander": "^14.0.2",
34-
"ink": "^6.6.0",
17+
"commander": "^14.0.3",
18+
"ink": "^6.8.0",
3519
"ink-link": "^5.0.0",
3620
"ink-text-input": "^6.0.0",
37-
"jotai": "^2.17.0",
21+
"jotai": "^2.19.0",
3822
"json-to-graphql-query": "^2.3.0",
39-
"marked": "^17.0.1",
23+
"marked": "^17.0.5",
4024
"marked-terminal": "^7.3.0",
41-
"meow": "^14.0.0",
25+
"meow": "^14.1.0",
4226
"missive.js": "^0.5.0",
4327
"picocolors": "^1.1.1",
44-
"prettier": "^3.8.1",
4528
"react": "^19.2.4",
4629
"signale": "^1.4.0",
47-
"tar": "^7.5.7",
30+
"tar": "^7.5.13",
4831
"zod": "^4.3.6"
32+
},
33+
"devDependencies": {
34+
"@commitlint/cli": "^20.5.0",
35+
"@commitlint/config-conventional": "^20.5.0",
36+
"@types/bun": "^1.3.11",
37+
"@types/marked": "^6.0.0",
38+
"@types/marked-terminal": "^6.1.1",
39+
"@types/react": "^19.2.14",
40+
"@types/signale": "^1.4.7",
41+
"oxfmt": "^0.43.0",
42+
"react-devtools-core": "^7.0.1"
43+
},
44+
"peerDependencies": {
45+
"typescript": "^6.0.2"
46+
},
47+
"engines": {
48+
"bun": ">=1.3"
4949
}
5050
}

src/command/add-mcp.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import type { CredentialRetriever } from '../domain/contracts/credential-retriever';
2+
import type { Logger } from '../domain/contracts/logger';
3+
import { Command } from 'commander';
4+
import { addInteractiveAndTokenOption } from '../core/helpers/add-iteractive-and-token-option';
5+
import pc from 'picocolors';
6+
7+
type Deps = {
8+
credentialsRetriever: CredentialRetriever;
9+
logger: Logger;
10+
};
11+
12+
export const createAddMcpCommand = ({ credentialsRetriever, logger }: Deps): Command => {
13+
const command = new Command('add-mcp');
14+
command.description('Add the Crystallize MCP server to your environment.');
15+
addInteractiveAndTokenOption(command);
16+
command.action(async (options) => {
17+
const credentials = await credentialsRetriever.getCredentials({
18+
token_id: options.token_id,
19+
token_secret: options.token_secret,
20+
});
21+
22+
if (!credentials.ACCESS_TOKEN_ID || !credentials.ACCESS_TOKEN_SECRET) {
23+
logger.error('Access token credentials are required to add the MCP server. Please login first.');
24+
process.exit(1);
25+
}
26+
27+
logger.info(`Adding Crystallize MCP server...`);
28+
29+
const proc = Bun.spawn(
30+
[
31+
process.execPath,
32+
'x',
33+
'add-mcp',
34+
'https://mcp.crystallize.com/mcp',
35+
'--header',
36+
`X-Crystallize-Access-Token-Id: ${credentials.ACCESS_TOKEN_ID}`,
37+
'--header',
38+
`X-Crystallize-Access-Token-Secret: ${credentials.ACCESS_TOKEN_SECRET}`,
39+
],
40+
{
41+
env: { ...process.env, BUN_BE_BUN: '1' },
42+
stdin: 'inherit',
43+
stdout: 'inherit',
44+
stderr: 'inherit',
45+
},
46+
);
47+
48+
await proc.exited;
49+
50+
if (proc.exitCode === 0) {
51+
logger.info(pc.green('Crystallize MCP server added successfully!'));
52+
logger.warn(
53+
pc.yellow(
54+
'The MCP configuration file now contains your access tokens. Make sure you do not commit this file to version control.',
55+
),
56+
);
57+
} else {
58+
logger.error('Failed to add Crystallize MCP server.');
59+
process.exit(proc.exitCode || 1);
60+
}
61+
});
62+
return command;
63+
};

src/command/add-skills.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import type { Logger } from '../domain/contracts/logger';
2+
import { Command } from 'commander';
3+
import pc from 'picocolors';
4+
5+
type Deps = {
6+
logger: Logger;
7+
};
8+
9+
export const createAddSkillsCommand = ({ logger }: Deps): Command => {
10+
const command = new Command('add-skills');
11+
command.description('Add Crystallize AI skills to your environment.');
12+
command.action(async () => {
13+
logger.info(`Adding Crystallize AI skills...`);
14+
15+
const proc = Bun.spawn([process.execPath, 'x', 'skills', 'add', 'https://github.com/crystallizeapi/ai'], {
16+
env: { ...process.env, BUN_BE_BUN: '1' },
17+
stdin: 'inherit',
18+
stdout: 'inherit',
19+
stderr: 'inherit',
20+
});
21+
22+
await proc.exited;
23+
24+
if (proc.exitCode === 0) {
25+
logger.info(pc.green('Crystallize AI skills added successfully!'));
26+
} else {
27+
logger.error('Failed to add Crystallize AI skills.');
28+
process.exit(proc.exitCode || 1);
29+
}
30+
});
31+
return command;
32+
};

0 commit comments

Comments
 (0)