@native-marketing/cli 0.0.0-stage → 0.1.1
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 +27 -2
- package/dist/agent.js +14 -0
- package/dist/cf-agent.js +18 -0
- package/dist/cf.js +15 -0
- package/dist/index.js +11 -0
- package/package.json +39 -4
- package/release.json +7 -0
- package/types/agent/index.d.ts +2 -0
- package/types/agent/main.d.ts +2 -0
- package/types/agent/run.d.ts +23 -0
- package/types/cli/index.d.ts +2 -0
- package/types/cli/main.d.ts +2 -0
package/README.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @native-marketing/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Node.js 24 authenticated Native Marketing CLI. One package supplies `cf` and `cf-agent`; both use `@native-marketing/sdk` and the same server capabilities. No database access, server administration, Runtime or automatic business execution.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install -g @native-marketing/cli
|
|
7
|
+
cf help --json
|
|
8
|
+
cf-agent help capabilities --json
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Sign in to the exact resource using the existing OAuth flow:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
cf auth login --resource https://ip.shipkitx.com/mcp/projects/PRJ-000003 \
|
|
15
|
+
--profile marketing --scope 'cf.context.read cf.survey.read' --json
|
|
16
|
+
cf context --profile marketing --json
|
|
17
|
+
cf capabilities find '当前定位' --profile marketing --json
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Request the scopes needed for your authorized work. A project code or profile name does not grant access. Credentials are stored owner-only in `~/.config/content-factory-agent/` unless `CF_AGENT_CONFIG_DIR` is set. Never pass a token as a command argument. `auth import --token-file` accepts a protected local file; it does not exchange AgentStack API keys for Native OAuth.
|
|
21
|
+
|
|
22
|
+
Help is layered: `help`, `help <group>`, `help all`. Discovery returns only currently visible capabilities; exact input schema is loaded on demand. `search` finds saved content. Supply exact business inputs through stdin or `--input-file`, keeping schema/view controls separate. Business writes require the existing request ID, concurrency checks and human authorization.
|
|
23
|
+
|
|
24
|
+
`--json` returns one JSON envelope on stdout; OAuth interaction prompts go to stderr. Errors carry code, outcome and safe recovery details. UNKNOWN means the original write may have happened: query its original read-only receipt before deciding what to do. The CLI never automatically replays an unknown write. A receipt is the original result; reread current state separately. A lost write permission may still allow authorized receipt recovery, but cannot authorize a new write.
|
|
25
|
+
|
|
26
|
+
The package exports its existing programmatic CLI surface and an `/agent` entry. Use `@native-marketing/sdk` for direct client APIs, or `@native-marketing/sdk/http` for typed HTTP calls. Installing or asking for help does not start work or a Runtime.
|
|
27
|
+
|
|
28
|
+
The package's `release.json` identifies the source commit. Public availability does not change source licensing (UNLICENSED). Installation does not deploy or migrate a Native Marketing server.
|
package/dist/agent.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// apps/agent-cli/src/run.ts
|
|
2
|
+
import { runNetworkCli } from "@native-marketing/sdk";
|
|
3
|
+
var runAgentCli = (args, env, io) => runNetworkCli(args, env, io, "cf-agent");
|
|
4
|
+
|
|
5
|
+
// apps/agent-cli/src/index.ts
|
|
6
|
+
import {
|
|
7
|
+
withNativeAgentClient,
|
|
8
|
+
NativeAgentClientError
|
|
9
|
+
} from "@native-marketing/sdk";
|
|
10
|
+
export {
|
|
11
|
+
NativeAgentClientError,
|
|
12
|
+
runAgentCli,
|
|
13
|
+
withNativeAgentClient
|
|
14
|
+
};
|
package/dist/cf-agent.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// apps/agent-cli/src/run.ts
|
|
4
|
+
import { runNetworkCli } from "@native-marketing/sdk";
|
|
5
|
+
var runAgentCli = (args, env, io) => runNetworkCli(args, env, io, "cf-agent");
|
|
6
|
+
|
|
7
|
+
// apps/agent-cli/src/index.ts
|
|
8
|
+
import {
|
|
9
|
+
withNativeAgentClient,
|
|
10
|
+
NativeAgentClientError
|
|
11
|
+
} from "@native-marketing/sdk";
|
|
12
|
+
|
|
13
|
+
// apps/agent-cli/src/main.ts
|
|
14
|
+
var result = await runAgentCli(process.argv.slice(2));
|
|
15
|
+
process.stdout.write(
|
|
16
|
+
JSON.stringify(result.envelope, null, process.argv.includes("--json") ? void 0 : 2) + "\n"
|
|
17
|
+
);
|
|
18
|
+
process.exitCode = result.exitCode;
|
package/dist/cf.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// apps/cli/src/index.ts
|
|
4
|
+
import { runNetworkCli } from "@native-marketing/sdk";
|
|
5
|
+
import {
|
|
6
|
+
withNativeAgentClient,
|
|
7
|
+
NativeAgentClientError
|
|
8
|
+
} from "@native-marketing/sdk";
|
|
9
|
+
|
|
10
|
+
// apps/cli/src/main.ts
|
|
11
|
+
var result = await runNetworkCli(process.argv.slice(2));
|
|
12
|
+
process.stdout.write(
|
|
13
|
+
JSON.stringify(result.envelope, null, process.argv.includes("--json") ? void 0 : 2) + "\n"
|
|
14
|
+
);
|
|
15
|
+
process.exitCode = result.exitCode;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// apps/cli/src/index.ts
|
|
2
|
+
import { runNetworkCli } from "@native-marketing/sdk";
|
|
3
|
+
import {
|
|
4
|
+
withNativeAgentClient,
|
|
5
|
+
NativeAgentClientError
|
|
6
|
+
} from "@native-marketing/sdk";
|
|
7
|
+
export {
|
|
8
|
+
NativeAgentClientError,
|
|
9
|
+
runNetworkCli as runCli,
|
|
10
|
+
withNativeAgentClient
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@native-marketing/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=24 <25"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/SENLIN746/native-marketing.git"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public",
|
|
15
|
+
"registry": "https://registry.npmjs.org/"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist/",
|
|
19
|
+
"types/",
|
|
20
|
+
"README.md",
|
|
21
|
+
"release.json"
|
|
22
|
+
],
|
|
23
|
+
"description": "Native Marketing authenticated CLI; cf and cf-agent share the public SDK",
|
|
24
|
+
"bin": {
|
|
25
|
+
"cf": "./dist/cf.js",
|
|
26
|
+
"cf-agent": "./dist/cf-agent.js"
|
|
27
|
+
},
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./types/cli/index.d.ts",
|
|
31
|
+
"default": "./dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./agent": {
|
|
34
|
+
"types": "./types/agent/index.d.ts",
|
|
35
|
+
"default": "./dist/agent.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@native-marketing/sdk": "0.1.1"
|
|
40
|
+
}
|
|
41
|
+
}
|
package/release.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { runNetworkCli } from '@native-marketing/sdk';
|
|
2
|
+
export declare const runAgentCli: (args: Parameters<typeof runNetworkCli>[0], env?: Parameters<typeof runNetworkCli>[1], io?: Parameters<typeof runNetworkCli>[2]) => Promise<{
|
|
3
|
+
exitCode: number;
|
|
4
|
+
envelope: {
|
|
5
|
+
ok: boolean;
|
|
6
|
+
command: string;
|
|
7
|
+
data: null;
|
|
8
|
+
error: {
|
|
9
|
+
code: string;
|
|
10
|
+
message: string;
|
|
11
|
+
outcome: "NOT_SENT" | "REJECTED" | "UNKNOWN";
|
|
12
|
+
details?: Record<string, unknown>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
} | {
|
|
16
|
+
exitCode: number;
|
|
17
|
+
envelope: {
|
|
18
|
+
ok: boolean;
|
|
19
|
+
command: string;
|
|
20
|
+
data: unknown;
|
|
21
|
+
error: null;
|
|
22
|
+
};
|
|
23
|
+
}>;
|