@abgov/nx-adsp 12.7.0 → 12.8.0-beta.10
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/package.json +1 -1
- package/src/generators/angular-app/angular-app.js +24 -1
- package/src/generators/angular-app/angular-app.js.map +1 -1
- package/src/generators/angular-app/schema.d.ts +5 -0
- package/src/generators/angular-app/schema.json +10 -0
- package/src/generators/express-service/express-service.js +58 -10
- package/src/generators/express-service/express-service.js.map +1 -1
- package/src/generators/express-service/express-service.spec.ts +2 -0
- package/src/generators/express-service/schema.d.ts +6 -0
- package/src/generators/express-service/schema.json +11 -1
- package/src/generators/mean/mean.js +38 -5
- package/src/generators/mean/mean.js.map +1 -1
- package/src/generators/mean/mean.spec.ts +1 -0
- package/src/generators/mean/schema.d.ts +2 -0
- package/src/generators/mean/schema.json +10 -0
- package/src/generators/mern/mern.js +38 -5
- package/src/generators/mern/mern.js.map +1 -1
- package/src/generators/mern/mern.spec.ts +1 -0
- package/src/generators/mern/schema.d.ts +2 -0
- package/src/generators/mern/schema.json +10 -0
- package/src/generators/react-app/files/src/app/config.slice.ts__tmpl__ +2 -2
- package/src/generators/react-app/files/src/app/intake.slice.ts__tmpl__ +1 -1
- package/src/generators/react-app/files/src/app/start.slice.ts__tmpl__ +7 -7
- package/src/generators/react-app/files/src/app/user.slice.ts__tmpl__ +1 -1
- package/src/generators/react-app/react-app.js +24 -1
- package/src/generators/react-app/react-app.js.map +1 -1
- package/src/generators/react-app/schema.d.ts +4 -0
- package/src/generators/react-app/schema.json +10 -0
- package/src/utils/agent.d.ts +32 -2
- package/src/utils/agent.js +359 -93
- package/src/utils/agent.js.map +1 -1
- package/src/utils/agent.spec.ts +35 -3
- package/src/utils/plugin-version.d.ts +1 -0
- package/src/utils/plugin-version.js +7 -0
- package/src/utils/plugin-version.js.map +1 -0
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = default_1;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const nx_oc_1 = require("@abgov/nx-oc");
|
|
6
|
+
const agent_1 = require("../../utils/agent");
|
|
7
|
+
const plugin_version_1 = require("../../utils/plugin-version");
|
|
6
8
|
const devkit_1 = require("@nx/devkit");
|
|
7
9
|
const eslint_1 = require("@nx/eslint");
|
|
8
10
|
const path = require("path");
|
|
@@ -58,7 +60,7 @@ function removeFiles(host, options) {
|
|
|
58
60
|
}
|
|
59
61
|
function default_1(host, options) {
|
|
60
62
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
var _a, _b;
|
|
63
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
62
64
|
const normalizedOptions = yield normalizeOptions(host, options);
|
|
63
65
|
const { applicationGenerator: initReact } = yield Promise.resolve().then(() => require('@nx/react'));
|
|
64
66
|
// Setting strict to false because of: https://github.com/nrwl/nx/issues/8180
|
|
@@ -107,6 +109,27 @@ function default_1(host, options) {
|
|
|
107
109
|
}
|
|
108
110
|
(0, devkit_1.updateProjectConfiguration)(host, options.name, config);
|
|
109
111
|
yield (0, devkit_1.formatFiles)(host);
|
|
112
|
+
if (normalizedOptions.adsp && !options.skipAgent) {
|
|
113
|
+
const accessToken = (_c = normalizedOptions.adsp.accessToken) !== null && _c !== void 0 ? _c : options.accessToken;
|
|
114
|
+
const appTs = (_e = (_d = host.read(`${normalizedOptions.projectRoot}/src/app/app.tsx`)) === null || _d === void 0 ? void 0 : _d.toString()) !== null && _e !== void 0 ? _e : '';
|
|
115
|
+
const storeTs = (_g = (_f = host.read(`${normalizedOptions.projectRoot}/src/store.ts`)) === null || _f === void 0 ? void 0 : _f.toString()) !== null && _g !== void 0 ? _g : '';
|
|
116
|
+
const environmentTs = (_j = (_h = host.read(`${normalizedOptions.projectRoot}/src/environments/environment.ts`)) === null || _h === void 0 ? void 0 : _h.toString()) !== null && _j !== void 0 ? _j : '';
|
|
117
|
+
const configSliceTs = (_l = (_k = host.read(`${normalizedOptions.projectRoot}/src/app/config.slice.ts`)) === null || _k === void 0 ? void 0 : _k.toString()) !== null && _l !== void 0 ? _l : '';
|
|
118
|
+
const intakeSliceTs = (_o = (_m = host.read(`${normalizedOptions.projectRoot}/src/app/intake.slice.ts`)) === null || _m === void 0 ? void 0 : _m.toString()) !== null && _o !== void 0 ? _o : '';
|
|
119
|
+
yield (0, agent_1.confirmAfterAgentInterrupt)(yield (0, agent_1.consultAgent)(normalizedOptions.adsp.directoryServiceUrl, accessToken, {
|
|
120
|
+
projectName: normalizedOptions.projectName,
|
|
121
|
+
projectType: 'react-app',
|
|
122
|
+
tenant: normalizedOptions.adsp.tenant,
|
|
123
|
+
pluginVersion: plugin_version_1.PLUGIN_VERSION,
|
|
124
|
+
existingFiles: {
|
|
125
|
+
'src/app/app.tsx': appTs,
|
|
126
|
+
'src/store.ts': storeTs,
|
|
127
|
+
'src/environments/environment.ts': environmentTs,
|
|
128
|
+
'src/app/config.slice.ts': configSliceTs,
|
|
129
|
+
'src/app/intake.slice.ts': intakeSliceTs,
|
|
130
|
+
},
|
|
131
|
+
}, host, normalizedOptions.projectRoot));
|
|
132
|
+
}
|
|
110
133
|
yield (0, nx_oc_1.deploymentGenerator)(host, Object.assign(Object.assign({}, normalizedOptions), { appType: 'frontend', project: normalizedOptions.projectName }));
|
|
111
134
|
return () => {
|
|
112
135
|
(0, devkit_1.installPackagesTask)(host);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-app.js","sourceRoot":"","sources":["../../../../../../packages/nx-adsp/src/generators/react-app/react-app.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"react-app.js","sourceRoot":"","sources":["../../../../../../packages/nx-adsp/src/generators/react-app/react-app.ts"],"names":[],"mappings":";;AAqGA,4BA4GC;;AAjND,wCAAyE;AACzE,6CAA6E;AAC7E,+DAA4D;AAC5D,uCAWoB;AACpB,uCAAoC;AACpC,6BAA6B;AAG7B,S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,EAAE,CAAC;YACtH,MAAM,aAAa,GAAG,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,WAAW,0BAA0B,CAAC,0CAAE,QAAQ,EAAE,mCAAI,EAAE,CAAC;YAC9G,MAAM,aAAa,GAAG,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,WAAW,0BAA0B,CAAC,0CAAE,QAAQ,EAAE,mCAAI,EAAE,CAAC;YAC9G,MAAM,IAAA,kCAA0B,EAAC,MAAM,IAAA,oBAAY,EACjD,iBAAiB,CAAC,IAAI,CAAC,mBAAmB,EAC1C,WAAW,EACX;gBACE,WAAW,EAAE,iBAAiB,CAAC,WAAW;gBAC1C,WAAW,EAAE,WAAW;gBACxB,MAAM,EAAE,iBAAiB,CAAC,IAAI,CAAC,MAAM;gBACrC,aAAa,EAAE,+BAAc;gBAC7B,aAAa,EAAE;oBACb,iBAAiB,EAAE,KAAK;oBACxB,cAAc,EAAE,OAAO;oBACvB,iCAAiC,EAAE,aAAa;oBAChD,yBAAyB,EAAE,aAAa;oBACxC,yBAAyB,EAAE,aAAa;iBACzC;aACF,EACD,IAAI,EACJ,iBAAiB,CAAC,WAAW,CAC9B,CAAC,CAAC;QACL,CAAC;QAED,MAAM,IAAA,2BAAmB,EAAC,IAAI,kCACzB,iBAAiB,KACpB,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,iBAAiB,CAAC,WAAW,IACtC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC;CAAA"}
|
|
@@ -5,7 +5,11 @@ export interface Schema {
|
|
|
5
5
|
name: string;
|
|
6
6
|
env: EnvironmentName;
|
|
7
7
|
accessToken?: string;
|
|
8
|
+
tenant?: string;
|
|
9
|
+
tenantRealm?: string;
|
|
8
10
|
proxy?: NginxProxyConfiguration | NginxProxyConfiguration[];
|
|
11
|
+
/** When true, skip the agent interaction. Used by composite generators that run the agent themselves. */
|
|
12
|
+
skipAgent?: boolean;
|
|
9
13
|
}
|
|
10
14
|
|
|
11
15
|
export interface NormalizedSchema extends Schema {
|
|
@@ -31,6 +31,16 @@
|
|
|
31
31
|
]
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
|
+
"tenant": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"description": "ADSP tenant name. Looks up the tenant realm and opens a single browser login, avoiding a separate interactive tenant selection.",
|
|
37
|
+
"alias": "t"
|
|
38
|
+
},
|
|
39
|
+
"tenantRealm": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"description": "Keycloak realm UUID. Optional when --tenant is provided — overrides the realm looked up from the tenant service.",
|
|
42
|
+
"alias": "tr"
|
|
43
|
+
},
|
|
34
44
|
"accessToken": {
|
|
35
45
|
"type": "string",
|
|
36
46
|
"description": "Access token for retrieving configuration from ADSP APIs.",
|
package/src/utils/agent.d.ts
CHANGED
|
@@ -14,21 +14,51 @@ export interface CapabilitySpec {
|
|
|
14
14
|
*/
|
|
15
15
|
export interface AgentResult {
|
|
16
16
|
filesWritten: number;
|
|
17
|
+
/** True when the user was in an active conversation before it ended. */
|
|
18
|
+
userInteracted: boolean;
|
|
19
|
+
/** True when the conversation ended via Ctrl+C (SIGINT). */
|
|
20
|
+
interrupted?: boolean;
|
|
17
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* After a consultAgent call, check whether the user interrupted before any
|
|
24
|
+
* files were generated and confirm they still want to proceed with the base
|
|
25
|
+
* scaffolding. Throws if the user declines, which aborts the Nx Tree commit.
|
|
26
|
+
*/
|
|
27
|
+
export declare function confirmAfterAgentInterrupt(result: AgentResult | null): Promise<void>;
|
|
18
28
|
/**
|
|
19
29
|
* Connect to the ADSP agent-service and conduct a multi-turn conversation
|
|
20
30
|
* with the nx-adsp-agent. The agent uses its workspace tools to write
|
|
21
31
|
* generated and modified files; this function retrieves the workspace state
|
|
22
32
|
* after the conversation and applies all files to the Nx Tree.
|
|
23
33
|
*
|
|
34
|
+
* The socket connection and file upload start immediately. While the files
|
|
35
|
+
* are uploading, the developer is prompted for a brief project description.
|
|
36
|
+
* The initial message is sent as soon as both the upload and the description
|
|
37
|
+
* are ready — whichever finishes last.
|
|
38
|
+
*
|
|
24
39
|
* Returns null if agent-service is unavailable — callers should skip the
|
|
25
40
|
* agent step gracefully in that case.
|
|
26
41
|
*/
|
|
27
42
|
export declare function consultAgent(directoryServiceUrl: string, accessToken: string, projectContext: {
|
|
28
43
|
projectName: string;
|
|
29
|
-
projectType: 'express-service' | 'react-app' | 'angular-app';
|
|
44
|
+
projectType: 'express-service' | 'react-app' | 'angular-app' | 'mern' | 'mean';
|
|
30
45
|
tenant: string;
|
|
31
46
|
pluginVersion: string;
|
|
32
47
|
/** Content of key integration files for the agent to read and potentially modify. */
|
|
33
48
|
existingFiles: Record<string, string>;
|
|
34
|
-
}, host: Tree, projectRoot: string
|
|
49
|
+
}, host: Tree, projectRoot: string, options?: {
|
|
50
|
+
/** Thread ID to use. When omitted a new UUID is generated. */
|
|
51
|
+
threadId?: string;
|
|
52
|
+
/**
|
|
53
|
+
* When true, skip the description prompt and send a continuation message instead,
|
|
54
|
+
* letting the agent carry context from a prior interaction on the same thread.
|
|
55
|
+
*/
|
|
56
|
+
isContinuation?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Additional project roots for composite generators (mern, mean).
|
|
59
|
+
* Files whose paths start with a given prefix are written to the mapped root
|
|
60
|
+
* rather than projectRoot. E.g. { 'app': '/path/to/my-app' } routes any
|
|
61
|
+
* workspace file beginning with 'app/' to that root (with the prefix stripped).
|
|
62
|
+
*/
|
|
63
|
+
additionalRoots?: Record<string, string>;
|
|
64
|
+
}): Promise<AgentResult | null>;
|