@m14i/sith 1.7.6 → 1.8.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/README.md CHANGED
@@ -10,42 +10,54 @@ Standardize and share your OpenCode setup with a fully dockerized environment, d
10
10
 
11
11
  ## Usage
12
12
 
13
+ ### Installation
14
+
15
+ **Install globally (recommended):**
16
+ ```bash
17
+ npm install -g @m14i/sith
18
+ ```
19
+
20
+ **Or use npx (slower, pulls image every time):**
21
+ ```bash
22
+ npx @m14i/sith@latest
23
+ ```
24
+
13
25
  ### Quick Start
14
26
 
15
27
  ```bash
16
28
  # Interactive menu (recommended)
17
- npx @m14i/sith
18
-
19
- # Pull prebuilt image directly
20
- npx @m14i/sith --pull
29
+ sith
30
+ # Options: Enter Shell | Configuration (Pull/Build)
21
31
 
22
- # Run shell
23
- npx @m14i/sith shell
32
+ # Direct commands (skip menu)
33
+ sith --it # Launch shell immediately
34
+ sith --pull # Pull prebuilt image
35
+ sith --build # Build from scratch
24
36
  ```
25
37
 
26
38
  ### Distribution Options
27
39
 
28
40
  | Method | Command | Speed | Trust Model | Use Case |
29
41
  |--------|---------|-------|-------------|----------|
30
- | **Prebuilt (Recommended)** | `npx @m14i/sith --pull` | ⚡ Fast | GitHub Actions + Cosign | Production, CI/CD |
31
- | **Local Build** | `npx @m14i/sith --build` | 🐌 Slow | Your machine | Air-gapped, custom builds |
42
+ | **Prebuilt (Recommended)** | `sith --pull` | ⚡ Fast | GitHub Actions + Cosign | Production, CI/CD |
43
+ | **Local Build** | `sith --build` | 🐌 Slow | Your machine | Air-gapped, custom builds |
32
44
 
33
45
  ### Commands
34
46
 
35
47
  | Command | Description |
36
48
  |---------|-------------|
37
- | `npx @m14i/sith` | Interactive menu with options |
38
- | `npx @m14i/sith --pull` | Pull prebuilt image from GHCR |
39
- | `npx @m14i/sith --build` | Build Docker image from scratch |
40
- | `npx @m14i/sith shell` | Launch interactive shell in container |
41
- | `npx @m14i/sith --help` | Show all available commands |
49
+ | `sith` | Interactive menu with options |
50
+ | `sith --it` | Launch interactive shell in container |
51
+ | `sith --pull` | Pull prebuilt image from GHCR |
52
+ | `sith --build` | Build Docker image from scratch |
53
+ | `sith --help` | Show all available commands |
42
54
 
43
55
  ### Prebuilt Image Details
44
56
 
45
57
  **Pull and verify:**
46
58
  ```bash
47
59
  # Pull (supports linux/amd64 and linux/arm64)
48
- npx @m14i/sith --pull
60
+ sith --pull
49
61
 
50
62
  # Or use Docker directly
51
63
  docker pull ghcr.io/merzoukemanouri/sith:latest
@@ -71,12 +83,12 @@ To use GitHub Copilot models, set the `GITHUB_TOKEN` environment variable:
71
83
  **Quick start (using GitHub CLI):**
72
84
  ```bash
73
85
  export GITHUB_TOKEN=$(gh auth token)
74
- npx @m14i/sith shell
86
+ sith --it
75
87
  ```
76
88
 
77
89
  **Or inline:**
78
90
  ```bash
79
- GITHUB_TOKEN=$(gh auth token) npx @m14i/sith shell
91
+ GITHUB_TOKEN=$(gh auth token) sith --it
80
92
  ```
81
93
 
82
94
  **Manual token:**
@@ -85,7 +97,7 @@ GITHUB_TOKEN=$(gh auth token) npx @m14i/sith shell
85
97
  3. Export it:
86
98
  ```bash
87
99
  export GITHUB_TOKEN=gho_your_token_here
