preclaim 0.3.4 → 0.3.6
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/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +146 -63
- package/dist/commands/init.js.map +1 -1
- package/dist/index.js +13 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAsGA,wBAAsB,WAAW,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,iBA+F9E"}
|
package/dist/commands/init.js
CHANGED
|
@@ -1,30 +1,94 @@
|
|
|
1
|
-
import { writeFile, readFile } from 'node:fs/promises';
|
|
1
|
+
import { writeFile, readFile, mkdir } from 'node:fs/promises';
|
|
2
2
|
import { join, basename } from 'node:path';
|
|
3
3
|
import { defaultConfig, loadCredentials, saveCredentials } from '@preclaim/core';
|
|
4
4
|
import { loginCommand } from './login.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { installHooksCommand } from './install-hooks.js';
|
|
6
|
+
const MCP_ENTRY = {
|
|
7
|
+
command: 'npx',
|
|
8
|
+
args: ['@preclaim/mcp'],
|
|
9
|
+
};
|
|
10
|
+
async function fileExists(path) {
|
|
8
11
|
try {
|
|
9
|
-
await readFile(
|
|
10
|
-
|
|
11
|
-
return;
|
|
12
|
+
await readFile(path, 'utf-8');
|
|
13
|
+
return true;
|
|
12
14
|
}
|
|
13
15
|
catch {
|
|
14
|
-
|
|
16
|
+
return false;
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
}
|
|
19
|
+
async function detectAgents(projectRoot) {
|
|
20
|
+
const agents = [];
|
|
21
|
+
// Claude Code — .claude/ directory or running inside Claude Code
|
|
22
|
+
if (await fileExists(join(projectRoot, '.claude', 'settings.json')) || process.env.CLAUDE_CODE) {
|
|
23
|
+
agents.push({
|
|
24
|
+
name: 'Claude Code',
|
|
25
|
+
configPath: '.claude/settings.json',
|
|
26
|
+
writeConfig: async () => {
|
|
27
|
+
await installHooksCommand();
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// Cursor — .cursor/ directory
|
|
32
|
+
const cursorMcpPath = join(projectRoot, '.cursor', 'mcp.json');
|
|
33
|
+
if (await fileExists(cursorMcpPath) || await fileExists(join(projectRoot, '.cursor', 'rules'))) {
|
|
34
|
+
agents.push({
|
|
35
|
+
name: 'Cursor',
|
|
36
|
+
configPath: '.cursor/mcp.json',
|
|
37
|
+
writeConfig: async () => {
|
|
38
|
+
await writeMcpConfig(cursorMcpPath);
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
// Windsurf — .windsurf/ directory
|
|
43
|
+
const windsurfMcpPath = join(projectRoot, '.windsurf', 'mcp.json');
|
|
44
|
+
if (await fileExists(join(projectRoot, '.windsurf', 'rules')) || await fileExists(windsurfMcpPath)) {
|
|
45
|
+
agents.push({
|
|
46
|
+
name: 'Windsurf',
|
|
47
|
+
configPath: '.windsurf/mcp.json',
|
|
48
|
+
writeConfig: async () => {
|
|
49
|
+
await writeMcpConfig(windsurfMcpPath);
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// Cline — .cline/ directory
|
|
54
|
+
const clineMcpPath = join(projectRoot, '.cline', 'mcp.json');
|
|
55
|
+
if (await fileExists(join(projectRoot, '.cline', 'mcp_settings.json')) || await fileExists(join(projectRoot, '.cline', 'rules'))) {
|
|
56
|
+
agents.push({
|
|
57
|
+
name: 'Cline',
|
|
58
|
+
configPath: '.cline/mcp.json',
|
|
59
|
+
writeConfig: async () => {
|
|
60
|
+
await writeMcpConfig(clineMcpPath);
|
|
61
|
+
},
|
|
62
|
+
});
|
|
24
63
|
}
|
|
25
|
-
|
|
64
|
+
return agents;
|
|
65
|
+
}
|
|
66
|
+
async function writeMcpConfig(configPath) {
|
|
67
|
+
// Read existing config or create new
|
|
68
|
+
let config = {};
|
|
69
|
+
try {
|
|
70
|
+
const raw = await readFile(configPath, 'utf-8');
|
|
71
|
+
config = JSON.parse(raw);
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
// File doesn't exist
|
|
75
|
+
}
|
|
76
|
+
// Merge preclaim into mcpServers
|
|
77
|
+
const mcpServers = (config.mcpServers ?? {});
|
|
78
|
+
mcpServers.preclaim = MCP_ENTRY;
|
|
79
|
+
config.mcpServers = mcpServers;
|
|
80
|
+
await mkdir(join(configPath, '..'), { recursive: true });
|
|
81
|
+
await writeFile(configPath, JSON.stringify(config, null, 2) + '\n');
|
|
82
|
+
}
|
|
83
|
+
// ─── Init command ───
|
|
84
|
+
export async function initCommand(opts) {
|
|
85
|
+
const projectRoot = process.cwd();
|
|
86
|
+
const configPath = join(projectRoot, '.preclaim.json');
|
|
87
|
+
const backend = opts.backend;
|
|
88
|
+
// ─── Step 1: Auth ───
|
|
26
89
|
let creds = await loadCredentials();
|
|
27
|
-
|
|
90
|
+
const configExists = await fileExists(configPath);
|
|
91
|
+
if (!creds && !opts.projectId) {
|
|
28
92
|
console.log('Not logged in. Starting authentication...\n');
|
|
29
93
|
await loginCommand();
|
|
30
94
|
creds = await loadCredentials();
|
|
@@ -34,55 +98,74 @@ export async function initCommand(opts) {
|
|
|
34
98
|
}
|
|
35
99
|
console.log('');
|
|
36
100
|
}
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
'
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
101
|
+
// ─── Step 2: Project setup ───
|
|
102
|
+
if (!configExists) {
|
|
103
|
+
if (opts.projectId) {
|
|
104
|
+
const config = defaultConfig(opts.projectId, backend);
|
|
105
|
+
await writeFile(configPath, JSON.stringify(config, null, 2) + '\n');
|
|
106
|
+
console.log(`Created .preclaim.json (project: ${opts.projectId})`);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const dirName = basename(projectRoot);
|
|
110
|
+
const projectSlug = dirName.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/-+/g, '-');
|
|
111
|
+
const projectName = dirName;
|
|
112
|
+
console.log(`Setting up Preclaim for "${projectName}"...`);
|
|
113
|
+
const res = await fetch(`${backend}/api/v1/onboard`, {
|
|
114
|
+
method: 'POST',
|
|
115
|
+
headers: {
|
|
116
|
+
'Content-Type': 'application/json',
|
|
117
|
+
'Authorization': `Bearer ${creds.accessToken}`,
|
|
118
|
+
},
|
|
119
|
+
body: JSON.stringify({
|
|
120
|
+
project_name: projectName,
|
|
121
|
+
project_slug: projectSlug,
|
|
122
|
+
}),
|
|
123
|
+
});
|
|
124
|
+
if (!res.ok) {
|
|
125
|
+
const body = await res.text();
|
|
126
|
+
console.error(`Failed to create project: ${body}`);
|
|
127
|
+
process.exit(1);
|
|
128
|
+
}
|
|
129
|
+
const { data } = await res.json();
|
|
130
|
+
if (data.already_existed) {
|
|
131
|
+
console.log(`Project "${projectName}" already exists — joining.`);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
console.log(`Project "${projectName}" created.`);
|
|
135
|
+
}
|
|
136
|
+
if (creds.user.orgId !== data.org_id) {
|
|
137
|
+
creds.user.orgId = data.org_id;
|
|
138
|
+
await saveCredentials(creds);
|
|
139
|
+
}
|
|
140
|
+
const config = defaultConfig(data.project_id, backend);
|
|
141
|
+
await writeFile(configPath, JSON.stringify(config, null, 2) + '\n');
|
|
142
|
+
console.log('Created .preclaim.json');
|
|
143
|
+
}
|
|
62
144
|
}
|
|
63
145
|
else {
|
|
64
|
-
console.log(
|
|
146
|
+
console.log('.preclaim.json found — project already configured.');
|
|
65
147
|
}
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
148
|
+
// ─── Step 3: Detect agents and install integrations ───
|
|
149
|
+
const agents = await detectAgents(projectRoot);
|
|
150
|
+
if (agents.length === 0) {
|
|
151
|
+
// No agent detected — install Claude Code hooks as default + show MCP instructions
|
|
152
|
+
console.log('\nNo AI agent detected. Installing Claude Code hooks as default...');
|
|
153
|
+
await installHooksCommand();
|
|
154
|
+
console.log('\nUsing a different agent? Add this to your MCP config:\n');
|
|
155
|
+
console.log(JSON.stringify({ mcpServers: { preclaim: MCP_ENTRY } }, null, 2));
|
|
70
156
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
157
|
+
else {
|
|
158
|
+
console.log(`\nDetected: ${agents.map(a => a.name).join(', ')}`);
|
|
159
|
+
for (const agent of agents) {
|
|
160
|
+
console.log(` Setting up ${agent.name}...`);
|
|
161
|
+
await agent.writeConfig(projectRoot);
|
|
162
|
+
console.log(` ✓ ${agent.name} configured (${agent.configPath})`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// ─── Done ───
|
|
78
166
|
const dashboardUrl = backend.replace(/\/api\/v1$/, '').replace(/\/$/, '');
|
|
79
|
-
console.log('');
|
|
80
|
-
console.log('
|
|
81
|
-
console.log(
|
|
82
|
-
console.log(' 2. Commit .preclaim.json to your repo');
|
|
83
|
-
console.log(' 3. Open multiple Claude Code terminals — locks are automatic');
|
|
84
|
-
console.log('');
|
|
85
|
-
console.log(`Dashboard: ${dashboardUrl}/dashboard`);
|
|
86
|
-
console.log('View your locks and activity in real-time.');
|
|
167
|
+
console.log('\n✓ Preclaim is ready.');
|
|
168
|
+
console.log(' Commit .preclaim.json to your repo so your team can join.');
|
|
169
|
+
console.log(` Dashboard: ${dashboardUrl}/dashboard`);
|
|
87
170
|
}
|
|
88
171
|
//# sourceMappingURL=init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAUzD,MAAM,SAAS,GAAG;IAChB,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,CAAC,eAAe,CAAC;CACxB,CAAC;AAEF,KAAK,UAAU,UAAU,CAAC,IAAY;IACpC,IAAI,CAAC;QACH,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,WAAmB;IAC7C,MAAM,MAAM,GAAoB,EAAE,CAAC;IAEnC,iEAAiE;IACjE,IAAI,MAAM,UAAU,CAAC,IAAI,CAAC,W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AAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC1E,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;IAC3E,OAAO,CAAC,GAAG,CAAC,gBAAgB,YAAY,YAAY,CAAC,CAAC;AACxD,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { Command } from 'commander';
|
|
4
|
+
import { getCommandDescription } from '@preclaim/core';
|
|
4
5
|
import { initCommand } from './commands/init.js';
|
|
5
6
|
import { loginCommand } from './commands/login.js';
|
|
6
7
|
import { lockCommand } from './commands/lock.js';
|
|
@@ -14,6 +15,7 @@ import { logsCommand } from './commands/logs.js';
|
|
|
14
15
|
import { sessionsCommand } from './commands/sessions.js';
|
|
15
16
|
const require = createRequire(import.meta.url);
|
|
16
17
|
const { version } = require('../package.json');
|
|
18
|
+
const desc = getCommandDescription;
|
|
17
19
|
const program = new Command();
|
|
18
20
|
program
|
|
19
21
|
.name('preclaim')
|
|
@@ -21,55 +23,55 @@ program
|
|
|
21
23
|
.version(version);
|
|
22
24
|
program
|
|
23
25
|
.command('init')
|
|
24
|
-
.description('
|
|
26
|
+
.description(desc('init'))
|
|
25
27
|
.option('--backend <url>', 'Backend URL', 'https://preclaim.dev')
|
|
26
28
|
.option('--project-id <id>', 'Project ID')
|
|
27
29
|
.action(initCommand);
|
|
28
30
|
program
|
|
29
31
|
.command('login')
|
|
30
|
-
.description('
|
|
32
|
+
.description(desc('login'))
|
|
31
33
|
.action(loginCommand);
|
|
32
34
|
program
|
|
33
35
|
.command('lock <file>')
|
|
34
|
-
.description('
|
|
36
|
+
.description(desc('lock'))
|
|
35
37
|
.option('-s, --session <id>', 'Session ID')
|
|
36
38
|
.option('-t, --ttl <minutes>', 'Lock TTL in minutes')
|
|
37
39
|
.action(lockCommand);
|
|
38
40
|
program
|
|
39
41
|
.command('unlock [file]')
|
|
40
|
-
.description('
|
|
42
|
+
.description(desc('unlock'))
|
|
41
43
|
.option('-s, --session <id>', 'Session ID')
|
|
42
44
|
.option('-a, --all', 'Release all locks for this session')
|
|
43
45
|
.action(unlockCommand);
|
|
44
46
|
program
|
|
45
47
|
.command('status')
|
|
46
|
-
.description('
|
|
48
|
+
.description(desc('status'))
|
|
47
49
|
.action(statusCommand);
|
|
48
50
|
program
|
|
49
51
|
.command('check <files...>')
|
|
50
|
-
.description('
|
|
52
|
+
.description(desc('check'))
|
|
51
53
|
.action(checkCommand);
|
|
52
54
|
program
|
|
53
55
|
.command('whoami')
|
|
54
|
-
.description('
|
|
56
|
+
.description(desc('whoami'))
|
|
55
57
|
.action(whoamiCommand);
|
|
56
58
|
program
|
|
57
59
|
.command('config')
|
|
58
|
-
.description('
|
|
60
|
+
.description(desc('config'))
|
|
59
61
|
.option('--get <key>', 'Get a config value')
|
|
60
62
|
.option('--set <key=value>', 'Set a config value')
|
|
61
63
|
.action(configCommand);
|
|
62
64
|
program
|
|
63
65
|
.command('sessions')
|
|
64
|
-
.description('
|
|
66
|
+
.description(desc('sessions'))
|
|
65
67
|
.action(sessionsCommand);
|
|
66
68
|
program
|
|
67
69
|
.command('logs')
|
|
68
|
-
.description('
|
|
70
|
+
.description(desc('logs'))
|
|
69
71
|
.action(logsCommand);
|
|
70
72
|
program
|
|
71
73
|
.command('install-hooks')
|
|
72
|
-
.description('
|
|
74
|
+
.description(desc('install-hooks'))
|
|
73
75
|
.action(installHooksCommand);
|
|
74
76
|
// Internal: hook runner for Claude Code hooks via npx
|
|
75
77
|
const hook = program
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAA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CAAC,CAAC;KACzB,MAAM,CAAC,WAAW,CAAC,CAAC;AAEvB,OAAO;KACJ,OAAO,CAAC,eAAe,CAAC;KACxB,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;KAClC,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAE/B,sDAAsD;AACtD,MAAM,IAAI,GAAG,OAAO;KACjB,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,mCAAmC,CAAC,CAAC;AAEpD,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;IAC7C,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAC1C,CAAC,CAAC,CAAC;AACH,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;IAC9C,MAAM,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAC3C,CAAC,CAAC,CAAC;AACH,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;IAC9C,MAAM,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAC3C,CAAC,CAAC,CAAC;AACH,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;IACrC,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "preclaim",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "AI File Coordination Layer — predictive file locking for AI coding agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"commander": "^13.1.0",
|
|
14
14
|
"minimatch": "^10.0.0",
|
|
15
|
-
"@preclaim/core": "0.
|
|
15
|
+
"@preclaim/core": "0.3.0"
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|