@dezkareid/osddt 1.11.1 → 1.11.2

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.
Files changed (2) hide show
  1. package/dist/index.js +21 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3,10 +3,10 @@ import { Command } from 'commander';
3
3
  import fs from 'fs-extra';
4
4
  import path from 'path';
5
5
  import { fileURLToPath } from 'url';
6
+ import { execSync } from 'child_process';
6
7
  import select from '@inquirer/select';
7
8
  import checkbox from '@inquirer/checkbox';
8
9
  import input from '@inquirer/input';
9
- import { execSync } from 'child_process';
10
10
  import readline from 'readline';
11
11
 
12
12
  function getRepoPreamble(npxCommand) {
@@ -857,7 +857,25 @@ async function writeAgentFiles(cwd, agents, npxCommand) {
857
857
  console.log('');
858
858
  }
859
859
  }
860
- async function setupWorktreeEnvironment(cwd, _worktreeRepository) {
860
+ function isGitRepository(cwd) {
861
+ try {
862
+ execSync('git rev-parse --git-dir', { cwd, stdio: 'ignore' });
863
+ return true;
864
+ }
865
+ catch {
866
+ return false;
867
+ }
868
+ }
869
+ function cloneBareRepository(cwd, repositoryUrl) {
870
+ console.log(`Cloning repository as bare into ${cwd}/.git ...\n`);
871
+ execSync(`git clone --bare "${repositoryUrl}" .git`, { cwd, stdio: 'inherit' });
872
+ execSync('git config --local core.bare false', { cwd, stdio: 'inherit' });
873
+ console.log('');
874
+ }
875
+ async function setupWorktreeEnvironment(cwd, worktreeRepository) {
876
+ if (!isGitRepository(cwd)) {
877
+ cloneBareRepository(cwd, worktreeRepository);
878
+ }
861
879
  console.log('Checking environment for git worktree support...\n');
862
880
  const allPassed = await runWorktreeChecks(cwd);
863
881
  console.log('');
@@ -879,7 +897,7 @@ async function runSetup(cwd, rawAgents, rawRepoType, rawWorktreeRepository) {
879
897
  if (rawWorktreeRepository === undefined)
880
898
  console.log('');
881
899
  if (worktreeRepository) {
882
- await setupWorktreeEnvironment(cwd);
900
+ await setupWorktreeEnvironment(cwd, worktreeRepository);
883
901
  }
884
902
  const npxCommand = await resolveNpxCommand(cwd);
885
903
  console.log('Setting up OSDDT command files...\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dezkareid/osddt",
3
- "version": "1.11.1",
3
+ "version": "1.11.2",
4
4
  "description": "Package for Spec-Driven Development workflow",
5
5
  "keywords": [
6
6
  "spec-driven",