@crouton-kit/crouter 0.1.7 → 0.1.8
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/dist/cli.js +2 -1
- package/dist/core/bootstrap.d.ts +1 -0
- package/dist/core/bootstrap.js +28 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import { registerPlanCommand } from './commands/plan.js';
|
|
|
13
13
|
import { registerSpecCommand } from './commands/spec.js';
|
|
14
14
|
import { registerAgentCommand } from './commands/agent.js';
|
|
15
15
|
import { maybeAutoUpdate } from './core/auto-update.js';
|
|
16
|
-
import { ensureBootSkill, ensureOfficialMarketplace } from './core/bootstrap.js';
|
|
16
|
+
import { ensureBootSkill, ensureOfficialMarketplace, ensureProjectScope } from './core/bootstrap.js';
|
|
17
17
|
function readPackageVersion() {
|
|
18
18
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
19
19
|
const pkgPath = join(here, '..', 'package.json');
|
|
@@ -38,6 +38,7 @@ registerSpecCommand(program);
|
|
|
38
38
|
registerAgentCommand(program);
|
|
39
39
|
ensureOfficialMarketplace(process.argv);
|
|
40
40
|
ensureBootSkill(process.argv);
|
|
41
|
+
ensureProjectScope(process.argv);
|
|
41
42
|
maybeAutoUpdate(process.argv);
|
|
42
43
|
program.parseAsync().catch((err) => {
|
|
43
44
|
process.stderr.write(`crtr: ${err instanceof Error ? err.message : String(err)}\n`);
|
package/dist/core/bootstrap.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export declare const OFFICIAL_MARKETPLACE_URL = "https://github.com/crouton-labs
|
|
|
3
3
|
export declare const OFFICIAL_MARKETPLACE_REF = "main";
|
|
4
4
|
export declare function ensureBootSkill(argv: string[]): void;
|
|
5
5
|
export declare function ensureOfficialMarketplace(argv: string[]): void;
|
|
6
|
+
export declare function ensureProjectScope(argv: string[]): void;
|
package/dist/core/bootstrap.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { writeFileSync } from 'node:fs';
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
import { userScopeRoot } from './scope.js';
|
|
4
|
+
import { findProjectScopeRoot, resetScopeCache, userScopeRoot } from './scope.js';
|
|
5
5
|
import { ensureDir, pathExists, readText, removePath, nowIso } from './fs-utils.js';
|
|
6
6
|
import { readConfig, readState, updateConfig, updateState, ensureScopeInitialized } from './config.js';
|
|
7
7
|
import { clone } from './git.js';
|
|
8
8
|
import { readMarketplaceManifest } from './manifest.js';
|
|
9
|
+
import { CRTR_DIR_NAME } from '../types.js';
|
|
9
10
|
export const OFFICIAL_MARKETPLACE_NAME = 'crouter-official-marketplace';
|
|
10
11
|
export const OFFICIAL_MARKETPLACE_URL = 'https://github.com/crouton-labs/crouter-official-marketplace.git';
|
|
11
12
|
export const OFFICIAL_MARKETPLACE_REF = 'main';
|
|
@@ -141,3 +142,29 @@ export function ensureOfficialMarketplace(argv) {
|
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
}
|
|
145
|
+
export function ensureProjectScope(argv) {
|
|
146
|
+
try {
|
|
147
|
+
if (process.env.CRTR_NO_AUTO_INIT === '1')
|
|
148
|
+
return;
|
|
149
|
+
if (shouldSkipForArgv(argv))
|
|
150
|
+
return;
|
|
151
|
+
// Already inside a project scope (here or in an ancestor) — nothing to do.
|
|
152
|
+
if (findProjectScopeRoot() !== null)
|
|
153
|
+
return;
|
|
154
|
+
const cwd = process.cwd();
|
|
155
|
+
// Never auto-init at $HOME — that path is reserved for the user scope.
|
|
156
|
+
if (cwd === homedir())
|
|
157
|
+
return;
|
|
158
|
+
const projectRoot = join(cwd, CRTR_DIR_NAME);
|
|
159
|
+
if (projectRoot === userScopeRoot())
|
|
160
|
+
return;
|
|
161
|
+
ensureScopeInitialized('project', projectRoot);
|
|
162
|
+
resetScopeCache();
|
|
163
|
+
}
|
|
164
|
+
catch (e) {
|
|
165
|
+
if (process.env.CRTR_DEBUG === '1') {
|
|
166
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
167
|
+
process.stderr.write(`crtr: project-init error: ${msg}\n`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|