intent-system 0.22.0

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/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # intent-system
2
+
3
+ `intent-system` is the npm distribution entry point for `intent-cli`. It
4
+ installs the matching self-contained release binary through an npm optional
5
+ dependency for macOS Apple Silicon, Linux x64, or Windows x64.
6
+
7
+ For a persistent command:
8
+
9
+ ```bash
10
+ npm install -g intent-system
11
+ intent-cli --version
12
+ ```
13
+
14
+ For a one-shot invocation:
15
+
16
+ ```bash
17
+ npx intent-system guide onboarding
18
+ ```
19
+
20
+ The thin shim never installs packages and has no `postinstall` download hook.
21
+ When npx is used and no `intent-cli` is already on `PATH`, it prints one short
22
+ line suggesting the global install after the command completes. The release
23
+ pipeline writes a checksum for every platform package and verifies package,
24
+ binary, and `--version` identity before publishing.
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict';
4
+
5
+ const fs = require('node:fs');
6
+ const path = require('node:path');
7
+ const { spawnSync } = require('node:child_process');
8
+
9
+ const platformPackage = new Map([
10
+ ['darwin:arm64', '@j-tech-japan/intent-cli-darwin-arm64'],
11
+ ['linux:x64', '@j-tech-japan/intent-cli-linux-x64'],
12
+ ['win32:x64', '@j-tech-japan/intent-cli-win32-x64'],
13
+ ]);
14
+
15
+ function platformBinaryName() {
16
+ return process.platform === 'win32' ? 'intent-cli.exe' : 'intent-cli';
17
+ }
18
+
19
+ function findPlatformBinary() {
20
+ const key = `${process.platform}:${process.arch}`;
21
+ const packageName = platformPackage.get(key);
22
+ if (!packageName) {
23
+ throw new Error(
24
+ `intent-system does not ship a self-contained intent-cli binary for ${process.platform}/${process.arch}. ` +
25
+ 'Install JTechJapan.IntentSystem.Cli with dotnet or use a supported release platform.',
26
+ );
27
+ }
28
+
29
+ const binaryName = platformBinaryName();
30
+ let packageBinary;
31
+ try {
32
+ packageBinary = require.resolve(`${packageName}/bin/${binaryName}`);
33
+ } catch {
34
+ throw new Error(
35
+ `The optional dependency ${packageName} is not installed for ${process.platform}/${process.arch}. ` +
36
+ 'Reinstall intent-system with optional dependencies enabled.',
37
+ );
38
+ }
39
+
40
+ return packageBinary;
41
+ }
42
+
43
+ function pathHasIntentCli() {
44
+ const pathValue = process.env.PATH || '';
45
+ const names = process.platform === 'win32'
46
+ ? ['intent-cli.exe', 'intent-cli.cmd', 'intent-cli']
47
+ : ['intent-cli'];
48
+
49
+ return pathValue.split(path.delimiter).filter(Boolean).some((directory) =>
50
+ names.some((name) => {
51
+ const candidate = path.join(directory, name);
52
+ try {
53
+ fs.accessSync(candidate, fs.constants.X_OK);
54
+ return true;
55
+ } catch {
56
+ return false;
57
+ }
58
+ }),
59
+ );
60
+ }
61
+
62
+ function wasInvokedByNpx() {
63
+ const userAgent = process.env.npm_config_user_agent || process.env.NPM_CONFIG_USER_AGENT || '';
64
+ return /(?:^|\s|\/)npx(?:\/|\s|$)/i.test(userAgent) || /^npx(?:\/|\s|$)/i.test(userAgent);
65
+ }
66
+
67
+ function emitNpxGuidanceOnce() {
68
+ process.stderr.write(
69
+ 'For a persistent install, run: npm install -g intent-system; then use intent-cli.\n',
70
+ );
71
+ }
72
+
73
+ function main() {
74
+ const binary = findPlatformBinary();
75
+ const result = spawnSync(binary, process.argv.slice(2), {
76
+ env: process.env,
77
+ stdio: 'inherit',
78
+ });
79
+
80
+ if (result.error) {
81
+ throw result.error;
82
+ }
83
+
84
+ if (result.status === 0 && wasInvokedByNpx() && !pathHasIntentCli()) {
85
+ emitNpxGuidanceOnce();
86
+ }
87
+
88
+ process.exitCode = result.status ?? 1;
89
+ }
90
+
91
+ try {
92
+ main();
93
+ } catch (error) {
94
+ process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
95
+ process.exitCode = 1;
96
+ }
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "intent-system",
3
+ "version": "0.22.0",
4
+ "description": "The intent-cli command, distributed with self-contained platform binaries.",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/J-Tech-Japan/intent-system.git"
9
+ },
10
+ "homepage": "https://github.com/J-Tech-Japan/intent-system",
11
+ "engines": {
12
+ "node": ">=18"
13
+ },
14
+ "bin": {
15
+ "intent-cli": "bin/intent-cli.js"
16
+ },
17
+ "files": [
18
+ "bin",
19
+ "README.md"
20
+ ],
21
+ "optionalDependencies": {
22
+ "@j-tech-japan/intent-cli-darwin-arm64": "0.22.0",
23
+ "@j-tech-japan/intent-cli-linux-x64": "0.22.0",
24
+ "@j-tech-japan/intent-cli-win32-x64": "0.22.0"
25
+ },
26
+ "scripts": {
27
+ "test": "node --test test/*.test.js"
28
+ }
29
+ }