tycono 0.1.24 → 0.1.26

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/tycono.ts CHANGED
@@ -97,9 +97,24 @@ async function startServer(): Promise<void> {
97
97
  process.env.COMPANY_ROOT = process.cwd();
98
98
  }
99
99
 
100
- // Check for CLAUDE.md (soft server starts regardless for onboarding wizard)
101
- const claudeMdPath = path.join(process.env.COMPANY_ROOT, 'CLAUDE.md');
102
- const initialized = fs.existsSync(claudeMdPath);
100
+ // Check for CLAUDE.md — also scan one level deep (for ~/acme-corp/ scenario)
101
+ let claudeMdPath = path.join(process.env.COMPANY_ROOT, 'CLAUDE.md');
102
+ let initialized = fs.existsSync(claudeMdPath);
103
+ if (!initialized) {
104
+ // Look for .tycono/ marker in subdirectories (faster than scanning all dirs for CLAUDE.md)
105
+ try {
106
+ const entries = fs.readdirSync(process.env.COMPANY_ROOT, { withFileTypes: true });
107
+ for (const entry of entries) {
108
+ if (!entry.isDirectory() || entry.name.startsWith('.')) continue;
109
+ if (fs.existsSync(path.join(process.env.COMPANY_ROOT, entry.name, '.tycono', 'config.json'))) {
110
+ process.env.COMPANY_ROOT = path.join(process.env.COMPANY_ROOT, entry.name);
111
+ claudeMdPath = path.join(process.env.COMPANY_ROOT, 'CLAUDE.md');
112
+ initialized = fs.existsSync(claudeMdPath);
113
+ break;
114
+ }
115
+ }
116
+ } catch { /* permission denied etc — ignore */ }
117
+ }
103
118
 
104
119
  // Production mode + auto-detect execution engine (soft-fail)
105
120
  process.env.NODE_ENV = 'production';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tycono",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "description": "Build an AI company. Watch them work.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -82,28 +82,33 @@ setupRouter.post('/validate-path', (req, res) => {
82
82
  * POST /api/setup/scaffold
83
83
  */
84
84
  setupRouter.post('/scaffold', (req, res) => {
85
- const { companyName, description, apiKey, team, existingProjectPath, knowledgePaths, codeRoot, language } = req.body;
85
+ const { companyName, description, apiKey, team, existingProjectPath, knowledgePaths, codeRoot, language, location } = req.body;
86
86
 
87
87
  if (!companyName || typeof companyName !== 'string') {
88
88
  res.status(400).json({ error: 'companyName is required' });
89
89
  return;
90
90
  }
91
91
 
92
- const baseRoot = process.env.COMPANY_ROOT || process.cwd();
93
-
94
- // Safety: if CWD is a dangerous path (home dir, root, or has too many entries),
95
- // scaffold into a subdirectory named after the company
96
- const dangerousPaths = new Set(['/', os.homedir(), os.tmpdir()]);
97
- const isDangerous = dangerousPaths.has(baseRoot) || baseRoot === '/tmp';
98
- let projectRoot = baseRoot;
99
- if (isDangerous) {
100
- const slug = companyName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || 'my-company';
101
- projectRoot = path.join(baseRoot, slug);
102
- if (!fs.existsSync(projectRoot)) {
103
- fs.mkdirSync(projectRoot, { recursive: true });
92
+ // Determine project root: explicit location from wizard > fallback to CWD with safety check
93
+ let projectRoot: string;
94
+ if (location && typeof location === 'string') {
95
+ projectRoot = path.resolve(location);
96
+ } else {
97
+ const baseRoot = process.env.COMPANY_ROOT || process.cwd();
98
+ const dangerousPaths = new Set(['/', os.homedir(), os.tmpdir()]);
99
+ const isDangerous = dangerousPaths.has(baseRoot) || baseRoot === '/tmp';
100
+ if (isDangerous) {
101
+ const slug = companyName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || 'my-company';
102
+ projectRoot = path.join(baseRoot, slug);
103
+ } else {
104
+ projectRoot = baseRoot;
104
105
  }
105
106
  }
106
107
 
108
+ if (!fs.existsSync(projectRoot)) {
109
+ fs.mkdirSync(projectRoot, { recursive: true });
110
+ }
111
+
107
112
  const config: ScaffoldConfig = {
108
113
  companyName,
109
114
  description: description || 'An AI-powered organization',