@wirecat/cli-template 0.1.6 → 0.1.7
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/.github/workflows/changelog-guard.yml +1 -1
- package/.github/workflows/ci.yml +5 -2
- package/.markdownlint-cli2.jsonc +11 -1
- package/CHANGELOG.md +33 -0
- package/README.md +19 -0
- package/SECURITY.md +1 -1
- package/bin/release +18 -6
- package/cspell.json +1 -1
- package/dist/commands/doctor.d.ts +69 -36
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +39 -12
- package/dist/commands/doctor.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/commands.md +18 -2
- package/docs/dev/skills/release/SKILL.md +2 -0
- package/docs/dev/test-matrix.md +3 -1
- package/docs/installation.md +2 -2
- package/docs/security.md +5 -1
- package/docs/troubleshooting.md +1 -0
- package/kit/dist/new.js +6 -0
- package/package.json +8 -7
- package/pnpm-workspace.yaml +2 -0
- package/scripts/docs-rules.ts +1 -1
- package/src/commands/doctor.ts +38 -11
- package/src/program.test.ts +35 -2
- package/src/roots.test.ts +16 -0
- package/src/testing/sandbox.ts +4 -7
- package/src/version.ts +1 -1
|
@@ -9,4 +9,4 @@ permissions:
|
|
|
9
9
|
|
|
10
10
|
jobs:
|
|
11
11
|
changelog:
|
|
12
|
-
uses: WireCatLabs/cli-base/.github/workflows/changelog-guard.yml@
|
|
12
|
+
uses: WireCatLabs/cli-base/.github/workflows/changelog-guard.yml@d8d32114a008109b9d0a8d04e729b20d81bc6122 # v0.57.0
|
package/.github/workflows/ci.yml
CHANGED
|
@@ -85,5 +85,8 @@ jobs:
|
|
|
85
85
|
echo "${VALE_SHA256} vale.tar.gz" | sha256sum -c -
|
|
86
86
|
tar -xzf vale.tar.gz vale
|
|
87
87
|
# Style findings are annotations until the rules are tuned; the tone rule (an error) fails.
|
|
88
|
-
|
|
89
|
-
- run:
|
|
88
|
+
# kit/ is the template's own; a CLI made from it has none.
|
|
89
|
+
- run: |
|
|
90
|
+
pages="README.md CHANGELOG.md docs/*.md $(git ls-files kit/README.md)"
|
|
91
|
+
./vale --output line $pages | sed 's/^/::warning::/' || true
|
|
92
|
+
./vale --minAlertLevel error $pages
|
package/.markdownlint-cli2.jsonc
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"globs": [
|
|
2
|
+
"globs": [
|
|
3
|
+
"README.md",
|
|
4
|
+
"SECURITY.md",
|
|
5
|
+
"CHANGELOG.md",
|
|
6
|
+
"kit/README.md",
|
|
7
|
+
"AGENTS.md",
|
|
8
|
+
"CLAUDE.md",
|
|
9
|
+
"docs/*.md",
|
|
10
|
+
"docs/dev/**/*.md",
|
|
11
|
+
"skills/**/*.md"
|
|
12
|
+
],
|
|
3
13
|
"ignores": ["node_modules", "dist", ".worktrees", "config/wirecat", "docs/commands.md", "docs/dev/test-matrix.md"],
|
|
4
14
|
"config": {
|
|
5
15
|
"extends": "./config/wirecat/markdownlint.json"
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,39 @@
|
|
|
3
3
|
Notable changes to `@wirecat/cli-template`. One section per version, newest first; versions follow
|
|
4
4
|
[semantic versioning](https://semver.org), so before `1.0.0` the skeleton may still change.
|
|
5
5
|
|
|
6
|
+
<!-- cspell:words katex smol -->
|
|
7
|
+
|
|
8
|
+
## 0.1.7 — 25.10.2026
|
|
9
|
+
|
|
10
|
+
### Changed — may break callers
|
|
11
|
+
|
|
12
|
+
- **The skeleton runs on cli-core 0.428.0 and cli-base 0.57.0.** `config set` saves `config.json` readable by its
|
|
13
|
+
owner only (`0600`); it used to rewrite it as `0644`. Anything that reads the file as another user can no longer
|
|
14
|
+
read it after the next save. `skill status` and `skill show --for claude|agents` are new shared commands. A run
|
|
15
|
+
record gains `cli_command`, `argv`, `agent` and, for a failed run, `error`.
|
|
16
|
+
- **`bin/release --local` reads the keyring only for the account in `NPM_KEYRING_ACCOUNT`.** It used to look up one
|
|
17
|
+
fixed account name; now nothing is looked up while the variable is unset, and the token comes from `NPM_TOKEN` or
|
|
18
|
+
your npm login. To keep using the keyring, `export NPM_KEYRING_ACCOUNT=<account>` with the account the token is
|
|
19
|
+
stored under (service `npm`). A failed lookup says so on stderr and never prints the token.
|
|
20
|
+
- **The prose check in `ci.yml` reads `CHANGELOG.md` too.** A tone error in the changelog now fails the `prose` job
|
|
21
|
+
after `upgrade`. A new CLI's `docs:check` and `docs:spell` also cover `CHANGELOG.md`.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- **A CLI's `SECURITY.md` and `docs/security.md` still link its own repository,** and the template's copies link
|
|
26
|
+
cli-template instead of a repository that does not exist. `new` rewrites the two links.
|
|
27
|
+
- **The skeleton compiles against cli-core on `@modelcontextprotocol/server` 2.4.** It moves to server 2.4.0; until a
|
|
28
|
+
cli-core release ranges the server `^2.4.0`, an override in `pnpm-workspace.yaml` gives cli-core the same copy,
|
|
29
|
+
since two copies fail to compile `src/mcp.ts`.
|
|
30
|
+
|
|
31
|
+
### Security
|
|
32
|
+
|
|
33
|
+
- **`doctor` reports a `config.json` or config folder that other users can read, with the `chmod` that fixes it.**
|
|
34
|
+
`doctor --json` gains `files: { checked, ok, problems }`, each problem `{ path, mode, want }`: the file wants `0600`,
|
|
35
|
+
its folder `0700`. stderr prints `to make it private: chmod 600 '<path>'` for each; nothing is changed on disk.
|
|
36
|
+
`files` is in the answer also when the settings are refused. Windows is not checked (`checked: false`). `src/` is
|
|
37
|
+
copied once, so a CLI started from an older template copies `src/commands/doctor.ts`.
|
|
38
|
+
|
|
6
39
|
## 0.1.6 — 25.10.2026
|
|
7
40
|
|
|
8
41
|
### Changed — may break callers
|
package/README.md
CHANGED
|
@@ -42,6 +42,25 @@ such as `personal` in `clidev personal config show`; none is ever assumed. `CLID
|
|
|
42
42
|
`clidev skill show` prints the rules an agent follows with this tool. `clidev personal mcp` serves every command to an
|
|
43
43
|
agent, writes included: the profile's permissions decide what runs. See [MCP and permissions](docs/usage.md#agents).
|
|
44
44
|
|
|
45
|
+
## Why this template
|
|
46
|
+
|
|
47
|
+
A new WireCat CLI must meet the same standards as the others from its first commit: the shared commands, the
|
|
48
|
+
settings, the agent skill, MCP, the checks and the release. Built by hand, that is days of copying and some of it
|
|
49
|
+
is missed. `new` gives a CLI that already passes every check, so the work starts on the service itself. `upgrade`
|
|
50
|
+
keeps the shared files in step later, so a CLI made today does not drift from one made next year.
|
|
51
|
+
|
|
52
|
+
## Main features
|
|
53
|
+
|
|
54
|
+
- **`new`** copies the skeleton, renames `clidev` to your command word, and writes the design answers into
|
|
55
|
+
`docs/dev/DESIGN.md`. It asks for each missing answer and never guesses one.
|
|
56
|
+
- **`upgrade`** merges each template change into your CLI file by file, and asks before it touches a file you changed.
|
|
57
|
+
- **The skeleton runs.** The shared root commands, settings with permissions, the agent skill and the MCP server
|
|
58
|
+
work before a line of your own code.
|
|
59
|
+
- **Every check is wired in:** lint, types, tests with a coverage floor, command contracts, the docs checks and the
|
|
60
|
+
release script.
|
|
61
|
+
|
|
62
|
+
The copy tool is described in [kit/README.md](kit/README.md).
|
|
63
|
+
|
|
45
64
|
## Profiles
|
|
46
65
|
|
|
47
66
|
A profile is a name you choose for one account, such as `personal` or `work`. It is the first word of every command
|
package/SECURITY.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Please report a security problem privately — never in a public issue:
|
|
4
4
|
|
|
5
5
|
- by email: [hello@wirecat.dev](mailto:hello@wirecat.dev);
|
|
6
|
-
- or through [GitHub's private vulnerability reporting](https://github.com/WireCatLabs/
|
|
6
|
+
- or through [GitHub's private vulnerability reporting](https://github.com/WireCatLabs/cli-template/security/advisories/new).
|
|
7
7
|
|
|
8
8
|
Say what you saw, how to repeat it, and the version (`clidev --version`). Never send a token, a password or anyone's
|
|
9
9
|
private content.
|
package/bin/release
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
# bin/release # publishes from GitHub Actions (.github/workflows/release.yml, npm trusted publishing)
|
|
7
7
|
# bin/release --local # publishes from this computer: NPM_TOKEN if exported, else the keyring, else `npm login`
|
|
8
8
|
#
|
|
9
|
+
# The keyring is read only when NPM_KEYRING_ACCOUNT names the account the token is stored under
|
|
10
|
+
# (`secret-tool store --label=npm service npm account <account>`); unset, the keyring is skipped.
|
|
11
|
+
#
|
|
9
12
|
# A package that is not on npm yet is published the same way; its first version needs --local until npm trusts
|
|
10
13
|
# release.yml. The npm token is never printed and never written to a file (WC-REL-14).
|
|
11
14
|
set -eu
|
|
@@ -77,6 +80,12 @@ land() {
|
|
|
77
80
|
{ echo "main is not origin/main after $pr" >&2; exit 1; }
|
|
78
81
|
}
|
|
79
82
|
|
|
83
|
+
# A pull request checked before the last release and merged after it put its entry in that release's section;
|
|
84
|
+
# restore moves it to Unreleased, so the fold below brings it into this version.
|
|
85
|
+
restored=$(npx -y -p @wirecat/cli-base@0.55.1 cli-dev changelog restore --land)
|
|
86
|
+
[ -z "$restored" ] || echo "$restored"
|
|
87
|
+
rerun_if_changed "$@"
|
|
88
|
+
|
|
80
89
|
# A merge after the version was dated, but before it was published, adds Unreleased above it; --land folds it on a
|
|
81
90
|
# fresh main through its own pull request.
|
|
82
91
|
folded=""
|
|
@@ -147,10 +156,12 @@ if [ "$mode" = ci ]; then
|
|
|
147
156
|
exit 0
|
|
148
157
|
fi
|
|
149
158
|
|
|
150
|
-
#
|
|
151
|
-
# ~/.npmrc as usual.
|
|
152
|
-
|
|
153
|
-
|
|
159
|
+
# No default account: this file is copied into every CLI, and one person's account name does not belong in it.
|
|
160
|
+
# Without NPM_TOKEN or the entry, npm reads your own login from ~/.npmrc as usual.
|
|
161
|
+
keyring_account=${NPM_KEYRING_ACCOUNT:-}
|
|
162
|
+
if [ -z "$publish_token" ] && [ -n "$keyring_account" ] && command -v secret-tool >/dev/null 2>&1; then
|
|
163
|
+
publish_token=$(secret-tool lookup service npm account "$keyring_account" 2>/dev/null) || publish_token=""
|
|
164
|
+
[ -n "$publish_token" ] || echo "no npm token in the keyring for service npm, account $keyring_account" >&2
|
|
154
165
|
fi
|
|
155
166
|
|
|
156
167
|
# Our own npm config names the variable, not the value, so the token stays in the publish process's environment.
|
|
@@ -162,8 +173,9 @@ if [ -n "$publish_token" ]; then
|
|
|
162
173
|
set -- --userconfig "$config"
|
|
163
174
|
else
|
|
164
175
|
npm whoami >/dev/null 2>&1 || {
|
|
165
|
-
echo "no npm token: export NPM_TOKEN
|
|
166
|
-
echo "
|
|
176
|
+
echo "no npm token: export NPM_TOKEN; or store one with" >&2
|
|
177
|
+
echo " secret-tool store --label=npm service npm account <account>" >&2
|
|
178
|
+
echo "and export NPM_KEYRING_ACCOUNT=<account>; or run npm login" >&2
|
|
167
179
|
exit 1
|
|
168
180
|
}
|
|
169
181
|
set --
|
package/cspell.json
CHANGED
|
@@ -1,44 +1,77 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* It is run when everything else is broken, so a problem in the config file is a field in the answer, never a throw.
|
|
4
|
+
* `fixes` are the `chmod` commands that make the config private; they go to stderr, not into the answer.
|
|
5
|
+
*/
|
|
3
6
|
export declare const doctorReport: (env: NodeJS.ProcessEnv) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
report: {
|
|
8
|
+
version: string;
|
|
9
|
+
runtime: {
|
|
10
|
+
node: string;
|
|
11
|
+
platform: NodeJS.Platform;
|
|
12
|
+
};
|
|
13
|
+
paths: {
|
|
14
|
+
config: string;
|
|
15
|
+
state: string;
|
|
16
|
+
cache: string;
|
|
17
|
+
};
|
|
18
|
+
config: {
|
|
19
|
+
path: string;
|
|
20
|
+
found: boolean;
|
|
21
|
+
issues: import("@wirecat/cli-core/cli").ConfigIssue[];
|
|
22
|
+
};
|
|
23
|
+
profiles: string[];
|
|
24
|
+
read_only: string | null;
|
|
25
|
+
files: {
|
|
26
|
+
checked: false;
|
|
27
|
+
reason: string;
|
|
28
|
+
} | {
|
|
29
|
+
checked: true;
|
|
30
|
+
ok: boolean;
|
|
31
|
+
problems: {
|
|
32
|
+
path: string;
|
|
33
|
+
mode: string;
|
|
34
|
+
want: string;
|
|
35
|
+
}[];
|
|
36
|
+
};
|
|
8
37
|
};
|
|
9
|
-
|
|
10
|
-
config: string;
|
|
11
|
-
state: string;
|
|
12
|
-
cache: string;
|
|
13
|
-
};
|
|
14
|
-
config: {
|
|
15
|
-
path: string;
|
|
16
|
-
found: boolean;
|
|
17
|
-
issues: import("@wirecat/cli-core/cli").ConfigIssue[];
|
|
18
|
-
};
|
|
19
|
-
profiles: string[];
|
|
20
|
-
read_only: string | null;
|
|
38
|
+
fixes: string[] | never[];
|
|
21
39
|
} | {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
report: {
|
|
41
|
+
version: string;
|
|
42
|
+
runtime: {
|
|
43
|
+
node: string;
|
|
44
|
+
platform: NodeJS.Platform;
|
|
45
|
+
};
|
|
46
|
+
paths: {
|
|
47
|
+
config: string;
|
|
48
|
+
state: string;
|
|
49
|
+
cache: string;
|
|
50
|
+
};
|
|
51
|
+
config: {
|
|
52
|
+
path: string;
|
|
53
|
+
found: boolean;
|
|
54
|
+
issues: never[];
|
|
55
|
+
};
|
|
56
|
+
settings: {
|
|
57
|
+
error: string;
|
|
58
|
+
};
|
|
59
|
+
profiles: null;
|
|
60
|
+
read_only: string | null;
|
|
61
|
+
files: {
|
|
62
|
+
checked: false;
|
|
63
|
+
reason: string;
|
|
64
|
+
} | {
|
|
65
|
+
checked: true;
|
|
66
|
+
ok: boolean;
|
|
67
|
+
problems: {
|
|
68
|
+
path: string;
|
|
69
|
+
mode: string;
|
|
70
|
+
want: string;
|
|
71
|
+
}[];
|
|
72
|
+
};
|
|
39
73
|
};
|
|
40
|
-
|
|
41
|
-
read_only: string | null;
|
|
74
|
+
fixes: string[] | never[];
|
|
42
75
|
};
|
|
43
76
|
export declare const doctorCommand: () => Command;
|
|
44
77
|
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAkBnC;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAS,MAAM,CAAC,UAAU;;;;YAIpC,IAAI;YAAyB,QAAQ;;;YACvC,MAAM;YAAgB,KAAK;YAAe,KAAK;;;YAS1C,IAAI;YAAuB,KAAK;YAAwB,MAAM;;;;;;;;;;;;;;;;;;;;;;YAVjE,IAAI;YAAyB,QAAQ;;;YACvC,MAAM;YAAgB,KAAK;YAAe,KAAK;;;YAsB1C,IAAI;YAAQ,KAAK;YAAoB,MAAM;;;YACzC,KAAK;;;;;;;;;;;;;;;;;;CAQxB,CAAA;AAED,eAAO,MAAM,aAAa,QAAO,OAc3B,CAAA"}
|
package/dist/commands/doctor.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
+
import { dirname } from "node:path";
|
|
2
3
|
import { CliError, configFilePath, resolvePaths } from "@wirecat/cli-base";
|
|
3
4
|
import { annotate } from "@wirecat/cli-base/commands";
|
|
4
|
-
import { environmentOf, itemOf, LOCAL_READ, outputFor, profileFree, readOnlyLockOf, renderAnswer, } from "@wirecat/cli-core/cli";
|
|
5
|
+
import { environmentOf, itemOf, LOCAL_READ, outputFor, privateFiles, profileFree, readOnlyLockOf, renderAnswer, } from "@wirecat/cli-core/cli";
|
|
5
6
|
import { Command } from "commander";
|
|
6
7
|
import { configuration } from "../config.js";
|
|
7
8
|
import { IDENTITY } from "../identity.js";
|
|
@@ -10,7 +11,19 @@ const failure = (error) => {
|
|
|
10
11
|
return error.message;
|
|
11
12
|
throw error;
|
|
12
13
|
};
|
|
13
|
-
|
|
14
|
+
const configFiles = (path) => {
|
|
15
|
+
const files = privateFiles({ files: [path], dirs: [dirname(path)] });
|
|
16
|
+
if (!files.checked)
|
|
17
|
+
return { files, fixes: [] };
|
|
18
|
+
return {
|
|
19
|
+
files: { ...files, problems: files.problems.map(({ path, mode, want }) => ({ path, mode, want })) },
|
|
20
|
+
fixes: files.problems.map((problem) => problem.fix),
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* It is run when everything else is broken, so a problem in the config file is a field in the answer, never a throw.
|
|
25
|
+
* `fixes` are the `chmod` commands that make the config private; they go to stderr, not into the answer.
|
|
26
|
+
*/
|
|
14
27
|
export const doctorReport = (env) => {
|
|
15
28
|
const paths = resolvePaths({ appName: IDENTITY.appName, prefix: IDENTITY.envPrefix, env });
|
|
16
29
|
const common = {
|
|
@@ -21,21 +34,31 @@ export const doctorReport = (env) => {
|
|
|
21
34
|
const readOnly = readOnlyLockOf(IDENTITY, env) ?? null;
|
|
22
35
|
try {
|
|
23
36
|
const settings = configuration.resolveSettings({}, { env, readOnly: true, needsProfile: false, withIssues: true });
|
|
37
|
+
const { files, fixes } = configFiles(settings.configPath);
|
|
24
38
|
return {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
39
|
+
report: {
|
|
40
|
+
...common,
|
|
41
|
+
config: { path: settings.configPath, found: settings.configFound, issues: settings.configIssues ?? [] },
|
|
42
|
+
profiles: settings.configuredProfiles,
|
|
43
|
+
read_only: readOnly,
|
|
44
|
+
files,
|
|
45
|
+
},
|
|
46
|
+
fixes,
|
|
29
47
|
};
|
|
30
48
|
}
|
|
31
49
|
catch (error) {
|
|
32
50
|
const file = configFilePath(paths.config);
|
|
51
|
+
const { files, fixes } = configFiles(file);
|
|
33
52
|
return {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
53
|
+
report: {
|
|
54
|
+
...common,
|
|
55
|
+
config: { path: file, found: existsSync(file), issues: [] },
|
|
56
|
+
settings: { error: failure(error) },
|
|
57
|
+
profiles: null,
|
|
58
|
+
read_only: readOnly,
|
|
59
|
+
files,
|
|
60
|
+
},
|
|
61
|
+
fixes,
|
|
39
62
|
};
|
|
40
63
|
}
|
|
41
64
|
};
|
|
@@ -46,6 +69,10 @@ export const doctorCommand = () => profileFree(annotate(new Command("doctor"), {
|
|
|
46
69
|
.description("check this installation: version, paths, config, profiles; no keyring or network")
|
|
47
70
|
.action(function () {
|
|
48
71
|
const env = environmentOf(this).env ?? process.env;
|
|
49
|
-
|
|
72
|
+
const { report, fixes } = doctorReport(env);
|
|
73
|
+
const output = outputFor(this);
|
|
74
|
+
renderAnswer(this, output, itemOf(report));
|
|
75
|
+
for (const fix of fixes)
|
|
76
|
+
output.renderer.note(`to make it private: ${fix}`);
|
|
50
77
|
});
|
|
51
78
|
//# sourceMappingURL=doctor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,OAAO,EACL,aAAa,EACb,MAAM,EACN,UAAU,EACV,SAAS,EACT,WAAW,EACX,cAAc,EACd,YAAY,GACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,a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AAG,aAAa,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAA;IAClD,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC,GAAG,CAAC,CAAA;IAC3C,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;IAC9B,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;IAC1C,KAAK,MAAM,GAAG,IAAI,KAAK;QAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,GAAG,EAAE,CAAC,CAAA;AAC7E,CAAC,CAAC,CAAA"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.7";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = "0.1.
|
|
1
|
+
export const VERSION = "0.1.7";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/docs/commands.md
CHANGED
|
@@ -70,16 +70,20 @@ the instructions an agent is given for this tool
|
|
|
70
70
|
|
|
71
71
|
### `clidev skill show`
|
|
72
72
|
|
|
73
|
-
print SKILL.md — `clidev skill install` puts it where Claude Code, Codex and Gemini CLI look for it
|
|
73
|
+
print SKILL.md — `clidev skill install` puts it where Claude Code, Codex and Gemini CLI look for it; --for prints the copy already there
|
|
74
74
|
|
|
75
75
|
```sh
|
|
76
|
-
clidev skill show [name]
|
|
76
|
+
clidev skill show [name] [options]
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
| Argument | | What it is |
|
|
80
80
|
|---|---|---|
|
|
81
81
|
| `name` | optional | one of the skills shipped for a task: follow-ups, link-conversations. |
|
|
82
82
|
|
|
83
|
+
| Option | What it does |
|
|
84
|
+
|---|---|
|
|
85
|
+
| `--for <agents>` | print the copy installed for these agents instead of this version's. One of: `claude`, `agents`. |
|
|
86
|
+
|
|
83
87
|
**Returns:** print the tool's instructions for AI agents
|
|
84
88
|
|
|
85
89
|
**Example:** `clidev skill show`, `clidev skill show follow-ups`
|
|
@@ -102,6 +106,18 @@ clidev skill install [options]
|
|
|
102
106
|
|
|
103
107
|
**Example:** `clidev skill install --for agents`
|
|
104
108
|
|
|
109
|
+
### `clidev skill status`
|
|
110
|
+
|
|
111
|
+
for each place `clidev skill install` writes to: the path, the version installed there, and whether it is current, stale, missing or unversioned
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
clidev skill status
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Returns:** whether the installed instructions for AI agents match this version
|
|
118
|
+
|
|
119
|
+
**Example:** `clidev skill status`, `clidev skill status --json`
|
|
120
|
+
|
|
105
121
|
## `clidev mcp`
|
|
106
122
|
|
|
107
123
|
serve this profile's commands to an agent over MCP, on stdin and stdout, writes included; the profile's permissions decide — `claude mcp add clidev -- clidev personal mcp`
|
|
@@ -25,3 +25,5 @@ and runs `bin/release`.
|
|
|
25
25
|
`pnpm release:check` again, and open the pull request `chore(release): <version>`.
|
|
26
26
|
7. **The owner** merges it and runs `bin/release` on a clean `main`. `bin/release --local` publishes from this
|
|
27
27
|
computer when GitHub Actions cannot, with `NPM_TOKEN`, the npm token in the keyring, or the owner's own npm login.
|
|
28
|
+
The keyring is read only when `NPM_KEYRING_ACCOUNT` names the account the token is stored under (service `npm`);
|
|
29
|
+
there is no default account.
|
package/docs/dev/test-matrix.md
CHANGED
|
@@ -7,7 +7,7 @@ ran it · ⛔ not tested offline, with the reason and where it is checked instea
|
|
|
7
7
|
Measured from the test run (`coverage/argv.jsonl`), not searched for — see
|
|
8
8
|
[TESTING.md](TESTING.md) for how, and for the states and failures that cut across commands.
|
|
9
9
|
|
|
10
|
-
**
|
|
10
|
+
**45 ✅ · 2 ⛔ · 0 ❌** — 15 commands, 32 options.
|
|
11
11
|
|
|
12
12
|
| Command | Option | | Note |
|
|
13
13
|
|---|---|---|---|
|
|
@@ -15,8 +15,10 @@ Measured from the test run (`coverage/argv.jsonl`), not searched for — see
|
|
|
15
15
|
| `commands info` | | ✅ | |
|
|
16
16
|
| `doctor` | | ✅ | |
|
|
17
17
|
| `skill show` | | ✅ | |
|
|
18
|
+
| `skill show` | `--for` | ✅ | |
|
|
18
19
|
| `skill install` | | ✅ | |
|
|
19
20
|
| `skill install` | `--for` | ✅ | |
|
|
21
|
+
| `skill status` | | ✅ | |
|
|
20
22
|
| `mcp` | | ✅ | |
|
|
21
23
|
| `upgrade` | | ✅ | |
|
|
22
24
|
| `upgrade` | `--check` | ✅ | |
|
package/docs/installation.md
CHANGED
|
@@ -13,5 +13,5 @@ Check the installation, then pick a profile name for your account, such as `pers
|
|
|
13
13
|
clidev doctor
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
`doctor` needs no network and opens no keyring. It shows the version, where settings live
|
|
17
|
-
exist. Next: [use it](usage.md).
|
|
16
|
+
`doctor` needs no network and opens no keyring. It shows the version, where settings live, the profiles that
|
|
17
|
+
exist, and whether other users of the computer can read the settings. Next: [use it](usage.md).
|
package/docs/security.md
CHANGED
|
@@ -4,5 +4,9 @@ What WireCat CLIs share — the keyring, permissions, MCP and what never reaches
|
|
|
4
4
|
[shared security page](https://wirecat.dev/en/docs/security). This page keeps only what is particular to `clidev`.
|
|
5
5
|
|
|
6
6
|
`clidev` keeps its settings in `config.json` and its state in the folders `clidev doctor` shows. It sends nothing
|
|
7
|
-
to any service yet.
|
|
7
|
+
to any service yet.
|
|
8
|
+
|
|
9
|
+
`config.json` is saved readable by you only (`0600`), and its folder is created for you only (`0700`). A file or
|
|
10
|
+
folder made by an older version may be open to other users of the computer: `clidev doctor` lists each under
|
|
11
|
+
`files.problems` and prints the `chmod` that fixes it. Windows is not checked. Report a vulnerability as [SECURITY.md](https://github.com/WireCatLabs/cli-template/blob/main/SECURITY.md)
|
|
8
12
|
says.
|
package/docs/troubleshooting.md
CHANGED
|
@@ -9,6 +9,7 @@ support request.
|
|
|
9
9
|
| `clidev` is not found | Open a new terminal, and check that npm's global folder is on `PATH`. |
|
|
10
10
|
| "name a profile" | Put the profile first, as in `clidev personal config show`, or set `CLIDEV_PROFILE`. |
|
|
11
11
|
| The settings file does not read | `doctor` lists every problem in the file under `config.issues`. Run the `config unset` each one gives, or fix the file by hand. |
|
|
12
|
+
| `doctor` lists `files.problems` | Other users of the computer can read `config.json` or enter its folder. Run each `chmod` that `doctor` prints after "to make it private:". `doctor` never changes a file mode itself. |
|
|
12
13
|
| A write is refused | The profile's permissions or `CLIDEV_READ_ONLY` stop it; see [settings](configuration.md#permissions). |
|
|
13
14
|
|
|
14
15
|
Never paste a token, a password or private content into a support request.
|
package/kit/dist/new.js
CHANGED
|
@@ -189,6 +189,10 @@ export const cliReadme = (names) => [
|
|
|
189
189
|
`\`doctor\` needs no profile. Every command that uses an account starts with one, a name you choose: \`${names.command} personal config show\`.`,
|
|
190
190
|
"",
|
|
191
191
|
].join("\n");
|
|
192
|
+
// The template's own security links point at cli-template, where a report about the template belongs; the placeholder
|
|
193
|
+
// repository does not exist. A CLI's copy names its own repository.
|
|
194
|
+
const TEMPLATE_REPOSITORY = "https://github.com/WireCatLabs/cli-template/";
|
|
195
|
+
const ownRepository = (names) => (text) => text.replaceAll(TEMPLATE_REPOSITORY, `https://github.com/${names.owner}/${names.name}/`);
|
|
192
196
|
export const cliChangelog = (names, source) => [
|
|
193
197
|
"# Changelog",
|
|
194
198
|
"",
|
|
@@ -229,6 +233,8 @@ export const runNew = async (cwd, source, args, io) => {
|
|
|
229
233
|
const rewrites = {
|
|
230
234
|
"package.json": (text) => cliPackageJson(text, names),
|
|
231
235
|
"README.md": () => cliReadme(names),
|
|
236
|
+
"SECURITY.md": ownRepository(names),
|
|
237
|
+
"docs/security.md": ownRepository(names),
|
|
232
238
|
"CHANGELOG.md": () => cliChangelog(names, source),
|
|
233
239
|
[VERSION_FILE]: (text) => text.replace(/VERSION = "[^"]*"/, 'VERSION = "0.0.0"'),
|
|
234
240
|
[IDENTITY_FILE]: (text) => withMessenger(withContentLanguages(text, answers.contentLang ?? []), category),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-template",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Start a new WireCat CLI: a working skeleton on cli-base and cli-core, copied by new and kept current by upgrade",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Viacheslav Ptsarev",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"smoke": "node --experimental-strip-types scripts/smoke.ts",
|
|
64
64
|
"smoke:bun": "bun scripts/smoke.ts",
|
|
65
65
|
"package:check": "pnpm smoke",
|
|
66
|
-
"docs:check": "cli-dev docs-check --rules scripts/docs-rules.ts --pages && pnpm docs:spell && rumdl check --config config/wirecat/rumdl.toml README.md SECURITY.md CLAUDE.md AGENTS.md docs/*.md docs/dev/*.md && pnpm docs:lint",
|
|
66
|
+
"docs:check": "cli-dev docs-check --rules scripts/docs-rules.ts --pages && pnpm docs:spell && rumdl check --config config/wirecat/rumdl.toml README.md SECURITY.md CHANGELOG.md CLAUDE.md AGENTS.md docs/*.md docs/dev/*.md && pnpm docs:lint && pnpm kit:docs",
|
|
67
67
|
"docs:lint": "markdownlint-cli2",
|
|
68
68
|
"contracts:check": "cli-contract contracts/plan.json",
|
|
69
69
|
"security:no-leak": "cli-testing security no-leak . contracts/no-leak.json",
|
|
@@ -76,15 +76,16 @@
|
|
|
76
76
|
"release:check": "pnpm standards:check && pnpm lint && pnpm typecheck && pnpm test:coverage && pnpm lint:commands && pnpm audit:commands && pnpm contracts:check && pnpm test:matrix:check && pnpm docs:check && pnpm generate:check && pnpm version:check",
|
|
77
77
|
"prepare": "lefthook install || true",
|
|
78
78
|
"prepack": "pnpm build",
|
|
79
|
-
"docs:spell": "cspell lint --config cspell.json --no-progress --no-summary README.md SECURITY.md 'docs/*.md'",
|
|
79
|
+
"docs:spell": "cspell lint --config cspell.json --no-progress --no-summary README.md SECURITY.md CHANGELOG.md 'docs/*.md'",
|
|
80
80
|
"kit:build": "tsc -p kit && node -e \"require('node:fs').copyFileSync('.gitignore', 'gitignore')\"",
|
|
81
81
|
"kit:typecheck": "tsc -p kit/tsconfig.test.json",
|
|
82
|
-
"kit:e2e": "bash kit/e2e.sh"
|
|
82
|
+
"kit:e2e": "bash kit/e2e.sh",
|
|
83
|
+
"kit:docs": "cspell lint --config cspell.json --no-progress --no-summary kit/README.md && rumdl check --config config/wirecat/rumdl.toml kit/README.md"
|
|
83
84
|
},
|
|
84
85
|
"dependencies": {
|
|
85
|
-
"@modelcontextprotocol/server": "2.
|
|
86
|
-
"@wirecat/cli-base": "0.
|
|
87
|
-
"@wirecat/cli-core": "0.
|
|
86
|
+
"@modelcontextprotocol/server": "2.4.0",
|
|
87
|
+
"@wirecat/cli-base": "0.57.0",
|
|
88
|
+
"@wirecat/cli-core": "0.428.0",
|
|
88
89
|
"commander": "15.0.0"
|
|
89
90
|
},
|
|
90
91
|
"devDependencies": {
|
package/pnpm-workspace.yaml
CHANGED
package/scripts/docs-rules.ts
CHANGED
|
@@ -6,7 +6,7 @@ export const CHANGELOG = {
|
|
|
6
6
|
ids: JOURNAL_IDS,
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
const USER_PAGES = /^(README|SECURITY)\.md$|^docs\/[^/]+\.md$/
|
|
9
|
+
const USER_PAGES = /^(README|SECURITY|CHANGELOG)\.md$|^kit\/README\.md$|^docs\/[^/]+\.md$/
|
|
10
10
|
|
|
11
11
|
export const docsRules = (root: string): DocsRules => ({
|
|
12
12
|
files: markdownFiles(root, new Set(["node_modules", "dist", "coverage", ".git"])),
|
package/src/commands/doctor.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { existsSync } from "node:fs"
|
|
2
|
+
import { dirname } from "node:path"
|
|
2
3
|
import { CliError, configFilePath, resolvePaths } from "@wirecat/cli-base"
|
|
3
4
|
import { annotate } from "@wirecat/cli-base/commands"
|
|
4
5
|
import {
|
|
@@ -6,6 +7,7 @@ import {
|
|
|
6
7
|
itemOf,
|
|
7
8
|
LOCAL_READ,
|
|
8
9
|
outputFor,
|
|
10
|
+
privateFiles,
|
|
9
11
|
profileFree,
|
|
10
12
|
readOnlyLockOf,
|
|
11
13
|
renderAnswer,
|
|
@@ -19,7 +21,19 @@ const failure = (error: unknown) => {
|
|
|
19
21
|
throw error
|
|
20
22
|
}
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
const configFiles = (path: string) => {
|
|
25
|
+
const files = privateFiles({ files: [path], dirs: [dirname(path)] })
|
|
26
|
+
if (!files.checked) return { files, fixes: [] }
|
|
27
|
+
return {
|
|
28
|
+
files: { ...files, problems: files.problems.map(({ path, mode, want }) => ({ path, mode, want })) },
|
|
29
|
+
fixes: files.problems.map((problem) => problem.fix),
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* It is run when everything else is broken, so a problem in the config file is a field in the answer, never a throw.
|
|
35
|
+
* `fixes` are the `chmod` commands that make the config private; they go to stderr, not into the answer.
|
|
36
|
+
*/
|
|
23
37
|
export const doctorReport = (env: NodeJS.ProcessEnv) => {
|
|
24
38
|
const paths = resolvePaths({ appName: IDENTITY.appName, prefix: IDENTITY.envPrefix, env })
|
|
25
39
|
const common = {
|
|
@@ -30,20 +44,30 @@ export const doctorReport = (env: NodeJS.ProcessEnv) => {
|
|
|
30
44
|
const readOnly = readOnlyLockOf(IDENTITY, env) ?? null
|
|
31
45
|
try {
|
|
32
46
|
const settings = configuration.resolveSettings({}, { env, readOnly: true, needsProfile: false, withIssues: true })
|
|
47
|
+
const { files, fixes } = configFiles(settings.configPath)
|
|
33
48
|
return {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
49
|
+
report: {
|
|
50
|
+
...common,
|
|
51
|
+
config: { path: settings.configPath, found: settings.configFound, issues: settings.configIssues ?? [] },
|
|
52
|
+
profiles: settings.configuredProfiles,
|
|
53
|
+
read_only: readOnly,
|
|
54
|
+
files,
|
|
55
|
+
},
|
|
56
|
+
fixes,
|
|
38
57
|
}
|
|
39
58
|
} catch (error) {
|
|
40
59
|
const file = configFilePath(paths.config)
|
|
60
|
+
const { files, fixes } = configFiles(file)
|
|
41
61
|
return {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
62
|
+
report: {
|
|
63
|
+
...common,
|
|
64
|
+
config: { path: file, found: existsSync(file), issues: [] },
|
|
65
|
+
settings: { error: failure(error) },
|
|
66
|
+
profiles: null,
|
|
67
|
+
read_only: readOnly,
|
|
68
|
+
files,
|
|
69
|
+
},
|
|
70
|
+
fixes,
|
|
47
71
|
}
|
|
48
72
|
}
|
|
49
73
|
}
|
|
@@ -58,5 +82,8 @@ export const doctorCommand = (): Command =>
|
|
|
58
82
|
.description("check this installation: version, paths, config, profiles; no keyring or network")
|
|
59
83
|
.action(function (this: Command) {
|
|
60
84
|
const env = environmentOf(this).env ?? process.env
|
|
61
|
-
|
|
85
|
+
const { report, fixes } = doctorReport(env)
|
|
86
|
+
const output = outputFor(this)
|
|
87
|
+
renderAnswer(this, output, itemOf(report))
|
|
88
|
+
for (const fix of fixes) output.renderer.note(`to make it private: ${fix}`)
|
|
62
89
|
})
|
package/src/program.test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs"
|
|
1
|
+
import { chmodSync, mkdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs"
|
|
2
2
|
import { join } from "node:path"
|
|
3
3
|
import { expect, it } from "vitest"
|
|
4
4
|
import { doctorReport } from "./commands/doctor.js"
|
|
@@ -58,10 +58,43 @@ it("doctor reports an unknown setting with the command that removes it", async (
|
|
|
58
58
|
})
|
|
59
59
|
|
|
60
60
|
it("doctor reports settings an environment variable breaks, and still answers", () => {
|
|
61
|
-
const report = doctorReport({ ...process.env, CLIDEV_EMBEDDING_DIMS: "many" })
|
|
61
|
+
const { report } = doctorReport({ ...process.env, CLIDEV_EMBEDDING_DIMS: "many" })
|
|
62
62
|
expect(report).toMatchObject({ config: { issues: [] }, settings: { error: expect.any(String) }, profiles: null })
|
|
63
63
|
})
|
|
64
64
|
|
|
65
|
+
it.skipIf(process.platform === "win32")(
|
|
66
|
+
"doctor names a config file and folder others can read, with the chmod that fixes each",
|
|
67
|
+
async () => {
|
|
68
|
+
const dir = process.env.CLIDEV_CONFIG_DIR ?? ""
|
|
69
|
+
const file = join(dir, "config.json")
|
|
70
|
+
mkdirSync(dir, { recursive: true })
|
|
71
|
+
writeFileSync(file, "{}")
|
|
72
|
+
chmodSync(file, 0o644)
|
|
73
|
+
chmodSync(dir, 0o775)
|
|
74
|
+
try {
|
|
75
|
+
const { code, out, err } = await ran(["doctor", "--json"])
|
|
76
|
+
expect(code).toBe(0)
|
|
77
|
+
expect(json(out).item.files).toEqual({
|
|
78
|
+
checked: true,
|
|
79
|
+
ok: false,
|
|
80
|
+
problems: [
|
|
81
|
+
{ path: file, mode: "0644", want: "0600" },
|
|
82
|
+
{ path: dir, mode: "0775", want: "0700" },
|
|
83
|
+
],
|
|
84
|
+
})
|
|
85
|
+
expect(err).toContain(`to make it private: chmod 600 '${file}'`)
|
|
86
|
+
expect(err).toContain(`to make it private: chmod 700 '${dir}'`)
|
|
87
|
+
|
|
88
|
+
chmodSync(dir, 0o700)
|
|
89
|
+
expect((await ran(["personal", "config", "set", "--defaults", "limit", "5"])).code).toBe(0)
|
|
90
|
+
expect(statSync(file).mode & 0o777).toBe(0o600)
|
|
91
|
+
expect(json((await ran(["doctor", "--json"])).out).item.files).toEqual({ checked: true, ok: true, problems: [] })
|
|
92
|
+
} finally {
|
|
93
|
+
rmSync(file)
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
)
|
|
97
|
+
|
|
65
98
|
it("config show names the profile it was given", async () => {
|
|
66
99
|
const { code, out } = await ran(["personal", "config", "show", "--json"])
|
|
67
100
|
expect(code).toBe(0)
|
package/src/roots.test.ts
CHANGED
|
@@ -73,6 +73,22 @@ it("skill install writes the skill for Claude Code", async () => {
|
|
|
73
73
|
expect(existsSync(join(homedir(), ".claude", "skills", "clidev-cli", "SKILL.md"))).toBe(true)
|
|
74
74
|
})
|
|
75
75
|
|
|
76
|
+
it("skill status and skill show --for read what skill install wrote", async () => {
|
|
77
|
+
expect((await ran(["skill", "install", "--for", "claude", "--json"])).code).toBe(0)
|
|
78
|
+
const status = await ran(["skill", "status", "--json"])
|
|
79
|
+
expect(status.code).toBe(0)
|
|
80
|
+
expect(JSON.parse(status.out).targets).toEqual([
|
|
81
|
+
expect.objectContaining({ target: "claude", state: "current" }),
|
|
82
|
+
expect.objectContaining({ target: "agents", installed: null, state: "missing" }),
|
|
83
|
+
])
|
|
84
|
+
const shown = await ran(["skill", "show", "--for", "claude", "--json"])
|
|
85
|
+
expect(shown.code).toBe(0)
|
|
86
|
+
expect(JSON.parse(shown.out)).toMatchObject({
|
|
87
|
+
target: "claude",
|
|
88
|
+
content: expect.stringContaining("name: clidev-cli"),
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
|
|
76
92
|
it("help prints the first screen", async () => {
|
|
77
93
|
const { code, out } = await ran(["help"])
|
|
78
94
|
expect(code).toBe(0)
|
package/src/testing/sandbox.ts
CHANGED
|
@@ -5,13 +5,10 @@ import { ARGV_LOG } from "./argv-log.js"
|
|
|
5
5
|
|
|
6
6
|
const saved = { ...process.env }
|
|
7
7
|
|
|
8
|
-
// cli-base's setup already gave this file a fresh TMPDIR and HOME, a keyring that throws and no network
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
process.env.
|
|
12
|
-
process.env.CLIDEV_CACHE_DIR = join(sandbox, "cache")
|
|
13
|
-
process.env.MESSAGING_STORE = join(sandbox, "messages.db")
|
|
14
|
-
process.env.WIRECAT_STATE_DIR = join(sandbox, "wirecat")
|
|
8
|
+
// cli-base's setup already gave this file a fresh TMPDIR and HOME, a keyring that throws and no network, and points
|
|
9
|
+
// every folder and store variable at them (WC-TEST-1, WC-STORE-14). The config folder is set only because tests
|
|
10
|
+
// write into it by name.
|
|
11
|
+
process.env.CLIDEV_CONFIG_DIR = join(tmpdir(), "config")
|
|
15
12
|
process.env.CLIDEV_NO_UPDATE_CHECK = "1"
|
|
16
13
|
process.env.CLIDEV_TEST_ARGV_LOG = ARGV_LOG
|
|
17
14
|
delete process.env.CLIDEV_PROFILE
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.1.
|
|
1
|
+
export const VERSION = "0.1.7"
|