@way_marks/cli 4.0.0 → 4.0.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.
- package/dist/index.js +54 -18
- package/package.json +8 -5
- package/scripts/postinstall.js +44 -0
package/dist/index.js
CHANGED
|
@@ -1,6 +1,57 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
function getVersion() {
|
|
4
|
+
// dist/index.js → ../package.json (when published or installed globally)
|
|
5
|
+
// dev (ts-node from src/) → ../package.json relative to repo
|
|
6
|
+
try {
|
|
7
|
+
return require('../package.json').version || 'unknown';
|
|
8
|
+
}
|
|
9
|
+
catch { }
|
|
10
|
+
try {
|
|
11
|
+
return require('../../package.json').version || 'unknown';
|
|
12
|
+
}
|
|
13
|
+
catch { }
|
|
14
|
+
return 'unknown';
|
|
15
|
+
}
|
|
16
|
+
function printVersion() {
|
|
17
|
+
console.log(`@way_marks/cli ${getVersion()}`);
|
|
18
|
+
}
|
|
19
|
+
function printHelp() {
|
|
20
|
+
console.log(`waymark ${getVersion()} — control what AI agents can do in your codebase`);
|
|
21
|
+
console.log('');
|
|
22
|
+
console.log('Usage: waymark <command> [options] (also: way_marks, npx @way_marks/cli)');
|
|
23
|
+
console.log('');
|
|
24
|
+
console.log('Commands:');
|
|
25
|
+
console.log(' init Set up Waymark in the current project');
|
|
26
|
+
console.log(' start [--port <n>] Start the Waymark dashboard and MCP server');
|
|
27
|
+
console.log(' stop Stop the running Waymark servers');
|
|
28
|
+
console.log(' pause Pause a project (keep port allocated)');
|
|
29
|
+
console.log(' resume Resume a paused project');
|
|
30
|
+
console.log(' status Show current Waymark status and pending count');
|
|
31
|
+
console.log(' logs Show recent action log');
|
|
32
|
+
console.log(' list List all registered Waymark projects');
|
|
33
|
+
console.log(' open Open a project dashboard or start it');
|
|
34
|
+
console.log('');
|
|
35
|
+
console.log('Top-level flags:');
|
|
36
|
+
console.log(' -v, --version Print the installed version');
|
|
37
|
+
console.log(' -h, --help Show this help');
|
|
38
|
+
console.log('');
|
|
39
|
+
console.log('Notes:');
|
|
40
|
+
console.log(' • Default port range is 47000-47999 (avoids collisions with dev servers).');
|
|
41
|
+
console.log(' • Pin a port per-project: add "port": 47100 to waymark.config.json.');
|
|
42
|
+
console.log(' • Override at runtime: waymark start --port 47200');
|
|
43
|
+
}
|
|
3
44
|
const command = process.argv[2];
|
|
45
|
+
// Top-level flags / aliases handled before the command switch so that
|
|
46
|
+
// `waymark -v`, `waymark --version`, and `waymark version` all work.
|
|
47
|
+
if (command === '-v' || command === '--version' || command === 'version') {
|
|
48
|
+
printVersion();
|
|
49
|
+
process.exit(0);
|
|
50
|
+
}
|
|
51
|
+
if (command === '-h' || command === '--help' || command === 'help' || command === undefined) {
|
|
52
|
+
printHelp();
|
|
53
|
+
process.exit(command === undefined ? 0 : 0);
|
|
54
|
+
}
|
|
4
55
|
switch (command) {
|
|
5
56
|
case 'init':
|
|
6
57
|
require('./commands/init').run();
|
|
@@ -30,22 +81,7 @@ switch (command) {
|
|
|
30
81
|
require('./commands/open').run();
|
|
31
82
|
break;
|
|
32
83
|
default:
|
|
33
|
-
console.
|
|
34
|
-
console.
|
|
35
|
-
|
|
36
|
-
console.log(' init Set up Waymark in the current project');
|
|
37
|
-
console.log(' start [--port <n>] Start the Waymark dashboard and MCP server');
|
|
38
|
-
console.log(' stop Stop the running Waymark servers');
|
|
39
|
-
console.log(' pause Pause a project (keep port allocated)');
|
|
40
|
-
console.log(' resume Resume a paused project');
|
|
41
|
-
console.log(' status Show current Waymark status and pending count');
|
|
42
|
-
console.log(' logs Show recent action log');
|
|
43
|
-
console.log(' list List all registered Waymark projects');
|
|
44
|
-
console.log(' open Open a project dashboard or start it');
|
|
45
|
-
console.log('');
|
|
46
|
-
console.log('Notes:');
|
|
47
|
-
console.log(' • Default port range is 47000-47999 (avoids collisions with dev servers).');
|
|
48
|
-
console.log(' • Pin a port per-project: add "port": 47100 to waymark.config.json.');
|
|
49
|
-
console.log(' • Override at runtime: waymark start --port 47200');
|
|
50
|
-
process.exit(command ? 1 : 0);
|
|
84
|
+
console.error(`Unknown command: ${command}`);
|
|
85
|
+
console.error('Run "waymark --help" for usage.');
|
|
86
|
+
process.exit(1);
|
|
51
87
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@way_marks/cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Control what AI agents can do in your codebase",
|
|
5
5
|
"author": "Waymark <hello@waymarks.dev>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,15 +22,18 @@
|
|
|
22
22
|
"agent-control"
|
|
23
23
|
],
|
|
24
24
|
"bin": {
|
|
25
|
-
"waymark": "./dist/index.js"
|
|
25
|
+
"waymark": "./dist/index.js",
|
|
26
|
+
"way_marks": "./dist/index.js"
|
|
26
27
|
},
|
|
27
28
|
"files": [
|
|
28
|
-
"dist/**"
|
|
29
|
+
"dist/**",
|
|
30
|
+
"scripts/postinstall.js"
|
|
29
31
|
],
|
|
30
32
|
"scripts": {
|
|
31
33
|
"build": "tsc",
|
|
32
34
|
"test": "jest",
|
|
33
|
-
"test:coverage": "jest --coverage"
|
|
35
|
+
"test:coverage": "jest --coverage",
|
|
36
|
+
"postinstall": "node scripts/postinstall.js"
|
|
34
37
|
},
|
|
35
38
|
"jest": {
|
|
36
39
|
"preset": "ts-jest",
|
|
@@ -40,7 +43,7 @@
|
|
|
40
43
|
]
|
|
41
44
|
},
|
|
42
45
|
"dependencies": {
|
|
43
|
-
"@way_marks/server": "4.0.
|
|
46
|
+
"@way_marks/server": "4.0.2"
|
|
44
47
|
},
|
|
45
48
|
"devDependencies": {
|
|
46
49
|
"@types/jest": "^30.0.0",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Friendly post-install banner.
|
|
4
|
+
*
|
|
5
|
+
* Runs only when @way_marks/cli is installed globally (so it doesn't
|
|
6
|
+
* spam users who add it as a dev-dep). Anything that goes wrong is
|
|
7
|
+
* silently swallowed — postinstall must never fail the install.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
// npm sets npm_config_global=true for `npm i -g`. We only want the banner
|
|
12
|
+
// for global installs; in dev (added as a dep) it would be noise.
|
|
13
|
+
const isGlobal =
|
|
14
|
+
process.env.npm_config_global === 'true' ||
|
|
15
|
+
process.env.npm_global === 'true';
|
|
16
|
+
if (!isGlobal) process.exit(0);
|
|
17
|
+
|
|
18
|
+
// Skip in CI to avoid spamming logs. Don't gate on isTTY — npm pipes child
|
|
19
|
+
// stdout through itself during install, so isTTY is always false even when
|
|
20
|
+
// the user is at an interactive terminal.
|
|
21
|
+
if (process.env.CI) process.exit(0);
|
|
22
|
+
|
|
23
|
+
const pkg = require('../package.json');
|
|
24
|
+
const version = pkg.version || 'unknown';
|
|
25
|
+
|
|
26
|
+
const lines = [
|
|
27
|
+
'',
|
|
28
|
+
` ✓ @way_marks/cli@${version} installed.`,
|
|
29
|
+
'',
|
|
30
|
+
' Run: waymark init — set up Waymark in your current project',
|
|
31
|
+
' waymark start — launch the dashboard + MCP server',
|
|
32
|
+
' waymark --help — full command list',
|
|
33
|
+
'',
|
|
34
|
+
' Tip: the binary is `waymark` (also accepts `way_marks`).',
|
|
35
|
+
'',
|
|
36
|
+
];
|
|
37
|
+
// Write to stderr so npm forwards it reliably during global install.
|
|
38
|
+
// (npm buffers install-script stdout at the default log level; stderr is
|
|
39
|
+
// surfaced as a notice.)
|
|
40
|
+
for (const l of lines) process.stderr.write(l + '\n');
|
|
41
|
+
} catch {
|
|
42
|
+
// never block npm install on banner failure
|
|
43
|
+
process.exit(0);
|
|
44
|
+
}
|