@newtype-ai/nit 0.4.1 → 0.4.3

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
@@ -94,7 +94,7 @@ nit auto-discovers your skills directory from all major agent frameworks:
94
94
  - `.cursor/skills/` — Cursor
95
95
  - `.windsurf/skills/` — Windsurf
96
96
  - `.codex/skills/` — OpenAI Codex
97
- - `.agents/skills/` — Generic
97
+ - `.openclaw/workspace/skills/` — OpenClaw
98
98
 
99
99
  The discovered path is stored in `.nit/config`. When `nit sign --login <domain>` creates a new branch, it auto-creates a SKILL.md template and adds a pointer to the card. The committed card always contains fully resolved, self-contained skill data.
100
100
 
@@ -324,7 +324,7 @@ var FRAMEWORK_MARKERS = [
324
324
  { marker: ".cursor", skillsPath: ".cursor/skills" },
325
325
  { marker: ".codex", skillsPath: ".codex/skills" },
326
326
  { marker: ".windsurf", skillsPath: ".windsurf/skills" },
327
- { marker: ".openclaw", skillsPath: ".agents/skills" }
327
+ { marker: ".openclaw", skillsPath: ".openclaw/workspace/skills" }
328
328
  ];
329
329
  var GLOBAL_SKILLS_DIRS = [
330
330
  { marker: ".claude", skillsPath: ".claude/skills" },
package/dist/cli.js CHANGED
@@ -15,7 +15,72 @@ import {
15
15
  remoteSetUrl,
16
16
  sign,
17
17
  status
18
- } from "./chunk-BC7OEIFR.js";
18
+ } from "./chunk-CPNPQQOU.js";
19
+
20
+ // src/update-check.ts
21
+ import { homedir } from "os";
22
+ import { join } from "path";
23
+ import { readFile, writeFile } from "fs/promises";
24
+ var CACHE_PATH = join(homedir(), ".nit-update-cache.json");
25
+ var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
26
+ var FETCH_TIMEOUT_MS = 3e3;
27
+ var REGISTRY_URL = "https://registry.npmjs.org/@newtype-ai/nit/latest";
28
+ function getCurrentVersion() {
29
+ try {
30
+ return "0.4.3";
31
+ } catch {
32
+ return "0.0.0";
33
+ }
34
+ }
35
+ var version = getCurrentVersion();
36
+ function isNewer(latest, current) {
37
+ const a = latest.split(".").map(Number);
38
+ const b = current.split(".").map(Number);
39
+ for (let i = 0; i < 3; i++) {
40
+ if ((a[i] ?? 0) > (b[i] ?? 0)) return true;
41
+ if ((a[i] ?? 0) < (b[i] ?? 0)) return false;
42
+ }
43
+ return false;
44
+ }
45
+ async function readCache() {
46
+ try {
47
+ const raw = await readFile(CACHE_PATH, "utf-8");
48
+ return JSON.parse(raw);
49
+ } catch {
50
+ return null;
51
+ }
52
+ }
53
+ async function writeCache(cache) {
54
+ try {
55
+ await writeFile(CACHE_PATH, JSON.stringify(cache), "utf-8");
56
+ } catch {
57
+ }
58
+ }
59
+ async function checkForUpdate() {
60
+ const current = getCurrentVersion();
61
+ const cache = await readCache();
62
+ if (cache && Date.now() - cache.lastChecked < CHECK_INTERVAL_MS) {
63
+ return isNewer(cache.latestVersion, current) ? { current, latest: cache.latestVersion } : null;
64
+ }
65
+ const controller = new AbortController();
66
+ const timeout = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
67
+ try {
68
+ const res = await fetch(REGISTRY_URL, {
69
+ signal: controller.signal,
70
+ headers: { Accept: "application/json" }
71
+ });
72
+ if (!res.ok) return null;
73
+ const data = await res.json();
74
+ const latest = data.version;
75
+ if (!latest) return null;
76
+ await writeCache({ lastChecked: Date.now(), latestVersion: latest });
77
+ return isNewer(latest, current) ? { current, latest } : null;
78
+ } catch {
79
+ return null;
80
+ } finally {
81
+ clearTimeout(timeout);
82
+ }
83
+ }
19
84
 
20
85
  // src/cli.ts
21
86
  var bold = (s) => `\x1B[1m${s}\x1B[0m`;
@@ -63,6 +128,10 @@ async function main() {
63
128
  case void 0:
64
129
  printUsage();
65
130
  break;
131
+ case "--version":
132
+ case "-v":
133
+ break;
134
+ // version printed below via update check
66
135
  default:
67
136
  console.error(`nit: '${command}' is not a nit command. See 'nit help'.`);
68
137
  process.exit(1);
@@ -72,6 +141,16 @@ async function main() {
72
141
  console.error(red(`error: ${msg}`));
73
142
  process.exit(1);
74
143
  }
144
+ if (command === "--version" || command === "-v") {
145
+ console.log(`nit ${version}`);
146
+ }
147
+ const update = await checkForUpdate().catch(() => null);
148
+ if (update) {
149
+ console.error(yellow(`
150
+ Update available: ${update.current} \u2192 ${update.latest}`));
151
+ console.error(yellow(` Run: npm install -g @newtype-ai/nit
152
+ `));
153
+ }
75
154
  }
76
155
  async function cmdInit() {
77
156
  const result = await init();
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ import {
30
30
  signChallenge,
31
31
  signMessage,
32
32
  status
33
- } from "./chunk-BC7OEIFR.js";
33
+ } from "./chunk-CPNPQQOU.js";
34
34
  export {
35
35
  NIT_NAMESPACE,
36
36
  base58Encode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newtype-ai/nit",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "Version control for agent cards",
5
5
  "type": "module",
6
6
  "bin": {