@lark-codem/lark-cli 0.0.0-stage → 0.1.0-codem.4

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 CHANGED
@@ -1,3 +1,21 @@
1
- # Temporary Holding Version
1
+ # CodeM Lark CLI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Maintained in [codem-cli-adapters](https://code.byted.org/dc/codem-cli-adapters). Fixed official Agent Skills are packaged in the sibling `packages/codem-larkcli-plugin`; credentials and authorization remain in Base.
4
+
5
+ Install `@lark-codem/lark-cli` with optional dependencies enabled, then invoke `lark-cli` directly. The main package selects exactly one matching native package on macOS, Windows or Linux, x64 or arm64. Hosts can synchronously load `require('@lark-codem/lark-cli').resolveLarkCliBinary()` and link the returned native executable onto PATH. `packageVersion` and `@lark-codem/lark-cli/package.json` expose the exact package version.
6
+
7
+ The pinned official CLI owns personal commands, OAuth, profiles, user credentials, document formats, output and exit codes. With no task context, `CODEM_LARK_CLI_MODE=personal` (or unset) executes that CLI unchanged, including the host's managed UAT and `LARKSUITE_CLI_STRICT_MODE=user` environment.
8
+
9
+ `CODEM_LARK_CLI_MODE=task`, a task token, dispatch ID or native sandbox marker selects the task boundary. `CODEM_TOKEN` and `CODEM_SANDBOX_DISPATCH_ID` (legacy `CODEM_DISPATCH_ID`) are both required; incomplete context fails before any business request. An explicit personal hint cannot downgrade an existing task. Task invocations isolate personal CLI config, ignore personal Lark credentials, use controlled placeholder credentials and send OpenAPI requests through the CodeM gateway. Gateway denial never falls back to personal auth. Sandbox business requests use the bot placeholder; Base executes with application TAT only. Sandbox calls never load, refresh or use a UAT. Base disables the calendar, meeting/minutes, whiteboard and user-identity helper capabilities in both sandbox scenes. Commands that require user credentials cannot run with the sandbox bot-only provider. Tag resource operations require Base to prove the initiator's permission under its configured policy; application access alone does not grant task access. Explicit `--as user`, app selection and personal profiles are rejected in task mode.
10
+
11
+ Personal and sandbox modes retain the pinned official business commands, parameters and help. The CLI does not consume the capability catalog, filter commands by scene, or rewrite business options. All sandbox scenes share the same functional Skills. Legacy `CODEM_LARK_TASK_SCENE` hints are ignored. Base independently resolves the persisted task scene and authorizes every logical request; a visible command does not grant permission. Official Skills are distributed separately as `@lark-codem/codem-larkcli-plugin` and a static plugin ZIP, loaded unchanged by the existing managed-resource loader in every scene. The sandbox plugin retains only Meegle work-item operations.
12
+
13
+ The gateway base accepts an HTTPS origin or the same origin with `/goapi/codem` (and an optional trailing slash), including the Native host's `CODEM_SERVER_URL`. Both forms produce exactly `/goapi/codem/lark_proxy/request`; arbitrary paths, query strings, fragments and embedded credentials remain rejected. Version and official help commands work offline without a gateway or task token, while retaining task mode and private config. Business commands still require the complete task context and never fall back to personal credentials.
14
+
15
+ `node packages/lark-cli/scripts/release.mjs` cross-compiles six executables with the npm package version embedded in the official `--version` output and packs the six platform packages followed by the main package. Artifacts, `manifest.json` and `SHA256SUMS` are written under `.artifacts/lark-cli/<version>/`. Each platform package exports its native binary, `package.json`, and `manifest.json` with the native SHA256, version and pinned upstream.
16
+
17
+ The default command does not publish. Explicit `--publish --tag codem` publishes the exact platform tarballs first, checks each registry integrity, then publishes the main tarball. The current local candidate is `0.1.0-codem.4`, including document media/history support and the sandbox application-only boundary. Previously released artifacts remain immutable; update the main version, all six platform versions and exact optional dependencies together. Install all seven local tarballs with `npm install --ignore-scripts --offline --force <paths>` in an isolated test directory to validate a local candidate without registry publication. Production installs select the platform through npm normally.
18
+
19
+ Sandbox local auth/config/skills management is disabled because it does not pass through Base. The official self-update command and upstream update/skills notices are disabled. Upgrade this distribution through the CodeM installer or host so the custom task boundary remains installed. All personal business and auth commands retain the official implementation.
20
+
21
+ Native Linux fixture and installed-tarball tests verify protocol and packaging. Builds use CGO_ENABLED=0, -trimpath and -buildvcs=false; native manifests identify the exact executable bytes. Cross-compilation does not substitute for macOS and Windows native execution checks.
@@ -0,0 +1,23 @@
1
+ This package embeds github.com/larksuite/cli at 97f0dabe7b046f45cfd820453b8305aeed47a601.
2
+
3
+ MIT License
4
+
5
+ Copyright (c) 2026 Lark Technologies Pte. Ltd.
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from 'node:child_process';
3
+ import { resolveLarkCliBinary } from '../resolve.cjs';
4
+ try {
5
+ const result = spawnSync(resolveLarkCliBinary(), process.argv.slice(2), { stdio: 'inherit' });
6
+ if (result.error) throw result.error;
7
+ if (result.signal) process.kill(process.pid, result.signal);
8
+ else process.exit(result.status ?? 1);
9
+ } catch (error) {
10
+ console.error(error.message);
11
+ process.exit(1);
12
+ }
package/package.json CHANGED
@@ -1,6 +1,41 @@
1
1
  {
2
2
  "name": "@lark-codem/lark-cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0-codem.4",
4
+ "description": "Official Lark CLI with CodeM personal and task credential boundaries.",
5
+ "type": "module",
6
+ "bin": {
7
+ "lark-cli": "bin/lark-cli.js"
8
+ },
9
+ "exports": {
10
+ ".": "./resolve.cjs",
11
+ "./package.json": "./package.json"
12
+ },
13
+ "files": [
14
+ "bin",
15
+ "resolve.cjs",
16
+ "platforms.cjs",
17
+ "README.md",
18
+ "THIRD_PARTY_NOTICES"
19
+ ],
20
+ "scripts": {
21
+ "test": "node --test test/*.test.mjs",
22
+ "test:cli": "cd cli && go test ./...",
23
+ "pack:release": "node scripts/release.mjs",
24
+ "test:package": "node scripts/test-package.mjs"
25
+ },
26
+ "optionalDependencies": {
27
+ "@lark-codem/lark-cli-darwin-x64": "0.1.0-codem.4",
28
+ "@lark-codem/lark-cli-darwin-arm64": "0.1.0-codem.4",
29
+ "@lark-codem/lark-cli-linux-x64": "0.1.0-codem.4",
30
+ "@lark-codem/lark-cli-linux-arm64": "0.1.0-codem.4",
31
+ "@lark-codem/lark-cli-win32-x64": "0.1.0-codem.4",
32
+ "@lark-codem/lark-cli-win32-arm64": "0.1.0-codem.4"
33
+ },
34
+ "engines": {
35
+ "node": ">=18"
36
+ },
37
+ "publishConfig": {
38
+ "registry": "https://registry.npmjs.org",
39
+ "access": "public"
40
+ }
41
+ }
package/platforms.cjs ADDED
@@ -0,0 +1,14 @@
1
+ const targets = [
2
+ ['darwin', 'x64', 'darwin', 'amd64'],
3
+ ['darwin', 'arm64', 'darwin', 'arm64'],
4
+ ['linux', 'x64', 'linux', 'amd64'],
5
+ ['linux', 'arm64', 'linux', 'arm64'],
6
+ ['win32', 'x64', 'windows', 'amd64'],
7
+ ['win32', 'arm64', 'windows', 'arm64'],
8
+ ].map(([platform, arch, goos, goarch]) => ({
9
+ platform, arch, goos, goarch,
10
+ directory: `${platform}-${arch}`,
11
+ executable: platform === 'win32' ? 'lark-cli.exe' : 'lark-cli',
12
+ packageName: `@lark-codem/lark-cli-${platform}-${arch}`,
13
+ }));
14
+ exports.targets = targets;
package/resolve.cjs ADDED
@@ -0,0 +1,19 @@
1
+ const { existsSync } = require('node:fs');
2
+ const { targets } = require('./platforms.cjs');
3
+ const { version } = require('./package.json');
4
+
5
+ // Synchronous for host installers using createRequire. Resolution never runs a
6
+ // subprocess or changes installed files. Hosts may link the returned native
7
+ // executable directly onto PATH; agents invoke the ordinary `lark-cli` command.
8
+ function resolveLarkCliBinary({ platform = process.platform, arch = process.arch, resolve = require.resolve } = {}) {
9
+ const target = targets.find(target => target.platform === platform && target.arch === arch);
10
+ if (!target) throw new Error(`unsupported Lark CLI platform: ${platform}/${arch}`);
11
+ let binary;
12
+ try { binary = resolve(`${target.packageName}/${target.executable}`); } catch {
13
+ throw new Error(`Lark CLI ${version} for ${platform}/${arch} is missing; reinstall @lark-codem/lark-cli with optional dependencies enabled.`);
14
+ }
15
+ if (!existsSync(binary)) throw new Error(`Lark CLI native executable is missing: ${binary}`);
16
+ return binary;
17
+ }
18
+ exports.resolveLarkCliBinary = resolveLarkCliBinary;
19
+ exports.packageVersion = version;