88
- npx @m14i/sith shell
100
+ sith --it
89
101
  ```
90
102
 
91
103
  **Make it persistent (add to ~/.zshrc or ~/.bashrc):**
@@ -1 +1 @@
1
- {"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["file:///home/runner/work/sith/sith/src/commands/docker.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAkC,oBAAoB,EAAE,MAAM,aAAa,CAAC;AA6PxF,wBAAsB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBhF;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAEpD"}
1
+ {"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["file:///home/runner/work/sith/sith/src/commands/docker.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAkC,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAmRxF,wBAAsB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBhF;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAEpD"}
package/dist/index.js CHANGED
@@ -35471,9 +35471,13 @@ function findProjectRoot(startDir) {
35471
35471
  }
35472
35472
  const rootDir = findProjectRoot(__dirname);
35473
35473
  const menuItems = [
35474
+ { label: "Enter Shell", value: "shell", icon: "🚀" },
35475
+ { label: "Configuration", value: "config", icon: "⚙️" },
35476
+ ];
35477
+ const configMenuItems = [
35474
35478
  { label: "Pull prebuilt image (recommended)", value: "pull", icon: "📦" },
35475
35479
  { label: "Build Docker image from scratch", value: "build", icon: "🔨" },
35476
- { label: "Exit", value: "exit", icon: "" },
35480
+ { label: "Back", value: "back", icon: "◀️" },
35477
35481
  ];
35478
35482
  function Logo() {
35479
35483
  return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ink__WEBPACK_IMPORTED_MODULE_1__/* .Box */ .az, { flexDirection: "column", marginBottom: 1 },
@@ -35502,6 +35506,7 @@ function Menu() {
35502
35506
  const [processStep, setProcessStep] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)("");
35503
35507
  const [processComplete, setProcessComplete] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
35504
35508
  const [processError, setProcessError] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null);
35509
+ const [currentMenu, setCurrentMenu] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)("main");
35505
35510
  (0,ink__WEBPACK_IMPORTED_MODULE_1__/* .useInput */ .Ge)((_input, key) => {
35506
35511
  if (isProcessing) {
35507
35512
  return;
@@ -35511,20 +35516,30 @@ function Menu() {
35511
35516
  exit();
35512
35517
  return;
35513
35518
  }
35519
+ const items = currentMenu === "main" ? menuItems : configMenuItems;
35514
35520
  if (key.upArrow) {
35515
- setSelectedIndex((prev) => (prev > 0 ? prev - 1 : menuItems.length - 1));
35521
+ setSelectedIndex((prev) => (prev > 0 ? prev - 1 : items.length - 1));
35516
35522
  }
35517
35523
  else if (key.downArrow) {
35518
- setSelectedIndex((prev) => (prev < menuItems.length - 1 ? prev + 1 : 0));
35524
+ setSelectedIndex((prev) => (prev < items.length - 1 ? prev + 1 : 0));
35519
35525
  }
35520
35526
  else if (key.return) {
35521
- handleSelection(menuItems[selectedIndex].value);
35527
+ handleSelection(items[selectedIndex].value);
35522
35528
  }
35523
35529
  });
35524
35530
  async function handleSelection(value) {
35525
35531
  switch (value) {
35526
- case "exit":
35532
+ case "shell":
35527
35533
  exit();
35534
+ await runShell();
35535
+ return;
35536
+ case "config":
35537
+ setCurrentMenu("config");
35538
+ setSelectedIndex(0);
35539
+ return;
35540
+ case "back":
35541
+ setCurrentMenu("main");
35542
+ setSelectedIndex(0);
35528
35543
  return;
35529
35544
  case "pull":
35530
35545
  await handlePullCommand();
@@ -35598,7 +35613,7 @@ function Menu() {
35598
35613
  "Image: ",
35599
35614
  _config_js__WEBPACK_IMPORTED_MODULE_5__/* .DOCKER_CONFIG */ .e6.imageName)),
35600
35615
  react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ink__WEBPACK_IMPORTED_MODULE_1__/* .Box */ .az, { marginTop: 1 },
35601
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ink__WEBPACK_IMPORTED_MODULE_1__/* .Text */ .EY, { dimColor: true }, "Run: npx @m14i/sith shell")),
35616
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ink__WEBPACK_IMPORTED_MODULE_1__/* .Text */ .EY, { dimColor: true }, "Run: sith --it")),
35602
35617
  react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ink__WEBPACK_IMPORTED_MODULE_1__/* .Box */ .az, { marginTop: 1 },
35603
35618
  react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ink__WEBPACK_IMPORTED_MODULE_1__/* .Text */ .EY, { dimColor: true }, "Press any key to exit..."))));
35604
35619
  }
@@ -35613,11 +35628,13 @@ function Menu() {
35613
35628
  rootDir))));
35614
35629
  }
35615
35630
  // Render menu state
35631
+ const items = currentMenu === "main" ? menuItems : configMenuItems;
35632
+ const menuTitle = currentMenu === "main" ? "What would you like to do?" : "Configuration";
35616
35633
  return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ink__WEBPACK_IMPORTED_MODULE_1__/* .Box */ .az, { flexDirection: "column" },
35617
35634
  react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Logo, null),
35618
35635
  react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ink__WEBPACK_IMPORTED_MODULE_1__/* .Box */ .az, { flexDirection: "column", marginTop: 1 },
35619
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ink__WEBPACK_IMPORTED_MODULE_1__/* .Text */ .EY, { bold: true }, "What would you like to do?"),
35620
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ink__WEBPACK_IMPORTED_MODULE_1__/* .Box */ .az, { flexDirection: "column", marginTop: 1 }, menuItems.map((item, index) => {
35636
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ink__WEBPACK_IMPORTED_MODULE_1__/* .Text */ .EY, { bold: true }, menuTitle),
35637
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ink__WEBPACK_IMPORTED_MODULE_1__/* .Box */ .az, { flexDirection: "column", marginTop: 1 }, items.map((item, index) => {
35621
35638
  const isSelected = index === selectedIndex;
35622
35639
  return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ink__WEBPACK_IMPORTED_MODULE_1__/* .Box */ .az, { key: item.value, marginY: 0 },
35623
35640
  react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ink__WEBPACK_IMPORTED_MODULE_1__/* .Text */ .EY, { color: isSelected ? "cyan" : undefined },
@@ -35669,7 +35686,7 @@ async function pullDocker() {
35669
35686
  console.log("✅ Docker image ready!");
35670
35687
  console.log(`Image: ${_config_js__WEBPACK_IMPORTED_MODULE_5__/* .DOCKER_CONFIG */ .e6.imageName}`);
35671
35688
  console.log();
35672
- console.log("Run: npx @m14i/sith shell");
35689
+ console.log("Run: sith --it");
35673
35690
  }
35674
35691
  catch (error) {
35675
35692
  console.error("❌ Pull failed");
@@ -35697,7 +35714,7 @@ async function buildDocker() {
35697
35714
  console.log("✅ Docker image built successfully!");
35698
35715
  console.log(`Image: ${_config_js__WEBPACK_IMPORTED_MODULE_5__/* .DOCKER_CONFIG */ .e6.imageName}`);
35699
35716
  console.log();
35700
- console.log("Run: npx @m14i/sith shell");
35717
+ console.log("Run: sith --it");
35701
35718
  }
35702
35719
  catch (error) {
35703
35720
  console.error("❌ Build failed");
@@ -35720,10 +35737,8 @@ async function runShell() {
35720
35737
  `${process.cwd()}:${_config_js__WEBPACK_IMPORTED_MODULE_5__/* .DOCKER_CONFIG */ .e6.workspaceMount}`,
35721
35738
  "-e",
35722
35739
  `GITHUB_TOKEN=${process.env.GITHUB_TOKEN || ""}`,
35723
- "--entrypoint",
35724
- "nix-shell",
35725
35740
  _config_js__WEBPACK_IMPORTED_MODULE_5__/* .DOCKER_CONFIG */ .e6.imageName,
35726
- _config_js__WEBPACK_IMPORTED_MODULE_5__/* .DOCKER_CONFIG */ .e6.shellEntrypoint,
35741
+ "bash",
35727
35742
  ];
35728
35743
  try {
35729
35744
  await (0,execa__WEBPACK_IMPORTED_MODULE_6__/* .execa */ .Ho)("docker", dockerArgs, {
@@ -35799,11 +35814,17 @@ function createProgram() {
35799
35814
  .description(PROGRAM_DESCRIPTION)
35800
35815
  .version(PROGRAM_VERSION)
35801
35816
  .option('--pull', 'Pull prebuilt Docker image (recommended)')
35802
- .option('--build', 'Build the Docker image from scratch');
35803
- // Default action - show interactive menu
35817
+ .option('--build', 'Build the Docker image from scratch')
35818
+ .option('--it', 'Launch interactive shell in Docker container');
35819
+ // Default action - show interactive menu or run shell with --it
35804
35820
  program
35805
35821
  .action(async (options) => {
35806
- await (0,_commands_docker_js__WEBPACK_IMPORTED_MODULE_1__/* .dockerCommand */ .Q)(options);
35822
+ if (options.it) {
35823
+ await (0,_commands_docker_js__WEBPACK_IMPORTED_MODULE_1__/* .runShellDirect */ .l)();
35824
+ }
35825
+ else {
35826
+ await (0,_commands_docker_js__WEBPACK_IMPORTED_MODULE_1__/* .dockerCommand */ .Q)(options);
35827
+ }
35807
35828
  });
35808
35829
  // Docker command - explicit Docker management
35809
35830
  program
package/docker/Dockerfile CHANGED
@@ -9,10 +9,11 @@
9
9
  # ============================================================================
10
10
  FROM nixos/nix:2.19.2 AS builder
11
11
 
12
- # Configuration Nix pour permettre les builds
12
+ # Configuration Nix pour permettre les builds et activer flakes
13
13
  # Note: sandbox=false required for Docker-in-Docker compatibility
14
14
  RUN echo "sandbox = false" >> /etc/nix/nix.conf && \
15
- echo "filter-syscalls = false" >> /etc/nix/nix.conf
15
+ echo "filter-syscalls = false" >> /etc/nix/nix.conf && \
16
+ echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
16
17
 
17
18
  # Copier les fichiers de configuration des skills
18
19
  COPY docker/skills/rtk-config.toml /opt/sith/skills/rtk-config.toml
@@ -24,9 +25,10 @@ COPY docker/nix/ /opt/sith/nix/
24
25
  # Configurer npm pour utiliser le registry public
25
26
  RUN echo "registry=https://registry.npmjs.org/" > /root/.npmrc
26
27
 
27
- # Pré-charger l'environnement Nix (installe tous les packages)
28
- # Cela cache les dépendances dans le layer Docker
29
- RUN nix-shell /opt/sith/nix/shell.nix --run "echo '✅ Environment cached'"
28
+ # Generate flake.lock and pre-build environment
29
+ RUN cd /opt/sith/nix && \
30
+ nix flake lock && \
31
+ nix develop --command echo '✅ Flake environment cached'
30
32
 
31
33
  # Installer OpenCode CLI via script officiel
32
34
  RUN nix-shell /opt/sith/nix/shell.nix --run " \
@@ -46,10 +48,11 @@ LABEL description="OpenCode CI/CD avec Nix, GitHub Copilot et skills d'optimisat
46
48
  LABEL version="2.3.0"
47
49
  LABEL org.opencontainers.image.source="https://github.com/MerzoukeMansouri/sith"
48
50
 
49
- # Configuration Nix pour permettre les builds
51
+ # Configuration Nix pour permettre les builds et activer flakes
50
52
  # Note: sandbox=false required for Docker-in-Docker compatibility
51
53
  RUN echo "sandbox = false" >> /etc/nix/nix.conf && \
52
- echo "filter-syscalls = false" >> /etc/nix/nix.conf
54
+ echo "filter-syscalls = false" >> /etc/nix/nix.conf && \
55
+ echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
53
56
 
54
57
  # Copier les fichiers de configuration des skills depuis builder
55
58
  COPY --from=builder /opt/sith/ /opt/sith/
@@ -99,13 +102,13 @@ ENV CAVEMAN_AUTO=true
99
102
  # Healthcheck pour vérifier que l'environnement est prêt
100
103
  # Note: RTK check is conditional on RTK_ENABLED to avoid false failures
101
104
  HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
102
- CMD nix-shell /opt/sith/nix/shell.nix --run "opencode --version && ([ \"\$RTK_ENABLED\" = \"false\" ] || command -v rtk)" || exit 1
105
+ CMD cd /opt/sith/nix && nix develop --command sh -c "opencode --version && ([ \"\$RTK_ENABLED\" = \"false\" ] || command -v rtk)" || exit 1
103
106
 
104
107
  # Répertoire de travail pour les projets
105
108
  WORKDIR /workspace
106
109
 
107
- # Point d'entrée via nix-shell
108
- ENTRYPOINT ["nix-shell", "/opt/sith/nix/shell.nix", "--run"]
110
+ # Point d'entrée via nix develop (flakes)
111
+ ENTRYPOINT ["sh", "-c", "cd /opt/sith/nix && nix develop --command"]
109
112
 
110
113
  # Commande par défaut
111
114
  CMD ["opencode --help"]
@@ -0,0 +1,56 @@
1
+ {
2
+ description = "Sith - OpenCode Docker Environment";
3
+
4
+ inputs = {
5
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
6
+ flake-utils.url = "github:numtide/flake-utils";
7
+ };
8
+
9
+ outputs = { self, nixpkgs, flake-utils }:
10
+ flake-utils.lib.eachDefaultSystem (system:
11
+ let
12
+ pkgs = nixpkgs.legacyPackages.${system};
13
+
14
+ # Load packages from config
15
+ packagesConfig = builtins.fromJSON (builtins.readFile ./nix-config/packages.json);
16
+
17
+ allPackages = pkgs.lib.flatten (
18
+ pkgs.lib.mapAttrsToList (category: config: config.packages) packagesConfig.categories
19
+ );
20
+
21
+ resolvePkg = pkgPath:
22
+ let
23
+ parts = pkgs.lib.splitString "." pkgPath;
24
+ in
25
+ if pkgs.lib.length parts == 1
26
+ then builtins.getAttr (pkgs.lib.head parts) pkgs
27
+ else if pkgs.lib.length parts == 2
28
+ then builtins.getAttr (pkgs.lib.elemAt parts 1) (builtins.getAttr (pkgs.lib.head parts) pkgs)
29
+ else throw "Package path too deep: ${pkgPath}";
30
+
31
+ packages = map resolvePkg allPackages;
32
+ in
33
+ {
34
+ devShells.default = pkgs.mkShell {
35
+ name = "opencode-ci-environment";
36
+
37
+ buildInputs = packages;
38
+
39
+ shellHook = ''
40
+ # Source external setup script
41
+ if [ -f /opt/sith/nix/nix-scripts/setup.sh ]; then
42
+ source /opt/sith/nix/nix-scripts/setup.sh
43
+ fi
44
+ '';
45
+
46
+ LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
47
+ LANG = "en_US.UTF-8";
48
+ LC_ALL = "en_US.UTF-8";
49
+ LC_CTYPE = "en_US.UTF-8";
50
+
51
+ SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
52
+ NIX_SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
53
+ };
54
+ }
55
+ );
56
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m14i/sith",
3
- "version": "1.7.6",
3
+ "version": "1.8.1",
4
4
  "description": "Turn your context to the dark side. Standardize and share your OpenCode setup with a fully dockerized environment, designed for seamless collaboration and CI integration.",
5
5
  "type": "module",
6
6
  "repository": {