@nepopsx/cli 0.0.20 → 0.0.22
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/dist/agents/catalog.d.ts.map +1 -1
- package/dist/agents/catalog.js +2 -1
- package/dist/agents/catalog.js.map +1 -1
- package/dist/commands/capture.d.ts.map +1 -1
- package/dist/commands/capture.js +29 -9
- package/dist/commands/capture.js.map +1 -1
- package/dist/commands/doctor.js +5 -6
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +6 -2
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/push-learnings.d.ts.map +1 -1
- package/dist/commands/push-learnings.js +38 -26
- package/dist/commands/push-learnings.js.map +1 -1
- package/dist/commands/scan.d.ts.map +1 -1
- package/dist/commands/scan.js +4 -2
- package/dist/commands/scan.js.map +1 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +10 -5
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +6 -1
- package/dist/commands/up.js.map +1 -1
- package/dist/enrichment/workflow.d.ts.map +1 -1
- package/dist/enrichment/workflow.js +2 -1
- package/dist/enrichment/workflow.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/licensing/index.d.ts +2 -1
- package/dist/licensing/index.d.ts.map +1 -1
- package/dist/licensing/index.js +2 -1
- package/dist/licensing/index.js.map +1 -1
- package/dist/licensing/installer.d.ts.map +1 -1
- package/dist/licensing/installer.js +3 -2
- package/dist/licensing/installer.js.map +1 -1
- package/dist/licensing/license-manager.d.ts +11 -0
- package/dist/licensing/license-manager.d.ts.map +1 -1
- package/dist/licensing/license-manager.js +31 -1
- package/dist/licensing/license-manager.js.map +1 -1
- package/dist/licensing/template-fetch.d.ts.map +1 -1
- package/dist/licensing/template-fetch.js +2 -1
- package/dist/licensing/template-fetch.js.map +1 -1
- package/dist/licensing/workspace-name.d.ts +36 -0
- package/dist/licensing/workspace-name.d.ts.map +1 -0
- package/dist/licensing/workspace-name.js +54 -0
- package/dist/licensing/workspace-name.js.map +1 -0
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ import { resolveApiBase } from '../config/api-config.js';
|
|
|
14
14
|
import { fetchWithTimeout } from '../utils/fetch.js';
|
|
15
15
|
import { decryptBundle as decryptBundleRaw } from './installer.js';
|
|
16
16
|
import { DOWNLOAD_TIMEOUT_MS } from '../constants.js';
|
|
17
|
+
import { resolveWorkspaceName } from './workspace-name.js';
|
|
17
18
|
// EncryptedBundle is imported from installer.ts
|
|
18
19
|
// ─── Public API ─────────────────────────────────────────────
|
|
19
20
|
/**
|
|
@@ -33,7 +34,7 @@ export async function fetchRemoteTemplates(rootDir, license, agentName, agentVer
|
|
|
33
34
|
},
|
|
34
35
|
body: JSON.stringify({
|
|
35
36
|
machine_id: license.machine_id,
|
|
36
|
-
workspace: license
|
|
37
|
+
workspace: resolveWorkspaceName(rootDir, license),
|
|
37
38
|
custom_instructions: customInstructions,
|
|
38
39
|
// When set, the backend returns FINAL per-provider files (already path-
|
|
39
40
|
// mapped + frontmatter-transformed). The CLI just writes them.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-fetch.js","sourceRoot":"","sources":["../../src/licensing/template-fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,aAAa,IAAI,gBAAgB,EAAwB,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"template-fetch.js","sourceRoot":"","sources":["../../src/licensing/template-fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,cA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C;QAEjG,OAAO;YACL,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,YAAY;YACrB,SAAS;YACT,MAAM,EAAE,QAAQ;SACjB,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,+DAA+D;QAC/D,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,+DAA+D;AAE/D,8CAA8C;AAE9C,+DAA+D;AAE/D,0DAA0D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace-name resolution.
|
|
3
|
+
*
|
|
4
|
+
* The license file (`.nepopsx/license.json`) carries a `workspace` field that is
|
|
5
|
+
* written ONCE at `nepopsx login` / `nepopsx activate` time. At first run the
|
|
6
|
+
* workspace config doesn't exist yet, so it is stored as the literal `"unknown"`.
|
|
7
|
+
* `nepopsx up` later creates `.nepopsx/workspace.yaml` with the real name, but the
|
|
8
|
+
* license file is not rewritten — so any command that sends `license.workspace`
|
|
9
|
+
* to the backend would query the wrong (`"unknown"`) workspace and 404/401.
|
|
10
|
+
*
|
|
11
|
+
* This resolver always prefers the LIVE workspace name (from the loaded config or,
|
|
12
|
+
* failing that, from `workspace.yaml` on disk) and only falls back to the license
|
|
13
|
+
* value as a last resort.
|
|
14
|
+
*/
|
|
15
|
+
import type { License } from '@nepopsx/core';
|
|
16
|
+
export declare const UNKNOWN_WORKSPACE = "unknown";
|
|
17
|
+
/** Shape covering both the validated WorkspaceConfig and a raw YAML parse. */
|
|
18
|
+
type ConfigLike = {
|
|
19
|
+
workspace?: {
|
|
20
|
+
name?: string;
|
|
21
|
+
} | null;
|
|
22
|
+
} | null | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Read `workspace.name` directly from `.nepopsx/workspace.yaml`. Best-effort —
|
|
25
|
+
* returns undefined if the file is missing, unparseable, or has no real name.
|
|
26
|
+
*/
|
|
27
|
+
export declare function readWorkspaceNameFromDisk(rootDir: string): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the workspace name to send to the backend.
|
|
30
|
+
*
|
|
31
|
+
* Precedence: explicit live config → workspace.yaml on disk → license value.
|
|
32
|
+
* Only the license value may be `"unknown"`; the first two are validated to be real.
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveWorkspaceName(rootDir: string, license: Pick<License, 'workspace'> | null | undefined, config?: ConfigLike): string;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=workspace-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-name.d.ts","sourceRoot":"","sources":["../../src/licensing/workspace-name.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,8EAA8E;AAC9E,KAAK,UAAU,GAAG;IAAE,SAAS,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,CAAC;AAM9E;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAU7E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,EACtD,MAAM,CAAC,EAAE,UAAU,GAClB,MAAM,CAQR"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace-name resolution.
|
|
3
|
+
*
|
|
4
|
+
* The license file (`.nepopsx/license.json`) carries a `workspace` field that is
|
|
5
|
+
* written ONCE at `nepopsx login` / `nepopsx activate` time. At first run the
|
|
6
|
+
* workspace config doesn't exist yet, so it is stored as the literal `"unknown"`.
|
|
7
|
+
* `nepopsx up` later creates `.nepopsx/workspace.yaml` with the real name, but the
|
|
8
|
+
* license file is not rewritten — so any command that sends `license.workspace`
|
|
9
|
+
* to the backend would query the wrong (`"unknown"`) workspace and 404/401.
|
|
10
|
+
*
|
|
11
|
+
* This resolver always prefers the LIVE workspace name (from the loaded config or,
|
|
12
|
+
* failing that, from `workspace.yaml` on disk) and only falls back to the license
|
|
13
|
+
* value as a last resort.
|
|
14
|
+
*/
|
|
15
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
16
|
+
import { resolve } from 'node:path';
|
|
17
|
+
import { parse as parseYaml } from 'yaml';
|
|
18
|
+
export const UNKNOWN_WORKSPACE = 'unknown';
|
|
19
|
+
function isRealName(name) {
|
|
20
|
+
return typeof name === 'string' && name.length > 0 && name !== UNKNOWN_WORKSPACE;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Read `workspace.name` directly from `.nepopsx/workspace.yaml`. Best-effort —
|
|
24
|
+
* returns undefined if the file is missing, unparseable, or has no real name.
|
|
25
|
+
*/
|
|
26
|
+
export function readWorkspaceNameFromDisk(rootDir) {
|
|
27
|
+
try {
|
|
28
|
+
const configPath = resolve(rootDir, '.nepopsx', 'workspace.yaml');
|
|
29
|
+
if (!existsSync(configPath))
|
|
30
|
+
return undefined;
|
|
31
|
+
const raw = parseYaml(readFileSync(configPath, 'utf-8'));
|
|
32
|
+
const name = raw?.workspace?.name;
|
|
33
|
+
return isRealName(name) ? name : undefined;
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolve the workspace name to send to the backend.
|
|
41
|
+
*
|
|
42
|
+
* Precedence: explicit live config → workspace.yaml on disk → license value.
|
|
43
|
+
* Only the license value may be `"unknown"`; the first two are validated to be real.
|
|
44
|
+
*/
|
|
45
|
+
export function resolveWorkspaceName(rootDir, license, config) {
|
|
46
|
+
const fromConfig = config?.workspace?.name;
|
|
47
|
+
if (isRealName(fromConfig))
|
|
48
|
+
return fromConfig;
|
|
49
|
+
const fromDisk = readWorkspaceNameFromDisk(rootDir);
|
|
50
|
+
if (fromDisk)
|
|
51
|
+
return fromDisk;
|
|
52
|
+
return license?.workspace ?? UNKNOWN_WORKSPACE;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=workspace-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-name.js","sourceRoot":"","sources":["../../src/licensing/workspace-name.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAG1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAK3C,SAAS,UAAU,CAAC,IAA+B;IACjD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,KAAK,iBAAiB,CAAC;AACnF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAe;IACvD,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC;QAClE,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;YAAE,OAAO,SAAS,CAAC;QAC9C,MAAM,GAAG,GAAG,SAAS,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAe,CAAC;QACvE,MAAM,IAAI,GAAG,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC;QAClC,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;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