@ibgib/web-gib 0.0.23 → 0.0.25
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/AUTO-GENERATED-version.d.mts +14 -0
- package/dist/AUTO-GENERATED-version.d.mts.map +1 -0
- package/dist/AUTO-GENERATED-version.mjs +14 -0
- package/dist/AUTO-GENERATED-version.mjs.map +1 -0
- package/package.json +4 -1
- package/src/AUTO-GENERATED-version.mts +14 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/SKILL.md +81 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/generate-id.js +9 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/templates/bootstrap.mts.template +58 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/templates/constants.mts.template +75 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/templates/declarations.d.ts.template +9 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/templates/helpers.web.mts.template +199 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/templates/index.html.template +65 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/templates/index.mts.template +61 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/templates/types.mts.template +128 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/SKILL.md +59 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/templates/api/function-infos.web.mts.template +11 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/templates/witness/app/app-v1.mts.template +124 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/templates/witness/app/constants.mts.template +48 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/templates/witness/app/helper.mts.template +72 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/templates/witness/app/types.mts.template +38 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-component/SKILL.md +36 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-component/templates/components/component-name/component.css.template +26 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-component/templates/components/component-name/component.html.template +6 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-component/templates/components/component-name/component.mts.template +131 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-shell/SKILL.md +34 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-shell/templates/ui/shell/shell-constants.mts.template +10 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-shell/templates/ui/shell/shell-service.mts.template +139 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-create-shell/templates/ui/shell/shell-types.mts.template +6 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-enum-pattern/SKILL.md +153 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-get-pattern/SKILL.md +92 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-scaffold-app/SKILL.md +42 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-targeted-refactoring/SKILL.md +84 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-targeted-refactoring/generate-id.js +9 -0
- package/tools/copy-agent-skills.js +51 -0
- package/{generate-version-file.js → tools/generate-version-file.js} +1 -1
- package/tools/init-agents.js +28 -14
package/tools/auto-generated-agent-skills/skills/ibgib-add-core-engine/templates/types.mts.template
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { CommentData_V1 } from "@ibgib/core-gib/dist/common/comment/comment-types.mjs";
|
|
2
|
+
import { MetaspaceService } from "@ibgib/core-gib/dist/witness/space/metaspace/metaspace-types.mjs";
|
|
3
|
+
import { RCLIArgInfo } from "@ibgib/helper-gib/dist/rcli/rcli-types.mjs";
|
|
4
|
+
import { IbGibRel8ns_V1, IbGib_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
5
|
+
import { LiveProxyIbGib } from "@ibgib/web-gib/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mjs";
|
|
6
|
+
import { IbGibGlobalThisInfo } from "@ibgib/web-gib/dist/types.mjs";
|
|
7
|
+
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// App-level ambient context config
|
|
10
|
+
//
|
|
11
|
+
// NOTE: This interface is intentionally agnostic to pulmoniq or any other
|
|
12
|
+
// domain. It should eventually be upstreamed into @ibgib/web-gib.
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Configuration for the application's global state and storage substrates.
|
|
17
|
+
*/
|
|
18
|
+
export interface IbGibAmbientContextConfig {
|
|
19
|
+
/** Target IndexedDB database name */
|
|
20
|
+
dbName: string;
|
|
21
|
+
/** Primary object store name */
|
|
22
|
+
storeName: string;
|
|
23
|
+
/** Additional stores that need to be initialized (e.g., zero space ID) */
|
|
24
|
+
additionalStoreNames?: string[];
|
|
25
|
+
/** The IndexedDB key under which the AI API key is persisted */
|
|
26
|
+
apiKeyName: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
// Bootstrap request comment (RCLI plumbing)
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
|
|
33
|
+
export interface RequestCommentData_V1 extends CommentData_V1 {
|
|
34
|
+
args: string[];
|
|
35
|
+
interpretedArgInfos: RCLIArgInfo[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface RequestCommentRel8ns_V1 extends IbGibRel8ns_V1 {}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Special Comment that acts as a "request" — the command analog from RCLI.
|
|
42
|
+
*/
|
|
43
|
+
export interface RequestCommentIbGib_V1
|
|
44
|
+
extends IbGib_V1<RequestCommentData_V1, RequestCommentRel8ns_V1> {
|
|
45
|
+
oneOff: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
// Space shim (RCLI pathing compat)
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
|
|
52
|
+
export interface SpaceShimGlobalInfo {
|
|
53
|
+
initialCwd: string;
|
|
54
|
+
cwd: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
// Identity (optional — only populate if the app uses identity)
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Framework-level identity interface.
|
|
63
|
+
*
|
|
64
|
+
* ## notes
|
|
65
|
+
*
|
|
66
|
+
* The implementation is entirely consumer-supplied. The framework only defines
|
|
67
|
+
* the shape of the slot so that shells and components can react to auth state
|
|
68
|
+
* without being coupled to a specific identity mechanism.
|
|
69
|
+
*
|
|
70
|
+
* For ibgib apps, the typical implementation will be keystone-based (a
|
|
71
|
+
* Merkle DAG proof of identity), not token-based.
|
|
72
|
+
*/
|
|
73
|
+
export interface IbGibIdentityContext {
|
|
74
|
+
/** Whether identity resolution has completed (does not imply authenticated). */
|
|
75
|
+
resolved: boolean;
|
|
76
|
+
/** Whether the user has a verified identity in this session. */
|
|
77
|
+
authenticated: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* App-specific identity payload.
|
|
80
|
+
* For ibgib: typically includes keystoneAddr, userIbGibAddr, etc.
|
|
81
|
+
*/
|
|
82
|
+
data?: Record<string, any>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// ---------------------------------------------------------------------------
|
|
86
|
+
// GlobalThis state
|
|
87
|
+
// ---------------------------------------------------------------------------
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Base layer: fields shared across ALL ibgib web apps.
|
|
91
|
+
*
|
|
92
|
+
* NOTE: This is a superset of IbGibGlobalThisInfo from @ibgib/web-gib.
|
|
93
|
+
* Intended to be upstreamed eventually.
|
|
94
|
+
*/
|
|
95
|
+
export interface IbGibGlobalThis_Common extends IbGibGlobalThisInfo {
|
|
96
|
+
bootstrapStarted?: boolean;
|
|
97
|
+
bootstrapPromise?: Promise<void>;
|
|
98
|
+
chronologysComponent?: any;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Mid-layer: fields shared by any app that uses the ibgib App witness pattern.
|
|
103
|
+
*
|
|
104
|
+
* NOTE: Intended to be upstreamed into @ibgib/web-gib as IbGibGlobalThis_IbGibApp.
|
|
105
|
+
*/
|
|
106
|
+
export interface IbGibGlobalThis_IbGibApp extends IbGibGlobalThis_Common {
|
|
107
|
+
version?: string;
|
|
108
|
+
spaceShim: { [spaceId: string]: SpaceShimGlobalInfo };
|
|
109
|
+
verbose?: boolean;
|
|
110
|
+
fnDefaultGetAPIKey: () => Promise<string>;
|
|
111
|
+
initialCommentIbGib?: IbGib_V1;
|
|
112
|
+
initialCommentIbGibProxy?: LiveProxyIbGib;
|
|
113
|
+
/**
|
|
114
|
+
* Optional. Populated by the consumer's resolveIdentity() callback.
|
|
115
|
+
* Undefined = identity not configured. Null = unresolved/unauthenticated.
|
|
116
|
+
*/
|
|
117
|
+
identity?: IbGibIdentityContext | null;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// ---------------------------------------------------------------------------
|
|
121
|
+
// App-specific globalThis — add only what this app uniquely needs below
|
|
122
|
+
// ---------------------------------------------------------------------------
|
|
123
|
+
|
|
124
|
+
export interface IbGibGlobalThis_{{APP_CLASSNAME_PREFIX}} extends IbGibGlobalThis_IbGibApp {
|
|
125
|
+
{{APP_VAR_NAME}}ShellSvc?: any;
|
|
126
|
+
// TODO: add app-specific singleton references here, e.g.:
|
|
127
|
+
// currentModuleAddr?: string;
|
|
128
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ibgib-create-app-witness
|
|
3
|
+
description: >
|
|
4
|
+
Scaffolds the App Witness (engine) logic for an ibgib application.
|
|
5
|
+
Generates the core business logic files including the App class,
|
|
6
|
+
constants, helpers, and types.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Skill: ibgib-create-app-witness
|
|
10
|
+
|
|
11
|
+
## What This Skill Does
|
|
12
|
+
|
|
13
|
+
Generates the "Brain" of an ibgib app. In ibgib architecture, the App Witness is a class that reacts to "Request Comments" (commands) sent by the user or-other agents.
|
|
14
|
+
|
|
15
|
+
This skill scaffolds:
|
|
16
|
+
- **App Class**: Inherits from `AppBase_V1` and handles the initial `--interactive` request to boot the app.
|
|
17
|
+
- **App Constants**: Defines `PARAM_INFOS` and the app's internal command set.
|
|
18
|
+
- **App Helpers**: boilerplate for creating request comments and validating parameters.
|
|
19
|
+
- **App Types**: Data and Relationship structures unique to this app.
|
|
20
|
+
- **API Registration**: Plumbing to register core app functions with the ibgib runtime.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Token Reference
|
|
25
|
+
|
|
26
|
+
| Token | Example value | How it's computed |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| `{{APP_DIR_NAME}}` | `test-app` | kebab-case name of the app |
|
|
29
|
+
| `{{APP_CLASSNAME_PREFIX}}` | `TestApp` | PascalCase, no suffix |
|
|
30
|
+
| `{{APP_CLASSNAME}}` | `TestAppApp_V1` | PascalCase + `App_V1` |
|
|
31
|
+
| `{{APP_NAME_UPPER}}` | `TEST_APP` | Uppercase + underscores |
|
|
32
|
+
| `{{APP_UUID}}` | `8d6217327e6490650169be9cb22a0b25` | Use the SAME UUID as in the core-engine. |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Generation Steps
|
|
37
|
+
|
|
38
|
+
### 1. Confirm Tokens
|
|
39
|
+
Ensure you have the same tokens used in `ibgib-add-core-engine`.
|
|
40
|
+
|
|
41
|
+
### 2. Generate Files
|
|
42
|
+
Apply substitutions to templates and write to the target directory (usually `src/`).
|
|
43
|
+
|
|
44
|
+
| Template file | Output file |
|
|
45
|
+
|---|---|
|
|
46
|
+
| `templates/witness/app/app-v1.mts.template` | `witness/app/{{APP_DIR_NAME}}/{{APP_DIR_NAME}}-app-v1.mts` |
|
|
47
|
+
| `templates/witness/app/constants.mts.template` | `witness/app/{{APP_DIR_NAME}}/{{APP_DIR_NAME}}-constants.mts` |
|
|
48
|
+
| `templates/witness/app/helper.mts.template` | `witness/app/{{APP_DIR_NAME}}/{{APP_DIR_NAME}}-helper.mts` |
|
|
49
|
+
| `templates/witness/app/types.mts.template` | `witness/app/{{APP_DIR_NAME}}/{{APP_DIR_NAME}}-types.mts` |
|
|
50
|
+
| `templates/api/function-infos.web.mts.template` | `api/function-infos.web.mts` |
|
|
51
|
+
|
|
52
|
+
### 3. Replace `genuuid` placeholders
|
|
53
|
+
Replace all `genuuid` strings in the templates with fresh IDs from `generate-id.js`.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Reference Implementations
|
|
58
|
+
- `apps/learning/src/witness/app/pulmoniq-learning/` — Historical reference for full-featured witnesses.
|
|
59
|
+
- `apps/website/src/witness/app/pulmoniq-website/` — Historical reference for shell-service witnesses.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module function-infos.web
|
|
3
|
+
*
|
|
4
|
+
* Logic to register app-specific functions with the ibgib runtime.
|
|
5
|
+
* Useful for exposing functionality to the Agent/AI layer.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export function registerDeprecatedFunctionNamesAndFunctionInfos_Web(): void {
|
|
9
|
+
// Boilerplate for future API registrations.
|
|
10
|
+
// console.log("Registering app functions... (I: genuuid)");
|
|
11
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {
|
|
2
|
+
extractErrorMsg, pretty,
|
|
3
|
+
} from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
4
|
+
import { IbGibAddr, Ib, TransformResult } from '@ibgib/ts-gib/dist/types.mjs';
|
|
5
|
+
import { IbGib_V1, IbGibRel8ns_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
|
|
6
|
+
import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
|
|
7
|
+
import { Factory_V1 as factory } from '@ibgib/ts-gib/dist/V1/factory.mjs';
|
|
8
|
+
import { AppBase_V1 } from '@ibgib/core-gib/dist/witness/app/app-base-v1.mjs';
|
|
9
|
+
import { WITNESS_CONTEXT_REL8N_NAME } from '@ibgib/core-gib/dist/witness/witness-constants.mjs';
|
|
10
|
+
import { ROOT } from '@ibgib/ts-gib/dist/V1/constants.mjs';
|
|
11
|
+
|
|
12
|
+
import { GLOBAL_LOG_A_LOT, APP_CONFIG } from '../../../constants.mjs';
|
|
13
|
+
import {
|
|
14
|
+
{{APP_CLASSNAME}}Data_V1, {{APP_CLASSNAME}}Rel8ns_V1, {{APP_CLASSNAME}}IbGib_V1,
|
|
15
|
+
} from './{{APP_DIR_NAME}}-types.mjs';
|
|
16
|
+
import {
|
|
17
|
+
isRequestComment,
|
|
18
|
+
} from './{{APP_DIR_NAME}}-helper.mjs';
|
|
19
|
+
import { PARAM_INFO_INTERACTIVE, {{APP_CLASSNAME_PREFIX}}Command } from './{{APP_DIR_NAME}}-constants.mjs';
|
|
20
|
+
import { RequestCommentData_V1, RequestCommentIbGib_V1 } from '../../../types.mjs';
|
|
21
|
+
|
|
22
|
+
const logalot = GLOBAL_LOG_A_LOT;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The App Witness for {{APP_HUMAN_NAME}}.
|
|
26
|
+
* Handles user requests and coordinates the app's internal state.
|
|
27
|
+
*/
|
|
28
|
+
export class {{APP_CLASSNAME}} extends AppBase_V1<
|
|
29
|
+
// in
|
|
30
|
+
any, IbGibRel8ns_V1, IbGib_V1<any, IbGibRel8ns_V1>,
|
|
31
|
+
// out
|
|
32
|
+
any, IbGibRel8ns_V1, IbGib_V1<any, IbGibRel8ns_V1>,
|
|
33
|
+
// this
|
|
34
|
+
{{APP_CLASSNAME}}Data_V1, {{APP_CLASSNAME}}Rel8ns_V1
|
|
35
|
+
> implements {{APP_CLASSNAME}}IbGib_V1 {
|
|
36
|
+
protected lc: string = `[{{APP_CLASSNAME}}]`;
|
|
37
|
+
|
|
38
|
+
constructor(initialData?: {{APP_CLASSNAME}}Data_V1, initialRel8ns?: {{APP_CLASSNAME}}Rel8ns_V1) {
|
|
39
|
+
super(initialData, initialRel8ns);
|
|
40
|
+
const lc = `${this.lc}[ctor]`;
|
|
41
|
+
try {
|
|
42
|
+
if (logalot) { console.log(`${lc} starting... (I: genuuid)`); }
|
|
43
|
+
this.initialized = this.initialize();
|
|
44
|
+
} catch (error) {
|
|
45
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
46
|
+
throw error;
|
|
47
|
+
} finally {
|
|
48
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Overridden to handle Request comments (commands).
|
|
54
|
+
*/
|
|
55
|
+
protected async doNonArg({
|
|
56
|
+
ibGib,
|
|
57
|
+
}: {
|
|
58
|
+
ibGib: IbGib_V1,
|
|
59
|
+
}): Promise<IbGib_V1 | undefined> {
|
|
60
|
+
const lc = `${this.lc}[${this.doNonArg.name}]`;
|
|
61
|
+
try {
|
|
62
|
+
if (logalot) { console.log(`${lc} starting... (I: genuuid)`); }
|
|
63
|
+
|
|
64
|
+
if (isRequestComment({ ibGib })) {
|
|
65
|
+
return await this.doContextRequestComment({
|
|
66
|
+
requestCommentIbGib: ibGib as RequestCommentIbGib_V1
|
|
67
|
+
});
|
|
68
|
+
} else {
|
|
69
|
+
return await super.doNonArg({ ibGib });
|
|
70
|
+
}
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
73
|
+
throw error;
|
|
74
|
+
} finally {
|
|
75
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Handles the initial bootstrap request or any subsequent command request.
|
|
81
|
+
*/
|
|
82
|
+
protected async doContextRequestComment({
|
|
83
|
+
requestCommentIbGib
|
|
84
|
+
}: {
|
|
85
|
+
requestCommentIbGib: RequestCommentIbGib_V1
|
|
86
|
+
}): Promise<IbGib_V1> {
|
|
87
|
+
const lc = `${this.lc}[${this.doContextRequestComment.name}]`;
|
|
88
|
+
try {
|
|
89
|
+
if (logalot) { console.log(`${lc} starting... (I: genuuid)`); }
|
|
90
|
+
if (logalot) { console.log(`${lc} request: ${pretty(requestCommentIbGib.data)} (I: genuuid)`); }
|
|
91
|
+
|
|
92
|
+
const { interpretedArgInfos } = requestCommentIbGib.data!;
|
|
93
|
+
|
|
94
|
+
// Handle the initial --interactive bootstrap request
|
|
95
|
+
if (interpretedArgInfos.some(x => x.name === PARAM_INFO_INTERACTIVE.name)) {
|
|
96
|
+
await this.initializeContext({
|
|
97
|
+
contextIbGib: requestCommentIbGib,
|
|
98
|
+
rel8nName: WITNESS_CONTEXT_REL8N_NAME,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
console.log(`${this.lc} {{APP_HUMAN_NAME}} initialized and ready. (I: genuuid)`);
|
|
102
|
+
} else {
|
|
103
|
+
console.warn(`${lc} other requests not implemented yet. (W: genuuid)`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return ROOT;
|
|
107
|
+
} catch (error) {
|
|
108
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
109
|
+
throw error;
|
|
110
|
+
} finally {
|
|
111
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
protected parseAddlMetadataString<TParseResult>({ ib }: { ib: Ib }): TParseResult {
|
|
116
|
+
return {} as TParseResult;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Stub factory for app witness creation.
|
|
122
|
+
*/
|
|
123
|
+
export const {{APP_CLASSNAME}}_Factory = {
|
|
124
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { RCLIParamInfo } from "@ibgib/helper-gib/dist/rcli/rcli-types.mjs";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Command literal for the app.
|
|
5
|
+
*/
|
|
6
|
+
export type {{APP_CLASSNAME_PREFIX}}Command = 'help' | 'init' | 'quit';
|
|
7
|
+
|
|
8
|
+
export const {{APP_CLASSNAME_PREFIX}}Command = {
|
|
9
|
+
help: 'help' as {{APP_CLASSNAME_PREFIX}}Command,
|
|
10
|
+
init: 'init' as {{APP_CLASSNAME_PREFIX}}Command,
|
|
11
|
+
quit: 'quit' as {{APP_CLASSNAME_PREFIX}}Command,
|
|
12
|
+
} satisfies { [key: string]: {{APP_CLASSNAME_PREFIX}}Command };
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Commands identifiers (including synonyms).
|
|
16
|
+
*/
|
|
17
|
+
export const RCLI_COMMAND_IDENTIFIERS: string[] = [
|
|
18
|
+
...Object.values({{APP_CLASSNAME_PREFIX}}Command),
|
|
19
|
+
'h', 'exit', 'q'
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Parameter info for the interactive bootstrap.
|
|
24
|
+
*/
|
|
25
|
+
export const PARAM_INFO_INTERACTIVE: RCLIParamInfo = {
|
|
26
|
+
name: 'interactive',
|
|
27
|
+
isFlag: true,
|
|
28
|
+
argTypeName: 'boolean',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Full parameter info list for command parsing.
|
|
33
|
+
*/
|
|
34
|
+
export const PARAM_INFOS: RCLIParamInfo[] = [
|
|
35
|
+
PARAM_INFO_INTERACTIVE,
|
|
36
|
+
{
|
|
37
|
+
name: 'help',
|
|
38
|
+
isFlag: true,
|
|
39
|
+
argTypeName: 'boolean',
|
|
40
|
+
synonyms: ['h'],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'quit',
|
|
44
|
+
isFlag: true,
|
|
45
|
+
argTypeName: 'boolean',
|
|
46
|
+
synonyms: ['q', 'exit'],
|
|
47
|
+
}
|
|
48
|
+
];
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getTimestamp, getUUID,
|
|
3
|
+
} from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
4
|
+
import { RCLIArgInfo, RCLIParamInfo } from '@ibgib/helper-gib/dist/rcli/rcli-types.mjs';
|
|
5
|
+
import { Factory_V1 as factory } from '@ibgib/ts-gib/dist/V1/factory.mjs';
|
|
6
|
+
import { TransformResult } from '@ibgib/ts-gib/dist/types.mjs';
|
|
7
|
+
import { isComment } from '@ibgib/core-gib/dist/common/comment/comment-helper.mjs';
|
|
8
|
+
import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
|
|
9
|
+
|
|
10
|
+
import { RequestCommentData_V1, RequestCommentIbGib_V1 } from '../../../types.mjs';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Validates that no duplicate parameter identifiers exist in the config.
|
|
14
|
+
*/
|
|
15
|
+
export function validateParamInfos({ paramInfos }: { paramInfos: RCLIParamInfo[] }): string[] {
|
|
16
|
+
const errors: string[] = [];
|
|
17
|
+
const identifiers: string[] = [];
|
|
18
|
+
paramInfos.forEach(p => {
|
|
19
|
+
const names = [p.name, ...(p.synonyms ?? [])];
|
|
20
|
+
names.forEach(name => {
|
|
21
|
+
if (identifiers.includes(name.toLowerCase())) {
|
|
22
|
+
errors.push(`Duplicate identifier found: ${name} (E: genuuid)`);
|
|
23
|
+
}
|
|
24
|
+
identifiers.push(name.toLowerCase());
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return errors;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Minimal stub for arg validation.
|
|
32
|
+
*/
|
|
33
|
+
export function validateArgInfos({ argInfos }: { argInfos: RCLIArgInfo[] }): string | undefined {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Detects if an ibgib is a Request Comment (a command).
|
|
39
|
+
*/
|
|
40
|
+
export function isRequestComment({ ibGib }: { ibGib: IbGib_V1 }): boolean {
|
|
41
|
+
if (!isComment({ ibGib })) { return false; }
|
|
42
|
+
const data = ibGib.data as RequestCommentData_V1;
|
|
43
|
+
return !!(data?.args?.length && data?.interpretedArgInfos?.length);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Creates a Request Comment ibgib from raw arguments.
|
|
48
|
+
*/
|
|
49
|
+
export async function createRequestCommentIbGib({
|
|
50
|
+
args, interpretedArgInfos,
|
|
51
|
+
}: {
|
|
52
|
+
args: string[],
|
|
53
|
+
interpretedArgInfos: RCLIArgInfo[],
|
|
54
|
+
}): Promise<TransformResult<RequestCommentIbGib_V1>> {
|
|
55
|
+
const text = args.join(' ');
|
|
56
|
+
const data: RequestCommentData_V1 = {
|
|
57
|
+
uuid: await getUUID(),
|
|
58
|
+
text,
|
|
59
|
+
args,
|
|
60
|
+
interpretedArgInfos,
|
|
61
|
+
textTimestamp: getTimestamp(),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return await factory.firstGen({
|
|
65
|
+
parentIbGib: factory.primitive({ ib: 'comment' }),
|
|
66
|
+
ib: `comment ${text.substring(0, 32).replace(/ /g, '_')}`,
|
|
67
|
+
data,
|
|
68
|
+
dna: true,
|
|
69
|
+
tjp: { uuid: true, timestamp: true },
|
|
70
|
+
nCounter: true,
|
|
71
|
+
}) as TransformResult<RequestCommentIbGib_V1>;
|
|
72
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { IbGib_V1, IbGibRel8ns_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
2
|
+
import { AppIbGib_V1 } from "@ibgib/core-gib/dist/witness/app/app-types.mjs";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Data unique to the {{APP_HUMAN_NAME}} App witness.
|
|
6
|
+
*/
|
|
7
|
+
export interface {{APP_CLASSNAME}}Data_V1 extends AppData_V1 {
|
|
8
|
+
uuid: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
classname: string;
|
|
12
|
+
version: string;
|
|
13
|
+
icon: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const DEFAULT_{{APP_NAME_UPPER}}_APP_DATA_V1: {{APP_CLASSNAME}}Data_V1 = {
|
|
17
|
+
uuid: '',
|
|
18
|
+
name: '{{APP_DIR_NAME}}',
|
|
19
|
+
description: '{{APP_HUMAN_NAME}} witness',
|
|
20
|
+
classname: '{{APP_CLASSNAME}}',
|
|
21
|
+
version: '0.0.1',
|
|
22
|
+
icon: 'apps-outline',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const DEFAULT_{{APP_NAME_UPPER}}_APP_REL8NS_V1: {{APP_CLASSNAME}}Rel8ns_V1 | undefined = undefined;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Relationships unique to the {{APP_HUMAN_NAME}} App witness.
|
|
29
|
+
*/
|
|
30
|
+
export interface {{APP_CLASSNAME}}Rel8ns_V1 extends IbGibRel8ns_V1 {
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The full IbGib type for the {{APP_HUMAN_NAME}} App witness.
|
|
35
|
+
*/
|
|
36
|
+
export interface {{APP_CLASSNAME}}IbGib_V1
|
|
37
|
+
extends AppIbGib_V1<{{APP_CLASSNAME}}Data_V1, {{APP_CLASSNAME}}Rel8ns_V1> {
|
|
38
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ibgib-create-component
|
|
3
|
+
description: Scaffolds a new reusable ibgib UI component. Generates the component logic (Meta and Instance classes), HTML template, and CSS stylesheet.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ibgib-create-component
|
|
7
|
+
|
|
8
|
+
This skill scaffolds a new UI component for an ibgib application. components are implemented as Web Components (Custom Elements) using the `ibgib-web-gib` framework, which provides deep integration with ibgib timelines and real-time updates.
|
|
9
|
+
|
|
10
|
+
## Goal
|
|
11
|
+
To create a standard, reactive UI component that can be registered with the `ibgib-component-service` and rendered within an app shell.
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
Wait for the user to provide or confirm these tokens:
|
|
15
|
+
- `{{COMPONENT_NAME}}`: e.g. `test-component`
|
|
16
|
+
- `{{COMPONENT_TAG_NAME}}`: e.g. `test-app-test-component` (must be kebab-case and include a prefix)
|
|
17
|
+
- `{{COMPONENT_CLASS_PREFIX}}`: e.g. `Test`
|
|
18
|
+
- `{{APP_DIR_NAME}}`: e.g. `test-app`
|
|
19
|
+
- `{{APP_CLASS_PREFIX}}`: e.g. `TestApp` (for helper imports)
|
|
20
|
+
|
|
21
|
+
## Output Files
|
|
22
|
+
The skill will generate:
|
|
23
|
+
1. `src/components/{{COMPONENT_NAME}}/{{COMPONENT_NAME}}.mts`
|
|
24
|
+
2. `src/components/{{COMPONENT_NAME}}/{{COMPONENT_NAME}}.html`
|
|
25
|
+
3. `src/components/{{COMPONENT_NAME}}/{{COMPONENT_NAME}}.css`
|
|
26
|
+
|
|
27
|
+
## Usage Instructions
|
|
28
|
+
1. Ensure the `src/components/{{COMPONENT_NAME}}` directory exists.
|
|
29
|
+
2. Generate the files from templates.
|
|
30
|
+
3. Import and register the `{{COMPONENT_CLASS_PREFIX}}ComponentMeta` in your `ShellService`'s `registerComponents()` method.
|
|
31
|
+
|
|
32
|
+
## Component Lifecycle
|
|
33
|
+
- `initialize(opts)`: Called when the component is first given an ibGib address.
|
|
34
|
+
- `created()`: Called when the element is attached to the DOM. This is where you should query Shadow Root elements.
|
|
35
|
+
- `renderUI()`: Called to update the DOM based on the current `this.ibGib`.
|
|
36
|
+
- `handleContextUpdated()`: Called automatically when the observed ibgib timeline evolves.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.component-container {
|
|
9
|
+
padding: 1.5rem;
|
|
10
|
+
background: var(--glass-background, rgba(255, 255, 255, 0.1));
|
|
11
|
+
backdrop-filter: blur(10px);
|
|
12
|
+
border-radius: 1rem;
|
|
13
|
+
border: 1px solid var(--border-color, rgba(255, 255, 255, 0.2));
|
|
14
|
+
color: var(--text-color, #ffffff);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
h1 {
|
|
18
|
+
margin-top: 0;
|
|
19
|
+
font-size: 1.5rem;
|
|
20
|
+
color: var(--primary-color, #007aff);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.content {
|
|
24
|
+
margin-top: 1rem;
|
|
25
|
+
opacity: 0.8;
|
|
26
|
+
}
|